gantt-lib 0.3.1 → 0.3.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/dist/index.js +26 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1180,7 +1180,6 @@ var TaskRow = import_react3.default.memo(
|
|
|
1180
1180
|
if (!highlightExpiredTasks) return false;
|
|
1181
1181
|
const now = /* @__PURE__ */ new Date();
|
|
1182
1182
|
const today = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()));
|
|
1183
|
-
const tomorrow = new Date(Date.UTC(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate() + 1));
|
|
1184
1183
|
const taskStart = parseUTCDate(task.startDate);
|
|
1185
1184
|
const taskEnd = parseUTCDate(task.endDate);
|
|
1186
1185
|
const actualProgress = task.progress ?? 0;
|
|
@@ -1188,12 +1187,11 @@ var TaskRow = import_react3.default.memo(
|
|
|
1188
1187
|
return false;
|
|
1189
1188
|
}
|
|
1190
1189
|
const msPerDay = 1e3 * 60 * 60 * 24;
|
|
1191
|
-
const
|
|
1192
|
-
const
|
|
1193
|
-
const
|
|
1194
|
-
const
|
|
1195
|
-
|
|
1196
|
-
return actualProgress < todayPosition;
|
|
1190
|
+
const duration = taskEnd.getTime() - taskStart.getTime() + msPerDay;
|
|
1191
|
+
const elapsedCutoff = taskEnd.getTime() < today.getTime() ? taskEnd.getTime() : today.getTime();
|
|
1192
|
+
const elapsed = elapsedCutoff - taskStart.getTime();
|
|
1193
|
+
const expected = elapsed / duration * 100;
|
|
1194
|
+
return actualProgress < expected;
|
|
1197
1195
|
}, [task.startDate, task.endDate, task.progress, highlightExpiredTasks]);
|
|
1198
1196
|
const { left, width } = (0, import_react3.useMemo)(
|
|
1199
1197
|
() => calculateTaskBar(taskStartDate, taskEndDate, monthStart, dayWidth),
|
|
@@ -2664,6 +2662,27 @@ var GanttChart = (0, import_react12.forwardRef)(({
|
|
|
2664
2662
|
const cascadedTask = updatedTask;
|
|
2665
2663
|
const cascadedChain = cascadeByLinks(updatedTask.id, newStart, newEnd, tasks);
|
|
2666
2664
|
const allCascaded = [cascadedTask, ...cascadedChain];
|
|
2665
|
+
const now = /* @__PURE__ */ new Date();
|
|
2666
|
+
const today = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()));
|
|
2667
|
+
const msPerDay = 1e3 * 60 * 60 * 24;
|
|
2668
|
+
console.log("[GanttChart handleTaskChange] IsExpired calculation:");
|
|
2669
|
+
for (const t of allCascaded) {
|
|
2670
|
+
const taskStart = new Date(t.startDate);
|
|
2671
|
+
const taskEnd = new Date(t.endDate);
|
|
2672
|
+
const actualProgress = t.progress ?? 0;
|
|
2673
|
+
if (actualProgress >= 100) {
|
|
2674
|
+
console.log(` [${t.id}] START=${t.startDate} END=${t.endDate} TODAY=${today.toISOString().split("T")[0]} PROGRESS=${actualProgress}% EXPECTED=N/A (completed) EXPIRED=NO`);
|
|
2675
|
+
continue;
|
|
2676
|
+
}
|
|
2677
|
+
const duration = taskEnd.getTime() - taskStart.getTime() + msPerDay;
|
|
2678
|
+
const elapsedCutoff = taskEnd.getTime() < today.getTime() ? taskEnd.getTime() : today.getTime();
|
|
2679
|
+
const elapsed = elapsedCutoff - taskStart.getTime();
|
|
2680
|
+
const expectedProgress = Math.min(100, Math.max(0, elapsed / duration * 100));
|
|
2681
|
+
const isExpired = actualProgress < expectedProgress;
|
|
2682
|
+
const durationDays = Math.round(duration / msPerDay);
|
|
2683
|
+
const elapsedDays = Math.round(elapsed / msPerDay);
|
|
2684
|
+
console.log(` [${t.id}] START=${t.startDate} END=${t.endDate} TODAY=${today.toISOString().split("T")[0]} PROGRESS=${actualProgress}% DURATION=${durationDays}d ELAPSED=${elapsedDays}d EXPECTED=${expectedProgress.toFixed(1)}% EXPIRED=${isExpired ? "YES" : "NO"}`);
|
|
2685
|
+
}
|
|
2667
2686
|
onChange?.((currentTasks) => {
|
|
2668
2687
|
const m = new Map(allCascaded.map((t) => [t.id, t]));
|
|
2669
2688
|
return currentTasks.map((t) => m.get(t.id) ?? t);
|