Skip to content

Commit c3eb9c7

Browse files
committed
fix: bump react-selecto version
1 parent 5cecddf commit c3eb9c7

File tree

4 files changed

+383
-42
lines changed

4 files changed

+383
-42
lines changed

packages/react-moveable/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"react-dom": "^16.8.6",
112112
"react-infinite-viewer": "^0.19.1",
113113
"react-keycon": "^0.1.2",
114-
"react-selecto": "^1.20.2",
114+
"react-selecto": "^1.24.0",
115115
"storybook-addon-preview": "^2.3.0",
116116
"storybook-dark-mode": "^1.0.9",
117117
"ts-loader": "^8.3.0",
@@ -131,7 +131,8 @@
131131
"framework-utils": "^1.1.0",
132132
"gesto": "^1.19.0",
133133
"overlap-area": "^1.1.0",
134-
"react-css-styled": "^1.1.9"
134+
"react-css-styled": "^1.1.9",
135+
"react-selecto": "^1.25.0"
135136
},
136137
"browserslist": {
137138
"production": [

packages/react-moveable/src/gesto/getAbleGesto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export function checkMoveableTarget(moveable: MoveableManagerInterface) {
206206
const areaElement = moveable.areaElement;
207207
const dragTargetElement = (moveable as any)._dragTarget;
208208

209-
if (moveable.controlGesto?.isFlag()) {
209+
if (!dragTargetElement || moveable.controlGesto?.isFlag()) {
210210
return false;
211211
}
212212

packages/react-moveable/stories/9A-Components/ReactSelectoMultipleGroupUngroupApp.tsx

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,37 @@ export default function App() {
9494
) {
9595
e.stop();
9696
}
97+
e.data.startTargets = targets;
98+
}}
99+
onSelect={e => {
100+
const {
101+
startAdded,
102+
startRemoved,
103+
isDragStartEnd,
104+
} = e;
105+
106+
if (isDragStartEnd) {
107+
return;
108+
}
109+
const nextChilds = groupManager.selectSameDepthChilds(
110+
e.data.startTargets,
111+
startAdded,
112+
startRemoved,
113+
);
114+
115+
setSelectedTargets(nextChilds.targets());
97116
}}
98117
onSelectEnd={e => {
99118
const {
100-
isDragStart,
119+
isDragStartEnd,
101120
isClick,
102121
added,
103122
removed,
104123
inputEvent,
105124
} = e;
106125
const moveable = moveableRef.current!;
107126

108-
if (isDragStart) {
127+
if (isDragStartEnd) {
109128
inputEvent.preventDefault();
110129

111130
moveable.waitToChangeTarget().then(() => {
@@ -114,12 +133,11 @@ export default function App() {
114133
}
115134
let nextChilds: TargetList;
116135

117-
if (isDragStart || isClick) {
118-
nextChilds = groupManager.selectCompletedChilds(targets, added, removed);
136+
if (isDragStartEnd || isClick) {
137+
nextChilds = groupManager.selectCompletedChilds(e.data.startTargets, added, removed);
119138
} else {
120-
nextChilds = groupManager.selectSameDepthChilds(targets, added, removed);
139+
nextChilds = groupManager.selectSameDepthChilds(e.data.startTargets, added, removed);
121140
}
122-
123141
e.currentTarget.setSelectedTargets(nextChilds.flatten());
124142
setSelectedTargets(nextChilds.targets());
125143
}}

0 commit comments

Comments
 (0)