gantt-lib 0.145.1 → 0.146.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.js +17 -7
- package/dist/core/scheduling/index.js.map +1 -1
- package/dist/core/scheduling/index.mjs +17 -7
- package/dist/core/scheduling/index.mjs.map +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +150 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +150 -31
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +32 -0
- package/package.json +1 -1
|
@@ -1255,8 +1255,8 @@ function recalculateProjectSchedule(snapshot, options) {
|
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
1257
|
const queue = snapshot.filter((task) => (indegree.get(task.id) ?? 0) === 0).map((task) => task.id);
|
|
1258
|
-
|
|
1259
|
-
const currentId = queue
|
|
1258
|
+
for (let queueIndex = 0; queueIndex < queue.length; queueIndex++) {
|
|
1259
|
+
const currentId = queue[queueIndex];
|
|
1260
1260
|
for (const successorId of successorIdsByTask.get(currentId) ?? []) {
|
|
1261
1261
|
const nextIndegree = (indegree.get(successorId) ?? 0) - 1;
|
|
1262
1262
|
indegree.set(successorId, nextIndegree);
|
|
@@ -1307,7 +1307,13 @@ function recalculateProjectSchedule(snapshot, options) {
|
|
|
1307
1307
|
queue.push(successorId);
|
|
1308
1308
|
}
|
|
1309
1309
|
}
|
|
1310
|
-
const
|
|
1310
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
1311
|
+
for (const task of snapshot) if (task.parentId) {
|
|
1312
|
+
const children = childrenByParent.get(task.parentId) ?? [];
|
|
1313
|
+
children.push(task.id);
|
|
1314
|
+
childrenByParent.set(task.parentId, children);
|
|
1315
|
+
}
|
|
1316
|
+
const parentsByDepth = snapshot.filter((task) => childrenByParent.has(task.id)).map((task) => {
|
|
1311
1317
|
let depth = 0;
|
|
1312
1318
|
let current = task.parentId ? workingMap.get(task.parentId) : void 0;
|
|
1313
1319
|
while (current) {
|
|
@@ -1316,17 +1322,21 @@ function recalculateProjectSchedule(snapshot, options) {
|
|
|
1316
1322
|
}
|
|
1317
1323
|
return { taskId: task.id, depth };
|
|
1318
1324
|
}).sort((left, right) => right.depth - left.depth);
|
|
1319
|
-
const workingTasks = () => Array.from(workingMap.values());
|
|
1320
1325
|
for (const { taskId } of parentsByDepth) {
|
|
1321
1326
|
const parent = workingMap.get(taskId);
|
|
1322
1327
|
if (!parent || parent.locked) {
|
|
1323
1328
|
continue;
|
|
1324
1329
|
}
|
|
1325
|
-
|
|
1330
|
+
let startTime = Infinity, endTime = -Infinity;
|
|
1331
|
+
for (const childId of childrenByParent.get(taskId)) {
|
|
1332
|
+
const child = workingMap.get(childId);
|
|
1333
|
+
startTime = Math.min(startTime, new Date(child.startDate).getTime());
|
|
1334
|
+
endTime = Math.max(endTime, new Date(child.endDate).getTime());
|
|
1335
|
+
}
|
|
1326
1336
|
workingMap.set(taskId, {
|
|
1327
1337
|
...parent,
|
|
1328
|
-
startDate: toIsoDate(
|
|
1329
|
-
endDate: toIsoDate(
|
|
1338
|
+
startDate: toIsoDate(new Date(startTime)),
|
|
1339
|
+
endDate: toIsoDate(new Date(endTime))
|
|
1330
1340
|
});
|
|
1331
1341
|
}
|
|
1332
1342
|
return createChangedResult(snapshot, Array.from(workingMap.values()));
|