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.js
CHANGED
|
@@ -3177,7 +3177,8 @@ var TaskRow = import_react3.default.memo(
|
|
|
3177
3177
|
}
|
|
3178
3178
|
return calculateTaskBar(baselineStartDate, baselineEndDate, monthStart, dayWidth);
|
|
3179
3179
|
}, [baselineStartDate, baselineEndDate, milestone, monthStart, dayWidth]);
|
|
3180
|
-
const
|
|
3180
|
+
const criticalBarColor = "var(--gantt-critical-path-color, #dc2626)";
|
|
3181
|
+
const barColor = isExpired ? "var(--gantt-expired-color)" : isCritical ? criticalBarColor : task.color || "var(--gantt-task-bar-default-color)";
|
|
3181
3182
|
const progressWidth = (0, import_react3.useMemo)(() => {
|
|
3182
3183
|
if (task.progress === void 0 || task.progress <= 0) return 0;
|
|
3183
3184
|
return Math.min(100, Math.max(0, Math.round(task.progress)));
|
|
@@ -3186,21 +3187,31 @@ var TaskRow = import_react3.default.memo(
|
|
|
3186
3187
|
if (isExpired) {
|
|
3187
3188
|
return "color-mix(in srgb, var(--gantt-expired-color) 40%, black)";
|
|
3188
3189
|
}
|
|
3190
|
+
if (isCritical) {
|
|
3191
|
+
return `color-mix(in srgb, ${criticalBarColor} 40%, black)`;
|
|
3192
|
+
}
|
|
3189
3193
|
if (progressWidth === 100) {
|
|
3190
3194
|
return task.accepted ? "var(--gantt-progress-accepted, #22c55e)" : "var(--gantt-progress-completed, #fbbf24)";
|
|
3191
3195
|
}
|
|
3192
3196
|
const baseColor = task.color || "var(--gantt-task-bar-default-color)";
|
|
3193
3197
|
return `color-mix(in srgb, ${baseColor} 40%, black)`;
|
|
3194
|
-
}, [isExpired, progressWidth, task.accepted, task.color]);
|
|
3198
|
+
}, [isCritical, isExpired, progressWidth, task.accepted, task.color]);
|
|
3195
3199
|
const externalTaskNameColor = (0, import_react3.useMemo)(() => {
|
|
3196
3200
|
if (isExpired) {
|
|
3197
3201
|
return "color-mix(in srgb, var(--gantt-expired-color) 40%, black)";
|
|
3198
3202
|
}
|
|
3199
3203
|
const baseColor = isParent ? task.color || defaultParentBarColor : task.color || "var(--gantt-task-bar-default-color)";
|
|
3200
3204
|
return `color-mix(in srgb, ${baseColor} 40%, black)`;
|
|
3201
|
-
}, [defaultParentBarColor, isExpired, isParent, task.color]);
|
|
3205
|
+
}, [defaultParentBarColor, isCritical, isExpired, isParent, task.color]);
|
|
3202
3206
|
const barStyle = (0, import_react3.useMemo)(() => {
|
|
3203
3207
|
const parentBarColor = task.color || defaultParentBarColor;
|
|
3208
|
+
if (isCritical && !isExpired) {
|
|
3209
|
+
const c = criticalBarColor;
|
|
3210
|
+
if (isParent) {
|
|
3211
|
+
return { backgroundColor: c, "--gantt-parent-bar-color": c };
|
|
3212
|
+
}
|
|
3213
|
+
return { backgroundColor: c };
|
|
3214
|
+
}
|
|
3204
3215
|
if (isParent) {
|
|
3205
3216
|
if (progressWidth >= 100) {
|
|
3206
3217
|
const c = isExpired ? "color-mix(in srgb, var(--gantt-expired-color) 40%, black)" : `color-mix(in srgb, ${parentBarColor} 40%, black)`;
|
|
@@ -3212,7 +3223,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
3212
3223
|
return { backgroundColor: progressColor };
|
|
3213
3224
|
}
|
|
3214
3225
|
return { backgroundColor: barColor };
|
|
3215
|
-
}, [defaultParentBarColor, isExpired, isParent, progressWidth, barColor, progressColor, task.color]);
|
|
3226
|
+
}, [isCritical, defaultParentBarColor, isExpired, isParent, progressWidth, barColor, progressColor, task.color]);
|
|
3216
3227
|
const handleDragEnd = (result) => {
|
|
3217
3228
|
const updatedTask = {
|
|
3218
3229
|
...normalizedTask,
|
|
@@ -3791,6 +3802,7 @@ var DependencyLines = import_react7.default.memo(({
|
|
|
3791
3802
|
for (const task of allTasks) {
|
|
3792
3803
|
if (positions.has(task.id)) continue;
|
|
3793
3804
|
if (collapsedParentIds.size > 0 && isTaskHidden(task.id, collapsedParentIds, taskMap)) continue;
|
|
3805
|
+
if (rowIndexByTaskId && !rowIndexByTaskId.has(task.id)) continue;
|
|
3794
3806
|
hidden.add(task.id);
|
|
3795
3807
|
const override = dragOverrides?.get(task.id);
|
|
3796
3808
|
const computed = resolveTaskHorizontalGeometry(task, monthStart, dayWidth, override);
|
|
@@ -13010,13 +13022,18 @@ function TaskGanttChartInner(props, ref) {
|
|
|
13010
13022
|
if (filterMode === "hide") {
|
|
13011
13023
|
return /* @__PURE__ */ new Set();
|
|
13012
13024
|
}
|
|
13013
|
-
|
|
13025
|
+
const criticalHighlightMode = criticalPathMode === "highlight";
|
|
13026
|
+
const hasExternalHighlights = !!highlightedTaskIds && highlightedTaskIds.size > 0;
|
|
13027
|
+
if (!hasExternalHighlights && matchedTaskIds.size === 0 && !criticalHighlightMode) {
|
|
13014
13028
|
return /* @__PURE__ */ new Set();
|
|
13015
13029
|
}
|
|
13016
13030
|
const mergedHighlightedTaskIds = new Set(highlightedTaskIds ?? []);
|
|
13017
13031
|
matchedTaskIds.forEach((taskId) => mergedHighlightedTaskIds.add(taskId));
|
|
13032
|
+
if (criticalHighlightMode) {
|
|
13033
|
+
criticalTaskIds.forEach((taskId) => mergedHighlightedTaskIds.add(taskId));
|
|
13034
|
+
}
|
|
13018
13035
|
return mergedHighlightedTaskIds;
|
|
13019
|
-
}, [filterMode, highlightedTaskIds, matchedTaskIds]);
|
|
13036
|
+
}, [filterMode, highlightedTaskIds, matchedTaskIds, criticalPathMode, criticalTaskIds]);
|
|
13020
13037
|
const totalGridHeight = (0, import_react18.useMemo)(
|
|
13021
13038
|
() => visibleTasks.length * effectiveRowHeight,
|
|
13022
13039
|
[effectiveRowHeight, visibleTasks.length]
|
|
@@ -14011,7 +14028,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
14011
14028
|
onCascade: handleCascade,
|
|
14012
14029
|
highlightExpiredTasks,
|
|
14013
14030
|
showBaseline,
|
|
14014
|
-
isFilterMatch: filterMode === "highlight" ? matchedTaskIds.has(task.id) : false,
|
|
14031
|
+
isFilterMatch: (filterMode === "highlight" ? matchedTaskIds.has(task.id) : false) || (criticalPathMode === "highlight" ? criticalTaskIds.has(task.id) : false),
|
|
14015
14032
|
isCritical: criticalTaskIds.has(task.id),
|
|
14016
14033
|
businessDays,
|
|
14017
14034
|
customDays,
|