gantt-lib 0.134.0 → 0.134.1
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.
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3988,7 +3988,13 @@ var useTaskDrag = (options) => {
|
|
|
3988
3988
|
const rawHookTask = allTasks.find((t) => t.id === taskId);
|
|
3989
3989
|
const hookTask = rawHookTask ? normalizeTaskDatesForType(rawHookTask) : void 0;
|
|
3990
3990
|
const hookTaskIsMilestone = hookTask ? isMilestoneTask(hookTask) : false;
|
|
3991
|
+
const authoritativeStartTime = parseUTCDate(hookTask?.startDate ?? initialStartDate).getTime();
|
|
3992
|
+
const authoritativeEndTime = parseUTCDate(hookTask?.endDate ?? initialEndDate).getTime();
|
|
3991
3993
|
const isOwnerRef = (0, import_react2.useRef)(false);
|
|
3994
|
+
const authoritativeRangeRef = (0, import_react2.useRef)({
|
|
3995
|
+
start: authoritativeStartTime,
|
|
3996
|
+
end: authoritativeEndTime
|
|
3997
|
+
});
|
|
3992
3998
|
const effectiveLocked = locked || disableTaskDrag;
|
|
3993
3999
|
const [isDragging, setIsDragging] = (0, import_react2.useState)(false);
|
|
3994
4000
|
const [dragMode, setDragMode] = (0, import_react2.useState)(null);
|
|
@@ -4015,6 +4021,17 @@ var useTaskDrag = (options) => {
|
|
|
4015
4021
|
const width = Math.round((duration + 1) * dayWidth);
|
|
4016
4022
|
return { left, width };
|
|
4017
4023
|
}, [initialStartDate, initialEndDate, monthStart, dayWidth, hookTaskIsMilestone]);
|
|
4024
|
+
(0, import_react2.useEffect)(() => {
|
|
4025
|
+
const nextRange = {
|
|
4026
|
+
start: authoritativeStartTime,
|
|
4027
|
+
end: authoritativeEndTime
|
|
4028
|
+
};
|
|
4029
|
+
const previousRange = authoritativeRangeRef.current;
|
|
4030
|
+
authoritativeRangeRef.current = nextRange;
|
|
4031
|
+
if ((previousRange.start !== nextRange.start || previousRange.end !== nextRange.end) && isOwnerRef.current && globalActiveDrag?.taskId === taskId) {
|
|
4032
|
+
cancelDrag();
|
|
4033
|
+
}
|
|
4034
|
+
}, [authoritativeStartTime, authoritativeEndTime, taskId]);
|
|
4018
4035
|
(0, import_react2.useEffect)(() => {
|
|
4019
4036
|
if (isOwnerRef.current && globalActiveDrag) return;
|
|
4020
4037
|
const { left, width } = getInitialPosition();
|