gantt-lib 0.146.6 → 0.146.8
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/README.md +33 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +690 -626
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +287 -223
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +447 -404
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -166,8 +166,94 @@ __export(index_exports, {
|
|
|
166
166
|
});
|
|
167
167
|
module.exports = __toCommonJS(index_exports);
|
|
168
168
|
|
|
169
|
+
// src/components/GanttChart/useBarContrast.ts
|
|
170
|
+
var import_react = require("react");
|
|
171
|
+
var BarContrastContext = (0, import_react.createContext)(/* @__PURE__ */ new Map());
|
|
172
|
+
var over = (foreground, background) => {
|
|
173
|
+
const a = foreground[3] + background[3] * (1 - foreground[3]);
|
|
174
|
+
if (!a) return [0, 0, 0, 0];
|
|
175
|
+
return [0, 1, 2].map((i) => (foreground[i] * foreground[3] + background[i] * background[3] * (1 - foreground[3])) / a).concat(a);
|
|
176
|
+
};
|
|
177
|
+
var luminance = (color) => {
|
|
178
|
+
const c = color.slice(0, 3).map((value) => {
|
|
179
|
+
const x = value / 255;
|
|
180
|
+
return x <= 0.04045 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
|
|
181
|
+
});
|
|
182
|
+
return 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2];
|
|
183
|
+
};
|
|
184
|
+
var contrast = (a, b) => {
|
|
185
|
+
const [high, low] = [luminance(a), luminance(b)].sort((x, y) => y - x);
|
|
186
|
+
return (high + 0.05) / (low + 0.05);
|
|
187
|
+
};
|
|
188
|
+
var needsBarOutline = (fill, canvas) => contrast(over(fill, canvas), canvas) < 3;
|
|
189
|
+
function useBarContrast(root, tasks, enabled) {
|
|
190
|
+
const [edges, setEdges] = (0, import_react.useState)(() => /* @__PURE__ */ new Map());
|
|
191
|
+
(0, import_react.useEffect)(() => {
|
|
192
|
+
const host = root.current;
|
|
193
|
+
if (!host || !enabled || typeof CanvasRenderingContext2D === "undefined") return;
|
|
194
|
+
const probe = document.createElement("span");
|
|
195
|
+
probe.style.cssText = "position:absolute;width:0;height:0;visibility:hidden;pointer-events:none";
|
|
196
|
+
host.appendChild(probe);
|
|
197
|
+
const pixel = document.createElement("canvas");
|
|
198
|
+
pixel.width = 1;
|
|
199
|
+
pixel.height = 1;
|
|
200
|
+
const context = pixel.getContext("2d", { willReadFrequently: true });
|
|
201
|
+
if (!context) {
|
|
202
|
+
probe.remove();
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const readColor = (computed) => {
|
|
206
|
+
context.clearRect(0, 0, 1, 1);
|
|
207
|
+
context.fillStyle = computed;
|
|
208
|
+
context.fillRect(0, 0, 1, 1);
|
|
209
|
+
const c = context.getImageData(0, 0, 1, 1).data;
|
|
210
|
+
return [c[0], c[1], c[2], c[3] / 255];
|
|
211
|
+
};
|
|
212
|
+
const resolve = (expression) => {
|
|
213
|
+
probe.style.backgroundColor = "";
|
|
214
|
+
probe.style.backgroundColor = expression;
|
|
215
|
+
if (!probe.style.backgroundColor) return null;
|
|
216
|
+
return readColor(getComputedStyle(probe).backgroundColor);
|
|
217
|
+
};
|
|
218
|
+
const candidates = /* @__PURE__ */ new Set(["var(--gantt-task-bar-default-color)", "#782FC4", "var(--gantt-progress-accepted, #22c55e)", "var(--gantt-progress-completed, #fbbf24)", "var(--gantt-expired-color)", "var(--gantt-critical-path-color, #dc2626)"]);
|
|
219
|
+
for (const task of tasks) {
|
|
220
|
+
if (task.color) candidates.add(task.color);
|
|
221
|
+
for (const activity of task.activities ?? []) if (activity.color) candidates.add(activity.color);
|
|
222
|
+
const parent = task.color || "#782FC4";
|
|
223
|
+
candidates.add(`color-mix(in srgb, ${parent} 40%, black)`);
|
|
224
|
+
}
|
|
225
|
+
candidates.add("color-mix(in srgb, var(--gantt-expired-color) 40%, black)");
|
|
226
|
+
const refresh = () => {
|
|
227
|
+
const ancestors = [];
|
|
228
|
+
for (let element = host; element; element = element.parentElement) ancestors.push(element);
|
|
229
|
+
const canvas = ancestors.reverse().reduce(
|
|
230
|
+
(background, element) => over(readColor(getComputedStyle(element).backgroundColor), background),
|
|
231
|
+
[255, 255, 255, 1]
|
|
232
|
+
);
|
|
233
|
+
const muted = resolve("var(--gantt-text-muted-color, #6b7280)");
|
|
234
|
+
const white = [255, 255, 255, 1], black = [0, 0, 0, 1];
|
|
235
|
+
const edge = muted && contrast(over(muted, canvas), canvas) >= 3 ? muted : contrast(white, canvas) >= contrast(black, canvas) ? white : black;
|
|
236
|
+
const edgeCss = `rgb(${edge.slice(0, 3).map(Math.round).join(" ")} / ${edge[3]})`;
|
|
237
|
+
const next = /* @__PURE__ */ new Map();
|
|
238
|
+
for (const color of candidates) {
|
|
239
|
+
const resolved = resolve(color);
|
|
240
|
+
if (resolved && needsBarOutline(resolved, canvas)) next.set(color, edgeCss);
|
|
241
|
+
}
|
|
242
|
+
setEdges((previous) => previous.size === next.size && [...next].every(([key, value]) => previous.get(key) === value) ? previous : next);
|
|
243
|
+
};
|
|
244
|
+
refresh();
|
|
245
|
+
const observer = new MutationObserver(refresh);
|
|
246
|
+
for (let element = host; element; element = element.parentElement) observer.observe(element, { attributes: true, attributeFilter: ["class", "style", "data-theme"] });
|
|
247
|
+
return () => {
|
|
248
|
+
observer.disconnect();
|
|
249
|
+
probe.remove();
|
|
250
|
+
};
|
|
251
|
+
}, [root, tasks, enabled]);
|
|
252
|
+
return edges;
|
|
253
|
+
}
|
|
254
|
+
|
|
169
255
|
// src/components/GanttChart/GanttChart.tsx
|
|
170
|
-
var
|
|
256
|
+
var import_react21 = require("react");
|
|
171
257
|
|
|
172
258
|
// src/core/scheduling/dateMath.ts
|
|
173
259
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -3865,7 +3951,7 @@ function compactGroupBoundaryClasses(tasks, index, compositeParents) {
|
|
|
3865
3951
|
}
|
|
3866
3952
|
|
|
3867
3953
|
// src/components/TimeScaleHeader/TimeScaleHeader.tsx
|
|
3868
|
-
var
|
|
3954
|
+
var import_react2 = require("react");
|
|
3869
3955
|
var import_date_fns = require("date-fns");
|
|
3870
3956
|
var import_locale = require("date-fns/locale");
|
|
3871
3957
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -3879,42 +3965,42 @@ var TimeScaleHeader = ({
|
|
|
3879
3965
|
onTimelineHover,
|
|
3880
3966
|
onTimelineHoverEnd
|
|
3881
3967
|
}) => {
|
|
3882
|
-
const today = (0,
|
|
3883
|
-
const monthSpans = (0,
|
|
3968
|
+
const today = (0, import_react2.useMemo)(() => getTodayLocalUtcDate(), []);
|
|
3969
|
+
const monthSpans = (0, import_react2.useMemo)(() => getMonthSpans(days), [days]);
|
|
3884
3970
|
const rowHeight = headerHeight / 2;
|
|
3885
|
-
const dayGridTemplate = (0,
|
|
3971
|
+
const dayGridTemplate = (0, import_react2.useMemo)(
|
|
3886
3972
|
() => `repeat(${days.length}, ${dayWidth}px)`,
|
|
3887
3973
|
[days.length, dayWidth]
|
|
3888
3974
|
);
|
|
3889
|
-
const weekBlocks = (0,
|
|
3975
|
+
const weekBlocks = (0, import_react2.useMemo)(
|
|
3890
3976
|
() => viewMode === "week" ? getWeekBlocks(days) : [],
|
|
3891
3977
|
[days, viewMode]
|
|
3892
3978
|
);
|
|
3893
|
-
const weekSpans = (0,
|
|
3979
|
+
const weekSpans = (0, import_react2.useMemo)(
|
|
3894
3980
|
() => viewMode === "week" ? getWeekSpans(days) : [],
|
|
3895
3981
|
[days, viewMode]
|
|
3896
3982
|
);
|
|
3897
|
-
const weekColumnWidths = (0,
|
|
3983
|
+
const weekColumnWidths = (0, import_react2.useMemo)(
|
|
3898
3984
|
() => weekBlocks.map((b) => b.days * dayWidth),
|
|
3899
3985
|
[weekBlocks, dayWidth]
|
|
3900
3986
|
);
|
|
3901
|
-
const weekGridTemplate = (0,
|
|
3987
|
+
const weekGridTemplate = (0, import_react2.useMemo)(
|
|
3902
3988
|
() => weekColumnWidths.map((w) => `${w}px`).join(" "),
|
|
3903
3989
|
[weekColumnWidths]
|
|
3904
3990
|
);
|
|
3905
|
-
const monthBlocks = (0,
|
|
3991
|
+
const monthBlocks = (0, import_react2.useMemo)(
|
|
3906
3992
|
() => viewMode === "month" ? getMonthBlocks(days) : [],
|
|
3907
3993
|
[days, viewMode]
|
|
3908
3994
|
);
|
|
3909
|
-
const yearSpans = (0,
|
|
3995
|
+
const yearSpans = (0, import_react2.useMemo)(
|
|
3910
3996
|
() => viewMode === "month" ? getYearSpans(days) : [],
|
|
3911
3997
|
[days, viewMode]
|
|
3912
3998
|
);
|
|
3913
|
-
const monthGridTemplate = (0,
|
|
3999
|
+
const monthGridTemplate = (0, import_react2.useMemo)(
|
|
3914
4000
|
() => monthBlocks.map((b) => `${b.days * dayWidth}px`).join(" "),
|
|
3915
4001
|
[monthBlocks, dayWidth]
|
|
3916
4002
|
);
|
|
3917
|
-
const markerByDayKey = (0,
|
|
4003
|
+
const markerByDayKey = (0, import_react2.useMemo)(() => {
|
|
3918
4004
|
const map = /* @__PURE__ */ new Map();
|
|
3919
4005
|
for (const marker of timelineMarkers ?? []) {
|
|
3920
4006
|
const date = parseUTCDate(marker.date);
|
|
@@ -3925,7 +4011,7 @@ var TimeScaleHeader = ({
|
|
|
3925
4011
|
}
|
|
3926
4012
|
return map;
|
|
3927
4013
|
}, [timelineMarkers]);
|
|
3928
|
-
const separators = (0,
|
|
4014
|
+
const separators = (0, import_react2.useMemo)(() => {
|
|
3929
4015
|
const result = [];
|
|
3930
4016
|
if (viewMode === "day") {
|
|
3931
4017
|
for (let i = 1; i < days.length; i++) {
|
|
@@ -4075,7 +4161,7 @@ var TimeScaleHeader = ({
|
|
|
4075
4161
|
onTimelineHover?.({
|
|
4076
4162
|
label: tooltipText,
|
|
4077
4163
|
left: index * dayWidth,
|
|
4078
|
-
color: isTodayDate ? "#dc2626" : markerColor || "var(--gantt-timeline-marker-color, #dc2626)"
|
|
4164
|
+
color: isTodayDate ? "var(--gantt-danger-solid-background, #dc2626)" : markerColor || "var(--gantt-timeline-marker-color, #dc2626)"
|
|
4079
4165
|
});
|
|
4080
4166
|
},
|
|
4081
4167
|
onMouseLeave: onTimelineHoverEnd,
|
|
@@ -4094,7 +4180,7 @@ var TimeScaleHeader = ({
|
|
|
4094
4180
|
var TimeScaleHeader_default = TimeScaleHeader;
|
|
4095
4181
|
|
|
4096
4182
|
// src/components/TaskRow/TaskRow.tsx
|
|
4097
|
-
var
|
|
4183
|
+
var import_react4 = __toESM(require("react"));
|
|
4098
4184
|
var import_react_dom = require("react-dom");
|
|
4099
4185
|
|
|
4100
4186
|
// src/utils/expired.ts
|
|
@@ -4148,7 +4234,7 @@ function normalizeTaskDatesForType(task) {
|
|
|
4148
4234
|
}
|
|
4149
4235
|
|
|
4150
4236
|
// src/hooks/useTaskDrag.ts
|
|
4151
|
-
var
|
|
4237
|
+
var import_react3 = require("react");
|
|
4152
4238
|
|
|
4153
4239
|
// src/adapters/scheduling/drag.ts
|
|
4154
4240
|
function resolveDateRangeFromPixels(mode, left, width, monthStart, dayWidth, task, businessDays, weekendPredicate) {
|
|
@@ -4561,18 +4647,18 @@ var useTaskDrag = (options) => {
|
|
|
4561
4647
|
const hookTaskIsMilestone = hookTask ? isMilestoneTask(hookTask) : false;
|
|
4562
4648
|
const authoritativeStartTime = parseUTCDate(hookTask?.startDate ?? initialStartDate).getTime();
|
|
4563
4649
|
const authoritativeEndTime = parseUTCDate(hookTask?.endDate ?? initialEndDate).getTime();
|
|
4564
|
-
const isOwnerRef = (0,
|
|
4565
|
-
const authoritativeRangeRef = (0,
|
|
4650
|
+
const isOwnerRef = (0, import_react3.useRef)(false);
|
|
4651
|
+
const authoritativeRangeRef = (0, import_react3.useRef)({
|
|
4566
4652
|
start: authoritativeStartTime,
|
|
4567
4653
|
end: authoritativeEndTime
|
|
4568
4654
|
});
|
|
4569
4655
|
const effectiveLocked = locked || disableTaskDrag;
|
|
4570
|
-
const [isDragging, setIsDragging] = (0,
|
|
4571
|
-
const [dragMode, setDragMode] = (0,
|
|
4572
|
-
const [currentLeft, setCurrentLeft] = (0,
|
|
4573
|
-
const [currentWidth, setCurrentWidth] = (0,
|
|
4574
|
-
const [hoverCursor, setHoverCursor] = (0,
|
|
4575
|
-
const getInitialPosition = (0,
|
|
4656
|
+
const [isDragging, setIsDragging] = (0, import_react3.useState)(false);
|
|
4657
|
+
const [dragMode, setDragMode] = (0, import_react3.useState)(null);
|
|
4658
|
+
const [currentLeft, setCurrentLeft] = (0, import_react3.useState)(0);
|
|
4659
|
+
const [currentWidth, setCurrentWidth] = (0, import_react3.useState)(0);
|
|
4660
|
+
const [hoverCursor, setHoverCursor] = (0, import_react3.useState)("grab");
|
|
4661
|
+
const getInitialPosition = (0, import_react3.useCallback)(() => {
|
|
4576
4662
|
const getUTCDayDifference2 = (date1, date2) => {
|
|
4577
4663
|
const ms1 = Date.UTC(
|
|
4578
4664
|
date1.getUTCFullYear(),
|
|
@@ -4592,7 +4678,7 @@ var useTaskDrag = (options) => {
|
|
|
4592
4678
|
const width = Math.round((duration + 1) * dayWidth);
|
|
4593
4679
|
return { left, width };
|
|
4594
4680
|
}, [initialStartDate, initialEndDate, monthStart, dayWidth, hookTaskIsMilestone]);
|
|
4595
|
-
(0,
|
|
4681
|
+
(0, import_react3.useEffect)(() => {
|
|
4596
4682
|
const nextRange = {
|
|
4597
4683
|
start: authoritativeStartTime,
|
|
4598
4684
|
end: authoritativeEndTime
|
|
@@ -4603,13 +4689,13 @@ var useTaskDrag = (options) => {
|
|
|
4603
4689
|
cancelDrag();
|
|
4604
4690
|
}
|
|
4605
4691
|
}, [authoritativeStartTime, authoritativeEndTime, taskId]);
|
|
4606
|
-
(0,
|
|
4692
|
+
(0, import_react3.useEffect)(() => {
|
|
4607
4693
|
if (isOwnerRef.current && globalActiveDrag) return;
|
|
4608
4694
|
const { left, width } = getInitialPosition();
|
|
4609
4695
|
setCurrentLeft(left);
|
|
4610
4696
|
setCurrentWidth(width);
|
|
4611
4697
|
}, [getInitialPosition]);
|
|
4612
|
-
(0,
|
|
4698
|
+
(0, import_react3.useEffect)(() => {
|
|
4613
4699
|
if (!isOwnerRef.current || !globalActiveDrag) return;
|
|
4614
4700
|
const oldMonthStart = globalActiveDrag.monthStart;
|
|
4615
4701
|
if (oldMonthStart === monthStart) return;
|
|
@@ -4621,7 +4707,7 @@ var useTaskDrag = (options) => {
|
|
|
4621
4707
|
globalActiveDrag.currentLeft += pixelShift;
|
|
4622
4708
|
globalActiveDrag.monthStart = monthStart;
|
|
4623
4709
|
}, [monthStart, dayWidth]);
|
|
4624
|
-
const handleProgress = (0,
|
|
4710
|
+
const handleProgress = (0, import_react3.useCallback)((left, width) => {
|
|
4625
4711
|
setCurrentLeft(left);
|
|
4626
4712
|
setCurrentWidth(width);
|
|
4627
4713
|
if (onDragStateChange && isOwnerRef.current) {
|
|
@@ -4634,7 +4720,7 @@ var useTaskDrag = (options) => {
|
|
|
4634
4720
|
});
|
|
4635
4721
|
}
|
|
4636
4722
|
}, [onDragStateChange]);
|
|
4637
|
-
const handleComplete = (0,
|
|
4723
|
+
const handleComplete = (0, import_react3.useCallback)((finalLeft, finalWidth, finalMode, cascadeContext) => {
|
|
4638
4724
|
const wasOwner = isOwnerRef.current;
|
|
4639
4725
|
isOwnerRef.current = false;
|
|
4640
4726
|
const currentTaskRaw = allTasks.find((t) => t.id === taskId);
|
|
@@ -4802,7 +4888,7 @@ var useTaskDrag = (options) => {
|
|
|
4802
4888
|
initialEndDate,
|
|
4803
4889
|
hookTaskIsMilestone
|
|
4804
4890
|
]);
|
|
4805
|
-
const handleCancel = (0,
|
|
4891
|
+
const handleCancel = (0, import_react3.useCallback)(() => {
|
|
4806
4892
|
isOwnerRef.current = false;
|
|
4807
4893
|
setIsDragging(false);
|
|
4808
4894
|
setDragMode(null);
|
|
@@ -4815,14 +4901,14 @@ var useTaskDrag = (options) => {
|
|
|
4815
4901
|
});
|
|
4816
4902
|
}
|
|
4817
4903
|
}, [onDragStateChange, currentLeft, currentWidth]);
|
|
4818
|
-
(0,
|
|
4904
|
+
(0, import_react3.useEffect)(() => {
|
|
4819
4905
|
return () => {
|
|
4820
4906
|
if (isOwnerRef.current && globalActiveDrag) {
|
|
4821
4907
|
cancelDrag();
|
|
4822
4908
|
}
|
|
4823
4909
|
};
|
|
4824
4910
|
}, []);
|
|
4825
|
-
const startDrag = (0,
|
|
4911
|
+
const startDrag = (0, import_react3.useCallback)((e) => {
|
|
4826
4912
|
if (effectiveLocked) return;
|
|
4827
4913
|
const target = e.currentTarget;
|
|
4828
4914
|
const currentTask = allTasks.find((t) => t.id === taskId);
|
|
@@ -4888,10 +4974,10 @@ var useTaskDrag = (options) => {
|
|
|
4888
4974
|
scheduleIntentMode: Boolean(onScheduleIntent)
|
|
4889
4975
|
};
|
|
4890
4976
|
}, [edgeZoneWidth, currentLeft, currentWidth, dayWidth, monthStart, taskId, onDragStateChange, handleProgress, handleComplete, handleCancel, allTasks, disableConstraints, deferCascadePreview, onCascadeProgress, onCascade, effectiveLocked]);
|
|
4891
|
-
const handleMouseDown = (0,
|
|
4977
|
+
const handleMouseDown = (0, import_react3.useCallback)((e) => {
|
|
4892
4978
|
startDrag(e);
|
|
4893
4979
|
}, [startDrag]);
|
|
4894
|
-
const handleMouseMove = (0,
|
|
4980
|
+
const handleMouseMove = (0, import_react3.useCallback)((e) => {
|
|
4895
4981
|
if (disableTaskDrag) {
|
|
4896
4982
|
setHoverCursor("grab");
|
|
4897
4983
|
return;
|
|
@@ -4913,10 +4999,10 @@ var useTaskDrag = (options) => {
|
|
|
4913
4999
|
const edgeZone = detectEdgeZone(e.clientX, target, edgeZoneWidth);
|
|
4914
5000
|
setHoverCursor(edgeZone === "move" ? "grab" : "ew-resize");
|
|
4915
5001
|
}, [disableTaskDrag, locked, isDragging, allTasks, taskId, edgeZoneWidth]);
|
|
4916
|
-
const handleMouseLeave = (0,
|
|
5002
|
+
const handleMouseLeave = (0, import_react3.useCallback)(() => {
|
|
4917
5003
|
setHoverCursor(disableTaskDrag ? "grab" : locked ? "not-allowed" : isDragging ? "grabbing" : "grab");
|
|
4918
5004
|
}, [disableTaskDrag, locked, isDragging]);
|
|
4919
|
-
const getCursorStyle = (0,
|
|
5005
|
+
const getCursorStyle = (0, import_react3.useCallback)(() => {
|
|
4920
5006
|
if (disableTaskDrag) return "grab";
|
|
4921
5007
|
if (locked) return "not-allowed";
|
|
4922
5008
|
if (isDragging) {
|
|
@@ -5158,27 +5244,6 @@ var COMPOSITE_SEGMENT_CUT_MIN_PX = 10;
|
|
|
5158
5244
|
var toIsoDay = (date) => date.toISOString().slice(0, 10);
|
|
5159
5245
|
var shiftActivityDay = (value, days) => new Date(parseUTCDate(value).getTime() + days * DAY_MS);
|
|
5160
5246
|
var activityDurationDays = (activity) => Math.max(1, Math.round((parseUTCDate(activity.endDate).getTime() - parseUTCDate(activity.startDate).getTime()) / DAY_MS) + 1);
|
|
5161
|
-
var ACTIVITY_TEXT_LUMINANCE_THRESHOLD = 0.55;
|
|
5162
|
-
var relativeLuminance = (hex) => {
|
|
5163
|
-
const channels = [1, 3, 5].map((index) => {
|
|
5164
|
-
const value = parseInt(hex.slice(index, index + 2), 16) / 255;
|
|
5165
|
-
return value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
|
5166
|
-
});
|
|
5167
|
-
return 0.2126 * channels[0] + 0.7152 * channels[1] + 0.0722 * channels[2];
|
|
5168
|
-
};
|
|
5169
|
-
var activityTextColor = (background) => {
|
|
5170
|
-
const lightText = "var(--gantt-task-bar-text-color, #ffffff)";
|
|
5171
|
-
if (!background) return lightText;
|
|
5172
|
-
const value = background.trim();
|
|
5173
|
-
if (value.startsWith("#")) {
|
|
5174
|
-
return relativeLuminance(value) > ACTIVITY_TEXT_LUMINANCE_THRESHOLD ? "#111111" : "#ffffff";
|
|
5175
|
-
}
|
|
5176
|
-
const oklch = /oklch\(\s*([0-9.]+)/i.exec(value);
|
|
5177
|
-
if (oklch) {
|
|
5178
|
-
return Number(oklch[1]) > 0.66 ? "#111111" : "#ffffff";
|
|
5179
|
-
}
|
|
5180
|
-
return lightText;
|
|
5181
|
-
};
|
|
5182
5247
|
var formatCompositePreviewDate = (date) => {
|
|
5183
5248
|
const month = new Intl.DateTimeFormat("ru-RU", { month: "short", timeZone: "UTC" }).format(date).replace(/\.$/, "");
|
|
5184
5249
|
const yearSuffix = date.getUTCFullYear() === (/* @__PURE__ */ new Date()).getFullYear() ? "" : ` ${String(date.getUTCFullYear()).slice(-2)}`;
|
|
@@ -5187,18 +5252,19 @@ var formatCompositePreviewDate = (date) => {
|
|
|
5187
5252
|
var arePropsEqual = (prevProps, nextProps) => {
|
|
5188
5253
|
return prevProps.task.id === nextProps.task.id && prevProps.task.name === nextProps.task.name && prevProps.task.startDate === nextProps.task.startDate && prevProps.task.endDate === nextProps.task.endDate && prevProps.task.baselineStartDate === nextProps.task.baselineStartDate && prevProps.task.baselineEndDate === nextProps.task.baselineEndDate && prevProps.task.type === nextProps.task.type && prevProps.task.color === nextProps.task.color && prevProps.task.progress === nextProps.task.progress && prevProps.task.accepted === nextProps.task.accepted && prevProps.task.activities === nextProps.task.activities && prevProps.monthStart.getTime() === nextProps.monthStart.getTime() && prevProps.dayWidth === nextProps.dayWidth && prevProps.rowHeight === nextProps.rowHeight && prevProps.overridePosition?.left === nextProps.overridePosition?.left && prevProps.overridePosition?.width === nextProps.overridePosition?.width && prevProps.previewPositionStore === nextProps.previewPositionStore && prevProps.activityPreviewStore === nextProps.activityPreviewStore && prevProps.activityBlockStore === nextProps.activityBlockStore && prevProps.activityDragOwner === nextProps.activityDragOwner && prevProps.activityActivationStore === nextProps.activityActivationStore && prevProps.activityClickToDrag === nextProps.activityClickToDrag && prevProps.activityActivationMode === nextProps.activityActivationMode && prevProps.showActivityLinks === nextProps.showActivityLinks && prevProps.showActivityLag === nextProps.showActivityLag && prevProps.horizontalWindow?.startPx === nextProps.horizontalWindow?.startPx && prevProps.horizontalWindow?.endPx === nextProps.horizontalWindow?.endPx && prevProps.allTasks === nextProps.allTasks && prevProps.disableConstraints === nextProps.disableConstraints && prevProps.deferCascadePreview === nextProps.deferCascadePreview && prevProps.task.locked === nextProps.task.locked && prevProps.task.synced === nextProps.task.synced && prevProps.task.divider === nextProps.task.divider && prevProps.highlightExpiredTasks === nextProps.highlightExpiredTasks && prevProps.isCritical === nextProps.isCritical && prevProps.showBaseline === nextProps.showBaseline && prevProps.onCompositeToggle === nextProps.onCompositeToggle && prevProps.compactDetail === nextProps.compactDetail && prevProps.compositeParentColor === nextProps.compositeParentColor && prevProps.compositeExpanded === nextProps.compositeExpanded && prevProps.isFilterMatch === nextProps.isFilterMatch && prevProps.businessDays === nextProps.businessDays && prevProps.customDays === nextProps.customDays && prevProps.isWeekend === nextProps.isWeekend && prevProps.disableTaskDrag === nextProps.disableTaskDrag && prevProps.disableDependencyEditing === nextProps.disableDependencyEditing && prevProps.isDependencyDragActive === nextProps.isDependencyDragActive && prevProps.viewMode === nextProps.viewMode && prevProps.showTaskDateLabels === nextProps.showTaskDateLabels && prevProps.showTaskNames === nextProps.showTaskNames && prevProps.showCompositeSegments === nextProps.showCompositeSegments;
|
|
5189
5254
|
};
|
|
5190
|
-
var TaskRow =
|
|
5255
|
+
var TaskRow = import_react4.default.memo(
|
|
5191
5256
|
({ task, monthStart, dayWidth, rowHeight, onTasksChange, onScheduleIntent, onDragStateChange, rowIndex, allTasks, enableAutoSchedule, disableConstraints, deferCascadePreview = false, overridePosition, previewPositionStore, activityPreviewStore, activityBlockStore, activityDragOwner, activityActivationStore, activityClickToDrag = false, activityActivationMode = "none", showActivityLinks = true, showActivityLag = true, activityTooltip, horizontalWindow, onCascadeProgress, onCascade, divider, highlightExpiredTasks, isCritical = false, showBaseline = false, isFilterMatch = false, businessDays, customDays, isWeekend: isWeekend3, disableTaskDrag = false, disableDependencyEditing = false, onDependencyPortPointerDown, isDependencyDragActive = false, viewMode = "day", showTaskDateLabels = true, showTaskNames = true, showCompositeSegments: showCompositeSegmentsProp = true, onCompositeToggle, compactDetail = false, compositeParentColor, compositeExpanded = false }) => {
|
|
5192
5257
|
const defaultParentBarColor = "#782FC4";
|
|
5193
|
-
const
|
|
5194
|
-
const [
|
|
5195
|
-
const
|
|
5196
|
-
const
|
|
5197
|
-
const
|
|
5258
|
+
const contrastEdges = (0, import_react4.useContext)(BarContrastContext);
|
|
5259
|
+
const [showCompositePreview, setShowCompositePreview] = (0, import_react4.useState)(false);
|
|
5260
|
+
const [compositePreviewPosition, setCompositePreviewPosition] = (0, import_react4.useState)(null);
|
|
5261
|
+
const pointerStart = (0, import_react4.useRef)(null);
|
|
5262
|
+
const suppressCompositeClick = (0, import_react4.useRef)(false);
|
|
5263
|
+
const compositeChildren = (0, import_react4.useMemo)(
|
|
5198
5264
|
() => task.composite ? (allTasks ?? []).filter((child) => child.parentId === task.id) : [],
|
|
5199
5265
|
[allTasks, task.composite, task.id]
|
|
5200
5266
|
);
|
|
5201
|
-
(0,
|
|
5267
|
+
(0, import_react4.useEffect)(() => {
|
|
5202
5268
|
if (!showCompositePreview) return;
|
|
5203
5269
|
const hide = () => setShowCompositePreview(false);
|
|
5204
5270
|
window.addEventListener("scroll", hide, true);
|
|
@@ -5209,38 +5275,38 @@ var TaskRow = import_react3.default.memo(
|
|
|
5209
5275
|
};
|
|
5210
5276
|
}, [showCompositePreview]);
|
|
5211
5277
|
const { divider: taskDivider } = task;
|
|
5212
|
-
const normalizedTask = (0,
|
|
5213
|
-
const milestone = (0,
|
|
5214
|
-
const taskStartDate = (0,
|
|
5215
|
-
const taskEndDate = (0,
|
|
5216
|
-
const baselineStartDate = (0,
|
|
5278
|
+
const normalizedTask = (0, import_react4.useMemo)(() => normalizeTaskDatesForType(task), [task]);
|
|
5279
|
+
const milestone = (0, import_react4.useMemo)(() => isMilestoneTask(normalizedTask), [normalizedTask]);
|
|
5280
|
+
const taskStartDate = (0, import_react4.useMemo)(() => parseUTCDate(normalizedTask.startDate), [normalizedTask.startDate]);
|
|
5281
|
+
const taskEndDate = (0, import_react4.useMemo)(() => parseUTCDate(normalizedTask.endDate), [normalizedTask.endDate]);
|
|
5282
|
+
const baselineStartDate = (0, import_react4.useMemo)(
|
|
5217
5283
|
() => task.baselineStartDate ? parseUTCDate(task.baselineStartDate) : null,
|
|
5218
5284
|
[task.baselineStartDate]
|
|
5219
5285
|
);
|
|
5220
|
-
const baselineEndDate = (0,
|
|
5286
|
+
const baselineEndDate = (0, import_react4.useMemo)(
|
|
5221
5287
|
() => task.baselineEndDate ? parseUTCDate(task.baselineEndDate) : null,
|
|
5222
5288
|
[task.baselineEndDate]
|
|
5223
5289
|
);
|
|
5224
|
-
const isParent = (0,
|
|
5290
|
+
const isParent = (0, import_react4.useMemo)(() => {
|
|
5225
5291
|
return allTasks ? isTaskParent(task.id, allTasks) : false;
|
|
5226
5292
|
}, [allTasks, task.id]);
|
|
5227
5293
|
const isVisualParent = isParent && !task.composite;
|
|
5228
|
-
const childCount = (0,
|
|
5294
|
+
const childCount = (0, import_react4.useMemo)(() => {
|
|
5229
5295
|
return allTasks ? getChildren(task.id, allTasks).length : 0;
|
|
5230
5296
|
}, [allTasks, task.id]);
|
|
5231
|
-
const isExpired = (0,
|
|
5297
|
+
const isExpired = (0, import_react4.useMemo)(() => {
|
|
5232
5298
|
if (!highlightExpiredTasks) return false;
|
|
5233
5299
|
return isTaskExpired(normalizedTask);
|
|
5234
5300
|
}, [normalizedTask.startDate, normalizedTask.endDate, normalizedTask.progress, highlightExpiredTasks]);
|
|
5235
|
-
const { left, width } = (0,
|
|
5301
|
+
const { left, width } = (0, import_react4.useMemo)(
|
|
5236
5302
|
() => calculateTaskBar(taskStartDate, taskEndDate, monthStart, dayWidth),
|
|
5237
5303
|
[taskStartDate, taskEndDate, monthStart, dayWidth]
|
|
5238
5304
|
);
|
|
5239
|
-
const milestoneGeometry = (0,
|
|
5305
|
+
const milestoneGeometry = (0, import_react4.useMemo)(
|
|
5240
5306
|
() => calculateMilestoneGeometry(taskStartDate, monthStart, dayWidth),
|
|
5241
5307
|
[taskStartDate, monthStart, dayWidth]
|
|
5242
5308
|
);
|
|
5243
|
-
const baselineGeometry = (0,
|
|
5309
|
+
const baselineGeometry = (0, import_react4.useMemo)(() => {
|
|
5244
5310
|
if (!baselineStartDate || !baselineEndDate) return null;
|
|
5245
5311
|
if (milestone) {
|
|
5246
5312
|
return calculateTaskBar(baselineStartDate, baselineStartDate, monthStart, dayWidth);
|
|
@@ -5249,11 +5315,11 @@ var TaskRow = import_react3.default.memo(
|
|
|
5249
5315
|
}, [baselineStartDate, baselineEndDate, milestone, monthStart, dayWidth]);
|
|
5250
5316
|
const criticalBarColor = "var(--gantt-critical-path-color, #dc2626)";
|
|
5251
5317
|
const barColor = isExpired ? "var(--gantt-expired-color)" : isCritical ? criticalBarColor : task.color || "var(--gantt-task-bar-default-color)";
|
|
5252
|
-
const progressWidth = (0,
|
|
5318
|
+
const progressWidth = (0, import_react4.useMemo)(() => {
|
|
5253
5319
|
if (task.progress === void 0 || task.progress <= 0) return 0;
|
|
5254
5320
|
return Math.min(100, Math.max(0, Math.round(task.progress)));
|
|
5255
5321
|
}, [task.progress]);
|
|
5256
|
-
const progressColor = (0,
|
|
5322
|
+
const progressColor = (0, import_react4.useMemo)(() => {
|
|
5257
5323
|
if (isExpired) {
|
|
5258
5324
|
return "color-mix(in srgb, var(--gantt-expired-color) 40%, black)";
|
|
5259
5325
|
}
|
|
@@ -5266,14 +5332,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
5266
5332
|
const baseColor = task.color || "var(--gantt-task-bar-default-color)";
|
|
5267
5333
|
return `color-mix(in srgb, ${baseColor} 40%, black)`;
|
|
5268
5334
|
}, [isCritical, isExpired, progressWidth, task.accepted, task.color]);
|
|
5269
|
-
const
|
|
5270
|
-
if (isExpired) {
|
|
5271
|
-
return "color-mix(in srgb, var(--gantt-expired-color) 40%, black)";
|
|
5272
|
-
}
|
|
5273
|
-
const baseColor = isVisualParent ? task.color || defaultParentBarColor : task.color || "var(--gantt-task-bar-default-color)";
|
|
5274
|
-
return `color-mix(in srgb, ${baseColor} 40%, black)`;
|
|
5275
|
-
}, [defaultParentBarColor, isCritical, isExpired, isVisualParent, task.color]);
|
|
5276
|
-
const barStyle = (0, import_react3.useMemo)(() => {
|
|
5335
|
+
const barStyle = (0, import_react4.useMemo)(() => {
|
|
5277
5336
|
const parentBarColor = task.color || defaultParentBarColor;
|
|
5278
5337
|
if (isCritical && !isExpired) {
|
|
5279
5338
|
const c = criticalBarColor;
|
|
@@ -5294,6 +5353,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
5294
5353
|
}
|
|
5295
5354
|
return { backgroundColor: barColor };
|
|
5296
5355
|
}, [isCritical, defaultParentBarColor, isExpired, isVisualParent, progressWidth, barColor, progressColor, task.color]);
|
|
5356
|
+
const taskBarEdge = contrastEdges.get(String(barStyle.backgroundColor ?? (isVisualParent ? task.color || defaultParentBarColor : barColor)));
|
|
5297
5357
|
const handleDragEnd = (result) => {
|
|
5298
5358
|
const updatedTask = {
|
|
5299
5359
|
...normalizedTask,
|
|
@@ -5305,7 +5365,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
5305
5365
|
onTasksChange?.([updatedTask]);
|
|
5306
5366
|
}
|
|
5307
5367
|
};
|
|
5308
|
-
const weekendPredicate = (0,
|
|
5368
|
+
const weekendPredicate = (0, import_react4.useMemo)(
|
|
5309
5369
|
() => createCustomDayPredicate({ customDays, isWeekend: isWeekend3 }),
|
|
5310
5370
|
[customDays, isWeekend3]
|
|
5311
5371
|
);
|
|
@@ -5338,16 +5398,16 @@ var TaskRow = import_react3.default.memo(
|
|
|
5338
5398
|
weekendPredicate,
|
|
5339
5399
|
viewMode
|
|
5340
5400
|
});
|
|
5341
|
-
const subscribePreviewPosition = (0,
|
|
5401
|
+
const subscribePreviewPosition = (0, import_react4.useCallback)(
|
|
5342
5402
|
(listener) => previewPositionStore?.subscribeTask(task.id, listener) ?? (() => {
|
|
5343
5403
|
}),
|
|
5344
5404
|
[previewPositionStore, task.id]
|
|
5345
5405
|
);
|
|
5346
|
-
const getPreviewPositionSnapshot = (0,
|
|
5406
|
+
const getPreviewPositionSnapshot = (0, import_react4.useCallback)(
|
|
5347
5407
|
() => previewPositionStore?.getTaskPosition(task.id),
|
|
5348
5408
|
[previewPositionStore, task.id]
|
|
5349
5409
|
);
|
|
5350
|
-
const previewPosition = (0,
|
|
5410
|
+
const previewPosition = (0, import_react4.useSyncExternalStore)(
|
|
5351
5411
|
subscribePreviewPosition,
|
|
5352
5412
|
getPreviewPositionSnapshot,
|
|
5353
5413
|
() => void 0
|
|
@@ -5355,7 +5415,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
5355
5415
|
const effectiveOverridePosition = previewPosition ?? overridePosition;
|
|
5356
5416
|
const displayLeft = effectiveOverridePosition?.left ?? (isDragging ? currentLeft : left);
|
|
5357
5417
|
const displayWidth = effectiveOverridePosition?.width ?? (isDragging ? currentWidth : width);
|
|
5358
|
-
const displayMilestoneGeometry = (0,
|
|
5418
|
+
const displayMilestoneGeometry = (0, import_react4.useMemo)(() => {
|
|
5359
5419
|
const centerX = Math.round(displayLeft + dayWidth / 2);
|
|
5360
5420
|
const halfSize = Math.round(milestoneGeometry.size / 2);
|
|
5361
5421
|
return {
|
|
@@ -5367,7 +5427,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
5367
5427
|
}, [displayLeft, dayWidth, milestoneGeometry.size]);
|
|
5368
5428
|
const visualLeft = milestone ? displayMilestoneGeometry.left : displayLeft;
|
|
5369
5429
|
const visualWidth = milestone ? displayMilestoneGeometry.size : displayWidth;
|
|
5370
|
-
const compositeSegments = (0,
|
|
5430
|
+
const compositeSegments = (0, import_react4.useMemo)(() => {
|
|
5371
5431
|
if (!task.composite || width <= 0) return [];
|
|
5372
5432
|
const laneEnds = [];
|
|
5373
5433
|
const segments2 = compositeChildren.map((child) => {
|
|
@@ -5398,35 +5458,35 @@ var TaskRow = import_react3.default.memo(
|
|
|
5398
5458
|
const shouldRenderCompositeSegments = showCompositeSegmentsProp && task.composite && compositeSegments.length > 0 && visualWidth / compositeSegments.length >= 22;
|
|
5399
5459
|
const shouldRenderBaseline = showBaseline && baselineGeometry !== null;
|
|
5400
5460
|
const hasPreviewPosition = isDragging || effectiveOverridePosition !== void 0;
|
|
5401
|
-
const activityLayout = (0,
|
|
5461
|
+
const activityLayout = (0, import_react4.useMemo)(
|
|
5402
5462
|
() => task.activities && task.activities.length > 0 ? computeActivityLanes(task.activities, monthStart, dayWidth) : null,
|
|
5403
5463
|
[task.activities, monthStart, dayWidth]
|
|
5404
5464
|
);
|
|
5405
5465
|
const renderActivities = activityLayout !== null && !compactDetail;
|
|
5406
5466
|
const activityTopOffset = activityLayout ? Math.max(0, (rowHeight - activityLayout.laneCount * ACTIVITY_LANE_STEP) / 2) : 0;
|
|
5407
5467
|
const activityDragEnabled = !task.locked && !disableTaskDrag;
|
|
5408
|
-
const [activityDrag, setActivityDrag] = (0,
|
|
5409
|
-
const [activityTipId, setActivityTipId] = (0,
|
|
5410
|
-
const [activityTipPosition, setActivityTipPosition] = (0,
|
|
5411
|
-
const activityTipAnchor = (0,
|
|
5412
|
-
const activityDragStart = (0,
|
|
5413
|
-
const activityConstraintRef = (0,
|
|
5414
|
-
const [activityBlockedBy, setActivityBlockedBy] = (0,
|
|
5415
|
-
const subscribeActivityOverrides = (0,
|
|
5468
|
+
const [activityDrag, setActivityDrag] = (0, import_react4.useState)(null);
|
|
5469
|
+
const [activityTipId, setActivityTipId] = (0, import_react4.useState)(null);
|
|
5470
|
+
const [activityTipPosition, setActivityTipPosition] = (0, import_react4.useState)(null);
|
|
5471
|
+
const activityTipAnchor = (0, import_react4.useRef)(null);
|
|
5472
|
+
const activityDragStart = (0, import_react4.useRef)(null);
|
|
5473
|
+
const activityConstraintRef = (0, import_react4.useRef)(null);
|
|
5474
|
+
const [activityBlockedBy, setActivityBlockedBy] = (0, import_react4.useState)(null);
|
|
5475
|
+
const subscribeActivityOverrides = (0, import_react4.useCallback)(
|
|
5416
5476
|
(listener) => activityPreviewStore?.subscribeTask(task.id, listener) ?? (() => {
|
|
5417
5477
|
}),
|
|
5418
5478
|
[activityPreviewStore, task.id]
|
|
5419
5479
|
);
|
|
5420
|
-
const getActivityOverridesSnapshot = (0,
|
|
5480
|
+
const getActivityOverridesSnapshot = (0, import_react4.useCallback)(
|
|
5421
5481
|
() => activityPreviewStore?.getTaskOverrides(task.id),
|
|
5422
5482
|
[activityPreviewStore, task.id]
|
|
5423
5483
|
);
|
|
5424
|
-
const activityOverrides = (0,
|
|
5484
|
+
const activityOverrides = (0, import_react4.useSyncExternalStore)(
|
|
5425
5485
|
subscribeActivityOverrides,
|
|
5426
5486
|
getActivityOverridesSnapshot,
|
|
5427
5487
|
() => void 0
|
|
5428
5488
|
);
|
|
5429
|
-
const visibleActivitySegments = (0,
|
|
5489
|
+
const visibleActivitySegments = (0, import_react4.useMemo)(() => {
|
|
5430
5490
|
if (!activityLayout) return [];
|
|
5431
5491
|
if (!horizontalWindow) return activityLayout.segments;
|
|
5432
5492
|
return activityLayout.segments.filter((segment) => {
|
|
@@ -5435,35 +5495,35 @@ var TaskRow = import_react3.default.memo(
|
|
|
5435
5495
|
return left2 <= horizontalWindow.endPx && left2 + segment.width >= horizontalWindow.startPx;
|
|
5436
5496
|
});
|
|
5437
5497
|
}, [activityLayout, horizontalWindow, activityDrag?.id, activityOverrides, dayWidth]);
|
|
5438
|
-
const subscribeActivityBlock = (0,
|
|
5498
|
+
const subscribeActivityBlock = (0, import_react4.useCallback)(
|
|
5439
5499
|
(listener) => activityBlockStore?.subscribeTask(task.id, listener) ?? (() => {
|
|
5440
5500
|
}),
|
|
5441
5501
|
[activityBlockStore, task.id]
|
|
5442
5502
|
);
|
|
5443
|
-
const getActivityBlockSnapshot = (0,
|
|
5503
|
+
const getActivityBlockSnapshot = (0, import_react4.useCallback)(
|
|
5444
5504
|
() => activityBlockStore?.getTaskBlockers(task.id),
|
|
5445
5505
|
[activityBlockStore, task.id]
|
|
5446
5506
|
);
|
|
5447
|
-
const blockedActivityIds = (0,
|
|
5507
|
+
const blockedActivityIds = (0, import_react4.useSyncExternalStore)(
|
|
5448
5508
|
subscribeActivityBlock,
|
|
5449
5509
|
getActivityBlockSnapshot,
|
|
5450
5510
|
() => void 0
|
|
5451
5511
|
);
|
|
5452
|
-
const subscribeActivation = (0,
|
|
5512
|
+
const subscribeActivation = (0, import_react4.useCallback)(
|
|
5453
5513
|
(listener) => activityActivationStore?.subscribe(listener) ?? (() => {
|
|
5454
5514
|
}),
|
|
5455
5515
|
[activityActivationStore]
|
|
5456
5516
|
);
|
|
5457
|
-
const getActivationSnapshot = (0,
|
|
5517
|
+
const getActivationSnapshot = (0, import_react4.useCallback)(
|
|
5458
5518
|
() => activityActivationStore?.getActiveKey() ?? null,
|
|
5459
5519
|
[activityActivationStore]
|
|
5460
5520
|
);
|
|
5461
|
-
const activeActivityKey = (0,
|
|
5521
|
+
const activeActivityKey = (0, import_react4.useSyncExternalStore)(
|
|
5462
5522
|
subscribeActivation,
|
|
5463
5523
|
getActivationSnapshot,
|
|
5464
5524
|
() => null
|
|
5465
5525
|
);
|
|
5466
|
-
const activeWork = (0,
|
|
5526
|
+
const activeWork = (0, import_react4.useMemo)(() => {
|
|
5467
5527
|
if (!activeActivityKey) return null;
|
|
5468
5528
|
const [activeTaskId, activeActivityId] = activeActivityKey.split("\0");
|
|
5469
5529
|
const source = (allTasks ?? []).find((candidate) => candidate.id === activeTaskId);
|
|
@@ -5478,7 +5538,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
5478
5538
|
if (mode === "resize-right") return Math.max(dayDelta, -(durationDays2 - 1));
|
|
5479
5539
|
return dayDelta;
|
|
5480
5540
|
};
|
|
5481
|
-
const publishChainPreview = (0,
|
|
5541
|
+
const publishChainPreview = (0, import_react4.useCallback)((draggedId, mode, dayDelta) => {
|
|
5482
5542
|
if (!activityPreviewStore) return;
|
|
5483
5543
|
if (!task.activityChain) {
|
|
5484
5544
|
activityPreviewStore.clear();
|
|
@@ -5510,7 +5570,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
5510
5570
|
}
|
|
5511
5571
|
activityPreviewStore.setOverrides(overrides);
|
|
5512
5572
|
}, [activityPreviewStore, allTasks, task.activityChain, task.id]);
|
|
5513
|
-
(0,
|
|
5573
|
+
(0, import_react4.useEffect)(() => {
|
|
5514
5574
|
if (!activityDrag) return;
|
|
5515
5575
|
const startInfo = activityDragStart.current;
|
|
5516
5576
|
if (!startInfo) return;
|
|
@@ -5670,7 +5730,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
5670
5730
|
}
|
|
5671
5731
|
return { left: segment.left, width: segment.width + activityDrag.dayDelta * dayWidth };
|
|
5672
5732
|
};
|
|
5673
|
-
const activityLinks = (0,
|
|
5733
|
+
const activityLinks = (0, import_react4.useMemo)(() => {
|
|
5674
5734
|
const gaps = [];
|
|
5675
5735
|
const elbows = [];
|
|
5676
5736
|
if (!showActivityLinks || !renderActivities || !activityLayout) return { gaps, elbows };
|
|
@@ -5717,7 +5777,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
5717
5777
|
}
|
|
5718
5778
|
return { gaps, elbows };
|
|
5719
5779
|
}, [showActivityLinks, renderActivities, activityLayout, visibleActivitySegments, activityTopOffset, activityOverrides, activityDrag, dayWidth, task.activities]);
|
|
5720
|
-
const activityTipData = (0,
|
|
5780
|
+
const activityTipData = (0, import_react4.useMemo)(() => {
|
|
5721
5781
|
if (!activityTipId || !task.activities) return null;
|
|
5722
5782
|
const activity = task.activities.find((item) => item.id === activityTipId);
|
|
5723
5783
|
if (!activity) return null;
|
|
@@ -5819,17 +5879,19 @@ var TaskRow = import_react3.default.memo(
|
|
|
5819
5879
|
const isSameWorkType = activeWork !== null && (segment.id === activeWork.id || activeWork.name !== null && segment.name === activeWork.name);
|
|
5820
5880
|
const isDimmed = dimOthers && activeWork !== null && !isSameWorkType;
|
|
5821
5881
|
const isChainHighlighted = highlightChain && activeWork !== null && isSameWorkType;
|
|
5882
|
+
const activityEdge = contrastEdges.get(segment.color || "var(--gantt-task-bar-default-color)");
|
|
5822
5883
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
5823
5884
|
"div",
|
|
5824
5885
|
{
|
|
5825
5886
|
"data-activity-id": segment.id,
|
|
5826
|
-
className: `gantt-tr-activityBar${isDraggingActivity ? " gantt-tr-activityBar-dragging" : ""}${isBlockingActivity ? " gantt-tr-activityBar-blocking" : ""}${isAtLimit ? " gantt-tr-activityBar-atLimit" : ""}${isActiveActivity ? " gantt-tr-activityBar-active" : ""}${isDimmed ? " gantt-tr-activityBar-dimmed" : ""}${isChainHighlighted ? " gantt-tr-activityBar-chain" : ""}${activityDragEnabled ? "" : " gantt-tr-activityBar-locked"}`,
|
|
5887
|
+
className: `gantt-tr-activityBar${activityEdge ? " gantt-tr-needs-contrast" : ""}${isDraggingActivity ? " gantt-tr-activityBar-dragging" : ""}${isBlockingActivity ? " gantt-tr-activityBar-blocking" : ""}${isAtLimit ? " gantt-tr-activityBar-atLimit" : ""}${isActiveActivity ? " gantt-tr-activityBar-active" : ""}${isDimmed ? " gantt-tr-activityBar-dimmed" : ""}${isChainHighlighted ? " gantt-tr-activityBar-chain" : ""}${activityDragEnabled ? "" : " gantt-tr-activityBar-locked"}`,
|
|
5827
5888
|
style: {
|
|
5828
5889
|
left: `${liveLeft}px`,
|
|
5829
5890
|
width: `${live.width}px`,
|
|
5830
5891
|
top: `${activityTopOffset + segment.lane * ACTIVITY_LANE_STEP + (ACTIVITY_LANE_STEP - ACTIVITY_LANE_BAR_HEIGHT) / 2}px`,
|
|
5831
5892
|
height: `${ACTIVITY_LANE_BAR_HEIGHT}px`,
|
|
5832
|
-
backgroundColor: segment.color || "var(--gantt-task-bar-default-color)"
|
|
5893
|
+
backgroundColor: segment.color || "var(--gantt-task-bar-default-color)",
|
|
5894
|
+
...activityEdge ? { "--gantt-conditional-bar-outline": activityEdge } : {}
|
|
5833
5895
|
},
|
|
5834
5896
|
onMouseDown: (event) => {
|
|
5835
5897
|
if (!activityDragEnabled) return;
|
|
@@ -5863,7 +5925,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
5863
5925
|
style: { width: `${activityProgress}%` }
|
|
5864
5926
|
}
|
|
5865
5927
|
),
|
|
5866
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "gantt-tr-activityName",
|
|
5928
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "gantt-tr-activityName", children: segment.name }),
|
|
5867
5929
|
activityDragEnabled && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
5868
5930
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "gantt-tr-resizeHandle gantt-tr-resizeHandleLeft" }),
|
|
5869
5931
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "gantt-tr-resizeHandle gantt-tr-resizeHandleRight" })
|
|
@@ -5873,7 +5935,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
5873
5935
|
segment.id
|
|
5874
5936
|
);
|
|
5875
5937
|
}),
|
|
5876
|
-
activityLinks.gaps.map((gap) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
5938
|
+
activityLinks.gaps.map((gap) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react4.default.Fragment, { children: [
|
|
5877
5939
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5878
5940
|
"span",
|
|
5879
5941
|
{
|
|
@@ -5911,10 +5973,11 @@ var TaskRow = import_react3.default.memo(
|
|
|
5911
5973
|
tabIndex: task.composite ? 0 : void 0,
|
|
5912
5974
|
"aria-label": task.composite ? `${task.name}: ${compositeExpanded ? "\u0441\u0432\u0435\u0440\u043D\u0443\u0442\u044C" : "\u0440\u0430\u0441\u043A\u0440\u044B\u0442\u044C"} \u0434\u0435\u0442\u0430\u043B\u0438` : void 0,
|
|
5913
5975
|
"aria-expanded": task.composite ? compositeExpanded : void 0,
|
|
5914
|
-
className: `gantt-tr-taskBar ${isDragging ? "gantt-tr-dragging" : ""} ${task.locked ? "gantt-tr-locked" : ""} ${task.synced === false ? "gantt-tr-unsynced" : ""} ${isVisualParent ? "gantt-tr-parentBar" : ""} ${task.composite ? "gantt-tr-compositeBar" : ""} ${milestone ? "gantt-tr-milestone" : ""} ${isCritical ? "gantt-tr-critical" : ""}`,
|
|
5976
|
+
className: `gantt-tr-taskBar ${taskBarEdge ? "gantt-tr-needs-contrast " : ""}${isDragging ? "gantt-tr-dragging" : ""} ${task.locked ? "gantt-tr-locked" : ""} ${task.synced === false ? "gantt-tr-unsynced" : ""} ${isVisualParent ? "gantt-tr-parentBar" : ""} ${task.composite ? "gantt-tr-compositeBar" : ""} ${milestone ? "gantt-tr-milestone" : ""} ${isCritical ? "gantt-tr-critical" : ""}`,
|
|
5915
5977
|
style: {
|
|
5916
5978
|
left: `${visualLeft}px`,
|
|
5917
5979
|
...barStyle,
|
|
5980
|
+
...taskBarEdge ? { "--gantt-conditional-bar-outline": taskBarEdge } : {},
|
|
5918
5981
|
...milestone ? {
|
|
5919
5982
|
height: `${displayMilestoneGeometry.size}px`,
|
|
5920
5983
|
width: `${displayMilestoneGeometry.size}px`,
|
|
@@ -6138,7 +6201,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
6138
6201
|
transform: "translateY(-50%)",
|
|
6139
6202
|
width: "12px",
|
|
6140
6203
|
height: "12px",
|
|
6141
|
-
color: "#444",
|
|
6204
|
+
color: "var(--gantt-text-muted-color, #444)",
|
|
6142
6205
|
pointerEvents: "none"
|
|
6143
6206
|
},
|
|
6144
6207
|
viewBox: "0 0 24 24",
|
|
@@ -6152,7 +6215,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
6152
6215
|
"span",
|
|
6153
6216
|
{
|
|
6154
6217
|
className: "gantt-tr-externalDuration gantt-tr-durationBeforeBar gantt-tr-compositeDuration",
|
|
6155
|
-
style: { left: `${visualLeft - 46}px`, color:
|
|
6218
|
+
style: { left: `${visualLeft - 46}px`, color: "var(--gantt-task-label-color, var(--gantt-text-color, #374151))" },
|
|
6156
6219
|
children: isVisualParent ? getChildCountLabel(childCount) : `${durationDays} \u0434`
|
|
6157
6220
|
}
|
|
6158
6221
|
),
|
|
@@ -6162,7 +6225,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
6162
6225
|
className: "gantt-tr-rightLabels",
|
|
6163
6226
|
style: {
|
|
6164
6227
|
left: `${visualLeft + Math.max(visualWidth, 20) - Math.min(6, Math.max(visualWidth, 20) / 2) + 8}px`,
|
|
6165
|
-
color:
|
|
6228
|
+
color: "var(--gantt-task-label-color, var(--gantt-text-color, #374151))"
|
|
6166
6229
|
},
|
|
6167
6230
|
children: [
|
|
6168
6231
|
!compactDetail && !showDurationInside && !milestone && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "gantt-tr-externalDuration", children: isVisualParent ? getChildCountLabel(childCount) : `${durationDays} \u0434` }),
|
|
@@ -6174,7 +6237,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
6174
6237
|
"span",
|
|
6175
6238
|
{
|
|
6176
6239
|
className: "gantt-tr-externalTaskName",
|
|
6177
|
-
style: { color:
|
|
6240
|
+
style: { color: "var(--gantt-task-label-color, var(--gantt-text-color, #374151))" },
|
|
6178
6241
|
children: task.name
|
|
6179
6242
|
}
|
|
6180
6243
|
)
|
|
@@ -6193,11 +6256,11 @@ TaskRow.displayName = "TaskRow";
|
|
|
6193
6256
|
var TaskRow_default = TaskRow;
|
|
6194
6257
|
|
|
6195
6258
|
// src/components/TodayIndicator/TodayIndicator.tsx
|
|
6196
|
-
var
|
|
6259
|
+
var import_react5 = require("react");
|
|
6197
6260
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
6198
6261
|
var TodayIndicator = ({ monthStart, dayWidth, onHover, onHoverEnd }) => {
|
|
6199
6262
|
const todayLocal = getTodayLocalUtcDate();
|
|
6200
|
-
const position = (0,
|
|
6263
|
+
const position = (0, import_react5.useMemo)(() => {
|
|
6201
6264
|
const offset = getDayOffset(todayLocal, monthStart);
|
|
6202
6265
|
return Math.round(offset * dayWidth);
|
|
6203
6266
|
}, [monthStart, dayWidth, todayLocal]);
|
|
@@ -6218,7 +6281,7 @@ var TodayIndicator = ({ monthStart, dayWidth, onHover, onHoverEnd }) => {
|
|
|
6218
6281
|
"div",
|
|
6219
6282
|
{
|
|
6220
6283
|
className: "gantt-ti-hitArea",
|
|
6221
|
-
onMouseEnter: () => onHover?.({ label: todayLabel, left: position, color: "#dc2626" }),
|
|
6284
|
+
onMouseEnter: () => onHover?.({ label: todayLabel, left: position, color: "var(--gantt-danger-solid-background, #dc2626)" }),
|
|
6222
6285
|
onMouseLeave: onHoverEnd
|
|
6223
6286
|
}
|
|
6224
6287
|
)
|
|
@@ -6228,10 +6291,10 @@ var TodayIndicator = ({ monthStart, dayWidth, onHover, onHoverEnd }) => {
|
|
|
6228
6291
|
var TodayIndicator_default = TodayIndicator;
|
|
6229
6292
|
|
|
6230
6293
|
// src/components/TimelineMarkers/TimelineMarkers.tsx
|
|
6231
|
-
var
|
|
6294
|
+
var import_react6 = require("react");
|
|
6232
6295
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
6233
6296
|
var TimelineMarkers = ({ rangeStart, dayWidth, totalHeight, markers = [], onHover, onHoverEnd }) => {
|
|
6234
|
-
const visibleMarkers = (0,
|
|
6297
|
+
const visibleMarkers = (0, import_react6.useMemo)(() => {
|
|
6235
6298
|
return markers.map((marker, index) => {
|
|
6236
6299
|
const date = parseUTCDate(marker.date);
|
|
6237
6300
|
const offset = getDayOffset(date, rangeStart);
|
|
@@ -6289,48 +6352,48 @@ var TimelineMarkers = ({ rangeStart, dayWidth, totalHeight, markers = [], onHove
|
|
|
6289
6352
|
var TimelineMarkers_default = TimelineMarkers;
|
|
6290
6353
|
|
|
6291
6354
|
// src/components/GridBackground/GridBackground.tsx
|
|
6292
|
-
var
|
|
6355
|
+
var import_react7 = __toESM(require("react"));
|
|
6293
6356
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
6294
6357
|
var arePropsEqual2 = (prevProps, nextProps) => {
|
|
6295
6358
|
return prevProps.dayWidth === nextProps.dayWidth && prevProps.dateRange.length === nextProps.dateRange.length && prevProps.totalHeight === nextProps.totalHeight && // skip re-render only when totalHeight unchanged
|
|
6296
6359
|
prevProps.viewMode === nextProps.viewMode && prevProps.isCustomWeekend === nextProps.isCustomWeekend && prevProps.showWeekendBlocks === nextProps.showWeekendBlocks && prevProps.showGridLines === nextProps.showGridLines && prevProps.horizontalWindow?.startPx === nextProps.horizontalWindow?.startPx && prevProps.horizontalWindow?.endPx === nextProps.horizontalWindow?.endPx;
|
|
6297
6360
|
};
|
|
6298
|
-
var GridBackground =
|
|
6361
|
+
var GridBackground = import_react7.default.memo(
|
|
6299
6362
|
({ dateRange, dayWidth, totalHeight, viewMode = "day", isCustomWeekend, className, showWeekendBlocks = true, showGridLines = true, horizontalWindow }) => {
|
|
6300
|
-
const weekGridLines = (0,
|
|
6363
|
+
const weekGridLines = (0, import_react7.useMemo)(() => {
|
|
6301
6364
|
if (viewMode !== "week") return [];
|
|
6302
6365
|
return calculateWeekGridLines(dateRange, dayWidth);
|
|
6303
6366
|
}, [dateRange, dayWidth, viewMode]);
|
|
6304
|
-
const gridLines = (0,
|
|
6367
|
+
const gridLines = (0, import_react7.useMemo)(() => {
|
|
6305
6368
|
if (viewMode === "week" || viewMode === "month") return [];
|
|
6306
6369
|
return calculateGridLines(dateRange, dayWidth);
|
|
6307
6370
|
}, [dateRange, dayWidth, viewMode]);
|
|
6308
|
-
const monthGridLines = (0,
|
|
6371
|
+
const monthGridLines = (0, import_react7.useMemo)(() => {
|
|
6309
6372
|
if (viewMode !== "month") return [];
|
|
6310
6373
|
return calculateMonthGridLines(dateRange, dayWidth);
|
|
6311
6374
|
}, [dateRange, dayWidth, viewMode]);
|
|
6312
|
-
const weekendBlocks = (0,
|
|
6375
|
+
const weekendBlocks = (0, import_react7.useMemo)(() => {
|
|
6313
6376
|
if (viewMode === "week" || viewMode === "month") return [];
|
|
6314
6377
|
return calculateWeekendBlocks(dateRange, dayWidth, isCustomWeekend);
|
|
6315
6378
|
}, [dateRange, dayWidth, viewMode, isCustomWeekend]);
|
|
6316
6379
|
const inHorizontalWindow = (left, width = 1) => !horizontalWindow || left <= horizontalWindow.endPx && left + width >= horizontalWindow.startPx;
|
|
6317
|
-
const visibleWeekendBlocks = (0,
|
|
6380
|
+
const visibleWeekendBlocks = (0, import_react7.useMemo)(
|
|
6318
6381
|
() => weekendBlocks.filter((block) => inHorizontalWindow(block.left, block.width)),
|
|
6319
6382
|
[weekendBlocks, horizontalWindow?.startPx, horizontalWindow?.endPx]
|
|
6320
6383
|
);
|
|
6321
|
-
const visibleWeekGridLines = (0,
|
|
6384
|
+
const visibleWeekGridLines = (0, import_react7.useMemo)(
|
|
6322
6385
|
() => weekGridLines.filter((line) => inHorizontalWindow(line.x)),
|
|
6323
6386
|
[weekGridLines, horizontalWindow?.startPx, horizontalWindow?.endPx]
|
|
6324
6387
|
);
|
|
6325
|
-
const visibleMonthGridLines = (0,
|
|
6388
|
+
const visibleMonthGridLines = (0, import_react7.useMemo)(
|
|
6326
6389
|
() => monthGridLines.filter((line) => inHorizontalWindow(line.x)),
|
|
6327
6390
|
[monthGridLines, horizontalWindow?.startPx, horizontalWindow?.endPx]
|
|
6328
6391
|
);
|
|
6329
|
-
const visibleGridLines = (0,
|
|
6392
|
+
const visibleGridLines = (0, import_react7.useMemo)(
|
|
6330
6393
|
() => gridLines.filter((line) => inHorizontalWindow(line.x)),
|
|
6331
6394
|
[gridLines, horizontalWindow?.startPx, horizontalWindow?.endPx]
|
|
6332
6395
|
);
|
|
6333
|
-
const gridWidth = (0,
|
|
6396
|
+
const gridWidth = (0, import_react7.useMemo)(() => {
|
|
6334
6397
|
return Math.round(dateRange.length * dayWidth);
|
|
6335
6398
|
}, [dateRange.length, dayWidth]);
|
|
6336
6399
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
@@ -6447,7 +6510,7 @@ var DragGuideLines = ({
|
|
|
6447
6510
|
var DragGuideLines_default = DragGuideLines;
|
|
6448
6511
|
|
|
6449
6512
|
// src/components/DependencyLines/DependencyLines.tsx
|
|
6450
|
-
var
|
|
6513
|
+
var import_react8 = __toESM(require("react"));
|
|
6451
6514
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
6452
6515
|
function isTaskHidden(taskId, collapsedParentIds, taskMap) {
|
|
6453
6516
|
const task = taskMap.get(taskId);
|
|
@@ -6477,7 +6540,7 @@ function areBothHiddenInSameParent(predecessorId, successorId, collapsedParentId
|
|
|
6477
6540
|
return predVisibleAncestor.id === succVisibleAncestor.id;
|
|
6478
6541
|
}
|
|
6479
6542
|
var EMPTY_COLLAPSED_PARENT_IDS = /* @__PURE__ */ new Set();
|
|
6480
|
-
var DependencyLineView =
|
|
6543
|
+
var DependencyLineView = import_react8.default.memo(function DependencyLineView2({
|
|
6481
6544
|
line,
|
|
6482
6545
|
hovered,
|
|
6483
6546
|
selected,
|
|
@@ -6501,8 +6564,8 @@ var DependencyLineView = import_react7.default.memo(function DependencyLineView2
|
|
|
6501
6564
|
else if (hasCycle) markerEnd = `url(#${markerPrefix}-arrowhead-cycle)`;
|
|
6502
6565
|
else if (line.isCritical) markerEnd = `url(#${markerPrefix}-arrowhead-critical)`;
|
|
6503
6566
|
else markerEnd = `url(#${markerPrefix}-arrowhead)`;
|
|
6504
|
-
const lagColor =
|
|
6505
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
6567
|
+
const lagColor = "var(--gantt-text-color, #1f2937)";
|
|
6568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react8.default.Fragment, { children: [
|
|
6506
6569
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
6507
6570
|
"g",
|
|
6508
6571
|
{
|
|
@@ -6546,7 +6609,7 @@ var DependencyLineView = import_react7.default.memo(function DependencyLineView2
|
|
|
6546
6609
|
// геометрией — пере-рендерить их нельзя, иначе пан дёргается.
|
|
6547
6610
|
prev.line.id === next.line.id && prev.line.predecessorId === next.line.predecessorId && prev.line.successorId === next.line.successorId && prev.line.linkType === next.line.linkType && prev.line.path === next.line.path && prev.line.hasCycle === next.line.hasCycle && prev.line.lag === next.line.lag && prev.line.toX === next.line.toX && prev.line.fromY === next.line.fromY && prev.line.reverseOrder === next.line.reverseOrder && prev.line.isVirtual === next.line.isVirtual && prev.line.isCritical === next.line.isCritical && prev.line.isCoupling === next.line.isCoupling && prev.hovered === next.hovered && prev.selected === next.selected && prev.dimmed === next.dimmed && prev.showLag === next.showLag && prev.markerPrefix === next.markerPrefix && prev.onLineHover === next.onLineHover && prev.onLineLeave === next.onLineLeave && prev.onDependencyClick === next.onDependencyClick
|
|
6548
6611
|
));
|
|
6549
|
-
var DependencyLines =
|
|
6612
|
+
var DependencyLines = import_react8.default.memo(({
|
|
6550
6613
|
tasks,
|
|
6551
6614
|
allTasks,
|
|
6552
6615
|
collapsedParentIds = EMPTY_COLLAPSED_PARENT_IDS,
|
|
@@ -6570,14 +6633,14 @@ var DependencyLines = import_react7.default.memo(({
|
|
|
6570
6633
|
onDependencyClick,
|
|
6571
6634
|
horizontalWindow
|
|
6572
6635
|
}) => {
|
|
6573
|
-
const markerPrefix = `gantt-dependency-${(0,
|
|
6636
|
+
const markerPrefix = `gantt-dependency-${(0, import_react8.useId)().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
6574
6637
|
const markerId = (kind) => `${markerPrefix}-${kind}`;
|
|
6575
|
-
const [hoveredLineId, setHoveredLineId] = (0,
|
|
6576
|
-
const handleLineHover = (0,
|
|
6577
|
-
const handleLineLeave = (0,
|
|
6638
|
+
const [hoveredLineId, setHoveredLineId] = (0, import_react8.useState)(null);
|
|
6639
|
+
const handleLineHover = (0, import_react8.useCallback)((id) => setHoveredLineId(id), []);
|
|
6640
|
+
const handleLineLeave = (0, import_react8.useCallback)((id) => setHoveredLineId((current) => current === id ? null : current), []);
|
|
6578
6641
|
const tasksForPositions = allTasks ?? tasks;
|
|
6579
6642
|
const geometryTasks = activityEndpoints ? tasksForPositions : tasks;
|
|
6580
|
-
const { taskPositions, taskIndices, hiddenTaskIds } = (0,
|
|
6643
|
+
const { taskPositions, taskIndices, hiddenTaskIds } = (0, import_react8.useMemo)(() => {
|
|
6581
6644
|
const positions = /* @__PURE__ */ new Map();
|
|
6582
6645
|
const indices = /* @__PURE__ */ new Map();
|
|
6583
6646
|
const hidden = /* @__PURE__ */ new Set();
|
|
@@ -6640,13 +6703,13 @@ var DependencyLines = import_react7.default.memo(({
|
|
|
6640
6703
|
return { taskPositions: positions, taskIndices: indices, hiddenTaskIds: hidden };
|
|
6641
6704
|
}, [geometryTasks, tasksForPositions, allTasks, collapsedParentIds, monthStart, dayWidth, rowHeight, rowTops, rowHeights, dragOverrides, rowIndexByTaskId]);
|
|
6642
6705
|
const tasksForCycleDetection = allTasks ?? tasks;
|
|
6643
|
-
const cycleInfo = (0,
|
|
6706
|
+
const cycleInfo = (0, import_react8.useMemo)(() => {
|
|
6644
6707
|
if (cycleTaskIds) return cycleTaskIds;
|
|
6645
6708
|
const result = detectCycles(tasksForCycleDetection);
|
|
6646
6709
|
const detectedCycleIds = new Set(result.cyclePath || []);
|
|
6647
6710
|
return detectedCycleIds;
|
|
6648
6711
|
}, [tasksForCycleDetection, cycleTaskIds]);
|
|
6649
|
-
const lines = (0,
|
|
6712
|
+
const lines = (0, import_react8.useMemo)(() => {
|
|
6650
6713
|
const tasksForEdges = allTasks ?? geometryTasks;
|
|
6651
6714
|
const taskMap = new Map(tasksForEdges.map((task) => [task.id, task]));
|
|
6652
6715
|
const positionedTaskIds = Array.from(taskPositions.keys());
|
|
@@ -6751,7 +6814,7 @@ var DependencyLines = import_react7.default.memo(({
|
|
|
6751
6814
|
}
|
|
6752
6815
|
return lines2;
|
|
6753
6816
|
}, [geometryTasks, allTasks, taskPositions, taskIndices, cycleInfo, collapsedParentIds, criticalTaskIds, activityEndpoints]);
|
|
6754
|
-
const visibleLines = (0,
|
|
6817
|
+
const visibleLines = (0, import_react8.useMemo)(() => {
|
|
6755
6818
|
const renderedIds = activityEndpoints ? new Set(tasks.map((task) => task.id)) : void 0;
|
|
6756
6819
|
return lines.filter((line) => {
|
|
6757
6820
|
if (renderedIds && !renderedIds.has(line.predecessorId) && !renderedIds.has(line.successorId)) return false;
|
|
@@ -6822,7 +6885,7 @@ var DependencyLines = import_react7.default.memo(({
|
|
|
6822
6885
|
"polygon",
|
|
6823
6886
|
{
|
|
6824
6887
|
points: "0 0, 8 3, 0 6",
|
|
6825
|
-
fill: "#ef4444"
|
|
6888
|
+
fill: "var(--gantt-dependency-selected-color, #ef4444)"
|
|
6826
6889
|
}
|
|
6827
6890
|
)
|
|
6828
6891
|
}
|
|
@@ -6892,7 +6955,7 @@ DependencyLines.displayName = "DependencyLines";
|
|
|
6892
6955
|
var DependencyLines_default = DependencyLines;
|
|
6893
6956
|
|
|
6894
6957
|
// src/components/DependencyLines/ActivityDependencyLines.tsx
|
|
6895
|
-
var
|
|
6958
|
+
var import_react9 = require("react");
|
|
6896
6959
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
6897
6960
|
var activityKey = (taskId, activityId) => JSON.stringify([taskId, activityId]);
|
|
6898
6961
|
var sameDependencies = (left, right) => {
|
|
@@ -6905,12 +6968,12 @@ var sameDependencies = (left, right) => {
|
|
|
6905
6968
|
};
|
|
6906
6969
|
function ActivityDependencyLines(props) {
|
|
6907
6970
|
const { tasks, dependencies, monthStart, dayWidth, previewStore } = props;
|
|
6908
|
-
const [previewVersion, refresh] = (0,
|
|
6909
|
-
(0,
|
|
6971
|
+
const [previewVersion, refresh] = (0, import_react9.useReducer)((value) => value + 1, 0);
|
|
6972
|
+
(0, import_react9.useEffect)(() => {
|
|
6910
6973
|
const cleanups = tasks.filter((task) => task.activities?.length).map((task) => previewStore?.subscribeTask(task.id, refresh));
|
|
6911
6974
|
return () => cleanups.forEach((cleanup) => cleanup?.());
|
|
6912
6975
|
}, [tasks, previewStore]);
|
|
6913
|
-
const cycleTaskIds = (0,
|
|
6976
|
+
const cycleTaskIds = (0, import_react9.useMemo)(() => {
|
|
6914
6977
|
const incoming = /* @__PURE__ */ new Map();
|
|
6915
6978
|
for (const edge of dependencies) {
|
|
6916
6979
|
const id = activityKey(edge.successorTaskId, edge.successorActivityId);
|
|
@@ -6921,8 +6984,8 @@ function ActivityDependencyLines(props) {
|
|
|
6921
6984
|
const nodes = tasks.flatMap((task) => (task.activities ?? []).map((activity) => ({ id: activityKey(task.id, activity.id), name: activity.name, startDate: activity.startDate, endDate: activity.endDate, dependencies: incoming.get(activityKey(task.id, activity.id)) })));
|
|
6922
6985
|
return new Set(detectCycles(nodes).cyclePath ?? []);
|
|
6923
6986
|
}, [tasks, dependencies]);
|
|
6924
|
-
const layoutCacheRef = (0,
|
|
6925
|
-
const layout = (0,
|
|
6987
|
+
const layoutCacheRef = (0, import_react9.useRef)(/* @__PURE__ */ new Map());
|
|
6988
|
+
const layout = (0, import_react9.useMemo)(() => {
|
|
6926
6989
|
const flattened = [], tops = [], heights = [];
|
|
6927
6990
|
const nodesByTaskId = /* @__PURE__ */ new Map();
|
|
6928
6991
|
const indices = /* @__PURE__ */ new Map();
|
|
@@ -7009,7 +7072,7 @@ function ActivityDependencyLines(props) {
|
|
|
7009
7072
|
}
|
|
7010
7073
|
return { flattened, nodesByTaskId, indices, tops, heights, dimmedLineIds };
|
|
7011
7074
|
}, [tasks, dependencies, props.highlight, monthStart, dayWidth, props.rowIndexByTaskId, props.rowTops, props.rowHeights, props.rowHeight, previewStore, previewVersion]);
|
|
7012
|
-
const rendered = (0,
|
|
7075
|
+
const rendered = (0, import_react9.useMemo)(() => {
|
|
7013
7076
|
const nodes = [];
|
|
7014
7077
|
for (const taskId of props.renderedTaskIds) {
|
|
7015
7078
|
const rowNodes = layout.nodesByTaskId.get(taskId);
|
|
@@ -7077,7 +7140,7 @@ var DependencyCreationOverlay = ({ drag, width, height }) => {
|
|
|
7077
7140
|
};
|
|
7078
7141
|
|
|
7079
7142
|
// src/components/TaskList/TaskList.tsx
|
|
7080
|
-
var
|
|
7143
|
+
var import_react16 = __toESM(require("react"));
|
|
7081
7144
|
|
|
7082
7145
|
// src/utils/taskListReorder.ts
|
|
7083
7146
|
function getDescendantIds(taskId, tasks) {
|
|
@@ -7281,12 +7344,12 @@ var PopoverContent = ({
|
|
|
7281
7344
|
};
|
|
7282
7345
|
|
|
7283
7346
|
// src/components/TaskList/TaskListRow.tsx
|
|
7284
|
-
var
|
|
7347
|
+
var import_react13 = __toESM(require("react"));
|
|
7285
7348
|
|
|
7286
7349
|
// src/components/ui/Input.tsx
|
|
7287
|
-
var
|
|
7350
|
+
var import_react10 = __toESM(require("react"));
|
|
7288
7351
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
7289
|
-
var Input =
|
|
7352
|
+
var Input = import_react10.default.forwardRef(
|
|
7290
7353
|
({ className, ...props }, ref) => {
|
|
7291
7354
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
7292
7355
|
"input",
|
|
@@ -7301,11 +7364,11 @@ var Input = import_react9.default.forwardRef(
|
|
|
7301
7364
|
Input.displayName = "Input";
|
|
7302
7365
|
|
|
7303
7366
|
// src/components/ui/DatePicker.tsx
|
|
7304
|
-
var
|
|
7367
|
+
var import_react12 = require("react");
|
|
7305
7368
|
var import_date_fns3 = require("date-fns");
|
|
7306
7369
|
|
|
7307
7370
|
// src/components/ui/Calendar.tsx
|
|
7308
|
-
var
|
|
7371
|
+
var import_react11 = require("react");
|
|
7309
7372
|
var import_date_fns2 = require("date-fns");
|
|
7310
7373
|
var import_locale2 = require("date-fns/locale");
|
|
7311
7374
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
@@ -7325,18 +7388,18 @@ var Calendar = ({
|
|
|
7325
7388
|
disabled = false,
|
|
7326
7389
|
isWeekend: isWeekendProp
|
|
7327
7390
|
}) => {
|
|
7328
|
-
const scrollRef = (0,
|
|
7329
|
-
const initialMonth = (0,
|
|
7391
|
+
const scrollRef = (0, import_react11.useRef)(null);
|
|
7392
|
+
const initialMonth = (0, import_react11.useMemo)(
|
|
7330
7393
|
() => (0, import_date_fns2.startOfMonth)(initialDate ?? selected ?? /* @__PURE__ */ new Date()),
|
|
7331
7394
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7332
7395
|
[]
|
|
7333
7396
|
);
|
|
7334
|
-
const [months, setMonths] = (0,
|
|
7397
|
+
const [months, setMonths] = (0, import_react11.useState)(() => [
|
|
7335
7398
|
(0, import_date_fns2.subMonths)(initialMonth, 1),
|
|
7336
7399
|
initialMonth,
|
|
7337
7400
|
(0, import_date_fns2.addMonths)(initialMonth, 1)
|
|
7338
7401
|
]);
|
|
7339
|
-
const loadMoreMonths = (0,
|
|
7402
|
+
const loadMoreMonths = (0, import_react11.useCallback)((direction) => {
|
|
7340
7403
|
setMonths((prev) => {
|
|
7341
7404
|
if (direction === "up") {
|
|
7342
7405
|
return [(0, import_date_fns2.subMonths)(prev[0], 1), ...prev];
|
|
@@ -7345,7 +7408,7 @@ var Calendar = ({
|
|
|
7345
7408
|
}
|
|
7346
7409
|
});
|
|
7347
7410
|
}, []);
|
|
7348
|
-
(0,
|
|
7411
|
+
(0, import_react11.useEffect)(() => {
|
|
7349
7412
|
const container = scrollRef.current;
|
|
7350
7413
|
if (!container) return;
|
|
7351
7414
|
const handleScroll = () => {
|
|
@@ -7363,7 +7426,7 @@ var Calendar = ({
|
|
|
7363
7426
|
container.addEventListener("scroll", handleScroll);
|
|
7364
7427
|
return () => container.removeEventListener("scroll", handleScroll);
|
|
7365
7428
|
}, [loadMoreMonths]);
|
|
7366
|
-
(0,
|
|
7429
|
+
(0, import_react11.useEffect)(() => {
|
|
7367
7430
|
if (!scrollRef.current) return;
|
|
7368
7431
|
const target = selected ?? initialDate ?? /* @__PURE__ */ new Date();
|
|
7369
7432
|
const monthKey = (0, import_date_fns2.format)((0, import_date_fns2.startOfMonth)(target), "yyyy-MM");
|
|
@@ -7372,7 +7435,7 @@ var Calendar = ({
|
|
|
7372
7435
|
el.scrollIntoView({ behavior: "auto", block: "start" });
|
|
7373
7436
|
}
|
|
7374
7437
|
}, []);
|
|
7375
|
-
const renderMonth = (0,
|
|
7438
|
+
const renderMonth = (0, import_react11.useCallback)(
|
|
7376
7439
|
(month) => {
|
|
7377
7440
|
const firstDay = (0, import_date_fns2.startOfMonth)(month);
|
|
7378
7441
|
const totalDays = (0, import_date_fns2.getDaysInMonth)(month);
|
|
@@ -7413,7 +7476,7 @@ var Calendar = ({
|
|
|
7413
7476
|
},
|
|
7414
7477
|
[selected, onSelect, disabled, isWeekendProp]
|
|
7415
7478
|
);
|
|
7416
|
-
const renderedMonths = (0,
|
|
7479
|
+
const renderedMonths = (0, import_react11.useMemo)(
|
|
7417
7480
|
() => months.map(renderMonth),
|
|
7418
7481
|
[months, renderMonth]
|
|
7419
7482
|
);
|
|
@@ -7468,12 +7531,12 @@ var DatePicker = ({
|
|
|
7468
7531
|
businessDays = true,
|
|
7469
7532
|
footer
|
|
7470
7533
|
}) => {
|
|
7471
|
-
const [open, setOpen] = (0,
|
|
7472
|
-
const [inputValue, setInputValue] = (0,
|
|
7473
|
-
const [draftDate, setDraftDate] = (0,
|
|
7474
|
-
const dateInputRef = (0,
|
|
7475
|
-
const segIdxRef = (0,
|
|
7476
|
-
const charPosRef = (0,
|
|
7534
|
+
const [open, setOpen] = (0, import_react12.useState)(false);
|
|
7535
|
+
const [inputValue, setInputValue] = (0, import_react12.useState)("");
|
|
7536
|
+
const [draftDate, setDraftDate] = (0, import_react12.useState)(void 0);
|
|
7537
|
+
const dateInputRef = (0, import_react12.useRef)(null);
|
|
7538
|
+
const segIdxRef = (0, import_react12.useRef)(0);
|
|
7539
|
+
const charPosRef = (0, import_react12.useRef)(0);
|
|
7477
7540
|
const selectedDate = (() => {
|
|
7478
7541
|
if (!value) return void 0;
|
|
7479
7542
|
const d = /* @__PURE__ */ new Date(value + "T00:00:00Z");
|
|
@@ -7481,7 +7544,7 @@ var DatePicker = ({
|
|
|
7481
7544
|
})();
|
|
7482
7545
|
const activeDate = draftDate ?? selectedDate;
|
|
7483
7546
|
const displayValue = selectedDate ? formatUTCDate(selectedDate, displayFormat) : placeholder;
|
|
7484
|
-
(0,
|
|
7547
|
+
(0, import_react12.useEffect)(() => {
|
|
7485
7548
|
if (value) {
|
|
7486
7549
|
const d = /* @__PURE__ */ new Date(value + "T00:00:00Z");
|
|
7487
7550
|
if ((0, import_date_fns3.isValid)(d)) {
|
|
@@ -7493,12 +7556,12 @@ var DatePicker = ({
|
|
|
7493
7556
|
setDraftDate(void 0);
|
|
7494
7557
|
}
|
|
7495
7558
|
}, [value]);
|
|
7496
|
-
const selectSegByIdx = (0,
|
|
7559
|
+
const selectSegByIdx = (0, import_react12.useCallback)((idx) => {
|
|
7497
7560
|
if (!dateInputRef.current) return;
|
|
7498
7561
|
const seg = segments[idx] ?? segments[0];
|
|
7499
7562
|
dateInputRef.current.setSelectionRange(seg.start, seg.end);
|
|
7500
7563
|
}, []);
|
|
7501
|
-
(0,
|
|
7564
|
+
(0, import_react12.useEffect)(() => {
|
|
7502
7565
|
if (open) {
|
|
7503
7566
|
setTimeout(() => {
|
|
7504
7567
|
if (dateInputRef.current) {
|
|
@@ -7526,18 +7589,18 @@ var DatePicker = ({
|
|
|
7526
7589
|
selectSegByIdx(segIdxRef.current);
|
|
7527
7590
|
}, 0);
|
|
7528
7591
|
};
|
|
7529
|
-
const handleShiftButtonMouseDown = (0,
|
|
7592
|
+
const handleShiftButtonMouseDown = (0, import_react12.useCallback)(
|
|
7530
7593
|
(e) => {
|
|
7531
7594
|
e.preventDefault();
|
|
7532
7595
|
},
|
|
7533
7596
|
[]
|
|
7534
7597
|
);
|
|
7535
|
-
const updateFromDate = (0,
|
|
7598
|
+
const updateFromDate = (0, import_react12.useCallback)((newDate) => {
|
|
7536
7599
|
if (!(0, import_date_fns3.isValid)(newDate)) return;
|
|
7537
7600
|
setInputValue(formatUTCDate(newDate, "dd.MM.yy"));
|
|
7538
7601
|
setDraftDate(newDate);
|
|
7539
7602
|
}, []);
|
|
7540
|
-
const commitDate = (0,
|
|
7603
|
+
const commitDate = (0, import_react12.useCallback)((dateToCommit) => {
|
|
7541
7604
|
const nextDate = dateToCommit ?? draftDate ?? selectedDate;
|
|
7542
7605
|
if (!nextDate || !(0, import_date_fns3.isValid)(nextDate)) return;
|
|
7543
7606
|
const iso = [
|
|
@@ -7548,7 +7611,7 @@ var DatePicker = ({
|
|
|
7548
7611
|
if (iso === value) return;
|
|
7549
7612
|
onChange?.(iso);
|
|
7550
7613
|
}, [draftDate, onChange, selectedDate, value]);
|
|
7551
|
-
const handleCalendarSelect = (0,
|
|
7614
|
+
const handleCalendarSelect = (0, import_react12.useCallback)(
|
|
7552
7615
|
(day) => {
|
|
7553
7616
|
const normalizedDay = businessDays && isWeekend3 && isWeekend3(day) ? snapToBusinessDay(day, 1, isWeekend3) : day;
|
|
7554
7617
|
updateFromDate(normalizedDay);
|
|
@@ -7557,7 +7620,7 @@ var DatePicker = ({
|
|
|
7557
7620
|
},
|
|
7558
7621
|
[businessDays, commitDate, isWeekend3, updateFromDate]
|
|
7559
7622
|
);
|
|
7560
|
-
const handleDayShift = (0,
|
|
7623
|
+
const handleDayShift = (0, import_react12.useCallback)(
|
|
7561
7624
|
(delta) => {
|
|
7562
7625
|
const base = activeDate ?? /* @__PURE__ */ new Date();
|
|
7563
7626
|
if (businessDays && isWeekend3) {
|
|
@@ -7568,7 +7631,7 @@ var DatePicker = ({
|
|
|
7568
7631
|
},
|
|
7569
7632
|
[activeDate, updateFromDate, businessDays, isWeekend3]
|
|
7570
7633
|
);
|
|
7571
|
-
const handleTriggerKeyDown = (0,
|
|
7634
|
+
const handleTriggerKeyDown = (0, import_react12.useCallback)((e) => {
|
|
7572
7635
|
if (disabled) return;
|
|
7573
7636
|
if (e.key === "ArrowUp") {
|
|
7574
7637
|
e.preventDefault();
|
|
@@ -7582,7 +7645,7 @@ var DatePicker = ({
|
|
|
7582
7645
|
handleDayShift(-1);
|
|
7583
7646
|
}
|
|
7584
7647
|
}, [disabled, handleDayShift]);
|
|
7585
|
-
const handleKeyDown = (0,
|
|
7648
|
+
const handleKeyDown = (0, import_react12.useCallback)((e) => {
|
|
7586
7649
|
if (!dateInputRef.current) return;
|
|
7587
7650
|
const { value: inputVal } = dateInputRef.current;
|
|
7588
7651
|
const segIdx = segIdxRef.current;
|
|
@@ -7683,7 +7746,7 @@ var DatePicker = ({
|
|
|
7683
7746
|
}
|
|
7684
7747
|
}
|
|
7685
7748
|
}, [activeDate, businessDays, commitDate, isWeekend3, selectSegByIdx, updateFromDate]);
|
|
7686
|
-
const handleOpenChange = (0,
|
|
7749
|
+
const handleOpenChange = (0, import_react12.useCallback)((nextOpen) => {
|
|
7687
7750
|
if (!nextOpen && open) {
|
|
7688
7751
|
commitDate();
|
|
7689
7752
|
}
|
|
@@ -7927,11 +7990,11 @@ var DepChip = ({
|
|
|
7927
7990
|
businessDays = true,
|
|
7928
7991
|
weekendPredicate
|
|
7929
7992
|
}) => {
|
|
7930
|
-
const [popoverOpen, setPopoverOpen] = (0,
|
|
7931
|
-
const [typeMenuOpen, setTypeMenuOpen] = (0,
|
|
7993
|
+
const [popoverOpen, setPopoverOpen] = (0, import_react13.useState)(false);
|
|
7994
|
+
const [typeMenuOpen, setTypeMenuOpen] = (0, import_react13.useState)(false);
|
|
7932
7995
|
const lagAbs = Math.abs(lag ?? 0);
|
|
7933
|
-
const [inputAbs, setInputAbs] = (0,
|
|
7934
|
-
(0,
|
|
7996
|
+
const [inputAbs, setInputAbs] = (0, import_react13.useState)(lagAbs === 0 ? "" : String(lagAbs));
|
|
7997
|
+
(0, import_react13.useEffect)(() => {
|
|
7935
7998
|
const abs = Math.abs(lag ?? 0);
|
|
7936
7999
|
setInputAbs(abs === 0 ? "" : String(abs));
|
|
7937
8000
|
}, [lag]);
|
|
@@ -7950,7 +8013,7 @@ var DepChip = ({
|
|
|
7950
8013
|
onChipSelect?.(null);
|
|
7951
8014
|
}
|
|
7952
8015
|
};
|
|
7953
|
-
const handleOpenChange = (0,
|
|
8016
|
+
const handleOpenChange = (0, import_react13.useCallback)(
|
|
7954
8017
|
(open) => {
|
|
7955
8018
|
setPopoverOpen(open);
|
|
7956
8019
|
},
|
|
@@ -7962,7 +8025,7 @@ var DepChip = ({
|
|
|
7962
8025
|
onChipSelectClear();
|
|
7963
8026
|
setPopoverOpen(false);
|
|
7964
8027
|
};
|
|
7965
|
-
const handleLagChange = (0,
|
|
8028
|
+
const handleLagChange = (0, import_react13.useCallback)(
|
|
7966
8029
|
(newLag) => {
|
|
7967
8030
|
if (!onTasksChange || !allTasks) return;
|
|
7968
8031
|
const taskById = new Map(allTasks.map((t) => [t.id, t]));
|
|
@@ -8022,7 +8085,7 @@ var DepChip = ({
|
|
|
8022
8085
|
},
|
|
8023
8086
|
[dep, task, allTasks, onTasksChange, businessDays, weekendPredicate]
|
|
8024
8087
|
);
|
|
8025
|
-
const handleInputCommit = (0,
|
|
8088
|
+
const handleInputCommit = (0, import_react13.useCallback)(
|
|
8026
8089
|
(raw) => {
|
|
8027
8090
|
if (raw === "") {
|
|
8028
8091
|
handleLagChange(0);
|
|
@@ -8050,7 +8113,7 @@ var DepChip = ({
|
|
|
8050
8113
|
const Icon = LINK_TYPE_ICONS[dep.type];
|
|
8051
8114
|
const depName = predecessorName ?? dep.taskId;
|
|
8052
8115
|
const effectiveLag = lag ?? 0;
|
|
8053
|
-
const handleTypeChange = (0,
|
|
8116
|
+
const handleTypeChange = (0, import_react13.useCallback)(
|
|
8054
8117
|
(newType) => {
|
|
8055
8118
|
if (newType === dep.type) return;
|
|
8056
8119
|
if (!onTasksChange || !allTasks) return;
|
|
@@ -8353,7 +8416,7 @@ var areTaskListRowPropsEqual = (prevProps, nextProps) => {
|
|
|
8353
8416
|
const nextAnyPicking = nextProps.selectingPredecessorFor != null;
|
|
8354
8417
|
return prevTaskUnchanged && prevProps.rowIndex === nextProps.rowIndex && prevProps.taskNumber === nextProps.taskNumber && prevProps.taskNumberMap === nextProps.taskNumberMap && prevProps.rowHeight === nextProps.rowHeight && prevIsSelected === nextIsSelected && prevProps.disableTaskNameEditing === nextProps.disableTaskNameEditing && prevProps.disableDependencyEditing === nextProps.disableDependencyEditing && prevProps.allTasks === nextProps.allTasks && prevProps.activeLinkType === nextProps.activeLinkType && prevProps.dependencyPickMode === nextProps.dependencyPickMode && prevPickingTask === nextPickingTask && prevAnyPicking === nextAnyPicking && resolveSelectedChipRole(prevProps) === resolveSelectedChipRole(nextProps) && prevIsEditingTask === nextIsEditingTask && prevProps.isDragging === nextProps.isDragging && prevProps.isDragOver === nextProps.isDragOver && prevProps.dragOverPlacement === nextProps.dragOverPlacement && prevProps.isNestedDropTarget === nextProps.isNestedDropTarget && prevProps.isDirectChildDropTarget === nextProps.isDirectChildDropTarget && prevCollapsed === nextCollapsed && prevProps.canDemoteTask === nextProps.canDemoteTask && prevProps.isLastChild === nextProps.isLastChild && prevProps.nestingDepth === nextProps.nestingDepth && prevProps.hasVisibleChildren === nextProps.hasVisibleChildren && prevProps.ancestorLineModes === nextProps.ancestorLineModes && prevProps.customDays === nextProps.customDays && prevProps.isWeekend === nextProps.isWeekend && prevProps.fillParentRow === nextProps.fillParentRow && prevProps.businessDays === nextProps.businessDays && prevProps.defaultTaskDurationDays === nextProps.defaultTaskDurationDays && prevProps.isFilterMatch === nextProps.isFilterMatch && prevProps.isFilterHideMode === nextProps.isFilterHideMode && prevProps.resolvedColumns === nextProps.resolvedColumns && prevProps.isTaskSelected === nextProps.isTaskSelected && resolveActiveCustomCellForRow(prevProps) === resolveActiveCustomCellForRow(nextProps) && prevProps.taskListMenuCommands === nextProps.taskListMenuCommands && prevProps.onInsertAfter === nextProps.onInsertAfter && prevProps.onPromoteTask === nextProps.onPromoteTask && prevProps.onDemoteTask === nextProps.onDemoteTask && prevProps.onDuplicateTask === nextProps.onDuplicateTask && prevProps.onDelete === nextProps.onDelete && prevProps.onUngroupTask === nextProps.onUngroupTask && prevProps.renderTaskListActions === nextProps.renderTaskListActions && prevProps.renderTaskListMenu === nextProps.renderTaskListMenu && prevProps.renderTaskDateAction === nextProps.renderTaskDateAction && prevProps.hideTaskListRowActions === nextProps.hideTaskListRowActions && prevProps.rowClassName === nextProps.rowClassName && prevProps.getTaskListNamePrefixIcon === nextProps.getTaskListNamePrefixIcon && prevProps.taskDateChangeMode === nextProps.taskDateChangeMode && prevProps.printDependencyLabels === nextProps.printDependencyLabels;
|
|
8355
8418
|
};
|
|
8356
|
-
var TaskListRow =
|
|
8419
|
+
var TaskListRow = import_react13.default.memo(
|
|
8357
8420
|
({
|
|
8358
8421
|
task,
|
|
8359
8422
|
rowIndex,
|
|
@@ -8426,13 +8489,13 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8426
8489
|
onTaskDateChangeModeChange,
|
|
8427
8490
|
printDependencyLabels = false
|
|
8428
8491
|
}) => {
|
|
8429
|
-
const [editingColumnId, setEditingColumnId] = (0,
|
|
8430
|
-
const [editingColumnStartValue, setEditingColumnStartValue] = (0,
|
|
8492
|
+
const [editingColumnId, setEditingColumnId] = (0, import_react13.useState)(null);
|
|
8493
|
+
const [editingColumnStartValue, setEditingColumnStartValue] = (0, import_react13.useState)(void 0);
|
|
8431
8494
|
const editingName = editingColumnId === "name";
|
|
8432
8495
|
const editingDuration = editingColumnId === "duration";
|
|
8433
8496
|
const editingProgress = editingColumnId === "progress";
|
|
8434
8497
|
const taskListNamePrefixIcon = getTaskListNamePrefixIcon?.(task) ?? null;
|
|
8435
|
-
const columnWidthStyleMap = (0,
|
|
8498
|
+
const columnWidthStyleMap = (0, import_react13.useMemo)(() => {
|
|
8436
8499
|
return new Map(
|
|
8437
8500
|
(resolvedColumns ?? []).map((column) => {
|
|
8438
8501
|
const width = column.width ?? 120;
|
|
@@ -8448,7 +8511,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8448
8511
|
})
|
|
8449
8512
|
);
|
|
8450
8513
|
}, [resolvedColumns]);
|
|
8451
|
-
const getColumnStyle = (0,
|
|
8514
|
+
const getColumnStyle = (0, import_react13.useCallback)((columnId, fallbackWidth) => {
|
|
8452
8515
|
return columnWidthStyleMap.get(columnId) ?? {
|
|
8453
8516
|
width: fallbackWidth,
|
|
8454
8517
|
minWidth: fallbackWidth,
|
|
@@ -8456,30 +8519,30 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8456
8519
|
flex: `0 0 ${fallbackWidth}px`
|
|
8457
8520
|
};
|
|
8458
8521
|
}, [columnWidthStyleMap]);
|
|
8459
|
-
const normalizedTask = (0,
|
|
8460
|
-
const isMilestone = (0,
|
|
8461
|
-
const [nameValue, setNameValue] = (0,
|
|
8462
|
-
const nameInputRef = (0,
|
|
8463
|
-
const [durationValue, setDurationValue] = (0,
|
|
8522
|
+
const normalizedTask = (0, import_react13.useMemo)(() => normalizeTaskDatesForType(task), [task]);
|
|
8523
|
+
const isMilestone = (0, import_react13.useMemo)(() => isMilestoneTask(normalizedTask), [normalizedTask]);
|
|
8524
|
+
const [nameValue, setNameValue] = (0, import_react13.useState)("");
|
|
8525
|
+
const nameInputRef = (0, import_react13.useRef)(null);
|
|
8526
|
+
const [durationValue, setDurationValue] = (0, import_react13.useState)(
|
|
8464
8527
|
() => getInclusiveDurationDays(normalizedTask.startDate, normalizedTask.endDate)
|
|
8465
8528
|
);
|
|
8466
|
-
const durationInputRef = (0,
|
|
8467
|
-
const dependencySearchInputRef = (0,
|
|
8468
|
-
const dependencySearchListRef = (0,
|
|
8469
|
-
const [progressValue, setProgressValue] = (0,
|
|
8470
|
-
const progressInputRef = (0,
|
|
8471
|
-
const [overflowOpen, setOverflowOpen] = (0,
|
|
8472
|
-
const [contextMenuOpen, setContextMenuOpen] = (0,
|
|
8473
|
-
const nameConfirmedRef = (0,
|
|
8474
|
-
const durationConfirmedRef = (0,
|
|
8475
|
-
const progressConfirmedRef = (0,
|
|
8476
|
-
const autoEditedForRef = (0,
|
|
8477
|
-
const editTriggerRef = (0,
|
|
8529
|
+
const durationInputRef = (0, import_react13.useRef)(null);
|
|
8530
|
+
const dependencySearchInputRef = (0, import_react13.useRef)(null);
|
|
8531
|
+
const dependencySearchListRef = (0, import_react13.useRef)(null);
|
|
8532
|
+
const [progressValue, setProgressValue] = (0, import_react13.useState)(0);
|
|
8533
|
+
const progressInputRef = (0, import_react13.useRef)(null);
|
|
8534
|
+
const [overflowOpen, setOverflowOpen] = (0, import_react13.useState)(false);
|
|
8535
|
+
const [contextMenuOpen, setContextMenuOpen] = (0, import_react13.useState)(false);
|
|
8536
|
+
const nameConfirmedRef = (0, import_react13.useRef)(false);
|
|
8537
|
+
const durationConfirmedRef = (0, import_react13.useRef)(false);
|
|
8538
|
+
const progressConfirmedRef = (0, import_react13.useRef)(false);
|
|
8539
|
+
const autoEditedForRef = (0, import_react13.useRef)(null);
|
|
8540
|
+
const editTriggerRef = (0, import_react13.useRef)(
|
|
8478
8541
|
"doubleclick"
|
|
8479
8542
|
);
|
|
8480
|
-
const rowRef = (0,
|
|
8543
|
+
const rowRef = (0, import_react13.useRef)(null);
|
|
8481
8544
|
const isSelected = selectedTaskId === task.id;
|
|
8482
|
-
const isParent = (0,
|
|
8545
|
+
const isParent = (0, import_react13.useMemo)(
|
|
8483
8546
|
() => isTaskParent(task.id, allTasks),
|
|
8484
8547
|
[task.id, allTasks]
|
|
8485
8548
|
);
|
|
@@ -8487,30 +8550,30 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8487
8550
|
const rowFillLevel = Math.min(nestingDepth, 2);
|
|
8488
8551
|
const isTotalRow = Boolean(task.isTotal);
|
|
8489
8552
|
const isMilestoneRow = normalizedTask.type === "milestone";
|
|
8490
|
-
const weekendPredicate = (0,
|
|
8553
|
+
const weekendPredicate = (0, import_react13.useMemo)(
|
|
8491
8554
|
() => createCustomDayPredicate({ customDays, isWeekend: isWeekend3 }),
|
|
8492
8555
|
[customDays, isWeekend3]
|
|
8493
8556
|
);
|
|
8494
|
-
const getDuration = (0,
|
|
8557
|
+
const getDuration = (0, import_react13.useCallback)(
|
|
8495
8558
|
(start, end) => {
|
|
8496
8559
|
return businessDays ? getBusinessDaysCount(start, end, weekendPredicate) : getInclusiveDurationDays(start, end);
|
|
8497
8560
|
},
|
|
8498
8561
|
[businessDays, weekendPredicate]
|
|
8499
8562
|
);
|
|
8500
|
-
const getEndDate = (0,
|
|
8563
|
+
const getEndDate = (0, import_react13.useCallback)(
|
|
8501
8564
|
(start, duration) => {
|
|
8502
8565
|
return businessDays ? addBusinessDays(start, duration, weekendPredicate).toISOString().split("T")[0] : getEndDateFromDuration(start, duration);
|
|
8503
8566
|
},
|
|
8504
8567
|
[businessDays, weekendPredicate]
|
|
8505
8568
|
);
|
|
8506
8569
|
const isCollapsed = collapsedParentIds.has(task.id);
|
|
8507
|
-
const [compositeIconMode, setCompositeIconMode] = (0,
|
|
8570
|
+
const [compositeIconMode, setCompositeIconMode] = (0, import_react13.useState)(
|
|
8508
8571
|
() => isCollapsed ? "composite" : "down"
|
|
8509
8572
|
);
|
|
8510
|
-
const compositeIconModeRef = (0,
|
|
8511
|
-
const [compositeIconAnimation, setCompositeIconAnimation] = (0,
|
|
8512
|
-
const [compositeIconAnimationPhase, setCompositeIconAnimationPhase] = (0,
|
|
8513
|
-
(0,
|
|
8573
|
+
const compositeIconModeRef = (0, import_react13.useRef)(compositeIconMode);
|
|
8574
|
+
const [compositeIconAnimation, setCompositeIconAnimation] = (0, import_react13.useState)(null);
|
|
8575
|
+
const [compositeIconAnimationPhase, setCompositeIconAnimationPhase] = (0, import_react13.useState)(null);
|
|
8576
|
+
(0, import_react13.useEffect)(() => {
|
|
8514
8577
|
const nextMode = isCollapsed ? "composite" : "down";
|
|
8515
8578
|
if (nextMode === compositeIconModeRef.current) {
|
|
8516
8579
|
setCompositeIconAnimation(null);
|
|
@@ -8533,14 +8596,14 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8533
8596
|
window.clearTimeout(finishTimeoutId);
|
|
8534
8597
|
};
|
|
8535
8598
|
}, [isCollapsed]);
|
|
8536
|
-
const getHierarchyLineColor = (0,
|
|
8537
|
-
return columnDepth % 2 === 0 ? "#93c5fd" : "var(--gantt-hierarchy-line-color)";
|
|
8599
|
+
const getHierarchyLineColor = (0, import_react13.useCallback)((columnDepth) => {
|
|
8600
|
+
return columnDepth % 2 === 0 ? "var(--gantt-focus-color, #93c5fd)" : "var(--gantt-hierarchy-line-color)";
|
|
8538
8601
|
}, []);
|
|
8539
8602
|
const isPicking = selectingPredecessorFor != null;
|
|
8540
8603
|
const isSourceRow = isPicking && selectingPredecessorFor === task.id;
|
|
8541
|
-
const [dependencySearchQuery, setDependencySearchQuery] = (0,
|
|
8542
|
-
const [highlightedDependencyIndex, setHighlightedDependencyIndex] = (0,
|
|
8543
|
-
const chips = (0,
|
|
8604
|
+
const [dependencySearchQuery, setDependencySearchQuery] = (0, import_react13.useState)("");
|
|
8605
|
+
const [highlightedDependencyIndex, setHighlightedDependencyIndex] = (0, import_react13.useState)(0);
|
|
8606
|
+
const chips = (0, import_react13.useMemo)(() => {
|
|
8544
8607
|
const taskById = new Map((allTasks ?? []).map((t) => [t.id, t]));
|
|
8545
8608
|
return (task.dependencies ?? []).filter((dep) => !dep.hidden).map((dep) => {
|
|
8546
8609
|
const pred = taskById.get(dep.taskId);
|
|
@@ -8549,7 +8612,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8549
8612
|
});
|
|
8550
8613
|
}, [task.dependencies, allTasks]);
|
|
8551
8614
|
const linkWord = chips.length <= 4 ? "\u0441\u0432\u044F\u0437\u0438" : "\u0441\u0432\u044F\u0437\u0435\u0439";
|
|
8552
|
-
const dependencySearchCandidates = (0,
|
|
8615
|
+
const dependencySearchCandidates = (0, import_react13.useMemo)(() => {
|
|
8553
8616
|
if (!isSourceRow) return [];
|
|
8554
8617
|
const normalizedQuery = dependencySearchQuery.trim().toLowerCase();
|
|
8555
8618
|
return allTasks.filter((candidate) => candidate.id !== task.id).map((candidate) => {
|
|
@@ -8576,7 +8639,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8576
8639
|
taskNumberMap,
|
|
8577
8640
|
task.dependencies
|
|
8578
8641
|
]);
|
|
8579
|
-
(0,
|
|
8642
|
+
(0, import_react13.useEffect)(() => {
|
|
8580
8643
|
if (editingName && nameInputRef.current) {
|
|
8581
8644
|
nameInputRef.current.focus();
|
|
8582
8645
|
if (editTriggerRef.current === "keypress") {
|
|
@@ -8587,15 +8650,15 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8587
8650
|
}
|
|
8588
8651
|
}
|
|
8589
8652
|
}, [editingName]);
|
|
8590
|
-
(0,
|
|
8653
|
+
(0, import_react13.useEffect)(() => {
|
|
8591
8654
|
if (!isSourceRow && dependencySearchQuery !== "") {
|
|
8592
8655
|
setDependencySearchQuery("");
|
|
8593
8656
|
}
|
|
8594
8657
|
}, [isSourceRow, dependencySearchQuery]);
|
|
8595
|
-
(0,
|
|
8658
|
+
(0, import_react13.useEffect)(() => {
|
|
8596
8659
|
setHighlightedDependencyIndex(0);
|
|
8597
8660
|
}, [dependencySearchQuery, isSourceRow, dependencyPickMode]);
|
|
8598
|
-
(0,
|
|
8661
|
+
(0, import_react13.useEffect)(() => {
|
|
8599
8662
|
if (dependencySearchCandidates.length === 0) {
|
|
8600
8663
|
setHighlightedDependencyIndex(0);
|
|
8601
8664
|
return;
|
|
@@ -8604,13 +8667,13 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8604
8667
|
setHighlightedDependencyIndex(dependencySearchCandidates.length - 1);
|
|
8605
8668
|
}
|
|
8606
8669
|
}, [dependencySearchCandidates, highlightedDependencyIndex]);
|
|
8607
|
-
(0,
|
|
8670
|
+
(0, import_react13.useEffect)(() => {
|
|
8608
8671
|
if (isSourceRow && dependencySearchInputRef.current) {
|
|
8609
8672
|
dependencySearchInputRef.current.focus();
|
|
8610
8673
|
dependencySearchInputRef.current.select();
|
|
8611
8674
|
}
|
|
8612
8675
|
}, [isSourceRow, dependencyPickMode, activeLinkType]);
|
|
8613
|
-
(0,
|
|
8676
|
+
(0, import_react13.useEffect)(() => {
|
|
8614
8677
|
if (!isSourceRow || dependencySearchCandidates.length === 0) {
|
|
8615
8678
|
return;
|
|
8616
8679
|
}
|
|
@@ -8622,7 +8685,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8622
8685
|
block: "nearest"
|
|
8623
8686
|
});
|
|
8624
8687
|
}, [isSourceRow, highlightedDependencyIndex, dependencySearchCandidates]);
|
|
8625
|
-
(0,
|
|
8688
|
+
(0, import_react13.useEffect)(() => {
|
|
8626
8689
|
if (editingTaskId === task.id && !disableTaskNameEditing && autoEditedForRef.current !== editingTaskId) {
|
|
8627
8690
|
autoEditedForRef.current = editingTaskId;
|
|
8628
8691
|
nameConfirmedRef.current = false;
|
|
@@ -8631,7 +8694,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8631
8694
|
setEditingColumnId("name");
|
|
8632
8695
|
}
|
|
8633
8696
|
}, [editingTaskId, task.id, disableTaskNameEditing]);
|
|
8634
|
-
const handleNameClick = (0,
|
|
8697
|
+
const handleNameClick = (0, import_react13.useCallback)(
|
|
8635
8698
|
(e) => {
|
|
8636
8699
|
e.stopPropagation();
|
|
8637
8700
|
onRowClick?.(task.id);
|
|
@@ -8639,7 +8702,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8639
8702
|
},
|
|
8640
8703
|
[task.id, onRowClick, onScrollToTask]
|
|
8641
8704
|
);
|
|
8642
|
-
const handleNameDoubleClick = (0,
|
|
8705
|
+
const handleNameDoubleClick = (0, import_react13.useCallback)(
|
|
8643
8706
|
(e) => {
|
|
8644
8707
|
if (task.composite) return;
|
|
8645
8708
|
if (disableTaskNameEditing) return;
|
|
@@ -8651,7 +8714,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8651
8714
|
},
|
|
8652
8715
|
[task.name, task.composite, disableTaskNameEditing]
|
|
8653
8716
|
);
|
|
8654
|
-
const handleRowKeyDown = (0,
|
|
8717
|
+
const handleRowKeyDown = (0, import_react13.useCallback)(
|
|
8655
8718
|
(e) => {
|
|
8656
8719
|
if (editingProgress) return;
|
|
8657
8720
|
if (!editingName && !disableTaskNameEditing && e.key === "F2") {
|
|
@@ -8665,7 +8728,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8665
8728
|
},
|
|
8666
8729
|
[editingName, disableTaskNameEditing, task.name]
|
|
8667
8730
|
);
|
|
8668
|
-
const handleNameSave = (0,
|
|
8731
|
+
const handleNameSave = (0, import_react13.useCallback)(() => {
|
|
8669
8732
|
if (nameConfirmedRef.current) {
|
|
8670
8733
|
nameConfirmedRef.current = false;
|
|
8671
8734
|
return;
|
|
@@ -8675,10 +8738,10 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8675
8738
|
}
|
|
8676
8739
|
setEditingColumnId(null);
|
|
8677
8740
|
}, [nameValue, task, onTasksChange]);
|
|
8678
|
-
const handleNameCancel = (0,
|
|
8741
|
+
const handleNameCancel = (0, import_react13.useCallback)(() => {
|
|
8679
8742
|
setEditingColumnId(null);
|
|
8680
8743
|
}, []);
|
|
8681
|
-
const handleNameKeyDown = (0,
|
|
8744
|
+
const handleNameKeyDown = (0, import_react13.useCallback)(
|
|
8682
8745
|
(e) => {
|
|
8683
8746
|
if (e.key === "Enter") {
|
|
8684
8747
|
nameConfirmedRef.current = true;
|
|
@@ -8692,7 +8755,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8692
8755
|
},
|
|
8693
8756
|
[nameValue, task, onTasksChange, handleNameCancel]
|
|
8694
8757
|
);
|
|
8695
|
-
const handleDurationClick = (0,
|
|
8758
|
+
const handleDurationClick = (0, import_react13.useCallback)(
|
|
8696
8759
|
(e) => {
|
|
8697
8760
|
if (task.locked) return;
|
|
8698
8761
|
e.stopPropagation();
|
|
@@ -8704,11 +8767,11 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8704
8767
|
},
|
|
8705
8768
|
[task.locked, normalizedTask.startDate, normalizedTask.endDate, getDuration, isMilestone]
|
|
8706
8769
|
);
|
|
8707
|
-
const applyDurationChange = (0,
|
|
8770
|
+
const applyDurationChange = (0, import_react13.useCallback)((nextDuration) => {
|
|
8708
8771
|
const normalizedDuration = Math.max(0, Math.round(nextDuration) || 0);
|
|
8709
8772
|
setDurationValue(normalizedDuration);
|
|
8710
8773
|
}, []);
|
|
8711
|
-
const emitDurationChange = (0,
|
|
8774
|
+
const emitDurationChange = (0, import_react13.useCallback)((rounded) => {
|
|
8712
8775
|
if (onDurationChange) {
|
|
8713
8776
|
onDurationChange(
|
|
8714
8777
|
isMilestone && rounded > 0 ? { ...task, type: "task" } : !isMilestone && rounded === 0 ? { ...task, type: "milestone", endDate: task.startDate } : task,
|
|
@@ -8730,7 +8793,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8730
8793
|
]);
|
|
8731
8794
|
}
|
|
8732
8795
|
}, [getEndDate, isMilestone, onDurationChange, onTasksChange, task]);
|
|
8733
|
-
const handleDurationSave = (0,
|
|
8796
|
+
const handleDurationSave = (0, import_react13.useCallback)(() => {
|
|
8734
8797
|
if (durationConfirmedRef.current) {
|
|
8735
8798
|
durationConfirmedRef.current = false;
|
|
8736
8799
|
return;
|
|
@@ -8739,17 +8802,17 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8739
8802
|
emitDurationChange(rounded);
|
|
8740
8803
|
setEditingColumnId(null);
|
|
8741
8804
|
}, [durationValue, emitDurationChange]);
|
|
8742
|
-
const handleDurationCancel = (0,
|
|
8805
|
+
const handleDurationCancel = (0, import_react13.useCallback)(() => {
|
|
8743
8806
|
setDurationValue(isMilestone ? 0 : getDuration(normalizedTask.startDate, normalizedTask.endDate));
|
|
8744
8807
|
setEditingColumnId(null);
|
|
8745
8808
|
}, [normalizedTask.startDate, normalizedTask.endDate, getDuration, isMilestone]);
|
|
8746
|
-
const handleDurationAdjust = (0,
|
|
8809
|
+
const handleDurationAdjust = (0, import_react13.useCallback)(
|
|
8747
8810
|
(delta) => {
|
|
8748
8811
|
applyDurationChange(durationValue + delta);
|
|
8749
8812
|
},
|
|
8750
8813
|
[applyDurationChange, durationValue]
|
|
8751
8814
|
);
|
|
8752
|
-
const handleDurationKeyDown = (0,
|
|
8815
|
+
const handleDurationKeyDown = (0, import_react13.useCallback)(
|
|
8753
8816
|
(e) => {
|
|
8754
8817
|
e.stopPropagation();
|
|
8755
8818
|
if (e.key === "Enter") {
|
|
@@ -8763,7 +8826,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8763
8826
|
},
|
|
8764
8827
|
[durationValue, emitDurationChange, handleDurationCancel]
|
|
8765
8828
|
);
|
|
8766
|
-
const handleProgressClick = (0,
|
|
8829
|
+
const handleProgressClick = (0, import_react13.useCallback)(
|
|
8767
8830
|
(e) => {
|
|
8768
8831
|
if (task.locked) return;
|
|
8769
8832
|
e.stopPropagation();
|
|
@@ -8773,7 +8836,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8773
8836
|
},
|
|
8774
8837
|
[task.progress, task.locked]
|
|
8775
8838
|
);
|
|
8776
|
-
const handleProgressSave = (0,
|
|
8839
|
+
const handleProgressSave = (0, import_react13.useCallback)(() => {
|
|
8777
8840
|
if (progressConfirmedRef.current) {
|
|
8778
8841
|
progressConfirmedRef.current = false;
|
|
8779
8842
|
return;
|
|
@@ -8782,15 +8845,15 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8782
8845
|
onTasksChange?.(cascadeTaskProgress({ ...task, progress: clampedValue }, allTasks));
|
|
8783
8846
|
setEditingColumnId(null);
|
|
8784
8847
|
}, [progressValue, task, onTasksChange, allTasks]);
|
|
8785
|
-
const handleProgressCancel = (0,
|
|
8848
|
+
const handleProgressCancel = (0, import_react13.useCallback)(() => {
|
|
8786
8849
|
setEditingColumnId(null);
|
|
8787
8850
|
}, []);
|
|
8788
|
-
const handleProgressAdjust = (0,
|
|
8851
|
+
const handleProgressAdjust = (0, import_react13.useCallback)((delta) => {
|
|
8789
8852
|
setProgressValue(
|
|
8790
8853
|
(current) => Math.max(0, Math.min(100, current + delta))
|
|
8791
8854
|
);
|
|
8792
8855
|
}, []);
|
|
8793
|
-
const handleProgressKeyDown = (0,
|
|
8856
|
+
const handleProgressKeyDown = (0, import_react13.useCallback)(
|
|
8794
8857
|
(e) => {
|
|
8795
8858
|
e.stopPropagation();
|
|
8796
8859
|
if (e.key === "Enter") {
|
|
@@ -8804,22 +8867,22 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8804
8867
|
},
|
|
8805
8868
|
[progressValue, task, onTasksChange, handleProgressCancel, allTasks]
|
|
8806
8869
|
);
|
|
8807
|
-
(0,
|
|
8870
|
+
(0, import_react13.useEffect)(() => {
|
|
8808
8871
|
if (editingProgress && progressInputRef.current) {
|
|
8809
8872
|
progressInputRef.current.focus();
|
|
8810
8873
|
progressInputRef.current.select();
|
|
8811
8874
|
}
|
|
8812
8875
|
}, [editingProgress]);
|
|
8813
|
-
(0,
|
|
8876
|
+
(0, import_react13.useEffect)(() => {
|
|
8814
8877
|
setDurationValue(getDuration(normalizedTask.startDate, normalizedTask.endDate));
|
|
8815
8878
|
}, [normalizedTask.startDate, normalizedTask.endDate, getDuration]);
|
|
8816
|
-
(0,
|
|
8879
|
+
(0, import_react13.useEffect)(() => {
|
|
8817
8880
|
if (editingDuration && durationInputRef.current) {
|
|
8818
8881
|
durationInputRef.current.focus();
|
|
8819
8882
|
durationInputRef.current.select();
|
|
8820
8883
|
}
|
|
8821
8884
|
}, [editingDuration]);
|
|
8822
|
-
const emitMilestoneDateChange = (0,
|
|
8885
|
+
const emitMilestoneDateChange = (0, import_react13.useCallback)((nextDateISO) => {
|
|
8823
8886
|
const alignedDate = businessDays ? alignToWorkingDay(/* @__PURE__ */ new Date(`${nextDateISO}T00:00:00.000Z`), 1, weekendPredicate) : /* @__PURE__ */ new Date(`${nextDateISO}T00:00:00.000Z`);
|
|
8824
8887
|
const clampedRange = clampTaskRangeForIncomingFS(
|
|
8825
8888
|
task,
|
|
@@ -8852,7 +8915,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8852
8915
|
}
|
|
8853
8916
|
]);
|
|
8854
8917
|
}, [task, onTasksChange, allTasks, businessDays, weekendPredicate]);
|
|
8855
|
-
const handleStartDateChange = (0,
|
|
8918
|
+
const handleStartDateChange = (0, import_react13.useCallback)(
|
|
8856
8919
|
(newDateISO) => {
|
|
8857
8920
|
if (!newDateISO) return;
|
|
8858
8921
|
if (isMilestone) {
|
|
@@ -8905,7 +8968,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8905
8968
|
},
|
|
8906
8969
|
[task, onTasksChange, businessDays, getDuration, allTasks, weekendPredicate, isMilestone, emitMilestoneDateChange, taskDateChangeMode]
|
|
8907
8970
|
);
|
|
8908
|
-
const handleEndDateChange = (0,
|
|
8971
|
+
const handleEndDateChange = (0, import_react13.useCallback)(
|
|
8909
8972
|
(newDateISO) => {
|
|
8910
8973
|
if (!newDateISO) return;
|
|
8911
8974
|
if (isMilestone) {
|
|
@@ -8969,24 +9032,24 @@ var TaskListRow = import_react12.default.memo(
|
|
|
8969
9032
|
),
|
|
8970
9033
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "\u0421\u043E\u0445\u0440\u0430\u043D\u044F\u0442\u044C \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C" })
|
|
8971
9034
|
] }) : null;
|
|
8972
|
-
const handleRowClickInternal = (0,
|
|
9035
|
+
const handleRowClickInternal = (0, import_react13.useCallback)(() => {
|
|
8973
9036
|
onRowClick?.(task.id);
|
|
8974
9037
|
}, [task.id, onRowClick]);
|
|
8975
|
-
const handleNumberClick = (0,
|
|
9038
|
+
const handleNumberClick = (0, import_react13.useCallback)(
|
|
8976
9039
|
(e) => {
|
|
8977
9040
|
e.stopPropagation();
|
|
8978
9041
|
onRowClick?.(task.id);
|
|
8979
9042
|
},
|
|
8980
9043
|
[task.id, onRowClick]
|
|
8981
9044
|
);
|
|
8982
|
-
const handleToggleCollapse = (0,
|
|
9045
|
+
const handleToggleCollapse = (0, import_react13.useCallback)(
|
|
8983
9046
|
(e) => {
|
|
8984
9047
|
e.stopPropagation();
|
|
8985
9048
|
onToggleCollapse?.(task.id);
|
|
8986
9049
|
},
|
|
8987
9050
|
[task.id, onToggleCollapse]
|
|
8988
9051
|
);
|
|
8989
|
-
const visibleCustomMenuCommands = (0,
|
|
9052
|
+
const visibleCustomMenuCommands = (0, import_react13.useMemo)(
|
|
8990
9053
|
() => taskListMenuCommands.filter(
|
|
8991
9054
|
(command) => {
|
|
8992
9055
|
const scope = command.scope ?? "all";
|
|
@@ -9018,7 +9081,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
9018
9081
|
ungroup: isParent && onUngroupTask ? () => onUngroupTask(task.id) : void 0,
|
|
9019
9082
|
closeMenu: () => setContextMenuOpen(false)
|
|
9020
9083
|
};
|
|
9021
|
-
const commandContent = visibleCustomMenuCommands.length ? visibleCustomMenuCommands.map((command) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
9084
|
+
const commandContent = visibleCustomMenuCommands.length ? visibleCustomMenuCommands.map((command) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react13.default.Fragment, { children: [
|
|
9022
9085
|
command.divider === "top" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("hr", { className: "gantt-tl-context-menu-divider" }),
|
|
9023
9086
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
9024
9087
|
"button",
|
|
@@ -9042,14 +9105,14 @@ var TaskListRow = import_react12.default.memo(
|
|
|
9042
9105
|
const menuContent = hideTaskListRowActions ? null : renderTaskListMenu ? renderTaskListMenu(actionContext, commandContent) : commandContent;
|
|
9043
9106
|
const actionContent = hideTaskListRowActions ? null : renderTaskListActions?.(actionContext);
|
|
9044
9107
|
const hasContextMenu = menuContent !== null && menuContent !== void 0 && menuContent !== false;
|
|
9045
|
-
const handleAddClick = (0,
|
|
9108
|
+
const handleAddClick = (0, import_react13.useCallback)(
|
|
9046
9109
|
(e) => {
|
|
9047
9110
|
e.stopPropagation();
|
|
9048
9111
|
onSetSelectingPredecessorFor?.(task.id);
|
|
9049
9112
|
},
|
|
9050
9113
|
[task.id, onSetSelectingPredecessorFor]
|
|
9051
9114
|
);
|
|
9052
|
-
const handlePredecessorPick = (0,
|
|
9115
|
+
const handlePredecessorPick = (0, import_react13.useCallback)(
|
|
9053
9116
|
(e) => {
|
|
9054
9117
|
e.stopPropagation();
|
|
9055
9118
|
if (!isPicking || isSourceRow) return;
|
|
@@ -9070,14 +9133,14 @@ var TaskListRow = import_react12.default.memo(
|
|
|
9070
9133
|
onAddDependency
|
|
9071
9134
|
]
|
|
9072
9135
|
);
|
|
9073
|
-
const handleCancelPicking = (0,
|
|
9136
|
+
const handleCancelPicking = (0, import_react13.useCallback)(
|
|
9074
9137
|
(e) => {
|
|
9075
9138
|
e.stopPropagation();
|
|
9076
9139
|
onSetSelectingPredecessorFor?.(null);
|
|
9077
9140
|
},
|
|
9078
9141
|
[onSetSelectingPredecessorFor]
|
|
9079
9142
|
);
|
|
9080
|
-
const handleSourceCellClick = (0,
|
|
9143
|
+
const handleSourceCellClick = (0, import_react13.useCallback)(
|
|
9081
9144
|
(e) => {
|
|
9082
9145
|
if (e.target === e.currentTarget) {
|
|
9083
9146
|
handleCancelPicking(e);
|
|
@@ -9085,7 +9148,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
9085
9148
|
},
|
|
9086
9149
|
[handleCancelPicking]
|
|
9087
9150
|
);
|
|
9088
|
-
const handleSearchPick = (0,
|
|
9151
|
+
const handleSearchPick = (0, import_react13.useCallback)(
|
|
9089
9152
|
(pickedTaskId) => {
|
|
9090
9153
|
if (!activeLinkType) return;
|
|
9091
9154
|
if (dependencyPickMode === "predecessor") {
|
|
@@ -9096,7 +9159,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
9096
9159
|
},
|
|
9097
9160
|
[activeLinkType, dependencyPickMode, onAddDependency, task.id]
|
|
9098
9161
|
);
|
|
9099
|
-
const handleSearchRemove = (0,
|
|
9162
|
+
const handleSearchRemove = (0, import_react13.useCallback)(
|
|
9100
9163
|
(pickedTaskId) => {
|
|
9101
9164
|
const matchingTypes = dependencyPickMode === "predecessor" ? (task.dependencies ?? []).filter((dep) => dep.taskId === pickedTaskId).map((dep) => dep.type) : (allTasks.find((candidate) => candidate.id === pickedTaskId)?.dependencies ?? []).filter((dep) => dep.taskId === task.id).map((dep) => dep.type);
|
|
9102
9165
|
for (const linkType of matchingTypes) {
|
|
@@ -9305,7 +9368,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
9305
9368
|
isChild && !editingName && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
9306
9369
|
!isFilterHideMode && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
9307
9370
|
ancestorLineModes.map(
|
|
9308
|
-
(mode, idx) => mode ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
9371
|
+
(mode, idx) => mode ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react13.default.Fragment, { children: [
|
|
9309
9372
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
9310
9373
|
"span",
|
|
9311
9374
|
{
|
|
@@ -9765,10 +9828,10 @@ var TaskListRow = import_react12.default.memo(
|
|
|
9765
9828
|
{
|
|
9766
9829
|
className: "gantt-tl-progress-display",
|
|
9767
9830
|
style: editingProgress ? { visibility: "hidden", pointerEvents: "none" } : task.progress === 100 ? {
|
|
9768
|
-
backgroundColor: "#17c864",
|
|
9831
|
+
backgroundColor: "var(--gantt-success-solid-background, #17c864)",
|
|
9769
9832
|
borderRadius: "4px",
|
|
9770
9833
|
padding: "2px 4px",
|
|
9771
|
-
color: "#ffffff"
|
|
9834
|
+
color: "var(--gantt-solid-foreground, #ffffff)"
|
|
9772
9835
|
} : void 0,
|
|
9773
9836
|
children: task.progress ? Math.round(task.progress) === 100 ? "100" : `${Math.round(task.progress)}%` : "-"
|
|
9774
9837
|
}
|
|
@@ -9898,7 +9961,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
9898
9961
|
progress: progressCell,
|
|
9899
9962
|
dependencies: dependenciesCell
|
|
9900
9963
|
};
|
|
9901
|
-
const focusCustomCell = (0,
|
|
9964
|
+
const focusCustomCell = (0, import_react13.useCallback)((taskId, columnId) => {
|
|
9902
9965
|
const overlay = rowRef.current?.closest(".gantt-tl-overlay");
|
|
9903
9966
|
if (!overlay) {
|
|
9904
9967
|
return;
|
|
@@ -9907,7 +9970,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
9907
9970
|
const nextCell = overlay.querySelector(selector);
|
|
9908
9971
|
nextCell?.focus();
|
|
9909
9972
|
}, []);
|
|
9910
|
-
const moveActiveCustomCell = (0,
|
|
9973
|
+
const moveActiveCustomCell = (0, import_react13.useCallback)((columnId, direction) => {
|
|
9911
9974
|
const overlay = rowRef.current?.closest(".gantt-tl-overlay");
|
|
9912
9975
|
if (!overlay || !resolvedColumns) {
|
|
9913
9976
|
return;
|
|
@@ -9982,7 +10045,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
9982
10045
|
tabIndex: isSelected ? 0 : -1,
|
|
9983
10046
|
children: resolvedColumns?.map((col) => {
|
|
9984
10047
|
const builtIn = builtInCells[col.id];
|
|
9985
|
-
if (builtIn) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
10048
|
+
if (builtIn) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react13.default.Fragment, { children: builtIn }, col.id);
|
|
9986
10049
|
const isEditing = editingColumnId === col.id;
|
|
9987
10050
|
const editorFn = col.renderEditor;
|
|
9988
10051
|
const isActiveCustomCell = activeCustomCell?.taskId === task.id && activeCustomCell?.columnId === col.id;
|
|
@@ -10111,7 +10174,7 @@ var TaskListRow = import_react12.default.memo(
|
|
|
10111
10174
|
TaskListRow.displayName = "TaskListRow";
|
|
10112
10175
|
|
|
10113
10176
|
// src/components/TaskList/NewTaskRow.tsx
|
|
10114
|
-
var
|
|
10177
|
+
var import_react14 = require("react");
|
|
10115
10178
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
10116
10179
|
var NewTaskRow = ({
|
|
10117
10180
|
rowHeight,
|
|
@@ -10119,12 +10182,12 @@ var NewTaskRow = ({
|
|
|
10119
10182
|
onCancel,
|
|
10120
10183
|
nestingDepth = 0
|
|
10121
10184
|
}) => {
|
|
10122
|
-
const [nameValue, setNameValue] = (0,
|
|
10123
|
-
const inputRef = (0,
|
|
10124
|
-
const confirmedRef = (0,
|
|
10185
|
+
const [nameValue, setNameValue] = (0, import_react14.useState)("");
|
|
10186
|
+
const inputRef = (0, import_react14.useRef)(null);
|
|
10187
|
+
const confirmedRef = (0, import_react14.useRef)(false);
|
|
10125
10188
|
const inputInnerPadding = 4;
|
|
10126
10189
|
const levelOffset = nestingDepth > 0 ? nestingDepth * 20 + 8 : 0;
|
|
10127
|
-
(0,
|
|
10190
|
+
(0, import_react14.useEffect)(() => {
|
|
10128
10191
|
if (inputRef.current) {
|
|
10129
10192
|
inputRef.current.focus();
|
|
10130
10193
|
inputRef.current.select();
|
|
@@ -10177,7 +10240,7 @@ var NewTaskRow = ({
|
|
|
10177
10240
|
};
|
|
10178
10241
|
|
|
10179
10242
|
// src/components/GenerationSkeleton/GenerationSkeleton.tsx
|
|
10180
|
-
var
|
|
10243
|
+
var import_react15 = require("react");
|
|
10181
10244
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
10182
10245
|
var MAX_SKELETON_ROWS = 200;
|
|
10183
10246
|
var SHIMMER_DURATION_MS = 1450;
|
|
@@ -10202,8 +10265,8 @@ var GenerationSkeletonRows = ({
|
|
|
10202
10265
|
chartStartJitterDays = 0
|
|
10203
10266
|
}) => {
|
|
10204
10267
|
const safeCount = clampCount(count);
|
|
10205
|
-
const previousCountRef = (0,
|
|
10206
|
-
const shimmerDelayRef = (0,
|
|
10268
|
+
const previousCountRef = (0, import_react15.useRef)(null);
|
|
10269
|
+
const shimmerDelayRef = (0, import_react15.useRef)("0ms");
|
|
10207
10270
|
if (previousCountRef.current !== safeCount) {
|
|
10208
10271
|
previousCountRef.current = safeCount;
|
|
10209
10272
|
shimmerDelayRef.current = `-${Date.now() % SHIMMER_DURATION_MS}ms`;
|
|
@@ -10474,8 +10537,8 @@ var SelectAllCheckbox = ({
|
|
|
10474
10537
|
indeterminate,
|
|
10475
10538
|
onChange
|
|
10476
10539
|
}) => {
|
|
10477
|
-
const ref = (0,
|
|
10478
|
-
(0,
|
|
10540
|
+
const ref = (0, import_react16.useRef)(null);
|
|
10541
|
+
(0, import_react16.useEffect)(() => {
|
|
10479
10542
|
if (ref.current) {
|
|
10480
10543
|
ref.current.indeterminate = indeterminate;
|
|
10481
10544
|
}
|
|
@@ -10559,14 +10622,14 @@ var TaskList = ({
|
|
|
10559
10622
|
skeletonRowCount = 0
|
|
10560
10623
|
}) => {
|
|
10561
10624
|
const reorderDisabled = disableTaskListReorder || disableTaskDrag;
|
|
10562
|
-
const [internalSelectedTaskIds, setInternalSelectedTaskIds] = (0,
|
|
10563
|
-
const [activeCustomCell, setActiveCustomCell] = (0,
|
|
10564
|
-
const [columnWidthOverrides, setColumnWidthOverrides] = (0,
|
|
10565
|
-
const [isColumnResizeMode, setIsColumnResizeMode] = (0,
|
|
10566
|
-
const columnResizeHeaderRef = (0,
|
|
10567
|
-
const resizeStateRef = (0,
|
|
10625
|
+
const [internalSelectedTaskIds, setInternalSelectedTaskIds] = (0, import_react16.useState)(/* @__PURE__ */ new Set());
|
|
10626
|
+
const [activeCustomCell, setActiveCustomCell] = (0, import_react16.useState)(null);
|
|
10627
|
+
const [columnWidthOverrides, setColumnWidthOverrides] = (0, import_react16.useState)(() => normalizeColumnWidthMap(taskListColumnWidths));
|
|
10628
|
+
const [isColumnResizeMode, setIsColumnResizeMode] = (0, import_react16.useState)(false);
|
|
10629
|
+
const columnResizeHeaderRef = (0, import_react16.useRef)(null);
|
|
10630
|
+
const resizeStateRef = (0, import_react16.useRef)(null);
|
|
10568
10631
|
const effectiveSelectedTaskIds = selectedTaskIds ?? internalSelectedTaskIds;
|
|
10569
|
-
(0,
|
|
10632
|
+
(0, import_react16.useEffect)(() => {
|
|
10570
10633
|
if (!isColumnResizeMode) {
|
|
10571
10634
|
return;
|
|
10572
10635
|
}
|
|
@@ -10582,15 +10645,15 @@ var TaskList = ({
|
|
|
10582
10645
|
document.removeEventListener("pointerdown", handleOutsidePointerDown);
|
|
10583
10646
|
};
|
|
10584
10647
|
}, [isColumnResizeMode]);
|
|
10585
|
-
const emitSelectedTaskIdsChange = (0,
|
|
10648
|
+
const emitSelectedTaskIdsChange = (0, import_react16.useCallback)((nextSelectedTaskIds) => {
|
|
10586
10649
|
if (!selectedTaskIds) {
|
|
10587
10650
|
setInternalSelectedTaskIds(nextSelectedTaskIds);
|
|
10588
10651
|
}
|
|
10589
10652
|
onSelectedTaskIdsChange?.(nextSelectedTaskIds);
|
|
10590
10653
|
}, [onSelectedTaskIdsChange, selectedTaskIds]);
|
|
10591
|
-
const [internalCollapsedParentIds, setInternalCollapsedParentIds] = (0,
|
|
10654
|
+
const [internalCollapsedParentIds, setInternalCollapsedParentIds] = (0, import_react16.useState)(/* @__PURE__ */ new Set());
|
|
10592
10655
|
const collapsedParentIds = externalCollapsedParentIds ?? internalCollapsedParentIds;
|
|
10593
|
-
const handleToggleCollapse = externalOnToggleCollapse ?? (0,
|
|
10656
|
+
const handleToggleCollapse = externalOnToggleCollapse ?? (0, import_react16.useCallback)((parentId) => {
|
|
10594
10657
|
setInternalCollapsedParentIds((prev) => {
|
|
10595
10658
|
const next = new Set(prev);
|
|
10596
10659
|
if (next.has(parentId)) {
|
|
@@ -10601,14 +10664,14 @@ var TaskList = ({
|
|
|
10601
10664
|
return next;
|
|
10602
10665
|
});
|
|
10603
10666
|
}, []);
|
|
10604
|
-
const weekendPredicate = (0,
|
|
10667
|
+
const weekendPredicate = (0, import_react16.useMemo)(
|
|
10605
10668
|
() => createCustomDayPredicate({ customDays, isWeekend: isWeekend3 }),
|
|
10606
10669
|
[customDays, isWeekend3]
|
|
10607
10670
|
);
|
|
10608
|
-
const orderedTasks = (0,
|
|
10671
|
+
const orderedTasks = (0, import_react16.useMemo)(() => {
|
|
10609
10672
|
return normalizeHierarchyTasks(tasks, businessDays, weekendPredicate);
|
|
10610
10673
|
}, [tasks, businessDays, weekendPredicate]);
|
|
10611
|
-
const visibleTasks = (0,
|
|
10674
|
+
const visibleTasks = (0, import_react16.useMemo)(() => {
|
|
10612
10675
|
const parentMap = new Map(orderedTasks.map((t) => [t.id, t.parentId]));
|
|
10613
10676
|
function isAnyAncestorCollapsed(parentId) {
|
|
10614
10677
|
let current = parentId;
|
|
@@ -10627,41 +10690,41 @@ var TaskList = ({
|
|
|
10627
10690
|
}
|
|
10628
10691
|
return tasks2;
|
|
10629
10692
|
}, [orderedTasks, collapsedParentIds, filterMode, filteredTaskIds, isFilterActive, criticalPathMode, criticalTaskIds]);
|
|
10630
|
-
const totalHeight = (0,
|
|
10693
|
+
const totalHeight = (0, import_react16.useMemo)(
|
|
10631
10694
|
() => (rowTops && rowHeights && visibleTasks.length > 0 ? rowTops[visibleTasks.length - 1] + rowHeights[visibleTasks.length - 1] : visibleTasks.length * rowHeight) + Math.max(0, Math.floor(skeletonRowCount)) * rowHeight,
|
|
10632
10695
|
[rowHeight, rowTops, rowHeights, skeletonRowCount, visibleTasks.length]
|
|
10633
10696
|
);
|
|
10634
|
-
const visibleTaskNumberMap = (0,
|
|
10697
|
+
const visibleTaskNumberMap = (0, import_react16.useMemo)(
|
|
10635
10698
|
() => Object.fromEntries(buildTaskNumberMap(visibleTasks)),
|
|
10636
10699
|
[visibleTasks]
|
|
10637
10700
|
);
|
|
10638
|
-
const visibleTaskIds = (0,
|
|
10639
|
-
const compositeParentIds = (0,
|
|
10701
|
+
const visibleTaskIds = (0, import_react16.useMemo)(() => visibleTasks.map((task) => task.id), [visibleTasks]);
|
|
10702
|
+
const compositeParentIds = (0, import_react16.useMemo)(
|
|
10640
10703
|
() => new Set(tasks.filter((task) => task.composite).map((task) => task.id)),
|
|
10641
10704
|
[tasks]
|
|
10642
10705
|
);
|
|
10643
|
-
const compositeParentsById = (0,
|
|
10706
|
+
const compositeParentsById = (0, import_react16.useMemo)(
|
|
10644
10707
|
() => new Map(tasks.filter((task) => task.composite).map((task) => [task.id, task])),
|
|
10645
10708
|
[tasks]
|
|
10646
10709
|
);
|
|
10647
|
-
const renderedVisibleRowIndices = (0,
|
|
10710
|
+
const renderedVisibleRowIndices = (0, import_react16.useMemo)(
|
|
10648
10711
|
() => visibleRowIndices ?? visibleTasks.map((_, index) => index),
|
|
10649
10712
|
[visibleRowIndices, visibleTasks]
|
|
10650
10713
|
);
|
|
10651
|
-
const renderedVisibleTasks = (0,
|
|
10714
|
+
const renderedVisibleTasks = (0, import_react16.useMemo)(
|
|
10652
10715
|
() => renderedVisibleRowIndices.map((index) => {
|
|
10653
10716
|
const task = visibleTasks[index];
|
|
10654
10717
|
return task ? { index, task } : null;
|
|
10655
10718
|
}).filter((entry) => entry !== null),
|
|
10656
10719
|
[renderedVisibleRowIndices, visibleTasks]
|
|
10657
10720
|
);
|
|
10658
|
-
const selectedVisibleTaskCount = (0,
|
|
10721
|
+
const selectedVisibleTaskCount = (0, import_react16.useMemo)(
|
|
10659
10722
|
() => visibleTaskIds.filter((taskId) => effectiveSelectedTaskIds.has(taskId)).length,
|
|
10660
10723
|
[effectiveSelectedTaskIds, visibleTaskIds]
|
|
10661
10724
|
);
|
|
10662
10725
|
const areAllVisibleTasksSelected = visibleTaskIds.length > 0 && selectedVisibleTaskCount === visibleTaskIds.length;
|
|
10663
10726
|
const areSomeVisibleTasksSelected = selectedVisibleTaskCount > 0 && !areAllVisibleTasksSelected;
|
|
10664
|
-
const handleToggleTaskSelection = (0,
|
|
10727
|
+
const handleToggleTaskSelection = (0, import_react16.useCallback)((taskId, checked) => {
|
|
10665
10728
|
const nextSelectedTaskIds = new Set(effectiveSelectedTaskIds);
|
|
10666
10729
|
if (checked) {
|
|
10667
10730
|
nextSelectedTaskIds.add(taskId);
|
|
@@ -10670,7 +10733,7 @@ var TaskList = ({
|
|
|
10670
10733
|
}
|
|
10671
10734
|
emitSelectedTaskIdsChange(nextSelectedTaskIds);
|
|
10672
10735
|
}, [effectiveSelectedTaskIds, emitSelectedTaskIdsChange]);
|
|
10673
|
-
const handleToggleAllVisibleTaskSelection = (0,
|
|
10736
|
+
const handleToggleAllVisibleTaskSelection = (0, import_react16.useCallback)((checked) => {
|
|
10674
10737
|
const nextSelectedTaskIds = new Set(effectiveSelectedTaskIds);
|
|
10675
10738
|
for (const taskId of visibleTaskIds) {
|
|
10676
10739
|
if (checked) {
|
|
@@ -10681,11 +10744,11 @@ var TaskList = ({
|
|
|
10681
10744
|
}
|
|
10682
10745
|
emitSelectedTaskIdsChange(nextSelectedTaskIds);
|
|
10683
10746
|
}, [effectiveSelectedTaskIds, emitSelectedTaskIdsChange, visibleTaskIds]);
|
|
10684
|
-
const originalTaskNumberMap = (0,
|
|
10747
|
+
const originalTaskNumberMap = (0, import_react16.useMemo)(
|
|
10685
10748
|
() => Object.fromEntries(buildTaskNumberMap(orderedTasks)),
|
|
10686
10749
|
[orderedTasks]
|
|
10687
10750
|
);
|
|
10688
|
-
const nestingDepthMap = (0,
|
|
10751
|
+
const nestingDepthMap = (0, import_react16.useMemo)(() => {
|
|
10689
10752
|
const depthMap = /* @__PURE__ */ new Map();
|
|
10690
10753
|
const taskById = new Map(tasks.map((t) => [t.id, t]));
|
|
10691
10754
|
function getDepth(taskId) {
|
|
@@ -10704,7 +10767,7 @@ var TaskList = ({
|
|
|
10704
10767
|
}
|
|
10705
10768
|
return depthMap;
|
|
10706
10769
|
}, [tasks]);
|
|
10707
|
-
const lastChildIds = (0,
|
|
10770
|
+
const lastChildIds = (0, import_react16.useMemo)(() => {
|
|
10708
10771
|
const last = /* @__PURE__ */ new Set();
|
|
10709
10772
|
const seenParents = /* @__PURE__ */ new Set();
|
|
10710
10773
|
for (let i = visibleTasks.length - 1; i >= 0; i--) {
|
|
@@ -10716,14 +10779,14 @@ var TaskList = ({
|
|
|
10716
10779
|
}
|
|
10717
10780
|
return last;
|
|
10718
10781
|
}, [visibleTasks]);
|
|
10719
|
-
const visibleParentIds = (0,
|
|
10782
|
+
const visibleParentIds = (0, import_react16.useMemo)(() => {
|
|
10720
10783
|
const parentIds = /* @__PURE__ */ new Set();
|
|
10721
10784
|
for (const task of visibleTasks) {
|
|
10722
10785
|
if (task.parentId) parentIds.add(task.parentId);
|
|
10723
10786
|
}
|
|
10724
10787
|
return parentIds;
|
|
10725
10788
|
}, [visibleTasks]);
|
|
10726
|
-
const ancestorLineModesMap = (0,
|
|
10789
|
+
const ancestorLineModesMap = (0, import_react16.useMemo)(() => {
|
|
10727
10790
|
const taskById = new Map(tasks.map((t) => [t.id, t]));
|
|
10728
10791
|
const isDescendantOf2 = (taskId, ancestorId) => {
|
|
10729
10792
|
let current = taskById.get(taskId);
|
|
@@ -10751,26 +10814,26 @@ var TaskList = ({
|
|
|
10751
10814
|
}
|
|
10752
10815
|
return map;
|
|
10753
10816
|
}, [tasks, visibleTasks]);
|
|
10754
|
-
const handleRowClick = (0,
|
|
10817
|
+
const handleRowClick = (0, import_react16.useCallback)((taskId) => {
|
|
10755
10818
|
onTaskSelect?.(taskId);
|
|
10756
10819
|
}, [onTaskSelect]);
|
|
10757
|
-
const [activeLinkType, setActiveLinkType] = (0,
|
|
10758
|
-
const [selectingPredecessorFor, setSelectingPredecessorFor] = (0,
|
|
10759
|
-
const [dependencyPickMode, setDependencyPickMode] = (0,
|
|
10760
|
-
const [typeMenuOpen, setTypeMenuOpen] = (0,
|
|
10761
|
-
const [dependencyError, setDependencyError] = (0,
|
|
10762
|
-
const overlayRef = (0,
|
|
10763
|
-
const [selectedChip, setSelectedChip] = (0,
|
|
10764
|
-
(0,
|
|
10820
|
+
const [activeLinkType, setActiveLinkType] = (0, import_react16.useState)("FS");
|
|
10821
|
+
const [selectingPredecessorFor, setSelectingPredecessorFor] = (0, import_react16.useState)(null);
|
|
10822
|
+
const [dependencyPickMode, setDependencyPickMode] = (0, import_react16.useState)("successor");
|
|
10823
|
+
const [typeMenuOpen, setTypeMenuOpen] = (0, import_react16.useState)(false);
|
|
10824
|
+
const [dependencyError, setDependencyError] = (0, import_react16.useState)(null);
|
|
10825
|
+
const overlayRef = (0, import_react16.useRef)(null);
|
|
10826
|
+
const [selectedChip, setSelectedChip] = (0, import_react16.useState)(controlledSelectedChip ? { ...controlledSelectedChip, linkType: controlledSelectedChip.linkType } : null);
|
|
10827
|
+
(0, import_react16.useEffect)(() => {
|
|
10765
10828
|
if (controlledSelectedChip !== void 0) {
|
|
10766
10829
|
setSelectedChip(controlledSelectedChip ? { ...controlledSelectedChip, linkType: controlledSelectedChip.linkType } : null);
|
|
10767
10830
|
}
|
|
10768
10831
|
}, [controlledSelectedChip]);
|
|
10769
|
-
const handleChipSelect = (0,
|
|
10832
|
+
const handleChipSelect = (0, import_react16.useCallback)((chip) => {
|
|
10770
10833
|
setSelectedChip(chip);
|
|
10771
10834
|
onSelectedChipChange?.(chip);
|
|
10772
10835
|
}, [onSelectedChipChange]);
|
|
10773
|
-
(0,
|
|
10836
|
+
(0, import_react16.useEffect)(() => {
|
|
10774
10837
|
if (!selectingPredecessorFor && !selectedChip && !selectedTaskId && !activeCustomCell) return;
|
|
10775
10838
|
const pendingCanvasMouseDownRef = {
|
|
10776
10839
|
container: null,
|
|
@@ -10865,7 +10928,7 @@ var TaskList = ({
|
|
|
10865
10928
|
document.removeEventListener("mouseup", handleCanvasMouseUp, true);
|
|
10866
10929
|
};
|
|
10867
10930
|
}, [selectingPredecessorFor, selectedChip, selectedTaskId, activeCustomCell, onTaskSelect, onSelectedChipChange]);
|
|
10868
|
-
const handleAddDependency = (0,
|
|
10931
|
+
const handleAddDependency = (0, import_react16.useCallback)((successorTaskId, predecessorTaskId, linkType) => {
|
|
10869
10932
|
if (successorTaskId === predecessorTaskId) return;
|
|
10870
10933
|
if (areTasksHierarchicallyRelated(successorTaskId, predecessorTaskId, tasks)) {
|
|
10871
10934
|
setDependencyError("\u0421\u0432\u044F\u0437\u0438 \u043C\u0435\u0436\u0434\u0443 \u0440\u043E\u0434\u0438\u0442\u0435\u043B\u0435\u043C \u0438 \u043F\u043E\u0442\u043E\u043C\u043A\u043E\u043C \u0437\u0430\u043F\u0440\u0435\u0449\u0435\u043D\u044B");
|
|
@@ -10944,7 +11007,7 @@ var TaskList = ({
|
|
|
10944
11007
|
}
|
|
10945
11008
|
setSelectingPredecessorFor(null);
|
|
10946
11009
|
}, [tasks, onTasksChange]);
|
|
10947
|
-
const handleRemoveDependency = (0,
|
|
11010
|
+
const handleRemoveDependency = (0, import_react16.useCallback)((taskId, predecessorTaskId, linkType) => {
|
|
10948
11011
|
const task = tasks.find((t) => t.id === taskId);
|
|
10949
11012
|
if (!task) return;
|
|
10950
11013
|
const updatedDeps = (task.dependencies ?? []).filter(
|
|
@@ -10952,21 +11015,21 @@ var TaskList = ({
|
|
|
10952
11015
|
);
|
|
10953
11016
|
onTasksChange?.([{ ...task, dependencies: updatedDeps }]);
|
|
10954
11017
|
}, [tasks, onTasksChange]);
|
|
10955
|
-
const [isCreating, setIsCreating] = (0,
|
|
10956
|
-
const [pendingInsert, setPendingInsert] = (0,
|
|
10957
|
-
const [draggingIndex, setDraggingIndex] = (0,
|
|
10958
|
-
const [dragOverTarget, setDragOverTarget] = (0,
|
|
10959
|
-
const [isBeforeFirstDropZoneActive, setIsBeforeFirstDropZoneActive] = (0,
|
|
10960
|
-
const dragOriginIndexRef = (0,
|
|
10961
|
-
const dragTaskIdRef = (0,
|
|
10962
|
-
const clearDragState = (0,
|
|
11018
|
+
const [isCreating, setIsCreating] = (0, import_react16.useState)(false);
|
|
11019
|
+
const [pendingInsert, setPendingInsert] = (0, import_react16.useState)(null);
|
|
11020
|
+
const [draggingIndex, setDraggingIndex] = (0, import_react16.useState)(null);
|
|
11021
|
+
const [dragOverTarget, setDragOverTarget] = (0, import_react16.useState)(null);
|
|
11022
|
+
const [isBeforeFirstDropZoneActive, setIsBeforeFirstDropZoneActive] = (0, import_react16.useState)(false);
|
|
11023
|
+
const dragOriginIndexRef = (0, import_react16.useRef)(null);
|
|
11024
|
+
const dragTaskIdRef = (0, import_react16.useRef)(null);
|
|
11025
|
+
const clearDragState = (0, import_react16.useCallback)(() => {
|
|
10963
11026
|
setDraggingIndex(null);
|
|
10964
11027
|
setDragOverTarget(null);
|
|
10965
11028
|
setIsBeforeFirstDropZoneActive(false);
|
|
10966
11029
|
dragOriginIndexRef.current = null;
|
|
10967
11030
|
dragTaskIdRef.current = null;
|
|
10968
11031
|
}, []);
|
|
10969
|
-
const isValidParentDrop = (0,
|
|
11032
|
+
const isValidParentDrop = (0, import_react16.useCallback)((draggedTaskId, dropIndex) => {
|
|
10970
11033
|
if (!isTaskParent(draggedTaskId, tasks)) {
|
|
10971
11034
|
return true;
|
|
10972
11035
|
}
|
|
@@ -10984,13 +11047,13 @@ var TaskList = ({
|
|
|
10984
11047
|
}
|
|
10985
11048
|
return true;
|
|
10986
11049
|
}, [tasks, visibleTasks, orderedTasks]);
|
|
10987
|
-
const handleDragStart = (0,
|
|
11050
|
+
const handleDragStart = (0, import_react16.useCallback)((index, e) => {
|
|
10988
11051
|
e.dataTransfer.effectAllowed = "move";
|
|
10989
11052
|
setDraggingIndex(index);
|
|
10990
11053
|
dragOriginIndexRef.current = index;
|
|
10991
11054
|
dragTaskIdRef.current = visibleTasks[index]?.id ?? null;
|
|
10992
11055
|
}, [visibleTasks]);
|
|
10993
|
-
const normalizeDropTarget = (0,
|
|
11056
|
+
const normalizeDropTarget = (0, import_react16.useCallback)((movedTaskId, target) => {
|
|
10994
11057
|
if (target.placement !== "before" || target.index <= 0 || target.index >= visibleTasks.length) {
|
|
10995
11058
|
return target;
|
|
10996
11059
|
}
|
|
@@ -11013,7 +11076,7 @@ var TaskList = ({
|
|
|
11013
11076
|
}
|
|
11014
11077
|
return target;
|
|
11015
11078
|
}, [orderedTasks, visibleTasks]);
|
|
11016
|
-
const handleDragOver = (0,
|
|
11079
|
+
const handleDragOver = (0, import_react16.useCallback)((index, e, forcedPlacement) => {
|
|
11017
11080
|
e.preventDefault();
|
|
11018
11081
|
const draggedTaskId = dragTaskIdRef.current;
|
|
11019
11082
|
if (!draggedTaskId) return;
|
|
@@ -11065,7 +11128,7 @@ var TaskList = ({
|
|
|
11065
11128
|
isDirectChildDrop: normalizedTarget.placement === "after" && reorderPlan.inferredParentId === targetTask.id
|
|
11066
11129
|
});
|
|
11067
11130
|
}, [isValidParentDrop, normalizeDropTarget, orderedTasks, visibleTasks]);
|
|
11068
|
-
const handleDrop = (0,
|
|
11131
|
+
const handleDrop = (0, import_react16.useCallback)((dropIndex, e, forcedPlacement) => {
|
|
11069
11132
|
e.preventDefault();
|
|
11070
11133
|
const originVisibleIndex = dragOriginIndexRef.current;
|
|
11071
11134
|
const movedTaskId = dragTaskIdRef.current;
|
|
@@ -11132,7 +11195,7 @@ var TaskList = ({
|
|
|
11132
11195
|
onTaskSelect?.(moved.id);
|
|
11133
11196
|
clearDragState();
|
|
11134
11197
|
}, [orderedTasks, visibleTasks, onReorder, onTaskSelect, isValidParentDrop, clearDragState, normalizeDropTarget]);
|
|
11135
|
-
const handleBeforeFirstDragOver = (0,
|
|
11198
|
+
const handleBeforeFirstDragOver = (0, import_react16.useCallback)((e) => {
|
|
11136
11199
|
const draggedTaskId = dragTaskIdRef.current;
|
|
11137
11200
|
const firstTask = visibleTasks[0];
|
|
11138
11201
|
const descendantIds = draggedTaskId ? new Set(getAllDescendants3(draggedTaskId, orderedTasks).map((task) => task.id)) : /* @__PURE__ */ new Set();
|
|
@@ -11140,11 +11203,11 @@ var TaskList = ({
|
|
|
11140
11203
|
setIsBeforeFirstDropZoneActive(isValidBeforeFirstDrop);
|
|
11141
11204
|
handleDragOver(0, e, "before");
|
|
11142
11205
|
}, [handleDragOver, isValidParentDrop, orderedTasks, visibleTasks]);
|
|
11143
|
-
const handleDragEnd = (0,
|
|
11206
|
+
const handleDragEnd = (0, import_react16.useCallback)(() => {
|
|
11144
11207
|
clearDragState();
|
|
11145
11208
|
}, [clearDragState]);
|
|
11146
11209
|
const shouldShowBeforeFirstDropZone = !reorderDisabled && visibleTasks.length > 0 && draggingIndex !== null && draggingIndex > 0;
|
|
11147
|
-
const handleConfirmNewTask = (0,
|
|
11210
|
+
const handleConfirmNewTask = (0, import_react16.useCallback)((name) => {
|
|
11148
11211
|
const range = buildDefaultTaskDateRange(getTodayISODate(), {
|
|
11149
11212
|
businessDays,
|
|
11150
11213
|
defaultTaskDurationDays,
|
|
@@ -11159,8 +11222,8 @@ var TaskList = ({
|
|
|
11159
11222
|
onAdd?.(newTask);
|
|
11160
11223
|
setIsCreating(false);
|
|
11161
11224
|
}, [businessDays, defaultTaskDurationDays, onAdd, weekendPredicate]);
|
|
11162
|
-
const handleCancelNewTask = (0,
|
|
11163
|
-
const findInsertAfterTaskId = (0,
|
|
11225
|
+
const handleCancelNewTask = (0, import_react16.useCallback)(() => setIsCreating(false), []);
|
|
11226
|
+
const findInsertAfterTaskId = (0, import_react16.useCallback)((anchorTaskId) => {
|
|
11164
11227
|
const anchorIndex = orderedTasks.findIndex((task) => task.id === anchorTaskId);
|
|
11165
11228
|
if (anchorIndex === -1) {
|
|
11166
11229
|
return anchorTaskId;
|
|
@@ -11184,7 +11247,7 @@ var TaskList = ({
|
|
|
11184
11247
|
}
|
|
11185
11248
|
return insertAfterTaskId;
|
|
11186
11249
|
}, [orderedTasks]);
|
|
11187
|
-
const pendingInsertDisplayTaskId = (0,
|
|
11250
|
+
const pendingInsertDisplayTaskId = (0, import_react16.useMemo)(() => {
|
|
11188
11251
|
if (!pendingInsert) {
|
|
11189
11252
|
return null;
|
|
11190
11253
|
}
|
|
@@ -11205,12 +11268,12 @@ var TaskList = ({
|
|
|
11205
11268
|
}
|
|
11206
11269
|
return displayTaskId;
|
|
11207
11270
|
}, [pendingInsert, visibleTasks]);
|
|
11208
|
-
const pendingInsertRowIndex = (0,
|
|
11271
|
+
const pendingInsertRowIndex = (0, import_react16.useMemo)(
|
|
11209
11272
|
() => pendingInsertDisplayTaskId ? visibleTasks.findIndex((task) => task.id === pendingInsertDisplayTaskId) : -1,
|
|
11210
11273
|
[pendingInsertDisplayTaskId, visibleTasks]
|
|
11211
11274
|
);
|
|
11212
11275
|
const hasVisiblePendingInsert = pendingInsertRowIndex >= 0;
|
|
11213
|
-
const handleStartInsertAfter = (0,
|
|
11276
|
+
const handleStartInsertAfter = (0, import_react16.useCallback)((taskId, newTask) => {
|
|
11214
11277
|
const anchorTask = orderedTasks.find((task) => task.id === taskId);
|
|
11215
11278
|
if (!anchorTask) {
|
|
11216
11279
|
return;
|
|
@@ -11225,7 +11288,7 @@ var TaskList = ({
|
|
|
11225
11288
|
nestingDepth: nestingDepthMap.get(taskId) ?? 0
|
|
11226
11289
|
});
|
|
11227
11290
|
}, [findInsertAfterTaskId, nestingDepthMap, orderedTasks]);
|
|
11228
|
-
const handleConfirmInsertedTask = (0,
|
|
11291
|
+
const handleConfirmInsertedTask = (0, import_react16.useCallback)((name) => {
|
|
11229
11292
|
if (!pendingInsert) {
|
|
11230
11293
|
return;
|
|
11231
11294
|
}
|
|
@@ -11239,7 +11302,7 @@ var TaskList = ({
|
|
|
11239
11302
|
onInsertAfter?.(pendingInsert.insertAfterTaskId, newTask);
|
|
11240
11303
|
setPendingInsert(null);
|
|
11241
11304
|
}, [onInsertAfter, pendingInsert]);
|
|
11242
|
-
const handleCancelInsertedTask = (0,
|
|
11305
|
+
const handleCancelInsertedTask = (0, import_react16.useCallback)(() => setPendingInsert(null), []);
|
|
11243
11306
|
function getTaskDepth(task, tasks2) {
|
|
11244
11307
|
if (!task) return 0;
|
|
11245
11308
|
let depth = 0;
|
|
@@ -11252,7 +11315,7 @@ var TaskList = ({
|
|
|
11252
11315
|
}
|
|
11253
11316
|
return depth;
|
|
11254
11317
|
}
|
|
11255
|
-
const handleDemoteWrapper = (0,
|
|
11318
|
+
const handleDemoteWrapper = (0, import_react16.useCallback)((taskId, _newParentId) => {
|
|
11256
11319
|
const taskIndex = visibleTasks.findIndex((t) => t.id === taskId);
|
|
11257
11320
|
const currentTask = visibleTasks[taskIndex];
|
|
11258
11321
|
const currentDepth = getTaskDepth(currentTask, orderedTasks);
|
|
@@ -11286,18 +11349,18 @@ var TaskList = ({
|
|
|
11286
11349
|
];
|
|
11287
11350
|
onReorder?.(updatedTasks, taskId, newSectionTask.id);
|
|
11288
11351
|
}, [visibleTasks, orderedTasks, onDemoteTask, onReorder]);
|
|
11289
|
-
const handleDuplicateTask = (0,
|
|
11352
|
+
const handleDuplicateTask = (0, import_react16.useCallback)((taskId) => {
|
|
11290
11353
|
const duplicatedTasks = duplicateTaskSubtree(taskId, orderedTasks);
|
|
11291
11354
|
onReorder?.(duplicatedTasks);
|
|
11292
11355
|
}, [orderedTasks, onReorder]);
|
|
11293
|
-
const builtInColumns = (0,
|
|
11356
|
+
const builtInColumns = (0, import_react16.useMemo)(
|
|
11294
11357
|
() => createBuiltInColumns({ businessDays, enableTaskMultiSelect }),
|
|
11295
11358
|
[businessDays, enableTaskMultiSelect]
|
|
11296
11359
|
);
|
|
11297
|
-
(0,
|
|
11360
|
+
(0, import_react16.useEffect)(() => {
|
|
11298
11361
|
setColumnWidthOverrides(normalizeColumnWidthMap(taskListColumnWidths));
|
|
11299
11362
|
}, [taskListColumnWidths]);
|
|
11300
|
-
const resolvedColumns = (0,
|
|
11363
|
+
const resolvedColumns = (0, import_react16.useMemo)(
|
|
11301
11364
|
() => resolveTaskListColumns(
|
|
11302
11365
|
builtInColumns,
|
|
11303
11366
|
additionalColumns ?? [],
|
|
@@ -11313,11 +11376,11 @@ var TaskList = ({
|
|
|
11313
11376
|
}),
|
|
11314
11377
|
[builtInColumns, additionalColumns, hiddenTaskListColumns, columnWidthOverrides]
|
|
11315
11378
|
);
|
|
11316
|
-
const resolvedColumnWidthTotal = (0,
|
|
11379
|
+
const resolvedColumnWidthTotal = (0, import_react16.useMemo)(
|
|
11317
11380
|
() => resolvedColumns.reduce((sum, col) => sum + (col.width ?? 120), 0),
|
|
11318
11381
|
[resolvedColumns]
|
|
11319
11382
|
);
|
|
11320
|
-
const generationSkeletonTaskListLayout = (0,
|
|
11383
|
+
const generationSkeletonTaskListLayout = (0, import_react16.useMemo)(() => {
|
|
11321
11384
|
let left = 0;
|
|
11322
11385
|
const layout = {
|
|
11323
11386
|
nameLeft: 40,
|
|
@@ -11336,7 +11399,7 @@ var TaskList = ({
|
|
|
11336
11399
|
const requestedTaskListWidth = taskListWidth ?? Math.min(MIN_TASK_LIST_WIDTH, resolvedColumnWidthTotal);
|
|
11337
11400
|
const effectiveTaskListWidth = Math.max(requestedTaskListWidth, resolvedColumnWidthTotal);
|
|
11338
11401
|
const tableHeaderHeight = headerHeight + 1;
|
|
11339
|
-
const updateColumnWidth = (0,
|
|
11402
|
+
const updateColumnWidth = (0, import_react16.useCallback)((columnId, width) => {
|
|
11340
11403
|
setColumnWidthOverrides((prev) => {
|
|
11341
11404
|
if (prev[columnId] === width) {
|
|
11342
11405
|
return prev;
|
|
@@ -11346,7 +11409,7 @@ var TaskList = ({
|
|
|
11346
11409
|
return next;
|
|
11347
11410
|
});
|
|
11348
11411
|
}, [onTaskListColumnWidthsChange]);
|
|
11349
|
-
(0,
|
|
11412
|
+
(0, import_react16.useEffect)(() => {
|
|
11350
11413
|
const updateResizedColumn = (clientX) => {
|
|
11351
11414
|
const resizeState = resizeStateRef.current;
|
|
11352
11415
|
if (!resizeState) {
|
|
@@ -11422,7 +11485,7 @@ var TaskList = ({
|
|
|
11422
11485
|
document.body.style.removeProperty("touch-action");
|
|
11423
11486
|
};
|
|
11424
11487
|
}, [resolvedColumns, updateColumnWidth]);
|
|
11425
|
-
const startColumnResize = (0,
|
|
11488
|
+
const startColumnResize = (0, import_react16.useCallback)((columnId, event) => {
|
|
11426
11489
|
if (resizeStateRef.current) {
|
|
11427
11490
|
return;
|
|
11428
11491
|
}
|
|
@@ -11449,7 +11512,7 @@ var TaskList = ({
|
|
|
11449
11512
|
document.body.style.userSelect = "none";
|
|
11450
11513
|
document.body.style.touchAction = "none";
|
|
11451
11514
|
}, [resolvedColumns]);
|
|
11452
|
-
const renderResizeHandle = (0,
|
|
11515
|
+
const renderResizeHandle = (0, import_react16.useCallback)((columnId) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
11453
11516
|
"button",
|
|
11454
11517
|
{
|
|
11455
11518
|
type: "button",
|
|
@@ -11548,7 +11611,7 @@ var TaskList = ({
|
|
|
11548
11611
|
onClick: (e) => e.stopPropagation(),
|
|
11549
11612
|
children: [
|
|
11550
11613
|
"\u0421\u0432\u044F\u0437\u0438 ",
|
|
11551
|
-
|
|
11614
|
+
import_react16.default.createElement(LINK_TYPE_ICONS[activeLinkType]),
|
|
11552
11615
|
" \u25BE"
|
|
11553
11616
|
]
|
|
11554
11617
|
}
|
|
@@ -11562,7 +11625,7 @@ var TaskList = ({
|
|
|
11562
11625
|
setTypeMenuOpen(false);
|
|
11563
11626
|
},
|
|
11564
11627
|
children: [
|
|
11565
|
-
|
|
11628
|
+
import_react16.default.createElement(LINK_TYPE_ICONS[lt]),
|
|
11566
11629
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: LINK_TYPE_LABELS[lt] })
|
|
11567
11630
|
]
|
|
11568
11631
|
},
|
|
@@ -11810,7 +11873,7 @@ var TaskList = ({
|
|
|
11810
11873
|
};
|
|
11811
11874
|
|
|
11812
11875
|
// src/components/ResourceTimelineChart/ResourceTimelineChart.tsx
|
|
11813
|
-
var
|
|
11876
|
+
var import_react18 = __toESM(require("react"));
|
|
11814
11877
|
|
|
11815
11878
|
// src/utils/resourceTimelineLayout.ts
|
|
11816
11879
|
var isInvalidDate = (date) => Number.isNaN(date.getTime());
|
|
@@ -12012,7 +12075,7 @@ var layoutResourceTimelineItems = (resources, options) => {
|
|
|
12012
12075
|
};
|
|
12013
12076
|
|
|
12014
12077
|
// src/hooks/useResourceItemDrag.ts
|
|
12015
|
-
var
|
|
12078
|
+
var import_react17 = require("react");
|
|
12016
12079
|
var RESOURCE_CURSOR_STYLE_ID = "gantt-resource-global-drag-cursor-style";
|
|
12017
12080
|
function ensureResourceGlobalCursorStyle() {
|
|
12018
12081
|
if (typeof document === "undefined") return;
|
|
@@ -12124,30 +12187,30 @@ var useResourceItemDrag = ({
|
|
|
12124
12187
|
weekendPredicate,
|
|
12125
12188
|
onResourceItemMove
|
|
12126
12189
|
}) => {
|
|
12127
|
-
const activeDragRef = (0,
|
|
12128
|
-
const rowsRef = (0,
|
|
12129
|
-
const onResourceItemMoveRef = (0,
|
|
12130
|
-
const rafRef = (0,
|
|
12131
|
-
const [preview, setPreview] = (0,
|
|
12132
|
-
(0,
|
|
12190
|
+
const activeDragRef = (0, import_react17.useRef)(null);
|
|
12191
|
+
const rowsRef = (0, import_react17.useRef)(rows);
|
|
12192
|
+
const onResourceItemMoveRef = (0, import_react17.useRef)(onResourceItemMove);
|
|
12193
|
+
const rafRef = (0, import_react17.useRef)(null);
|
|
12194
|
+
const [preview, setPreview] = (0, import_react17.useState)(null);
|
|
12195
|
+
(0, import_react17.useEffect)(() => {
|
|
12133
12196
|
rowsRef.current = rows;
|
|
12134
12197
|
}, [rows]);
|
|
12135
|
-
(0,
|
|
12198
|
+
(0, import_react17.useEffect)(() => {
|
|
12136
12199
|
onResourceItemMoveRef.current = onResourceItemMove;
|
|
12137
12200
|
}, [onResourceItemMove]);
|
|
12138
|
-
const clearRaf = (0,
|
|
12201
|
+
const clearRaf = (0, import_react17.useCallback)(() => {
|
|
12139
12202
|
if (rafRef.current !== null) {
|
|
12140
12203
|
cancelAnimationFrame(rafRef.current);
|
|
12141
12204
|
rafRef.current = null;
|
|
12142
12205
|
}
|
|
12143
12206
|
}, []);
|
|
12144
|
-
const cancelDrag2 = (0,
|
|
12207
|
+
const cancelDrag2 = (0, import_react17.useCallback)(() => {
|
|
12145
12208
|
clearRaf();
|
|
12146
12209
|
clearResourceGlobalCursor();
|
|
12147
12210
|
activeDragRef.current = null;
|
|
12148
12211
|
setPreview(null);
|
|
12149
12212
|
}, [clearRaf]);
|
|
12150
|
-
(0,
|
|
12213
|
+
(0, import_react17.useEffect)(() => {
|
|
12151
12214
|
const handleMouseMove = (event) => {
|
|
12152
12215
|
const activeDrag = activeDragRef.current;
|
|
12153
12216
|
if (!activeDrag || rafRef.current !== null) {
|
|
@@ -12220,7 +12283,7 @@ var useResourceItemDrag = ({
|
|
|
12220
12283
|
cancelDrag2();
|
|
12221
12284
|
};
|
|
12222
12285
|
}, [cancelDrag2, clearRaf, disableResourceReassignment, gridElementRef]);
|
|
12223
|
-
const startDrag = (0,
|
|
12286
|
+
const startDrag = (0, import_react17.useCallback)((event, layoutItem) => {
|
|
12224
12287
|
if (readonly || layoutItem.item.locked || event.button !== 0) {
|
|
12225
12288
|
return;
|
|
12226
12289
|
}
|
|
@@ -12480,14 +12543,14 @@ var ResourceHeader = ({
|
|
|
12480
12543
|
onConflictBadgeClick,
|
|
12481
12544
|
columnTemplate
|
|
12482
12545
|
}) => {
|
|
12483
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
12484
|
-
const [typeMenuOpen, setTypeMenuOpen] = (0,
|
|
12485
|
-
const [scopeMenuOpen, setScopeMenuOpen] = (0,
|
|
12486
|
-
const [editingName, setEditingName] = (0,
|
|
12487
|
-
const [nameValue, setNameValue] = (0,
|
|
12488
|
-
const nameInputRef = (0,
|
|
12489
|
-
const nameConfirmedRef = (0,
|
|
12490
|
-
const visibleCommands = (0,
|
|
12546
|
+
const [menuOpen, setMenuOpen] = (0, import_react18.useState)(false);
|
|
12547
|
+
const [typeMenuOpen, setTypeMenuOpen] = (0, import_react18.useState)(false);
|
|
12548
|
+
const [scopeMenuOpen, setScopeMenuOpen] = (0, import_react18.useState)(false);
|
|
12549
|
+
const [editingName, setEditingName] = (0, import_react18.useState)(false);
|
|
12550
|
+
const [nameValue, setNameValue] = (0, import_react18.useState)(resource.name);
|
|
12551
|
+
const nameInputRef = (0, import_react18.useRef)(null);
|
|
12552
|
+
const nameConfirmedRef = (0, import_react18.useRef)(false);
|
|
12553
|
+
const visibleCommands = (0, import_react18.useMemo)(
|
|
12491
12554
|
() => menuCommands.filter((command) => command.isVisible?.(resource) ?? true),
|
|
12492
12555
|
[menuCommands, resource]
|
|
12493
12556
|
);
|
|
@@ -12496,15 +12559,15 @@ var ResourceHeader = ({
|
|
|
12496
12559
|
const scope = resource.scope ?? "Project";
|
|
12497
12560
|
const scopeLabel = RESOURCE_SCOPE_LABELS[scope] ?? scope;
|
|
12498
12561
|
const isInactive = isInactiveResourceStatus(resource.status);
|
|
12499
|
-
const applyResourcePatch = (0,
|
|
12562
|
+
const applyResourcePatch = (0, import_react18.useCallback)((patch) => {
|
|
12500
12563
|
onResourceChange?.({ ...resource, ...patch });
|
|
12501
12564
|
}, [onResourceChange, resource]);
|
|
12502
|
-
(0,
|
|
12565
|
+
(0, import_react18.useEffect)(() => {
|
|
12503
12566
|
if (!editingName) {
|
|
12504
12567
|
setNameValue(resource.name);
|
|
12505
12568
|
}
|
|
12506
12569
|
}, [editingName, resource.name]);
|
|
12507
|
-
(0,
|
|
12570
|
+
(0, import_react18.useEffect)(() => {
|
|
12508
12571
|
if (editingName && nameInputRef.current) {
|
|
12509
12572
|
nameInputRef.current.focus();
|
|
12510
12573
|
nameInputRef.current.select();
|
|
@@ -12517,7 +12580,7 @@ var ResourceHeader = ({
|
|
|
12517
12580
|
}
|
|
12518
12581
|
command.onSelect(resource);
|
|
12519
12582
|
};
|
|
12520
|
-
const handleNameDoubleClick = (0,
|
|
12583
|
+
const handleNameDoubleClick = (0, import_react18.useCallback)((event) => {
|
|
12521
12584
|
if (!onResourceChange) {
|
|
12522
12585
|
return;
|
|
12523
12586
|
}
|
|
@@ -12526,7 +12589,7 @@ var ResourceHeader = ({
|
|
|
12526
12589
|
setNameValue(resource.name);
|
|
12527
12590
|
setEditingName(true);
|
|
12528
12591
|
}, [onResourceChange, resource.name]);
|
|
12529
|
-
const handleNameSave = (0,
|
|
12592
|
+
const handleNameSave = (0, import_react18.useCallback)(() => {
|
|
12530
12593
|
if (nameConfirmedRef.current) {
|
|
12531
12594
|
nameConfirmedRef.current = false;
|
|
12532
12595
|
return;
|
|
@@ -12537,11 +12600,11 @@ var ResourceHeader = ({
|
|
|
12537
12600
|
}
|
|
12538
12601
|
setEditingName(false);
|
|
12539
12602
|
}, [applyResourcePatch, nameValue, resource.name]);
|
|
12540
|
-
const handleNameCancel = (0,
|
|
12603
|
+
const handleNameCancel = (0, import_react18.useCallback)(() => {
|
|
12541
12604
|
setNameValue(resource.name);
|
|
12542
12605
|
setEditingName(false);
|
|
12543
12606
|
}, [resource.name]);
|
|
12544
|
-
const handleNameKeyDown = (0,
|
|
12607
|
+
const handleNameKeyDown = (0, import_react18.useCallback)((event) => {
|
|
12545
12608
|
if (event.key === "Enter") {
|
|
12546
12609
|
nameConfirmedRef.current = true;
|
|
12547
12610
|
const nextName = nameValue.trim();
|
|
@@ -12745,10 +12808,10 @@ var ResourceHeader = ({
|
|
|
12745
12808
|
);
|
|
12746
12809
|
};
|
|
12747
12810
|
var NewResourceRow = ({ height, onConfirm, onCancel, columnTemplate }) => {
|
|
12748
|
-
const [nameValue, setNameValue] = (0,
|
|
12749
|
-
const inputRef = (0,
|
|
12750
|
-
const confirmedRef = (0,
|
|
12751
|
-
(0,
|
|
12811
|
+
const [nameValue, setNameValue] = (0, import_react18.useState)("");
|
|
12812
|
+
const inputRef = (0, import_react18.useRef)(null);
|
|
12813
|
+
const confirmedRef = (0, import_react18.useRef)(false);
|
|
12814
|
+
(0, import_react18.useEffect)(() => {
|
|
12752
12815
|
inputRef.current?.focus();
|
|
12753
12816
|
inputRef.current?.select();
|
|
12754
12817
|
}, []);
|
|
@@ -12833,33 +12896,33 @@ function ResourceTimelineChart({
|
|
|
12833
12896
|
resourceTableColumnWidths,
|
|
12834
12897
|
onResourceTableColumnWidthsChange
|
|
12835
12898
|
}) {
|
|
12836
|
-
const scrollContainerRef = (0,
|
|
12837
|
-
const gridRef = (0,
|
|
12838
|
-
const panStateRef = (0,
|
|
12839
|
-
const resourceColumnResizeRef = (0,
|
|
12840
|
-
const conflictNavigationIndexRef = (0,
|
|
12841
|
-
const resourceNavigationIndexRef = (0,
|
|
12842
|
-
const conflictHighlightTimeoutRef = (0,
|
|
12843
|
-
const [isCreatingResource, setIsCreatingResource] = (0,
|
|
12844
|
-
const [creatingResourceGroupType, setCreatingResourceGroupType] = (0,
|
|
12845
|
-
const [activeConflictItemId, setActiveConflictItemId] = (0,
|
|
12846
|
-
const [resourceColumnHasRightShadow, setResourceColumnHasRightShadow] = (0,
|
|
12847
|
-
const [resourceColumnWidthOverrides, setResourceColumnWidthOverrides] = (0,
|
|
12848
|
-
const validItems = (0,
|
|
12849
|
-
const dateRange = (0,
|
|
12850
|
-
const monthStart = (0,
|
|
12899
|
+
const scrollContainerRef = (0, import_react18.useRef)(null);
|
|
12900
|
+
const gridRef = (0, import_react18.useRef)(null);
|
|
12901
|
+
const panStateRef = (0, import_react18.useRef)(null);
|
|
12902
|
+
const resourceColumnResizeRef = (0, import_react18.useRef)(null);
|
|
12903
|
+
const conflictNavigationIndexRef = (0, import_react18.useRef)(/* @__PURE__ */ new Map());
|
|
12904
|
+
const resourceNavigationIndexRef = (0, import_react18.useRef)(/* @__PURE__ */ new Map());
|
|
12905
|
+
const conflictHighlightTimeoutRef = (0, import_react18.useRef)(null);
|
|
12906
|
+
const [isCreatingResource, setIsCreatingResource] = (0, import_react18.useState)(false);
|
|
12907
|
+
const [creatingResourceGroupType, setCreatingResourceGroupType] = (0, import_react18.useState)(null);
|
|
12908
|
+
const [activeConflictItemId, setActiveConflictItemId] = (0, import_react18.useState)(null);
|
|
12909
|
+
const [resourceColumnHasRightShadow, setResourceColumnHasRightShadow] = (0, import_react18.useState)(false);
|
|
12910
|
+
const [resourceColumnWidthOverrides, setResourceColumnWidthOverrides] = (0, import_react18.useState)(() => normalizeResourceColumnWidthMap(resourceTableColumnWidths));
|
|
12911
|
+
const validItems = (0, import_react18.useMemo)(() => collectValidItems(resources), [resources]);
|
|
12912
|
+
const dateRange = (0, import_react18.useMemo)(() => getMultiMonthDays(validItems), [validItems]);
|
|
12913
|
+
const monthStart = (0, import_react18.useMemo)(() => {
|
|
12851
12914
|
const firstDay = dateRange[0] ?? /* @__PURE__ */ new Date();
|
|
12852
12915
|
return new Date(Date.UTC(firstDay.getUTCFullYear(), firstDay.getUTCMonth(), 1));
|
|
12853
12916
|
}, [dateRange]);
|
|
12854
|
-
const weekendPredicate = (0,
|
|
12917
|
+
const weekendPredicate = (0, import_react18.useMemo)(
|
|
12855
12918
|
() => createCustomDayPredicate({ customDays, isWeekend: isWeekend3 }),
|
|
12856
12919
|
[customDays, isWeekend3]
|
|
12857
12920
|
);
|
|
12858
|
-
const gridWidth = (0,
|
|
12859
|
-
(0,
|
|
12921
|
+
const gridWidth = (0, import_react18.useMemo)(() => Math.round(dateRange.length * dayWidth), [dateRange.length, dayWidth]);
|
|
12922
|
+
(0, import_react18.useEffect)(() => {
|
|
12860
12923
|
setResourceColumnWidthOverrides(normalizeResourceColumnWidthMap(resourceTableColumnWidths));
|
|
12861
12924
|
}, [resourceTableColumnWidths]);
|
|
12862
|
-
const resolvedResourceColumnWidths = (0,
|
|
12925
|
+
const resolvedResourceColumnWidths = (0, import_react18.useMemo)(
|
|
12863
12926
|
() => ({
|
|
12864
12927
|
number: getResourceColumnWidth("number", resourceColumnWidthOverrides),
|
|
12865
12928
|
name: getResourceColumnWidth("name", resourceColumnWidthOverrides),
|
|
@@ -12869,20 +12932,20 @@ function ResourceTimelineChart({
|
|
|
12869
12932
|
}),
|
|
12870
12933
|
[resourceColumnWidthOverrides]
|
|
12871
12934
|
);
|
|
12872
|
-
const resourceColumnTemplate = (0,
|
|
12935
|
+
const resourceColumnTemplate = (0, import_react18.useMemo)(
|
|
12873
12936
|
() => `${resolvedResourceColumnWidths.number}px minmax(${resolvedResourceColumnWidths.name}px, 1fr) ${resolvedResourceColumnWidths.availability}px ${resolvedResourceColumnWidths.assignments}px ${resolvedResourceColumnWidths.actions}px`,
|
|
12874
12937
|
[resolvedResourceColumnWidths]
|
|
12875
12938
|
);
|
|
12876
|
-
const resolvedResourceColumnWidthTotal = (0,
|
|
12939
|
+
const resolvedResourceColumnWidthTotal = (0, import_react18.useMemo)(
|
|
12877
12940
|
() => Object.values(resolvedResourceColumnWidths).reduce((sum, width) => sum + width, 0),
|
|
12878
12941
|
[resolvedResourceColumnWidths]
|
|
12879
12942
|
);
|
|
12880
12943
|
const effectiveRowHeaderWidth = Math.max(rowHeaderWidth, DEFAULT_ROW_HEADER_WIDTH, resolvedResourceColumnWidthTotal);
|
|
12881
|
-
const orderedResources = (0,
|
|
12944
|
+
const orderedResources = (0, import_react18.useMemo)(
|
|
12882
12945
|
() => resourceGrouping === "type" ? orderResourcesByType(resources) : resources,
|
|
12883
12946
|
[resourceGrouping, resources]
|
|
12884
12947
|
);
|
|
12885
|
-
const workedDaysByResourceId = (0,
|
|
12948
|
+
const workedDaysByResourceId = (0, import_react18.useMemo)(() => {
|
|
12886
12949
|
const map = /* @__PURE__ */ new Map();
|
|
12887
12950
|
for (const resource of resources) {
|
|
12888
12951
|
const workedDays = resource.items.reduce((sum, item) => {
|
|
@@ -12901,7 +12964,7 @@ function ResourceTimelineChart({
|
|
|
12901
12964
|
}
|
|
12902
12965
|
return map;
|
|
12903
12966
|
}, [businessDays, resources, weekendPredicate]);
|
|
12904
|
-
const layout = (0,
|
|
12967
|
+
const layout = (0, import_react18.useMemo)(
|
|
12905
12968
|
() => layoutResourceTimelineItems(orderedResources, {
|
|
12906
12969
|
monthStart,
|
|
12907
12970
|
dayWidth,
|
|
@@ -12912,8 +12975,8 @@ function ResourceTimelineChart({
|
|
|
12912
12975
|
);
|
|
12913
12976
|
const canAddResource = enableAddResource && Boolean(onAddResource);
|
|
12914
12977
|
const resourceAddRowHeight = laneHeight + DEFAULT_RESOURCE_ROW_GAP;
|
|
12915
|
-
const [collapsedResourceGroups, setCollapsedResourceGroups] = (0,
|
|
12916
|
-
const updateResourceColumnWidth = (0,
|
|
12978
|
+
const [collapsedResourceGroups, setCollapsedResourceGroups] = (0, import_react18.useState)(/* @__PURE__ */ new Set());
|
|
12979
|
+
const updateResourceColumnWidth = (0, import_react18.useCallback)((columnId, width) => {
|
|
12917
12980
|
setResourceColumnWidthOverrides((prev) => {
|
|
12918
12981
|
if (prev[columnId] === width) {
|
|
12919
12982
|
return prev;
|
|
@@ -12923,7 +12986,7 @@ function ResourceTimelineChart({
|
|
|
12923
12986
|
return next;
|
|
12924
12987
|
});
|
|
12925
12988
|
}, [onResourceTableColumnWidthsChange]);
|
|
12926
|
-
(0,
|
|
12989
|
+
(0, import_react18.useEffect)(() => {
|
|
12927
12990
|
const handleMouseMove = (event) => {
|
|
12928
12991
|
const resizeState = resourceColumnResizeRef.current;
|
|
12929
12992
|
if (!resizeState) {
|
|
@@ -12952,7 +13015,7 @@ function ResourceTimelineChart({
|
|
|
12952
13015
|
document.body.style.removeProperty("user-select");
|
|
12953
13016
|
};
|
|
12954
13017
|
}, [updateResourceColumnWidth]);
|
|
12955
|
-
const startResourceColumnResize = (0,
|
|
13018
|
+
const startResourceColumnResize = (0, import_react18.useCallback)((columnId, event) => {
|
|
12956
13019
|
const width = resolvedResourceColumnWidths[columnId];
|
|
12957
13020
|
if (typeof width !== "number") {
|
|
12958
13021
|
return;
|
|
@@ -12967,7 +13030,7 @@ function ResourceTimelineChart({
|
|
|
12967
13030
|
document.body.style.cursor = "col-resize";
|
|
12968
13031
|
document.body.style.userSelect = "none";
|
|
12969
13032
|
}, [resolvedResourceColumnWidths]);
|
|
12970
|
-
const renderResizeHandle = (0,
|
|
13033
|
+
const renderResizeHandle = (0, import_react18.useCallback)((columnId) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
12971
13034
|
"button",
|
|
12972
13035
|
{
|
|
12973
13036
|
type: "button",
|
|
@@ -12981,7 +13044,7 @@ function ResourceTimelineChart({
|
|
|
12981
13044
|
}
|
|
12982
13045
|
}
|
|
12983
13046
|
), [startResourceColumnResize]);
|
|
12984
|
-
const toggleResourceGroupCollapsed = (0,
|
|
13047
|
+
const toggleResourceGroupCollapsed = (0, import_react18.useCallback)((groupKey) => {
|
|
12985
13048
|
setCollapsedResourceGroups((prev) => {
|
|
12986
13049
|
const next = new Set(prev);
|
|
12987
13050
|
if (next.has(groupKey)) {
|
|
@@ -12992,7 +13055,7 @@ function ResourceTimelineChart({
|
|
|
12992
13055
|
return next;
|
|
12993
13056
|
});
|
|
12994
13057
|
}, []);
|
|
12995
|
-
const displayLayout = (0,
|
|
13058
|
+
const displayLayout = (0, import_react18.useMemo)(() => {
|
|
12996
13059
|
if (resourceGrouping !== "type") {
|
|
12997
13060
|
return {
|
|
12998
13061
|
rows: layout.rows,
|
|
@@ -13075,11 +13138,11 @@ function ResourceTimelineChart({
|
|
|
13075
13138
|
totalHeight: currentTop
|
|
13076
13139
|
};
|
|
13077
13140
|
}, [collapsedResourceGroups, creatingResourceGroupType, layout, resourceAddRowHeight, resourceGrouping]);
|
|
13078
|
-
const todayInRange = (0,
|
|
13141
|
+
const todayInRange = (0, import_react18.useMemo)(() => {
|
|
13079
13142
|
const today = getTodayLocalUtcDate();
|
|
13080
13143
|
return dateRange.some((day) => day.getTime() === today.getTime());
|
|
13081
13144
|
}, [dateRange]);
|
|
13082
|
-
const itemsByResourceId = (0,
|
|
13145
|
+
const itemsByResourceId = (0, import_react18.useMemo)(() => {
|
|
13083
13146
|
const map = /* @__PURE__ */ new Map();
|
|
13084
13147
|
for (const item of displayLayout.items) {
|
|
13085
13148
|
const next = map.get(item.resourceId) ?? [];
|
|
@@ -13088,7 +13151,7 @@ function ResourceTimelineChart({
|
|
|
13088
13151
|
}
|
|
13089
13152
|
return map;
|
|
13090
13153
|
}, [displayLayout.items]);
|
|
13091
|
-
const conflictItemsByResourceId = (0,
|
|
13154
|
+
const conflictItemsByResourceId = (0, import_react18.useMemo)(() => {
|
|
13092
13155
|
const map = /* @__PURE__ */ new Map();
|
|
13093
13156
|
for (const item of displayLayout.items) {
|
|
13094
13157
|
if (item.conflictRanges.length === 0) {
|
|
@@ -13107,7 +13170,7 @@ function ResourceTimelineChart({
|
|
|
13107
13170
|
}, [displayLayout.items]);
|
|
13108
13171
|
const displayTotalHeight = displayLayout.totalHeight + (canAddResource ? resourceAddRowHeight : 0);
|
|
13109
13172
|
const timelineHeaderHeight = headerHeight + 1;
|
|
13110
|
-
const handleConfirmNewResource = (0,
|
|
13173
|
+
const handleConfirmNewResource = (0, import_react18.useCallback)((name) => {
|
|
13111
13174
|
onAddResource?.({
|
|
13112
13175
|
id: crypto.randomUUID(),
|
|
13113
13176
|
name,
|
|
@@ -13118,7 +13181,7 @@ function ResourceTimelineChart({
|
|
|
13118
13181
|
setIsCreatingResource(false);
|
|
13119
13182
|
setCreatingResourceGroupType(null);
|
|
13120
13183
|
}, [creatingResourceGroupType, onAddResource]);
|
|
13121
|
-
const handleStartAddResourceToGroup = (0,
|
|
13184
|
+
const handleStartAddResourceToGroup = (0, import_react18.useCallback)((type) => {
|
|
13122
13185
|
setIsCreatingResource(false);
|
|
13123
13186
|
setCreatingResourceGroupType(type);
|
|
13124
13187
|
setCollapsedResourceGroups((prev) => {
|
|
@@ -13130,11 +13193,11 @@ function ResourceTimelineChart({
|
|
|
13130
13193
|
return next;
|
|
13131
13194
|
});
|
|
13132
13195
|
}, []);
|
|
13133
|
-
const handleCancelNewResource = (0,
|
|
13196
|
+
const handleCancelNewResource = (0, import_react18.useCallback)(() => {
|
|
13134
13197
|
setIsCreatingResource(false);
|
|
13135
13198
|
setCreatingResourceGroupType(null);
|
|
13136
13199
|
}, []);
|
|
13137
|
-
const handleConflictBadgeClick = (0,
|
|
13200
|
+
const handleConflictBadgeClick = (0, import_react18.useCallback)((resourceId) => {
|
|
13138
13201
|
const conflictItems = conflictItemsByResourceId.get(resourceId) ?? [];
|
|
13139
13202
|
if (conflictItems.length === 0) {
|
|
13140
13203
|
return;
|
|
@@ -13159,7 +13222,7 @@ function ResourceTimelineChart({
|
|
|
13159
13222
|
conflictHighlightTimeoutRef.current = null;
|
|
13160
13223
|
}, 1600);
|
|
13161
13224
|
}, [conflictItemsByResourceId, dayWidth, laneHeight]);
|
|
13162
|
-
const handleResourceNameClick = (0,
|
|
13225
|
+
const handleResourceNameClick = (0, import_react18.useCallback)((resourceId) => {
|
|
13163
13226
|
const resourceItems = itemsByResourceId.get(resourceId) ?? [];
|
|
13164
13227
|
if (resourceItems.length === 0) {
|
|
13165
13228
|
return;
|
|
@@ -13192,7 +13255,7 @@ function ResourceTimelineChart({
|
|
|
13192
13255
|
weekendPredicate,
|
|
13193
13256
|
onResourceItemMove
|
|
13194
13257
|
});
|
|
13195
|
-
(0,
|
|
13258
|
+
(0, import_react18.useEffect)(() => {
|
|
13196
13259
|
const container = scrollContainerRef.current;
|
|
13197
13260
|
if (!container) return;
|
|
13198
13261
|
const updateShadow = () => {
|
|
@@ -13204,7 +13267,7 @@ function ResourceTimelineChart({
|
|
|
13204
13267
|
container.removeEventListener("scroll", updateShadow);
|
|
13205
13268
|
};
|
|
13206
13269
|
}, []);
|
|
13207
|
-
const handlePanStart = (0,
|
|
13270
|
+
const handlePanStart = (0, import_react18.useCallback)((event) => {
|
|
13208
13271
|
if (event.button !== 0) {
|
|
13209
13272
|
return;
|
|
13210
13273
|
}
|
|
@@ -13232,7 +13295,7 @@ function ResourceTimelineChart({
|
|
|
13232
13295
|
container.style.cursor = "grabbing";
|
|
13233
13296
|
event.preventDefault();
|
|
13234
13297
|
}, []);
|
|
13235
|
-
(0,
|
|
13298
|
+
(0, import_react18.useEffect)(() => {
|
|
13236
13299
|
const handlePanMove = (event) => {
|
|
13237
13300
|
const pan = panStateRef.current;
|
|
13238
13301
|
const container = scrollContainerRef.current;
|
|
@@ -13261,7 +13324,7 @@ function ResourceTimelineChart({
|
|
|
13261
13324
|
window.removeEventListener("mouseup", handlePanEnd);
|
|
13262
13325
|
};
|
|
13263
13326
|
}, [allowVerticalPan]);
|
|
13264
|
-
(0,
|
|
13327
|
+
(0, import_react18.useEffect)(() => {
|
|
13265
13328
|
const nextNavigation = /* @__PURE__ */ new Map();
|
|
13266
13329
|
for (const [resourceId, resourceItems] of itemsByResourceId.entries()) {
|
|
13267
13330
|
if (resourceItems.length === 0) {
|
|
@@ -13271,7 +13334,7 @@ function ResourceTimelineChart({
|
|
|
13271
13334
|
}
|
|
13272
13335
|
resourceNavigationIndexRef.current = nextNavigation;
|
|
13273
13336
|
}, [itemsByResourceId]);
|
|
13274
|
-
(0,
|
|
13337
|
+
(0, import_react18.useEffect)(() => {
|
|
13275
13338
|
return () => {
|
|
13276
13339
|
if (conflictHighlightTimeoutRef.current) {
|
|
13277
13340
|
window.clearTimeout(conflictHighlightTimeoutRef.current);
|
|
@@ -13319,7 +13382,7 @@ function ResourceTimelineChart({
|
|
|
13319
13382
|
]
|
|
13320
13383
|
}
|
|
13321
13384
|
),
|
|
13322
|
-
displayLayout.groupHeaders.length > 0 ? displayLayout.groupHeaders.map((group) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
13385
|
+
displayLayout.groupHeaders.length > 0 ? displayLayout.groupHeaders.map((group) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react18.default.Fragment, { children: [
|
|
13323
13386
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
13324
13387
|
"div",
|
|
13325
13388
|
{
|
|
@@ -13691,7 +13754,7 @@ function ResourceTimelineChart({
|
|
|
13691
13754
|
}
|
|
13692
13755
|
|
|
13693
13756
|
// src/components/TableMatrix/TableMatrix.tsx
|
|
13694
|
-
var
|
|
13757
|
+
var import_react19 = require("react");
|
|
13695
13758
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
13696
13759
|
var AUTO_COLUMN_MIN_WIDTH = 72;
|
|
13697
13760
|
var AUTO_COLUMN_MAX_WIDTH = 180;
|
|
@@ -13758,13 +13821,13 @@ function TableMatrix({
|
|
|
13758
13821
|
filterMode = "highlight",
|
|
13759
13822
|
visibleRowIndices
|
|
13760
13823
|
}) {
|
|
13761
|
-
const measureRef = (0,
|
|
13762
|
-
const [measuredAutoWidths, setMeasuredAutoWidths] = (0,
|
|
13763
|
-
const hasAutoWidthColumns = (0,
|
|
13824
|
+
const measureRef = (0, import_react19.useRef)(null);
|
|
13825
|
+
const [measuredAutoWidths, setMeasuredAutoWidths] = (0, import_react19.useState)([]);
|
|
13826
|
+
const hasAutoWidthColumns = (0, import_react19.useMemo)(
|
|
13764
13827
|
() => columns.some((column) => typeof column.width !== "number"),
|
|
13765
13828
|
[columns]
|
|
13766
13829
|
);
|
|
13767
|
-
(0,
|
|
13830
|
+
(0, import_react19.useLayoutEffect)(() => {
|
|
13768
13831
|
if (!hasAutoWidthColumns) {
|
|
13769
13832
|
setMeasuredAutoWidths([]);
|
|
13770
13833
|
return;
|
|
@@ -13791,7 +13854,7 @@ function TableMatrix({
|
|
|
13791
13854
|
return changed ? nextWidths : previousWidths;
|
|
13792
13855
|
});
|
|
13793
13856
|
}, [columns, hasAutoWidthColumns, tasks]);
|
|
13794
|
-
const resolvedColumnWidths = (0,
|
|
13857
|
+
const resolvedColumnWidths = (0, import_react19.useMemo)(
|
|
13795
13858
|
() => columns.map((column, index) => {
|
|
13796
13859
|
if (typeof column.width === "number") return column.width;
|
|
13797
13860
|
const minWidth = getAutoMinWidth(column);
|
|
@@ -13800,27 +13863,27 @@ function TableMatrix({
|
|
|
13800
13863
|
}),
|
|
13801
13864
|
[columns, measuredAutoWidths]
|
|
13802
13865
|
);
|
|
13803
|
-
const gridTemplateColumns = (0,
|
|
13866
|
+
const gridTemplateColumns = (0, import_react19.useMemo)(
|
|
13804
13867
|
() => resolvedColumnWidths.map((width) => `${width}px`).join(" "),
|
|
13805
13868
|
[resolvedColumnWidths]
|
|
13806
13869
|
);
|
|
13807
|
-
const totalWidth = (0,
|
|
13870
|
+
const totalWidth = (0, import_react19.useMemo)(
|
|
13808
13871
|
() => resolvedColumnWidths.reduce((sum, width) => sum + width, 0),
|
|
13809
13872
|
[resolvedColumnWidths]
|
|
13810
13873
|
);
|
|
13811
|
-
const overlayDateMs = (0,
|
|
13874
|
+
const overlayDateMs = (0, import_react19.useMemo)(
|
|
13812
13875
|
() => dateOverlay ? parseDateOnlyMs(dateOverlay.date) : null,
|
|
13813
13876
|
[dateOverlay]
|
|
13814
13877
|
);
|
|
13815
|
-
const hasGroupHeader = (0,
|
|
13878
|
+
const hasGroupHeader = (0, import_react19.useMemo)(
|
|
13816
13879
|
() => columns.some((column) => !!column.groupId) || (columnGroups?.length ?? 0) > 0,
|
|
13817
13880
|
[columnGroups, columns]
|
|
13818
13881
|
);
|
|
13819
|
-
const groupMap = (0,
|
|
13882
|
+
const groupMap = (0, import_react19.useMemo)(
|
|
13820
13883
|
() => new Map((columnGroups ?? []).map((group) => [group.id, group])),
|
|
13821
13884
|
[columnGroups]
|
|
13822
13885
|
);
|
|
13823
|
-
const headerSpans = (0,
|
|
13886
|
+
const headerSpans = (0, import_react19.useMemo)(() => {
|
|
13824
13887
|
if (!hasGroupHeader) return [];
|
|
13825
13888
|
if (columnGroups?.some((group) => typeof group.width === "number")) {
|
|
13826
13889
|
return columnGroups.map((group) => ({
|
|
@@ -13853,7 +13916,7 @@ function TableMatrix({
|
|
|
13853
13916
|
const headerContentHeight = Math.max(0, headerHeight - 1);
|
|
13854
13917
|
const topRowHeight = hasGroupHeader ? Math.ceil(headerContentHeight / 2) : headerContentHeight;
|
|
13855
13918
|
const bottomRowHeight = hasGroupHeader ? Math.floor(headerContentHeight / 2) : 0;
|
|
13856
|
-
const parentTaskIds = (0,
|
|
13919
|
+
const parentTaskIds = (0, import_react19.useMemo)(() => {
|
|
13857
13920
|
const ids = /* @__PURE__ */ new Set();
|
|
13858
13921
|
for (const task of allTasks) {
|
|
13859
13922
|
if (task.parentId) {
|
|
@@ -13862,7 +13925,7 @@ function TableMatrix({
|
|
|
13862
13925
|
}
|
|
13863
13926
|
return ids;
|
|
13864
13927
|
}, [allTasks]);
|
|
13865
|
-
const nestingDepthMap = (0,
|
|
13928
|
+
const nestingDepthMap = (0, import_react19.useMemo)(() => {
|
|
13866
13929
|
const depthMap = /* @__PURE__ */ new Map();
|
|
13867
13930
|
const taskById = new Map(allTasks.map((task) => [task.id, task]));
|
|
13868
13931
|
const getDepth = (taskId, seen = /* @__PURE__ */ new Set()) => {
|
|
@@ -13883,7 +13946,7 @@ function TableMatrix({
|
|
|
13883
13946
|
}
|
|
13884
13947
|
return depthMap;
|
|
13885
13948
|
}, [allTasks]);
|
|
13886
|
-
const renderedRows = (0,
|
|
13949
|
+
const renderedRows = (0, import_react19.useMemo)(() => {
|
|
13887
13950
|
if (!visibleRowIndices) {
|
|
13888
13951
|
return tasks.map((task, index) => ({ task, index }));
|
|
13889
13952
|
}
|
|
@@ -14059,7 +14122,7 @@ function TableMatrix({
|
|
|
14059
14122
|
}
|
|
14060
14123
|
|
|
14061
14124
|
// src/components/PlanFactMatrix/PlanFactMatrix.tsx
|
|
14062
|
-
var
|
|
14125
|
+
var import_react20 = __toESM(require("react"));
|
|
14063
14126
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
14064
14127
|
var DAY_MS6 = 24 * 60 * 60 * 1e3;
|
|
14065
14128
|
function joinClasses2(...values) {
|
|
@@ -14151,9 +14214,9 @@ function PlanFactCellEditor({
|
|
|
14151
14214
|
onCommitRange,
|
|
14152
14215
|
onCancel
|
|
14153
14216
|
}) {
|
|
14154
|
-
const [draft, setDraft] = (0,
|
|
14155
|
-
const inputRef = (0,
|
|
14156
|
-
(0,
|
|
14217
|
+
const [draft, setDraft] = (0, import_react20.useState)(startValue ?? (value === void 0 ? "" : String(value)));
|
|
14218
|
+
const inputRef = (0, import_react20.useRef)(null);
|
|
14219
|
+
(0, import_react20.useEffect)(() => {
|
|
14157
14220
|
inputRef.current?.focus();
|
|
14158
14221
|
if (startValue === void 0) {
|
|
14159
14222
|
inputRef.current?.select();
|
|
@@ -14161,7 +14224,7 @@ function PlanFactCellEditor({
|
|
|
14161
14224
|
inputRef.current?.setSelectionRange(startValue.length, startValue.length);
|
|
14162
14225
|
}
|
|
14163
14226
|
}, [startValue]);
|
|
14164
|
-
const commit = (0,
|
|
14227
|
+
const commit = (0, import_react20.useCallback)(() => {
|
|
14165
14228
|
const parsed = parseNumberInput(draft);
|
|
14166
14229
|
if (parsed === null) {
|
|
14167
14230
|
onCancel();
|
|
@@ -14486,7 +14549,7 @@ function arePlanFactRowsEqual(previous, next) {
|
|
|
14486
14549
|
const nextRangeTouchesRow = doesRangeTouchRow(next.renderedRangeBounds, next.rowIndex);
|
|
14487
14550
|
return previous.task === next.task && previous.rowIndex === next.rowIndex && previous.dateRange === next.dateRange && previous.dateKeys === next.dateKeys && previous.renderedDateIndices === next.renderedDateIndices && previous.totalWidth === next.totalWidth && previous.rowHeight === next.rowHeight && previous.subrowHeight === next.subrowHeight && previous.dayWidth === next.dayWidth && previous.plannedRange === next.plannedRange && previous.todayDateIndex === next.todayDateIndex && previous.isParent === next.isParent && previous.isHighlighted === next.isHighlighted && previous.selectedTaskId === previous.task.id === (next.selectedTaskId === next.task.id) && getCellSignatureForTask(previous.activeCell, previous.task.id) === getCellSignatureForTask(next.activeCell, next.task.id) && getEditingCellSignatureForTask(previous.editingCell, previous.task.id) === getEditingCellSignatureForTask(next.editingCell, next.task.id) && getRangeAnchorSignatureForTask(previous.selectedRange, previous.task.id) === getRangeAnchorSignatureForTask(next.selectedRange, next.task.id) && previousRangeTouchesRow === nextRangeTouchesRow && (!nextRangeTouchesRow || areRangeBoundsEqual(previous.renderedRangeBounds, next.renderedRangeBounds));
|
|
14488
14551
|
}
|
|
14489
|
-
var PlanFactRow =
|
|
14552
|
+
var PlanFactRow = import_react20.default.memo(PlanFactRowInner, arePlanFactRowsEqual);
|
|
14490
14553
|
function PlanFactMatrix({
|
|
14491
14554
|
tasks,
|
|
14492
14555
|
allTasks = tasks,
|
|
@@ -14506,51 +14569,51 @@ function PlanFactMatrix({
|
|
|
14506
14569
|
todayDateIndex,
|
|
14507
14570
|
isCustomWeekend
|
|
14508
14571
|
}) {
|
|
14509
|
-
const [activeCell, setActiveCell] = (0,
|
|
14510
|
-
const [editingCell, setEditingCell] = (0,
|
|
14511
|
-
const [selectedRange, setSelectedRange] = (0,
|
|
14512
|
-
const [fillRange, setFillRange] = (0,
|
|
14513
|
-
const [overflowTooltip, setOverflowTooltip] = (0,
|
|
14514
|
-
const isSelectingRef = (0,
|
|
14515
|
-
const isFillDraggingRef = (0,
|
|
14516
|
-
const didDragSelectRef = (0,
|
|
14517
|
-
const pendingHoverCellRef = (0,
|
|
14518
|
-
const hoverFrameRef = (0,
|
|
14519
|
-
const rootRef = (0,
|
|
14520
|
-
const bodyRef = (0,
|
|
14572
|
+
const [activeCell, setActiveCell] = (0, import_react20.useState)(null);
|
|
14573
|
+
const [editingCell, setEditingCell] = (0, import_react20.useState)(null);
|
|
14574
|
+
const [selectedRange, setSelectedRange] = (0, import_react20.useState)(null);
|
|
14575
|
+
const [fillRange, setFillRange] = (0, import_react20.useState)(null);
|
|
14576
|
+
const [overflowTooltip, setOverflowTooltip] = (0, import_react20.useState)(null);
|
|
14577
|
+
const isSelectingRef = (0, import_react20.useRef)(false);
|
|
14578
|
+
const isFillDraggingRef = (0, import_react20.useRef)(false);
|
|
14579
|
+
const didDragSelectRef = (0, import_react20.useRef)(false);
|
|
14580
|
+
const pendingHoverCellRef = (0, import_react20.useRef)(null);
|
|
14581
|
+
const hoverFrameRef = (0, import_react20.useRef)(null);
|
|
14582
|
+
const rootRef = (0, import_react20.useRef)(null);
|
|
14583
|
+
const bodyRef = (0, import_react20.useRef)(null);
|
|
14521
14584
|
const totalWidth = dateRange.length * dayWidth;
|
|
14522
14585
|
const subrowHeight = rowHeight / 2;
|
|
14523
|
-
const renderedRowIndices = (0,
|
|
14586
|
+
const renderedRowIndices = (0, import_react20.useMemo)(
|
|
14524
14587
|
() => visibleRowIndices ?? tasks.map((_, index) => index),
|
|
14525
14588
|
[tasks, visibleRowIndices]
|
|
14526
14589
|
);
|
|
14527
|
-
const renderedDateIndices = (0,
|
|
14590
|
+
const renderedDateIndices = (0, import_react20.useMemo)(
|
|
14528
14591
|
() => visibleDateIndices ?? dateRange.map((_, index) => index),
|
|
14529
14592
|
[dateRange, visibleDateIndices]
|
|
14530
14593
|
);
|
|
14531
|
-
const parentTaskIds = (0,
|
|
14594
|
+
const parentTaskIds = (0, import_react20.useMemo)(() => {
|
|
14532
14595
|
const ids = /* @__PURE__ */ new Set();
|
|
14533
14596
|
for (const task of allTasks) {
|
|
14534
14597
|
if (task.parentId) ids.add(task.parentId);
|
|
14535
14598
|
}
|
|
14536
14599
|
return ids;
|
|
14537
14600
|
}, [allTasks]);
|
|
14538
|
-
const dateKeys = (0,
|
|
14539
|
-
const renderedDateWindow = (0,
|
|
14601
|
+
const dateKeys = (0, import_react20.useMemo)(() => dateRange.map(formatDateKey), [dateRange]);
|
|
14602
|
+
const renderedDateWindow = (0, import_react20.useMemo)(
|
|
14540
14603
|
() => getRenderedDateWindow(dateRange, renderedDateIndices),
|
|
14541
14604
|
[dateRange, renderedDateIndices]
|
|
14542
14605
|
);
|
|
14543
14606
|
const dateRangeStartMs = dateRange[0] ? getDateOnlyMs(dateRange[0]) : 0;
|
|
14544
|
-
const taskIndexById = (0,
|
|
14607
|
+
const taskIndexById = (0, import_react20.useMemo)(() => {
|
|
14545
14608
|
const indexById = /* @__PURE__ */ new Map();
|
|
14546
14609
|
tasks.forEach((task, index) => indexById.set(task.id, index));
|
|
14547
14610
|
return indexById;
|
|
14548
14611
|
}, [tasks]);
|
|
14549
|
-
const taskById = (0,
|
|
14612
|
+
const taskById = (0, import_react20.useMemo)(
|
|
14550
14613
|
() => new Map(tasks.map((task) => [task.id, task])),
|
|
14551
14614
|
[tasks]
|
|
14552
14615
|
);
|
|
14553
|
-
const monthSeparatorIndices = (0,
|
|
14616
|
+
const monthSeparatorIndices = (0, import_react20.useMemo)(() => {
|
|
14554
14617
|
const indices = [];
|
|
14555
14618
|
for (let index = 1; index < dateRange.length; index += 1) {
|
|
14556
14619
|
if (dateRange[index].getUTCDate() === 1) {
|
|
@@ -14559,14 +14622,14 @@ function PlanFactMatrix({
|
|
|
14559
14622
|
}
|
|
14560
14623
|
return indices;
|
|
14561
14624
|
}, [dateRange]);
|
|
14562
|
-
const plannedRangeByTaskId = (0,
|
|
14625
|
+
const plannedRangeByTaskId = (0, import_react20.useMemo)(() => {
|
|
14563
14626
|
const rangeByTaskId = /* @__PURE__ */ new Map();
|
|
14564
14627
|
for (const task of tasks) {
|
|
14565
14628
|
rangeByTaskId.set(task.id, getPlannedIndexRange(task, dateRangeStartMs, dateRange.length));
|
|
14566
14629
|
}
|
|
14567
14630
|
return rangeByTaskId;
|
|
14568
14631
|
}, [dateRange.length, dateRangeStartMs, tasks]);
|
|
14569
|
-
const focusCell = (0,
|
|
14632
|
+
const focusCell = (0, import_react20.useCallback)((cell) => {
|
|
14570
14633
|
window.requestAnimationFrame(() => {
|
|
14571
14634
|
const selector = [
|
|
14572
14635
|
`[data-plan-fact-task-id="${escapeAttributeValue(cell.taskId)}"]`,
|
|
@@ -14576,7 +14639,7 @@ function PlanFactMatrix({
|
|
|
14576
14639
|
bodyRef.current?.querySelector(selector)?.focus();
|
|
14577
14640
|
});
|
|
14578
14641
|
}, []);
|
|
14579
|
-
const clearSelection = (0,
|
|
14642
|
+
const clearSelection = (0, import_react20.useCallback)(() => {
|
|
14580
14643
|
if (hoverFrameRef.current !== null) {
|
|
14581
14644
|
window.cancelAnimationFrame(hoverFrameRef.current);
|
|
14582
14645
|
hoverFrameRef.current = null;
|
|
@@ -14591,10 +14654,10 @@ function PlanFactMatrix({
|
|
|
14591
14654
|
setFillRange(null);
|
|
14592
14655
|
setOverflowTooltip(null);
|
|
14593
14656
|
}, []);
|
|
14594
|
-
const hideOverflowTooltip = (0,
|
|
14657
|
+
const hideOverflowTooltip = (0, import_react20.useCallback)(() => {
|
|
14595
14658
|
setOverflowTooltip(null);
|
|
14596
14659
|
}, []);
|
|
14597
|
-
const flushPendingHoverCell = (0,
|
|
14660
|
+
const flushPendingHoverCell = (0, import_react20.useCallback)(() => {
|
|
14598
14661
|
hoverFrameRef.current = null;
|
|
14599
14662
|
const currentCell = pendingHoverCellRef.current;
|
|
14600
14663
|
if (!currentCell) return;
|
|
@@ -14612,12 +14675,12 @@ function PlanFactMatrix({
|
|
|
14612
14675
|
}));
|
|
14613
14676
|
onTaskSelect?.(currentCell.taskId);
|
|
14614
14677
|
}, [onTaskSelect, selectedRange]);
|
|
14615
|
-
const queueHoverCellUpdate = (0,
|
|
14678
|
+
const queueHoverCellUpdate = (0, import_react20.useCallback)((cell) => {
|
|
14616
14679
|
pendingHoverCellRef.current = cell;
|
|
14617
14680
|
if (hoverFrameRef.current !== null) return;
|
|
14618
14681
|
hoverFrameRef.current = window.requestAnimationFrame(flushPendingHoverCell);
|
|
14619
14682
|
}, [flushPendingHoverCell]);
|
|
14620
|
-
const showOverflowTooltip = (0,
|
|
14683
|
+
const showOverflowTooltip = (0, import_react20.useCallback)((target, label, force = false) => {
|
|
14621
14684
|
if (!rootRef.current || !label) return;
|
|
14622
14685
|
if (!force && target.scrollWidth <= target.clientWidth) {
|
|
14623
14686
|
setOverflowTooltip(null);
|
|
@@ -14631,12 +14694,12 @@ function PlanFactMatrix({
|
|
|
14631
14694
|
top: targetRect.top - rootRect.top
|
|
14632
14695
|
});
|
|
14633
14696
|
}, []);
|
|
14634
|
-
const selectSingleCell = (0,
|
|
14697
|
+
const selectSingleCell = (0, import_react20.useCallback)((cell) => {
|
|
14635
14698
|
setActiveCell(cell);
|
|
14636
14699
|
setSelectedRange({ anchor: cell, focus: cell });
|
|
14637
14700
|
setFillRange(null);
|
|
14638
14701
|
}, []);
|
|
14639
|
-
const getRangeBounds = (0,
|
|
14702
|
+
const getRangeBounds = (0, import_react20.useCallback)((range) => {
|
|
14640
14703
|
const anchorTaskIndex = taskIndexById.get(range.anchor.taskId);
|
|
14641
14704
|
const focusTaskIndex = taskIndexById.get(range.focus.taskId);
|
|
14642
14705
|
if (anchorTaskIndex === void 0 || focusTaskIndex === void 0) {
|
|
@@ -14656,11 +14719,11 @@ function PlanFactMatrix({
|
|
|
14656
14719
|
};
|
|
14657
14720
|
}, [taskIndexById]);
|
|
14658
14721
|
const renderedRange = fillRange ?? selectedRange;
|
|
14659
|
-
const renderedRangeBounds = (0,
|
|
14722
|
+
const renderedRangeBounds = (0, import_react20.useMemo)(
|
|
14660
14723
|
() => renderedRange ? getRangeBounds(renderedRange) : null,
|
|
14661
14724
|
[getRangeBounds, renderedRange]
|
|
14662
14725
|
);
|
|
14663
|
-
const getCellFromPosition = (0,
|
|
14726
|
+
const getCellFromPosition = (0, import_react20.useCallback)((subrowIndex, dateIndex) => {
|
|
14664
14727
|
const task = tasks[Math.floor(subrowIndex / 2)];
|
|
14665
14728
|
if (!task) return null;
|
|
14666
14729
|
return {
|
|
@@ -14669,7 +14732,7 @@ function PlanFactMatrix({
|
|
|
14669
14732
|
kind: subrowIndex % 2 === 0 ? "plan" : "fact"
|
|
14670
14733
|
};
|
|
14671
14734
|
}, [tasks]);
|
|
14672
|
-
const isCellInRange = (0,
|
|
14735
|
+
const isCellInRange = (0, import_react20.useCallback)((cell, range) => {
|
|
14673
14736
|
const bounds = getRangeBounds(range);
|
|
14674
14737
|
if (!bounds) return false;
|
|
14675
14738
|
const cellTaskIndex = taskIndexById.get(cell.taskId);
|
|
@@ -14679,7 +14742,7 @@ function PlanFactMatrix({
|
|
|
14679
14742
|
const cellSubrowIndex = getSubrowIndex(cellTaskIndex, cell.kind);
|
|
14680
14743
|
return cell.dateIndex >= bounds.fromDateIndex && cell.dateIndex <= bounds.toDateIndex && cellSubrowIndex >= bounds.fromSubrowIndex && cellSubrowIndex <= bounds.toSubrowIndex;
|
|
14681
14744
|
}, [getRangeBounds, taskIndexById]);
|
|
14682
|
-
const commitCell = (0,
|
|
14745
|
+
const commitCell = (0, import_react20.useCallback)((task, dateIndex, kind, value) => {
|
|
14683
14746
|
const dateKey = dateKeys[dateIndex];
|
|
14684
14747
|
const source = kind === "plan" ? task.planByDate : task.factByDate;
|
|
14685
14748
|
const nextValues = { ...source ?? {} };
|
|
@@ -14701,7 +14764,7 @@ function PlanFactMatrix({
|
|
|
14701
14764
|
value
|
|
14702
14765
|
});
|
|
14703
14766
|
}, [dateKeys, dateRange, onCellCommit, onTasksChange]);
|
|
14704
|
-
const commitRangeCells = (0,
|
|
14767
|
+
const commitRangeCells = (0, import_react20.useCallback)((bounds, value, mode) => {
|
|
14705
14768
|
const changedTasksById = /* @__PURE__ */ new Map();
|
|
14706
14769
|
for (let subrowIndex = bounds.fromSubrowIndex; subrowIndex <= bounds.toSubrowIndex; subrowIndex += 1) {
|
|
14707
14770
|
const task = tasks[Math.floor(subrowIndex / 2)];
|
|
@@ -14748,7 +14811,7 @@ function PlanFactMatrix({
|
|
|
14748
14811
|
onTasksChange?.(changedTasks);
|
|
14749
14812
|
}
|
|
14750
14813
|
}, [dateKeys, onTasksChange, parentTaskIds, tasks]);
|
|
14751
|
-
const clearSelectedCells = (0,
|
|
14814
|
+
const clearSelectedCells = (0, import_react20.useCallback)(() => {
|
|
14752
14815
|
const activeRange = fillRange ?? selectedRange;
|
|
14753
14816
|
if (!activeRange) {
|
|
14754
14817
|
if (!activeCell) return;
|
|
@@ -14762,7 +14825,7 @@ function PlanFactMatrix({
|
|
|
14762
14825
|
commitRangeCells(bounds, void 0, "clear");
|
|
14763
14826
|
}
|
|
14764
14827
|
}, [activeCell, commitCell, commitRangeCells, fillRange, getRangeBounds, parentTaskIds, selectedRange, taskById]);
|
|
14765
|
-
const commitSelectedCells = (0,
|
|
14828
|
+
const commitSelectedCells = (0, import_react20.useCallback)((value) => {
|
|
14766
14829
|
const activeRange = fillRange ?? selectedRange;
|
|
14767
14830
|
if (!activeRange) {
|
|
14768
14831
|
if (!activeCell) return;
|
|
@@ -14776,13 +14839,13 @@ function PlanFactMatrix({
|
|
|
14776
14839
|
commitRangeCells(bounds, value, "set");
|
|
14777
14840
|
}
|
|
14778
14841
|
}, [activeCell, commitCell, commitRangeCells, fillRange, getRangeBounds, parentTaskIds, selectedRange, taskById]);
|
|
14779
|
-
const getCellValue = (0,
|
|
14842
|
+
const getCellValue = (0, import_react20.useCallback)((cell) => {
|
|
14780
14843
|
const task = taskById.get(cell.taskId);
|
|
14781
14844
|
if (!task) return void 0;
|
|
14782
14845
|
const dateKey = dateKeys[cell.dateIndex];
|
|
14783
14846
|
return cell.kind === "plan" ? task.planByDate?.[dateKey] : task.factByDate?.[dateKey];
|
|
14784
14847
|
}, [dateKeys, taskById]);
|
|
14785
|
-
const applyFillRange = (0,
|
|
14848
|
+
const applyFillRange = (0, import_react20.useCallback)((nextFillRange) => {
|
|
14786
14849
|
const targetRange = nextFillRange ?? fillRange;
|
|
14787
14850
|
if (!selectedRange || !targetRange) return;
|
|
14788
14851
|
const sourceBounds = getRangeBounds(selectedRange);
|
|
@@ -14855,7 +14918,7 @@ function PlanFactMatrix({
|
|
|
14855
14918
|
selectedRange,
|
|
14856
14919
|
taskById
|
|
14857
14920
|
]);
|
|
14858
|
-
const moveActiveCell = (0,
|
|
14921
|
+
const moveActiveCell = (0, import_react20.useCallback)((cell, direction) => {
|
|
14859
14922
|
const taskIndex = tasks.findIndex((task) => task.id === cell.taskId);
|
|
14860
14923
|
if (taskIndex < 0) return;
|
|
14861
14924
|
let nextCell = { ...cell };
|
|
@@ -14887,7 +14950,7 @@ function PlanFactMatrix({
|
|
|
14887
14950
|
onTaskSelect?.(nextCell.taskId);
|
|
14888
14951
|
focusCell(nextCell);
|
|
14889
14952
|
}, [dateRange.length, focusCell, onTaskSelect, parentTaskIds, tasks]);
|
|
14890
|
-
const extendSelectedRange = (0,
|
|
14953
|
+
const extendSelectedRange = (0, import_react20.useCallback)((cell, direction) => {
|
|
14891
14954
|
const taskIndex = tasks.findIndex((task) => task.id === cell.taskId);
|
|
14892
14955
|
if (taskIndex < 0) return;
|
|
14893
14956
|
let nextCell = { ...cell };
|
|
@@ -14923,7 +14986,7 @@ function PlanFactMatrix({
|
|
|
14923
14986
|
onTaskSelect?.(nextCell.taskId);
|
|
14924
14987
|
focusCell(selectedRange?.anchor ?? cell);
|
|
14925
14988
|
}, [dateRange.length, focusCell, onTaskSelect, parentTaskIds, selectedRange, tasks]);
|
|
14926
|
-
(0,
|
|
14989
|
+
(0, import_react20.useEffect)(() => {
|
|
14927
14990
|
const endSelection = () => {
|
|
14928
14991
|
let pendingFillRange = null;
|
|
14929
14992
|
if (hoverFrameRef.current !== null) {
|
|
@@ -14946,12 +15009,12 @@ function PlanFactMatrix({
|
|
|
14946
15009
|
window.removeEventListener("mouseup", endSelection);
|
|
14947
15010
|
};
|
|
14948
15011
|
}, [applyFillRange, flushPendingHoverCell]);
|
|
14949
|
-
(0,
|
|
15012
|
+
(0, import_react20.useEffect)(() => () => {
|
|
14950
15013
|
if (hoverFrameRef.current !== null) {
|
|
14951
15014
|
window.cancelAnimationFrame(hoverFrameRef.current);
|
|
14952
15015
|
}
|
|
14953
15016
|
}, []);
|
|
14954
|
-
(0,
|
|
15017
|
+
(0, import_react20.useEffect)(() => {
|
|
14955
15018
|
const handleKeyDown = (event) => {
|
|
14956
15019
|
if (event.key !== "Escape") return;
|
|
14957
15020
|
clearSelection();
|
|
@@ -15698,17 +15761,18 @@ function TaskGanttChartInner(props, ref) {
|
|
|
15698
15761
|
const onMatrixCellClick = isTableMatrixMode ? props.onMatrixCellClick : void 0;
|
|
15699
15762
|
const matrixDateOverlay = isTableMatrixMode ? props.matrixDateOverlay : void 0;
|
|
15700
15763
|
const onPlanFactCellCommit = isPlanFactMode ? props.onPlanFactCellCommit : void 0;
|
|
15701
|
-
const containerRef = (0,
|
|
15702
|
-
const
|
|
15703
|
-
const
|
|
15704
|
-
const
|
|
15705
|
-
const
|
|
15706
|
-
const
|
|
15707
|
-
const
|
|
15708
|
-
const
|
|
15709
|
-
const
|
|
15710
|
-
const
|
|
15711
|
-
const
|
|
15764
|
+
const containerRef = (0, import_react21.useRef)(null);
|
|
15765
|
+
const barContrast = useBarContrast(containerRef, tasks, !isTableMatrixMode && !isPlanFactMode);
|
|
15766
|
+
const scrollContainerRef = (0, import_react21.useRef)(null);
|
|
15767
|
+
const scrollContentRef = (0, import_react21.useRef)(null);
|
|
15768
|
+
const clearSelectedTaskTimeoutRef = (0, import_react21.useRef)(null);
|
|
15769
|
+
const hasAutoScrolledToTodayRef = (0, import_react21.useRef)(false);
|
|
15770
|
+
const previewPositionStoreRef = (0, import_react21.useRef)(null);
|
|
15771
|
+
const activityPreviewStoreRef = (0, import_react21.useRef)(null);
|
|
15772
|
+
const activityBlockStoreRef = (0, import_react21.useRef)(null);
|
|
15773
|
+
const activityDragOwnerRef = (0, import_react21.useRef)(null);
|
|
15774
|
+
const activityActivationStoreRef = (0, import_react21.useRef)(null);
|
|
15775
|
+
const renderedTaskIdsRef = (0, import_react21.useRef)(/* @__PURE__ */ new Set());
|
|
15712
15776
|
if (previewPositionStoreRef.current === null) {
|
|
15713
15777
|
previewPositionStoreRef.current = createTaskPreviewPositionStore();
|
|
15714
15778
|
}
|
|
@@ -15729,10 +15793,10 @@ function TaskGanttChartInner(props, ref) {
|
|
|
15729
15793
|
const activityBlockStore = activityBlockStoreRef.current;
|
|
15730
15794
|
const activityDragOwner = activityDragOwnerRef.current;
|
|
15731
15795
|
const activityActivationStore = activityActivationStoreRef.current;
|
|
15732
|
-
const [selectedTaskId, setSelectedTaskId] = (0,
|
|
15733
|
-
const [taskListHasRightShadow, setTaskListHasRightShadow] = (0,
|
|
15734
|
-
const [internalTaskDateChangeMode, setInternalTaskDateChangeMode] = (0,
|
|
15735
|
-
const [scrollViewport, setScrollViewport] = (0,
|
|
15796
|
+
const [selectedTaskId, setSelectedTaskId] = (0, import_react21.useState)(null);
|
|
15797
|
+
const [taskListHasRightShadow, setTaskListHasRightShadow] = (0, import_react21.useState)(false);
|
|
15798
|
+
const [internalTaskDateChangeMode, setInternalTaskDateChangeMode] = (0, import_react21.useState)("preserve-duration");
|
|
15799
|
+
const [scrollViewport, setScrollViewport] = (0, import_react21.useState)(() => ({
|
|
15736
15800
|
scrollTop: 0,
|
|
15737
15801
|
viewportHeight: getInitialScrollViewportHeight(containerHeight, headerHeight + 1),
|
|
15738
15802
|
// Ширина видимой области графика и «бакетированный» горизонтальный скролл —
|
|
@@ -15740,14 +15804,14 @@ function TaskGanttChartInner(props, ref) {
|
|
|
15740
15804
|
viewportWidth: 0,
|
|
15741
15805
|
chartScrollLeft: 0
|
|
15742
15806
|
}));
|
|
15743
|
-
const [forceFullRenderForPrint, setForceFullRenderForPrint] = (0,
|
|
15744
|
-
const [planFactDateWindow, setPlanFactDateWindow] = (0,
|
|
15745
|
-
const [selectedChip, setSelectedChip] = (0,
|
|
15746
|
-
const [dependencyCreationDrag, setDependencyCreationDrag] = (0,
|
|
15747
|
-
const dependencyCreationRef = (0,
|
|
15748
|
-
const [dependencyCreationError, setDependencyCreationError] = (0,
|
|
15749
|
-
const [dependencyLineMenu, setDependencyLineMenu] = (0,
|
|
15750
|
-
const getDependencyPortPoint = (0,
|
|
15807
|
+
const [forceFullRenderForPrint, setForceFullRenderForPrint] = (0, import_react21.useState)(false);
|
|
15808
|
+
const [planFactDateWindow, setPlanFactDateWindow] = (0, import_react21.useState)({ start: 0, end: 0 });
|
|
15809
|
+
const [selectedChip, setSelectedChip] = (0, import_react21.useState)(null);
|
|
15810
|
+
const [dependencyCreationDrag, setDependencyCreationDrag] = (0, import_react21.useState)(null);
|
|
15811
|
+
const dependencyCreationRef = (0, import_react21.useRef)(null);
|
|
15812
|
+
const [dependencyCreationError, setDependencyCreationError] = (0, import_react21.useState)(null);
|
|
15813
|
+
const [dependencyLineMenu, setDependencyLineMenu] = (0, import_react21.useState)(null);
|
|
15814
|
+
const getDependencyPortPoint = (0, import_react21.useCallback)((element, chartRect) => {
|
|
15751
15815
|
const rect = element.getBoundingClientRect();
|
|
15752
15816
|
const side = element.getAttribute("data-port-side");
|
|
15753
15817
|
return {
|
|
@@ -15761,13 +15825,13 @@ function TaskGanttChartInner(props, ref) {
|
|
|
15761
15825
|
y: rect.top + rect.height / 2 - chartRect.top
|
|
15762
15826
|
};
|
|
15763
15827
|
}, []);
|
|
15764
|
-
const getVisualDependencyType = (0,
|
|
15828
|
+
const getVisualDependencyType = (0, import_react21.useCallback)((sourceSide, targetSide) => {
|
|
15765
15829
|
if (sourceSide === "right" && targetSide === "left") return "FS";
|
|
15766
15830
|
if (sourceSide === "left" && targetSide === "left") return "SS";
|
|
15767
15831
|
if (sourceSide === "right" && targetSide === "right") return "FF";
|
|
15768
15832
|
return "SF";
|
|
15769
15833
|
}, []);
|
|
15770
|
-
const handleDependencyPortPointerDown = (0,
|
|
15834
|
+
const handleDependencyPortPointerDown = (0, import_react21.useCallback)((sourceId, sourceSide, event) => {
|
|
15771
15835
|
if (disableDependencyEditing || event.button !== 0) return;
|
|
15772
15836
|
const chartElement = event.currentTarget.closest(".gantt-taskArea");
|
|
15773
15837
|
if (!(chartElement instanceof HTMLElement)) return;
|
|
@@ -15780,7 +15844,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
15780
15844
|
dependencyCreationRef.current = nextDrag;
|
|
15781
15845
|
setDependencyCreationDrag(nextDrag);
|
|
15782
15846
|
}, [disableDependencyEditing, getDependencyPortPoint]);
|
|
15783
|
-
(0,
|
|
15847
|
+
(0, import_react21.useEffect)(() => {
|
|
15784
15848
|
if (!dependencyCreationDrag) return;
|
|
15785
15849
|
const handlePointerMove = (event) => {
|
|
15786
15850
|
const activeDrag = dependencyCreationRef.current;
|
|
@@ -15864,12 +15928,12 @@ function TaskGanttChartInner(props, ref) {
|
|
|
15864
15928
|
document.removeEventListener("keydown", handleKeyDown);
|
|
15865
15929
|
};
|
|
15866
15930
|
}, [businessDays, customDays, dependencyCreationDrag !== null, getDependencyPortPoint, getVisualDependencyType, isWeekend3, onTasksChange, tasks]);
|
|
15867
|
-
(0,
|
|
15931
|
+
(0, import_react21.useEffect)(() => {
|
|
15868
15932
|
if (!dependencyCreationError) return;
|
|
15869
15933
|
const timeout = window.setTimeout(() => setDependencyCreationError(null), 3e3);
|
|
15870
15934
|
return () => window.clearTimeout(timeout);
|
|
15871
15935
|
}, [dependencyCreationError]);
|
|
15872
|
-
(0,
|
|
15936
|
+
(0, import_react21.useEffect)(() => {
|
|
15873
15937
|
if (!dependencyLineMenu) return;
|
|
15874
15938
|
const closeMenu = (event) => {
|
|
15875
15939
|
const target = event.target;
|
|
@@ -15885,7 +15949,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
15885
15949
|
document.removeEventListener("keydown", closeOnEscape);
|
|
15886
15950
|
};
|
|
15887
15951
|
}, [dependencyLineMenu]);
|
|
15888
|
-
const handleDependencyLineClick = (0,
|
|
15952
|
+
const handleDependencyLineClick = (0, import_react21.useCallback)((dependency) => {
|
|
15889
15953
|
setSelectedChip({
|
|
15890
15954
|
predecessorId: dependency.predecessorId,
|
|
15891
15955
|
successorId: dependency.successorId,
|
|
@@ -15893,10 +15957,10 @@ function TaskGanttChartInner(props, ref) {
|
|
|
15893
15957
|
});
|
|
15894
15958
|
setDependencyLineMenu(dependency);
|
|
15895
15959
|
}, []);
|
|
15896
|
-
const handleDependencyLineClose = (0,
|
|
15960
|
+
const handleDependencyLineClose = (0, import_react21.useCallback)(() => {
|
|
15897
15961
|
setDependencyLineMenu(null);
|
|
15898
15962
|
}, []);
|
|
15899
|
-
const handleDependencyLineDelete = (0,
|
|
15963
|
+
const handleDependencyLineDelete = (0, import_react21.useCallback)(() => {
|
|
15900
15964
|
if (!dependencyLineMenu) return;
|
|
15901
15965
|
const successor = tasks.find((task) => task.id === dependencyLineMenu.successorId);
|
|
15902
15966
|
if (!successor) return;
|
|
@@ -15907,23 +15971,23 @@ function TaskGanttChartInner(props, ref) {
|
|
|
15907
15971
|
setSelectedChip(null);
|
|
15908
15972
|
setDependencyLineMenu(null);
|
|
15909
15973
|
}, [dependencyLineMenu, onTasksChange, tasks]);
|
|
15910
|
-
const [activeTimelineTooltip, setActiveTimelineTooltip] = (0,
|
|
15911
|
-
const [internalCollapsedParentIds, setInternalCollapsedParentIds] = (0,
|
|
15912
|
-
const [expandedCompositeIds, setExpandedCompositeIds] = (0,
|
|
15913
|
-
const [editingTaskId, setEditingTaskId] = (0,
|
|
15974
|
+
const [activeTimelineTooltip, setActiveTimelineTooltip] = (0, import_react21.useState)(null);
|
|
15975
|
+
const [internalCollapsedParentIds, setInternalCollapsedParentIds] = (0, import_react21.useState)(/* @__PURE__ */ new Set());
|
|
15976
|
+
const [expandedCompositeIds, setExpandedCompositeIds] = (0, import_react21.useState)(/* @__PURE__ */ new Set());
|
|
15977
|
+
const [editingTaskId, setEditingTaskId] = (0, import_react21.useState)(null);
|
|
15914
15978
|
const taskDateChangeMode = externalTaskDateChangeMode ?? internalTaskDateChangeMode;
|
|
15915
15979
|
const handleTaskDateChangeMode = externalOnTaskDateChangeModeChange ?? setInternalTaskDateChangeMode;
|
|
15916
15980
|
const resolvedRowContentLines = isPlanFactMode ? Math.max(2, Math.floor(rowContentLines)) : Math.max(1, Math.floor(rowContentLines));
|
|
15917
15981
|
const shouldFillParentRowsInTaskList = fillParentRowsInTaskList ?? isPlanFactMode;
|
|
15918
|
-
const effectiveRowHeight = (0,
|
|
15982
|
+
const effectiveRowHeight = (0, import_react21.useMemo)(
|
|
15919
15983
|
() => rowContentLines === 0 && !isPlanFactMode ? rowHeight : Math.max(rowHeight, 10 + resolvedRowContentLines * 18),
|
|
15920
15984
|
[isPlanFactMode, resolvedRowContentLines, rowContentLines, rowHeight]
|
|
15921
15985
|
);
|
|
15922
|
-
const isCustomWeekend = (0,
|
|
15986
|
+
const isCustomWeekend = (0, import_react21.useMemo)(
|
|
15923
15987
|
() => createCustomDayPredicate({ customDays, isWeekend: isWeekend3 }),
|
|
15924
15988
|
[customDays, isWeekend3]
|
|
15925
15989
|
);
|
|
15926
|
-
const normalizedTasks = (0,
|
|
15990
|
+
const normalizedTasks = (0, import_react21.useMemo)(() => {
|
|
15927
15991
|
const ordered = normalizeHierarchyTasks(tasks, businessDays, isCustomWeekend);
|
|
15928
15992
|
const ranges = /* @__PURE__ */ new Map();
|
|
15929
15993
|
for (const task of ordered) {
|
|
@@ -15945,7 +16009,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
15945
16009
|
} : task;
|
|
15946
16010
|
});
|
|
15947
16011
|
}, [tasks, businessDays, isCustomWeekend]);
|
|
15948
|
-
const collapsedParentIds = (0,
|
|
16012
|
+
const collapsedParentIds = (0, import_react21.useMemo)(() => {
|
|
15949
16013
|
if (externalCollapsedParentIds) return externalCollapsedParentIds;
|
|
15950
16014
|
const ids = new Set(internalCollapsedParentIds);
|
|
15951
16015
|
for (const task of normalizedTasks) {
|
|
@@ -15953,18 +16017,18 @@ function TaskGanttChartInner(props, ref) {
|
|
|
15953
16017
|
}
|
|
15954
16018
|
return ids;
|
|
15955
16019
|
}, [externalCollapsedParentIds, internalCollapsedParentIds, normalizedTasks, expandedCompositeIds]);
|
|
15956
|
-
const controlledScheduleIdentity = (0,
|
|
16020
|
+
const controlledScheduleIdentity = (0, import_react21.useMemo)(
|
|
15957
16021
|
() => buildControlledScheduleIdentity(normalizedTasks),
|
|
15958
16022
|
[normalizedTasks]
|
|
15959
16023
|
);
|
|
15960
|
-
const previousControlledScheduleIdentityRef = (0,
|
|
16024
|
+
const previousControlledScheduleIdentityRef = (0, import_react21.useRef)(null);
|
|
15961
16025
|
const controlledScheduleChanged = previousControlledScheduleIdentityRef.current !== null && previousControlledScheduleIdentityRef.current !== controlledScheduleIdentity;
|
|
15962
|
-
const [previewTasksById, setPreviewTasksById] = (0,
|
|
15963
|
-
const previewNormalizedTasks = (0,
|
|
16026
|
+
const [previewTasksById, setPreviewTasksById] = (0, import_react21.useState)(/* @__PURE__ */ new Map());
|
|
16027
|
+
const previewNormalizedTasks = (0, import_react21.useMemo)(() => {
|
|
15964
16028
|
if (controlledScheduleChanged || previewTasksById.size === 0) return normalizedTasks;
|
|
15965
16029
|
return normalizedTasks.map((task) => previewTasksById.get(task.id) ?? task);
|
|
15966
16030
|
}, [controlledScheduleChanged, normalizedTasks, previewTasksById]);
|
|
15967
|
-
const criticalTaskIds = (0,
|
|
16031
|
+
const criticalTaskIds = (0, import_react21.useMemo)(() => {
|
|
15968
16032
|
if (!criticalPathMode) return /* @__PURE__ */ new Set();
|
|
15969
16033
|
const leafCritical = computeCriticalPath(previewNormalizedTasks, {
|
|
15970
16034
|
businessDays,
|
|
@@ -15972,7 +16036,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
15972
16036
|
});
|
|
15973
16037
|
return extendCriticalIdsToParents(leafCritical, previewNormalizedTasks);
|
|
15974
16038
|
}, [criticalPathMode, previewNormalizedTasks, businessDays, isCustomWeekend]);
|
|
15975
|
-
const dateRangeTasks = (0,
|
|
16039
|
+
const dateRangeTasks = (0, import_react21.useMemo)(() => {
|
|
15976
16040
|
if (isPlanFactMode) {
|
|
15977
16041
|
return getPlanFactRangeTasks(normalizedTasks);
|
|
15978
16042
|
}
|
|
@@ -15992,7 +16056,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
15992
16056
|
}
|
|
15993
16057
|
return rangeTasks;
|
|
15994
16058
|
}, [isPlanFactMode, normalizedTasks, showBaseline]);
|
|
15995
|
-
const dateRange = (0,
|
|
16059
|
+
const dateRange = (0, import_react21.useMemo)(
|
|
15996
16060
|
() => {
|
|
15997
16061
|
if (!isPlanFactMode && explicitDateRange) {
|
|
15998
16062
|
const exactDays = getDateRangeDays(explicitDateRange);
|
|
@@ -16002,21 +16066,21 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16002
16066
|
},
|
|
16003
16067
|
[dateRangeTasks, explicitDateRange, isPlanFactMode]
|
|
16004
16068
|
);
|
|
16005
|
-
const [validationResult, setValidationResult] = (0,
|
|
16006
|
-
const [cascadeOverrides, setCascadeOverrides] = (0,
|
|
16007
|
-
const gridWidth = (0,
|
|
16069
|
+
const [validationResult, setValidationResult] = (0, import_react21.useState)(null);
|
|
16070
|
+
const [cascadeOverrides, setCascadeOverrides] = (0, import_react21.useState)(/* @__PURE__ */ new Map());
|
|
16071
|
+
const gridWidth = (0, import_react21.useMemo)(
|
|
16008
16072
|
() => Math.round(dateRange.length * dayWidth),
|
|
16009
16073
|
[dateRange.length, dayWidth]
|
|
16010
16074
|
);
|
|
16011
16075
|
const renderGridWidth = Math.max(gridWidth, skeletonRowCount > 0 ? 720 : 0);
|
|
16012
|
-
const matrixWidth = (0,
|
|
16076
|
+
const matrixWidth = (0, import_react21.useMemo)(
|
|
16013
16077
|
() => matrixColumns.reduce((sum, column) => {
|
|
16014
16078
|
if (typeof column.width !== "number") return void 0;
|
|
16015
16079
|
return sum !== void 0 ? sum + column.width : void 0;
|
|
16016
16080
|
}, 0),
|
|
16017
16081
|
[matrixColumns]
|
|
16018
16082
|
);
|
|
16019
|
-
const visibleTasks = (0,
|
|
16083
|
+
const visibleTasks = (0, import_react21.useMemo)(() => {
|
|
16020
16084
|
const parentMap = new Map(normalizedTasks.map((t) => [t.id, t.parentId]));
|
|
16021
16085
|
function isAnyAncestorCollapsed(parentId) {
|
|
16022
16086
|
let current = parentId;
|
|
@@ -16035,7 +16099,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16035
16099
|
}
|
|
16036
16100
|
return tasks2;
|
|
16037
16101
|
}, [normalizedTasks, collapsedParentIds, filterMode, taskFilter, criticalPathMode, criticalTaskIds]);
|
|
16038
|
-
const monthStart = (0,
|
|
16102
|
+
const monthStart = (0, import_react21.useMemo)(() => {
|
|
16039
16103
|
if (dateRange.length === 0) {
|
|
16040
16104
|
return new Date(Date.UTC((/* @__PURE__ */ new Date()).getUTCFullYear(), (/* @__PURE__ */ new Date()).getUTCMonth(), 1));
|
|
16041
16105
|
}
|
|
@@ -16045,7 +16109,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16045
16109
|
}
|
|
16046
16110
|
return new Date(Date.UTC(firstDay.getUTCFullYear(), firstDay.getUTCMonth(), 1));
|
|
16047
16111
|
}, [dateRange, explicitDateRange, isPlanFactMode]);
|
|
16048
|
-
const activityLaneCounts = (0,
|
|
16112
|
+
const activityLaneCounts = (0, import_react21.useMemo)(() => {
|
|
16049
16113
|
const counts = /* @__PURE__ */ new Map();
|
|
16050
16114
|
for (const task of visibleTasks) {
|
|
16051
16115
|
if (task.activities && task.activities.length > 0) {
|
|
@@ -16054,7 +16118,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16054
16118
|
}
|
|
16055
16119
|
return counts;
|
|
16056
16120
|
}, [visibleTasks, monthStart, dayWidth]);
|
|
16057
|
-
const compositeRowLayout = (0,
|
|
16121
|
+
const compositeRowLayout = (0, import_react21.useMemo)(() => {
|
|
16058
16122
|
const compositeIds = new Set(normalizedTasks.filter((task) => task.composite).map((task) => task.id));
|
|
16059
16123
|
const tops = [];
|
|
16060
16124
|
const heights = [];
|
|
@@ -16067,15 +16131,15 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16067
16131
|
}
|
|
16068
16132
|
return { tops, heights, totalHeight: top };
|
|
16069
16133
|
}, [normalizedTasks, visibleTasks, effectiveRowHeight, activityLaneCounts]);
|
|
16070
|
-
const compositeParentsById = (0,
|
|
16134
|
+
const compositeParentsById = (0, import_react21.useMemo)(
|
|
16071
16135
|
() => new Map(normalizedTasks.filter((task) => task.composite).map((task) => [task.id, task])),
|
|
16072
16136
|
[normalizedTasks]
|
|
16073
16137
|
);
|
|
16074
|
-
const matchedTaskIds = (0,
|
|
16138
|
+
const matchedTaskIds = (0, import_react21.useMemo)(() => {
|
|
16075
16139
|
if (!taskFilter) return /* @__PURE__ */ new Set();
|
|
16076
16140
|
return new Set(visibleTasks.filter(taskFilter).map((task) => task.id));
|
|
16077
16141
|
}, [visibleTasks, taskFilter]);
|
|
16078
|
-
const taskListHighlightedTaskIds = (0,
|
|
16142
|
+
const taskListHighlightedTaskIds = (0, import_react21.useMemo)(() => {
|
|
16079
16143
|
if (filterMode === "hide") {
|
|
16080
16144
|
return /* @__PURE__ */ new Set();
|
|
16081
16145
|
}
|
|
@@ -16091,12 +16155,12 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16091
16155
|
}
|
|
16092
16156
|
return mergedHighlightedTaskIds;
|
|
16093
16157
|
}, [filterMode, highlightedTaskIds, matchedTaskIds, criticalPathMode, criticalTaskIds]);
|
|
16094
|
-
const totalGridHeight = (0,
|
|
16158
|
+
const totalGridHeight = (0, import_react21.useMemo)(
|
|
16095
16159
|
() => compositeRowLayout.totalHeight + Math.max(0, Math.floor(skeletonRowCount)) * effectiveRowHeight,
|
|
16096
16160
|
[compositeRowLayout.totalHeight, effectiveRowHeight, skeletonRowCount]
|
|
16097
16161
|
);
|
|
16098
16162
|
const timelineHeaderHeight = headerHeight + 1;
|
|
16099
|
-
const tableBodyMinHeight = (0,
|
|
16163
|
+
const tableBodyMinHeight = (0, import_react21.useMemo)(() => {
|
|
16100
16164
|
if (!isTableMatrixMode && !isPlanFactMode || containerHeight === void 0) {
|
|
16101
16165
|
return void 0;
|
|
16102
16166
|
}
|
|
@@ -16105,12 +16169,12 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16105
16169
|
}
|
|
16106
16170
|
return `calc(${containerHeight} - ${timelineHeaderHeight}px)`;
|
|
16107
16171
|
}, [containerHeight, isPlanFactMode, isTableMatrixMode, timelineHeaderHeight]);
|
|
16108
|
-
const todayIndex = (0,
|
|
16172
|
+
const todayIndex = (0, import_react21.useMemo)(() => {
|
|
16109
16173
|
const today = getTodayLocalUtcDate();
|
|
16110
16174
|
return dateRange.findIndex((day) => day.getTime() === today.getTime());
|
|
16111
16175
|
}, [dateRange]);
|
|
16112
16176
|
const todayInRange = todayIndex !== -1;
|
|
16113
|
-
const visibleTimelineMarkers = (0,
|
|
16177
|
+
const visibleTimelineMarkers = (0, import_react21.useMemo)(() => {
|
|
16114
16178
|
if (isTableMatrixMode || !timelineMarkers || timelineMarkers.length === 0 || dateRange.length === 0) {
|
|
16115
16179
|
return [];
|
|
16116
16180
|
}
|
|
@@ -16121,7 +16185,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16121
16185
|
return markerDate >= rangeStartMs && markerDate <= rangeEndMs;
|
|
16122
16186
|
});
|
|
16123
16187
|
}, [dateRange, isTableMatrixMode, timelineMarkers]);
|
|
16124
|
-
(0,
|
|
16188
|
+
(0, import_react21.useEffect)(() => {
|
|
16125
16189
|
if (isTableMatrixMode) return;
|
|
16126
16190
|
if (hasAutoScrolledToTodayRef.current) return;
|
|
16127
16191
|
const container = scrollContainerRef.current;
|
|
@@ -16135,7 +16199,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16135
16199
|
container.scrollLeft = Math.max(0, scrollLeft);
|
|
16136
16200
|
hasAutoScrolledToTodayRef.current = true;
|
|
16137
16201
|
}, [dateRange, dayWidth, isTableMatrixMode]);
|
|
16138
|
-
(0,
|
|
16202
|
+
(0, import_react21.useEffect)(() => {
|
|
16139
16203
|
const container = scrollContainerRef.current;
|
|
16140
16204
|
if (!container) return;
|
|
16141
16205
|
let frameId = null;
|
|
@@ -16202,7 +16266,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16202
16266
|
window.removeEventListener("resize", scheduleUpdate);
|
|
16203
16267
|
};
|
|
16204
16268
|
}, [dateRange.length, dayWidth, isPlanFactMode, showTaskList, taskListWidth, timelineHeaderHeight]);
|
|
16205
|
-
const scrollToToday = (0,
|
|
16269
|
+
const scrollToToday = (0, import_react21.useCallback)(() => {
|
|
16206
16270
|
if (isTableMatrixMode) return;
|
|
16207
16271
|
const container = scrollContainerRef.current;
|
|
16208
16272
|
if (!container || dateRange.length === 0) return;
|
|
@@ -16214,7 +16278,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16214
16278
|
const scrollLeft = Math.round(todayOffset + dayWidth / 2 - containerWidth * 0.3);
|
|
16215
16279
|
container.scrollTo({ left: Math.max(0, scrollLeft), behavior: "smooth" });
|
|
16216
16280
|
}, [dateRange, dayWidth, isTableMatrixMode]);
|
|
16217
|
-
const scrollToTask = (0,
|
|
16281
|
+
const scrollToTask = (0, import_react21.useCallback)((taskId) => {
|
|
16218
16282
|
if (isTableMatrixMode) {
|
|
16219
16283
|
const container2 = scrollContainerRef.current;
|
|
16220
16284
|
if (!container2) return;
|
|
@@ -16241,7 +16305,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16241
16305
|
const scrollLeft = Math.round(taskOffset - dayWidth * 2);
|
|
16242
16306
|
container.scrollTo({ left: Math.max(0, scrollLeft), behavior: "smooth" });
|
|
16243
16307
|
}, [dateRange, dayWidth, effectiveRowHeight, compositeRowLayout, isTableMatrixMode, tasks, visibleTasks]);
|
|
16244
|
-
const scrollToRow = (0,
|
|
16308
|
+
const scrollToRow = (0, import_react21.useCallback)((taskId, options = {}) => {
|
|
16245
16309
|
const container = scrollContainerRef.current;
|
|
16246
16310
|
if (!container) return;
|
|
16247
16311
|
const task = tasks.find((t) => t.id === taskId);
|
|
@@ -16270,9 +16334,9 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16270
16334
|
}
|
|
16271
16335
|
container.scrollTo({ top: scrollTop, behavior });
|
|
16272
16336
|
}, [effectiveRowHeight, compositeRowLayout, tasks, visibleTasks]);
|
|
16273
|
-
const [dragGuideLines, setDragGuideLines] = (0,
|
|
16274
|
-
const [draggedTaskOverride, setDraggedTaskOverride] = (0,
|
|
16275
|
-
(0,
|
|
16337
|
+
const [dragGuideLines, setDragGuideLines] = (0, import_react21.useState)(null);
|
|
16338
|
+
const [draggedTaskOverride, setDraggedTaskOverride] = (0, import_react21.useState)(null);
|
|
16339
|
+
(0, import_react21.useEffect)(() => {
|
|
16276
16340
|
const previousIdentity = previousControlledScheduleIdentityRef.current;
|
|
16277
16341
|
previousControlledScheduleIdentityRef.current = controlledScheduleIdentity;
|
|
16278
16342
|
if (previousIdentity === null || previousIdentity === controlledScheduleIdentity) {
|
|
@@ -16288,12 +16352,12 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16288
16352
|
setDraggedTaskOverride((current) => current === null ? current : null);
|
|
16289
16353
|
setDragGuideLines((current) => current === null ? current : null);
|
|
16290
16354
|
}, [controlledScheduleIdentity, previewPositionStore, activityPreviewStore, activityBlockStore, activityDragOwner, activityActivationStore]);
|
|
16291
|
-
(0,
|
|
16355
|
+
(0, import_react21.useEffect)(() => {
|
|
16292
16356
|
const result = validateDependencies(tasks);
|
|
16293
16357
|
setValidationResult(result);
|
|
16294
16358
|
onValidateDependencies?.(result);
|
|
16295
16359
|
}, [tasks, onValidateDependencies]);
|
|
16296
|
-
(0,
|
|
16360
|
+
(0, import_react21.useEffect)(() => () => {
|
|
16297
16361
|
if (clearSelectedTaskTimeoutRef.current !== null) {
|
|
16298
16362
|
window.clearTimeout(clearSelectedTaskTimeoutRef.current);
|
|
16299
16363
|
}
|
|
@@ -16303,7 +16367,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16303
16367
|
activityDragOwner.set(null);
|
|
16304
16368
|
activityActivationStore.setActiveKey(null);
|
|
16305
16369
|
}, [previewPositionStore, activityPreviewStore, activityBlockStore, activityDragOwner, activityActivationStore]);
|
|
16306
|
-
const handleTaskChange = (0,
|
|
16370
|
+
const handleTaskChange = (0, import_react21.useCallback)((updatedTasks, durationEdit) => {
|
|
16307
16371
|
let updatedTask = updatedTasks[0];
|
|
16308
16372
|
if (!updatedTask) return;
|
|
16309
16373
|
const originalTask = normalizedTasks.find((t) => t.id === updatedTask.id);
|
|
@@ -16439,7 +16503,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16439
16503
|
onTasksChange?.(cascadedTasks);
|
|
16440
16504
|
}
|
|
16441
16505
|
}, [tasks, normalizedTasks, onTasksChange, onScheduleIntent, disableConstraints, editingTaskId, businessDays, isCustomWeekend, onSubtreeScaleResult]);
|
|
16442
|
-
const handleTaskDurationChange = (0,
|
|
16506
|
+
const handleTaskDurationChange = (0, import_react21.useCallback)((task, duration) => {
|
|
16443
16507
|
const updatedTask = {
|
|
16444
16508
|
...task,
|
|
16445
16509
|
endDate: task.type === "milestone" ? task.startDate : buildTaskRangeFromStart(
|
|
@@ -16451,7 +16515,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16451
16515
|
};
|
|
16452
16516
|
handleTaskChange([updatedTask], { duration, anchor: "start" });
|
|
16453
16517
|
}, [businessDays, handleTaskChange, isCustomWeekend]);
|
|
16454
|
-
const handleDelete = (0,
|
|
16518
|
+
const handleDelete = (0, import_react21.useCallback)((taskId) => {
|
|
16455
16519
|
const toDelete = /* @__PURE__ */ new Set([taskId]);
|
|
16456
16520
|
function collectDescendants(parentId) {
|
|
16457
16521
|
const children = getChildren(parentId, tasks);
|
|
@@ -16476,10 +16540,10 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16476
16540
|
}
|
|
16477
16541
|
toDelete.forEach((id) => onDelete?.(id));
|
|
16478
16542
|
}, [tasks, onTasksChange, onDelete]);
|
|
16479
|
-
const handleInsertAfter = (0,
|
|
16543
|
+
const handleInsertAfter = (0, import_react21.useCallback)((taskId, newTask) => {
|
|
16480
16544
|
onInsertAfter?.(taskId, newTask);
|
|
16481
16545
|
}, [onInsertAfter]);
|
|
16482
|
-
const handleReorder = (0,
|
|
16546
|
+
const handleReorder = (0, import_react21.useCallback)((reorderedTasks, movedTaskId, inferredParentId) => {
|
|
16483
16547
|
let updated = reorderedTasks;
|
|
16484
16548
|
if (movedTaskId) {
|
|
16485
16549
|
updated = updated.map((t) => {
|
|
@@ -16500,7 +16564,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16500
16564
|
}
|
|
16501
16565
|
onTasksChange?.(normalized);
|
|
16502
16566
|
}, [onTasksChange, onReorder, businessDays, isCustomWeekend]);
|
|
16503
|
-
const dependencyOverrides = (0,
|
|
16567
|
+
const dependencyOverrides = (0, import_react21.useMemo)(() => {
|
|
16504
16568
|
if (controlledScheduleChanged) return /* @__PURE__ */ new Map();
|
|
16505
16569
|
const map = new Map(cascadeOverrides);
|
|
16506
16570
|
if (draggedTaskOverride) {
|
|
@@ -16511,7 +16575,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16511
16575
|
}
|
|
16512
16576
|
return map;
|
|
16513
16577
|
}, [cascadeOverrides, controlledScheduleChanged, draggedTaskOverride]);
|
|
16514
|
-
const handleCascadeProgress = (0,
|
|
16578
|
+
const handleCascadeProgress = (0, import_react21.useCallback)((overrides, previewTasks = []) => {
|
|
16515
16579
|
previewPositionStore.setPositions(overrides);
|
|
16516
16580
|
const renderedTaskIds = renderedTaskIdsRef.current;
|
|
16517
16581
|
const renderedOverrides = /* @__PURE__ */ new Map();
|
|
@@ -16526,22 +16590,22 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16526
16590
|
return arePreviewTaskMapsEqual(current, next) ? current : next;
|
|
16527
16591
|
});
|
|
16528
16592
|
}, [previewPositionStore]);
|
|
16529
|
-
const previewVisibleTasks = (0,
|
|
16593
|
+
const previewVisibleTasks = (0, import_react21.useMemo)(() => {
|
|
16530
16594
|
if (controlledScheduleChanged || previewTasksById.size === 0) return visibleTasks;
|
|
16531
16595
|
return visibleTasks.map((task) => previewTasksById.get(task.id) ?? task);
|
|
16532
16596
|
}, [controlledScheduleChanged, visibleTasks, previewTasksById]);
|
|
16533
|
-
const visibleTaskIndexMap = (0,
|
|
16597
|
+
const visibleTaskIndexMap = (0, import_react21.useMemo)(
|
|
16534
16598
|
() => new Map(visibleTasks.map((task, index) => [task.id, index])),
|
|
16535
16599
|
[visibleTasks]
|
|
16536
16600
|
);
|
|
16537
|
-
const forcedRenderedTaskIds = (0,
|
|
16601
|
+
const forcedRenderedTaskIds = (0, import_react21.useMemo)(() => {
|
|
16538
16602
|
const ids = /* @__PURE__ */ new Set();
|
|
16539
16603
|
if (draggedTaskOverride) {
|
|
16540
16604
|
ids.add(draggedTaskOverride.taskId);
|
|
16541
16605
|
}
|
|
16542
16606
|
return ids;
|
|
16543
16607
|
}, [draggedTaskOverride]);
|
|
16544
|
-
const horizontalWindow = (0,
|
|
16608
|
+
const horizontalWindow = (0, import_react21.useMemo)(() => {
|
|
16545
16609
|
const width = scrollViewport.viewportWidth;
|
|
16546
16610
|
if (width <= 0) return void 0;
|
|
16547
16611
|
const left = scrollViewport.chartScrollLeft;
|
|
@@ -16550,7 +16614,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16550
16614
|
endPx: left + width + HORIZONTAL_WINDOW_OVERSCAN_PX
|
|
16551
16615
|
};
|
|
16552
16616
|
}, [scrollViewport.chartScrollLeft, scrollViewport.viewportWidth]);
|
|
16553
|
-
const visibleTaskWindowIndices = (0,
|
|
16617
|
+
const visibleTaskWindowIndices = (0, import_react21.useMemo)(() => {
|
|
16554
16618
|
const totalTasks = visibleTasks.length;
|
|
16555
16619
|
if (totalTasks === 0) {
|
|
16556
16620
|
return [];
|
|
@@ -16592,7 +16656,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16592
16656
|
}
|
|
16593
16657
|
return Array.from(indices).sort((left, right) => left - right);
|
|
16594
16658
|
}, [compositeRowLayout, forceFullRenderForPrint, forcedRenderedTaskIds, scrollViewport.scrollTop, scrollViewport.viewportHeight, visibleTaskIndexMap, visibleTasks.length]);
|
|
16595
|
-
const visiblePlanFactDateIndices = (0,
|
|
16659
|
+
const visiblePlanFactDateIndices = (0, import_react21.useMemo)(() => {
|
|
16596
16660
|
if (forceFullRenderForPrint) {
|
|
16597
16661
|
return void 0;
|
|
16598
16662
|
}
|
|
@@ -16605,37 +16669,37 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16605
16669
|
(_, index) => window2.start + index
|
|
16606
16670
|
);
|
|
16607
16671
|
}, [dateRange.length, forceFullRenderForPrint, isPlanFactMode, planFactDateWindow]);
|
|
16608
|
-
const renderedChartTasks = (0,
|
|
16672
|
+
const renderedChartTasks = (0, import_react21.useMemo)(
|
|
16609
16673
|
() => visibleTaskWindowIndices.map((index) => {
|
|
16610
16674
|
const task = previewVisibleTasks[index];
|
|
16611
16675
|
return task ? { index, task } : null;
|
|
16612
16676
|
}).filter((entry) => entry !== null),
|
|
16613
16677
|
[previewVisibleTasks, visibleTaskWindowIndices]
|
|
16614
16678
|
);
|
|
16615
|
-
const renderedDependencyTasks = (0,
|
|
16679
|
+
const renderedDependencyTasks = (0, import_react21.useMemo)(
|
|
16616
16680
|
() => renderedChartTasks.map(({ task }) => task),
|
|
16617
16681
|
[renderedChartTasks]
|
|
16618
16682
|
);
|
|
16619
|
-
renderedTaskIdsRef.current = (0,
|
|
16683
|
+
renderedTaskIdsRef.current = (0, import_react21.useMemo)(
|
|
16620
16684
|
() => new Set(renderedChartTasks.map(({ task }) => task.id)),
|
|
16621
16685
|
[renderedChartTasks]
|
|
16622
16686
|
);
|
|
16623
|
-
const handleCascade = (0,
|
|
16687
|
+
const handleCascade = (0, import_react21.useCallback)((cascadedTasks) => {
|
|
16624
16688
|
if (!onScheduleIntent) {
|
|
16625
16689
|
onTasksChange?.(cascadedTasks);
|
|
16626
16690
|
}
|
|
16627
16691
|
}, [onScheduleIntent, onTasksChange]);
|
|
16628
|
-
const handleTaskSelect = (0,
|
|
16692
|
+
const handleTaskSelect = (0, import_react21.useCallback)((taskId) => {
|
|
16629
16693
|
setSelectedTaskId(taskId);
|
|
16630
16694
|
}, []);
|
|
16631
|
-
const hoveredRowElementsRef = (0,
|
|
16632
|
-
const clearHoveredRows = (0,
|
|
16695
|
+
const hoveredRowElementsRef = (0, import_react21.useRef)([]);
|
|
16696
|
+
const clearHoveredRows = (0, import_react21.useCallback)(() => {
|
|
16633
16697
|
for (const element of hoveredRowElementsRef.current) {
|
|
16634
16698
|
element.classList.remove("gantt-tl-row-hovered", "gantt-tr-row-hovered", "gantt-mx-row-hovered", "gantt-pf-row-hovered");
|
|
16635
16699
|
}
|
|
16636
16700
|
hoveredRowElementsRef.current = [];
|
|
16637
16701
|
}, []);
|
|
16638
|
-
const applyHoveredRows = (0,
|
|
16702
|
+
const applyHoveredRows = (0, import_react21.useCallback)((taskId) => {
|
|
16639
16703
|
const root = scrollContentRef.current;
|
|
16640
16704
|
if (!root) return;
|
|
16641
16705
|
clearHoveredRows();
|
|
@@ -16658,7 +16722,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16658
16722
|
}
|
|
16659
16723
|
hoveredRowElementsRef.current = nextHoveredRows;
|
|
16660
16724
|
}, [clearHoveredRows]);
|
|
16661
|
-
const handleSharedRowHover = (0,
|
|
16725
|
+
const handleSharedRowHover = (0, import_react21.useCallback)((event) => {
|
|
16662
16726
|
const target = event.target;
|
|
16663
16727
|
const row = target.closest("[data-gantt-task-row-id]");
|
|
16664
16728
|
const taskId = row?.dataset.ganttTaskRowId;
|
|
@@ -16688,28 +16752,28 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16688
16752
|
return next;
|
|
16689
16753
|
});
|
|
16690
16754
|
});
|
|
16691
|
-
const lastCompositeBarToggleRef = (0,
|
|
16755
|
+
const lastCompositeBarToggleRef = (0, import_react21.useRef)(null);
|
|
16692
16756
|
const handleCompositeBarToggle = (taskId, source) => {
|
|
16693
16757
|
const now = Date.now();
|
|
16694
16758
|
if (source === "click" && lastCompositeBarToggleRef.current?.source === "release" && lastCompositeBarToggleRef.current.id === taskId && now - lastCompositeBarToggleRef.current.time < 150) return;
|
|
16695
16759
|
lastCompositeBarToggleRef.current = { id: taskId, time: now, source };
|
|
16696
16760
|
handleToggleCollapse(taskId);
|
|
16697
16761
|
};
|
|
16698
|
-
const allParentIds = (0,
|
|
16762
|
+
const allParentIds = (0, import_react21.useMemo)(() => {
|
|
16699
16763
|
const taskIds = new Set(normalizedTasks.map((task) => task.id));
|
|
16700
16764
|
return new Set(normalizedTasks.map((task) => task.parentId).filter((parentId) => Boolean(parentId && taskIds.has(parentId))));
|
|
16701
16765
|
}, [normalizedTasks]);
|
|
16702
|
-
const handleCollapseAll = (0,
|
|
16766
|
+
const handleCollapseAll = (0, import_react21.useCallback)(() => {
|
|
16703
16767
|
if (externalCollapsedParentIds) return;
|
|
16704
16768
|
setInternalCollapsedParentIds(allParentIds);
|
|
16705
16769
|
setExpandedCompositeIds(/* @__PURE__ */ new Set());
|
|
16706
16770
|
}, [allParentIds, externalCollapsedParentIds]);
|
|
16707
|
-
const handleExpandAll = (0,
|
|
16771
|
+
const handleExpandAll = (0, import_react21.useCallback)(() => {
|
|
16708
16772
|
if (externalCollapsedParentIds) return;
|
|
16709
16773
|
setInternalCollapsedParentIds(/* @__PURE__ */ new Set());
|
|
16710
16774
|
setExpandedCompositeIds(new Set(normalizedTasks.filter((task) => task.composite).map((task) => task.id)));
|
|
16711
16775
|
}, [externalCollapsedParentIds, normalizedTasks]);
|
|
16712
|
-
const exportToPdf = (0,
|
|
16776
|
+
const exportToPdf = (0, import_react21.useCallback)(async (options) => {
|
|
16713
16777
|
const sourceContainer = containerRef.current;
|
|
16714
16778
|
if (!sourceContainer || typeof window === "undefined" || typeof document === "undefined") {
|
|
16715
16779
|
return;
|
|
@@ -16759,7 +16823,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16759
16823
|
}
|
|
16760
16824
|
}
|
|
16761
16825
|
}, [isTableMatrixMode, showTaskList, showChart]);
|
|
16762
|
-
(0,
|
|
16826
|
+
(0, import_react21.useImperativeHandle)(
|
|
16763
16827
|
ref,
|
|
16764
16828
|
() => ({
|
|
16765
16829
|
scrollToToday,
|
|
@@ -16782,7 +16846,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16782
16846
|
}
|
|
16783
16847
|
return depth;
|
|
16784
16848
|
}
|
|
16785
|
-
const handlePromoteTask = (0,
|
|
16849
|
+
const handlePromoteTask = (0, import_react21.useCallback)((taskId) => {
|
|
16786
16850
|
if (onPromoteTask) {
|
|
16787
16851
|
onPromoteTask(taskId);
|
|
16788
16852
|
return;
|
|
@@ -16814,7 +16878,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16814
16878
|
], businessDays, isCustomWeekend);
|
|
16815
16879
|
onTasksChange?.(reorderedTasks);
|
|
16816
16880
|
}, [tasks, onTasksChange, onPromoteTask, businessDays, isCustomWeekend]);
|
|
16817
|
-
const handleDemoteTask = (0,
|
|
16881
|
+
const handleDemoteTask = (0, import_react21.useCallback)((taskId, newParentId) => {
|
|
16818
16882
|
if (onDemoteTask) {
|
|
16819
16883
|
onDemoteTask(taskId, newParentId);
|
|
16820
16884
|
return;
|
|
@@ -16855,7 +16919,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16855
16919
|
};
|
|
16856
16920
|
onTasksChange?.([updatedDemotedTask]);
|
|
16857
16921
|
}, [tasks, onTasksChange, onDemoteTask]);
|
|
16858
|
-
const handleUngroupTask = (0,
|
|
16922
|
+
const handleUngroupTask = (0, import_react21.useCallback)((taskId) => {
|
|
16859
16923
|
if (onUngroupTask) {
|
|
16860
16924
|
onUngroupTask(taskId);
|
|
16861
16925
|
return;
|
|
@@ -16880,9 +16944,9 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16880
16944
|
onTasksChange?.(changedTasks);
|
|
16881
16945
|
}
|
|
16882
16946
|
}, [tasks, onTasksChange, onUngroupTask]);
|
|
16883
|
-
const panStateRef = (0,
|
|
16947
|
+
const panStateRef = (0, import_react21.useRef)(null);
|
|
16884
16948
|
const PAN_SUPPRESS_PX = 3;
|
|
16885
|
-
const handlePanStart = (0,
|
|
16949
|
+
const handlePanStart = (0, import_react21.useCallback)((e) => {
|
|
16886
16950
|
if (e.button !== 0) return;
|
|
16887
16951
|
const target = e.target;
|
|
16888
16952
|
if (!target.closest(".gantt-tr-activityBar")) {
|
|
@@ -16910,7 +16974,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16910
16974
|
container.style.cursor = "grabbing";
|
|
16911
16975
|
e.preventDefault();
|
|
16912
16976
|
}, [activityActivationStore]);
|
|
16913
|
-
(0,
|
|
16977
|
+
(0, import_react21.useEffect)(() => {
|
|
16914
16978
|
const flushPanMove = () => {
|
|
16915
16979
|
const pan = panStateRef.current;
|
|
16916
16980
|
if (!pan?.active) return;
|
|
@@ -16960,7 +17024,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
16960
17024
|
window.removeEventListener("mouseup", handlePanEnd);
|
|
16961
17025
|
};
|
|
16962
17026
|
}, []);
|
|
16963
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
17027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BarContrastContext.Provider, { value: barContrast, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
16964
17028
|
"div",
|
|
16965
17029
|
{
|
|
16966
17030
|
ref: containerRef,
|
|
@@ -17371,16 +17435,16 @@ function TaskGanttChartInner(props, ref) {
|
|
|
17371
17435
|
}
|
|
17372
17436
|
)
|
|
17373
17437
|
}
|
|
17374
|
-
);
|
|
17438
|
+
) });
|
|
17375
17439
|
}
|
|
17376
|
-
var TaskGanttChart = (0,
|
|
17377
|
-
var GanttChart = (0,
|
|
17440
|
+
var TaskGanttChart = (0, import_react21.forwardRef)(TaskGanttChartInner);
|
|
17441
|
+
var GanttChart = (0, import_react21.forwardRef)(GanttChartInner);
|
|
17378
17442
|
GanttChart.displayName = "GanttChart";
|
|
17379
17443
|
|
|
17380
17444
|
// src/components/ui/Button.tsx
|
|
17381
|
-
var
|
|
17445
|
+
var import_react22 = __toESM(require("react"));
|
|
17382
17446
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
17383
|
-
var Button =
|
|
17447
|
+
var Button = import_react22.default.forwardRef(
|
|
17384
17448
|
({ className, variant = "default", size = "default", children, ...props }, ref) => {
|
|
17385
17449
|
const classes = [
|
|
17386
17450
|
"gantt-btn",
|