gantt-lib 0.124.2 → 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.js +24 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -7
- 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);
|
|
@@ -12889,13 +12901,18 @@ function TaskGanttChartInner(props, ref) {
|
|
|
12889
12901
|
if (filterMode === "hide") {
|
|
12890
12902
|
return /* @__PURE__ */ new Set();
|
|
12891
12903
|
}
|
|
12892
|
-
|
|
12904
|
+
const criticalHighlightMode = criticalPathMode === "highlight";
|
|
12905
|
+
const hasExternalHighlights = !!highlightedTaskIds && highlightedTaskIds.size > 0;
|
|
12906
|
+
if (!hasExternalHighlights && matchedTaskIds.size === 0 && !criticalHighlightMode) {
|
|
12893
12907
|
return /* @__PURE__ */ new Set();
|
|
12894
12908
|
}
|
|
12895
12909
|
const mergedHighlightedTaskIds = new Set(highlightedTaskIds ?? []);
|
|
12896
12910
|
matchedTaskIds.forEach((taskId) => mergedHighlightedTaskIds.add(taskId));
|
|
12911
|
+
if (criticalHighlightMode) {
|
|
12912
|
+
criticalTaskIds.forEach((taskId) => mergedHighlightedTaskIds.add(taskId));
|
|
12913
|
+
}
|
|
12897
12914
|
return mergedHighlightedTaskIds;
|
|
12898
|
-
}, [filterMode, highlightedTaskIds, matchedTaskIds]);
|
|
12915
|
+
}, [filterMode, highlightedTaskIds, matchedTaskIds, criticalPathMode, criticalTaskIds]);
|
|
12899
12916
|
const totalGridHeight = useMemo13(
|
|
12900
12917
|
() => visibleTasks.length * effectiveRowHeight,
|
|
12901
12918
|
[effectiveRowHeight, visibleTasks.length]
|
|
@@ -13890,7 +13907,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
13890
13907
|
onCascade: handleCascade,
|
|
13891
13908
|
highlightExpiredTasks,
|
|
13892
13909
|
showBaseline,
|
|
13893
|
-
isFilterMatch: filterMode === "highlight" ? matchedTaskIds.has(task.id) : false,
|
|
13910
|
+
isFilterMatch: (filterMode === "highlight" ? matchedTaskIds.has(task.id) : false) || (criticalPathMode === "highlight" ? criticalTaskIds.has(task.id) : false),
|
|
13894
13911
|
isCritical: criticalTaskIds.has(task.id),
|
|
13895
13912
|
businessDays,
|
|
13896
13913
|
customDays,
|