gantt-lib 0.9.0 → 0.9.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 +21 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3981,31 +3981,29 @@ var GanttChart = (0, import_react13.forwardRef)(({
|
|
|
3981
3981
|
});
|
|
3982
3982
|
const additionalParentUpdates = [];
|
|
3983
3983
|
parentIdsToUpdate.forEach((parentId) => {
|
|
3984
|
+
const parentTask = tasks.find((t) => t.id === parentId);
|
|
3985
|
+
if (!parentTask) return;
|
|
3984
3986
|
if (parentId === updatedTask.id) {
|
|
3985
|
-
const
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3987
|
+
const newProgress2 = computeParentProgress(parentId, tasks.map((t) => changedTasks.get(t.id) ?? t));
|
|
3988
|
+
const parentInCascaded = cascadedTasks.find((t) => t.id === parentId);
|
|
3989
|
+
if (parentInCascaded) {
|
|
3990
|
+
parentInCascaded.progress = newProgress2;
|
|
3989
3991
|
}
|
|
3990
3992
|
return;
|
|
3991
3993
|
}
|
|
3992
|
-
const
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
progress: newProgress
|
|
4002
|
-
});
|
|
4003
|
-
}
|
|
3994
|
+
const tempTasks = tasks.map((t) => changedTasks.get(t.id) ?? t);
|
|
3995
|
+
const newDates = computeParentDates(parentId, tempTasks);
|
|
3996
|
+
const newProgress = computeParentProgress(parentId, tempTasks);
|
|
3997
|
+
additionalParentUpdates.push({
|
|
3998
|
+
...parentTask,
|
|
3999
|
+
startDate: newDates.startDate.toISOString().split("T")[0],
|
|
4000
|
+
endDate: newDates.endDate.toISOString().split("T")[0],
|
|
4001
|
+
progress: newProgress
|
|
4002
|
+
});
|
|
4004
4003
|
});
|
|
4005
4004
|
onTasksChange?.([...cascadedTasks, ...additionalParentUpdates]);
|
|
4006
|
-
onCascade?.(cascadedTasks);
|
|
4007
4005
|
}
|
|
4008
|
-
}, [tasks, onTasksChange, disableConstraints,
|
|
4006
|
+
}, [tasks, onTasksChange, disableConstraints, editingTaskId]);
|
|
4009
4007
|
const handleDelete = (0, import_react13.useCallback)((taskId) => {
|
|
4010
4008
|
const toDelete = /* @__PURE__ */ new Set([taskId]);
|
|
4011
4009
|
function collectDescendants(parentId) {
|
|
@@ -4129,7 +4127,10 @@ var GanttChart = (0, import_react13.forwardRef)(({
|
|
|
4129
4127
|
const tempTasks = tasks.map((t) => cascadeMap.get(t.id) ?? t);
|
|
4130
4128
|
if (parentId === draggedTaskId) {
|
|
4131
4129
|
const newProgress2 = computeParentProgress(parentId, tempTasks);
|
|
4132
|
-
|
|
4130
|
+
const parentInCascaded = cascadedTasks.find((t) => t.id === parentId);
|
|
4131
|
+
if (parentInCascaded) {
|
|
4132
|
+
parentInCascaded.progress = newProgress2;
|
|
4133
|
+
}
|
|
4133
4134
|
return;
|
|
4134
4135
|
}
|
|
4135
4136
|
const newDates = computeParentDates(parentId, tempTasks);
|
|
@@ -4142,8 +4143,7 @@ var GanttChart = (0, import_react13.forwardRef)(({
|
|
|
4142
4143
|
});
|
|
4143
4144
|
});
|
|
4144
4145
|
onTasksChange?.([...cascadedTasks, ...additionalParentUpdates]);
|
|
4145
|
-
|
|
4146
|
-
}, [tasks, onTasksChange, onCascade]);
|
|
4146
|
+
}, [tasks, onTasksChange]);
|
|
4147
4147
|
const handleTaskSelect = (0, import_react13.useCallback)((taskId) => {
|
|
4148
4148
|
setSelectedTaskId(taskId);
|
|
4149
4149
|
}, []);
|