@baishuyun/ui-base 6.5.0 → 6.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Gantt/GanttChart/index.js +1 -1
- package/dist/Gantt/{GanttChart-CnIWe_wk.js → GanttChart-DbI1fvxe.js} +613 -543
- package/dist/Gantt/index.js +1 -1
- package/dist/Select/{Select-B0r9VgF6.js → Select-DTximYG6.js} +35 -34
- package/dist/Select/index.js +1 -1
- package/dist/components/Gantt/GanttChart/GanttTimelineHeader/HeaderStickyTopLabel.d.ts +9 -0
- package/dist/components/Gantt/GanttChart/utils/constants.d.ts +1 -1
- package/dist/components/Gantt/types.internal.d.ts +2 -0
- package/dist/components/Select/OptionList/OptionList.d.ts +1 -1
- package/dist/components/Select/interface.d.ts +5 -0
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -5,25 +5,26 @@ import { a as r, f as i, g as a, i as o, m as s, n as c, o as l, r as u } from "
|
|
|
5
5
|
import { t as d } from "./GanttHighlightContext-CtT98ZnK.js";
|
|
6
6
|
import { n as f, r as p } from "./highlightTarget-DtCe7zto.js";
|
|
7
7
|
import { a as m, d as h, i as g, n as _, r as v, t as y, u as b } from "./timelineViewConfig-Dl3AXO45.js";
|
|
8
|
-
import { _ as x, a as S, b as C, c as w, d as T, f as ee, g as E, h as D, i as O, l as k, m as A, o as j, p as M, r as
|
|
9
|
-
import { r as
|
|
10
|
-
import { isFunction as
|
|
8
|
+
import { _ as x, a as S, b as C, c as w, d as T, f as ee, g as E, h as D, i as O, l as k, m as A, o as j, p as M, r as te, s as ne, t as N, u as re, v as ie, x as P, y as ae } from "./collapseKeys-1N9ci2oJ.js";
|
|
9
|
+
import { r as oe, t as F } from "./GanttToolBar-8jPQ9BAG.js";
|
|
10
|
+
import { isFunction as se, isNumber as ce, isString as I } from "lodash-es";
|
|
11
11
|
import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
12
|
-
import B, { forwardRef as V, memo as H, useCallback as U, useEffect as W, useImperativeHandle as
|
|
13
|
-
import
|
|
14
|
-
import { useDocumentVisibility as
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
12
|
+
import B, { forwardRef as V, memo as H, useCallback as U, useEffect as W, useImperativeHandle as G, useLayoutEffect as le, useMemo as K, useRef as q, useState as J } from "react";
|
|
13
|
+
import Y from "clsx";
|
|
14
|
+
import { useDocumentVisibility as ue, useSize as de } from "ahooks";
|
|
15
|
+
import { AnimatePresence as fe, motion as X } from "motion/react";
|
|
16
|
+
import { createContext as pe, useContextSelector as me } from "use-context-selector";
|
|
17
|
+
import he from "dayjs";
|
|
18
|
+
import ge from "dayjs/plugin/isoWeek";
|
|
19
|
+
import { useVirtualizer as _e } from "@tanstack/react-virtual";
|
|
20
|
+
import ve from "dayjs/plugin/quarterOfYear";
|
|
21
|
+
import { OverlayScrollbars as ye } from "overlayscrollbars";
|
|
21
22
|
//#region src/components/Gantt/GanttChart/utils/dragEngine.ts
|
|
22
|
-
var
|
|
23
|
+
var be = (e) => e?.type === "task" && e?.draggable !== !1 && !e?.invalid, xe = {
|
|
23
24
|
canMove: !1,
|
|
24
25
|
canResizeStart: !1,
|
|
25
26
|
canResizeEnd: !1
|
|
26
|
-
},
|
|
27
|
+
}, Se = (e) => !e || e.invalid || e.type === "summary" || e.draggable === !1 ? xe : e.dragPermission ? {
|
|
27
28
|
canMove: e.dragPermission.canMove === !0,
|
|
28
29
|
canResizeStart: e.dragPermission.canResizeStart === !0,
|
|
29
30
|
canResizeEnd: e.dragPermission.canResizeEnd === !0
|
|
@@ -31,14 +32,14 @@ var ve = (e) => e?.type === "task" && e?.draggable !== !1 && !e?.invalid, ye = {
|
|
|
31
32
|
canMove: !0,
|
|
32
33
|
canResizeStart: !0,
|
|
33
34
|
canResizeEnd: !0
|
|
34
|
-
},
|
|
35
|
+
}, Ce = (e, t) => be(e) ? e?.dragPermission ? t === "move" ? e.dragPermission.canMove === !0 : t === "resize-start" ? e.dragPermission.canResizeStart === !0 : t === "resize-end" ? e.dragPermission.canResizeEnd === !0 : !1 : !0 : !1, we = (e, t) => !t || Math.abs(e) < Math.min(5, t) ? 0 : Math.round(e / t), Te = (e, t) => we(e, t), Ee = (e, t, n = "round") => {
|
|
35
36
|
if (!t || !Number.isFinite(e)) return e;
|
|
36
|
-
let r =
|
|
37
|
+
let r = P(e), i = he(r).startOf("day").valueOf(), a = (r - i) / t, o;
|
|
37
38
|
return o = n === "floor" ? Math.floor(a) : n === "ceil" ? Math.ceil(a) : Math.round(a), ie(i + o * t);
|
|
38
|
-
},
|
|
39
|
+
}, De = (e, t, n) => ({
|
|
39
40
|
startMs: e + n,
|
|
40
41
|
endMs: t + n
|
|
41
|
-
}),
|
|
42
|
+
}), Oe = ({ startMs: e, endMs: t, deltaMs: n, edge: r, minDurationMs: i }) => {
|
|
42
43
|
if (r === "start") {
|
|
43
44
|
let r = t - i;
|
|
44
45
|
return {
|
|
@@ -51,12 +52,12 @@ var ve = (e) => e?.type === "task" && e?.draggable !== !1 && !e?.invalid, ye = {
|
|
|
51
52
|
startMs: e,
|
|
52
53
|
endMs: Math.max(t + n, a)
|
|
53
54
|
};
|
|
54
|
-
},
|
|
55
|
+
}, ke = (e, t, n, r) => {
|
|
55
56
|
let i = e.originStartMs, a = e.originEndMs, o = e.originAnchorPx ?? e.originLeftPx, c = e.originAnchorMs ?? n.timeAtX(o), l = o + t, u = n.timeAtX(l);
|
|
56
57
|
if (e.dragMode === "move") {
|
|
57
58
|
let t = Math.round((u - c) / s) * s;
|
|
58
59
|
i = e.originStartMs + t, a = e.originEndMs + t;
|
|
59
|
-
} else e.dragMode === "resize-start" ? (i =
|
|
60
|
+
} else e.dragMode === "resize-start" ? (i = Ee(u, r, "round"), a = e.originEndMs, a - i < r && (i = a - r)) : (a = Ee(u, r, "round"), i = e.originStartMs, a - i < r && (a = i + r));
|
|
60
61
|
return {
|
|
61
62
|
deltaUnits: e.dragMode === "resize-end" ? Math.round((a - e.originEndMs) / r) : Math.round((i - e.originStartMs) / r),
|
|
62
63
|
previewStartMs: i,
|
|
@@ -64,7 +65,7 @@ var ve = (e) => e?.type === "task" && e?.draggable !== !1 && !e?.invalid, ye = {
|
|
|
64
65
|
previewLeftPx: e.dragMode === "resize-end" ? e.originLeftPx : l
|
|
65
66
|
};
|
|
66
67
|
};
|
|
67
|
-
function
|
|
68
|
+
function Ae(e) {
|
|
68
69
|
let t = {
|
|
69
70
|
taskId: String(e.item.id),
|
|
70
71
|
newStart: e.startMs,
|
|
@@ -95,14 +96,14 @@ function Oe(e) {
|
|
|
95
96
|
deltaDays: n.deltaDays
|
|
96
97
|
};
|
|
97
98
|
}
|
|
98
|
-
var
|
|
99
|
+
var je = (e) => e && se(e.then) ? e : Promise.resolve(e);
|
|
99
100
|
//#endregion
|
|
100
101
|
//#region src/components/Gantt/GanttChart/hooks/useEdgeScroll.tsx
|
|
101
|
-
function
|
|
102
|
-
return e < 0 ? t * 10 : e >=
|
|
102
|
+
function Me(e, t) {
|
|
103
|
+
return e < 0 ? t * 10 : e >= 20 ? 0 : t * (2 + 8 * (1 - e / 20));
|
|
103
104
|
}
|
|
104
|
-
function
|
|
105
|
-
let n =
|
|
105
|
+
function Ne(e, t) {
|
|
106
|
+
let n = q(null), r = q(0), i = U(() => {
|
|
106
107
|
n.current !== null && cancelAnimationFrame(n.current), n.current = null, r.current = 0;
|
|
107
108
|
}, []);
|
|
108
109
|
W(() => () => {
|
|
@@ -125,7 +126,7 @@ function je(e, t) {
|
|
|
125
126
|
startEdgeDetection: U((t, n) => {
|
|
126
127
|
let o = e.current;
|
|
127
128
|
if (!o) return 0;
|
|
128
|
-
let s = n ?? o.getBoundingClientRect(), c = t - s.left, l = s.right - t, u = c <
|
|
129
|
+
let s = n ?? o.getBoundingClientRect(), c = t - s.left, l = s.right - t, u = c < 20 ? Me(c, -1) : l < 20 ? Me(l, 1) : 0;
|
|
129
130
|
return r.current = u, u === 0 ? i() : a(), u;
|
|
130
131
|
}, [
|
|
131
132
|
e,
|
|
@@ -137,13 +138,13 @@ function je(e, t) {
|
|
|
137
138
|
}
|
|
138
139
|
//#endregion
|
|
139
140
|
//#region src/components/Gantt/GanttChart/hooks/useGanttDrag.tsx
|
|
140
|
-
function
|
|
141
|
-
let d = h(t), f = m(t), p = f / s * e, g =
|
|
141
|
+
function Pe({ pixelsPerDay: e, viewMode: t, timelineCoords: n, onTaskTimeChange: i, containerRef: c, onDragInteractionChange: u }) {
|
|
142
|
+
let d = h(t), f = m(t), p = f / s * e, g = q(n);
|
|
142
143
|
g.current = n;
|
|
143
|
-
let [_, v] =
|
|
144
|
+
let [_, v] = J({}), [y, b] = J(null), x = q(null), S = q({
|
|
144
145
|
shouldSuppressClick: !1,
|
|
145
146
|
at: 0
|
|
146
|
-
}), C =
|
|
147
|
+
}), C = q(0), w = q(null), { startEdgeDetection: T, stopEdgeScroll: ee } = Ne(c ?? { current: null }, w), E = q({});
|
|
147
148
|
W(() => {
|
|
148
149
|
x.current = y;
|
|
149
150
|
}, [y]), W(() => () => {
|
|
@@ -167,7 +168,7 @@ function Me({ pixelsPerDay: e, viewMode: t, timelineCoords: n, onTaskTimeChange:
|
|
|
167
168
|
at: 0
|
|
168
169
|
};
|
|
169
170
|
}, []), k = U((e, t, n, r, i = 1) => {
|
|
170
|
-
if (!
|
|
171
|
+
if (!Ce(t, r) || t.invalid) return;
|
|
171
172
|
e.preventDefault(), e.stopPropagation();
|
|
172
173
|
let a = c?.current, o = a?.scrollLeft ?? 0, s = a?.getBoundingClientRect(), l = s ? e.clientX - s.left : 0, d = t.endMs ?? 0, f = t.startMs ?? 0, p = Math.max(1, i), m = r === "resize-end" ? n + p : n, h = l - (m - o), _ = {
|
|
173
174
|
taskId: t.id,
|
|
@@ -214,7 +215,7 @@ function Me({ pixelsPerDay: e, viewMode: t, timelineCoords: n, onTaskTimeChange:
|
|
|
214
215
|
let m = l - r.originAnchorPx;
|
|
215
216
|
if (!d) {
|
|
216
217
|
let e = {
|
|
217
|
-
...
|
|
218
|
+
...ke(r, m, s, f),
|
|
218
219
|
previewLeftPx: u
|
|
219
220
|
};
|
|
220
221
|
if (e.deltaUnits === r.deltaUnits && e.previewLeftPx === r.previewLeftPx && e.previewStartMs === r.previewStartMs && e.previewEndMs === r.previewEndMs) return;
|
|
@@ -225,16 +226,16 @@ function Me({ pixelsPerDay: e, viewMode: t, timelineCoords: n, onTaskTimeChange:
|
|
|
225
226
|
x.current = t, b(t);
|
|
226
227
|
return;
|
|
227
228
|
}
|
|
228
|
-
let h =
|
|
229
|
+
let h = Te(m, p), _ = {
|
|
229
230
|
...r,
|
|
230
231
|
deltaUnits: h,
|
|
231
232
|
previewLeftPx: u
|
|
232
233
|
};
|
|
233
234
|
if (r.dragMode === "move") {
|
|
234
|
-
let e =
|
|
235
|
+
let e = De(r.originStartMs, r.originEndMs, h * f);
|
|
235
236
|
_.previewStartMs = e.startMs, _.previewEndMs = e.endMs;
|
|
236
237
|
} else {
|
|
237
|
-
let e =
|
|
238
|
+
let e = Oe({
|
|
238
239
|
startMs: r.originStartMs,
|
|
239
240
|
endMs: r.originEndMs,
|
|
240
241
|
deltaMs: h * f,
|
|
@@ -267,7 +268,7 @@ function Me({ pixelsPerDay: e, viewMode: t, timelineCoords: n, onTaskTimeChange:
|
|
|
267
268
|
at: Date.now()
|
|
268
269
|
};
|
|
269
270
|
let o = r;
|
|
270
|
-
if (!
|
|
271
|
+
if (!Ce(n.item, n.dragMode) || !o || !i) {
|
|
271
272
|
x.current = null, b(null);
|
|
272
273
|
return;
|
|
273
274
|
}
|
|
@@ -294,15 +295,15 @@ function Me({ pixelsPerDay: e, viewMode: t, timelineCoords: n, onTaskTimeChange:
|
|
|
294
295
|
};
|
|
295
296
|
let m, g;
|
|
296
297
|
if (d) if (n.dragMode === "move") {
|
|
297
|
-
let e =
|
|
298
|
+
let e = Ee(n.previewStartMs, f, "round"), t = e - n.previewStartMs;
|
|
298
299
|
m = e, g = n.previewEndMs + t;
|
|
299
|
-
} else n.dragMode === "resize-start" ? (m =
|
|
300
|
+
} else n.dragMode === "resize-start" ? (m = Ee(n.previewStartMs, f, "round"), g = n.previewEndMs) : (m = n.previewStartMs, g = Ee(n.previewEndMs, f, "round"));
|
|
300
301
|
else {
|
|
301
302
|
let e = Number.isFinite(n.item.rawStartMs) && Number.isFinite(n.item.baseStartMs) && Number.isFinite(n.previewStartMs), t = Number.isFinite(n.item.rawEndMs) && Number.isFinite(n.item.baseEndMs) && Number.isFinite(n.previewEndMs), r = e ? Math.round((n.previewStartMs - (n.item.baseStartMs ?? 0)) / s) : 0, i = t ? Math.round((n.previewEndMs - (n.item.baseEndMs ?? 0)) / s) : 0;
|
|
302
303
|
m = e ? (n.item.rawStartMs ?? 0) + r * s : n.item.rawStartMs ?? 0, g = t ? (n.item.rawEndMs ?? 0) + i * s : n.item.rawEndMs ?? 0;
|
|
303
304
|
}
|
|
304
305
|
let _;
|
|
305
|
-
_ = h(t) ?
|
|
306
|
+
_ = h(t) ? Ae({
|
|
306
307
|
item: n.item,
|
|
307
308
|
startMs: m,
|
|
308
309
|
endMs: g,
|
|
@@ -310,7 +311,7 @@ function Me({ pixelsPerDay: e, viewMode: t, timelineCoords: n, onTaskTimeChange:
|
|
|
310
311
|
snapUnitMs: f,
|
|
311
312
|
changeType: n.dragMode,
|
|
312
313
|
viewMode: t
|
|
313
|
-
}) :
|
|
314
|
+
}) : Ae({
|
|
314
315
|
item: n.item,
|
|
315
316
|
startMs: m,
|
|
316
317
|
endMs: g,
|
|
@@ -319,7 +320,7 @@ function Me({ pixelsPerDay: e, viewMode: t, timelineCoords: n, onTaskTimeChange:
|
|
|
319
320
|
snapUnitMs: f,
|
|
320
321
|
changeType: n.dragMode,
|
|
321
322
|
viewMode: t
|
|
322
|
-
}),
|
|
323
|
+
}), je(i(_)).catch((e) => {
|
|
323
324
|
console.error("[GanttChart] onTaskTimeChange rejected", e), E.current[c]?.opId === l && v((e) => {
|
|
324
325
|
let t = { ...e };
|
|
325
326
|
return delete t[c], t;
|
|
@@ -363,25 +364,25 @@ function Me({ pixelsPerDay: e, viewMode: t, timelineCoords: n, onTaskTimeChange:
|
|
|
363
364
|
}
|
|
364
365
|
//#endregion
|
|
365
366
|
//#region src/components/Gantt/GanttChart/utils/timelineFocus.ts
|
|
366
|
-
function
|
|
367
|
+
function Fe(e, t, n) {
|
|
367
368
|
let r = Number(t) > 0 ? Number(t) : 0, i = Number(n) > 0 ? Number(n) : 0, a = Math.max(0, i - r);
|
|
368
369
|
return Number.isFinite(e) ? Math.min(Math.max(0, e), a) : 0;
|
|
369
370
|
}
|
|
370
|
-
function
|
|
371
|
+
function Ie({ anchorMs: e, toX: t, viewportWidth: n, timelineWidth: r }) {
|
|
371
372
|
let i = Number(n) > 0 ? Number(n) : 0;
|
|
372
373
|
if (!Number.isFinite(e) || typeof t != "function" || i <= 0) return 0;
|
|
373
374
|
let a = t(e);
|
|
374
|
-
return Number.isFinite(a) ?
|
|
375
|
+
return Number.isFinite(a) ? Fe(a - i / 2, i, r) : 0;
|
|
375
376
|
}
|
|
376
377
|
//#endregion
|
|
377
378
|
//#region src/components/Gantt/GanttChart/hooks/useGanttColumnVirtual.ts
|
|
378
|
-
function
|
|
379
|
+
function Le(e) {
|
|
379
380
|
let t = Number(e);
|
|
380
381
|
return Math.max((Number.isFinite(t) && t > 0 ? t : 0) * 4, 240);
|
|
381
382
|
}
|
|
382
|
-
function
|
|
383
|
+
function Re(e, t) {
|
|
383
384
|
if (!Array.isArray(e) || e.length === 0) return [];
|
|
384
|
-
let { scrollLeft: n = 0, viewportWidth: r = 0, pixelsPerDay: i } = t || {}, a =
|
|
385
|
+
let { scrollLeft: n = 0, viewportWidth: r = 0, pixelsPerDay: i } = t || {}, a = Le(Number(e[0]?.width) > 0 ? Number(e[0].width) : i), o = e[e.length - 1], s = Fe(n, r, Number(o?.left) + Number(o?.width) > 0 ? Number(o.left) + Number(o.width) : 0), c = Math.max(0, s - a), l = s + r + a, u = e.length, d = 0, f = u - 1, p = u;
|
|
385
386
|
for (; d <= f;) {
|
|
386
387
|
let t = d + f >> 1, n = e[t];
|
|
387
388
|
n.left + n.width > c ? (p = t, f = t - 1) : d = t + 1;
|
|
@@ -397,9 +398,9 @@ function Ie(e, t) {
|
|
|
397
398
|
for (let e = p; e <= m; e += 1) h.push({ index: e });
|
|
398
399
|
return h;
|
|
399
400
|
}
|
|
400
|
-
function
|
|
401
|
+
function ze({ lowerSegments: e, pixelsPerDay: t, scrollLeft: n, viewportWidth: r, showWeekendHighlight: i, timelineStartMs: a, timelineWidth: o, viewMode: c }) {
|
|
401
402
|
return {
|
|
402
|
-
virtualColumns:
|
|
403
|
+
virtualColumns: K(() => Re(e, {
|
|
403
404
|
scrollLeft: n,
|
|
404
405
|
viewportWidth: r,
|
|
405
406
|
pixelsPerDay: t
|
|
@@ -409,11 +410,11 @@ function Le({ lowerSegments: e, pixelsPerDay: t, scrollLeft: n, viewportWidth: r
|
|
|
409
410
|
n,
|
|
410
411
|
r
|
|
411
412
|
]),
|
|
412
|
-
weekendSegments:
|
|
413
|
+
weekendSegments: K(() => {
|
|
413
414
|
if (!i || o <= 0 || c !== "day") return [];
|
|
414
415
|
let e = Math.max(0, n - 120), l = n + r + 120, u = Math.max(0, Math.floor(e / t)), d = Math.ceil(l / t), f = [];
|
|
415
416
|
for (let e = u; e <= d; e += 1) {
|
|
416
|
-
let n = a + e * s, r =
|
|
417
|
+
let n = a + e * s, r = ae(n);
|
|
417
418
|
(r === 0 || r === 6) && f.push({
|
|
418
419
|
id: `weekend-${n}`,
|
|
419
420
|
left: e * t,
|
|
@@ -432,8 +433,8 @@ function Le({ lowerSegments: e, pixelsPerDay: t, scrollLeft: n, viewportWidth: r
|
|
|
432
433
|
])
|
|
433
434
|
};
|
|
434
435
|
}
|
|
435
|
-
|
|
436
|
-
var
|
|
436
|
+
he.extend(ge), he.extend(ve);
|
|
437
|
+
var Be = {
|
|
437
438
|
day: {
|
|
438
439
|
amount: 1,
|
|
439
440
|
unit: "day"
|
|
@@ -486,7 +487,7 @@ var Re = {
|
|
|
486
487
|
amount: 1,
|
|
487
488
|
unit: "minute"
|
|
488
489
|
}
|
|
489
|
-
},
|
|
490
|
+
}, Ve = (e, t, n) => {
|
|
490
491
|
switch (t) {
|
|
491
492
|
case "halfDay": return e.hour() < 12 ? n("header.lower.halfDayAm") : n("header.lower.halfDayPm");
|
|
492
493
|
case "sixHour": {
|
|
@@ -502,7 +503,7 @@ var Re = {
|
|
|
502
503
|
case "oneMinute": return e.format("mm");
|
|
503
504
|
default: return e.format("DD");
|
|
504
505
|
}
|
|
505
|
-
},
|
|
506
|
+
}, He = (e, t, n) => {
|
|
506
507
|
let r = C(e.valueOf());
|
|
507
508
|
switch (t) {
|
|
508
509
|
case "day": return r.format("DD");
|
|
@@ -511,25 +512,38 @@ var Re = {
|
|
|
511
512
|
case "quarterMonth": return D(e.valueOf(), n);
|
|
512
513
|
case "quarter": return n("header.lower.quarter", { quarter: r.quarter() });
|
|
513
514
|
case "year": return r.month() < 6 ? n("firstHalf") : n("secondHalf");
|
|
514
|
-
default: return
|
|
515
|
+
default: return Ve(r, t, n);
|
|
515
516
|
}
|
|
516
|
-
},
|
|
517
|
+
}, Ue = (e, t) => {
|
|
517
518
|
let n = C(e.valueOf()), r = y(t).headerLayout;
|
|
518
519
|
return r === "dayNested" ? `day-${n.format("YYYY-MM-DD")}` : r === "hourNested" ? `hour-${n.format("YYYY-MM-DD-HH")}` : r === "quarterNested" ? `quarter-${n.format("YYYY")}-Q${n.quarter()}` : t === "day" || t === "week" ? `month-${n.format("YYYY-MM")}` : `year-${n.format("YYYY")}`;
|
|
519
|
-
},
|
|
520
|
+
}, We = (e, t, n) => {
|
|
520
521
|
let r = C(e.valueOf()), i = y(t).headerLayout;
|
|
521
|
-
|
|
522
|
+
if (i === "dayNested") return { label: n("header.top.monthDay", {
|
|
522
523
|
month: r.month() + 1,
|
|
523
524
|
day: r.date()
|
|
524
|
-
})
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
525
|
+
}) };
|
|
526
|
+
if (i === "hourNested") {
|
|
527
|
+
let e = r.hour();
|
|
528
|
+
if (e === 0) return { label: n("header.top.hourWithDate", {
|
|
529
|
+
month: r.month() + 1,
|
|
530
|
+
day: r.date(),
|
|
531
|
+
hour: 0
|
|
532
|
+
}) };
|
|
533
|
+
let i = n("header.top.hourOnly", { hour: e });
|
|
534
|
+
return t === "tenMinute" || t === "oneMinute" ? {
|
|
535
|
+
label: i,
|
|
536
|
+
dateLabel: n("header.top.monthDay", {
|
|
537
|
+
month: r.month() + 1,
|
|
538
|
+
day: r.date()
|
|
539
|
+
})
|
|
540
|
+
} : { label: i };
|
|
541
|
+
}
|
|
542
|
+
return i === "quarterNested" ? { label: E(e.valueOf(), n) } : t === "day" || t === "week" ? { label: n("header.top.yearMonth", {
|
|
529
543
|
year: r.year(),
|
|
530
544
|
month: r.month() + 1
|
|
531
|
-
}) : n("header.top.year", { year: r.year() });
|
|
532
|
-
},
|
|
545
|
+
}) } : { label: n("header.top.year", { year: r.year() }) };
|
|
546
|
+
}, Ge = (e, t, n, r, i, a, o) => {
|
|
533
547
|
let s = _(r), c = A ?? 100;
|
|
534
548
|
e.push({
|
|
535
549
|
id: `${r}-${t}`,
|
|
@@ -537,64 +551,54 @@ var Re = {
|
|
|
537
551
|
endMs: n,
|
|
538
552
|
left: s ? e.length * c : M(t, i, a, r),
|
|
539
553
|
width: s ? c : Math.max(1, ee(t, n, a, r)),
|
|
540
|
-
label:
|
|
554
|
+
label: He(he(t), r, o)
|
|
541
555
|
});
|
|
542
|
-
},
|
|
543
|
-
let a = [], o =
|
|
556
|
+
}, Ke = ({ viewMode: e, timelineStartMs: t, timelineEndMs: n, pixelsPerDay: r, formatMessage: i }) => {
|
|
557
|
+
let a = [], o = Be[e] || Be.day, s = he(P(t));
|
|
544
558
|
_(e) && (s = s.startOf("month"));
|
|
545
|
-
let c =
|
|
559
|
+
let c = he(P(n));
|
|
546
560
|
for (; s.isBefore(c);) {
|
|
547
561
|
o.align && (s = o.align(s));
|
|
548
562
|
let n = s.add(o.amount, o.unit);
|
|
549
|
-
|
|
563
|
+
Ge(a, ie(s.valueOf()), ie(n.valueOf()), e, t, r, i), s = n;
|
|
550
564
|
}
|
|
551
565
|
return a;
|
|
552
|
-
},
|
|
566
|
+
}, qe = ({ lowerSegments: e, viewMode: t, formatMessage: n }) => {
|
|
553
567
|
if (!Array.isArray(e) || e.length === 0) return [];
|
|
554
568
|
let r = [], i = null;
|
|
555
569
|
for (let a of e) {
|
|
556
|
-
let e =
|
|
557
|
-
if (!i || i.
|
|
558
|
-
i && r.push({
|
|
559
|
-
id:
|
|
560
|
-
left: i.left,
|
|
561
|
-
width: i.width,
|
|
562
|
-
label: i.label
|
|
563
|
-
}), i = {
|
|
564
|
-
key: o,
|
|
570
|
+
let e = he(a.startMs), o = Ue(e, t);
|
|
571
|
+
if (!i || i.id !== o) {
|
|
572
|
+
i && r.push(i), i = {
|
|
573
|
+
id: o,
|
|
565
574
|
left: a.left,
|
|
566
575
|
width: a.width,
|
|
567
|
-
|
|
576
|
+
...We(e, t, n)
|
|
568
577
|
};
|
|
569
578
|
continue;
|
|
570
579
|
}
|
|
571
580
|
i.width += a.width;
|
|
572
581
|
}
|
|
573
|
-
return i !== null && r.push(
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
}), r;
|
|
579
|
-
}, Ke = (e) => Number.isFinite(e.startMs) && Number.isFinite(e.endMs) && e.startMs < e.endMs, qe = (e) => {
|
|
580
|
-
if (!Ke(e)) throw RangeError("Timeline range must be finite and satisfy startMs < endMs");
|
|
581
|
-
}, Je = (e, t) => {
|
|
582
|
-
if (qe(e), !Number.isFinite(t)) throw RangeError("Timeline time must be finite");
|
|
582
|
+
return i !== null && r.push(i), r;
|
|
583
|
+
}, Je = (e) => Number.isFinite(e.startMs) && Number.isFinite(e.endMs) && e.startMs < e.endMs, Ye = (e) => {
|
|
584
|
+
if (!Je(e)) throw RangeError("Timeline range must be finite and satisfy startMs < endMs");
|
|
585
|
+
}, Xe = (e, t) => {
|
|
586
|
+
if (Ye(e), !Number.isFinite(t)) throw RangeError("Timeline time must be finite");
|
|
583
587
|
return e.startMs <= t && t < e.endMs;
|
|
584
|
-
},
|
|
585
|
-
|
|
588
|
+
}, Ze = (e, t) => (Ye(e), Ye(t), e.startMs < t.endMs && t.startMs < e.endMs), Qe = (e, t) => {
|
|
589
|
+
Ye(e), Ye(t);
|
|
586
590
|
let n = Math.max(e.startMs, t.startMs), r = Math.min(e.endMs, t.endMs);
|
|
587
591
|
return n < r ? {
|
|
588
592
|
startMs: n,
|
|
589
593
|
endMs: r
|
|
590
594
|
} : null;
|
|
591
|
-
},
|
|
595
|
+
}, $e = (e, t) => {
|
|
592
596
|
if (!Number.isFinite(e) || e <= 0) throw RangeError(`${t} must be finite and greater than zero`);
|
|
593
|
-
},
|
|
597
|
+
}, et = (e, t) => {
|
|
594
598
|
if (Number.isFinite(e)) return e;
|
|
595
599
|
if (Number.isFinite(t)) return t;
|
|
596
600
|
throw RangeError("focusMs or fallbackFocusMs must be finite");
|
|
597
|
-
},
|
|
601
|
+
}, tt = ({ startMs: e, endMs: t, viewMode: n, viewportWidth: r, pixelsPerDay: i }) => {
|
|
598
602
|
let a = (t - e) / s;
|
|
599
603
|
if (a * i >= r) return {
|
|
600
604
|
startMs: e,
|
|
@@ -602,24 +606,24 @@ var Re = {
|
|
|
602
606
|
};
|
|
603
607
|
let o = Math.ceil(r / i), c = Math.ceil((o - a) / 2) * s;
|
|
604
608
|
return S(e - c, t + c, n);
|
|
605
|
-
},
|
|
609
|
+
}, nt = ({ range: e, focusMs: t, viewMode: n, viewportWidth: r, pixelsPerDay: i }) => {
|
|
606
610
|
let a = (r / 2 + 281) / i * s;
|
|
607
|
-
return
|
|
611
|
+
return tt({
|
|
608
612
|
...S(Math.min(e.startMs, t - a), Math.max(e.endMs, t + a), n),
|
|
609
613
|
viewMode: n,
|
|
610
614
|
viewportWidth: r,
|
|
611
615
|
pixelsPerDay: i
|
|
612
616
|
});
|
|
613
|
-
},
|
|
614
|
-
if (!
|
|
617
|
+
}, rt = ({ renderWindow: e, timelineCoords: t, scrollLeft: n, viewportWidth: r }) => {
|
|
618
|
+
if (!Je(e)) throw RangeError("renderWindow must be a valid timeline range");
|
|
615
619
|
if (!Number.isFinite(n) || n < 0) throw RangeError("scrollLeft must be finite and non-negative");
|
|
616
|
-
|
|
620
|
+
$e(r, "viewportWidth");
|
|
617
621
|
let i = {
|
|
618
622
|
startMs: t.timeAtX(n),
|
|
619
623
|
endMs: t.timeAtX(n + r)
|
|
620
624
|
};
|
|
621
|
-
if (!
|
|
622
|
-
let a =
|
|
625
|
+
if (!Je(i)) throw RangeError("TimelineCoords must produce an increasing finite visible range");
|
|
626
|
+
let a = Qe(i, e);
|
|
623
627
|
if (!a) throw RangeError("Visible range must intersect renderWindow");
|
|
624
628
|
let o = t.timeAtX(n + r / 2);
|
|
625
629
|
if (!Number.isFinite(o)) throw RangeError("TimelineCoords must produce a finite focus");
|
|
@@ -628,65 +632,65 @@ var Re = {
|
|
|
628
632
|
visibleRange: a,
|
|
629
633
|
focusMs: o
|
|
630
634
|
};
|
|
631
|
-
},
|
|
635
|
+
}, it = ({ scrollLeft: e, viewportWidth: t, timelineWidth: n, guardBandPx: r }) => {
|
|
632
636
|
if (!Number.isFinite(e) || e < 0) throw RangeError("scrollLeft must be finite and non-negative");
|
|
633
|
-
if (
|
|
637
|
+
if ($e(t, "viewportWidth"), $e(n, "timelineWidth"), !Number.isFinite(r) || r < 0) throw RangeError("guardBandPx must be finite and non-negative");
|
|
634
638
|
let i = Math.max(0, n - t);
|
|
635
639
|
if (i === 0) return null;
|
|
636
640
|
let a = Math.min(e, i), o = a <= r;
|
|
637
641
|
return o === i - a <= r ? null : o ? "left" : "right";
|
|
638
|
-
},
|
|
639
|
-
|
|
640
|
-
let o =
|
|
642
|
+
}, at = ({ focusMs: e, fallbackFocusMs: t, viewMode: n, timeRangeConfig: r, viewportWidth: i, pixelsPerDay: a }) => {
|
|
643
|
+
$e(i, "viewportWidth"), $e(a, "pixelsPerDay");
|
|
644
|
+
let o = et(e, t), s = nt({
|
|
641
645
|
range: j(r, o),
|
|
642
646
|
focusMs: o,
|
|
643
647
|
viewMode: n,
|
|
644
648
|
viewportWidth: i,
|
|
645
649
|
pixelsPerDay: a
|
|
646
650
|
});
|
|
647
|
-
if (!
|
|
651
|
+
if (!Je(s)) throw RangeError("Viewport engine produced an invalid render window");
|
|
648
652
|
return s;
|
|
649
|
-
},
|
|
650
|
-
let a =
|
|
651
|
-
return
|
|
653
|
+
}, ot = ({ focusMs: e, fallbackFocusMs: t, timelineCoords: n, viewportWidth: r, timelineWidth: i }) => {
|
|
654
|
+
let a = et(e, t);
|
|
655
|
+
return $e(r, "viewportWidth"), $e(i, "timelineWidth"), {
|
|
652
656
|
focusMs: a,
|
|
653
|
-
scrollLeft:
|
|
657
|
+
scrollLeft: Ie({
|
|
654
658
|
anchorMs: a,
|
|
655
659
|
toX: n.toX,
|
|
656
660
|
viewportWidth: r,
|
|
657
661
|
timelineWidth: i
|
|
658
662
|
})
|
|
659
663
|
};
|
|
660
|
-
},
|
|
664
|
+
}, st = (e) => {
|
|
661
665
|
if (v(e)) {
|
|
662
666
|
let t = g(e);
|
|
663
|
-
return
|
|
667
|
+
return Ee(Date.now(), t, "floor") + t / 2;
|
|
664
668
|
}
|
|
665
669
|
return T(Date.now()) + s / 2;
|
|
666
|
-
},
|
|
670
|
+
}, ct = (e, t) => {
|
|
667
671
|
if (v(t)) {
|
|
668
672
|
let n = g(t);
|
|
669
|
-
return
|
|
673
|
+
return Ee(e, n, "floor") + n + 1;
|
|
670
674
|
}
|
|
671
675
|
return T(e) + s + 1;
|
|
672
|
-
},
|
|
673
|
-
let [t, n] =
|
|
676
|
+
}, lt = (e) => {
|
|
677
|
+
let [t, n] = J(() => st(e)), r = q(null), i = U(() => {
|
|
674
678
|
r.current &&= (clearTimeout(r.current), null);
|
|
675
679
|
}, []), a = U(() => {
|
|
676
680
|
i();
|
|
677
|
-
let t = Date.now(), o =
|
|
681
|
+
let t = Date.now(), o = ct(t, e);
|
|
678
682
|
r.current = setTimeout(() => {
|
|
679
|
-
n(
|
|
683
|
+
n(st(e)), a();
|
|
680
684
|
}, Math.max(1, o - t));
|
|
681
685
|
}, [i, e]);
|
|
682
|
-
W(() => (n(
|
|
686
|
+
W(() => (n(st(e)), a(), i), [
|
|
683
687
|
e,
|
|
684
688
|
a,
|
|
685
689
|
i
|
|
686
690
|
]);
|
|
687
|
-
let o =
|
|
691
|
+
let o = ue();
|
|
688
692
|
return W(() => {
|
|
689
|
-
o === "visible" && (n(
|
|
693
|
+
o === "visible" && (n(st(e)), a());
|
|
690
694
|
}, [
|
|
691
695
|
o,
|
|
692
696
|
a,
|
|
@@ -695,59 +699,61 @@ var Re = {
|
|
|
695
699
|
};
|
|
696
700
|
//#endregion
|
|
697
701
|
//#region src/components/Gantt/GanttChart/hooks/useTimelineViewportController.ts
|
|
698
|
-
function
|
|
699
|
-
let l = k(n, t), u =
|
|
702
|
+
function ut({ timeRangeConfig: e, pixelsPerDayConfig: t, viewMode: n, contentRef: r, contentSize: i, headerTrackRef: a, formatMessage: o, isHorizontalScrollbarInteracting: s, isTaskBarInteracting: c = !1 }) {
|
|
703
|
+
let l = k(n, t), u = K(() => re(n, e), [n, e]), d = i?.width !== null && i?.width !== void 0 && Number(i.width) > 0 ? Number(i.width) : 0, f = q(!1), [p, m] = J(!1), [h, g] = J(d), _ = q(null), v = q(!1), y = q(!1), b = q(null), x = q(null), S = q(null), [C, w] = J(0), T = q(null), ee = U((e) => {
|
|
700
704
|
let t = S.current;
|
|
701
705
|
if (!t || !e) return !1;
|
|
702
706
|
let n = e.scrollLeft || 0;
|
|
703
707
|
return Math.abs(n - t.targetLeft) > 1;
|
|
704
|
-
}, []),
|
|
708
|
+
}, []), E = U((e) => {
|
|
705
709
|
let t = S.current;
|
|
706
710
|
t && Math.abs(e - t.targetLeft) <= 1 && (S.current = null);
|
|
707
|
-
}, []),
|
|
711
|
+
}, []), D = U(() => {
|
|
708
712
|
x.current !== null && (cancelAnimationFrame(x.current), x.current = null), b.current = null;
|
|
709
|
-
}, []),
|
|
710
|
-
|
|
713
|
+
}, []), O = U((e) => {
|
|
714
|
+
D();
|
|
711
715
|
let t = { left: e };
|
|
712
716
|
b.current = t, x.current = requestAnimationFrame(() => {
|
|
713
717
|
x.current = null, b.current === t && (b.current = null);
|
|
714
718
|
});
|
|
715
|
-
}, [
|
|
716
|
-
|
|
719
|
+
}, [D]), [A, j] = J(0), M = q(0), te = q(0), N = q(null), ie = U((e) => {
|
|
720
|
+
te.current = e, N.current === null && (N.current = requestAnimationFrame(() => {
|
|
717
721
|
N.current = null;
|
|
718
|
-
let e =
|
|
719
|
-
|
|
722
|
+
let e = te.current;
|
|
723
|
+
j((t) => t === e ? t : e);
|
|
720
724
|
}));
|
|
725
|
+
}, []), P = U(() => {
|
|
726
|
+
T.current !== null && (cancelAnimationFrame(T.current), T.current = null);
|
|
721
727
|
}, []);
|
|
722
728
|
W(() => () => {
|
|
723
|
-
N.current !== null && cancelAnimationFrame(N.current),
|
|
724
|
-
}, [
|
|
725
|
-
let [
|
|
729
|
+
N.current !== null && cancelAnimationFrame(N.current), P(), D();
|
|
730
|
+
}, [P, D]);
|
|
731
|
+
let [ae, oe] = J(null), F = q(n), se = F.current === n, ce = se ? ae : null, I = U(() => {
|
|
726
732
|
let e = _.current;
|
|
727
|
-
return e !== null && Number.isFinite(e) ? e :
|
|
728
|
-
}, [n]),
|
|
733
|
+
return e !== null && Number.isFinite(e) ? e : st(n);
|
|
734
|
+
}, [n]), L = U((e) => {
|
|
729
735
|
Number.isFinite(e) && (_.current = e);
|
|
730
|
-
}, []),
|
|
736
|
+
}, []), R = U((e) => {
|
|
731
737
|
S.current = null;
|
|
732
|
-
let t =
|
|
738
|
+
let t = at({
|
|
733
739
|
focusMs: e,
|
|
734
|
-
fallbackFocusMs:
|
|
740
|
+
fallbackFocusMs: I(),
|
|
735
741
|
viewMode: n,
|
|
736
742
|
timeRangeConfig: u,
|
|
737
743
|
viewportWidth: h || 1e3,
|
|
738
744
|
pixelsPerDay: l
|
|
739
745
|
});
|
|
740
|
-
return
|
|
746
|
+
return oe(t), v.current = !0, t;
|
|
741
747
|
}, [
|
|
742
748
|
u,
|
|
743
749
|
l,
|
|
744
|
-
|
|
750
|
+
I,
|
|
745
751
|
n,
|
|
746
752
|
h
|
|
747
753
|
]);
|
|
748
754
|
W(() => {
|
|
749
|
-
|
|
750
|
-
}, [e?.bufferDaysBefore, e?.bufferDaysAfter]),
|
|
755
|
+
F.current = n, R(I());
|
|
756
|
+
}, [e?.bufferDaysBefore, e?.bufferDaysAfter]), le(() => {
|
|
751
757
|
let e = i?.width !== null && i?.width !== void 0 && Number(i.width) > 0 ? Number(i.width) : 0, t = r.current?.clientWidth !== null && r.current?.clientWidth !== void 0 && Number(r.current.clientWidth) > 0 ? Number(r.current.clientWidth) : 0, n = e > 0 ? e : f.current ? t : 0;
|
|
752
758
|
n > 0 && n !== h && g(n);
|
|
753
759
|
}, [
|
|
@@ -755,8 +761,8 @@ function ct({ timeRangeConfig: e, pixelsPerDayConfig: t, viewMode: n, contentRef
|
|
|
755
761
|
i?.width,
|
|
756
762
|
h
|
|
757
763
|
]);
|
|
758
|
-
let
|
|
759
|
-
focusMs:
|
|
764
|
+
let z = K(() => ce || at({
|
|
765
|
+
focusMs: I(),
|
|
760
766
|
viewMode: n,
|
|
761
767
|
timeRangeConfig: u,
|
|
762
768
|
viewportWidth: h || 1e3,
|
|
@@ -765,247 +771,266 @@ function ct({ timeRangeConfig: e, pixelsPerDayConfig: t, viewMode: n, contentRef
|
|
|
765
771
|
ce,
|
|
766
772
|
u,
|
|
767
773
|
l,
|
|
768
|
-
|
|
774
|
+
I,
|
|
769
775
|
n,
|
|
770
776
|
h
|
|
771
|
-
]), { timelineStartMs:
|
|
772
|
-
timelineStartMs:
|
|
773
|
-
timelineEndMs:
|
|
774
|
-
}), [
|
|
777
|
+
]), { timelineStartMs: B, timelineEndMs: V } = K(() => ({
|
|
778
|
+
timelineStartMs: z.startMs,
|
|
779
|
+
timelineEndMs: z.endMs
|
|
780
|
+
}), [z]), H = K(() => Ke({
|
|
775
781
|
viewMode: n,
|
|
776
|
-
timelineStartMs:
|
|
777
|
-
timelineEndMs:
|
|
782
|
+
timelineStartMs: B,
|
|
783
|
+
timelineEndMs: V,
|
|
778
784
|
pixelsPerDay: l,
|
|
779
785
|
formatMessage: o
|
|
780
786
|
}), [
|
|
781
787
|
n,
|
|
782
|
-
|
|
783
|
-
|
|
788
|
+
B,
|
|
789
|
+
V,
|
|
784
790
|
l,
|
|
785
791
|
o
|
|
786
|
-
]),
|
|
792
|
+
]), G = K(() => ne({
|
|
787
793
|
viewMode: n,
|
|
788
|
-
timelineStartMs:
|
|
789
|
-
timelineEndMs:
|
|
794
|
+
timelineStartMs: B,
|
|
795
|
+
timelineEndMs: V,
|
|
790
796
|
pixelsPerDay: l,
|
|
791
|
-
lowerSegments:
|
|
797
|
+
lowerSegments: H
|
|
792
798
|
}), [
|
|
793
799
|
n,
|
|
794
|
-
|
|
795
|
-
|
|
800
|
+
B,
|
|
801
|
+
V,
|
|
796
802
|
l,
|
|
797
|
-
|
|
798
|
-
]),
|
|
799
|
-
if (
|
|
800
|
-
let e =
|
|
803
|
+
H
|
|
804
|
+
]), Y = K(() => {
|
|
805
|
+
if (H.length === 0) return 0;
|
|
806
|
+
let e = H[H.length - 1];
|
|
801
807
|
return e.left + e.width;
|
|
802
|
-
}, [
|
|
803
|
-
|
|
804
|
-
|
|
808
|
+
}, [H]), ue = U(() => v.current ? !1 : (R(I()), !0), [I, R]);
|
|
809
|
+
le(() => {
|
|
810
|
+
F.current !== n && (F.current = n, R(I()));
|
|
805
811
|
}, [
|
|
806
812
|
n,
|
|
807
|
-
|
|
808
|
-
|
|
813
|
+
I,
|
|
814
|
+
R
|
|
809
815
|
]);
|
|
810
|
-
let
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
]),
|
|
816
|
+
let de = lt(n), fe = K(() => Y <= 0 ? null : G.toX(de), [
|
|
817
|
+
de,
|
|
818
|
+
G,
|
|
819
|
+
Y
|
|
820
|
+
]), X = U((e) => {
|
|
815
821
|
let t = a?.current;
|
|
816
822
|
t && t.style.setProperty("--gantt-scroll-left", `${e}px`);
|
|
817
823
|
}, [a]), pe = U((e, t) => {
|
|
818
|
-
|
|
819
|
-
|
|
824
|
+
e.scrollLeft = t;
|
|
825
|
+
let n = e.scrollLeft || 0, r = !(Math.abs(n - t) <= 1) && e.scrollWidth + 1 < Y;
|
|
826
|
+
return O(n), X(n), j(n), M.current = n, !r;
|
|
827
|
+
}, [
|
|
828
|
+
X,
|
|
829
|
+
O,
|
|
830
|
+
Y
|
|
831
|
+
]), me = U(() => {
|
|
820
832
|
let e = r.current, t = h;
|
|
821
|
-
if (!e || t <= 0 ||
|
|
822
|
-
let { scrollLeft: n } =
|
|
833
|
+
if (!e || t <= 0 || Y <= 0) return !1;
|
|
834
|
+
let { scrollLeft: n } = ot({
|
|
823
835
|
focusMs: _.current ?? NaN,
|
|
824
|
-
fallbackFocusMs:
|
|
825
|
-
timelineCoords:
|
|
836
|
+
fallbackFocusMs: I(),
|
|
837
|
+
timelineCoords: G,
|
|
826
838
|
viewportWidth: t,
|
|
827
|
-
timelineWidth:
|
|
839
|
+
timelineWidth: Y
|
|
828
840
|
});
|
|
829
|
-
return pe(e, n)
|
|
841
|
+
return pe(e, n);
|
|
830
842
|
}, [
|
|
831
843
|
pe,
|
|
832
844
|
r,
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
845
|
+
I,
|
|
846
|
+
G,
|
|
847
|
+
Y,
|
|
836
848
|
h
|
|
837
|
-
]),
|
|
849
|
+
]), he = U(() => {
|
|
850
|
+
v.current = !1, P(), f.current || (f.current = !0, m(!0));
|
|
851
|
+
}, [P]), ge = U(() => me() ? (he(), !0) : !1, [me, he]), _e = U(() => {
|
|
852
|
+
if (T.current !== null) return;
|
|
853
|
+
let e = 0, t = () => {
|
|
854
|
+
T.current = null, v.current && (ge() || (e += 1, e < 30 && (T.current = requestAnimationFrame(t))));
|
|
855
|
+
};
|
|
856
|
+
T.current = requestAnimationFrame(t);
|
|
857
|
+
}, [ge]), ve = U((e) => {
|
|
838
858
|
let t = e.currentTarget.scrollLeft, n = h, r = b.current, i = r !== null && Math.abs(t - r.left) <= 1;
|
|
839
|
-
|
|
840
|
-
let a =
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
859
|
+
if (v.current && ge()) return;
|
|
860
|
+
let a = v.current, o = n > 0 && !i && !a;
|
|
861
|
+
r && D(), !i && !a && f.current && (y.current = !0), X(t);
|
|
862
|
+
let s = t !== M.current;
|
|
863
|
+
if (M.current = t, s && ie(t), o) {
|
|
864
|
+
let e = Fe(t, n, Y);
|
|
865
|
+
L(rt({
|
|
844
866
|
renderWindow: {
|
|
845
|
-
startMs:
|
|
846
|
-
endMs:
|
|
867
|
+
startMs: B,
|
|
868
|
+
endMs: V
|
|
847
869
|
},
|
|
848
|
-
timelineCoords:
|
|
870
|
+
timelineCoords: G,
|
|
849
871
|
scrollLeft: e,
|
|
850
872
|
viewportWidth: n
|
|
851
873
|
}).focusMs);
|
|
852
874
|
}
|
|
853
|
-
|
|
875
|
+
E(t);
|
|
854
876
|
}, [
|
|
855
|
-
|
|
877
|
+
X,
|
|
878
|
+
D,
|
|
879
|
+
ge,
|
|
880
|
+
G,
|
|
881
|
+
h,
|
|
882
|
+
ie,
|
|
883
|
+
L,
|
|
856
884
|
E,
|
|
857
885
|
V,
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
R,
|
|
864
|
-
H
|
|
865
|
-
]), me = U(() => {
|
|
866
|
-
let e = at(n);
|
|
867
|
-
F(e), I(e);
|
|
886
|
+
B,
|
|
887
|
+
Y
|
|
888
|
+
]), ye = U(() => {
|
|
889
|
+
let e = st(n);
|
|
890
|
+
L(e), R(e);
|
|
868
891
|
}, [
|
|
869
|
-
|
|
870
|
-
|
|
892
|
+
R,
|
|
893
|
+
L,
|
|
871
894
|
n
|
|
872
|
-
]),
|
|
895
|
+
]), be = U((e) => {
|
|
873
896
|
let t = r.current, n = e?.targetMs;
|
|
874
897
|
if (!t || !Number.isFinite(n)) return;
|
|
875
898
|
let i = t.clientWidth > 0 ? t.clientWidth : h;
|
|
876
|
-
if (n <
|
|
877
|
-
S.current = null,
|
|
899
|
+
if (n < B || n >= V) {
|
|
900
|
+
S.current = null, L(n), R(n);
|
|
878
901
|
return;
|
|
879
902
|
}
|
|
880
|
-
let a =
|
|
903
|
+
let a = Ie({
|
|
881
904
|
anchorMs: n,
|
|
882
|
-
toX:
|
|
905
|
+
toX: G.toX,
|
|
883
906
|
viewportWidth: i,
|
|
884
|
-
timelineWidth:
|
|
907
|
+
timelineWidth: Y
|
|
885
908
|
}), o = t.scrollLeft || 0;
|
|
886
909
|
if (!(i > 0 && Math.abs(a - o) <= i * 1.5)) {
|
|
887
|
-
|
|
910
|
+
L(n), R(n);
|
|
888
911
|
return;
|
|
889
912
|
}
|
|
890
913
|
let s = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
|
|
891
|
-
s === "smooth" ? S.current = { targetLeft: a } : (S.current = null,
|
|
914
|
+
s === "smooth" ? S.current = { targetLeft: a } : (S.current = null, O(a)), t.scrollTo({
|
|
892
915
|
left: a,
|
|
893
916
|
behavior: s
|
|
894
|
-
}),
|
|
917
|
+
}), L(n), s === "auto" && (X(a), j(a), M.current = a);
|
|
895
918
|
}, [
|
|
896
|
-
|
|
919
|
+
X,
|
|
897
920
|
r,
|
|
898
|
-
|
|
899
|
-
I,
|
|
900
|
-
F,
|
|
901
|
-
V,
|
|
902
|
-
z,
|
|
921
|
+
O,
|
|
903
922
|
R,
|
|
904
|
-
|
|
923
|
+
L,
|
|
924
|
+
G,
|
|
925
|
+
V,
|
|
926
|
+
B,
|
|
927
|
+
Y,
|
|
905
928
|
h
|
|
906
929
|
]);
|
|
907
930
|
W(() => {
|
|
908
|
-
if (!f.current || !h || !
|
|
909
|
-
let e = r.current, t = e?.scrollLeft ??
|
|
931
|
+
if (!f.current || !h || !Y || v.current || !y.current) return;
|
|
932
|
+
let e = r.current, t = e?.scrollLeft ?? A, n = it({
|
|
910
933
|
scrollLeft: Math.max(0, t),
|
|
911
934
|
viewportWidth: h,
|
|
912
|
-
timelineWidth:
|
|
935
|
+
timelineWidth: Y,
|
|
913
936
|
guardBandPx: 280
|
|
914
937
|
});
|
|
915
|
-
s || c ||
|
|
938
|
+
s || c || ee(e) || (e && E(e.scrollLeft || 0), n && ue());
|
|
916
939
|
}, [
|
|
917
|
-
|
|
918
|
-
|
|
940
|
+
A,
|
|
941
|
+
Y,
|
|
919
942
|
h,
|
|
920
943
|
r,
|
|
921
|
-
T,
|
|
922
944
|
ee,
|
|
923
|
-
|
|
945
|
+
E,
|
|
946
|
+
ue,
|
|
924
947
|
s,
|
|
925
948
|
c,
|
|
926
949
|
C
|
|
927
|
-
]),
|
|
928
|
-
!f.current || h <= 0 || I(
|
|
950
|
+
]), le(() => {
|
|
951
|
+
!f.current || h <= 0 || R(I());
|
|
929
952
|
}, [
|
|
930
|
-
P,
|
|
931
953
|
I,
|
|
954
|
+
R,
|
|
932
955
|
h
|
|
933
|
-
]),
|
|
934
|
-
v.current && (h <= 0 ||
|
|
956
|
+
]), le(() => {
|
|
957
|
+
v.current && (h <= 0 || Y <= 0 || ge() || _e());
|
|
935
958
|
}, [
|
|
959
|
+
ge,
|
|
960
|
+
_e,
|
|
936
961
|
Y,
|
|
937
|
-
H,
|
|
938
962
|
h,
|
|
939
|
-
|
|
940
|
-
]),
|
|
941
|
-
if (!f.current && h > 0 &&
|
|
942
|
-
if (Number.isFinite(_.current ?? NaN) ||
|
|
943
|
-
I(
|
|
963
|
+
ae
|
|
964
|
+
]), le(() => {
|
|
965
|
+
if (!f.current && h > 0 && Y > 0) {
|
|
966
|
+
if (Number.isFinite(_.current ?? NaN) || L(st(n)), !ae) {
|
|
967
|
+
R(I());
|
|
944
968
|
return;
|
|
945
969
|
}
|
|
946
|
-
v.current = !0,
|
|
970
|
+
v.current = !0, ge() || _e();
|
|
947
971
|
}
|
|
948
972
|
}, [
|
|
949
|
-
Y,
|
|
950
|
-
P,
|
|
951
973
|
I,
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
974
|
+
R,
|
|
975
|
+
ge,
|
|
976
|
+
_e,
|
|
977
|
+
L,
|
|
978
|
+
ae,
|
|
979
|
+
Y,
|
|
955
980
|
h,
|
|
956
981
|
n
|
|
957
982
|
]);
|
|
958
|
-
let
|
|
983
|
+
let xe = U((e) => {
|
|
959
984
|
let t = h;
|
|
960
|
-
t <= 0 ||
|
|
985
|
+
t <= 0 || L(G.timeAtX(e + t / 2));
|
|
961
986
|
}, [
|
|
962
987
|
h,
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
]),
|
|
988
|
+
G,
|
|
989
|
+
L
|
|
990
|
+
]), Se = U(() => {
|
|
966
991
|
let e = r.current;
|
|
967
992
|
if (!e) return;
|
|
968
993
|
let t = h, n = e.scrollLeft || 0, i = Math.max(0, n - t);
|
|
969
994
|
if (Math.abs(i - n) <= 1) {
|
|
970
995
|
S.current = null;
|
|
971
|
-
let e =
|
|
972
|
-
|
|
996
|
+
let e = G.timeAtX(n - t / 2);
|
|
997
|
+
L(e), R(e);
|
|
973
998
|
return;
|
|
974
999
|
}
|
|
975
1000
|
S.current = { targetLeft: i }, e.scrollTo({
|
|
976
1001
|
left: i,
|
|
977
1002
|
behavior: "smooth"
|
|
978
|
-
}),
|
|
1003
|
+
}), xe(i);
|
|
979
1004
|
}, [
|
|
980
1005
|
r,
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1006
|
+
R,
|
|
1007
|
+
L,
|
|
1008
|
+
G,
|
|
1009
|
+
xe,
|
|
985
1010
|
h
|
|
986
|
-
]),
|
|
1011
|
+
]), Ce = U(() => {
|
|
987
1012
|
let e = r.current;
|
|
988
1013
|
if (!e) return;
|
|
989
|
-
let t = h, n = e.scrollLeft || 0, i = Math.max(0,
|
|
1014
|
+
let t = h, n = e.scrollLeft || 0, i = Math.max(0, Y - t), a = Fe(n + t, t, Y);
|
|
990
1015
|
if (Math.abs(a - n) <= 1) {
|
|
991
1016
|
if (S.current = null, a >= i - 1) {
|
|
992
|
-
let e =
|
|
993
|
-
|
|
1017
|
+
let e = G.timeAtX(n + t * 1.5);
|
|
1018
|
+
L(e), R(e);
|
|
994
1019
|
}
|
|
995
1020
|
return;
|
|
996
1021
|
}
|
|
997
1022
|
S.current = { targetLeft: a }, e.scrollTo({
|
|
998
1023
|
left: a,
|
|
999
1024
|
behavior: "smooth"
|
|
1000
|
-
}),
|
|
1025
|
+
}), xe(a);
|
|
1001
1026
|
}, [
|
|
1002
1027
|
r,
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1028
|
+
R,
|
|
1029
|
+
L,
|
|
1030
|
+
G,
|
|
1006
1031
|
h,
|
|
1007
|
-
|
|
1008
|
-
|
|
1032
|
+
Y,
|
|
1033
|
+
xe
|
|
1009
1034
|
]);
|
|
1010
1035
|
W(() => {
|
|
1011
1036
|
let e = r.current;
|
|
@@ -1015,23 +1040,23 @@ function ct({ timeRangeConfig: e, pixelsPerDayConfig: t, viewMode: n, contentRef
|
|
|
1015
1040
|
};
|
|
1016
1041
|
return e.addEventListener("scrollend", t), () => e.removeEventListener("scrollend", t);
|
|
1017
1042
|
}, [r]);
|
|
1018
|
-
let
|
|
1043
|
+
let we = (!se || v.current) && Y > 0 && h > 0 ? ot({
|
|
1019
1044
|
focusMs: _.current ?? NaN,
|
|
1020
|
-
fallbackFocusMs:
|
|
1021
|
-
timelineCoords:
|
|
1045
|
+
fallbackFocusMs: I(),
|
|
1046
|
+
timelineCoords: G,
|
|
1022
1047
|
viewportWidth: h,
|
|
1023
|
-
timelineWidth:
|
|
1024
|
-
}).scrollLeft :
|
|
1025
|
-
if (
|
|
1026
|
-
visibleStartMs:
|
|
1027
|
-
visibleEndMs:
|
|
1048
|
+
timelineWidth: Y
|
|
1049
|
+
}).scrollLeft : A, { visibleStartMs: Te, visibleEndMs: Ee } = K(() => {
|
|
1050
|
+
if (Y <= 0 || h <= 0) return {
|
|
1051
|
+
visibleStartMs: B,
|
|
1052
|
+
visibleEndMs: B
|
|
1028
1053
|
};
|
|
1029
|
-
let e =
|
|
1054
|
+
let e = Fe(we, h, Y), { visibleRange: t } = rt({
|
|
1030
1055
|
renderWindow: {
|
|
1031
|
-
startMs:
|
|
1032
|
-
endMs:
|
|
1056
|
+
startMs: B,
|
|
1057
|
+
endMs: V
|
|
1033
1058
|
},
|
|
1034
|
-
timelineCoords:
|
|
1059
|
+
timelineCoords: G,
|
|
1035
1060
|
scrollLeft: e,
|
|
1036
1061
|
viewportWidth: h
|
|
1037
1062
|
});
|
|
@@ -1040,41 +1065,41 @@ function ct({ timeRangeConfig: e, pixelsPerDayConfig: t, viewMode: n, contentRef
|
|
|
1040
1065
|
visibleEndMs: t.endMs
|
|
1041
1066
|
};
|
|
1042
1067
|
}, [
|
|
1043
|
-
|
|
1068
|
+
we,
|
|
1069
|
+
G,
|
|
1044
1070
|
V,
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
H,
|
|
1071
|
+
B,
|
|
1072
|
+
Y,
|
|
1048
1073
|
h
|
|
1049
1074
|
]);
|
|
1050
1075
|
return {
|
|
1051
1076
|
pixelsPerDay: l,
|
|
1052
1077
|
viewportWidth: h,
|
|
1053
|
-
scrollLeft:
|
|
1054
|
-
timelineStartMs:
|
|
1055
|
-
timelineEndMs:
|
|
1056
|
-
visibleStartMs:
|
|
1057
|
-
visibleEndMs:
|
|
1058
|
-
lowerSegments:
|
|
1059
|
-
timelineCoords:
|
|
1060
|
-
timelineWidth:
|
|
1061
|
-
todayCenterMs:
|
|
1062
|
-
todayLineLeft:
|
|
1078
|
+
scrollLeft: we,
|
|
1079
|
+
timelineStartMs: B,
|
|
1080
|
+
timelineEndMs: V,
|
|
1081
|
+
visibleStartMs: Te,
|
|
1082
|
+
visibleEndMs: Ee,
|
|
1083
|
+
lowerSegments: H,
|
|
1084
|
+
timelineCoords: G,
|
|
1085
|
+
timelineWidth: Y,
|
|
1086
|
+
todayCenterMs: de,
|
|
1087
|
+
todayLineLeft: fe,
|
|
1063
1088
|
isInitialLayoutReady: p,
|
|
1064
|
-
handleContentScroll:
|
|
1065
|
-
handleTodayClick:
|
|
1066
|
-
handleOffscreenJump:
|
|
1067
|
-
handleScrollPrev:
|
|
1068
|
-
handleScrollNext:
|
|
1089
|
+
handleContentScroll: ve,
|
|
1090
|
+
handleTodayClick: ye,
|
|
1091
|
+
handleOffscreenJump: be,
|
|
1092
|
+
handleScrollPrev: Se,
|
|
1093
|
+
handleScrollNext: Ce
|
|
1069
1094
|
};
|
|
1070
1095
|
}
|
|
1071
1096
|
//#endregion
|
|
1072
1097
|
//#region src/components/Gantt/GanttChart/hooks/useNormalizedItems.ts
|
|
1073
|
-
function
|
|
1074
|
-
return { normalizedItems:
|
|
1098
|
+
function dt({ visibleItems: e, committedRangeById: t = {}, viewMode: n = "day" }) {
|
|
1099
|
+
return { normalizedItems: K(() => {
|
|
1075
1100
|
let r = Array.isArray(e) ? e : [], i = [], a = b(n) ? n : "day";
|
|
1076
1101
|
for (let e = 0; e < r.length; e++) {
|
|
1077
|
-
let n = r[e], o = String(n?.id ?? `row-${e}`), { rawStartMs: s, rawEndMs: c, baseStartMs: l, baseEndMs: u, invalid: d } =
|
|
1102
|
+
let n = r[e], o = String(n?.id ?? `row-${e}`), { rawStartMs: s, rawEndMs: c, baseStartMs: l, baseEndMs: u, invalid: d } = te(n?.start, n?.end), f = t[o], p = n?.type === "summary" ? !1 : d, m = O({
|
|
1078
1103
|
rawStartMs: s,
|
|
1079
1104
|
rawEndMs: c,
|
|
1080
1105
|
baseStartMs: l,
|
|
@@ -1110,12 +1135,12 @@ function lt({ visibleItems: e, committedRangeById: t = {}, viewMode: n = "day" }
|
|
|
1110
1135
|
}
|
|
1111
1136
|
//#endregion
|
|
1112
1137
|
//#region src/components/Gantt/GanttChart/hooks/useGanttScrollbars.tsx
|
|
1113
|
-
function
|
|
1114
|
-
let [n, r] =
|
|
1115
|
-
return
|
|
1138
|
+
function ft(e, t) {
|
|
1139
|
+
let [n, r] = J(!1);
|
|
1140
|
+
return le(() => {
|
|
1116
1141
|
let n = e.current, i = t.current;
|
|
1117
1142
|
if (!n || !i) return;
|
|
1118
|
-
let a =
|
|
1143
|
+
let a = ye({
|
|
1119
1144
|
target: n,
|
|
1120
1145
|
elements: { viewport: i }
|
|
1121
1146
|
}, { scrollbars: {
|
|
@@ -1127,7 +1152,7 @@ function ut(e, t) {
|
|
|
1127
1152
|
e.pointerType === "mouse" && e.button !== 0 || (s = !0, c = e.pointerId, r(!0));
|
|
1128
1153
|
}, u = (e) => {
|
|
1129
1154
|
if (!s) return;
|
|
1130
|
-
let t = e.pointerId, n = "pointerId" in e &&
|
|
1155
|
+
let t = e.pointerId, n = "pointerId" in e && ce(t) ? t : null;
|
|
1131
1156
|
n !== null && c !== null && n !== c || (s = !1, c = null, r(!1));
|
|
1132
1157
|
}, d = { capture: !0 };
|
|
1133
1158
|
return o.addEventListener("pointerdown", l, d), o.addEventListener("lostpointercapture", u, d), document.addEventListener("pointerup", u, d), document.addEventListener("pointercancel", u, d), document.addEventListener("lostpointercapture", u, d), window.addEventListener("blur", u), () => {
|
|
@@ -1137,50 +1162,92 @@ function ut(e, t) {
|
|
|
1137
1162
|
}
|
|
1138
1163
|
//#endregion
|
|
1139
1164
|
//#region src/components/Gantt/GanttChart/utils/timelineMarkers.ts
|
|
1140
|
-
function
|
|
1141
|
-
return !!e && Number.isFinite(r) &&
|
|
1165
|
+
function pt(e, t, n, r, i) {
|
|
1166
|
+
return !!e && Number.isFinite(r) && Xe(i, r) && t !== null && Number.isFinite(t) && t >= 0 && t <= n;
|
|
1142
1167
|
}
|
|
1143
1168
|
var Z = {
|
|
1144
|
-
root: "
|
|
1145
|
-
timelineHost: "
|
|
1146
|
-
timelineContent: "
|
|
1147
|
-
canvas: "
|
|
1148
|
-
weekendBg: "
|
|
1149
|
-
colLine: "
|
|
1150
|
-
rowLine: "
|
|
1151
|
-
rowHoverBg: "
|
|
1152
|
-
todayIndicator: "
|
|
1153
|
-
todayIndicatorContentLine: "
|
|
1154
|
-
todayIndicatorLine: "
|
|
1155
|
-
todayIndicatorHeaderDot: "
|
|
1156
|
-
calendar: "
|
|
1157
|
-
calendarTrack: "
|
|
1158
|
-
calendarToolbar: "
|
|
1159
|
-
headerCell: "
|
|
1160
|
-
headerCellTop: "
|
|
1161
|
-
headerCellBottom: "
|
|
1162
|
-
isActive: "
|
|
1163
|
-
headerColLine: "
|
|
1164
|
-
headerCellStickyText: "
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1169
|
+
root: "_root_1ncav_1",
|
|
1170
|
+
timelineHost: "_timelineHost_1ncav_12",
|
|
1171
|
+
timelineContent: "_timelineContent_1ncav_19",
|
|
1172
|
+
canvas: "_canvas_1ncav_27",
|
|
1173
|
+
weekendBg: "_weekendBg_1ncav_33",
|
|
1174
|
+
colLine: "_colLine_1ncav_40",
|
|
1175
|
+
rowLine: "_rowLine_1ncav_49",
|
|
1176
|
+
rowHoverBg: "_rowHoverBg_1ncav_56",
|
|
1177
|
+
todayIndicator: "_todayIndicator_1ncav_65",
|
|
1178
|
+
todayIndicatorContentLine: "_todayIndicatorContentLine_1ncav_73",
|
|
1179
|
+
todayIndicatorLine: "_todayIndicatorLine_1ncav_77",
|
|
1180
|
+
todayIndicatorHeaderDot: "_todayIndicatorHeaderDot_1ncav_86",
|
|
1181
|
+
calendar: "_calendar_1ncav_98",
|
|
1182
|
+
calendarTrack: "_calendarTrack_1ncav_105",
|
|
1183
|
+
calendarToolbar: "_calendarToolbar_1ncav_112",
|
|
1184
|
+
headerCell: "_headerCell_1ncav_126",
|
|
1185
|
+
headerCellTop: "_headerCellTop_1ncav_140",
|
|
1186
|
+
headerCellBottom: "_headerCellBottom_1ncav_147",
|
|
1187
|
+
isActive: "_isActive_1ncav_152",
|
|
1188
|
+
headerColLine: "_headerColLine_1ncav_156",
|
|
1189
|
+
headerCellStickyText: "_headerCellStickyText_1ncav_164",
|
|
1190
|
+
headerCellDatePrefix: "_headerCellDatePrefix_1ncav_172",
|
|
1191
|
+
offscreenRow: "_offscreenRow_1ncav_178",
|
|
1192
|
+
offscreenTrack: "_offscreenTrack_1ncav_186",
|
|
1193
|
+
offscreenBtn: "_offscreenBtn_1ncav_192",
|
|
1194
|
+
offscreenBtnLeft: "_offscreenBtnLeft_1ncav_216",
|
|
1195
|
+
offscreenBtnRight: "_offscreenBtnRight_1ncav_221",
|
|
1196
|
+
bar: "_bar_1ncav_227",
|
|
1197
|
+
barProgress: "_barProgress_1ncav_245",
|
|
1198
|
+
barResizeHandle: "_barResizeHandle_1ncav_248",
|
|
1199
|
+
isReadonly: "_isReadonly_1ncav_258",
|
|
1200
|
+
isDragging: "_isDragging_1ncav_262",
|
|
1201
|
+
isMicro: "_isMicro_1ncav_274",
|
|
1202
|
+
isFull: "_isFull_1ncav_299",
|
|
1203
|
+
barLabel: "_barLabel_1ncav_303",
|
|
1204
|
+
isHidden: "_isHidden_1ncav_313",
|
|
1205
|
+
isOutside: "_isOutside_1ncav_317",
|
|
1206
|
+
barResizeHandleLeft: "_barResizeHandleLeft_1ncav_355",
|
|
1207
|
+
barResizeHandleRight: "_barResizeHandleRight_1ncav_363"
|
|
1208
|
+
}, mt = {
|
|
1209
|
+
initial: {
|
|
1210
|
+
opacity: 0,
|
|
1211
|
+
x: -10
|
|
1212
|
+
},
|
|
1213
|
+
animate: {
|
|
1214
|
+
opacity: 1,
|
|
1215
|
+
x: 0
|
|
1216
|
+
},
|
|
1217
|
+
exit: {
|
|
1218
|
+
opacity: 0,
|
|
1219
|
+
x: -10
|
|
1220
|
+
},
|
|
1221
|
+
transition: {
|
|
1222
|
+
duration: .16,
|
|
1223
|
+
ease: "easeOut"
|
|
1224
|
+
}
|
|
1225
|
+
}, ht = {
|
|
1226
|
+
duration: .16,
|
|
1227
|
+
ease: "easeOut"
|
|
1228
|
+
}, gt = B.memo(({ label: e, dateLabel: t, isReadingAnchor: n }) => t ? /* @__PURE__ */ z("span", {
|
|
1229
|
+
className: Z.headerCellStickyText,
|
|
1230
|
+
children: [/* @__PURE__ */ R(fe, {
|
|
1231
|
+
initial: !1,
|
|
1232
|
+
mode: "popLayout",
|
|
1233
|
+
children: n ? /* @__PURE__ */ R(X.span, {
|
|
1234
|
+
className: Z.headerCellDatePrefix,
|
|
1235
|
+
initial: mt.initial,
|
|
1236
|
+
animate: mt.animate,
|
|
1237
|
+
exit: mt.exit,
|
|
1238
|
+
transition: mt.transition,
|
|
1239
|
+
children: t
|
|
1240
|
+
}, "date-prefix") : null
|
|
1241
|
+
}), /* @__PURE__ */ R(X.span, {
|
|
1242
|
+
layout: "position",
|
|
1243
|
+
transition: ht,
|
|
1244
|
+
children: e
|
|
1245
|
+
})]
|
|
1246
|
+
}) : /* @__PURE__ */ R("span", {
|
|
1247
|
+
className: Z.headerCellStickyText,
|
|
1248
|
+
children: e
|
|
1249
|
+
})), _t = B.memo(({ timelineWidth: e, viewportWidth: t = 0, scrollLeft: n, trackRef: r, virtualColumns: i, lowerSegments: a, todayLineLeft: o, todayCenterMs: s, showTodayLine: c, viewMode: l, availableModes: u, formatMessage: d, onViewModeChange: f, onTodayClick: p, onScrollPrev: m, onScrollNext: h }) => {
|
|
1250
|
+
let g = K(() => qe({
|
|
1184
1251
|
lowerSegments: a,
|
|
1185
1252
|
viewMode: l,
|
|
1186
1253
|
formatMessage: d
|
|
@@ -1188,17 +1255,16 @@ var Z = {
|
|
|
1188
1255
|
a,
|
|
1189
1256
|
l,
|
|
1190
1257
|
d
|
|
1191
|
-
]), _ =
|
|
1192
|
-
let
|
|
1193
|
-
return g.filter((
|
|
1258
|
+
]), _ = Fe(n, t, e), v = K(() => {
|
|
1259
|
+
let e = _ - 240, n = _ + t + 240;
|
|
1260
|
+
return g.filter((t) => t.left < n && t.left + t.width > e);
|
|
1194
1261
|
}, [
|
|
1195
1262
|
g,
|
|
1196
|
-
|
|
1197
|
-
t
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
endMs: b
|
|
1263
|
+
_,
|
|
1264
|
+
t
|
|
1265
|
+
]), y = K(() => a.length && a.find((e) => s != null && s >= e.startMs && s < e.endMs)?.id || null, [a, s]), b = a[0]?.startMs ?? 0, x = a[a.length - 1]?.endMs ?? 0, S = pt(c, o, e, s ?? NaN, {
|
|
1266
|
+
startMs: b,
|
|
1267
|
+
endMs: x
|
|
1202
1268
|
});
|
|
1203
1269
|
return /* @__PURE__ */ z("div", {
|
|
1204
1270
|
className: Z.calendar,
|
|
@@ -1219,33 +1285,37 @@ var Z = {
|
|
|
1219
1285
|
}
|
|
1220
1286
|
}, `header-line-${t.id}`) : null;
|
|
1221
1287
|
}),
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
children:
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1288
|
+
v.map((e) => {
|
|
1289
|
+
let t = _ >= e.left && _ < e.left + e.width;
|
|
1290
|
+
return /* @__PURE__ */ z(B.Fragment, { children: [/* @__PURE__ */ R("div", {
|
|
1291
|
+
className: Y(Z.headerCell, Z.headerCellTop),
|
|
1292
|
+
"data-testid": "gantt-header-cell-top",
|
|
1293
|
+
style: {
|
|
1294
|
+
left: e.left,
|
|
1295
|
+
width: e.width,
|
|
1296
|
+
height: 34,
|
|
1297
|
+
"--segment-left": `${e.left}px`
|
|
1298
|
+
},
|
|
1299
|
+
children: /* @__PURE__ */ R(gt, {
|
|
1300
|
+
label: e.label,
|
|
1301
|
+
dateLabel: e.dateLabel,
|
|
1302
|
+
isReadingAnchor: t
|
|
1303
|
+
})
|
|
1304
|
+
}), /* @__PURE__ */ R("div", {
|
|
1305
|
+
className: Z.headerColLine,
|
|
1306
|
+
style: {
|
|
1307
|
+
left: e.left + e.width,
|
|
1308
|
+
top: 0,
|
|
1309
|
+
height: 34
|
|
1310
|
+
}
|
|
1311
|
+
})] }, `top-group-${e.id}`);
|
|
1312
|
+
}),
|
|
1243
1313
|
i.map((e) => {
|
|
1244
1314
|
let t = a[e.index];
|
|
1245
1315
|
if (!t) return null;
|
|
1246
|
-
let n = t.id ===
|
|
1316
|
+
let n = t.id === y;
|
|
1247
1317
|
return /* @__PURE__ */ R("div", {
|
|
1248
|
-
className:
|
|
1318
|
+
className: Y(Z.headerCell, Z.headerCellBottom, n && Z.isActive),
|
|
1249
1319
|
"data-testid": "gantt-header-cell-bottom",
|
|
1250
1320
|
style: {
|
|
1251
1321
|
left: t.left,
|
|
@@ -1256,7 +1326,7 @@ var Z = {
|
|
|
1256
1326
|
children: t.label
|
|
1257
1327
|
}, t.id);
|
|
1258
1328
|
}),
|
|
1259
|
-
|
|
1329
|
+
S && /* @__PURE__ */ R("span", {
|
|
1260
1330
|
className: Z.todayIndicatorHeaderDot,
|
|
1261
1331
|
style: { left: o ?? void 0 }
|
|
1262
1332
|
})
|
|
@@ -1264,7 +1334,7 @@ var Z = {
|
|
|
1264
1334
|
}), /* @__PURE__ */ R("div", {
|
|
1265
1335
|
className: Z.calendarToolbar,
|
|
1266
1336
|
"data-testid": "gantt-calendar-toolbar",
|
|
1267
|
-
children: /* @__PURE__ */ R(
|
|
1337
|
+
children: /* @__PURE__ */ R(F, {
|
|
1268
1338
|
viewMode: l,
|
|
1269
1339
|
availableModes: u,
|
|
1270
1340
|
onViewModeChange: f,
|
|
@@ -1277,8 +1347,8 @@ var Z = {
|
|
|
1277
1347
|
});
|
|
1278
1348
|
//#endregion
|
|
1279
1349
|
//#region src/components/Gantt/GanttChart/hooks/useGanttRowVirtualScroll.ts
|
|
1280
|
-
function
|
|
1281
|
-
let [a, o] =
|
|
1350
|
+
function vt({ items: e, contentRef: t, safeRowHeight: n, viewportHeight: r, overscan: i = 4 }) {
|
|
1351
|
+
let [a, o] = J(!1), s = _e({
|
|
1282
1352
|
count: e.length,
|
|
1283
1353
|
getScrollElement: () => t.current,
|
|
1284
1354
|
estimateSize: () => n,
|
|
@@ -1296,8 +1366,8 @@ function pt({ items: e, contentRef: t, safeRowHeight: n, viewportHeight: r, over
|
|
|
1296
1366
|
}
|
|
1297
1367
|
//#endregion
|
|
1298
1368
|
//#region src/components/Gantt/GanttChart/hooks/useOffscreenIndicators.ts
|
|
1299
|
-
function
|
|
1300
|
-
return
|
|
1369
|
+
function yt({ virtualRows: e, normalizedItems: t, visibleStartMs: n, visibleEndMs: r, enabled: i = !0, excludeTaskId: a = null }) {
|
|
1370
|
+
return K(() => {
|
|
1301
1371
|
if (!i || !Array.isArray(e) || !Array.isArray(t) || !Number.isFinite(n) || !Number.isFinite(r) || n >= r) return [];
|
|
1302
1372
|
let o = [];
|
|
1303
1373
|
return e.forEach((e) => {
|
|
@@ -1325,8 +1395,8 @@ function mt({ virtualRows: e, normalizedItems: t, visibleStartMs: n, visibleEndM
|
|
|
1325
1395
|
}
|
|
1326
1396
|
//#endregion
|
|
1327
1397
|
//#region src/components/Gantt/GanttChart/hooks/useRowHoverHighlight.ts
|
|
1328
|
-
function
|
|
1329
|
-
let n =
|
|
1398
|
+
function bt({ normalizedItems: e, safeRowHeight: t }) {
|
|
1399
|
+
let n = me(d, (e) => e.setHighlightTarget), r = me(d, (e) => e.subscribeHighlight), i = me(d, (e) => e.getIsScrollActive), a = q(null), o = q(null), s = q(null), c = q(!1), l = K(() => {
|
|
1330
1400
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
1331
1401
|
for (; n < e.length;) {
|
|
1332
1402
|
let r = e[n]?.parentId;
|
|
@@ -1341,7 +1411,7 @@ function ht({ normalizedItems: e, safeRowHeight: t }) {
|
|
|
1341
1411
|
} else t.set(n, null), n += 1;
|
|
1342
1412
|
}
|
|
1343
1413
|
return t;
|
|
1344
|
-
}, [e]), u =
|
|
1414
|
+
}, [e]), u = q(l);
|
|
1345
1415
|
u.current = l;
|
|
1346
1416
|
let m = U((e, n) => {
|
|
1347
1417
|
let r = o.current;
|
|
@@ -1412,14 +1482,14 @@ function ht({ normalizedItems: e, safeRowHeight: t }) {
|
|
|
1412
1482
|
}
|
|
1413
1483
|
//#endregion
|
|
1414
1484
|
//#region src/components/Gantt/GanttChart/GanttInteractionContext.ts
|
|
1415
|
-
var
|
|
1485
|
+
var xt = pe({
|
|
1416
1486
|
tooltip: null,
|
|
1417
1487
|
isScrolling: !1,
|
|
1418
1488
|
collapsedKeys: void 0,
|
|
1419
1489
|
onBarClick: () => {},
|
|
1420
1490
|
onTaskMouseDown: () => {},
|
|
1421
1491
|
onResizeMouseDown: () => {}
|
|
1422
|
-
}),
|
|
1492
|
+
}), St = (e) => me(xt, e), Ct = pe({
|
|
1423
1493
|
viewMode: "day",
|
|
1424
1494
|
pixelsPerDay: 1,
|
|
1425
1495
|
timelineStartMs: 0,
|
|
@@ -1435,14 +1505,14 @@ var gt = pe({
|
|
|
1435
1505
|
viewportWidth: 0,
|
|
1436
1506
|
timelineWidth: 0,
|
|
1437
1507
|
isInitialLayoutReady: !1
|
|
1438
|
-
}), Q = (e) =>
|
|
1508
|
+
}), Q = (e) => me(Ct, e), wt = (e, t) => {
|
|
1439
1509
|
let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
|
|
1440
1510
|
return `rgba(${parseInt(r.slice(0, 2), 16)}, ${parseInt(r.slice(2, 4), 16)}, ${parseInt(r.slice(4, 6), 16)}, ${t})`;
|
|
1441
|
-
},
|
|
1511
|
+
}, Tt = (e, t) => {
|
|
1442
1512
|
if (!I(e)) return null;
|
|
1443
1513
|
let n = e.trim();
|
|
1444
|
-
return i.test(n) ?
|
|
1445
|
-
},
|
|
1514
|
+
return i.test(n) ? wt(n, t) : null;
|
|
1515
|
+
}, Et = (e, t = 2.5) => {
|
|
1446
1516
|
if (!e || !I(e)) return "#121211";
|
|
1447
1517
|
let n, r, i;
|
|
1448
1518
|
if (e.startsWith("#")) {
|
|
@@ -1461,23 +1531,23 @@ var gt = pe({
|
|
|
1461
1531
|
return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
1462
1532
|
};
|
|
1463
1533
|
return 1.05 / (.2126 * a(n) + .7152 * a(r) + .0722 * a(i) + .05) >= t ? "#ffffff" : "#121211";
|
|
1464
|
-
},
|
|
1465
|
-
if (
|
|
1534
|
+
}, Dt, Ot = () => {
|
|
1535
|
+
if (Dt !== void 0) return Dt;
|
|
1466
1536
|
try {
|
|
1467
|
-
|
|
1537
|
+
Dt = document.createElement("canvas").getContext("2d");
|
|
1468
1538
|
} catch {
|
|
1469
|
-
|
|
1539
|
+
Dt = null;
|
|
1470
1540
|
}
|
|
1471
|
-
return
|
|
1472
|
-
},
|
|
1541
|
+
return Dt;
|
|
1542
|
+
}, kt = (e, t = "12px -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, PingFang SC, Noto Sans, Noto Sans CJK SC, Microsoft YaHei, \"微软雅黑\", sans-serif") => {
|
|
1473
1543
|
if (!e) return 0;
|
|
1474
|
-
let n = String(e), r =
|
|
1544
|
+
let n = String(e), r = Ot();
|
|
1475
1545
|
return r ? (r.font = t, r.measureText(n).width + 20) : n.length * 12 + 20;
|
|
1476
1546
|
};
|
|
1477
1547
|
//#endregion
|
|
1478
1548
|
//#region src/components/Gantt/GanttChart/hooks/useBarTooltipHover.ts
|
|
1479
|
-
function
|
|
1480
|
-
let [e, t] =
|
|
1549
|
+
function At() {
|
|
1550
|
+
let [e, t] = J(null), n = q("idle"), r = U((e) => {
|
|
1481
1551
|
n.current === "frozen" && (n.current = "open");
|
|
1482
1552
|
let r = e.currentTarget.getBoundingClientRect();
|
|
1483
1553
|
t({
|
|
@@ -1493,7 +1563,7 @@ function Tt() {
|
|
|
1493
1563
|
n.current = e ? "open" : "idle", e || t(null);
|
|
1494
1564
|
}, []);
|
|
1495
1565
|
return {
|
|
1496
|
-
virtualReference:
|
|
1566
|
+
virtualReference: K(() => {
|
|
1497
1567
|
if (e) return { getBoundingClientRect: () => ({
|
|
1498
1568
|
width: 0,
|
|
1499
1569
|
height: e.height,
|
|
@@ -1513,13 +1583,13 @@ function Tt() {
|
|
|
1513
1583
|
}
|
|
1514
1584
|
//#endregion
|
|
1515
1585
|
//#region src/components/Gantt/GanttChart/GanttBarTooltip/GanttBarTooltip.tsx
|
|
1516
|
-
var
|
|
1586
|
+
var jt = {
|
|
1517
1587
|
borderRadius: "10px",
|
|
1518
1588
|
padding: 0,
|
|
1519
1589
|
backgroundColor: "#fff",
|
|
1520
1590
|
boxShadow: "0 0 12px 0 rgba(0, 0, 0, 0.08)"
|
|
1521
|
-
},
|
|
1522
|
-
let { virtualReference: a, handleMouseMove: o, handleMouseLeave: s, handleTooltipVisibleChange: c } =
|
|
1591
|
+
}, Mt = ({ item: e, tooltip: t, disabled: r = !1, children: i }) => {
|
|
1592
|
+
let { virtualReference: a, handleMouseMove: o, handleMouseLeave: s, handleTooltipVisibleChange: c } = At(), l = K(() => r || !t ? null : t(e), [
|
|
1523
1593
|
r,
|
|
1524
1594
|
t,
|
|
1525
1595
|
e
|
|
@@ -1536,7 +1606,7 @@ var Et = {
|
|
|
1536
1606
|
zIndex: 8001,
|
|
1537
1607
|
virtualReference: a,
|
|
1538
1608
|
onVisibleChange: c,
|
|
1539
|
-
style:
|
|
1609
|
+
style: jt,
|
|
1540
1610
|
children: i({
|
|
1541
1611
|
onMouseMove: o,
|
|
1542
1612
|
onMouseLeave: s
|
|
@@ -1545,15 +1615,15 @@ var Et = {
|
|
|
1545
1615
|
onMouseMove: () => {},
|
|
1546
1616
|
onMouseLeave: () => {}
|
|
1547
1617
|
}) });
|
|
1548
|
-
},
|
|
1618
|
+
}, Nt = (e, t, n) => ({
|
|
1549
1619
|
...e,
|
|
1550
1620
|
clientX: t,
|
|
1551
1621
|
clientY: n,
|
|
1552
1622
|
preventDefault: () => e.preventDefault(),
|
|
1553
1623
|
stopPropagation: () => e.stopPropagation()
|
|
1554
1624
|
});
|
|
1555
|
-
function
|
|
1556
|
-
let r =
|
|
1625
|
+
function Pt({ enabled: e, onTaskMouseDown: t, onBarClick: n }) {
|
|
1626
|
+
let r = q(null), i = q(null), a = q(t), o = q(n);
|
|
1557
1627
|
W(() => {
|
|
1558
1628
|
a.current = t, o.current = n;
|
|
1559
1629
|
}, [t, n]);
|
|
@@ -1577,7 +1647,7 @@ function kt({ enabled: e, onTaskMouseDown: t, onBarClick: n }) {
|
|
|
1577
1647
|
let d = (e) => {
|
|
1578
1648
|
if (r.current !== u || u.dragStarted) return;
|
|
1579
1649
|
let t = e.clientX - u.startClientX, i = e.clientY - u.startClientY;
|
|
1580
|
-
Math.hypot(t, i) < 5 || (u.dragStarted = !0, s(), a.current?.(
|
|
1650
|
+
Math.hypot(t, i) < 5 || (u.dragStarted = !0, s(), a.current?.(Nt(e, u.startClientX, u.startClientY), n, c, u.width));
|
|
1581
1651
|
}, f = (e) => {
|
|
1582
1652
|
r.current === u && (s(), u.dragStarted || o.current?.(e, n));
|
|
1583
1653
|
};
|
|
@@ -1587,18 +1657,18 @@ function kt({ enabled: e, onTaskMouseDown: t, onBarClick: n }) {
|
|
|
1587
1657
|
}, document.addEventListener("mousemove", d), document.addEventListener("mouseup", f);
|
|
1588
1658
|
}, [e, s]) };
|
|
1589
1659
|
}
|
|
1590
|
-
var
|
|
1591
|
-
let { t: o } = t(), s = Q((e) => e.viewMode), c = Q((e) => e.timelineCoords), l = Q((e) => e.timelineStartMs), u = Q((e) => e.timelineEndMs), d = Q((e) => e.timelineWidth), f =
|
|
1660
|
+
var Ft = B.memo(({ item: e, barTop: n, dragTaskId: r, dragPreview: i, dragPermission: a }) => {
|
|
1661
|
+
let { t: o } = t(), s = Q((e) => e.viewMode), c = Q((e) => e.timelineCoords), l = Q((e) => e.timelineStartMs), u = Q((e) => e.timelineEndMs), d = Q((e) => e.timelineWidth), f = St((e) => e.tooltip), p = St((e) => e.isScrolling), m = St((e) => e.onBarClick), h = St((e) => e.onTaskMouseDown), g = St((e) => e.onResizeMouseDown), _ = p ? null : f, v = r === e.id, y = v && i ? i.previewStartMs : e.startMs, b = v && i ? i.previewEndMs : e.endMs, S = K(() => {
|
|
1592
1662
|
let t = e.color;
|
|
1593
1663
|
return {
|
|
1594
1664
|
baseColor: t,
|
|
1595
|
-
containerBgColor:
|
|
1596
|
-
hoverBorderColor:
|
|
1597
|
-
insideLabelColor:
|
|
1665
|
+
containerBgColor: Tt(t, .2) || t,
|
|
1666
|
+
hoverBorderColor: Tt(t, .5) || "transparent",
|
|
1667
|
+
insideLabelColor: Et(t)
|
|
1598
1668
|
};
|
|
1599
|
-
}, [e.color]), C =
|
|
1669
|
+
}, [e.color]), C = K(() => {
|
|
1600
1670
|
if (y == null || b == null || y >= b || l >= u) return null;
|
|
1601
|
-
let e =
|
|
1671
|
+
let e = Qe({
|
|
1602
1672
|
startMs: y,
|
|
1603
1673
|
endMs: b
|
|
1604
1674
|
}, {
|
|
@@ -1624,71 +1694,71 @@ var At = B.memo(({ item: e, barTop: n, dragTaskId: r, dragPreview: i, dragPermis
|
|
|
1624
1694
|
c,
|
|
1625
1695
|
v,
|
|
1626
1696
|
i
|
|
1627
|
-
]), { baseColor: w, containerBgColor: T, hoverBorderColor: ee, insideLabelColor: E } = S, D = C?.calculatedBarWidth ?? 0, O = e.progress === null, k = !C || y === null || b === null ? 0 : Math.max(0, Math.min(1, (C.rawBarLeft + c.toWidth(C.clippedRange.startMs, Math.min(C.clippedRange.endMs, Math.max(C.clippedRange.startMs, y + (b - y) * Math.max(0, e.progress ?? 0)))) - C.calculatedBarLeft) / C.calculatedBarWidth)), A = O || k >= 1, j = A ? "100%" : `${k * 100}%`, M = a ||
|
|
1628
|
-
enabled:
|
|
1697
|
+
]), { baseColor: w, containerBgColor: T, hoverBorderColor: ee, insideLabelColor: E } = S, D = C?.calculatedBarWidth ?? 0, O = e.progress === null, k = !C || y === null || b === null ? 0 : Math.max(0, Math.min(1, (C.rawBarLeft + c.toWidth(C.clippedRange.startMs, Math.min(C.clippedRange.endMs, Math.max(C.clippedRange.startMs, y + (b - y) * Math.max(0, e.progress ?? 0)))) - C.calculatedBarLeft) / C.calculatedBarWidth)), A = O || k >= 1, j = A ? "100%" : `${k * 100}%`, M = a || xe, te = M.canMove, ne = e.label ?? "", N = typeof ne == "string" ? ne : "", re = D < 40, ie = Math.max(0, D - 10), P = K(() => N ? kt(N) : 0, [N]), ae = !!N && P > ie && !!C && C.calculatedBarLeft + C.calculatedBarWidth + 4 + P <= d, { handlePointerMouseDown: oe } = Pt({
|
|
1698
|
+
enabled: te,
|
|
1629
1699
|
onTaskMouseDown: h,
|
|
1630
1700
|
onBarClick: m
|
|
1631
1701
|
});
|
|
1632
1702
|
if (!C) return null;
|
|
1633
|
-
let { calculatedBarLeft:
|
|
1634
|
-
left:
|
|
1703
|
+
let { calculatedBarLeft: F, clippedStart: se, clippedEnd: ce } = C, I = F + D, B = F + Math.max(40, D + 12) <= d, V = y !== null && b !== null ? s === "quarterMonth" ? x(y, b) : c.toWidth(y, b) : D, H = V < 40 ? Math.max(40, V + 12) : V, U = I + 4 <= d, W = {
|
|
1704
|
+
left: F,
|
|
1635
1705
|
top: n,
|
|
1636
1706
|
width: `var(--bsy-gantt-bar-actual-width, ${D}px)`,
|
|
1637
1707
|
height: 26,
|
|
1638
1708
|
background: T,
|
|
1639
|
-
cursor:
|
|
1709
|
+
cursor: te ? "move" : "default",
|
|
1640
1710
|
"--bsy-gantt-bar-fill-color": w,
|
|
1641
1711
|
"--bsy-gantt-bar-hover-border-color": ee,
|
|
1642
1712
|
"--bsy-gantt-bar-calc-width": `${D}px`,
|
|
1643
1713
|
"--bsy-gantt-bar-label-color": E
|
|
1644
1714
|
};
|
|
1645
|
-
return /* @__PURE__ */ R(
|
|
1715
|
+
return /* @__PURE__ */ R(Mt, {
|
|
1646
1716
|
item: e,
|
|
1647
1717
|
tooltip: _,
|
|
1648
1718
|
disabled: v,
|
|
1649
1719
|
children: ({ onMouseMove: t, onMouseLeave: n }) => /* @__PURE__ */ z("div", {
|
|
1650
|
-
className:
|
|
1651
|
-
[Z.isReadonly]: !
|
|
1720
|
+
className: Y(Z.bar, {
|
|
1721
|
+
[Z.isReadonly]: !te,
|
|
1652
1722
|
[Z.isDragging]: v,
|
|
1653
1723
|
[Z.isMicro]: re && B
|
|
1654
1724
|
}),
|
|
1655
1725
|
"data-testid": "gantt-bar",
|
|
1656
1726
|
style: W,
|
|
1657
1727
|
onMouseDown: (t) => {
|
|
1658
|
-
|
|
1728
|
+
te && oe(t, e, F, H);
|
|
1659
1729
|
},
|
|
1660
1730
|
onClick: (t) => {
|
|
1661
|
-
|
|
1731
|
+
te || m(t, e);
|
|
1662
1732
|
},
|
|
1663
1733
|
onMouseMove: t,
|
|
1664
1734
|
onMouseLeave: n,
|
|
1665
1735
|
children: [
|
|
1666
1736
|
e.type === "task" ? /* @__PURE__ */ R("div", {
|
|
1667
|
-
className:
|
|
1737
|
+
className: Y(Z.barProgress, { [Z.isFull]: A }),
|
|
1668
1738
|
"data-testid": "gantt-bar-progress",
|
|
1669
1739
|
style: { width: j }
|
|
1670
1740
|
}) : null,
|
|
1671
1741
|
/* @__PURE__ */ R("span", {
|
|
1672
|
-
className:
|
|
1742
|
+
className: Y(Z.barLabel, { [Z.isHidden]: ae }),
|
|
1673
1743
|
style: { color: "var(--bsy-gantt-bar-label-color)" },
|
|
1674
|
-
children:
|
|
1744
|
+
children: ne
|
|
1675
1745
|
}),
|
|
1676
|
-
|
|
1677
|
-
className:
|
|
1746
|
+
ae ? /* @__PURE__ */ R("span", {
|
|
1747
|
+
className: Y(Z.barLabel, Z.isOutside),
|
|
1678
1748
|
"data-testid": "gantt-bar-label-outside",
|
|
1679
|
-
children:
|
|
1749
|
+
children: ne
|
|
1680
1750
|
}) : null,
|
|
1681
|
-
M.canResizeStart && !
|
|
1751
|
+
M.canResizeStart && !se || M.canResizeEnd && !ce && U ? /* @__PURE__ */ z(L, { children: [M.canResizeStart && !se ? /* @__PURE__ */ R("button", {
|
|
1682
1752
|
type: "button",
|
|
1683
|
-
className:
|
|
1753
|
+
className: Y(Z.barResizeHandle, Z.barResizeHandleLeft),
|
|
1684
1754
|
"data-testid": "gantt-bar-resize-left",
|
|
1685
|
-
onMouseDown: (t) => g(t, e,
|
|
1755
|
+
onMouseDown: (t) => g(t, e, F, "start", D),
|
|
1686
1756
|
"aria-label": o("gantt.timeBegin")
|
|
1687
|
-
}) : null, M.canResizeEnd && !
|
|
1757
|
+
}) : null, M.canResizeEnd && !ce && U ? /* @__PURE__ */ R("button", {
|
|
1688
1758
|
type: "button",
|
|
1689
|
-
className:
|
|
1759
|
+
className: Y(Z.barResizeHandle, Z.barResizeHandleRight),
|
|
1690
1760
|
"data-testid": "gantt-bar-resize-right",
|
|
1691
|
-
onMouseDown: (t) => g(t, e,
|
|
1761
|
+
onMouseDown: (t) => g(t, e, F, "end", D),
|
|
1692
1762
|
"aria-label": o("gantt.timeEnd")
|
|
1693
1763
|
}) : null] }) : null
|
|
1694
1764
|
]
|
|
@@ -1708,21 +1778,21 @@ var At = B.memo(({ item: e, barTop: n, dragTaskId: r, dragPreview: i, dragPermis
|
|
|
1708
1778
|
progress: "_progress_8s9va_46",
|
|
1709
1779
|
summaryTooltip: "_summaryTooltip_8s9va_56",
|
|
1710
1780
|
summaryTooltipLine: "_summaryTooltipLine_8s9va_66"
|
|
1711
|
-
},
|
|
1712
|
-
function
|
|
1781
|
+
}, It = (e) => String(e).padStart(2, "0");
|
|
1782
|
+
function Lt(e, t) {
|
|
1713
1783
|
if (e == null) return t("summary.empty");
|
|
1714
1784
|
let n = C(e);
|
|
1715
1785
|
return t("summary.datetime", {
|
|
1716
1786
|
year: n.year(),
|
|
1717
|
-
month:
|
|
1718
|
-
day:
|
|
1719
|
-
hour:
|
|
1720
|
-
minute:
|
|
1721
|
-
second:
|
|
1787
|
+
month: It(n.month() + 1),
|
|
1788
|
+
day: It(n.date()),
|
|
1789
|
+
hour: It(n.hour()),
|
|
1790
|
+
minute: It(n.minute()),
|
|
1791
|
+
second: It(n.second())
|
|
1722
1792
|
});
|
|
1723
1793
|
}
|
|
1724
|
-
function
|
|
1725
|
-
let n =
|
|
1794
|
+
function Rt(e, t) {
|
|
1795
|
+
let n = ce(e?.progress), r = n ? Math.max(0, Math.min(1, e.progress ?? 0)) : 0, i = Lt(e?.rawStartMs, t), a = Lt(e?.rawEndMs, t);
|
|
1726
1796
|
return /* @__PURE__ */ z("div", {
|
|
1727
1797
|
className: $.summaryTooltip,
|
|
1728
1798
|
children: [
|
|
@@ -1743,17 +1813,17 @@ function Nt(e, t) {
|
|
|
1743
1813
|
}
|
|
1744
1814
|
//#endregion
|
|
1745
1815
|
//#region src/components/Gantt/GanttChart/GanttSummaryBar/GanttSummaryBar.tsx
|
|
1746
|
-
var
|
|
1816
|
+
var zt = 24, Bt = {
|
|
1747
1817
|
borderRadius: "6px",
|
|
1748
1818
|
padding: 0,
|
|
1749
1819
|
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
1750
1820
|
boxShadow: "none"
|
|
1751
1821
|
};
|
|
1752
|
-
function
|
|
1822
|
+
function Vt(e, t) {
|
|
1753
1823
|
return e == null || e === "__empty__" ? t : e;
|
|
1754
1824
|
}
|
|
1755
|
-
var
|
|
1756
|
-
let { t: a } = t(), o = U((e, t) => a(
|
|
1825
|
+
var Ht = ({ item: r, barTop: i }) => {
|
|
1826
|
+
let { t: a } = t(), o = U((e, t) => a(oe(e), t), [a]), s = Q((e) => e.timelineCoords), c = Q((e) => e.timelineStartMs), l = Q((e) => e.timelineEndMs), u = Q((e) => e.timelineWidth), d = St((e) => e.collapsedKeys), f = St((e) => e.onBarClick), { virtualReference: p, handleMouseMove: m, handleMouseLeave: h, handleTooltipVisibleChange: g } = At(), _ = ce(r.progress) ? Math.max(0, Math.min(1, r.progress ?? 0)) : 0, v = K(() => Rt({
|
|
1757
1827
|
rawStartMs: r.rawStartMs,
|
|
1758
1828
|
rawEndMs: r.rawEndMs,
|
|
1759
1829
|
progress: r.progress
|
|
@@ -1762,9 +1832,9 @@ var Lt = ({ item: r, barTop: i }) => {
|
|
|
1762
1832
|
r.rawEndMs,
|
|
1763
1833
|
r.progress,
|
|
1764
1834
|
o
|
|
1765
|
-
]), y =
|
|
1835
|
+
]), y = K(() => {
|
|
1766
1836
|
if (r.startMs === null || r.endMs === null || r.startMs >= r.endMs || c >= l) return null;
|
|
1767
|
-
let e =
|
|
1837
|
+
let e = Qe({
|
|
1768
1838
|
startMs: r.startMs,
|
|
1769
1839
|
endMs: r.endMs
|
|
1770
1840
|
}, {
|
|
@@ -1774,7 +1844,7 @@ var Lt = ({ item: r, barTop: i }) => {
|
|
|
1774
1844
|
return e ? {
|
|
1775
1845
|
barLeft: s.toX(e.startMs),
|
|
1776
1846
|
barWidth: s.toWidth(e.startMs, e.endMs),
|
|
1777
|
-
wrapperTop: i + (26 -
|
|
1847
|
+
wrapperTop: i + (26 - zt) / 2,
|
|
1778
1848
|
clippedEnd: e.endMs !== r.endMs,
|
|
1779
1849
|
clippedRange: e,
|
|
1780
1850
|
itemStartMs: r.startMs,
|
|
@@ -1789,7 +1859,7 @@ var Lt = ({ item: r, barTop: i }) => {
|
|
|
1789
1859
|
i
|
|
1790
1860
|
]);
|
|
1791
1861
|
if (!y) return null;
|
|
1792
|
-
let { barLeft: b, barWidth: x, wrapperTop: S, clippedEnd: C, clippedRange: w, itemStartMs: T, itemEndMs: ee } = y, E = T + (ee - T) * _, D = Math.min(w.endMs, Math.max(w.startMs, E)), O = s.toWidth(w.startMs, D), k = `${Math.max(0, Math.min(1, O / x)) * 100}%`, A = Math.max(0, u - b), j =
|
|
1862
|
+
let { barLeft: b, barWidth: x, wrapperTop: S, clippedEnd: C, clippedRange: w, itemStartMs: T, itemEndMs: ee } = y, E = T + (ee - T) * _, D = Math.min(w.endMs, Math.max(w.startMs, E)), O = s.toWidth(w.startMs, D), k = `${Math.max(0, Math.min(1, O / x)) * 100}%`, A = Math.max(0, u - b), j = Vt(r.label, a("gantt.emptyGroup")), M = N(d, r.groupKey);
|
|
1793
1863
|
return /* @__PURE__ */ R(n, {
|
|
1794
1864
|
content: v,
|
|
1795
1865
|
placement: "bottom-start",
|
|
@@ -1801,7 +1871,7 @@ var Lt = ({ item: r, barTop: i }) => {
|
|
|
1801
1871
|
zIndex: 8001,
|
|
1802
1872
|
virtualReference: p,
|
|
1803
1873
|
onVisibleChange: g,
|
|
1804
|
-
style:
|
|
1874
|
+
style: Bt,
|
|
1805
1875
|
children: /* @__PURE__ */ z("div", {
|
|
1806
1876
|
className: $.root,
|
|
1807
1877
|
"data-testid": "gantt-summary-bar",
|
|
@@ -1824,7 +1894,7 @@ var Lt = ({ item: r, barTop: i }) => {
|
|
|
1824
1894
|
children: [/* @__PURE__ */ R(e, {
|
|
1825
1895
|
name: "xiangxiazhankai1",
|
|
1826
1896
|
size: 16,
|
|
1827
|
-
className:
|
|
1897
|
+
className: Y($.arrow, { [$.isCollapsed]: M })
|
|
1828
1898
|
}), /* @__PURE__ */ R("span", {
|
|
1829
1899
|
className: $.labelText,
|
|
1830
1900
|
children: j
|
|
@@ -1840,10 +1910,10 @@ var Lt = ({ item: r, barTop: i }) => {
|
|
|
1840
1910
|
})
|
|
1841
1911
|
});
|
|
1842
1912
|
};
|
|
1843
|
-
function
|
|
1913
|
+
function Ut(e, t) {
|
|
1844
1914
|
return e.barTop === t.barTop && e.item === t.item;
|
|
1845
1915
|
}
|
|
1846
|
-
var
|
|
1916
|
+
var Wt = B.memo(Ht, Ut), Gt = B.memo(({ indicators: n = [], onJump: r }) => {
|
|
1847
1917
|
let { t: i } = t();
|
|
1848
1918
|
if (!Array.isArray(n) || n.length === 0) return null;
|
|
1849
1919
|
let a = (e, t) => {
|
|
@@ -1862,7 +1932,7 @@ var zt = B.memo(Lt, Rt), Bt = B.memo(({ indicators: n = [], onJump: r }) => {
|
|
|
1862
1932
|
className: Z.offscreenTrack,
|
|
1863
1933
|
children: [t.showLeft ? /* @__PURE__ */ R("button", {
|
|
1864
1934
|
type: "button",
|
|
1865
|
-
className:
|
|
1935
|
+
className: Y(Z.offscreenBtn, Z.offscreenBtnLeft),
|
|
1866
1936
|
"data-testid": "gantt-offscreen-btn-left",
|
|
1867
1937
|
"aria-label": i("gantt.aria.jumpLeft"),
|
|
1868
1938
|
onClick: (e) => a(e, t),
|
|
@@ -1872,7 +1942,7 @@ var zt = B.memo(Lt, Rt), Bt = B.memo(({ indicators: n = [], onJump: r }) => {
|
|
|
1872
1942
|
})
|
|
1873
1943
|
}) : null, t.showRight ? /* @__PURE__ */ R("button", {
|
|
1874
1944
|
type: "button",
|
|
1875
|
-
className:
|
|
1945
|
+
className: Y(Z.offscreenBtn, Z.offscreenBtnRight),
|
|
1876
1946
|
"data-testid": "gantt-offscreen-btn-right",
|
|
1877
1947
|
"aria-label": i("gantt.aria.jumpRight"),
|
|
1878
1948
|
onClick: (e) => a(e, t),
|
|
@@ -1883,15 +1953,15 @@ var zt = B.memo(Lt, Rt), Bt = B.memo(({ indicators: n = [], onJump: r }) => {
|
|
|
1883
1953
|
}) : null]
|
|
1884
1954
|
})
|
|
1885
1955
|
}, t.rowKey)) });
|
|
1886
|
-
}),
|
|
1887
|
-
className:
|
|
1956
|
+
}), Kt = ({ left: e, height: t, className: n = "" }) => /* @__PURE__ */ R("div", {
|
|
1957
|
+
className: Y(Z.todayIndicator, n),
|
|
1888
1958
|
"data-testid": "gantt-today-indicator-content-line",
|
|
1889
1959
|
style: {
|
|
1890
1960
|
left: e,
|
|
1891
1961
|
height: t
|
|
1892
1962
|
},
|
|
1893
1963
|
children: /* @__PURE__ */ R("span", { className: Z.todayIndicatorLine })
|
|
1894
|
-
}),
|
|
1964
|
+
}), qt = H(function({ canvasHeight: e, weekendSegments: t, virtualColumns: n, lowerSegments: r, shouldShowTodayMarker: i, todayLineLeft: a }) {
|
|
1895
1965
|
return /* @__PURE__ */ z(L, { children: [
|
|
1896
1966
|
t.map((t) => /* @__PURE__ */ R("div", {
|
|
1897
1967
|
className: Z.weekendBg,
|
|
@@ -1911,19 +1981,19 @@ var zt = B.memo(Lt, Rt), Bt = B.memo(({ indicators: n = [], onJump: r }) => {
|
|
|
1911
1981
|
}
|
|
1912
1982
|
}, `line-${n.id}`) : null;
|
|
1913
1983
|
}),
|
|
1914
|
-
i ? /* @__PURE__ */ R(
|
|
1984
|
+
i ? /* @__PURE__ */ R(Kt, {
|
|
1915
1985
|
left: a ?? 0,
|
|
1916
1986
|
height: e,
|
|
1917
1987
|
className: Z.todayIndicatorContentLine
|
|
1918
1988
|
}) : null
|
|
1919
1989
|
] });
|
|
1920
|
-
}),
|
|
1990
|
+
}), Jt = ({ virtualRows: e, normalizedItems: t, dragState: n, dragPermissionById: r, timelineStartMs: i, timelineEndMs: a }) => {
|
|
1921
1991
|
let o = n?.taskId ?? null;
|
|
1922
1992
|
return e.map((e) => {
|
|
1923
1993
|
let s = t[e.index];
|
|
1924
1994
|
if (!s || s.invalid) return null;
|
|
1925
1995
|
let c = o === s.id;
|
|
1926
|
-
if (!c && (s.startMs === null || s.endMs === null || s.startMs >= s.endMs || !
|
|
1996
|
+
if (!c && (s.startMs === null || s.endMs === null || s.startMs >= s.endMs || !Ze({
|
|
1927
1997
|
startMs: s.startMs,
|
|
1928
1998
|
endMs: s.endMs
|
|
1929
1999
|
}, {
|
|
@@ -1931,10 +2001,10 @@ var zt = B.memo(Lt, Rt), Bt = B.memo(({ indicators: n = [], onJump: r }) => {
|
|
|
1931
2001
|
endMs: a
|
|
1932
2002
|
}))) return null;
|
|
1933
2003
|
let l = e.start + (e.size - 26) / 2;
|
|
1934
|
-
return s.type === "summary" ? /* @__PURE__ */ R(
|
|
2004
|
+
return s.type === "summary" ? /* @__PURE__ */ R(Wt, {
|
|
1935
2005
|
item: s,
|
|
1936
2006
|
barTop: l
|
|
1937
|
-
}, `summary-${s.id}`) : /* @__PURE__ */ R(
|
|
2007
|
+
}, `summary-${s.id}`) : /* @__PURE__ */ R(Ft, {
|
|
1938
2008
|
item: s,
|
|
1939
2009
|
barTop: l,
|
|
1940
2010
|
dragTaskId: o,
|
|
@@ -1942,8 +2012,8 @@ var zt = B.memo(Lt, Rt), Bt = B.memo(({ indicators: n = [], onJump: r }) => {
|
|
|
1942
2012
|
dragPermission: r[s.id]
|
|
1943
2013
|
}, `bar-${s.id}`);
|
|
1944
2014
|
});
|
|
1945
|
-
},
|
|
1946
|
-
let o = Q((e) => e.timelineStartMs), s = Q((e) => e.timelineEndMs), c = Q((e) => e.visibleStartMs), l = Q((e) => e.visibleEndMs), u = Q((e) => e.isInitialLayoutReady), d =
|
|
2015
|
+
}, Yt = H(function({ virtualRows: e, normalizedItems: t, dragState: n, dragPermissionById: r, handleOffscreenJump: i, hoverBgRef: a }) {
|
|
2016
|
+
let o = Q((e) => e.timelineStartMs), s = Q((e) => e.timelineEndMs), c = Q((e) => e.visibleStartMs), l = Q((e) => e.visibleEndMs), u = Q((e) => e.isInitialLayoutReady), d = yt({
|
|
1947
2017
|
virtualRows: e,
|
|
1948
2018
|
normalizedItems: t,
|
|
1949
2019
|
visibleStartMs: c,
|
|
@@ -1966,7 +2036,7 @@ var zt = B.memo(Lt, Rt), Bt = B.memo(({ indicators: n = [], onJump: r }) => {
|
|
|
1966
2036
|
"data-testid": "gantt-row-hover-bg",
|
|
1967
2037
|
style: { display: "none" }
|
|
1968
2038
|
}),
|
|
1969
|
-
u &&
|
|
2039
|
+
u && Jt({
|
|
1970
2040
|
virtualRows: e,
|
|
1971
2041
|
normalizedItems: t,
|
|
1972
2042
|
dragState: n,
|
|
@@ -1974,24 +2044,24 @@ var zt = B.memo(Lt, Rt), Bt = B.memo(({ indicators: n = [], onJump: r }) => {
|
|
|
1974
2044
|
timelineStartMs: o,
|
|
1975
2045
|
timelineEndMs: s
|
|
1976
2046
|
}),
|
|
1977
|
-
u ? /* @__PURE__ */ R(
|
|
2047
|
+
u ? /* @__PURE__ */ R(Gt, {
|
|
1978
2048
|
indicators: d,
|
|
1979
2049
|
onJump: i
|
|
1980
2050
|
}) : null
|
|
1981
2051
|
] });
|
|
1982
|
-
}),
|
|
1983
|
-
let _ = Q((e) => e.timelineWidth), { virtualRows: v, canvasHeight: y, isScrolling: b } =
|
|
2052
|
+
}), Xt = H(function({ contentRef: e, normalizedItems: t, safeRowHeight: n, viewportHeight: r, lowerSegments: i, virtualColumns: a, weekendSegments: o, dragState: s, dragPermissionById: c, tooltip: l, handleTaskMouseDown: u, handleResizeMouseDown: d, handleBarClick: f, collapsedKeys: p, handleOffscreenJump: m, todayLineLeft: h, shouldShowTodayMarker: g }) {
|
|
2053
|
+
let _ = Q((e) => e.timelineWidth), { virtualRows: v, canvasHeight: y, isScrolling: b } = vt({
|
|
1984
2054
|
items: t,
|
|
1985
2055
|
contentRef: e,
|
|
1986
2056
|
safeRowHeight: n,
|
|
1987
2057
|
viewportHeight: r
|
|
1988
|
-
}), { hoverBgRef: x, handleContentMouseMove: S, handleContentMouseLeave: C } =
|
|
2058
|
+
}), { hoverBgRef: x, handleContentMouseMove: S, handleContentMouseLeave: C } = bt({
|
|
1989
2059
|
normalizedItems: t,
|
|
1990
2060
|
safeRowHeight: n
|
|
1991
|
-
}), w =
|
|
2061
|
+
}), w = K(() => ({
|
|
1992
2062
|
width: _,
|
|
1993
2063
|
height: y
|
|
1994
|
-
}), [_, y]), T =
|
|
2064
|
+
}), [_, y]), T = K(() => ({
|
|
1995
2065
|
tooltip: l ?? null,
|
|
1996
2066
|
isScrolling: b,
|
|
1997
2067
|
collapsedKeys: p,
|
|
@@ -2012,16 +2082,16 @@ var zt = B.memo(Lt, Rt), Bt = B.memo(({ indicators: n = [], onJump: r }) => {
|
|
|
2012
2082
|
style: w,
|
|
2013
2083
|
onMouseMove: S,
|
|
2014
2084
|
onMouseLeave: C,
|
|
2015
|
-
children: [/* @__PURE__ */ R(
|
|
2085
|
+
children: [/* @__PURE__ */ R(qt, {
|
|
2016
2086
|
canvasHeight: y,
|
|
2017
2087
|
weekendSegments: o,
|
|
2018
2088
|
virtualColumns: a,
|
|
2019
2089
|
lowerSegments: i,
|
|
2020
2090
|
shouldShowTodayMarker: g,
|
|
2021
2091
|
todayLineLeft: h
|
|
2022
|
-
}), /* @__PURE__ */ R(
|
|
2092
|
+
}), /* @__PURE__ */ R(xt.Provider, {
|
|
2023
2093
|
value: T,
|
|
2024
|
-
children: /* @__PURE__ */ R(
|
|
2094
|
+
children: /* @__PURE__ */ R(Yt, {
|
|
2025
2095
|
virtualRows: v,
|
|
2026
2096
|
normalizedItems: t,
|
|
2027
2097
|
dragState: s,
|
|
@@ -2034,8 +2104,8 @@ var zt = B.memo(Lt, Rt), Bt = B.memo(({ indicators: n = [], onJump: r }) => {
|
|
|
2034
2104
|
});
|
|
2035
2105
|
//#endregion
|
|
2036
2106
|
//#region src/components/Gantt/GanttChart/GanttChart.tsx
|
|
2037
|
-
function
|
|
2038
|
-
let { t: v } = t(), y = U((e, t) => v(
|
|
2107
|
+
function Zt({ items: e = [], viewMode: n = "day", availableModes: r, onViewModeChange: i, timeRangeConfig: a = u, pixelsPerDayConfig: o = c, onTaskTimeChange: s, onRowClick: l, tooltip: d, verticalScrollController: f, showWeekendHighlight: p = !0, showTodayLine: m = !0, collapsedKeys: h, onToggleCollapse: g }, _) {
|
|
2108
|
+
let { t: v } = t(), y = U((e, t) => v(oe(e), t), [v]), b = q(null), x = q(null), S = q(null), C = de(x), w = q(null), T = ft(b, x), [ee, E] = J(!1), { pixelsPerDay: D, viewportWidth: O, scrollLeft: k, timelineStartMs: A, timelineEndMs: j, visibleStartMs: M, visibleEndMs: te, lowerSegments: ne, timelineCoords: N, timelineWidth: re, todayCenterMs: ie, todayLineLeft: P, isInitialLayoutReady: ae, handleContentScroll: F, handleTodayClick: se, handleOffscreenJump: ce, handleScrollPrev: I, handleScrollNext: L } = ut({
|
|
2039
2109
|
timeRangeConfig: a,
|
|
2040
2110
|
pixelsPerDayConfig: o,
|
|
2041
2111
|
viewMode: n,
|
|
@@ -2046,19 +2116,19 @@ function Kt({ items: e = [], viewMode: n = "day", availableModes: r, onViewModeC
|
|
|
2046
2116
|
isHorizontalScrollbarInteracting: T,
|
|
2047
2117
|
isTaskBarInteracting: ee
|
|
2048
2118
|
});
|
|
2049
|
-
|
|
2050
|
-
scrollToToday:
|
|
2119
|
+
G(_, () => ({
|
|
2120
|
+
scrollToToday: se,
|
|
2051
2121
|
scrollPrev: I,
|
|
2052
2122
|
scrollNext: L
|
|
2053
2123
|
}), [
|
|
2054
|
-
|
|
2124
|
+
se,
|
|
2055
2125
|
I,
|
|
2056
2126
|
L
|
|
2057
2127
|
]);
|
|
2058
|
-
let { dragState: B, committedRangeById: V, resetCommittedRanges: H, forceResetAllCommittedRanges:
|
|
2128
|
+
let { dragState: B, committedRangeById: V, resetCommittedRanges: H, forceResetAllCommittedRanges: le, handleTaskMouseDown: Y, handleResizeMouseDown: ue, consumeRecentDragResult: fe } = Pe({
|
|
2059
2129
|
pixelsPerDay: D,
|
|
2060
2130
|
viewMode: n,
|
|
2061
|
-
timelineCoords:
|
|
2131
|
+
timelineCoords: N,
|
|
2062
2132
|
onTaskTimeChange: s,
|
|
2063
2133
|
containerRef: x,
|
|
2064
2134
|
onDragInteractionChange: E
|
|
@@ -2073,37 +2143,37 @@ function Kt({ items: e = [], viewMode: n = "day", availableModes: r, onViewModeC
|
|
|
2073
2143
|
}
|
|
2074
2144
|
}
|
|
2075
2145
|
if (w.current = t, r) {
|
|
2076
|
-
|
|
2146
|
+
le();
|
|
2077
2147
|
return;
|
|
2078
2148
|
}
|
|
2079
2149
|
H();
|
|
2080
2150
|
}, [
|
|
2081
2151
|
e,
|
|
2082
2152
|
H,
|
|
2083
|
-
|
|
2153
|
+
le
|
|
2084
2154
|
]);
|
|
2085
|
-
let { normalizedItems:
|
|
2155
|
+
let { normalizedItems: X } = dt({
|
|
2086
2156
|
visibleItems: e,
|
|
2087
2157
|
committedRangeById: V,
|
|
2088
2158
|
viewMode: n
|
|
2089
|
-
}),
|
|
2159
|
+
}), pe = K(() => {
|
|
2090
2160
|
let e = {};
|
|
2091
|
-
return
|
|
2092
|
-
e[t.id] =
|
|
2161
|
+
return X.forEach((t) => {
|
|
2162
|
+
e[t.id] = Se(t);
|
|
2093
2163
|
}), e;
|
|
2094
|
-
}, [
|
|
2095
|
-
let i =
|
|
2096
|
-
i?.canMove &&
|
|
2164
|
+
}, [X]), me = U((e, t, n, r) => {
|
|
2165
|
+
let i = pe[t.id];
|
|
2166
|
+
i?.canMove && Y(e, {
|
|
2097
2167
|
...t,
|
|
2098
2168
|
dragPermission: i
|
|
2099
2169
|
}, n, r);
|
|
2100
|
-
}, [
|
|
2101
|
-
let a =
|
|
2102
|
-
(r === "start" ? a?.canResizeStart : a?.canResizeEnd) &&
|
|
2170
|
+
}, [pe, Y]), he = U((e, t, n, r, i) => {
|
|
2171
|
+
let a = pe[t.id];
|
|
2172
|
+
(r === "start" ? a?.canResizeStart : a?.canResizeEnd) && ue(e, {
|
|
2103
2173
|
...t,
|
|
2104
2174
|
dragPermission: a
|
|
2105
2175
|
}, n, r, i);
|
|
2106
|
-
}, [
|
|
2176
|
+
}, [pe, ue]);
|
|
2107
2177
|
W(() => {
|
|
2108
2178
|
if (!f || !x.current) return;
|
|
2109
2179
|
let e = x.current;
|
|
@@ -2111,8 +2181,8 @@ function Kt({ items: e = [], viewMode: n = "day", availableModes: r, onViewModeC
|
|
|
2111
2181
|
e.scrollTop = t;
|
|
2112
2182
|
} });
|
|
2113
2183
|
}, [f]);
|
|
2114
|
-
let ge = C?.height || 0, { virtualColumns: _e, weekendSegments: ve } =
|
|
2115
|
-
lowerSegments:
|
|
2184
|
+
let ge = C?.height || 0, { virtualColumns: _e, weekendSegments: ve } = ze({
|
|
2185
|
+
lowerSegments: ne,
|
|
2116
2186
|
pixelsPerDay: D,
|
|
2117
2187
|
scrollLeft: k,
|
|
2118
2188
|
viewportWidth: O,
|
|
@@ -2120,11 +2190,11 @@ function Kt({ items: e = [], viewMode: n = "day", availableModes: r, onViewModeC
|
|
|
2120
2190
|
timelineStartMs: A,
|
|
2121
2191
|
timelineWidth: re,
|
|
2122
2192
|
viewMode: n
|
|
2123
|
-
}), ye =
|
|
2193
|
+
}), ye = pt(m, P, re, ie, {
|
|
2124
2194
|
startMs: A,
|
|
2125
2195
|
endMs: j
|
|
2126
|
-
}),
|
|
2127
|
-
if (!(e.target instanceof Element && e.target.closest(`.${Z.barResizeHandle}`)) && !
|
|
2196
|
+
}), be = U((e, t) => {
|
|
2197
|
+
if (!(e.target instanceof Element && e.target.closest(`.${Z.barResizeHandle}`)) && !fe()) {
|
|
2128
2198
|
if (t?.type === "summary") {
|
|
2129
2199
|
let e = t.groupKey;
|
|
2130
2200
|
if (!e || !g) return;
|
|
@@ -2134,55 +2204,55 @@ function Kt({ items: e = [], viewMode: n = "day", availableModes: r, onViewModeC
|
|
|
2134
2204
|
l && l(t, t.rowIndex, e);
|
|
2135
2205
|
}
|
|
2136
2206
|
}, [
|
|
2137
|
-
|
|
2207
|
+
fe,
|
|
2138
2208
|
l,
|
|
2139
2209
|
g
|
|
2140
|
-
]),
|
|
2210
|
+
]), xe = K(() => ({
|
|
2141
2211
|
viewMode: n,
|
|
2142
2212
|
pixelsPerDay: D,
|
|
2143
2213
|
timelineStartMs: A,
|
|
2144
2214
|
timelineEndMs: j,
|
|
2145
2215
|
visibleStartMs: M,
|
|
2146
|
-
visibleEndMs:
|
|
2147
|
-
timelineCoords:
|
|
2216
|
+
visibleEndMs: te,
|
|
2217
|
+
timelineCoords: N,
|
|
2148
2218
|
scrollLeft: k,
|
|
2149
2219
|
viewportWidth: O,
|
|
2150
2220
|
timelineWidth: re,
|
|
2151
|
-
isInitialLayoutReady:
|
|
2221
|
+
isInitialLayoutReady: ae
|
|
2152
2222
|
}), [
|
|
2153
2223
|
n,
|
|
2154
2224
|
D,
|
|
2155
2225
|
A,
|
|
2156
2226
|
j,
|
|
2157
2227
|
M,
|
|
2228
|
+
te,
|
|
2158
2229
|
N,
|
|
2159
|
-
ne,
|
|
2160
2230
|
k,
|
|
2161
2231
|
O,
|
|
2162
2232
|
re,
|
|
2163
|
-
|
|
2233
|
+
ae
|
|
2164
2234
|
]);
|
|
2165
|
-
return /* @__PURE__ */ R(
|
|
2166
|
-
value:
|
|
2235
|
+
return /* @__PURE__ */ R(Ct.Provider, {
|
|
2236
|
+
value: xe,
|
|
2167
2237
|
children: /* @__PURE__ */ z("div", {
|
|
2168
2238
|
className: Z.root,
|
|
2169
2239
|
"data-testid": "gantt-chart",
|
|
2170
|
-
style: { visibility:
|
|
2171
|
-
children: [/* @__PURE__ */ R(
|
|
2240
|
+
style: { visibility: ae ? "visible" : "hidden" },
|
|
2241
|
+
children: [/* @__PURE__ */ R(_t, {
|
|
2172
2242
|
timelineWidth: re,
|
|
2173
2243
|
viewportWidth: O,
|
|
2174
2244
|
scrollLeft: k,
|
|
2175
2245
|
trackRef: S,
|
|
2176
2246
|
virtualColumns: _e,
|
|
2177
|
-
lowerSegments:
|
|
2178
|
-
todayLineLeft:
|
|
2247
|
+
lowerSegments: ne,
|
|
2248
|
+
todayLineLeft: P,
|
|
2179
2249
|
todayCenterMs: ie,
|
|
2180
2250
|
showTodayLine: m,
|
|
2181
2251
|
viewMode: n,
|
|
2182
2252
|
availableModes: r,
|
|
2183
2253
|
formatMessage: y,
|
|
2184
2254
|
onViewModeChange: i,
|
|
2185
|
-
onTodayClick:
|
|
2255
|
+
onTodayClick: se,
|
|
2186
2256
|
onScrollPrev: I,
|
|
2187
2257
|
onScrollNext: L
|
|
2188
2258
|
}), /* @__PURE__ */ R("div", {
|
|
@@ -2195,25 +2265,25 @@ function Kt({ items: e = [], viewMode: n = "day", availableModes: r, onViewModeC
|
|
|
2195
2265
|
role: "region",
|
|
2196
2266
|
"aria-label": v("gantt.aria.timeline"),
|
|
2197
2267
|
onScroll: (e) => {
|
|
2198
|
-
|
|
2268
|
+
F(e), f && f.sync("timeline", e.currentTarget.scrollTop);
|
|
2199
2269
|
},
|
|
2200
|
-
children: /* @__PURE__ */ R(
|
|
2270
|
+
children: /* @__PURE__ */ R(Xt, {
|
|
2201
2271
|
contentRef: x,
|
|
2202
|
-
normalizedItems:
|
|
2272
|
+
normalizedItems: X,
|
|
2203
2273
|
safeRowHeight: 34,
|
|
2204
2274
|
viewportHeight: ge,
|
|
2205
|
-
lowerSegments:
|
|
2275
|
+
lowerSegments: ne,
|
|
2206
2276
|
virtualColumns: _e,
|
|
2207
2277
|
weekendSegments: ve,
|
|
2208
2278
|
dragState: B,
|
|
2209
|
-
dragPermissionById:
|
|
2279
|
+
dragPermissionById: pe,
|
|
2210
2280
|
tooltip: d,
|
|
2211
2281
|
handleTaskMouseDown: me,
|
|
2212
2282
|
handleResizeMouseDown: he,
|
|
2213
|
-
handleBarClick:
|
|
2283
|
+
handleBarClick: be,
|
|
2214
2284
|
collapsedKeys: h,
|
|
2215
|
-
handleOffscreenJump:
|
|
2216
|
-
todayLineLeft:
|
|
2285
|
+
handleOffscreenJump: ce,
|
|
2286
|
+
todayLineLeft: P,
|
|
2217
2287
|
shouldShowTodayMarker: ye
|
|
2218
2288
|
})
|
|
2219
2289
|
})
|
|
@@ -2221,6 +2291,6 @@ function Kt({ items: e = [], viewMode: n = "day", availableModes: r, onViewModeC
|
|
|
2221
2291
|
})
|
|
2222
2292
|
});
|
|
2223
2293
|
}
|
|
2224
|
-
var
|
|
2294
|
+
var Qt = V(Zt);
|
|
2225
2295
|
//#endregion
|
|
2226
|
-
export {
|
|
2296
|
+
export { Qt as t };
|