@outbuild-company/schedule-core 1.10.0 → 1.10.2
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 +35 -3
- package/dist/cdn/schedule-core.global.js +1 -1
- package/dist/cdn/schedule-core.global.js.map +1 -1
- package/dist/index.cjs +33 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -892,6 +892,7 @@ function dispatchFilterSet(action, deps) {
|
|
|
892
892
|
|
|
893
893
|
// src/internal/hierarchy/root-parent.ts
|
|
894
894
|
var ROOT_PARENT_ID = "0";
|
|
895
|
+
var ROOT_PROJECT_CORRELATIVE_ID = 0;
|
|
895
896
|
function isRootParent(parent) {
|
|
896
897
|
return parent == null || parent === 0 || parent === ROOT_PARENT_ID;
|
|
897
898
|
}
|
|
@@ -1817,6 +1818,9 @@ function findConnectedGroupForTrigger(triggerId, links) {
|
|
|
1817
1818
|
|
|
1818
1819
|
// src/constants/progress.ts
|
|
1819
1820
|
var COMPLETED_PROGRESS = 100;
|
|
1821
|
+
function isAutoSchedulingEnabledForProgress(progress) {
|
|
1822
|
+
return progress === 0;
|
|
1823
|
+
}
|
|
1820
1824
|
|
|
1821
1825
|
// src/autoscheduler/engine/link-calculator.ts
|
|
1822
1826
|
function normalize(predecessor, successor, link) {
|
|
@@ -3955,7 +3959,6 @@ var setRealWork = (value) => ({
|
|
|
3955
3959
|
// src/columns/progress/progress-pipeline.ts
|
|
3956
3960
|
var MIN_PROGRESS = 0;
|
|
3957
3961
|
var MAX_PROGRESS = PROGRESS_COMPLETE;
|
|
3958
|
-
var PROGRESS_NONE = 0;
|
|
3959
3962
|
var progressPipeline = {
|
|
3960
3963
|
targetField: "progress",
|
|
3961
3964
|
canEdit(activity, hierarchy) {
|
|
@@ -3975,7 +3978,8 @@ var progressPipeline = {
|
|
|
3975
3978
|
return valid();
|
|
3976
3979
|
},
|
|
3977
3980
|
transform(activity, newValue, ctx) {
|
|
3978
|
-
const autoScheduling =
|
|
3981
|
+
const autoScheduling = isAutoSchedulingEnabledForProgress(newValue);
|
|
3982
|
+
const needsAutoSchedule = activity.progress !== newValue && autoScheduling;
|
|
3979
3983
|
const recursive = isRecursiveProgressChange(newValue);
|
|
3980
3984
|
const realWorkByActivity = buildCanonicalRealWorkOverlay(
|
|
3981
3985
|
activity,
|
|
@@ -3999,7 +4003,7 @@ var progressPipeline = {
|
|
|
3999
4003
|
const postProcessors = [];
|
|
4000
4004
|
const trackingEvents = recursive ? buildRecursiveTrackingEvents(activity, newValue) : void 0;
|
|
4001
4005
|
return fieldChanges(patch, {
|
|
4002
|
-
autoSchedule:
|
|
4006
|
+
autoSchedule: needsAutoSchedule,
|
|
4003
4007
|
postProcessors,
|
|
4004
4008
|
cascadeMutations,
|
|
4005
4009
|
trackingEvents
|
|
@@ -4010,11 +4014,8 @@ var progressPipeline = {
|
|
|
4010
4014
|
function isOutOfRange(value) {
|
|
4011
4015
|
return value < MIN_PROGRESS || value > MAX_PROGRESS;
|
|
4012
4016
|
}
|
|
4013
|
-
function determineAutoScheduling(progress) {
|
|
4014
|
-
return progress === PROGRESS_NONE;
|
|
4015
|
-
}
|
|
4016
4017
|
function isRecursiveProgressChange(value) {
|
|
4017
|
-
return value === PROGRESS_COMPLETE || value
|
|
4018
|
+
return value === PROGRESS_COMPLETE || isAutoSchedulingEnabledForProgress(value);
|
|
4018
4019
|
}
|
|
4019
4020
|
function buildDescendantCascade(activity, newValue, autoScheduling, hierarchy, realWorkByActivity) {
|
|
4020
4021
|
const descendants = hierarchy.getDescendantIds(activity.id);
|
|
@@ -10299,10 +10300,6 @@ function mergeScheduledIds(firstSettleIds, secondSettleIds) {
|
|
|
10299
10300
|
}
|
|
10300
10301
|
|
|
10301
10302
|
// src/dispatch/sir-auto-reject.ts
|
|
10302
|
-
function datesChanged(before, after) {
|
|
10303
|
-
const toTime = (value) => value.getTime();
|
|
10304
|
-
return toTime(before.startDate) !== toTime(after.startDate) || toTime(before.endDate) !== toTime(after.endDate) || before.durationHours !== after.durationHours;
|
|
10305
|
-
}
|
|
10306
10303
|
function detectSirAutoReject(beforeSnap, adapter, touchedIds) {
|
|
10307
10304
|
const effects = [];
|
|
10308
10305
|
for (const id of touchedIds) {
|
|
@@ -10310,21 +10307,15 @@ function detectSirAutoReject(beforeSnap, adapter, touchedIds) {
|
|
|
10310
10307
|
if (!before) continue;
|
|
10311
10308
|
const pendingRequestIds = before.pendingRequestIds ?? [];
|
|
10312
10309
|
if (!isFrozen({ pendingRequestIds })) continue;
|
|
10313
|
-
|
|
10314
|
-
const deleted = after == null;
|
|
10315
|
-
if (!deleted && !datesChanged(before, after)) continue;
|
|
10316
|
-
const reason = deleted ? "activity_deleted" : "date_changed";
|
|
10310
|
+
if (adapter.getActivity(id) != null) continue;
|
|
10317
10311
|
for (const pending of pendingRequestIds) {
|
|
10318
10312
|
effects.push({
|
|
10319
10313
|
kind: "sir-auto-reject",
|
|
10320
10314
|
activityId: id,
|
|
10321
10315
|
sirId: pending,
|
|
10322
|
-
reason
|
|
10316
|
+
reason: "activity_deleted"
|
|
10323
10317
|
});
|
|
10324
10318
|
}
|
|
10325
|
-
if (!deleted) {
|
|
10326
|
-
adapter.setActivityField(id, "pendingRequestIds", []);
|
|
10327
|
-
}
|
|
10328
10319
|
}
|
|
10329
10320
|
return effects;
|
|
10330
10321
|
}
|
|
@@ -11910,7 +11901,11 @@ async function dispatchActivityDelete(action, options, deps) {
|
|
|
11910
11901
|
return { ok: false, reason: REJECTION_REASON.ACTIVITY_NOT_FOUND };
|
|
11911
11902
|
}
|
|
11912
11903
|
}
|
|
11913
|
-
const
|
|
11904
|
+
const deletableActivityIds = action.activityIds.filter((id) => {
|
|
11905
|
+
const activity = adapter.getActivity(id);
|
|
11906
|
+
return !(activity?.correlativeId === ROOT_PROJECT_CORRELATIVE_ID && activity.type === ACTIVITY_TYPE.PROJECT);
|
|
11907
|
+
});
|
|
11908
|
+
const toDelete = collectDescendantIds(deletableActivityIds, adapter);
|
|
11914
11909
|
const incidentLinkIds = collectIncidentLinkIds(toDelete, adapter);
|
|
11915
11910
|
const parentsToCheck = /* @__PURE__ */ new Set();
|
|
11916
11911
|
for (const id of action.activityIds) {
|
|
@@ -12647,10 +12642,12 @@ async function applyReconciledProgress(entries, deps) {
|
|
|
12647
12642
|
const before = await snapshotActivities(deps.adapter, touched);
|
|
12648
12643
|
deps.adapter.batchUpdate(() => {
|
|
12649
12644
|
for (const entry of progressToApply) {
|
|
12645
|
+
const activityId = String(entry.activityId);
|
|
12646
|
+
deps.adapter.setActivityField(activityId, "progress", entry.progress);
|
|
12650
12647
|
deps.adapter.setActivityField(
|
|
12651
|
-
|
|
12652
|
-
"
|
|
12653
|
-
entry.progress
|
|
12648
|
+
activityId,
|
|
12649
|
+
"autoScheduling",
|
|
12650
|
+
isAutoSchedulingEnabledForProgress(entry.progress)
|
|
12654
12651
|
);
|
|
12655
12652
|
}
|
|
12656
12653
|
recomputeProgressRollupForParents(ancestors, deps.adapter);
|
|
@@ -12821,7 +12818,7 @@ async function dispatchActivityLookaheadSync(action, options, deps) {
|
|
|
12821
12818
|
},
|
|
12822
12819
|
{
|
|
12823
12820
|
action,
|
|
12824
|
-
autoscheduleFrom: null,
|
|
12821
|
+
autoscheduleFrom: action.persistedProgress === 0 ? ids[0] : null,
|
|
12825
12822
|
recomputeParentsFrom: [],
|
|
12826
12823
|
now: deps.now,
|
|
12827
12824
|
options
|
|
@@ -14438,9 +14435,13 @@ function resolveDestination(afterSiblingId, adapter) {
|
|
|
14438
14435
|
if (!sibling) {
|
|
14439
14436
|
return { ok: false, reason: REJECTION_REASON.ANCHOR_SIBLING_NOT_FOUND };
|
|
14440
14437
|
}
|
|
14438
|
+
if (sibling.parentId == null) {
|
|
14439
|
+
return adapter.getRootIds().length === 1 ? { ok: true, parentId: sibling.id } : { ok: true, parentId: ROOT_PARENT_ID, afterSiblingId };
|
|
14440
|
+
}
|
|
14441
14441
|
return {
|
|
14442
14442
|
ok: true,
|
|
14443
|
-
parentId:
|
|
14443
|
+
parentId: String(sibling.parentId),
|
|
14444
|
+
afterSiblingId
|
|
14444
14445
|
};
|
|
14445
14446
|
}
|
|
14446
14447
|
var invariantFailure = () => ({
|
|
@@ -14467,12 +14468,11 @@ async function dispatchActivityPasteCopied(action, options, deps) {
|
|
|
14467
14468
|
let previousRootId;
|
|
14468
14469
|
for (const copied of clipboard.activities) {
|
|
14469
14470
|
const mappedParent = originalToNew.get(copied.originalParentId);
|
|
14471
|
+
const afterSiblingId = mappedParent === void 0 ? previousRootId ?? destination.afterSiblingId : void 0;
|
|
14470
14472
|
const created = await createActivityCore(
|
|
14471
14473
|
{
|
|
14472
14474
|
parentId: mappedParent ?? destination.parentId,
|
|
14473
|
-
...
|
|
14474
|
-
afterSiblingId: previousRootId ?? action.destination.afterSiblingId
|
|
14475
|
-
} : {},
|
|
14475
|
+
...afterSiblingId === void 0 ? {} : { afterSiblingId },
|
|
14476
14476
|
overrides: cloneDomainValue(copied.overrides),
|
|
14477
14477
|
eventSource: action.eventSource
|
|
14478
14478
|
},
|
|
@@ -19315,7 +19315,10 @@ var SaveTracker = class _SaveTracker {
|
|
|
19315
19315
|
const persistable = {
|
|
19316
19316
|
...saved.persistable,
|
|
19317
19317
|
...acknowledgesLookahead ? { isLookahead: current.isLookahead } : {},
|
|
19318
|
-
...acknowledgesProgress ? {
|
|
19318
|
+
...acknowledgesProgress ? {
|
|
19319
|
+
progress: current.progress,
|
|
19320
|
+
autoScheduling: current.autoScheduling
|
|
19321
|
+
} : {}
|
|
19319
19322
|
};
|
|
19320
19323
|
this.activitiesAtLastSave.set(activityId, {
|
|
19321
19324
|
...saved,
|
|
@@ -19474,9 +19477,6 @@ function normalizeActivities(rawActivities, context) {
|
|
|
19474
19477
|
reparentOrphansToRoot(activities, activityIds, context.reporter);
|
|
19475
19478
|
return { activities, activityIds, hiddenIds };
|
|
19476
19479
|
}
|
|
19477
|
-
function isAutoSchedulable(progress) {
|
|
19478
|
-
return progress === 0;
|
|
19479
|
-
}
|
|
19480
19480
|
function parseConstraintLabel(label, reporter) {
|
|
19481
19481
|
if (!label) return null;
|
|
19482
19482
|
const normalized2 = CONSTRAINT_LABEL_MAP[label.toUpperCase()];
|
|
@@ -19578,7 +19578,7 @@ function parseActivity(raw, context) {
|
|
|
19578
19578
|
durationHours: durationToHours(durationDays, context.hoursPerDay),
|
|
19579
19579
|
constraintType,
|
|
19580
19580
|
constraintDate,
|
|
19581
|
-
autoScheduling:
|
|
19581
|
+
autoScheduling: isAutoSchedulingEnabledForProgress(progress),
|
|
19582
19582
|
calendarId,
|
|
19583
19583
|
assignedDefaultCalendar: calendarId != null && inheritedDefaultCalendar,
|
|
19584
19584
|
dateOrigin: raw.date_origin == null ? null : parseBackendDate(raw.date_origin),
|