@outbuild-company/schedule-core 1.10.2 → 1.10.3
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/cdn/schedule-core.global.js +1 -1
- package/dist/cdn/schedule-core.global.js.map +1 -1
- package/dist/index.cjs +47 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +47 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9701,13 +9701,41 @@ async function createGanttAdapter(state, hoursPerDay) {
|
|
|
9701
9701
|
|
|
9702
9702
|
// src/critical-path/run-critical-path.ts
|
|
9703
9703
|
var CP_WRITE_YIELD_EVERY = 1e3;
|
|
9704
|
-
|
|
9705
|
-
|
|
9704
|
+
var finiteHoursOrNull = (value) => {
|
|
9705
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
9706
|
+
return Object.is(value, -0) ? 0 : value;
|
|
9707
|
+
};
|
|
9708
|
+
var linkFreeFloatDaysToHours = (valueDays, hoursPerDay) => {
|
|
9709
|
+
if (typeof valueDays !== "number" || valueDays < 0) return null;
|
|
9710
|
+
return slackDaysToHours(valueDays, hoursPerDay);
|
|
9711
|
+
};
|
|
9712
|
+
function fieldsForLink(input) {
|
|
9713
|
+
const freeSlackHours = linkFreeFloatDaysToHours(
|
|
9714
|
+
input.freeFloatDays,
|
|
9715
|
+
input.hoursPerDay
|
|
9716
|
+
);
|
|
9717
|
+
const residualHours = finiteHoursOrNull(input.residualHours);
|
|
9706
9718
|
return {
|
|
9707
9719
|
freeSlackHours,
|
|
9708
|
-
isCritical:
|
|
9720
|
+
isCritical: residualHours !== null && residualHours <= 0 && input.sourceIsCritical && input.targetIsCritical && input.targetProgress === 0
|
|
9709
9721
|
};
|
|
9710
9722
|
}
|
|
9723
|
+
async function collectLinkFreeFloatDays(freeFloat, isCurrent) {
|
|
9724
|
+
const values = /* @__PURE__ */ new Map();
|
|
9725
|
+
let sinceYield = 0;
|
|
9726
|
+
for (const calculation of freeFloat.values()) {
|
|
9727
|
+
for (const linkId in calculation.linksFreeFloat) {
|
|
9728
|
+
if (!Object.hasOwn(calculation.linksFreeFloat, linkId)) continue;
|
|
9729
|
+
if (++sinceYield >= CP_WRITE_YIELD_EVERY) {
|
|
9730
|
+
sinceYield = 0;
|
|
9731
|
+
await yieldToBrowser();
|
|
9732
|
+
if (!isCurrent()) return null;
|
|
9733
|
+
}
|
|
9734
|
+
values.set(String(linkId), calculation.linksFreeFloat[linkId]);
|
|
9735
|
+
}
|
|
9736
|
+
}
|
|
9737
|
+
return isCurrent() ? values : null;
|
|
9738
|
+
}
|
|
9711
9739
|
async function collectActivityFields(state, maps, hoursPerDay, toCanonicalActivityId, isCurrent) {
|
|
9712
9740
|
const fields = /* @__PURE__ */ new Map();
|
|
9713
9741
|
let sinceYield = 0;
|
|
@@ -9733,7 +9761,7 @@ async function collectActivityFields(state, maps, hoursPerDay, toCanonicalActivi
|
|
|
9733
9761
|
}
|
|
9734
9762
|
return isCurrent() ? fields : null;
|
|
9735
9763
|
}
|
|
9736
|
-
async function collectLinkFields(state, linkResidualHours, activityFields, isCurrent) {
|
|
9764
|
+
async function collectLinkFields(state, linkFreeFloatDays, linkResidualHours, activityFields, hoursPerDay, isCurrent) {
|
|
9737
9765
|
const fields = /* @__PURE__ */ new Map();
|
|
9738
9766
|
let sinceYield = 0;
|
|
9739
9767
|
for (const link of state.getAllLinks()) {
|
|
@@ -9744,12 +9772,14 @@ async function collectLinkFields(state, linkResidualHours, activityFields, isCur
|
|
|
9744
9772
|
}
|
|
9745
9773
|
fields.set(
|
|
9746
9774
|
String(link.id),
|
|
9747
|
-
fieldsForLink(
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
9775
|
+
fieldsForLink({
|
|
9776
|
+
freeFloatDays: linkFreeFloatDays.get(String(link.id)),
|
|
9777
|
+
residualHours: linkResidualHours.get(String(link.id)),
|
|
9778
|
+
hoursPerDay,
|
|
9779
|
+
sourceIsCritical: activityFields.get(link.source)?.isCritical === true,
|
|
9780
|
+
targetIsCritical: activityFields.get(link.target)?.isCritical === true,
|
|
9781
|
+
targetProgress: state.getActivity(link.target)?.progress
|
|
9782
|
+
})
|
|
9753
9783
|
);
|
|
9754
9784
|
}
|
|
9755
9785
|
return isCurrent() ? fields : null;
|
|
@@ -9832,10 +9862,17 @@ async function computeCriticalPathFields(state, hoursPerDay, isCurrent = () => t
|
|
|
9832
9862
|
isCurrent
|
|
9833
9863
|
);
|
|
9834
9864
|
if (!activities) return null;
|
|
9865
|
+
const linkFreeFloatDays = await collectLinkFreeFloatDays(
|
|
9866
|
+
maps.freeFloat,
|
|
9867
|
+
isCurrent
|
|
9868
|
+
);
|
|
9869
|
+
if (!linkFreeFloatDays) return null;
|
|
9835
9870
|
const links = await collectLinkFields(
|
|
9836
9871
|
state,
|
|
9872
|
+
linkFreeFloatDays,
|
|
9837
9873
|
criticalPath.linkResidualHours,
|
|
9838
9874
|
activities,
|
|
9875
|
+
hoursPerDay,
|
|
9839
9876
|
isCurrent
|
|
9840
9877
|
);
|
|
9841
9878
|
return links ? { activities, links } : null;
|