gantt-lib 0.84.0 → 0.85.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/README.md +2 -2
- package/dist/core/scheduling/index.d.mts +1 -1
- package/dist/core/scheduling/index.d.ts +1 -1
- package/dist/core/scheduling/index.js +32 -26
- package/dist/core/scheduling/index.js.map +1 -1
- package/dist/core/scheduling/index.mjs +31 -26
- package/dist/core/scheduling/index.mjs.map +1 -1
- package/dist/{index-DGOZyXZt.d.mts → index-BbdHmt1Q.d.mts} +7 -3
- package/dist/{index-DGOZyXZt.d.ts → index-BbdHmt1Q.d.ts} +7 -3
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +53 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -28
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +39 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -448,17 +448,27 @@ function normalizePredecessorDates(predecessor, parseDateFn) {
|
|
|
448
448
|
function getDependencyLag(dep) {
|
|
449
449
|
return Number.isFinite(dep.lag) ? dep.lag : 0;
|
|
450
450
|
}
|
|
451
|
+
function normalizeTaskDependencyLags(task) {
|
|
452
|
+
if (!task.dependencies?.length) {
|
|
453
|
+
return task;
|
|
454
|
+
}
|
|
455
|
+
let changed = false;
|
|
456
|
+
const dependencies = task.dependencies.map((dep) => {
|
|
457
|
+
const lag = getDependencyLag(dep);
|
|
458
|
+
const normalizedLag = dep.type === "FS" ? Math.max(0, lag) : lag;
|
|
459
|
+
if (normalizedLag === dep.lag) {
|
|
460
|
+
return dep;
|
|
461
|
+
}
|
|
462
|
+
changed = true;
|
|
463
|
+
return { ...dep, lag: normalizedLag };
|
|
464
|
+
});
|
|
465
|
+
return changed ? { ...task, dependencies } : task;
|
|
466
|
+
}
|
|
451
467
|
function normalizeDependencyLag(linkType, lag, predecessorStart, predecessorEnd, businessDays = false, weekendPredicate) {
|
|
452
468
|
if (linkType !== "FS") {
|
|
453
469
|
return lag;
|
|
454
470
|
}
|
|
455
|
-
|
|
456
|
-
predecessorStart,
|
|
457
|
-
predecessorEnd,
|
|
458
|
-
businessDays,
|
|
459
|
-
weekendPredicate
|
|
460
|
-
);
|
|
461
|
-
return Math.max(-predecessorDuration, lag);
|
|
471
|
+
return Math.max(0, lag);
|
|
462
472
|
}
|
|
463
473
|
function computeLagFromDates(linkType, predStart, predEnd, succStart, succEnd, businessDays = false, weekendPredicate) {
|
|
464
474
|
const pS = Date.UTC(predStart.getUTCFullYear(), predStart.getUTCMonth(), predStart.getUTCDate());
|
|
@@ -717,17 +727,11 @@ function clampTaskRangeForIncomingFS(task, proposedStart, proposedEnd, allTasks,
|
|
|
717
727
|
continue;
|
|
718
728
|
}
|
|
719
729
|
const { predStart: predecessorStart, predEnd: predecessorEnd } = normalizePredecessorDates(predecessor, parseDateOnly);
|
|
720
|
-
const predecessorDuration = getTaskDuration(
|
|
721
|
-
predecessorStart,
|
|
722
|
-
predecessorEnd,
|
|
723
|
-
businessDays,
|
|
724
|
-
weekendPredicate
|
|
725
|
-
);
|
|
726
730
|
const candidateMinStart = calculateSuccessorDate(
|
|
727
731
|
predecessorStart,
|
|
728
732
|
predecessorEnd,
|
|
729
733
|
"FS",
|
|
730
|
-
|
|
734
|
+
0,
|
|
731
735
|
businessDays,
|
|
732
736
|
weekendPredicate
|
|
733
737
|
);
|
|
@@ -838,11 +842,11 @@ function cascadeByLinks(movedTaskId, newStart, newEnd, allTasks, skipChildCascad
|
|
|
838
842
|
const newChildEnd = new Date(origEnd.getTime() + parentEndDelta);
|
|
839
843
|
visited.add(child.id);
|
|
840
844
|
updatedDates.set(child.id, { start: newChildStart, end: newChildEnd });
|
|
841
|
-
result.push({
|
|
845
|
+
result.push(normalizeTaskDependencyLags({
|
|
842
846
|
...child,
|
|
843
847
|
startDate: newChildStart.toISOString().split("T")[0],
|
|
844
848
|
endDate: newChildEnd.toISOString().split("T")[0]
|
|
845
|
-
});
|
|
849
|
+
}));
|
|
846
850
|
queue.push(child.id);
|
|
847
851
|
}
|
|
848
852
|
}
|
|
@@ -878,11 +882,11 @@ function cascadeByLinks(movedTaskId, newStart, newEnd, allTasks, skipChildCascad
|
|
|
878
882
|
}
|
|
879
883
|
visited.add(task.id);
|
|
880
884
|
updatedDates.set(task.id, { start: newSuccStart, end: newSuccEnd });
|
|
881
|
-
result.push({
|
|
885
|
+
result.push(normalizeTaskDependencyLags({
|
|
882
886
|
...task,
|
|
883
887
|
startDate: newSuccStart.toISOString().split("T")[0],
|
|
884
888
|
endDate: newSuccEnd.toISOString().split("T")[0]
|
|
885
|
-
});
|
|
889
|
+
}));
|
|
886
890
|
queue.push(task.id);
|
|
887
891
|
break;
|
|
888
892
|
}
|
|
@@ -937,11 +941,11 @@ function universalCascade(movedTask, newStart, newEnd, allTasks, businessDays =
|
|
|
937
941
|
const updatedDates = /* @__PURE__ */ new Map();
|
|
938
942
|
updatedDates.set(movedTask.id, { start: newStart, end: newEnd });
|
|
939
943
|
const resultMap = /* @__PURE__ */ new Map();
|
|
940
|
-
resultMap.set(movedTask.id, {
|
|
944
|
+
resultMap.set(movedTask.id, normalizeTaskDependencyLags({
|
|
941
945
|
...movedTask,
|
|
942
946
|
startDate: newStart.toISOString().split("T")[0],
|
|
943
947
|
endDate: newEnd.toISOString().split("T")[0]
|
|
944
|
-
});
|
|
948
|
+
}));
|
|
945
949
|
const queue = [[movedTask.id, "direct"]];
|
|
946
950
|
const childShifted = /* @__PURE__ */ new Set();
|
|
947
951
|
let iterations = 0;
|
|
@@ -987,11 +991,11 @@ function universalCascade(movedTask, newStart, newEnd, allTasks, businessDays =
|
|
|
987
991
|
updatedDates.set(child.id, { start: childNewStart, end: childNewEnd });
|
|
988
992
|
childShifted.add(child.id);
|
|
989
993
|
queue.push([child.id, "child-delta"]);
|
|
990
|
-
resultMap.set(child.id, {
|
|
994
|
+
resultMap.set(child.id, normalizeTaskDependencyLags({
|
|
991
995
|
...child,
|
|
992
996
|
startDate: childNewStart.toISOString().split("T")[0],
|
|
993
997
|
endDate: childNewEnd.toISOString().split("T")[0]
|
|
994
|
-
});
|
|
998
|
+
}));
|
|
995
999
|
}
|
|
996
1000
|
}
|
|
997
1001
|
const parentId = currentOriginal.parentId;
|
|
@@ -1009,11 +1013,11 @@ function universalCascade(movedTask, newStart, newEnd, allTasks, businessDays =
|
|
|
1009
1013
|
if (!prev || prev.start.getTime() !== minStart.getTime() || prev.end.getTime() !== maxEnd.getTime()) {
|
|
1010
1014
|
updatedDates.set(parentId, { start: minStart, end: maxEnd });
|
|
1011
1015
|
queue.push([parentId, "parent-recalc"]);
|
|
1012
|
-
resultMap.set(parentId, {
|
|
1016
|
+
resultMap.set(parentId, normalizeTaskDependencyLags({
|
|
1013
1017
|
...parent,
|
|
1014
1018
|
startDate: minStart.toISOString().split("T")[0],
|
|
1015
1019
|
endDate: maxEnd.toISOString().split("T")[0]
|
|
1016
|
-
});
|
|
1020
|
+
}));
|
|
1017
1021
|
}
|
|
1018
1022
|
}
|
|
1019
1023
|
}
|
|
@@ -1063,11 +1067,11 @@ function universalCascade(movedTask, newStart, newEnd, allTasks, businessDays =
|
|
|
1063
1067
|
}
|
|
1064
1068
|
updatedDates.set(task.id, { start: succNewStart, end: succNewEnd });
|
|
1065
1069
|
queue.push([task.id, "dependency"]);
|
|
1066
|
-
resultMap.set(task.id, {
|
|
1070
|
+
resultMap.set(task.id, normalizeTaskDependencyLags({
|
|
1067
1071
|
...task,
|
|
1068
1072
|
startDate: succNewStart.toISOString().split("T")[0],
|
|
1069
1073
|
endDate: succNewEnd.toISOString().split("T")[0]
|
|
1070
|
-
});
|
|
1074
|
+
}));
|
|
1071
1075
|
}
|
|
1072
1076
|
}
|
|
1073
1077
|
return Array.from(resultMap.values());
|
|
@@ -7794,6 +7798,13 @@ var ResourceTypeIcon = ({ type }) => {
|
|
|
7794
7798
|
/* @__PURE__ */ jsx15("path", { d: "M12 16h.01" })
|
|
7795
7799
|
] });
|
|
7796
7800
|
};
|
|
7801
|
+
function isInactiveResourceStatus(status) {
|
|
7802
|
+
return status?.trim().toLocaleLowerCase() === "inactive";
|
|
7803
|
+
}
|
|
7804
|
+
var ResourceStatusLockIcon = () => /* @__PURE__ */ jsxs12("svg", { className: "gantt-resourceTimeline-resourceStatusIcon", width: "12", height: "12", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
|
|
7805
|
+
/* @__PURE__ */ jsx15("rect", { x: "5", y: "11", width: "14", height: "10", rx: "2" }),
|
|
7806
|
+
/* @__PURE__ */ jsx15("path", { d: "M8 11V8a4 4 0 1 1 8 0v3" })
|
|
7807
|
+
] });
|
|
7797
7808
|
var ResourceHeader = ({
|
|
7798
7809
|
resource,
|
|
7799
7810
|
resourceId,
|
|
@@ -7823,6 +7834,7 @@ var ResourceHeader = ({
|
|
|
7823
7834
|
const type = resource.type ?? "\u0414\u0440\u0443\u0433\u043E\u0435";
|
|
7824
7835
|
const scope = resource.scope ?? "Project";
|
|
7825
7836
|
const scopeLabel = RESOURCE_SCOPE_LABELS[scope] ?? scope;
|
|
7837
|
+
const isInactive = isInactiveResourceStatus(resource.status);
|
|
7826
7838
|
const applyResourcePatch = useCallback7((patch) => {
|
|
7827
7839
|
onResourceChange?.({ ...resource, ...patch });
|
|
7828
7840
|
}, [onResourceChange, resource]);
|
|
@@ -7883,7 +7895,7 @@ var ResourceHeader = ({
|
|
|
7883
7895
|
return /* @__PURE__ */ jsxs12(
|
|
7884
7896
|
"div",
|
|
7885
7897
|
{
|
|
7886
|
-
className: `gantt-resourceTimeline-resourceHeader${menuOpen ? " gantt-resourceTimeline-resourceHeaderMenuOpen" : ""}`,
|
|
7898
|
+
className: `gantt-resourceTimeline-resourceHeader${menuOpen ? " gantt-resourceTimeline-resourceHeaderMenuOpen" : ""}${isInactive ? " gantt-resourceTimeline-resourceHeaderInactive" : ""}`,
|
|
7887
7899
|
"data-resource-row-id": resourceId,
|
|
7888
7900
|
style: {
|
|
7889
7901
|
height: `${height}px`,
|
|
@@ -7950,7 +7962,18 @@ var ResourceHeader = ({
|
|
|
7950
7962
|
onResourceNameClick?.(resourceId);
|
|
7951
7963
|
},
|
|
7952
7964
|
onDoubleClick: handleNameDoubleClick,
|
|
7953
|
-
children:
|
|
7965
|
+
children: /* @__PURE__ */ jsxs12("span", { className: "gantt-resourceTimeline-resourceNameContent", children: [
|
|
7966
|
+
isInactive && /* @__PURE__ */ jsx15(
|
|
7967
|
+
"span",
|
|
7968
|
+
{
|
|
7969
|
+
className: "gantt-resourceTimeline-resourceStatusMarker",
|
|
7970
|
+
"aria-label": `\u0420\u0435\u0441\u0443\u0440\u0441 ${resource.name} \u043D\u0435\u0430\u043A\u0442\u0438\u0432\u0435\u043D`,
|
|
7971
|
+
title: "\u041D\u0435\u0430\u043A\u0442\u0438\u0432\u0435\u043D",
|
|
7972
|
+
children: /* @__PURE__ */ jsx15(ResourceStatusLockIcon, {})
|
|
7973
|
+
}
|
|
7974
|
+
),
|
|
7975
|
+
/* @__PURE__ */ jsx15("span", { className: "gantt-resourceTimeline-resourceNameText", children: resource.name })
|
|
7976
|
+
] })
|
|
7954
7977
|
}
|
|
7955
7978
|
)
|
|
7956
7979
|
] }),
|
|
@@ -10015,6 +10038,7 @@ export {
|
|
|
10015
10038
|
normalizeHierarchyTasks,
|
|
10016
10039
|
normalizePredecessorDates,
|
|
10017
10040
|
normalizeTaskDates,
|
|
10041
|
+
normalizeTaskDependencyLags,
|
|
10018
10042
|
normalizeUTCDate,
|
|
10019
10043
|
not,
|
|
10020
10044
|
or,
|