gantt-lib 0.124.1 → 0.125.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/index.css.map +1 -1
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +32 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -8
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +0 -27
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3032,7 +3032,8 @@ var TaskRow = React2.memo(
|
|
|
3032
3032
|
}
|
|
3033
3033
|
return calculateTaskBar(baselineStartDate, baselineEndDate, monthStart, dayWidth);
|
|
3034
3034
|
}, [baselineStartDate, baselineEndDate, milestone, monthStart, dayWidth]);
|
|
3035
|
-
const
|
|
3035
|
+
const criticalBarColor = "var(--gantt-critical-path-color, #dc2626)";
|
|
3036
|
+
const barColor = isExpired ? "var(--gantt-expired-color)" : isCritical ? criticalBarColor : task.color || "var(--gantt-task-bar-default-color)";
|
|
3036
3037
|
const progressWidth = useMemo2(() => {
|
|
3037
3038
|
if (task.progress === void 0 || task.progress <= 0) return 0;
|
|
3038
3039
|
return Math.min(100, Math.max(0, Math.round(task.progress)));
|
|
@@ -3041,21 +3042,31 @@ var TaskRow = React2.memo(
|
|
|
3041
3042
|
if (isExpired) {
|
|
3042
3043
|
return "color-mix(in srgb, var(--gantt-expired-color) 40%, black)";
|
|
3043
3044
|
}
|
|
3045
|
+
if (isCritical) {
|
|
3046
|
+
return `color-mix(in srgb, ${criticalBarColor} 40%, black)`;
|
|
3047
|
+
}
|
|
3044
3048
|
if (progressWidth === 100) {
|
|
3045
3049
|
return task.accepted ? "var(--gantt-progress-accepted, #22c55e)" : "var(--gantt-progress-completed, #fbbf24)";
|
|
3046
3050
|
}
|
|
3047
3051
|
const baseColor = task.color || "var(--gantt-task-bar-default-color)";
|
|
3048
3052
|
return `color-mix(in srgb, ${baseColor} 40%, black)`;
|
|
3049
|
-
}, [isExpired, progressWidth, task.accepted, task.color]);
|
|
3053
|
+
}, [isCritical, isExpired, progressWidth, task.accepted, task.color]);
|
|
3050
3054
|
const externalTaskNameColor = useMemo2(() => {
|
|
3051
3055
|
if (isExpired) {
|
|
3052
3056
|
return "color-mix(in srgb, var(--gantt-expired-color) 40%, black)";
|
|
3053
3057
|
}
|
|
3054
3058
|
const baseColor = isParent ? task.color || defaultParentBarColor : task.color || "var(--gantt-task-bar-default-color)";
|
|
3055
3059
|
return `color-mix(in srgb, ${baseColor} 40%, black)`;
|
|
3056
|
-
}, [defaultParentBarColor, isExpired, isParent, task.color]);
|
|
3060
|
+
}, [defaultParentBarColor, isCritical, isExpired, isParent, task.color]);
|
|
3057
3061
|
const barStyle = useMemo2(() => {
|
|
3058
3062
|
const parentBarColor = task.color || defaultParentBarColor;
|
|
3063
|
+
if (isCritical && !isExpired) {
|
|
3064
|
+
const c = criticalBarColor;
|
|
3065
|
+
if (isParent) {
|
|
3066
|
+
return { backgroundColor: c, "--gantt-parent-bar-color": c };
|
|
3067
|
+
}
|
|
3068
|
+
return { backgroundColor: c };
|
|
3069
|
+
}
|
|
3059
3070
|
if (isParent) {
|
|
3060
3071
|
if (progressWidth >= 100) {
|
|
3061
3072
|
const c = isExpired ? "color-mix(in srgb, var(--gantt-expired-color) 40%, black)" : `color-mix(in srgb, ${parentBarColor} 40%, black)`;
|
|
@@ -3067,7 +3078,7 @@ var TaskRow = React2.memo(
|
|
|
3067
3078
|
return { backgroundColor: progressColor };
|
|
3068
3079
|
}
|
|
3069
3080
|
return { backgroundColor: barColor };
|
|
3070
|
-
}, [defaultParentBarColor, isExpired, isParent, progressWidth, barColor, progressColor, task.color]);
|
|
3081
|
+
}, [isCritical, defaultParentBarColor, isExpired, isParent, progressWidth, barColor, progressColor, task.color]);
|
|
3071
3082
|
const handleDragEnd = (result) => {
|
|
3072
3083
|
const updatedTask = {
|
|
3073
3084
|
...normalizedTask,
|
|
@@ -3646,6 +3657,7 @@ var DependencyLines = React6.memo(({
|
|
|
3646
3657
|
for (const task of allTasks) {
|
|
3647
3658
|
if (positions.has(task.id)) continue;
|
|
3648
3659
|
if (collapsedParentIds.size > 0 && isTaskHidden(task.id, collapsedParentIds, taskMap)) continue;
|
|
3660
|
+
if (rowIndexByTaskId && !rowIndexByTaskId.has(task.id)) continue;
|
|
3649
3661
|
hidden.add(task.id);
|
|
3650
3662
|
const override = dragOverrides?.get(task.id);
|
|
3651
3663
|
const computed = resolveTaskHorizontalGeometry(task, monthStart, dayWidth, override);
|
|
@@ -7582,6 +7594,8 @@ var TaskList = ({
|
|
|
7582
7594
|
filterMode = "highlight",
|
|
7583
7595
|
filteredTaskIds = /* @__PURE__ */ new Set(),
|
|
7584
7596
|
isFilterActive = false,
|
|
7597
|
+
criticalPathMode,
|
|
7598
|
+
criticalTaskIds,
|
|
7585
7599
|
additionalColumns,
|
|
7586
7600
|
hiddenTaskListColumns,
|
|
7587
7601
|
taskListColumnWidths,
|
|
@@ -7642,8 +7656,11 @@ var TaskList = ({
|
|
|
7642
7656
|
if (filterMode === "hide" && isFilterActive) {
|
|
7643
7657
|
tasks2 = tasks2.filter((task) => filteredTaskIds.has(task.id));
|
|
7644
7658
|
}
|
|
7659
|
+
if (criticalPathMode === "hide" && criticalTaskIds) {
|
|
7660
|
+
tasks2 = tasks2.filter((task) => criticalTaskIds.has(task.id));
|
|
7661
|
+
}
|
|
7645
7662
|
return tasks2;
|
|
7646
|
-
}, [orderedTasks, collapsedParentIds, filterMode, filteredTaskIds, isFilterActive]);
|
|
7663
|
+
}, [orderedTasks, collapsedParentIds, filterMode, filteredTaskIds, isFilterActive, criticalPathMode, criticalTaskIds]);
|
|
7647
7664
|
const totalHeight = useMemo9(
|
|
7648
7665
|
() => visibleTasks.length * rowHeight,
|
|
7649
7666
|
[visibleTasks.length, rowHeight]
|
|
@@ -12884,13 +12901,18 @@ function TaskGanttChartInner(props, ref) {
|
|
|
12884
12901
|
if (filterMode === "hide") {
|
|
12885
12902
|
return /* @__PURE__ */ new Set();
|
|
12886
12903
|
}
|
|
12887
|
-
|
|
12904
|
+
const criticalHighlightMode = criticalPathMode === "highlight";
|
|
12905
|
+
const hasExternalHighlights = !!highlightedTaskIds && highlightedTaskIds.size > 0;
|
|
12906
|
+
if (!hasExternalHighlights && matchedTaskIds.size === 0 && !criticalHighlightMode) {
|
|
12888
12907
|
return /* @__PURE__ */ new Set();
|
|
12889
12908
|
}
|
|
12890
12909
|
const mergedHighlightedTaskIds = new Set(highlightedTaskIds ?? []);
|
|
12891
12910
|
matchedTaskIds.forEach((taskId) => mergedHighlightedTaskIds.add(taskId));
|
|
12911
|
+
if (criticalHighlightMode) {
|
|
12912
|
+
criticalTaskIds.forEach((taskId) => mergedHighlightedTaskIds.add(taskId));
|
|
12913
|
+
}
|
|
12892
12914
|
return mergedHighlightedTaskIds;
|
|
12893
|
-
}, [filterMode, highlightedTaskIds, matchedTaskIds]);
|
|
12915
|
+
}, [filterMode, highlightedTaskIds, matchedTaskIds, criticalPathMode, criticalTaskIds]);
|
|
12894
12916
|
const totalGridHeight = useMemo13(
|
|
12895
12917
|
() => visibleTasks.length * effectiveRowHeight,
|
|
12896
12918
|
[effectiveRowHeight, visibleTasks.length]
|
|
@@ -13644,6 +13666,8 @@ function TaskGanttChartInner(props, ref) {
|
|
|
13644
13666
|
filterMode,
|
|
13645
13667
|
filteredTaskIds: matchedTaskIds,
|
|
13646
13668
|
isFilterActive: !!taskFilter,
|
|
13669
|
+
criticalPathMode,
|
|
13670
|
+
criticalTaskIds: criticalPathMode === "hide" ? criticalTaskIds : void 0,
|
|
13647
13671
|
additionalColumns,
|
|
13648
13672
|
hiddenTaskListColumns,
|
|
13649
13673
|
taskListColumnWidths,
|
|
@@ -13883,7 +13907,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
13883
13907
|
onCascade: handleCascade,
|
|
13884
13908
|
highlightExpiredTasks,
|
|
13885
13909
|
showBaseline,
|
|
13886
|
-
isFilterMatch: filterMode === "highlight" ? matchedTaskIds.has(task.id) : false,
|
|
13910
|
+
isFilterMatch: (filterMode === "highlight" ? matchedTaskIds.has(task.id) : false) || (criticalPathMode === "highlight" ? criticalTaskIds.has(task.id) : false),
|
|
13887
13911
|
isCritical: criticalTaskIds.has(task.id),
|
|
13888
13912
|
businessDays,
|
|
13889
13913
|
customDays,
|