gantt-lib 0.136.1 → 0.138.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/README.md +80 -0
- package/dist/core/scheduling/index.d.mts +1 -1
- package/dist/core/scheduling/index.d.ts +1 -1
- package/dist/core/scheduling/index.js +40 -3
- package/dist/core/scheduling/index.js.map +1 -1
- package/dist/core/scheduling/index.mjs +40 -3
- package/dist/core/scheduling/index.mjs.map +1 -1
- package/dist/{index-D99kbU4p.d.mts → index-C3mZqSTf.d.mts} +67 -1
- package/dist/{index-D99kbU4p.d.ts → index-C3mZqSTf.d.ts} +67 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +258 -3
- package/dist/index.d.ts +258 -3
- package/dist/index.js +2389 -1331
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2376 -1331
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +176 -1
- package/package.json +1 -1
|
@@ -477,6 +477,29 @@ function parseCascadeDateInput(date) {
|
|
|
477
477
|
}
|
|
478
478
|
return normalizeUTCDate(/* @__PURE__ */ new Date(`${date.split("T")[0]}T00:00:00.000Z`));
|
|
479
479
|
}
|
|
480
|
+
function projectDayDelta(from, to, businessDays, weekendPredicate) {
|
|
481
|
+
if (businessDays && weekendPredicate) {
|
|
482
|
+
return getBusinessDayOffset(from, to, weekendPredicate);
|
|
483
|
+
}
|
|
484
|
+
return Math.round((to.getTime() - from.getTime()) / DAY_MS);
|
|
485
|
+
}
|
|
486
|
+
function shiftTaskActivities(activities, dayDelta, businessDays, weekendPredicate) {
|
|
487
|
+
if (!activities || activities.length === 0 || dayDelta === 0) return void 0;
|
|
488
|
+
const shiftDate = (value) => {
|
|
489
|
+
const base = parseDateOnly(value);
|
|
490
|
+
const shifted = businessDays && weekendPredicate ? shiftBusinessDayOffset(base, dayDelta, weekendPredicate) : new Date(base.getTime() + dayDelta * DAY_MS);
|
|
491
|
+
return typeof value === "string" ? shifted.toISOString().slice(0, 10) : shifted;
|
|
492
|
+
};
|
|
493
|
+
return activities.map((activity) => ({
|
|
494
|
+
...activity,
|
|
495
|
+
startDate: shiftDate(activity.startDate),
|
|
496
|
+
endDate: shiftDate(activity.endDate)
|
|
497
|
+
}));
|
|
498
|
+
}
|
|
499
|
+
function shiftedActivitiesPatch(activities, dayDelta, businessDays, weekendPredicate) {
|
|
500
|
+
const shifted = shiftTaskActivities(activities, dayDelta, businessDays, weekendPredicate);
|
|
501
|
+
return shifted ? { activities: shifted } : {};
|
|
502
|
+
}
|
|
480
503
|
function createCascadeContext(allTasks) {
|
|
481
504
|
const childrenByParentId = /* @__PURE__ */ new Map();
|
|
482
505
|
const dependentsByPredecessorId = /* @__PURE__ */ new Map();
|
|
@@ -552,7 +575,8 @@ function cascadeByLinks(movedTaskId, newStart, newEnd, allTasks, skipChildCascad
|
|
|
552
575
|
result.push(normalizeTaskDependencyLags({
|
|
553
576
|
...child,
|
|
554
577
|
startDate: newChildStart.toISOString().split("T")[0],
|
|
555
|
-
endDate: newChildEnd.toISOString().split("T")[0]
|
|
578
|
+
endDate: newChildEnd.toISOString().split("T")[0],
|
|
579
|
+
...shiftedActivitiesPatch(child.activities, Math.round(parentStartDelta / DAY_MS), false)
|
|
556
580
|
}));
|
|
557
581
|
queue.push(child.id);
|
|
558
582
|
}
|
|
@@ -696,7 +720,14 @@ function universalCascade(movedTask, newStart, newEnd, allTasks, businessDays =
|
|
|
696
720
|
resultMap.set(child.id, normalizeTaskDependencyLags({
|
|
697
721
|
...child,
|
|
698
722
|
startDate: childNewStart.toISOString().split("T")[0],
|
|
699
|
-
endDate: childNewEnd.toISOString().split("T")[0]
|
|
723
|
+
endDate: childNewEnd.toISOString().split("T")[0],
|
|
724
|
+
// Дети едут параллельно: вместе с датами строки сдвигаются и её работы.
|
|
725
|
+
...shiftedActivitiesPatch(
|
|
726
|
+
child.activities,
|
|
727
|
+
projectDayDelta(childOrigStart, childNewStart, businessDays, weekendPredicate),
|
|
728
|
+
businessDays,
|
|
729
|
+
weekendPredicate
|
|
730
|
+
)
|
|
700
731
|
}));
|
|
701
732
|
}
|
|
702
733
|
}
|
|
@@ -775,7 +806,13 @@ function universalCascade(movedTask, newStart, newEnd, allTasks, businessDays =
|
|
|
775
806
|
resultMap.set(task.id, normalizeTaskDependencyLags({
|
|
776
807
|
...task,
|
|
777
808
|
startDate: succNewStart.toISOString().split("T")[0],
|
|
778
|
-
endDate: succNewEnd.toISOString().split("T")[0]
|
|
809
|
+
endDate: succNewEnd.toISOString().split("T")[0],
|
|
810
|
+
...shiftedActivitiesPatch(
|
|
811
|
+
task.activities,
|
|
812
|
+
projectDayDelta(origStart, succNewStart, businessDays, weekendPredicate),
|
|
813
|
+
businessDays,
|
|
814
|
+
weekendPredicate
|
|
815
|
+
)
|
|
779
816
|
}));
|
|
780
817
|
}
|
|
781
818
|
}
|