gantt-lib 0.124.2 → 0.126.0
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/core/scheduling/index.d.mts +1 -1
- package/dist/core/scheduling/index.d.ts +1 -1
- package/dist/core/scheduling/index.js +30 -19
- package/dist/core/scheduling/index.js.map +1 -1
- package/dist/core/scheduling/index.mjs +30 -19
- package/dist/core/scheduling/index.mjs.map +1 -1
- package/dist/{index-DD3YvhvA.d.mts → index-B1yy4LX0.d.mts} +15 -10
- package/dist/{index-DD3YvhvA.d.ts → index-B1yy4LX0.d.ts} +15 -10
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +64 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -32
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +0 -27
- package/package.json +1 -1
|
@@ -101,8 +101,7 @@ function getTaskDuration(startDate, endDate, businessDays = false, weekendPredic
|
|
|
101
101
|
// src/core/scheduling/dependencies.ts
|
|
102
102
|
function normalizePredecessorDates(predecessor, parseDateFn) {
|
|
103
103
|
const predStart = parseDateFn(predecessor.startDate);
|
|
104
|
-
const
|
|
105
|
-
const predEnd = isMilestone ? new Date(predStart.getTime() - DAY_MS) : parseDateFn(predecessor.endDate);
|
|
104
|
+
const predEnd = predecessor.type === "milestone" ? predStart : parseDateFn(predecessor.endDate);
|
|
106
105
|
return { predStart, predEnd };
|
|
107
106
|
}
|
|
108
107
|
function getDependencyLag(dep) {
|
|
@@ -111,7 +110,7 @@ function getDependencyLag(dep) {
|
|
|
111
110
|
function normalizeTaskDependencyLags(task) {
|
|
112
111
|
return task;
|
|
113
112
|
}
|
|
114
|
-
function normalizeDependencyLag(linkType, lag, predecessorStart, predecessorEnd, businessDays = false, weekendPredicate) {
|
|
113
|
+
function normalizeDependencyLag(linkType, lag, predecessorStart, predecessorEnd, businessDays = false, weekendPredicate, successorType) {
|
|
115
114
|
if (linkType !== "FS") {
|
|
116
115
|
return lag;
|
|
117
116
|
}
|
|
@@ -121,9 +120,10 @@ function normalizeDependencyLag(linkType, lag, predecessorStart, predecessorEnd,
|
|
|
121
120
|
businessDays,
|
|
122
121
|
weekendPredicate
|
|
123
122
|
);
|
|
124
|
-
|
|
123
|
+
const minimumLag = successorType === "milestone" ? -Math.max(0, predecessorDuration - 1) : -predecessorDuration;
|
|
124
|
+
return Math.max(minimumLag, lag);
|
|
125
125
|
}
|
|
126
|
-
function computeLagFromDates(linkType, predStart, predEnd, succStart, succEnd, businessDays = false, weekendPredicate) {
|
|
126
|
+
function computeLagFromDates(linkType, predStart, predEnd, succStart, succEnd, businessDays = false, weekendPredicate, successorType) {
|
|
127
127
|
const pS = Date.UTC(predStart.getUTCFullYear(), predStart.getUTCMonth(), predStart.getUTCDate());
|
|
128
128
|
const pE = Date.UTC(predEnd.getUTCFullYear(), predEnd.getUTCMonth(), predEnd.getUTCDate());
|
|
129
129
|
const sS = Date.UTC(succStart.getUTCFullYear(), succStart.getUTCMonth(), succStart.getUTCDate());
|
|
@@ -133,11 +133,12 @@ function computeLagFromDates(linkType, predStart, predEnd, succStart, succEnd, b
|
|
|
133
133
|
case "FS":
|
|
134
134
|
return normalizeDependencyLag(
|
|
135
135
|
linkType,
|
|
136
|
-
Math.round((sS - pE) / DAY_MS) - 1,
|
|
136
|
+
Math.round((sS - pE) / DAY_MS) - (successorType === "milestone" ? 0 : 1),
|
|
137
137
|
predStart,
|
|
138
138
|
predEnd,
|
|
139
139
|
businessDays,
|
|
140
|
-
weekendPredicate
|
|
140
|
+
weekendPredicate,
|
|
141
|
+
successorType
|
|
141
142
|
);
|
|
142
143
|
case "SS":
|
|
143
144
|
return Math.round((sS - pS) / DAY_MS);
|
|
@@ -154,11 +155,12 @@ function computeLagFromDates(linkType, predStart, predEnd, succStart, succEnd, b
|
|
|
154
155
|
case "FS":
|
|
155
156
|
return normalizeDependencyLag(
|
|
156
157
|
linkType,
|
|
157
|
-
businessOffset - 1,
|
|
158
|
+
businessOffset - (successorType === "milestone" ? 0 : 1),
|
|
158
159
|
predStart,
|
|
159
160
|
predEnd,
|
|
160
161
|
businessDays,
|
|
161
|
-
weekendPredicate
|
|
162
|
+
weekendPredicate,
|
|
163
|
+
successorType
|
|
162
164
|
);
|
|
163
165
|
case "SS":
|
|
164
166
|
return businessOffset;
|
|
@@ -168,19 +170,20 @@ function computeLagFromDates(linkType, predStart, predEnd, succStart, succEnd, b
|
|
|
168
170
|
return businessOffset + 1;
|
|
169
171
|
}
|
|
170
172
|
}
|
|
171
|
-
function calculateSuccessorDate(predecessorStart, predecessorEnd, linkType, lag = 0, businessDays = false, weekendPredicate) {
|
|
173
|
+
function calculateSuccessorDate(predecessorStart, predecessorEnd, linkType, lag = 0, businessDays = false, weekendPredicate, successorType) {
|
|
172
174
|
const normalizedLag = normalizeDependencyLag(
|
|
173
175
|
linkType,
|
|
174
176
|
lag,
|
|
175
177
|
predecessorStart,
|
|
176
178
|
predecessorEnd,
|
|
177
179
|
businessDays,
|
|
178
|
-
weekendPredicate
|
|
180
|
+
weekendPredicate,
|
|
181
|
+
successorType
|
|
179
182
|
);
|
|
180
183
|
if (!businessDays || !weekendPredicate) {
|
|
181
184
|
switch (linkType) {
|
|
182
185
|
case "FS":
|
|
183
|
-
return new Date(predecessorEnd.getTime() + (normalizedLag + 1) * DAY_MS);
|
|
186
|
+
return new Date(predecessorEnd.getTime() + (normalizedLag + (successorType === "milestone" ? 0 : 1)) * DAY_MS);
|
|
184
187
|
case "SS":
|
|
185
188
|
return new Date(predecessorStart.getTime() + normalizedLag * DAY_MS);
|
|
186
189
|
case "FF":
|
|
@@ -193,7 +196,7 @@ function calculateSuccessorDate(predecessorStart, predecessorEnd, linkType, lag
|
|
|
193
196
|
let offset;
|
|
194
197
|
switch (linkType) {
|
|
195
198
|
case "FS":
|
|
196
|
-
offset = normalizedLag + 1;
|
|
199
|
+
offset = normalizedLag + (successorType === "milestone" ? 0 : 1);
|
|
197
200
|
break;
|
|
198
201
|
case "SS":
|
|
199
202
|
offset = normalizedLag;
|
|
@@ -425,7 +428,8 @@ function clampTaskRangeForIncomingFS(task, proposedStart, proposedEnd, allTasks,
|
|
|
425
428
|
"FS",
|
|
426
429
|
-predecessorDuration,
|
|
427
430
|
businessDays,
|
|
428
|
-
weekendPredicate
|
|
431
|
+
weekendPredicate,
|
|
432
|
+
task.type
|
|
429
433
|
);
|
|
430
434
|
if (!minAllowedStart || candidateMinStart.getTime() > minAllowedStart.getTime()) {
|
|
431
435
|
minAllowedStart = candidateMinStart;
|
|
@@ -459,7 +463,8 @@ function recalculateIncomingLags(task, newStartDate, newEndDate, allTasks, busin
|
|
|
459
463
|
newStartDate,
|
|
460
464
|
newEndDate,
|
|
461
465
|
businessDays,
|
|
462
|
-
weekendPredicate
|
|
466
|
+
weekendPredicate,
|
|
467
|
+
task.type
|
|
463
468
|
);
|
|
464
469
|
return { ...dep, lag: nextLag };
|
|
465
470
|
});
|
|
@@ -574,7 +579,10 @@ function cascadeByLinks(movedTaskId, newStart, newEnd, allTasks, skipChildCascad
|
|
|
574
579
|
normalizedPredStart,
|
|
575
580
|
normalizedPredEnd,
|
|
576
581
|
dep.type,
|
|
577
|
-
getDependencyLag(dep)
|
|
582
|
+
getDependencyLag(dep),
|
|
583
|
+
false,
|
|
584
|
+
void 0,
|
|
585
|
+
task.type
|
|
578
586
|
);
|
|
579
587
|
let newSuccStart;
|
|
580
588
|
let newSuccEnd;
|
|
@@ -736,7 +744,8 @@ function universalCascade(movedTask, newStart, newEnd, allTasks, businessDays =
|
|
|
736
744
|
dep.type,
|
|
737
745
|
getDependencyLag(dep),
|
|
738
746
|
businessDays,
|
|
739
|
-
weekendPredicate
|
|
747
|
+
weekendPredicate,
|
|
748
|
+
task.type
|
|
740
749
|
);
|
|
741
750
|
let succNewStart;
|
|
742
751
|
let succNewEnd;
|
|
@@ -1036,7 +1045,8 @@ function recalculateTaskFromDependencies(taskId, snapshot, options) {
|
|
|
1036
1045
|
dep.type,
|
|
1037
1046
|
getDependencyLag(dep),
|
|
1038
1047
|
businessDays,
|
|
1039
|
-
weekendPredicate
|
|
1048
|
+
weekendPredicate,
|
|
1049
|
+
task.type
|
|
1040
1050
|
);
|
|
1041
1051
|
const duration = getTaskDuration(
|
|
1042
1052
|
parseDateOnly(task.startDate),
|
|
@@ -1152,7 +1162,8 @@ function recalculateProjectSchedule(snapshot, options) {
|
|
|
1152
1162
|
dep.type,
|
|
1153
1163
|
getDependencyLag(dep),
|
|
1154
1164
|
businessDays,
|
|
1155
|
-
weekendPredicate
|
|
1165
|
+
weekendPredicate,
|
|
1166
|
+
currentTask.type
|
|
1156
1167
|
);
|
|
1157
1168
|
const candidateRange = dep.type === "FS" || dep.type === "SS" ? buildTaskRangeFromStart(constraintDate, duration, businessDays, weekendPredicate) : buildTaskRangeFromEnd(constraintDate, duration, businessDays, weekendPredicate);
|
|
1158
1169
|
if (!constrainedRange || candidateRange.start.getTime() > constrainedRange.start.getTime() || candidateRange.start.getTime() === constrainedRange.start.getTime() && candidateRange.end.getTime() > constrainedRange.end.getTime()) {
|