@outbuild-company/schedule-core 1.9.4 → 1.10.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/dist/cdn/schedule-core.global.js +1 -1
- package/dist/cdn/schedule-core.global.js.map +1 -1
- package/dist/index.cjs +101 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +101 -66
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -843,6 +843,7 @@ declare class ScheduleCore {
|
|
|
843
843
|
getChildrenIds(parentId: ActivityId | '0'): ReadonlyArray<ActivityId>;
|
|
844
844
|
getSelectedActivityIds(): string[];
|
|
845
845
|
getHiddenActivityIds(): string[];
|
|
846
|
+
getVisibleActivityIds(): string[];
|
|
846
847
|
getActiveFilter(): Readonly<FilterState> | null;
|
|
847
848
|
getActiveOrder(): Readonly<OrderState> | null;
|
|
848
849
|
getVisualOrderIds(): ReadonlyArray<ActivityId>;
|
package/dist/index.d.ts
CHANGED
|
@@ -843,6 +843,7 @@ declare class ScheduleCore {
|
|
|
843
843
|
getChildrenIds(parentId: ActivityId | '0'): ReadonlyArray<ActivityId>;
|
|
844
844
|
getSelectedActivityIds(): string[];
|
|
845
845
|
getHiddenActivityIds(): string[];
|
|
846
|
+
getVisibleActivityIds(): string[];
|
|
846
847
|
getActiveFilter(): Readonly<FilterState> | null;
|
|
847
848
|
getActiveOrder(): Readonly<OrderState> | null;
|
|
848
849
|
getVisualOrderIds(): ReadonlyArray<ActivityId>;
|
package/dist/index.js
CHANGED
|
@@ -336,6 +336,7 @@ var FIELD_REGISTRY = {
|
|
|
336
336
|
},
|
|
337
337
|
expectedProgressBaseline: {
|
|
338
338
|
valueKind: "number",
|
|
339
|
+
equalityPrecision: 2,
|
|
339
340
|
extract: (activity) => activity.expectedProgressBaseline
|
|
340
341
|
},
|
|
341
342
|
expectedProgress: {
|
|
@@ -424,6 +425,9 @@ function toTargetDate(value) {
|
|
|
424
425
|
}
|
|
425
426
|
return new Date(Number.NaN);
|
|
426
427
|
}
|
|
428
|
+
function utcDayMs(date2) {
|
|
429
|
+
return Date.UTC(date2.getUTCFullYear(), date2.getUTCMonth(), date2.getUTCDate());
|
|
430
|
+
}
|
|
427
431
|
function matchString(value, target, operator) {
|
|
428
432
|
const isAbsent = value === null;
|
|
429
433
|
if (operator === "includes") {
|
|
@@ -436,12 +440,13 @@ function matchString(value, target, operator) {
|
|
|
436
440
|
if (operator === "isNot") return isAbsent || String(value) !== target;
|
|
437
441
|
return false;
|
|
438
442
|
}
|
|
439
|
-
function matchNumber(value, target, operator) {
|
|
443
|
+
function matchNumber(value, target, operator, equalityPrecision) {
|
|
440
444
|
if (value === null || typeof value !== "number") {
|
|
441
445
|
return operator === "notEquals";
|
|
442
446
|
}
|
|
443
|
-
|
|
444
|
-
if (operator === "
|
|
447
|
+
const equalityValue = equalityPrecision === void 0 ? value : Number(value.toFixed(equalityPrecision));
|
|
448
|
+
if (operator === "equals") return equalityValue === target;
|
|
449
|
+
if (operator === "notEquals") return equalityValue !== target;
|
|
445
450
|
if (operator === "greaterThan") return value > target;
|
|
446
451
|
if (operator === "lessThan") return value < target;
|
|
447
452
|
if (operator === "greaterOrEqual") return value >= target;
|
|
@@ -453,14 +458,16 @@ function matchNumberBetween(value, minimum, maximum) {
|
|
|
453
458
|
}
|
|
454
459
|
function matchDate(value, target, operator) {
|
|
455
460
|
if (!(value instanceof Date)) return false;
|
|
456
|
-
|
|
457
|
-
|
|
461
|
+
const valueDay = utcDayMs(value);
|
|
462
|
+
const targetDay = utcDayMs(target);
|
|
463
|
+
if (operator === "after") return valueDay > targetDay;
|
|
464
|
+
if (operator === "before") return valueDay < targetDay;
|
|
458
465
|
return false;
|
|
459
466
|
}
|
|
460
467
|
function matchDateBetween(value, minimum, maximum) {
|
|
461
468
|
if (!(value instanceof Date)) return false;
|
|
462
|
-
const
|
|
463
|
-
return
|
|
469
|
+
const day = utcDayMs(value);
|
|
470
|
+
return day >= utcDayMs(minimum) && day <= utcDayMs(maximum);
|
|
464
471
|
}
|
|
465
472
|
function matchIdArray(value, allowed, operator) {
|
|
466
473
|
const ids = Array.isArray(value) ? value : [];
|
|
@@ -505,7 +512,12 @@ function matchCriterion(activity, criterion, context) {
|
|
|
505
512
|
return matchString(value, String(criterion.value), operator);
|
|
506
513
|
}
|
|
507
514
|
if (descriptor.valueKind === "number") {
|
|
508
|
-
return matchNumber(
|
|
515
|
+
return matchNumber(
|
|
516
|
+
value,
|
|
517
|
+
Number(criterion.value),
|
|
518
|
+
operator,
|
|
519
|
+
descriptor.equalityPrecision
|
|
520
|
+
);
|
|
509
521
|
}
|
|
510
522
|
if (descriptor.valueKind === "date") {
|
|
511
523
|
return matchDate(value, toTargetDate(criterion.value), operator);
|
|
@@ -527,10 +539,10 @@ function matchesCriteria(activity, filter, context) {
|
|
|
527
539
|
);
|
|
528
540
|
}
|
|
529
541
|
function overlapsRange(activity, range) {
|
|
530
|
-
const taskStart = activity.startDate
|
|
531
|
-
const taskEnd = activity.endDate
|
|
532
|
-
const windowStart = range.start
|
|
533
|
-
const windowEnd = range.end
|
|
542
|
+
const taskStart = utcDayMs(activity.startDate);
|
|
543
|
+
const taskEnd = utcDayMs(activity.endDate);
|
|
544
|
+
const windowStart = utcDayMs(range.start);
|
|
545
|
+
const windowEnd = utcDayMs(range.end);
|
|
534
546
|
const fullyInside = taskStart >= windowStart && taskEnd <= windowEnd;
|
|
535
547
|
const startsInside = taskStart >= windowStart && taskStart <= windowEnd;
|
|
536
548
|
const windowStartsInside = windowStart >= taskStart && windowStart <= taskEnd;
|
|
@@ -878,6 +890,7 @@ function dispatchFilterSet(action, deps) {
|
|
|
878
890
|
|
|
879
891
|
// src/internal/hierarchy/root-parent.ts
|
|
880
892
|
var ROOT_PARENT_ID = "0";
|
|
893
|
+
var ROOT_PROJECT_CORRELATIVE_ID = 0;
|
|
881
894
|
function isRootParent(parent) {
|
|
882
895
|
return parent == null || parent === 0 || parent === ROOT_PARENT_ID;
|
|
883
896
|
}
|
|
@@ -1679,13 +1692,19 @@ function resolveExpansionAnchors(originalLink, adapter) {
|
|
|
1679
1692
|
userLag: originalLink.lag ?? 0,
|
|
1680
1693
|
sourceEndpointIsStart,
|
|
1681
1694
|
targetLag: targetEndpointIsFinish ? -endpointSpanHours(target, targetBounds, adapter) : 0,
|
|
1682
|
-
summarySourceId: originalLink.type === LINK_TYPE.START_TO_START && sourceBounds ? originalLink.source : void 0
|
|
1695
|
+
summarySourceId: originalLink.type === LINK_TYPE.START_TO_START && sourceBounds ? originalLink.source : void 0,
|
|
1696
|
+
finishAnchoredSummaryTargetId: targetEndpointIsFinish && targetBounds ? originalLink.target : void 0
|
|
1683
1697
|
};
|
|
1684
1698
|
}
|
|
1685
1699
|
function pushOffsetPreservingLinks(expanded, sourceIds, leafIds, originalLink, adapter, virtualIdCounter, linksByActivity) {
|
|
1686
1700
|
const anchors = resolveExpansionAnchors(originalLink, adapter);
|
|
1687
1701
|
const { source, sourceBounds, targetStart, userLag } = anchors;
|
|
1688
|
-
const {
|
|
1702
|
+
const {
|
|
1703
|
+
sourceEndpointIsStart,
|
|
1704
|
+
targetLag,
|
|
1705
|
+
summarySourceId,
|
|
1706
|
+
finishAnchoredSummaryTargetId
|
|
1707
|
+
} = anchors;
|
|
1689
1708
|
let counter = virtualIdCounter;
|
|
1690
1709
|
for (const srcId of sourceIds) {
|
|
1691
1710
|
const sourceLag = sourceEndpointIsStart ? sourceLagForLeaf(srcId, source, sourceBounds, adapter) : 0;
|
|
@@ -1708,7 +1727,7 @@ function pushOffsetPreservingLinks(expanded, sourceIds, leafIds, originalLink, a
|
|
|
1708
1727
|
targetLag,
|
|
1709
1728
|
userLag + offTarget,
|
|
1710
1729
|
summarySourceId,
|
|
1711
|
-
offTarget !== 0 && targetLag === 0 ? originalLink.target : void 0
|
|
1730
|
+
finishAnchoredSummaryTargetId ?? (offTarget !== 0 && targetLag === 0 ? originalLink.target : void 0)
|
|
1712
1731
|
)
|
|
1713
1732
|
);
|
|
1714
1733
|
counter += 1;
|
|
@@ -1797,6 +1816,9 @@ function findConnectedGroupForTrigger(triggerId, links) {
|
|
|
1797
1816
|
|
|
1798
1817
|
// src/constants/progress.ts
|
|
1799
1818
|
var COMPLETED_PROGRESS = 100;
|
|
1819
|
+
function isAutoSchedulingEnabledForProgress(progress) {
|
|
1820
|
+
return progress === 0;
|
|
1821
|
+
}
|
|
1800
1822
|
|
|
1801
1823
|
// src/autoscheduler/engine/link-calculator.ts
|
|
1802
1824
|
function normalize(predecessor, successor, link) {
|
|
@@ -2156,7 +2178,7 @@ async function asapPass(orderedIds, links, adapter, options, isCurrent, plans) {
|
|
|
2156
2178
|
if (!maxStart || result.successorStart > maxStart) {
|
|
2157
2179
|
maxStart = result.successorStart;
|
|
2158
2180
|
drivingLinkId = String(link.id);
|
|
2159
|
-
drivingOffsetIsStale = link._summaryTargetId !== void 0 && !predecessorMovedThisRun;
|
|
2181
|
+
drivingOffsetIsStale = link._summaryTargetId !== void 0 && !predecessorMovedThisRun && (link._targetLag === 0 || options.preventSummaryTargetPullback === true);
|
|
2160
2182
|
}
|
|
2161
2183
|
}
|
|
2162
2184
|
const staleOffsetWouldPullBack = maxStart !== null && drivingOffsetIsStale && maxStart < activity.startDate;
|
|
@@ -3935,7 +3957,6 @@ var setRealWork = (value) => ({
|
|
|
3935
3957
|
// src/columns/progress/progress-pipeline.ts
|
|
3936
3958
|
var MIN_PROGRESS = 0;
|
|
3937
3959
|
var MAX_PROGRESS = PROGRESS_COMPLETE;
|
|
3938
|
-
var PROGRESS_NONE = 0;
|
|
3939
3960
|
var progressPipeline = {
|
|
3940
3961
|
targetField: "progress",
|
|
3941
3962
|
canEdit(activity, hierarchy) {
|
|
@@ -3955,7 +3976,8 @@ var progressPipeline = {
|
|
|
3955
3976
|
return valid();
|
|
3956
3977
|
},
|
|
3957
3978
|
transform(activity, newValue, ctx) {
|
|
3958
|
-
const autoScheduling =
|
|
3979
|
+
const autoScheduling = isAutoSchedulingEnabledForProgress(newValue);
|
|
3980
|
+
const needsAutoSchedule = activity.progress !== newValue && autoScheduling;
|
|
3959
3981
|
const recursive = isRecursiveProgressChange(newValue);
|
|
3960
3982
|
const realWorkByActivity = buildCanonicalRealWorkOverlay(
|
|
3961
3983
|
activity,
|
|
@@ -3979,7 +4001,7 @@ var progressPipeline = {
|
|
|
3979
4001
|
const postProcessors = [];
|
|
3980
4002
|
const trackingEvents = recursive ? buildRecursiveTrackingEvents(activity, newValue) : void 0;
|
|
3981
4003
|
return fieldChanges(patch, {
|
|
3982
|
-
autoSchedule:
|
|
4004
|
+
autoSchedule: needsAutoSchedule,
|
|
3983
4005
|
postProcessors,
|
|
3984
4006
|
cascadeMutations,
|
|
3985
4007
|
trackingEvents
|
|
@@ -3990,11 +4012,8 @@ var progressPipeline = {
|
|
|
3990
4012
|
function isOutOfRange(value) {
|
|
3991
4013
|
return value < MIN_PROGRESS || value > MAX_PROGRESS;
|
|
3992
4014
|
}
|
|
3993
|
-
function determineAutoScheduling(progress) {
|
|
3994
|
-
return progress === PROGRESS_NONE;
|
|
3995
|
-
}
|
|
3996
4015
|
function isRecursiveProgressChange(value) {
|
|
3997
|
-
return value === PROGRESS_COMPLETE || value
|
|
4016
|
+
return value === PROGRESS_COMPLETE || isAutoSchedulingEnabledForProgress(value);
|
|
3998
4017
|
}
|
|
3999
4018
|
function buildDescendantCascade(activity, newValue, autoScheduling, hierarchy, realWorkByActivity) {
|
|
4000
4019
|
const descendants = hierarchy.getDescendantIds(activity.id);
|
|
@@ -10019,7 +10038,11 @@ async function runPostMutation(deps, args) {
|
|
|
10019
10038
|
if (passes.has(DERIVED_PASS.AUTOSCHEDULE)) {
|
|
10020
10039
|
await refreshMutatedParentBounds(deps.adapter, args);
|
|
10021
10040
|
}
|
|
10022
|
-
const schedule = passes.has(DERIVED_PASS.AUTOSCHEDULE) ? await runAutoschedule(
|
|
10041
|
+
const schedule = passes.has(DERIVED_PASS.AUTOSCHEDULE) ? await runAutoschedule(
|
|
10042
|
+
deps,
|
|
10043
|
+
args.autoscheduleFrom,
|
|
10044
|
+
args.preventSummaryTargetPullback
|
|
10045
|
+
) : emptySchedule();
|
|
10023
10046
|
await rollUpParentBounds(
|
|
10024
10047
|
deps.adapter,
|
|
10025
10048
|
args,
|
|
@@ -10090,8 +10113,11 @@ function collectFieldProgressInvalidations(adapter, beforeById, dirtySeeds, affe
|
|
|
10090
10113
|
}
|
|
10091
10114
|
}
|
|
10092
10115
|
}
|
|
10093
|
-
async function runAutoschedule(deps, autoscheduleFrom) {
|
|
10116
|
+
async function runAutoschedule(deps, autoscheduleFrom, preventSummaryTargetPullback = false) {
|
|
10094
10117
|
const options = autoscheduleFrom === "roots" ? {} : { triggerId: autoscheduleFrom };
|
|
10118
|
+
if (preventSummaryTargetPullback) {
|
|
10119
|
+
options.preventSummaryTargetPullback = true;
|
|
10120
|
+
}
|
|
10095
10121
|
const result = await deps.scheduler.schedule(options);
|
|
10096
10122
|
const outcome = captureScheduledRows(deps.adapter, result.updatedIds);
|
|
10097
10123
|
applyResults(deps.adapter, result);
|
|
@@ -10272,10 +10298,6 @@ function mergeScheduledIds(firstSettleIds, secondSettleIds) {
|
|
|
10272
10298
|
}
|
|
10273
10299
|
|
|
10274
10300
|
// src/dispatch/sir-auto-reject.ts
|
|
10275
|
-
function datesChanged(before, after) {
|
|
10276
|
-
const toTime = (value) => value.getTime();
|
|
10277
|
-
return toTime(before.startDate) !== toTime(after.startDate) || toTime(before.endDate) !== toTime(after.endDate) || before.durationHours !== after.durationHours;
|
|
10278
|
-
}
|
|
10279
10301
|
function detectSirAutoReject(beforeSnap, adapter, touchedIds) {
|
|
10280
10302
|
const effects = [];
|
|
10281
10303
|
for (const id of touchedIds) {
|
|
@@ -10283,21 +10305,15 @@ function detectSirAutoReject(beforeSnap, adapter, touchedIds) {
|
|
|
10283
10305
|
if (!before) continue;
|
|
10284
10306
|
const pendingRequestIds = before.pendingRequestIds ?? [];
|
|
10285
10307
|
if (!isFrozen({ pendingRequestIds })) continue;
|
|
10286
|
-
|
|
10287
|
-
const deleted = after == null;
|
|
10288
|
-
if (!deleted && !datesChanged(before, after)) continue;
|
|
10289
|
-
const reason = deleted ? "activity_deleted" : "date_changed";
|
|
10308
|
+
if (adapter.getActivity(id) != null) continue;
|
|
10290
10309
|
for (const pending of pendingRequestIds) {
|
|
10291
10310
|
effects.push({
|
|
10292
10311
|
kind: "sir-auto-reject",
|
|
10293
10312
|
activityId: id,
|
|
10294
10313
|
sirId: pending,
|
|
10295
|
-
reason
|
|
10314
|
+
reason: "activity_deleted"
|
|
10296
10315
|
});
|
|
10297
10316
|
}
|
|
10298
|
-
if (!deleted) {
|
|
10299
|
-
adapter.setActivityField(id, "pendingRequestIds", []);
|
|
10300
|
-
}
|
|
10301
10317
|
}
|
|
10302
10318
|
return effects;
|
|
10303
10319
|
}
|
|
@@ -11560,14 +11576,21 @@ async function createActivityCore(action, deps, opts = {}) {
|
|
|
11560
11576
|
recomputeUsedCostCascadeForActivity(newId, adapter);
|
|
11561
11577
|
recomputeCostCascadeForActivity(newId, adapter);
|
|
11562
11578
|
}
|
|
11563
|
-
|
|
11579
|
+
const correlativeShifts = recomputeCorrelatives(
|
|
11564
11580
|
adapter,
|
|
11565
11581
|
newId,
|
|
11566
|
-
beforeSnap,
|
|
11567
11582
|
initialTouched,
|
|
11568
11583
|
opts
|
|
11569
11584
|
);
|
|
11570
|
-
return {
|
|
11585
|
+
return {
|
|
11586
|
+
ok: true,
|
|
11587
|
+
newId,
|
|
11588
|
+
parent,
|
|
11589
|
+
newActivity,
|
|
11590
|
+
beforeSnap,
|
|
11591
|
+
initialTouched,
|
|
11592
|
+
correlativeShifts
|
|
11593
|
+
};
|
|
11571
11594
|
}
|
|
11572
11595
|
function validateCreateTarget(action, adapter) {
|
|
11573
11596
|
const isRoot = isRootParent(action.parentId);
|
|
@@ -11662,20 +11685,16 @@ function applyParentMutations(action, newId, parent, adapter, parentWasLeaf) {
|
|
|
11662
11685
|
);
|
|
11663
11686
|
}
|
|
11664
11687
|
}
|
|
11665
|
-
function
|
|
11666
|
-
if (opts.skipCorrelativeRecompute) return;
|
|
11667
|
-
const
|
|
11668
|
-
|
|
11669
|
-
foldCorrelativeShifts(
|
|
11670
|
-
adapter,
|
|
11671
|
-
correlativeShifts,
|
|
11672
|
-
/* @__PURE__ */ new Set([String(newId)]),
|
|
11673
|
-
beforeSnap,
|
|
11674
|
-
initialTouched
|
|
11688
|
+
function recomputeCorrelatives(adapter, newId, initialTouched, opts) {
|
|
11689
|
+
if (opts.skipCorrelativeRecompute) return [];
|
|
11690
|
+
const shifts = recomputeCorrelativeIds(adapter).filter(
|
|
11691
|
+
(shift) => shift.activityId !== String(newId)
|
|
11675
11692
|
);
|
|
11693
|
+
for (const shift of shifts) initialTouched.add(shift.activityId);
|
|
11694
|
+
return shifts;
|
|
11676
11695
|
}
|
|
11677
11696
|
async function buildCreateChangeSet(adapter, action, coreResult, scheduledIds, hoursPerDay) {
|
|
11678
|
-
const { newId, newActivity, beforeSnap, initialTouched } = coreResult;
|
|
11697
|
+
const { newId, newActivity, beforeSnap, initialTouched, correlativeShifts } = coreResult;
|
|
11679
11698
|
const trackingEvent = {
|
|
11680
11699
|
name: DISPATCH_TRACK_EVENT.ACTIVITY_CREATION,
|
|
11681
11700
|
properties: {
|
|
@@ -11692,6 +11711,7 @@ async function buildCreateChangeSet(adapter, action, coreResult, scheduledIds, h
|
|
|
11692
11711
|
beforeSnap,
|
|
11693
11712
|
touchedIds: initialTouched,
|
|
11694
11713
|
scheduledIds,
|
|
11714
|
+
correlativeShifts,
|
|
11695
11715
|
trackingEvents: [trackingEvent]});
|
|
11696
11716
|
}
|
|
11697
11717
|
async function dispatchActivityCreate(action, options, deps) {
|
|
@@ -11720,8 +11740,9 @@ async function dispatchActivityCreate(action, options, deps) {
|
|
|
11720
11740
|
},
|
|
11721
11741
|
{
|
|
11722
11742
|
action,
|
|
11723
|
-
autoscheduleFrom:
|
|
11743
|
+
autoscheduleFrom: newId,
|
|
11724
11744
|
recomputeParentsFrom: [newId],
|
|
11745
|
+
preventSummaryTargetPullback: true,
|
|
11725
11746
|
now: deps.now,
|
|
11726
11747
|
options
|
|
11727
11748
|
}
|
|
@@ -11878,7 +11899,11 @@ async function dispatchActivityDelete(action, options, deps) {
|
|
|
11878
11899
|
return { ok: false, reason: REJECTION_REASON.ACTIVITY_NOT_FOUND };
|
|
11879
11900
|
}
|
|
11880
11901
|
}
|
|
11881
|
-
const
|
|
11902
|
+
const deletableActivityIds = action.activityIds.filter((id) => {
|
|
11903
|
+
const activity = adapter.getActivity(id);
|
|
11904
|
+
return !(activity?.correlativeId === ROOT_PROJECT_CORRELATIVE_ID && activity.type === ACTIVITY_TYPE.PROJECT);
|
|
11905
|
+
});
|
|
11906
|
+
const toDelete = collectDescendantIds(deletableActivityIds, adapter);
|
|
11882
11907
|
const incidentLinkIds = collectIncidentLinkIds(toDelete, adapter);
|
|
11883
11908
|
const parentsToCheck = /* @__PURE__ */ new Set();
|
|
11884
11909
|
for (const id of action.activityIds) {
|
|
@@ -12615,10 +12640,12 @@ async function applyReconciledProgress(entries, deps) {
|
|
|
12615
12640
|
const before = await snapshotActivities(deps.adapter, touched);
|
|
12616
12641
|
deps.adapter.batchUpdate(() => {
|
|
12617
12642
|
for (const entry of progressToApply) {
|
|
12643
|
+
const activityId = String(entry.activityId);
|
|
12644
|
+
deps.adapter.setActivityField(activityId, "progress", entry.progress);
|
|
12618
12645
|
deps.adapter.setActivityField(
|
|
12619
|
-
|
|
12620
|
-
"
|
|
12621
|
-
entry.progress
|
|
12646
|
+
activityId,
|
|
12647
|
+
"autoScheduling",
|
|
12648
|
+
isAutoSchedulingEnabledForProgress(entry.progress)
|
|
12622
12649
|
);
|
|
12623
12650
|
}
|
|
12624
12651
|
recomputeProgressRollupForParents(ancestors, deps.adapter);
|
|
@@ -12789,7 +12816,7 @@ async function dispatchActivityLookaheadSync(action, options, deps) {
|
|
|
12789
12816
|
},
|
|
12790
12817
|
{
|
|
12791
12818
|
action,
|
|
12792
|
-
autoscheduleFrom: null,
|
|
12819
|
+
autoscheduleFrom: action.persistedProgress === 0 ? ids[0] : null,
|
|
12793
12820
|
recomputeParentsFrom: [],
|
|
12794
12821
|
now: deps.now,
|
|
12795
12822
|
options
|
|
@@ -14406,9 +14433,13 @@ function resolveDestination(afterSiblingId, adapter) {
|
|
|
14406
14433
|
if (!sibling) {
|
|
14407
14434
|
return { ok: false, reason: REJECTION_REASON.ANCHOR_SIBLING_NOT_FOUND };
|
|
14408
14435
|
}
|
|
14436
|
+
if (sibling.parentId == null) {
|
|
14437
|
+
return adapter.getRootIds().length === 1 ? { ok: true, parentId: sibling.id } : { ok: true, parentId: ROOT_PARENT_ID, afterSiblingId };
|
|
14438
|
+
}
|
|
14409
14439
|
return {
|
|
14410
14440
|
ok: true,
|
|
14411
|
-
parentId:
|
|
14441
|
+
parentId: String(sibling.parentId),
|
|
14442
|
+
afterSiblingId
|
|
14412
14443
|
};
|
|
14413
14444
|
}
|
|
14414
14445
|
var invariantFailure = () => ({
|
|
@@ -14435,12 +14466,11 @@ async function dispatchActivityPasteCopied(action, options, deps) {
|
|
|
14435
14466
|
let previousRootId;
|
|
14436
14467
|
for (const copied of clipboard.activities) {
|
|
14437
14468
|
const mappedParent = originalToNew.get(copied.originalParentId);
|
|
14469
|
+
const afterSiblingId = mappedParent === void 0 ? previousRootId ?? destination.afterSiblingId : void 0;
|
|
14438
14470
|
const created = await createActivityCore(
|
|
14439
14471
|
{
|
|
14440
14472
|
parentId: mappedParent ?? destination.parentId,
|
|
14441
|
-
...
|
|
14442
|
-
afterSiblingId: previousRootId ?? action.destination.afterSiblingId
|
|
14443
|
-
} : {},
|
|
14473
|
+
...afterSiblingId === void 0 ? {} : { afterSiblingId },
|
|
14444
14474
|
overrides: cloneDomainValue(copied.overrides),
|
|
14445
14475
|
eventSource: action.eventSource
|
|
14446
14476
|
},
|
|
@@ -19283,7 +19313,10 @@ var SaveTracker = class _SaveTracker {
|
|
|
19283
19313
|
const persistable = {
|
|
19284
19314
|
...saved.persistable,
|
|
19285
19315
|
...acknowledgesLookahead ? { isLookahead: current.isLookahead } : {},
|
|
19286
|
-
...acknowledgesProgress ? {
|
|
19316
|
+
...acknowledgesProgress ? {
|
|
19317
|
+
progress: current.progress,
|
|
19318
|
+
autoScheduling: current.autoScheduling
|
|
19319
|
+
} : {}
|
|
19287
19320
|
};
|
|
19288
19321
|
this.activitiesAtLastSave.set(activityId, {
|
|
19289
19322
|
...saved,
|
|
@@ -19442,9 +19475,6 @@ function normalizeActivities(rawActivities, context) {
|
|
|
19442
19475
|
reparentOrphansToRoot(activities, activityIds, context.reporter);
|
|
19443
19476
|
return { activities, activityIds, hiddenIds };
|
|
19444
19477
|
}
|
|
19445
|
-
function isAutoSchedulable(progress) {
|
|
19446
|
-
return progress === 0;
|
|
19447
|
-
}
|
|
19448
19478
|
function parseConstraintLabel(label, reporter) {
|
|
19449
19479
|
if (!label) return null;
|
|
19450
19480
|
const normalized2 = CONSTRAINT_LABEL_MAP[label.toUpperCase()];
|
|
@@ -19546,7 +19576,7 @@ function parseActivity(raw, context) {
|
|
|
19546
19576
|
durationHours: durationToHours(durationDays, context.hoursPerDay),
|
|
19547
19577
|
constraintType,
|
|
19548
19578
|
constraintDate,
|
|
19549
|
-
autoScheduling:
|
|
19579
|
+
autoScheduling: isAutoSchedulingEnabledForProgress(progress),
|
|
19550
19580
|
calendarId,
|
|
19551
19581
|
assignedDefaultCalendar: calendarId != null && inheritedDefaultCalendar,
|
|
19552
19582
|
dateOrigin: raw.date_origin == null ? null : parseBackendDate(raw.date_origin),
|
|
@@ -21408,6 +21438,11 @@ var ScheduleCore = class _ScheduleCore {
|
|
|
21408
21438
|
this.assertReady();
|
|
21409
21439
|
return this.coreRuntime.state.hiddenIds().map(String);
|
|
21410
21440
|
}
|
|
21441
|
+
getVisibleActivityIds() {
|
|
21442
|
+
this.assertReady();
|
|
21443
|
+
const hiddenIds = new Set(this.coreRuntime.state.hiddenIds().map(String));
|
|
21444
|
+
return this.coreRuntime.state.getAllIds().map(String).filter((activityId) => !hiddenIds.has(activityId));
|
|
21445
|
+
}
|
|
21411
21446
|
getActiveFilter() {
|
|
21412
21447
|
this.assertReady();
|
|
21413
21448
|
return cloneDomainValue(this.coreRuntime.state.getActiveFilter());
|