gantt-task-react-v 1.6.5 → 1.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,5 +14,6 @@ export declare const useSelection: (taskToRowIndexMap: TaskToRowIndexMap, rowInd
|
|
|
14
14
|
selectTaskOnMouseDown: (taskId: string, event: MouseEvent) => void;
|
|
15
15
|
selectTasksFromLastSelected: (taskId: string) => void;
|
|
16
16
|
selectedIdsMirror: Readonly<Record<string, true>>;
|
|
17
|
+
selectedIdsRef: import("react").MutableRefObject<Readonly<Record<string, true>>>;
|
|
17
18
|
toggleTask: (taskId?: string | null, singleMode?: boolean) => void;
|
|
18
19
|
};
|
|
@@ -18289,12 +18289,13 @@ const useSelection = (taskToRowIndexMap, rowIndexToTaskMap, checkTaskIdExists, o
|
|
|
18289
18289
|
const [cutIdsMirror, setCutIdsMirror] = useState(initialValue);
|
|
18290
18290
|
const [copyIdsMirror, setCopyIdsMirror] = useState(initialValue);
|
|
18291
18291
|
const [selectedIdsMirror, setSelectedIdsMirror] = useState(initialValue);
|
|
18292
|
+
const selectedIdsRef = useRef(initialValue);
|
|
18292
18293
|
const lastSelectedIdRef = useRef(null);
|
|
18293
18294
|
const selectTask = useCallback((taskId) => {
|
|
18294
18295
|
setCutIdsMirror(initialValue);
|
|
18295
|
-
|
|
18296
|
-
|
|
18297
|
-
|
|
18296
|
+
const next = { [taskId]: true };
|
|
18297
|
+
setSelectedIdsMirror(next);
|
|
18298
|
+
selectedIdsRef.current = next;
|
|
18298
18299
|
lastSelectedIdRef.current = taskId;
|
|
18299
18300
|
}, []);
|
|
18300
18301
|
const toggleTask = useCallback(
|
|
@@ -18302,24 +18303,28 @@ const useSelection = (taskToRowIndexMap, rowIndexToTaskMap, checkTaskIdExists, o
|
|
|
18302
18303
|
setCutIdsMirror(initialValue);
|
|
18303
18304
|
setSelectedIdsMirror((prevValue) => {
|
|
18304
18305
|
if (!taskId) {
|
|
18306
|
+
selectedIdsRef.current = {};
|
|
18305
18307
|
return {};
|
|
18306
18308
|
}
|
|
18307
18309
|
if (singleMode) {
|
|
18308
|
-
|
|
18309
|
-
|
|
18310
|
-
|
|
18310
|
+
const next2 = { [taskId]: true };
|
|
18311
|
+
selectedIdsRef.current = next2;
|
|
18312
|
+
return next2;
|
|
18311
18313
|
}
|
|
18312
18314
|
if (prevValue[taskId]) {
|
|
18313
18315
|
const nextValue = {
|
|
18314
18316
|
...prevValue
|
|
18315
18317
|
};
|
|
18316
18318
|
delete nextValue[taskId];
|
|
18319
|
+
selectedIdsRef.current = nextValue;
|
|
18317
18320
|
return nextValue;
|
|
18318
18321
|
}
|
|
18319
|
-
|
|
18322
|
+
const next = {
|
|
18320
18323
|
...prevValue,
|
|
18321
18324
|
[taskId]: true
|
|
18322
18325
|
};
|
|
18326
|
+
selectedIdsRef.current = next;
|
|
18327
|
+
return next;
|
|
18323
18328
|
});
|
|
18324
18329
|
lastSelectedIdRef.current = taskId;
|
|
18325
18330
|
},
|
|
@@ -18444,6 +18449,7 @@ const useSelection = (taskToRowIndexMap, rowIndexToTaskMap, checkTaskIdExists, o
|
|
|
18444
18449
|
selectTaskOnMouseDown,
|
|
18445
18450
|
selectTasksFromLastSelected,
|
|
18446
18451
|
selectedIdsMirror,
|
|
18452
|
+
selectedIdsRef,
|
|
18447
18453
|
toggleTask
|
|
18448
18454
|
};
|
|
18449
18455
|
};
|
|
@@ -19989,7 +19995,8 @@ const Gantt = (props) => {
|
|
|
19989
19995
|
resetSelectedTasks,
|
|
19990
19996
|
selectTask,
|
|
19991
19997
|
selectTaskOnMouseDown,
|
|
19992
|
-
selectedIdsMirror
|
|
19998
|
+
selectedIdsMirror,
|
|
19999
|
+
selectedIdsRef
|
|
19993
20000
|
} = useSelection(
|
|
19994
20001
|
taskToRowIndexMap,
|
|
19995
20002
|
rowIndexToTaskMap,
|
|
@@ -20916,13 +20923,18 @@ const Gantt = (props) => {
|
|
|
20916
20923
|
}
|
|
20917
20924
|
return;
|
|
20918
20925
|
}
|
|
20919
|
-
|
|
20920
|
-
|
|
20926
|
+
if (selectedIdsRef.current[task.id]) {
|
|
20927
|
+
setActiveArrowKey(null);
|
|
20928
|
+
setActiveTaskId(task.id);
|
|
20929
|
+
} else {
|
|
20930
|
+
setActiveArrowKey(null);
|
|
20931
|
+
setActiveTaskId(null);
|
|
20932
|
+
}
|
|
20921
20933
|
if (taskBar.onClick) {
|
|
20922
20934
|
taskBar.onClick(task);
|
|
20923
20935
|
}
|
|
20924
20936
|
},
|
|
20925
|
-
[enableDrawer, drawerData, selectTask, taskBar]
|
|
20937
|
+
[enableDrawer, drawerData, selectTask, selectedIdsRef, taskBar]
|
|
20926
20938
|
);
|
|
20927
20939
|
const handleTaskDoubleClick = useCallback(
|
|
20928
20940
|
(task) => {
|
|
@@ -18306,12 +18306,13 @@
|
|
|
18306
18306
|
const [cutIdsMirror, setCutIdsMirror] = React.useState(initialValue);
|
|
18307
18307
|
const [copyIdsMirror, setCopyIdsMirror] = React.useState(initialValue);
|
|
18308
18308
|
const [selectedIdsMirror, setSelectedIdsMirror] = React.useState(initialValue);
|
|
18309
|
+
const selectedIdsRef = React.useRef(initialValue);
|
|
18309
18310
|
const lastSelectedIdRef = React.useRef(null);
|
|
18310
18311
|
const selectTask = React.useCallback((taskId) => {
|
|
18311
18312
|
setCutIdsMirror(initialValue);
|
|
18312
|
-
|
|
18313
|
-
|
|
18314
|
-
|
|
18313
|
+
const next = { [taskId]: true };
|
|
18314
|
+
setSelectedIdsMirror(next);
|
|
18315
|
+
selectedIdsRef.current = next;
|
|
18315
18316
|
lastSelectedIdRef.current = taskId;
|
|
18316
18317
|
}, []);
|
|
18317
18318
|
const toggleTask = React.useCallback(
|
|
@@ -18319,24 +18320,28 @@
|
|
|
18319
18320
|
setCutIdsMirror(initialValue);
|
|
18320
18321
|
setSelectedIdsMirror((prevValue) => {
|
|
18321
18322
|
if (!taskId) {
|
|
18323
|
+
selectedIdsRef.current = {};
|
|
18322
18324
|
return {};
|
|
18323
18325
|
}
|
|
18324
18326
|
if (singleMode) {
|
|
18325
|
-
|
|
18326
|
-
|
|
18327
|
-
|
|
18327
|
+
const next2 = { [taskId]: true };
|
|
18328
|
+
selectedIdsRef.current = next2;
|
|
18329
|
+
return next2;
|
|
18328
18330
|
}
|
|
18329
18331
|
if (prevValue[taskId]) {
|
|
18330
18332
|
const nextValue = {
|
|
18331
18333
|
...prevValue
|
|
18332
18334
|
};
|
|
18333
18335
|
delete nextValue[taskId];
|
|
18336
|
+
selectedIdsRef.current = nextValue;
|
|
18334
18337
|
return nextValue;
|
|
18335
18338
|
}
|
|
18336
|
-
|
|
18339
|
+
const next = {
|
|
18337
18340
|
...prevValue,
|
|
18338
18341
|
[taskId]: true
|
|
18339
18342
|
};
|
|
18343
|
+
selectedIdsRef.current = next;
|
|
18344
|
+
return next;
|
|
18340
18345
|
});
|
|
18341
18346
|
lastSelectedIdRef.current = taskId;
|
|
18342
18347
|
},
|
|
@@ -18461,6 +18466,7 @@
|
|
|
18461
18466
|
selectTaskOnMouseDown,
|
|
18462
18467
|
selectTasksFromLastSelected,
|
|
18463
18468
|
selectedIdsMirror,
|
|
18469
|
+
selectedIdsRef,
|
|
18464
18470
|
toggleTask
|
|
18465
18471
|
};
|
|
18466
18472
|
};
|
|
@@ -20006,7 +20012,8 @@
|
|
|
20006
20012
|
resetSelectedTasks,
|
|
20007
20013
|
selectTask,
|
|
20008
20014
|
selectTaskOnMouseDown,
|
|
20009
|
-
selectedIdsMirror
|
|
20015
|
+
selectedIdsMirror,
|
|
20016
|
+
selectedIdsRef
|
|
20010
20017
|
} = useSelection(
|
|
20011
20018
|
taskToRowIndexMap,
|
|
20012
20019
|
rowIndexToTaskMap,
|
|
@@ -20933,13 +20940,18 @@
|
|
|
20933
20940
|
}
|
|
20934
20941
|
return;
|
|
20935
20942
|
}
|
|
20936
|
-
|
|
20937
|
-
|
|
20943
|
+
if (selectedIdsRef.current[task.id]) {
|
|
20944
|
+
setActiveArrowKey(null);
|
|
20945
|
+
setActiveTaskId(task.id);
|
|
20946
|
+
} else {
|
|
20947
|
+
setActiveArrowKey(null);
|
|
20948
|
+
setActiveTaskId(null);
|
|
20949
|
+
}
|
|
20938
20950
|
if (taskBar.onClick) {
|
|
20939
20951
|
taskBar.onClick(task);
|
|
20940
20952
|
}
|
|
20941
20953
|
},
|
|
20942
|
-
[enableDrawer, drawerData, selectTask, taskBar]
|
|
20954
|
+
[enableDrawer, drawerData, selectTask, selectedIdsRef, taskBar]
|
|
20943
20955
|
);
|
|
20944
20956
|
const handleTaskDoubleClick = React.useCallback(
|
|
20945
20957
|
(task) => {
|
package/package.json
CHANGED