@baishuyun/ui-base 6.4.0 → 6.4.2

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.
Files changed (67) hide show
  1. package/dist/Amap/AmapProvider/index.js +2 -2
  2. package/dist/Amap/{AmapProvider-By5tTMAj.js → AmapProvider-CwKdpmCg.js} +1 -1
  3. package/dist/Amap/index.js +2 -2
  4. package/dist/Calendar/{AllDaySection-DwQz-p7a.js → AllDaySection-CseF1DuB.js} +1 -1
  5. package/dist/Calendar/{Calendar-CuBzeTkR.js → Calendar-Yu2HfA5D.js} +4 -3
  6. package/dist/Calendar/{EventCard-DRJrT_AG.js → EventCard-L6jaKgEw.js} +1 -0
  7. package/dist/Calendar/index.js +4 -4
  8. package/dist/Calendar/subcomponents/AllDaySection/index.js +2 -2
  9. package/dist/Calendar/subcomponents/EventCard/index.js +1 -1
  10. package/dist/ConfigProvider/index.js +1 -1
  11. package/dist/DatePicker/{DatePicker-B6ZFxTt6.js → DatePicker-PCdNachD.js} +44 -43
  12. package/dist/DatePicker/index.js +1 -1
  13. package/dist/DropDown/{DropDown-C5H9UObs.js → DropDown-CvQAbsEo.js} +8 -8
  14. package/dist/DropDown/index.js +1 -1
  15. package/dist/Editor/{Buttons-B8_yDqF5.js → Buttons-DmSUkHWl.js} +2 -2
  16. package/dist/Editor/ToolbarPlugin/Buttons/index.js +3 -3
  17. package/dist/Editor/index.js +3 -3
  18. package/dist/Gantt/GanttChart/index.js +6 -6
  19. package/dist/Gantt/GanttChart-BgDJOyW1.js +2144 -0
  20. package/dist/Gantt/GanttTable/index.js +3 -3
  21. package/dist/Gantt/{GanttTable-DSTq5XmX.js → GanttTable-Di_p-0M1.js} +2 -2
  22. package/dist/Gantt/GanttToolBar/index.js +4 -4
  23. package/dist/Gantt/GanttToolBar-D5pQdrzv.js +105 -0
  24. package/dist/Gantt/{collapseKeys-BWMH5k37.js → collapseKeys-C8139wvy.js} +34 -30
  25. package/dist/Gantt/{constants-_vMvDXFh.js → constants-D4ur8WRs.js} +16 -17
  26. package/dist/Gantt/index.js +8 -8
  27. package/dist/Gantt/{timelineViewConfig-DshzoBp7.js → timelineViewConfig-BXl2UkN8.js} +1 -1
  28. package/dist/Gantt/utils/index.js +4 -4
  29. package/dist/Modal/{Modal-CrK8gFOn.js → Modal-D3LFqIV4.js} +3 -3
  30. package/dist/Modal/index.js +1 -1
  31. package/dist/Select/{Select-Gkywa_sm.js → Select-OjCjCogR.js} +4 -4
  32. package/dist/Select/index.js +2 -2
  33. package/dist/Table/{Table-DVTq4n2V.js → Table-3-kFIm5v.js} +3 -4
  34. package/dist/Table/index.js +1 -1
  35. package/dist/Tree/index.js +1 -1
  36. package/dist/components/DatePicker/__tests__/DatePicker.triggerActiveClassName.test.d.ts +1 -0
  37. package/dist/components/DatePicker/interface.d.ts +2 -0
  38. package/dist/components/Gantt/GanttChart/GanttTaskBar/GanttTaskBar.d.ts +1 -1
  39. package/dist/components/Gantt/GanttChart/GanttTaskBar/useTaskBarPointer.d.ts +2 -2
  40. package/dist/components/Gantt/GanttChart/OffscreenTaskIndicators/__tests__/OffscreenTaskIndicators.test.d.ts +1 -0
  41. package/dist/components/Gantt/GanttChart/hooks/__tests__/useGanttDrag.clippedQuarterMonth.test.d.ts +0 -0
  42. package/dist/components/Gantt/GanttChart/hooks/__tests__/useOffscreenIndicators.test.d.ts +1 -0
  43. package/dist/components/Gantt/GanttChart/hooks/__tests__/useTimelineViewportController.test.d.ts +0 -0
  44. package/dist/components/Gantt/GanttChart/hooks/useEdgeScroll.d.ts +1 -2
  45. package/dist/components/Gantt/GanttChart/hooks/useGanttDrag.d.ts +3 -3
  46. package/dist/components/Gantt/GanttChart/hooks/useGanttScrollbars.d.ts +1 -1
  47. package/dist/components/Gantt/GanttChart/hooks/useOffscreenIndicators.d.ts +6 -6
  48. package/dist/components/Gantt/GanttChart/hooks/useTimelineViewportController.d.ts +4 -2
  49. package/dist/components/Gantt/GanttChart/utils/__tests__/timelineMarkers.test.d.ts +1 -0
  50. package/dist/components/Gantt/GanttChart/utils/__tests__/timelineRange.test.d.ts +1 -0
  51. package/dist/components/Gantt/GanttChart/utils/__tests__/timelineViewportEngine.test.d.ts +1 -0
  52. package/dist/components/Gantt/GanttChart/utils/constants.d.ts +26 -17
  53. package/dist/components/Gantt/GanttChart/utils/dragEngine.d.ts +2 -0
  54. package/dist/components/Gantt/GanttChart/utils/quarterMonthScale.d.ts +1 -0
  55. package/dist/components/Gantt/GanttChart/utils/timelineFocus.d.ts +0 -34
  56. package/dist/components/Gantt/GanttChart/utils/timelineMarkers.d.ts +2 -1
  57. package/dist/components/Gantt/GanttChart/utils/timelineRange.d.ts +8 -0
  58. package/dist/components/Gantt/GanttChart/utils/timelineViewportEngine.d.ts +44 -0
  59. package/dist/components/Gantt/__tests__/GanttBars.renderWindow.test.d.ts +1 -0
  60. package/dist/components/Gantt/types.internal.d.ts +22 -8
  61. package/dist/index.js +11 -11
  62. package/dist/style.css +1 -1
  63. package/dist/vendors/{ConfigProvider-BRfJ7gWc.js → ConfigProvider-DwmA94S2.js} +5 -0
  64. package/dist/vendors/{Tree-DJpkMB5u.js → Tree-C7BgkjCQ.js} +1 -1
  65. package/package.json +1 -1
  66. package/dist/Gantt/GanttChart-DpmbH0GI.js +0 -1965
  67. package/dist/Gantt/GanttToolBar-fCAi-4zZ.js +0 -91
@@ -0,0 +1,2144 @@
1
+ import { t as e } from "../Icon/Icon-BQ3Whub2.js";
2
+ import { t } from "../vendors/useLocale-BTz4slNW.js";
3
+ import { t as n } from "../Tooltip/Tooltip-DW_XP13m.js";
4
+ 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 "./constants-D4ur8WRs.js";
5
+ import { t as d } from "./GanttHighlightContext-AIpN3-af.js";
6
+ import { n as f, r as p } from "./highlightTarget-DmzCIiQb.js";
7
+ import { a as m, d as h, i as g, n as _, r as v, t as y, u as b } from "./timelineViewConfig-BXl2UkN8.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 N, s as te, t as ne, u as re, v as ie, x as ae, y as P } from "./collapseKeys-C8139wvy.js";
9
+ import { n as oe, t as F } from "./GanttToolBar-D5pQdrzv.js";
10
+ import { isFunction as I, isNumber as L, isString as R } from "lodash-es";
11
+ import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
12
+ import H, { forwardRef as U, memo as W, useCallback as G, useEffect as K, useImperativeHandle as se, useLayoutEffect as ce, useMemo as q, useRef as J, useState as Y } from "react";
13
+ import X from "clsx";
14
+ import { useDocumentVisibility as le, useSize as ue } from "ahooks";
15
+ import { createContext as de, useContextSelector as Z } from "use-context-selector";
16
+ import Q from "dayjs";
17
+ import fe from "dayjs/plugin/isoWeek";
18
+ import { useVirtualizer as pe } from "@tanstack/react-virtual";
19
+ import me from "dayjs/plugin/quarterOfYear";
20
+ import { OverlayScrollbars as he } from "overlayscrollbars";
21
+ //#region src/components/Gantt/GanttChart/utils/dragEngine.ts
22
+ var ge = (e) => e?.type === "task" && e?.draggable !== !1 && !e?.invalid, _e = {
23
+ canMove: !1,
24
+ canResizeStart: !1,
25
+ canResizeEnd: !1
26
+ }, ve = (e) => !e || e.invalid || e.type === "summary" || e.draggable === !1 ? _e : e.dragPermission ? {
27
+ canMove: e.dragPermission.canMove === !0,
28
+ canResizeStart: e.dragPermission.canResizeStart === !0,
29
+ canResizeEnd: e.dragPermission.canResizeEnd === !0
30
+ } : {
31
+ canMove: !0,
32
+ canResizeStart: !0,
33
+ canResizeEnd: !0
34
+ }, ye = (e, t) => ge(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, be = (e, t) => !t || Math.abs(e) < Math.min(5, t) ? 0 : Math.round(e / t), xe = (e, t) => be(e, t), Se = (e, t, n = "round") => {
35
+ if (!t || !Number.isFinite(e)) return e;
36
+ let r = ae(e), i = Q(r).startOf("day").valueOf(), a = (r - i) / t, o;
37
+ return o = n === "floor" ? Math.floor(a) : n === "ceil" ? Math.ceil(a) : Math.round(a), ie(i + o * t);
38
+ }, Ce = (e, t, n) => ({
39
+ startMs: e + n,
40
+ endMs: t + n
41
+ }), we = ({ startMs: e, endMs: t, deltaMs: n, edge: r, minDurationMs: i }) => {
42
+ if (r === "start") {
43
+ let r = t - i;
44
+ return {
45
+ startMs: Math.min(e + n, r),
46
+ endMs: t
47
+ };
48
+ }
49
+ let a = e + i;
50
+ return {
51
+ startMs: e,
52
+ endMs: Math.max(t + n, a)
53
+ };
54
+ }, Te = (e, t, n, r) => {
55
+ 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
+ if (e.dragMode === "move") {
57
+ let t = Math.round((u - c) / s) * s;
58
+ i = e.originStartMs + t, a = e.originEndMs + t;
59
+ } else e.dragMode === "resize-start" ? (i = Se(u, r, "round"), a = e.originEndMs, a - i < r && (i = a - r)) : (a = Se(u, r, "round"), i = e.originStartMs, a - i < r && (a = i + r));
60
+ return {
61
+ deltaUnits: e.dragMode === "resize-end" ? Math.round((a - e.originEndMs) / r) : Math.round((i - e.originStartMs) / r),
62
+ previewStartMs: i,
63
+ previewEndMs: a,
64
+ previewLeftPx: e.dragMode === "resize-end" ? e.originLeftPx : l
65
+ };
66
+ };
67
+ function Ee(e) {
68
+ let t = {
69
+ taskId: String(e.item.id),
70
+ newStart: e.startMs,
71
+ newEnd: e.endMs,
72
+ deltaMs: e.deltaMs,
73
+ snapUnitMs: e.snapUnitMs,
74
+ changeType: e.changeType,
75
+ viewMode: e.viewMode
76
+ };
77
+ if (h(e.viewMode)) return {
78
+ taskId: t.taskId,
79
+ newStart: t.newStart,
80
+ newEnd: t.newEnd,
81
+ deltaMs: t.deltaMs,
82
+ snapUnitMs: t.snapUnitMs,
83
+ changeType: t.changeType,
84
+ viewMode: e.viewMode
85
+ };
86
+ let n = e;
87
+ return {
88
+ taskId: t.taskId,
89
+ newStart: t.newStart,
90
+ newEnd: t.newEnd,
91
+ deltaMs: t.deltaMs,
92
+ snapUnitMs: t.snapUnitMs,
93
+ changeType: t.changeType,
94
+ viewMode: n.viewMode,
95
+ deltaDays: n.deltaDays
96
+ };
97
+ }
98
+ var De = (e) => e && I(e.then) ? e : Promise.resolve(e);
99
+ //#endregion
100
+ //#region src/components/Gantt/GanttChart/hooks/useEdgeScroll.tsx
101
+ function Oe(e, t) {
102
+ return e < 0 ? t * 10 : e >= 60 ? 0 : t * (2 + 8 * (1 - e / 60));
103
+ }
104
+ function ke(e, t) {
105
+ let n = J(null), r = J(0), i = G(() => {
106
+ n.current !== null && cancelAnimationFrame(n.current), n.current = null, r.current = 0;
107
+ }, []);
108
+ K(() => () => {
109
+ n.current !== null && cancelAnimationFrame(n.current);
110
+ }, []);
111
+ let a = G(() => {
112
+ if (n.current !== null) return;
113
+ let i = () => {
114
+ let a = e.current, o = r.current;
115
+ if (!a || o === 0) {
116
+ n.current = null;
117
+ return;
118
+ }
119
+ let s = a.scrollLeft, c = a.scrollWidth - a.clientWidth, l = Math.max(0, Math.min(c, s + o));
120
+ a.scrollLeft = l, l !== s && t?.current?.(), n.current = requestAnimationFrame(i);
121
+ };
122
+ n.current = requestAnimationFrame(i);
123
+ }, [e, t]);
124
+ return {
125
+ startEdgeDetection: G((t, n) => {
126
+ let o = e.current;
127
+ if (!o) return;
128
+ let s = n ?? o.getBoundingClientRect(), c = t - s.left, l = s.right - t, u = c < 60 ? Oe(c, -1) : l < 60 ? Oe(l, 1) : 0;
129
+ r.current = u, u === 0 ? i() : a();
130
+ }, [
131
+ e,
132
+ a,
133
+ i
134
+ ]),
135
+ stopEdgeScroll: i
136
+ };
137
+ }
138
+ //#endregion
139
+ //#region src/components/Gantt/GanttChart/hooks/useGanttDrag.tsx
140
+ function Ae({ pixelsPerDay: e, viewMode: t, timelineCoords: n, onTaskTimeChange: i, containerRef: c, onDragInteractionChange: u }) {
141
+ let d = h(t), f = m(t), p = f / s * e, g = J(n);
142
+ g.current = n;
143
+ let [_, v] = Y({}), [y, b] = Y(null), x = J(null), S = J({
144
+ shouldSuppressClick: !1,
145
+ at: 0
146
+ }), C = J(0), w = J(null), { startEdgeDetection: T, stopEdgeScroll: ee } = ke(c ?? { current: null }, w), E = J({});
147
+ K(() => {
148
+ x.current = y;
149
+ }, [y]), K(() => () => {
150
+ for (let e of Object.values(E.current)) e.timeoutId && clearTimeout(e.timeoutId);
151
+ }, []);
152
+ let D = G(() => {
153
+ v((e) => {
154
+ let t = Object.keys(E.current);
155
+ if (t.length === 0) return {};
156
+ let n = {};
157
+ for (let r of t) e[r] && (n[r] = e[r]);
158
+ return Object.keys(n).length === Object.keys(e).length ? e : n;
159
+ }), S.current = {
160
+ shouldSuppressClick: !1,
161
+ at: 0
162
+ };
163
+ }, []), O = G(() => {
164
+ for (let e of Object.values(E.current)) e.timeoutId && clearTimeout(e.timeoutId);
165
+ E.current = {}, v({}), S.current = {
166
+ shouldSuppressClick: !1,
167
+ at: 0
168
+ };
169
+ }, []), k = G((e, t, n, r, i = 1) => {
170
+ if (!ye(t, r) || t.invalid) return;
171
+ e.preventDefault(), e.stopPropagation();
172
+ 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
+ taskId: t.id,
174
+ item: t,
175
+ startClientX: e.clientX,
176
+ grabOffsetInBar: h,
177
+ originLeftPx: n,
178
+ originWidthPx: p,
179
+ originAnchorPx: m,
180
+ originAnchorMs: g.current.timeAtX(m),
181
+ originStartMs: f,
182
+ originEndMs: d,
183
+ deltaUnits: 0,
184
+ dragMode: r,
185
+ previewLeftPx: n,
186
+ previewStartMs: f,
187
+ previewEndMs: d
188
+ };
189
+ S.current = {
190
+ shouldSuppressClick: !1,
191
+ at: 0
192
+ }, x.current = _, b(_), u?.(!0);
193
+ }, [c, u]), A = G((e, t, n, r) => {
194
+ k(e, t, n, o, r);
195
+ }, [k]), j = G((e, t, n, i, a) => {
196
+ k(e, t, n, i === "start" ? l : r, a);
197
+ }, [k]);
198
+ return K(() => {
199
+ if (!y?.taskId) return;
200
+ let e = (e, t) => {
201
+ let n = x.current;
202
+ if (!n) return;
203
+ let r = c?.current, i = t ?? r?.getBoundingClientRect(), a = r?.scrollLeft ?? 0, o = g.current, s = a + (i ? e - i.left : 0) - n.grabOffsetInBar, l = n.dragMode === "resize-end" ? n.originLeftPx : s, u = s - n.originAnchorPx;
204
+ if (!d) {
205
+ let e = {
206
+ ...Te(n, u, o, f),
207
+ previewLeftPx: l
208
+ };
209
+ if (e.deltaUnits === n.deltaUnits && e.previewLeftPx === n.previewLeftPx && e.previewStartMs === n.previewStartMs && e.previewEndMs === n.previewEndMs) return;
210
+ let t = {
211
+ ...n,
212
+ ...e
213
+ };
214
+ x.current = t, b(t);
215
+ return;
216
+ }
217
+ let m = xe(u, p), h = {
218
+ ...n,
219
+ deltaUnits: m,
220
+ previewLeftPx: l
221
+ };
222
+ if (n.dragMode === "move") {
223
+ let e = Ce(n.originStartMs, n.originEndMs, m * f);
224
+ h.previewStartMs = e.startMs, h.previewEndMs = e.endMs;
225
+ } else {
226
+ let e = we({
227
+ startMs: n.originStartMs,
228
+ endMs: n.originEndMs,
229
+ deltaMs: m * f,
230
+ edge: n.dragMode === "resize-start" ? "start" : "end",
231
+ minDurationMs: f
232
+ });
233
+ h.previewStartMs = e.startMs, h.previewEndMs = e.endMs;
234
+ }
235
+ let _ = Math.round((h.previewStartMs - n.originStartMs) / f), v = {
236
+ ...h,
237
+ deltaUnits: n.dragMode === "resize-end" ? Math.round((h.previewEndMs - n.originEndMs) / f) : _
238
+ };
239
+ v.deltaUnits === n.deltaUnits && v.previewLeftPx === n.previewLeftPx && v.previewStartMs === n.previewStartMs && v.previewEndMs === n.previewEndMs || (x.current = v, b(v));
240
+ };
241
+ w.current = () => {
242
+ e(C.current);
243
+ };
244
+ let n = (t) => {
245
+ C.current = t.clientX;
246
+ let n = c?.current?.getBoundingClientRect() ?? null;
247
+ e(t.clientX, n), T(t.clientX, n ?? void 0);
248
+ }, r = () => {
249
+ ee(), w.current = null, e(C.current);
250
+ let n = x.current;
251
+ if (u?.(!1), !n) return;
252
+ let r = n.previewStartMs !== n.originStartMs || n.previewEndMs !== n.originEndMs;
253
+ S.current = {
254
+ shouldSuppressClick: r,
255
+ at: Date.now()
256
+ };
257
+ let o = r;
258
+ if (!ye(n.item, n.dragMode) || !o || !i) {
259
+ x.current = null, b(null);
260
+ return;
261
+ }
262
+ let c = n.taskId;
263
+ v((e) => ({
264
+ ...e,
265
+ [c]: {
266
+ startMs: n.previewStartMs,
267
+ endMs: n.previewEndMs
268
+ }
269
+ })), x.current = null, b(null);
270
+ let l = (E.current[c]?.opId || 0) + 1;
271
+ E.current[c]?.timeoutId && clearTimeout(E.current[c].timeoutId);
272
+ let p = setTimeout(() => {
273
+ E.current[c]?.opId === l && (console.warn(`[GanttDrag] task ${c} op ${l} timed out (${a}ms)`), v((e) => {
274
+ let t = { ...e };
275
+ return delete t[c], t;
276
+ }), delete E.current[c]);
277
+ }, a);
278
+ E.current[c] = {
279
+ opId: l,
280
+ startedAt: Date.now(),
281
+ timeoutId: p
282
+ };
283
+ let m, g;
284
+ if (d) if (n.dragMode === "move") {
285
+ let e = Se(n.previewStartMs, f, "round"), t = e - n.previewStartMs;
286
+ m = e, g = n.previewEndMs + t;
287
+ } else n.dragMode === "resize-start" ? (m = Se(n.previewStartMs, f, "round"), g = n.previewEndMs) : (m = n.previewStartMs, g = Se(n.previewEndMs, f, "round"));
288
+ else {
289
+ 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;
290
+ m = e ? (n.item.rawStartMs ?? 0) + r * s : n.item.rawStartMs ?? 0, g = t ? (n.item.rawEndMs ?? 0) + i * s : n.item.rawEndMs ?? 0;
291
+ }
292
+ let _;
293
+ _ = h(t) ? Ee({
294
+ item: n.item,
295
+ startMs: m,
296
+ endMs: g,
297
+ deltaMs: n.deltaUnits * f,
298
+ snapUnitMs: f,
299
+ changeType: n.dragMode,
300
+ viewMode: t
301
+ }) : Ee({
302
+ item: n.item,
303
+ startMs: m,
304
+ endMs: g,
305
+ deltaDays: n.deltaUnits,
306
+ deltaMs: n.deltaUnits * f,
307
+ snapUnitMs: f,
308
+ changeType: n.dragMode,
309
+ viewMode: t
310
+ }), De(i(_)).catch((e) => {
311
+ console.error("[GanttChart] onTaskTimeChange rejected", e), E.current[c]?.opId === l && v((e) => {
312
+ let t = { ...e };
313
+ return delete t[c], t;
314
+ });
315
+ }).finally(() => {
316
+ E.current[c]?.opId === l && (clearTimeout(E.current[c].timeoutId), delete E.current[c]);
317
+ });
318
+ }, o = (e) => {
319
+ e.type === "visibilitychange" && document.visibilityState === "visible" || x.current && r();
320
+ };
321
+ return document.addEventListener("mousemove", n), document.addEventListener("mouseup", r), document.addEventListener("mouseleave", o), document.addEventListener("visibilitychange", o), window.addEventListener("blur", o), () => {
322
+ document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", r), document.removeEventListener("mouseleave", o), document.removeEventListener("visibilitychange", o), window.removeEventListener("blur", o), w.current = null;
323
+ };
324
+ }, [
325
+ y?.taskId,
326
+ d,
327
+ f,
328
+ p,
329
+ i,
330
+ e,
331
+ t,
332
+ T,
333
+ ee,
334
+ c,
335
+ u
336
+ ]), {
337
+ dragState: y,
338
+ committedRangeById: _,
339
+ resetCommittedRanges: D,
340
+ forceResetAllCommittedRanges: O,
341
+ handleTaskMouseDown: A,
342
+ handleResizeMouseDown: j,
343
+ consumeRecentDragResult: G(() => {
344
+ let { shouldSuppressClick: e, at: t } = S.current;
345
+ return S.current = {
346
+ shouldSuppressClick: !1,
347
+ at: 0
348
+ }, e ? Date.now() - t <= 400 : !1;
349
+ }, [])
350
+ };
351
+ }
352
+ //#endregion
353
+ //#region src/components/Gantt/GanttChart/utils/timelineFocus.ts
354
+ function je(e, t, n) {
355
+ let r = Number(t) > 0 ? Number(t) : 0, i = Number(n) > 0 ? Number(n) : 0, a = Math.max(0, i - r);
356
+ return Number.isFinite(e) ? Math.min(Math.max(0, e), a) : 0;
357
+ }
358
+ function Me({ anchorMs: e, toX: t, viewportWidth: n, timelineWidth: r }) {
359
+ let i = Number(n) > 0 ? Number(n) : 0;
360
+ if (!Number.isFinite(e) || typeof t != "function" || i <= 0) return 0;
361
+ let a = t(e);
362
+ return Number.isFinite(a) ? je(a - i / 2, i, r) : 0;
363
+ }
364
+ //#endregion
365
+ //#region src/components/Gantt/GanttChart/hooks/useGanttColumnVirtual.ts
366
+ function Ne(e) {
367
+ let t = Number(e);
368
+ return Math.max((Number.isFinite(t) && t > 0 ? t : 0) * 4, 240);
369
+ }
370
+ function Pe(e, t) {
371
+ if (!Array.isArray(e) || e.length === 0) return [];
372
+ let { scrollLeft: n = 0, viewportWidth: r = 0, pixelsPerDay: i } = t || {}, a = Ne(Number(e[0]?.width) > 0 ? Number(e[0].width) : i), o = e[e.length - 1], s = je(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;
373
+ for (; d <= f;) {
374
+ let t = d + f >> 1, n = e[t];
375
+ n.left + n.width > c ? (p = t, f = t - 1) : d = t + 1;
376
+ }
377
+ d = 0, f = u - 1;
378
+ let m = -1;
379
+ for (; d <= f;) {
380
+ let t = d + f >> 1;
381
+ e[t].left < l ? (m = t, d = t + 1) : f = t - 1;
382
+ }
383
+ if (p > m) return [];
384
+ let h = [];
385
+ for (let e = p; e <= m; e += 1) h.push({ index: e });
386
+ return h;
387
+ }
388
+ function Fe({ lowerSegments: e, pixelsPerDay: t, scrollLeft: n, viewportWidth: r, showWeekendHighlight: i, timelineStartMs: a, timelineWidth: o, viewMode: c }) {
389
+ return {
390
+ virtualColumns: q(() => Pe(e, {
391
+ scrollLeft: n,
392
+ viewportWidth: r,
393
+ pixelsPerDay: t
394
+ }), [
395
+ e,
396
+ t,
397
+ n,
398
+ r
399
+ ]),
400
+ weekendSegments: q(() => {
401
+ if (!i || o <= 0 || c !== "day") return [];
402
+ 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 = [];
403
+ for (let e = u; e <= d; e += 1) {
404
+ let n = a + e * s, r = P(n);
405
+ (r === 0 || r === 6) && f.push({
406
+ id: `weekend-${n}`,
407
+ left: e * t,
408
+ width: t
409
+ });
410
+ }
411
+ return f;
412
+ }, [
413
+ i,
414
+ o,
415
+ n,
416
+ r,
417
+ t,
418
+ a,
419
+ c
420
+ ])
421
+ };
422
+ }
423
+ Q.extend(fe), Q.extend(me);
424
+ var Ie = {
425
+ day: {
426
+ amount: 1,
427
+ unit: "day"
428
+ },
429
+ week: {
430
+ amount: 1,
431
+ unit: "week"
432
+ },
433
+ month: {
434
+ amount: 1,
435
+ unit: "month"
436
+ },
437
+ quarter: {
438
+ amount: 1,
439
+ unit: "quarter"
440
+ },
441
+ quarterMonth: {
442
+ amount: 1,
443
+ unit: "month"
444
+ },
445
+ year: {
446
+ amount: 6,
447
+ unit: "month",
448
+ align: (e) => {
449
+ let t = e.month();
450
+ return t !== 0 && t !== 6 ? t < 6 ? e.startOf("year") : e.month(6).startOf("month") : e;
451
+ }
452
+ },
453
+ halfDay: {
454
+ amount: 12,
455
+ unit: "hour"
456
+ },
457
+ sixHour: {
458
+ amount: 6,
459
+ unit: "hour"
460
+ },
461
+ hour: {
462
+ amount: 1,
463
+ unit: "hour"
464
+ },
465
+ halfHour: {
466
+ amount: 30,
467
+ unit: "minute"
468
+ },
469
+ tenMinute: {
470
+ amount: 10,
471
+ unit: "minute"
472
+ },
473
+ oneMinute: {
474
+ amount: 1,
475
+ unit: "minute"
476
+ }
477
+ }, Le = (e, t, n) => {
478
+ switch (t) {
479
+ case "halfDay": return e.hour() < 12 ? n("header.lower.halfDayAm") : n("header.lower.halfDayPm");
480
+ case "sixHour": {
481
+ let t = e.hour();
482
+ return n("header.lower.sixHourRange", {
483
+ start: t,
484
+ end: t + 6
485
+ });
486
+ }
487
+ case "hour": return String(e.hour());
488
+ case "halfHour": return e.format("HH:mm");
489
+ case "tenMinute": return String(e.minute());
490
+ case "oneMinute": return e.format("mm");
491
+ default: return e.format("DD");
492
+ }
493
+ }, Re = (e, t, n) => {
494
+ let r = C(e.valueOf());
495
+ switch (t) {
496
+ case "day": return r.format("DD");
497
+ case "week": return n("header.lower.week", { week: r.isoWeek() });
498
+ case "month":
499
+ case "quarterMonth": return D(e.valueOf(), n);
500
+ case "quarter": return n("header.lower.quarter", { quarter: r.quarter() });
501
+ case "year": return r.month() < 6 ? n("firstHalf") : n("secondHalf");
502
+ default: return Le(r, t, n);
503
+ }
504
+ }, ze = (e, t) => {
505
+ let n = C(e.valueOf()), r = y(t).headerLayout;
506
+ 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")}`;
507
+ }, Be = (e, t, n) => {
508
+ let r = C(e.valueOf()), i = y(t).headerLayout;
509
+ return i === "dayNested" ? n("header.top.monthDay", {
510
+ month: r.month() + 1,
511
+ day: r.date()
512
+ }) : i === "hourNested" ? r.hour() === 0 ? n("header.top.hourWithDate", {
513
+ month: r.month() + 1,
514
+ day: r.date(),
515
+ hour: 0
516
+ }) : n("header.top.hourOnly", { hour: r.hour() }) : i === "quarterNested" ? E(e.valueOf(), n) : t === "day" || t === "week" ? n("header.top.yearMonth", {
517
+ year: r.year(),
518
+ month: r.month() + 1
519
+ }) : n("header.top.year", { year: r.year() });
520
+ }, Ve = (e, t, n, r, i, a, o) => {
521
+ let s = _(r), c = A ?? 100;
522
+ e.push({
523
+ id: `${r}-${t}`,
524
+ startMs: t,
525
+ endMs: n,
526
+ left: s ? e.length * c : M(t, i, a, r),
527
+ width: s ? c : Math.max(1, ee(t, n, a, r)),
528
+ label: Re(Q(t), r, o)
529
+ });
530
+ }, He = ({ viewMode: e, timelineStartMs: t, timelineEndMs: n, pixelsPerDay: r, formatMessage: i }) => {
531
+ let a = [], o = Ie[e] || Ie.day, s = Q(ae(t));
532
+ _(e) && (s = s.startOf("month"));
533
+ let c = Q(ae(n));
534
+ for (; s.isBefore(c);) {
535
+ o.align && (s = o.align(s));
536
+ let n = s.add(o.amount, o.unit);
537
+ Ve(a, ie(s.valueOf()), ie(n.valueOf()), e, t, r, i), s = n;
538
+ }
539
+ return a;
540
+ }, Ue = ({ lowerSegments: e, viewMode: t, formatMessage: n }) => {
541
+ if (!Array.isArray(e) || e.length === 0) return [];
542
+ let r = [], i = null;
543
+ for (let a of e) {
544
+ let e = Q(a.startMs), o = ze(e, t);
545
+ if (!i || i.key !== o) {
546
+ i && r.push({
547
+ id: i.key,
548
+ left: i.left,
549
+ width: i.width,
550
+ label: i.label
551
+ }), i = {
552
+ key: o,
553
+ left: a.left,
554
+ width: a.width,
555
+ label: Be(e, t, n)
556
+ };
557
+ continue;
558
+ }
559
+ i.width += a.width;
560
+ }
561
+ return i !== null && r.push({
562
+ id: i.key,
563
+ left: i.left,
564
+ width: i.width,
565
+ label: i.label
566
+ }), r;
567
+ }, We = (e) => Number.isFinite(e.startMs) && Number.isFinite(e.endMs) && e.startMs < e.endMs, Ge = (e) => {
568
+ if (!We(e)) throw RangeError("Timeline range must be finite and satisfy startMs < endMs");
569
+ }, Ke = (e, t) => {
570
+ if (Ge(e), !Number.isFinite(t)) throw RangeError("Timeline time must be finite");
571
+ return e.startMs <= t && t < e.endMs;
572
+ }, qe = (e, t) => (Ge(e), Ge(t), e.startMs < t.endMs && t.startMs < e.endMs), Je = (e, t) => {
573
+ Ge(e), Ge(t);
574
+ let n = Math.max(e.startMs, t.startMs), r = Math.min(e.endMs, t.endMs);
575
+ return n < r ? {
576
+ startMs: n,
577
+ endMs: r
578
+ } : null;
579
+ }, Ye = (e, t) => {
580
+ if (!Number.isFinite(e) || e <= 0) throw RangeError(`${t} must be finite and greater than zero`);
581
+ }, Xe = (e, t) => {
582
+ if (Number.isFinite(e)) return e;
583
+ if (Number.isFinite(t)) return t;
584
+ throw RangeError("focusMs or fallbackFocusMs must be finite");
585
+ }, Ze = ({ startMs: e, endMs: t, viewMode: n, viewportWidth: r, pixelsPerDay: i }) => {
586
+ let a = (t - e) / s;
587
+ if (a * i >= r) return {
588
+ startMs: e,
589
+ endMs: t
590
+ };
591
+ let o = Math.ceil(r / i), c = Math.ceil((o - a) / 2) * s;
592
+ return S(e - c, t + c, n);
593
+ }, Qe = ({ range: e, focusMs: t, viewMode: n, viewportWidth: r, pixelsPerDay: i }) => {
594
+ let a = (r / 2 + 281) / i * s;
595
+ return Ze({
596
+ ...S(Math.min(e.startMs, t - a), Math.max(e.endMs, t + a), n),
597
+ viewMode: n,
598
+ viewportWidth: r,
599
+ pixelsPerDay: i
600
+ });
601
+ }, $e = ({ renderWindow: e, timelineCoords: t, scrollLeft: n, viewportWidth: r }) => {
602
+ if (!We(e)) throw RangeError("renderWindow must be a valid timeline range");
603
+ if (!Number.isFinite(n) || n < 0) throw RangeError("scrollLeft must be finite and non-negative");
604
+ Ye(r, "viewportWidth");
605
+ let i = {
606
+ startMs: t.timeAtX(n),
607
+ endMs: t.timeAtX(n + r)
608
+ };
609
+ if (!We(i)) throw RangeError("TimelineCoords must produce an increasing finite visible range");
610
+ let a = Je(i, e);
611
+ if (!a) throw RangeError("Visible range must intersect renderWindow");
612
+ let o = t.timeAtX(n + r / 2);
613
+ if (!Number.isFinite(o)) throw RangeError("TimelineCoords must produce a finite focus");
614
+ return {
615
+ renderWindow: e,
616
+ visibleRange: a,
617
+ focusMs: o
618
+ };
619
+ }, et = ({ scrollLeft: e, viewportWidth: t, timelineWidth: n, guardBandPx: r }) => {
620
+ if (!Number.isFinite(e) || e < 0) throw RangeError("scrollLeft must be finite and non-negative");
621
+ if (Ye(t, "viewportWidth"), Ye(n, "timelineWidth"), !Number.isFinite(r) || r < 0) throw RangeError("guardBandPx must be finite and non-negative");
622
+ let i = Math.max(0, n - t);
623
+ if (i === 0) return null;
624
+ let a = Math.min(e, i), o = a <= r;
625
+ return o === i - a <= r ? null : o ? "left" : "right";
626
+ }, tt = ({ focusMs: e, fallbackFocusMs: t, viewMode: n, timeRangeConfig: r, viewportWidth: i, pixelsPerDay: a }) => {
627
+ Ye(i, "viewportWidth"), Ye(a, "pixelsPerDay");
628
+ let o = Xe(e, t), s = Qe({
629
+ range: j(r, o),
630
+ focusMs: o,
631
+ viewMode: n,
632
+ viewportWidth: i,
633
+ pixelsPerDay: a
634
+ });
635
+ if (!We(s)) throw RangeError("Viewport engine produced an invalid render window");
636
+ return s;
637
+ }, nt = ({ focusMs: e, fallbackFocusMs: t, timelineCoords: n, viewportWidth: r, timelineWidth: i }) => {
638
+ let a = Xe(e, t);
639
+ return Ye(r, "viewportWidth"), Ye(i, "timelineWidth"), {
640
+ focusMs: a,
641
+ scrollLeft: Me({
642
+ anchorMs: a,
643
+ toX: n.toX,
644
+ viewportWidth: r,
645
+ timelineWidth: i
646
+ })
647
+ };
648
+ }, rt = (e) => {
649
+ if (v(e)) {
650
+ let t = g(e);
651
+ return Se(Date.now(), t, "floor") + t / 2;
652
+ }
653
+ return T(Date.now()) + s / 2;
654
+ }, it = (e, t) => {
655
+ if (v(t)) {
656
+ let n = g(t);
657
+ return Se(e, n, "floor") + n + 1;
658
+ }
659
+ return T(e) + s + 1;
660
+ }, at = (e) => {
661
+ let [t, n] = Y(() => rt(e)), r = J(null), i = G(() => {
662
+ r.current &&= (clearTimeout(r.current), null);
663
+ }, []), a = G(() => {
664
+ i();
665
+ let t = Date.now(), o = it(t, e);
666
+ r.current = setTimeout(() => {
667
+ n(rt(e)), a();
668
+ }, Math.max(1, o - t));
669
+ }, [i, e]);
670
+ K(() => (n(rt(e)), a(), i), [
671
+ e,
672
+ a,
673
+ i
674
+ ]);
675
+ let o = le();
676
+ return K(() => {
677
+ o === "visible" && (n(rt(e)), a());
678
+ }, [
679
+ o,
680
+ a,
681
+ e
682
+ ]), t;
683
+ };
684
+ //#endregion
685
+ //#region src/components/Gantt/GanttChart/hooks/useTimelineViewportController.ts
686
+ function ot({ timeRangeConfig: e, pixelsPerDayConfig: t, viewMode: n, contentRef: r, contentSize: i, headerTrackRef: a, formatMessage: o, isHorizontalScrollbarInteracting: s, isTaskBarInteracting: c = !1 }) {
687
+ let l = k(n, t), u = q(() => re(n, e), [n, e]), d = i?.width !== null && i?.width !== void 0 && Number(i.width) > 0 ? Number(i.width) : 0, f = J(!1), [p, m] = Y(!1), [h, g] = Y(d), _ = J(null), v = J(!1), y = J(!1), b = J(null), x = J(null), S = J(null), [C, w] = Y(0), T = G((e) => {
688
+ let t = S.current;
689
+ if (!t || !e) return !1;
690
+ let n = e.scrollLeft || 0;
691
+ return Math.abs(n - t.targetLeft) > 1;
692
+ }, []), ee = G((e) => {
693
+ let t = S.current;
694
+ t && Math.abs(e - t.targetLeft) <= 1 && (S.current = null);
695
+ }, []), E = G(() => {
696
+ x.current !== null && (cancelAnimationFrame(x.current), x.current = null), b.current = null;
697
+ }, []), D = G((e) => {
698
+ E();
699
+ let t = { left: e };
700
+ b.current = t, x.current = requestAnimationFrame(() => {
701
+ x.current = null, b.current === t && (b.current = null);
702
+ });
703
+ }, [E]), [O, A] = Y(0), j = J(0), M = J(0), N = J(null), ne = G((e) => {
704
+ M.current = e, N.current === null && (N.current = requestAnimationFrame(() => {
705
+ N.current = null;
706
+ let e = M.current;
707
+ A((t) => t === e ? t : e);
708
+ }));
709
+ }, []);
710
+ K(() => () => {
711
+ N.current !== null && cancelAnimationFrame(N.current), E();
712
+ }, [E]);
713
+ let [ie, ae] = Y(null), P = J(n), oe = P.current === n, F = oe ? ie : null, I = G(() => {
714
+ let e = _.current;
715
+ return e !== null && Number.isFinite(e) ? e : rt(n);
716
+ }, [n]), L = G((e) => {
717
+ Number.isFinite(e) && (_.current = e);
718
+ }, []), R = G((e) => {
719
+ S.current = null;
720
+ let t = tt({
721
+ focusMs: e,
722
+ fallbackFocusMs: I(),
723
+ viewMode: n,
724
+ timeRangeConfig: u,
725
+ viewportWidth: h || 1e3,
726
+ pixelsPerDay: l
727
+ });
728
+ return ae(t), v.current = !0, t;
729
+ }, [
730
+ u,
731
+ l,
732
+ I,
733
+ n,
734
+ h
735
+ ]);
736
+ K(() => {
737
+ P.current = n, R(I());
738
+ }, [e?.bufferDaysBefore, e?.bufferDaysAfter]), ce(() => {
739
+ 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;
740
+ n > 0 && n !== h && g(n);
741
+ }, [
742
+ r,
743
+ i?.width,
744
+ h
745
+ ]);
746
+ let z = q(() => F || tt({
747
+ focusMs: I(),
748
+ viewMode: n,
749
+ timeRangeConfig: u,
750
+ viewportWidth: h || 1e3,
751
+ pixelsPerDay: l
752
+ }), [
753
+ F,
754
+ u,
755
+ l,
756
+ I,
757
+ n,
758
+ h
759
+ ]), { timelineStartMs: B, timelineEndMs: V } = q(() => ({
760
+ timelineStartMs: z.startMs,
761
+ timelineEndMs: z.endMs
762
+ }), [z]), H = q(() => He({
763
+ viewMode: n,
764
+ timelineStartMs: B,
765
+ timelineEndMs: V,
766
+ pixelsPerDay: l,
767
+ formatMessage: o
768
+ }), [
769
+ n,
770
+ B,
771
+ V,
772
+ l,
773
+ o
774
+ ]), U = q(() => te({
775
+ viewMode: n,
776
+ timelineStartMs: B,
777
+ timelineEndMs: V,
778
+ pixelsPerDay: l,
779
+ lowerSegments: H
780
+ }), [
781
+ n,
782
+ B,
783
+ V,
784
+ l,
785
+ H
786
+ ]), W = q(() => {
787
+ if (H.length === 0) return 0;
788
+ let e = H[H.length - 1];
789
+ return e.left + e.width;
790
+ }, [H]), se = G(() => v.current ? !1 : (R(I()), !0), [I, R]);
791
+ ce(() => {
792
+ P.current !== n && (P.current = n, R(I()));
793
+ }, [
794
+ n,
795
+ I,
796
+ R
797
+ ]);
798
+ let X = at(n), le = q(() => W <= 0 ? null : U.toX(X), [
799
+ X,
800
+ U,
801
+ W
802
+ ]), ue = G((e) => {
803
+ let t = a?.current;
804
+ t && t.style.setProperty("--gantt-scroll-left", `${e}px`);
805
+ }, [a]), de = G((e, t) => {
806
+ D(t), e.scrollLeft = t, ue(t), A(t), j.current = t;
807
+ }, [ue, D]), Z = G(() => {
808
+ let e = r.current, t = h;
809
+ if (!e || t <= 0 || W <= 0) return !1;
810
+ let { scrollLeft: n } = nt({
811
+ focusMs: _.current ?? NaN,
812
+ fallbackFocusMs: I(),
813
+ timelineCoords: U,
814
+ viewportWidth: t,
815
+ timelineWidth: W
816
+ });
817
+ return de(e, n), !0;
818
+ }, [
819
+ de,
820
+ r,
821
+ I,
822
+ U,
823
+ W,
824
+ h
825
+ ]), Q = G((e) => {
826
+ let t = e.currentTarget.scrollLeft, n = h, r = b.current, i = r !== null && Math.abs(t - r.left) <= 1;
827
+ r && E(), !i && f.current && (y.current = !0), ue(t);
828
+ let a = t !== j.current;
829
+ if (j.current = t, a && ne(t), n > 0 && !i) {
830
+ let e = je(t, n, W);
831
+ L($e({
832
+ renderWindow: {
833
+ startMs: B,
834
+ endMs: V
835
+ },
836
+ timelineCoords: U,
837
+ scrollLeft: e,
838
+ viewportWidth: n
839
+ }).focusMs);
840
+ }
841
+ ee(t);
842
+ }, [
843
+ ue,
844
+ E,
845
+ U,
846
+ h,
847
+ ne,
848
+ L,
849
+ ee,
850
+ V,
851
+ B,
852
+ W
853
+ ]), fe = G(() => {
854
+ let e = rt(n);
855
+ L(e), R(e);
856
+ }, [
857
+ R,
858
+ L,
859
+ n
860
+ ]), pe = G((e) => {
861
+ let t = r.current, n = e?.targetMs;
862
+ if (!t || !Number.isFinite(n)) return;
863
+ let i = t.clientWidth > 0 ? t.clientWidth : h;
864
+ if (n < B || n >= V) {
865
+ S.current = null, L(n), R(n);
866
+ return;
867
+ }
868
+ let a = Me({
869
+ anchorMs: n,
870
+ toX: U.toX,
871
+ viewportWidth: i,
872
+ timelineWidth: W
873
+ }), o = t.scrollLeft || 0;
874
+ if (!(i > 0 && Math.abs(a - o) <= i * 1.5)) {
875
+ L(n), R(n);
876
+ return;
877
+ }
878
+ let s = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
879
+ s === "smooth" ? S.current = { targetLeft: a } : (S.current = null, D(a)), t.scrollTo({
880
+ left: a,
881
+ behavior: s
882
+ }), L(n), s === "auto" && (ue(a), A(a), j.current = a);
883
+ }, [
884
+ ue,
885
+ r,
886
+ D,
887
+ R,
888
+ L,
889
+ U,
890
+ V,
891
+ B,
892
+ W,
893
+ h
894
+ ]);
895
+ K(() => {
896
+ if (!f.current || !h || !W || v.current || !y.current) return;
897
+ let e = r.current, t = e?.scrollLeft ?? O, n = et({
898
+ scrollLeft: Math.max(0, t),
899
+ viewportWidth: h,
900
+ timelineWidth: W,
901
+ guardBandPx: 280
902
+ });
903
+ s || c || T(e) || (e && ee(e.scrollLeft || 0), n && se());
904
+ }, [
905
+ O,
906
+ W,
907
+ h,
908
+ r,
909
+ T,
910
+ ee,
911
+ se,
912
+ s,
913
+ c,
914
+ C
915
+ ]), ce(() => {
916
+ !f.current || h <= 0 || R(I());
917
+ }, [
918
+ I,
919
+ R,
920
+ h
921
+ ]), ce(() => {
922
+ v.current && (h <= 0 || W <= 0 || Z() && (v.current = !1, f.current || (f.current = !0, m(!0))));
923
+ }, [
924
+ Z,
925
+ W,
926
+ h,
927
+ ie
928
+ ]), ce(() => {
929
+ if (!f.current && h > 0 && W > 0) {
930
+ if (Number.isFinite(_.current ?? NaN) || L(rt(n)), !ie) {
931
+ R(I());
932
+ return;
933
+ }
934
+ v.current = !0, Z(), v.current = !1, f.current = !0, m(!0);
935
+ }
936
+ }, [
937
+ Z,
938
+ I,
939
+ R,
940
+ L,
941
+ ie,
942
+ W,
943
+ h,
944
+ n
945
+ ]);
946
+ let me = G((e) => {
947
+ let t = h;
948
+ t <= 0 || L(U.timeAtX(e + t / 2));
949
+ }, [
950
+ h,
951
+ U,
952
+ L
953
+ ]), he = G(() => {
954
+ let e = r.current;
955
+ if (!e) return;
956
+ let t = h, n = e.scrollLeft || 0, i = Math.max(0, n - t);
957
+ if (Math.abs(i - n) <= 1) {
958
+ S.current = null;
959
+ let e = U.timeAtX(n - t / 2);
960
+ L(e), R(e);
961
+ return;
962
+ }
963
+ S.current = { targetLeft: i }, e.scrollTo({
964
+ left: i,
965
+ behavior: "smooth"
966
+ }), me(i);
967
+ }, [
968
+ r,
969
+ R,
970
+ L,
971
+ U,
972
+ me,
973
+ h
974
+ ]), ge = G(() => {
975
+ let e = r.current;
976
+ if (!e) return;
977
+ let t = h, n = e.scrollLeft || 0, i = Math.max(0, W - t), a = je(n + t, t, W);
978
+ if (Math.abs(a - n) <= 1) {
979
+ if (S.current = null, a >= i - 1) {
980
+ let e = U.timeAtX(n + t * 1.5);
981
+ L(e), R(e);
982
+ }
983
+ return;
984
+ }
985
+ S.current = { targetLeft: a }, e.scrollTo({
986
+ left: a,
987
+ behavior: "smooth"
988
+ }), me(a);
989
+ }, [
990
+ r,
991
+ R,
992
+ L,
993
+ U,
994
+ h,
995
+ W,
996
+ me
997
+ ]);
998
+ K(() => {
999
+ let e = r.current;
1000
+ if (!e) return;
1001
+ let t = () => {
1002
+ S.current && (S.current = null, w((e) => e + 1));
1003
+ };
1004
+ return e.addEventListener("scrollend", t), () => e.removeEventListener("scrollend", t);
1005
+ }, [r]);
1006
+ let _e = (!oe || v.current) && W > 0 && h > 0 ? nt({
1007
+ focusMs: _.current ?? NaN,
1008
+ fallbackFocusMs: I(),
1009
+ timelineCoords: U,
1010
+ viewportWidth: h,
1011
+ timelineWidth: W
1012
+ }).scrollLeft : O, { visibleStartMs: ve, visibleEndMs: ye } = q(() => {
1013
+ if (W <= 0 || h <= 0) return {
1014
+ visibleStartMs: B,
1015
+ visibleEndMs: B
1016
+ };
1017
+ let e = je(_e, h, W), { visibleRange: t } = $e({
1018
+ renderWindow: {
1019
+ startMs: B,
1020
+ endMs: V
1021
+ },
1022
+ timelineCoords: U,
1023
+ scrollLeft: e,
1024
+ viewportWidth: h
1025
+ });
1026
+ return {
1027
+ visibleStartMs: t.startMs,
1028
+ visibleEndMs: t.endMs
1029
+ };
1030
+ }, [
1031
+ _e,
1032
+ U,
1033
+ V,
1034
+ B,
1035
+ W,
1036
+ h
1037
+ ]);
1038
+ return {
1039
+ pixelsPerDay: l,
1040
+ viewportWidth: h,
1041
+ scrollLeft: _e,
1042
+ timelineStartMs: B,
1043
+ timelineEndMs: V,
1044
+ visibleStartMs: ve,
1045
+ visibleEndMs: ye,
1046
+ lowerSegments: H,
1047
+ timelineCoords: U,
1048
+ timelineWidth: W,
1049
+ todayCenterMs: X,
1050
+ todayLineLeft: le,
1051
+ isInitialLayoutReady: p,
1052
+ handleContentScroll: Q,
1053
+ handleTodayClick: fe,
1054
+ handleOffscreenJump: pe,
1055
+ handleScrollPrev: he,
1056
+ handleScrollNext: ge
1057
+ };
1058
+ }
1059
+ //#endregion
1060
+ //#region src/components/Gantt/GanttChart/hooks/useNormalizedItems.ts
1061
+ function st({ visibleItems: e, committedRangeById: t = {}, viewMode: n = "day" }) {
1062
+ return { normalizedItems: q(() => {
1063
+ let r = Array.isArray(e) ? e : [], i = [], a = b(n) ? n : "day";
1064
+ for (let e = 0; e < r.length; e++) {
1065
+ let n = r[e], o = String(n?.id ?? `row-${e}`), { rawStartMs: s, rawEndMs: c, baseStartMs: l, baseEndMs: u, invalid: d } = N(n?.start, n?.end), f = t[o], p = n?.type === "summary" ? !1 : d, m = O({
1066
+ rawStartMs: s,
1067
+ rawEndMs: c,
1068
+ baseStartMs: l,
1069
+ baseEndMs: u
1070
+ }, a), h = m.startMs, g = m.endMs;
1071
+ if (!p && f?.startMs && f?.endMs) {
1072
+ let e = f.startMs, t = f.endMs;
1073
+ Number.isFinite(e) && Number.isFinite(t) && t > e && (h = e, g = t);
1074
+ }
1075
+ i.push({
1076
+ ...n,
1077
+ id: o,
1078
+ rowIndex: e,
1079
+ parentId: n?.parentId ?? void 0,
1080
+ groupKey: n?.groupKey ?? void 0,
1081
+ recordId: n?.recordId ?? void 0,
1082
+ rawStartMs: s,
1083
+ rawEndMs: c,
1084
+ baseStartMs: l,
1085
+ baseEndMs: u,
1086
+ startMs: h,
1087
+ endMs: g,
1088
+ invalid: p,
1089
+ progress: n?.progress === null || n?.progress === void 0 ? null : w(n.progress)
1090
+ });
1091
+ }
1092
+ return i;
1093
+ }, [
1094
+ e,
1095
+ t,
1096
+ n
1097
+ ]) };
1098
+ }
1099
+ //#endregion
1100
+ //#region src/components/Gantt/GanttChart/hooks/useGanttScrollbars.tsx
1101
+ function ct(e, t) {
1102
+ let [n, r] = Y(!1);
1103
+ return ce(() => {
1104
+ let n = e.current, i = t.current;
1105
+ if (!n || !i) return;
1106
+ let a = he({
1107
+ target: n,
1108
+ elements: { viewport: i }
1109
+ }, { scrollbars: {
1110
+ theme: "os-theme-bsy",
1111
+ autoHide: "leave",
1112
+ autoHideDelay: 600,
1113
+ clickScroll: !0
1114
+ } }), o = a.elements().scrollbarHorizontal.scrollbar, s = !1, c = null, l = (e) => {
1115
+ e.pointerType === "mouse" && e.button !== 0 || (s = !0, c = e.pointerId, r(!0));
1116
+ }, u = (e) => {
1117
+ if (!s) return;
1118
+ let t = e.pointerId, n = "pointerId" in e && L(t) ? t : null;
1119
+ n !== null && c !== null && n !== c || (s = !1, c = null, r(!1));
1120
+ }, d = { capture: !0 };
1121
+ 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), () => {
1122
+ o.removeEventListener("pointerdown", l, d), o.removeEventListener("lostpointercapture", u, d), document.removeEventListener("pointerup", u, d), document.removeEventListener("pointercancel", u, d), document.removeEventListener("lostpointercapture", u, d), window.removeEventListener("blur", u), a?.destroy();
1123
+ };
1124
+ }, [e, t]), n;
1125
+ }
1126
+ //#endregion
1127
+ //#region src/components/Gantt/GanttChart/utils/timelineMarkers.ts
1128
+ function lt(e, t, n, r, i) {
1129
+ return !!e && Number.isFinite(r) && Ke(i, r) && t !== null && Number.isFinite(t) && t >= 0 && t <= n;
1130
+ }
1131
+ var ut = H.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 }) => {
1132
+ let g = q(() => Ue({
1133
+ lowerSegments: a,
1134
+ viewMode: l,
1135
+ formatMessage: d
1136
+ }), [
1137
+ a,
1138
+ l,
1139
+ d
1140
+ ]), _ = q(() => {
1141
+ let r = je(n, t, e), i = r - 240, a = r + t + 240;
1142
+ return g.filter((e) => e.left < a && e.left + e.width > i);
1143
+ }, [
1144
+ g,
1145
+ n,
1146
+ t,
1147
+ e
1148
+ ]), v = q(() => a.length && a.find((e) => s != null && s >= e.startMs && s < e.endMs)?.id || null, [a, s]), y = a[0]?.startMs ?? 0, b = a[a.length - 1]?.endMs ?? 0, x = lt(c, o, e, s ?? NaN, {
1149
+ startMs: y,
1150
+ endMs: b
1151
+ });
1152
+ return /* @__PURE__ */ V("div", {
1153
+ className: "bsy-gantt-chart__calendar",
1154
+ children: [/* @__PURE__ */ V("div", {
1155
+ ref: r,
1156
+ className: "bsy-gantt-chart__calendar-track",
1157
+ style: { width: e },
1158
+ children: [
1159
+ i.map((e) => {
1160
+ let t = a[e.index];
1161
+ return t ? /* @__PURE__ */ B("div", {
1162
+ className: "bsy-gantt-chart__header-col-line",
1163
+ style: {
1164
+ left: t.left,
1165
+ top: 34,
1166
+ height: 34
1167
+ }
1168
+ }, `header-line-${t.id}`) : null;
1169
+ }),
1170
+ _.map((e) => /* @__PURE__ */ V(H.Fragment, { children: [/* @__PURE__ */ B("div", {
1171
+ className: "bsy-gantt-chart__header-cell bsy-gantt-chart__header-cell--top",
1172
+ style: {
1173
+ left: e.left,
1174
+ width: e.width,
1175
+ height: 34,
1176
+ "--segment-left": `${e.left}px`
1177
+ },
1178
+ children: /* @__PURE__ */ B("span", {
1179
+ className: "bsy-gantt-chart__header-cell-sticky-text",
1180
+ children: e.label
1181
+ })
1182
+ }), /* @__PURE__ */ B("div", {
1183
+ className: "bsy-gantt-chart__header-col-line",
1184
+ style: {
1185
+ left: e.left + e.width,
1186
+ top: 0,
1187
+ height: 34
1188
+ }
1189
+ })] }, `top-group-${e.id}`)),
1190
+ i.map((e) => {
1191
+ let t = a[e.index];
1192
+ return t ? /* @__PURE__ */ B("div", {
1193
+ className: X("bsy-gantt-chart__header-cell", "bsy-gantt-chart__header-cell--bottom", t.id === v && "bsy-gantt-chart__header-cell--bottom-active"),
1194
+ style: {
1195
+ left: t.left,
1196
+ width: t.width,
1197
+ height: 34,
1198
+ top: 34
1199
+ },
1200
+ children: t.label
1201
+ }, t.id) : null;
1202
+ }),
1203
+ x && /* @__PURE__ */ B("span", {
1204
+ className: "bsy-gantt-chart__today-indicator--header-dot",
1205
+ style: { left: o ?? void 0 }
1206
+ })
1207
+ ]
1208
+ }), /* @__PURE__ */ B("div", {
1209
+ className: "bsy-gantt-chart__calendar-toolbar",
1210
+ children: /* @__PURE__ */ B(F, {
1211
+ viewMode: l,
1212
+ availableModes: u,
1213
+ onViewModeChange: f,
1214
+ onTodayClick: p,
1215
+ onScrollPrev: m,
1216
+ onScrollNext: h
1217
+ })
1218
+ })]
1219
+ });
1220
+ });
1221
+ //#endregion
1222
+ //#region src/components/Gantt/GanttChart/hooks/useGanttRowVirtualScroll.ts
1223
+ function dt({ items: e, contentRef: t, safeRowHeight: n, viewportHeight: r, overscan: i = 4 }) {
1224
+ let [a, o] = Y(!1), s = pe({
1225
+ count: e.length,
1226
+ getScrollElement: () => t.current,
1227
+ estimateSize: () => n,
1228
+ overscan: i,
1229
+ onChange: (e) => {
1230
+ let t = !!e?.isScrolling;
1231
+ o((e) => e === t ? e : t);
1232
+ }
1233
+ });
1234
+ return {
1235
+ virtualRows: s.getVirtualItems(),
1236
+ canvasHeight: Math.max(s.getTotalSize(), r),
1237
+ isScrolling: a
1238
+ };
1239
+ }
1240
+ //#endregion
1241
+ //#region src/components/Gantt/GanttChart/hooks/useOffscreenIndicators.ts
1242
+ function ft({ virtualRows: e, normalizedItems: t, visibleStartMs: n, visibleEndMs: r, enabled: i = !0, excludeTaskId: a = null }) {
1243
+ return q(() => {
1244
+ if (!i || !Array.isArray(e) || !Array.isArray(t) || !Number.isFinite(n) || !Number.isFinite(r) || n >= r) return [];
1245
+ let o = [];
1246
+ return e.forEach((e) => {
1247
+ let i = t[e.index];
1248
+ if (!i || i.invalid || a !== null && i.id === a || i.type === "summary" || i.startMs === null || i.startMs === void 0 || i.endMs === null || i.endMs === void 0) return;
1249
+ let s = i.endMs <= n, c = i.startMs >= r;
1250
+ !s && !c || o.push({
1251
+ rowKey: `offscreen-${i.id}-${e.key}`,
1252
+ rowTop: e.start,
1253
+ rowHeight: e.size,
1254
+ showLeft: s,
1255
+ showRight: c,
1256
+ targetMs: i.startMs,
1257
+ taskId: i.id
1258
+ });
1259
+ }), o;
1260
+ }, [
1261
+ e,
1262
+ t,
1263
+ n,
1264
+ r,
1265
+ i,
1266
+ a
1267
+ ]);
1268
+ }
1269
+ //#endregion
1270
+ //#region src/components/Gantt/GanttChart/hooks/useRowHoverHighlight.ts
1271
+ function pt({ normalizedItems: e, safeRowHeight: t }) {
1272
+ let n = Z(d, (e) => e.setHighlightTarget), r = Z(d, (e) => e.subscribeHighlight), i = Z(d, (e) => e.getIsScrollActive), a = J(null), o = J(null), s = J(null), c = J(!1), l = q(() => {
1273
+ let t = /* @__PURE__ */ new Map(), n = 0;
1274
+ for (; n < e.length;) {
1275
+ let r = e[n]?.parentId;
1276
+ if (r) {
1277
+ let i = n;
1278
+ for (; i < e.length && e[i]?.parentId === r;) i += 1;
1279
+ for (let e = n; e < i; e += 1) t.set(e, {
1280
+ startIndex: n,
1281
+ endIndex: i - 1
1282
+ });
1283
+ n = i;
1284
+ } else t.set(n, null), n += 1;
1285
+ }
1286
+ return t;
1287
+ }, [e]), u = J(l);
1288
+ u.current = l;
1289
+ let m = G((e, n) => {
1290
+ let r = o.current;
1291
+ r && (r.style.top = `${e * t}px`, r.style.height = `${(n - e + 1) * t}px`, r.style.display = "block");
1292
+ }, [t]), h = G(() => {
1293
+ let e = o.current;
1294
+ e && (e.style.display = "none");
1295
+ }, []), g = G((t) => {
1296
+ if (!t) {
1297
+ h();
1298
+ return;
1299
+ }
1300
+ let n = t.type, r = t.id, i = -1, a = -1;
1301
+ for (let t = 0; t < e.length; t += 1) {
1302
+ let o = p(e[t]);
1303
+ o && o.type === n && o.id === r && (i === -1 && (i = t), a = t);
1304
+ }
1305
+ if (i === -1) {
1306
+ h();
1307
+ return;
1308
+ }
1309
+ m(i, a);
1310
+ }, [
1311
+ e,
1312
+ m,
1313
+ h
1314
+ ]), _ = G((r) => {
1315
+ if (i?.()) {
1316
+ a.current !== null && (a.current = null, h()), c.current = !1;
1317
+ return;
1318
+ }
1319
+ c.current = !0;
1320
+ let o = r.currentTarget, l = o.getBoundingClientRect(), d = r.clientY - l.top + o.scrollTop, g = Math.floor(d / t);
1321
+ if (g < 0 || g >= e.length) {
1322
+ a.current !== null && (a.current = null, h(), s.current !== null && (s.current = null, n?.(null)));
1323
+ return;
1324
+ }
1325
+ if (a.current !== g) {
1326
+ a.current = g;
1327
+ let t = u.current.get(g);
1328
+ m(t ? t.startIndex : g, t ? t.endIndex : g);
1329
+ let r = p(e[g]);
1330
+ f(s.current, r) || (s.current = r, n?.(r));
1331
+ }
1332
+ }, [
1333
+ t,
1334
+ e,
1335
+ n,
1336
+ m,
1337
+ h,
1338
+ i
1339
+ ]), v = G(() => {
1340
+ c.current = !1, a.current = null, h(), s.current !== null && (s.current = null, n?.(null));
1341
+ }, [n, h]);
1342
+ return K(() => {
1343
+ if (r) return r((e, t) => {
1344
+ if (t?.source === "table") {
1345
+ c.current = !1, a.current = null, s.current = e, g(e);
1346
+ return;
1347
+ }
1348
+ c.current || g(e);
1349
+ });
1350
+ }, [r, g]), {
1351
+ hoverBgRef: o,
1352
+ handleContentMouseMove: _,
1353
+ handleContentMouseLeave: v
1354
+ };
1355
+ }
1356
+ //#endregion
1357
+ //#region src/components/Gantt/GanttChart/GanttInteractionContext.ts
1358
+ var mt = de({
1359
+ tooltip: null,
1360
+ isScrolling: !1,
1361
+ collapsedKeys: void 0,
1362
+ onBarClick: () => {},
1363
+ onTaskMouseDown: () => {},
1364
+ onResizeMouseDown: () => {}
1365
+ }), ht = (e) => Z(mt, e), gt = de({
1366
+ viewMode: "day",
1367
+ pixelsPerDay: 1,
1368
+ timelineStartMs: 0,
1369
+ timelineEndMs: 0,
1370
+ visibleStartMs: 0,
1371
+ visibleEndMs: 0,
1372
+ timelineCoords: {
1373
+ toX: () => 0,
1374
+ toWidth: () => 0,
1375
+ timeAtX: () => 0
1376
+ },
1377
+ scrollLeft: 0,
1378
+ viewportWidth: 0,
1379
+ timelineWidth: 0,
1380
+ isInitialLayoutReady: !1
1381
+ }), $ = (e) => Z(gt, e), _t = (e, t) => {
1382
+ let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
1383
+ return `rgba(${parseInt(r.slice(0, 2), 16)}, ${parseInt(r.slice(2, 4), 16)}, ${parseInt(r.slice(4, 6), 16)}, ${t})`;
1384
+ }, vt = (e, t) => {
1385
+ if (!R(e)) return null;
1386
+ let n = e.trim();
1387
+ return i.test(n) ? _t(n, t) : null;
1388
+ }, yt = (e, t = 2.5) => {
1389
+ if (!e || !R(e)) return "#121211";
1390
+ let n, r, i;
1391
+ if (e.startsWith("#")) {
1392
+ let t = e.replace("#", ""), a = t.length === 3 ? [...t].map((e) => e + e) : [
1393
+ t.slice(0, 2),
1394
+ t.slice(2, 4),
1395
+ t.slice(4, 6)
1396
+ ];
1397
+ [n, r, i] = a.map((e) => parseInt(e, 16));
1398
+ } else {
1399
+ let t = (e.match(/\d+/g) || []).map(Number);
1400
+ if ([n, r, i] = t.slice(0, 3), n === void 0 || Number.isNaN(n)) return "#121211";
1401
+ }
1402
+ let a = (e) => {
1403
+ let t = e / 255;
1404
+ return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
1405
+ };
1406
+ return 1.05 / (.2126 * a(n) + .7152 * a(r) + .0722 * a(i) + .05) >= t ? "#ffffff" : "#121211";
1407
+ }, bt, xt = () => {
1408
+ if (bt !== void 0) return bt;
1409
+ try {
1410
+ bt = document.createElement("canvas").getContext("2d");
1411
+ } catch {
1412
+ bt = null;
1413
+ }
1414
+ return bt;
1415
+ }, St = (e, t = "12px -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, PingFang SC, Noto Sans, Noto Sans CJK SC, Microsoft YaHei, \"微软雅黑\", sans-serif") => {
1416
+ if (!e) return 0;
1417
+ let n = String(e), r = xt();
1418
+ return r ? (r.font = t, r.measureText(n).width + 20) : n.length * 12 + 20;
1419
+ };
1420
+ //#endregion
1421
+ //#region src/components/Gantt/GanttChart/hooks/useBarTooltipHover.ts
1422
+ function Ct() {
1423
+ let [e, t] = Y(null), n = J("idle"), r = G((e) => {
1424
+ n.current === "frozen" && (n.current = "open");
1425
+ let r = e.currentTarget.getBoundingClientRect();
1426
+ t({
1427
+ x: e.clientX,
1428
+ y: r.y,
1429
+ top: r.top,
1430
+ bottom: r.bottom,
1431
+ height: r.height
1432
+ });
1433
+ }, []), i = G(() => {
1434
+ n.current === "open" ? n.current = "frozen" : t(null);
1435
+ }, []), a = G((e) => {
1436
+ n.current = e ? "open" : "idle", e || t(null);
1437
+ }, []);
1438
+ return {
1439
+ virtualReference: q(() => {
1440
+ if (e) return { getBoundingClientRect: () => ({
1441
+ width: 0,
1442
+ height: e.height,
1443
+ x: e.x,
1444
+ y: e.y,
1445
+ top: e.top,
1446
+ bottom: e.bottom,
1447
+ left: e.x,
1448
+ right: e.x,
1449
+ toJSON: () => ({})
1450
+ }) };
1451
+ }, [e]),
1452
+ handleMouseMove: r,
1453
+ handleMouseLeave: i,
1454
+ handleTooltipVisibleChange: a
1455
+ };
1456
+ }
1457
+ //#endregion
1458
+ //#region src/components/Gantt/GanttChart/GanttBarTooltip/GanttBarTooltip.tsx
1459
+ var wt = {
1460
+ borderRadius: "10px",
1461
+ padding: 0,
1462
+ backgroundColor: "#fff",
1463
+ boxShadow: "0 0 12px 0 rgba(0, 0, 0, 0.08)"
1464
+ }, Tt = ({ item: e, tooltip: t, disabled: r = !1, children: i }) => {
1465
+ let { virtualReference: a, handleMouseMove: o, handleMouseLeave: s, handleTooltipVisibleChange: c } = Ct(), l = q(() => r || !t ? null : t(e), [
1466
+ r,
1467
+ t,
1468
+ e
1469
+ ]);
1470
+ return l ? /* @__PURE__ */ B(n, {
1471
+ content: l,
1472
+ placement: "bottom",
1473
+ showArrow: !1,
1474
+ hoverDelay: 300,
1475
+ moveToFloatingKeepOpen: !0,
1476
+ widthMode: "manual",
1477
+ maxWidth: 400,
1478
+ offset: 5,
1479
+ zIndex: 8001,
1480
+ virtualReference: a,
1481
+ onVisibleChange: c,
1482
+ style: wt,
1483
+ children: i({
1484
+ onMouseMove: o,
1485
+ onMouseLeave: s
1486
+ })
1487
+ }) : /* @__PURE__ */ B(z, { children: i({
1488
+ onMouseMove: () => {},
1489
+ onMouseLeave: () => {}
1490
+ }) });
1491
+ }, Et = (e, t, n) => ({
1492
+ ...e,
1493
+ clientX: t,
1494
+ clientY: n,
1495
+ preventDefault: () => e.preventDefault(),
1496
+ stopPropagation: () => e.stopPropagation()
1497
+ });
1498
+ function Dt({ enabled: e, onTaskMouseDown: t, onBarClick: n }) {
1499
+ let r = J(null), i = J(null), a = J(t), o = J(n);
1500
+ K(() => {
1501
+ a.current = t, o.current = n;
1502
+ }, [t, n]);
1503
+ let s = G(() => {
1504
+ r.current = null;
1505
+ let e = i.current;
1506
+ e && (document.removeEventListener("mousemove", e.move), document.removeEventListener("mouseup", e.up), i.current = null);
1507
+ }, []);
1508
+ return K(() => () => s(), [s]), { handlePointerMouseDown: G((t, n, c, l = 1) => {
1509
+ if (!e) return;
1510
+ s();
1511
+ let u = {
1512
+ item: n,
1513
+ baseLeft: c,
1514
+ width: l,
1515
+ startClientX: t.clientX,
1516
+ startClientY: t.clientY,
1517
+ dragStarted: !1
1518
+ };
1519
+ r.current = u;
1520
+ let d = (e) => {
1521
+ if (r.current !== u || u.dragStarted) return;
1522
+ let t = e.clientX - u.startClientX, i = e.clientY - u.startClientY;
1523
+ Math.hypot(t, i) < 5 || (u.dragStarted = !0, s(), a.current?.(Et(e, u.startClientX, u.startClientY), n, c, u.width));
1524
+ }, f = (e) => {
1525
+ r.current === u && (s(), u.dragStarted || o.current?.(e, n));
1526
+ };
1527
+ i.current = {
1528
+ move: d,
1529
+ up: f
1530
+ }, document.addEventListener("mousemove", d), document.addEventListener("mouseup", f);
1531
+ }, [e, s]) };
1532
+ }
1533
+ var Ot = H.memo(({ item: e, barTop: n, dragTaskId: r, dragPreview: i, dragPermission: a }) => {
1534
+ let { t: o } = t(), s = $((e) => e.viewMode), c = $((e) => e.timelineCoords), l = $((e) => e.timelineStartMs), u = $((e) => e.timelineEndMs), d = $((e) => e.timelineWidth), f = ht((e) => e.tooltip), p = ht((e) => e.isScrolling), m = ht((e) => e.onBarClick), h = ht((e) => e.onTaskMouseDown), g = ht((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 = q(() => {
1535
+ let t = e.color;
1536
+ return {
1537
+ baseColor: t,
1538
+ containerBgColor: vt(t, .2) || t,
1539
+ hoverBorderColor: vt(t, .5) || "transparent",
1540
+ insideLabelColor: yt(t)
1541
+ };
1542
+ }, [e.color]), C = q(() => {
1543
+ if (y == null || b == null || y >= b || l >= u) return null;
1544
+ let e = Je({
1545
+ startMs: y,
1546
+ endMs: b
1547
+ }, {
1548
+ startMs: l,
1549
+ endMs: u
1550
+ });
1551
+ if (!e) return null;
1552
+ let t = c.toX(e.startMs), n = c.toWidth(e.startMs, e.endMs), r = t + n, a = e.startMs !== y, o = e.endMs !== b, s = v && i && Number.isFinite(i.previewLeftPx), f = s && !a ? i.previewLeftPx : t, p = s && !o ? f + n : r, m = Math.max(0, f), h = Math.min(d, p);
1553
+ return m >= h ? null : {
1554
+ clippedRange: e,
1555
+ rawBarLeft: f,
1556
+ calculatedBarLeft: m,
1557
+ calculatedBarWidth: h - m,
1558
+ clippedStart: a || m !== f,
1559
+ clippedEnd: o || h !== p
1560
+ };
1561
+ }, [
1562
+ y,
1563
+ b,
1564
+ l,
1565
+ u,
1566
+ d,
1567
+ c,
1568
+ v,
1569
+ i
1570
+ ]), { 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 || _e, N = M.canMove, te = e.label ?? "", ne = typeof te == "string" ? te : "", re = D < 40, ie = Math.max(0, D - 10), ae = q(() => ne ? St(ne) : 0, [ne]), P = !!ne && ae > ie && !!C && C.calculatedBarLeft + C.calculatedBarWidth + 4 + ae <= d, { handlePointerMouseDown: oe } = Dt({
1571
+ enabled: N,
1572
+ onTaskMouseDown: h,
1573
+ onBarClick: m
1574
+ });
1575
+ if (!C) return null;
1576
+ let { calculatedBarLeft: F, clippedStart: I, clippedEnd: L } = C, R = F + D, H = F + Math.max(40, D + 12) <= d, U = y !== null && b !== null ? s === "quarterMonth" ? x(y, b) : c.toWidth(y, b) : D, W = U < 40 ? Math.max(40, U + 12) : U, G = R + 4 <= d, K = {
1577
+ left: F,
1578
+ top: n,
1579
+ width: `var(--bsy-gantt-bar-actual-width, ${D}px)`,
1580
+ height: 26,
1581
+ background: T,
1582
+ cursor: N ? "move" : "default",
1583
+ "--bsy-gantt-bar-fill-color": w,
1584
+ "--bsy-gantt-bar-hover-border-color": ee,
1585
+ "--bsy-gantt-bar-calc-width": `${D}px`,
1586
+ "--bsy-gantt-bar-label-color": E
1587
+ };
1588
+ return /* @__PURE__ */ B(Tt, {
1589
+ item: e,
1590
+ tooltip: _,
1591
+ disabled: v,
1592
+ children: ({ onMouseMove: t, onMouseLeave: n }) => /* @__PURE__ */ V("div", {
1593
+ className: X("bsy-gantt-chart__bar", `bsy-gantt-chart__bar--${e.type || "task"}`, {
1594
+ "bsy-gantt-chart__bar--readonly": !N,
1595
+ "bsy-gantt-chart__bar--dragging": v,
1596
+ "bsy-gantt-chart__bar--micro": re && H
1597
+ }),
1598
+ style: K,
1599
+ onMouseDown: (t) => {
1600
+ N && oe(t, e, F, W);
1601
+ },
1602
+ onClick: (t) => {
1603
+ N || m(t, e);
1604
+ },
1605
+ onMouseMove: t,
1606
+ onMouseLeave: n,
1607
+ children: [
1608
+ e.type === "task" ? /* @__PURE__ */ B("div", {
1609
+ className: X("bsy-gantt-chart__bar-progress", { "bsy-gantt-chart__bar-progress--full": A }),
1610
+ style: { width: j }
1611
+ }) : null,
1612
+ /* @__PURE__ */ B("span", {
1613
+ className: X("bsy-gantt-chart__bar-label", { "bsy-gantt-chart__bar-label--hidden": P }),
1614
+ style: { color: "var(--bsy-gantt-bar-label-color)" },
1615
+ children: te
1616
+ }),
1617
+ P ? /* @__PURE__ */ B("span", {
1618
+ className: "bsy-gantt-chart__bar-label bsy-gantt-chart__bar-label--outside",
1619
+ style: { color: "#121211" },
1620
+ children: te
1621
+ }) : null,
1622
+ M.canResizeStart && !I || M.canResizeEnd && !L && G ? /* @__PURE__ */ V(z, { children: [M.canResizeStart && !I ? /* @__PURE__ */ B("button", {
1623
+ type: "button",
1624
+ className: "bsy-gantt-chart__bar-resize-handle bsy-gantt-chart__bar-resize-handle--left",
1625
+ onMouseDown: (t) => g(t, e, F, "start", D),
1626
+ "aria-label": o("gantt.timeBegin")
1627
+ }) : null, M.canResizeEnd && !L && G ? /* @__PURE__ */ B("button", {
1628
+ type: "button",
1629
+ className: "bsy-gantt-chart__bar-resize-handle bsy-gantt-chart__bar-resize-handle--right",
1630
+ onMouseDown: (t) => g(t, e, F, "end", D),
1631
+ "aria-label": o("gantt.timeEnd")
1632
+ }) : null] }) : null
1633
+ ]
1634
+ }, `bar-${e.id}`)
1635
+ });
1636
+ }, (e, t) => {
1637
+ if (e.barTop !== t.barTop || e.dragTaskId !== t.dragTaskId || e.dragPermission?.canMove !== t.dragPermission?.canMove || e.dragPermission?.canResizeStart !== t.dragPermission?.canResizeStart || e.dragPermission?.canResizeEnd !== t.dragPermission?.canResizeEnd || e.item !== t.item) return !1;
1638
+ let n = e.dragPreview, r = t.dragPreview;
1639
+ return !(n !== r && (!n || !r || n.previewStartMs !== r.previewStartMs || n.previewEndMs !== r.previewEndMs || n.previewLeftPx !== r.previewLeftPx));
1640
+ }), kt = (e) => String(e).padStart(2, "0");
1641
+ function At(e, t) {
1642
+ if (e == null) return t("summary.empty");
1643
+ let n = C(e);
1644
+ return t("summary.datetime", {
1645
+ year: n.year(),
1646
+ month: kt(n.month() + 1),
1647
+ day: kt(n.date()),
1648
+ hour: kt(n.hour()),
1649
+ minute: kt(n.minute()),
1650
+ second: kt(n.second())
1651
+ });
1652
+ }
1653
+ function jt(e, t) {
1654
+ let n = L(e?.progress), r = n ? Math.max(0, Math.min(1, e.progress ?? 0)) : 0, i = At(e?.rawStartMs, t), a = At(e?.rawEndMs, t);
1655
+ return /* @__PURE__ */ V("div", {
1656
+ className: "bsy-gantt-summary-tooltip",
1657
+ children: [
1658
+ /* @__PURE__ */ B("p", {
1659
+ className: "bsy-gantt-summary-tooltip__line",
1660
+ children: t("summary.startTime", { datetime: i })
1661
+ }),
1662
+ /* @__PURE__ */ B("p", {
1663
+ className: "bsy-gantt-summary-tooltip__line",
1664
+ children: t("summary.endTime", { datetime: a })
1665
+ }),
1666
+ n ? /* @__PURE__ */ B("p", {
1667
+ className: "bsy-gantt-summary-tooltip__line",
1668
+ children: t("summary.progress", { percent: Math.round(r * 100) })
1669
+ }) : null
1670
+ ]
1671
+ });
1672
+ }
1673
+ //#endregion
1674
+ //#region src/components/Gantt/GanttChart/GanttSummaryBar/GanttSummaryBar.tsx
1675
+ var Mt = 24, Nt = {
1676
+ borderRadius: "6px",
1677
+ padding: 0,
1678
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
1679
+ boxShadow: "none"
1680
+ };
1681
+ function Pt(e, t) {
1682
+ return e == null || e === "__empty__" ? t : e;
1683
+ }
1684
+ var Ft = ({ item: r, barTop: i }) => {
1685
+ let { t: a } = t(), o = G((e, t) => a(oe(e), t), [a]), s = $((e) => e.timelineCoords), c = $((e) => e.timelineStartMs), l = $((e) => e.timelineEndMs), u = $((e) => e.timelineWidth), d = ht((e) => e.collapsedKeys), f = ht((e) => e.onBarClick), { virtualReference: p, handleMouseMove: m, handleMouseLeave: h, handleTooltipVisibleChange: g } = Ct(), _ = L(r.progress) ? Math.max(0, Math.min(1, r.progress ?? 0)) : 0, v = q(() => jt({
1686
+ rawStartMs: r.rawStartMs,
1687
+ rawEndMs: r.rawEndMs,
1688
+ progress: r.progress
1689
+ }, o), [
1690
+ r.rawStartMs,
1691
+ r.rawEndMs,
1692
+ r.progress,
1693
+ o
1694
+ ]), y = q(() => {
1695
+ if (r.startMs === null || r.endMs === null || r.startMs >= r.endMs || c >= l) return null;
1696
+ let e = Je({
1697
+ startMs: r.startMs,
1698
+ endMs: r.endMs
1699
+ }, {
1700
+ startMs: c,
1701
+ endMs: l
1702
+ });
1703
+ return e ? {
1704
+ barLeft: s.toX(e.startMs),
1705
+ barWidth: s.toWidth(e.startMs, e.endMs),
1706
+ wrapperTop: i + (26 - Mt) / 2,
1707
+ clippedEnd: e.endMs !== r.endMs,
1708
+ clippedRange: e,
1709
+ itemStartMs: r.startMs,
1710
+ itemEndMs: r.endMs
1711
+ } : null;
1712
+ }, [
1713
+ r.startMs,
1714
+ r.endMs,
1715
+ c,
1716
+ l,
1717
+ s,
1718
+ i
1719
+ ]);
1720
+ if (!y) return null;
1721
+ 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 = Pt(r.label, a("gantt.emptyGroup")), M = ne(d, r.groupKey);
1722
+ return /* @__PURE__ */ B(n, {
1723
+ content: v,
1724
+ placement: "bottom-start",
1725
+ showArrow: !1,
1726
+ hoverDelay: 300,
1727
+ moveToFloatingKeepOpen: !1,
1728
+ widthMode: "content",
1729
+ offset: 5,
1730
+ zIndex: 8001,
1731
+ virtualReference: p,
1732
+ onVisibleChange: g,
1733
+ style: Nt,
1734
+ children: /* @__PURE__ */ V("div", {
1735
+ className: "bsy-gantt-summary-bar",
1736
+ style: {
1737
+ left: b,
1738
+ top: S,
1739
+ width: x,
1740
+ overflow: C ? "hidden" : void 0
1741
+ },
1742
+ onClick: (e) => f?.(e, r),
1743
+ onMouseMove: m,
1744
+ onMouseLeave: h,
1745
+ children: [/* @__PURE__ */ V("div", {
1746
+ className: "bsy-gantt-summary-bar__label",
1747
+ style: {
1748
+ maxWidth: A,
1749
+ overflow: "hidden"
1750
+ },
1751
+ children: [/* @__PURE__ */ B(e, {
1752
+ name: "xiangxiazhankai1",
1753
+ size: 16,
1754
+ className: X("bsy-gantt-summary-bar__arrow", { "bsy-gantt-summary-bar__arrow--collapsed": M })
1755
+ }), /* @__PURE__ */ B("span", {
1756
+ className: "bsy-gantt-summary-bar__label-text",
1757
+ children: j
1758
+ })]
1759
+ }), /* @__PURE__ */ B("div", {
1760
+ className: "bsy-gantt-summary-bar__track",
1761
+ children: /* @__PURE__ */ B("div", {
1762
+ className: "bsy-gantt-summary-bar__progress",
1763
+ style: { width: k }
1764
+ })
1765
+ })]
1766
+ })
1767
+ });
1768
+ };
1769
+ function It(e, t) {
1770
+ return e.barTop === t.barTop && e.item === t.item;
1771
+ }
1772
+ var Lt = H.memo(Ft, It), Rt = H.memo(({ indicators: n = [], onJump: r }) => {
1773
+ let { t: i } = t();
1774
+ if (!Array.isArray(n) || n.length === 0) return null;
1775
+ let a = (e, t) => {
1776
+ e.preventDefault(), e.stopPropagation(), r?.({
1777
+ targetMs: t.targetMs,
1778
+ taskId: t.taskId
1779
+ });
1780
+ };
1781
+ return /* @__PURE__ */ B(z, { children: n.map((t) => /* @__PURE__ */ B("div", {
1782
+ className: "bsy-gantt-chart__offscreen-row",
1783
+ style: {
1784
+ top: t.rowTop,
1785
+ height: t.rowHeight
1786
+ },
1787
+ children: /* @__PURE__ */ V("div", {
1788
+ className: "bsy-gantt-chart__offscreen-track",
1789
+ children: [t.showLeft ? /* @__PURE__ */ B("button", {
1790
+ type: "button",
1791
+ className: "bsy-gantt-chart__offscreen-btn bsy-gantt-chart__offscreen-btn--left",
1792
+ "aria-label": i("gantt.aria.jumpLeft"),
1793
+ onClick: (e) => a(e, t),
1794
+ children: /* @__PURE__ */ B(e, {
1795
+ name: "left",
1796
+ size: 16
1797
+ })
1798
+ }) : null, t.showRight ? /* @__PURE__ */ B("button", {
1799
+ type: "button",
1800
+ className: "bsy-gantt-chart__offscreen-btn bsy-gantt-chart__offscreen-btn--right",
1801
+ "aria-label": i("gantt.aria.jumpRight"),
1802
+ onClick: (e) => a(e, t),
1803
+ children: /* @__PURE__ */ B(e, {
1804
+ name: "arrow-right",
1805
+ size: 16
1806
+ })
1807
+ }) : null]
1808
+ })
1809
+ }, t.rowKey)) });
1810
+ }), zt = ({ left: e, height: t, className: n = "" }) => /* @__PURE__ */ B("div", {
1811
+ className: X("bsy-gantt-chart__today-indicator", n),
1812
+ style: {
1813
+ left: e,
1814
+ height: t
1815
+ },
1816
+ children: /* @__PURE__ */ B("span", { className: "bsy-gantt-chart__today-indicator-line" })
1817
+ }), Bt = W(function({ canvasHeight: e, weekendSegments: t, virtualColumns: n, lowerSegments: r, shouldShowTodayMarker: i, todayLineLeft: a }) {
1818
+ return /* @__PURE__ */ V(z, { children: [
1819
+ t.map((t) => /* @__PURE__ */ B("div", {
1820
+ className: "bsy-gantt-chart__weekend-bg",
1821
+ style: {
1822
+ left: t.left,
1823
+ width: t.width,
1824
+ height: e
1825
+ }
1826
+ }, t.id)),
1827
+ n.map((t) => {
1828
+ let n = r[t.index];
1829
+ return n ? /* @__PURE__ */ B("div", {
1830
+ className: "bsy-gantt-chart__col-line",
1831
+ style: {
1832
+ left: n.left,
1833
+ height: e
1834
+ }
1835
+ }, `line-${n.id}`) : null;
1836
+ }),
1837
+ i ? /* @__PURE__ */ B(zt, {
1838
+ left: a ?? 0,
1839
+ height: e,
1840
+ className: "bsy-gantt-chart__today-indicator--content-line"
1841
+ }) : null
1842
+ ] });
1843
+ }), Vt = ({ virtualRows: e, normalizedItems: t, dragState: n, dragPermissionById: r, timelineStartMs: i, timelineEndMs: a }) => {
1844
+ let o = n?.taskId ?? null;
1845
+ return e.map((e) => {
1846
+ let s = t[e.index];
1847
+ if (!s || s.invalid) return null;
1848
+ let c = o === s.id;
1849
+ if (!c && (s.startMs === null || s.endMs === null || s.startMs >= s.endMs || !qe({
1850
+ startMs: s.startMs,
1851
+ endMs: s.endMs
1852
+ }, {
1853
+ startMs: i,
1854
+ endMs: a
1855
+ }))) return null;
1856
+ let l = e.start + (e.size - 26) / 2;
1857
+ return s.type === "summary" ? /* @__PURE__ */ B(Lt, {
1858
+ item: s,
1859
+ barTop: l
1860
+ }, `summary-${s.id}`) : /* @__PURE__ */ B(Ot, {
1861
+ item: s,
1862
+ barTop: l,
1863
+ dragTaskId: o,
1864
+ dragPreview: c ? n : null,
1865
+ dragPermission: r[s.id]
1866
+ }, `bar-${s.id}`);
1867
+ });
1868
+ }, Ht = W(function({ virtualRows: e, normalizedItems: t, dragState: n, dragPermissionById: r, handleOffscreenJump: i, hoverBgRef: a }) {
1869
+ let o = $((e) => e.timelineStartMs), s = $((e) => e.timelineEndMs), c = $((e) => e.visibleStartMs), l = $((e) => e.visibleEndMs), u = $((e) => e.isInitialLayoutReady), d = ft({
1870
+ virtualRows: e,
1871
+ normalizedItems: t,
1872
+ visibleStartMs: c,
1873
+ visibleEndMs: l,
1874
+ enabled: u,
1875
+ excludeTaskId: n?.taskId ?? null
1876
+ });
1877
+ return /* @__PURE__ */ V(z, { children: [
1878
+ e.map((e) => /* @__PURE__ */ B("div", {
1879
+ className: "bsy-gantt-chart__row-line",
1880
+ style: {
1881
+ top: e.start,
1882
+ height: e.size
1883
+ }
1884
+ }, `row-line-${e.key}`)),
1885
+ /* @__PURE__ */ B("div", {
1886
+ ref: a,
1887
+ className: "bsy-gantt-chart__row-hover-bg",
1888
+ style: { display: "none" }
1889
+ }),
1890
+ u && Vt({
1891
+ virtualRows: e,
1892
+ normalizedItems: t,
1893
+ dragState: n,
1894
+ dragPermissionById: r,
1895
+ timelineStartMs: o,
1896
+ timelineEndMs: s
1897
+ }),
1898
+ u ? /* @__PURE__ */ B(Rt, {
1899
+ indicators: d,
1900
+ onJump: i
1901
+ }) : null
1902
+ ] });
1903
+ }), Ut = W(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 }) {
1904
+ let _ = $((e) => e.timelineWidth), { virtualRows: v, canvasHeight: y, isScrolling: b } = dt({
1905
+ items: t,
1906
+ contentRef: e,
1907
+ safeRowHeight: n,
1908
+ viewportHeight: r
1909
+ }), { hoverBgRef: x, handleContentMouseMove: S, handleContentMouseLeave: C } = pt({
1910
+ normalizedItems: t,
1911
+ safeRowHeight: n
1912
+ }), w = q(() => ({
1913
+ width: _,
1914
+ height: y
1915
+ }), [_, y]), T = q(() => ({
1916
+ tooltip: l ?? null,
1917
+ isScrolling: b,
1918
+ collapsedKeys: p,
1919
+ onBarClick: f,
1920
+ onTaskMouseDown: u,
1921
+ onResizeMouseDown: d
1922
+ }), [
1923
+ l,
1924
+ b,
1925
+ p,
1926
+ f,
1927
+ u,
1928
+ d
1929
+ ]);
1930
+ return /* @__PURE__ */ V("div", {
1931
+ className: "bsy-gantt-chart__canvas",
1932
+ style: w,
1933
+ onMouseMove: S,
1934
+ onMouseLeave: C,
1935
+ children: [/* @__PURE__ */ B(Bt, {
1936
+ canvasHeight: y,
1937
+ weekendSegments: o,
1938
+ virtualColumns: a,
1939
+ lowerSegments: i,
1940
+ shouldShowTodayMarker: g,
1941
+ todayLineLeft: h
1942
+ }), /* @__PURE__ */ B(mt.Provider, {
1943
+ value: T,
1944
+ children: /* @__PURE__ */ B(Ht, {
1945
+ virtualRows: v,
1946
+ normalizedItems: t,
1947
+ dragState: s,
1948
+ dragPermissionById: c,
1949
+ handleOffscreenJump: m,
1950
+ hoverBgRef: x
1951
+ })
1952
+ })]
1953
+ });
1954
+ });
1955
+ //#endregion
1956
+ //#region src/components/Gantt/GanttChart/GanttChart.tsx
1957
+ function Wt({ 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 }, _) {
1958
+ let { t: v } = t(), y = G((e, t) => v(oe(e), t), [v]), b = J(null), x = J(null), S = J(null), C = ue(x), w = J(null), T = ct(b, x), [ee, E] = Y(!1), { pixelsPerDay: D, viewportWidth: O, scrollLeft: k, timelineStartMs: A, timelineEndMs: j, visibleStartMs: M, visibleEndMs: N, lowerSegments: te, timelineCoords: ne, timelineWidth: re, todayCenterMs: ie, todayLineLeft: ae, isInitialLayoutReady: P, handleContentScroll: F, handleTodayClick: I, handleOffscreenJump: L, handleScrollPrev: R, handleScrollNext: z } = ot({
1959
+ timeRangeConfig: a,
1960
+ pixelsPerDayConfig: o,
1961
+ viewMode: n,
1962
+ contentRef: x,
1963
+ contentSize: C,
1964
+ headerTrackRef: S,
1965
+ formatMessage: y,
1966
+ isHorizontalScrollbarInteracting: T,
1967
+ isTaskBarInteracting: ee
1968
+ });
1969
+ se(_, () => ({
1970
+ scrollToToday: I,
1971
+ scrollPrev: R,
1972
+ scrollNext: z
1973
+ }), [
1974
+ I,
1975
+ R,
1976
+ z
1977
+ ]);
1978
+ let { dragState: H, committedRangeById: U, resetCommittedRanges: W, forceResetAllCommittedRanges: ce, handleTaskMouseDown: X, handleResizeMouseDown: le, consumeRecentDragResult: de } = Ae({
1979
+ pixelsPerDay: D,
1980
+ viewMode: n,
1981
+ timelineCoords: ne,
1982
+ onTaskTimeChange: s,
1983
+ containerRef: x,
1984
+ onDragInteractionChange: E
1985
+ });
1986
+ K(() => {
1987
+ let t = new Set((e || []).map((e) => String(e?.id ?? ""))), n = w.current, r = !1;
1988
+ if (n) {
1989
+ if (n.size !== t.size) r = !0;
1990
+ else for (let e of n) if (!t.has(e)) {
1991
+ r = !0;
1992
+ break;
1993
+ }
1994
+ }
1995
+ if (w.current = t, r) {
1996
+ ce();
1997
+ return;
1998
+ }
1999
+ W();
2000
+ }, [
2001
+ e,
2002
+ W,
2003
+ ce
2004
+ ]);
2005
+ let { normalizedItems: Z } = st({
2006
+ visibleItems: e,
2007
+ committedRangeById: U,
2008
+ viewMode: n
2009
+ }), Q = q(() => {
2010
+ let e = {};
2011
+ return Z.forEach((t) => {
2012
+ e[t.id] = ve(t);
2013
+ }), e;
2014
+ }, [Z]), fe = G((e, t, n, r) => {
2015
+ let i = Q[t.id];
2016
+ i?.canMove && X(e, {
2017
+ ...t,
2018
+ dragPermission: i
2019
+ }, n, r);
2020
+ }, [Q, X]), pe = G((e, t, n, r, i) => {
2021
+ let a = Q[t.id];
2022
+ (r === "start" ? a?.canResizeStart : a?.canResizeEnd) && le(e, {
2023
+ ...t,
2024
+ dragPermission: a
2025
+ }, n, r, i);
2026
+ }, [Q, le]);
2027
+ K(() => {
2028
+ if (!f || !x.current) return;
2029
+ let e = x.current;
2030
+ return f.registerTimelineScroller({ setScrollTop: (t) => {
2031
+ e.scrollTop = t;
2032
+ } });
2033
+ }, [f]);
2034
+ let me = C?.height || 0, { virtualColumns: he, weekendSegments: ge } = Fe({
2035
+ lowerSegments: te,
2036
+ pixelsPerDay: D,
2037
+ scrollLeft: k,
2038
+ viewportWidth: O,
2039
+ showWeekendHighlight: p,
2040
+ timelineStartMs: A,
2041
+ timelineWidth: re,
2042
+ viewMode: n
2043
+ }), _e = lt(m, ae, re, ie, {
2044
+ startMs: A,
2045
+ endMs: j
2046
+ }), ye = G((e, t) => {
2047
+ if (!(e.target instanceof Element && e.target.closest(".bsy-gantt-chart__bar-resize-handle")) && !de()) {
2048
+ if (t?.type === "summary") {
2049
+ let e = t.groupKey;
2050
+ if (!e || !g) return;
2051
+ g(String(e));
2052
+ return;
2053
+ }
2054
+ l && l(t, t.rowIndex, e);
2055
+ }
2056
+ }, [
2057
+ de,
2058
+ l,
2059
+ g
2060
+ ]), be = q(() => ({
2061
+ viewMode: n,
2062
+ pixelsPerDay: D,
2063
+ timelineStartMs: A,
2064
+ timelineEndMs: j,
2065
+ visibleStartMs: M,
2066
+ visibleEndMs: N,
2067
+ timelineCoords: ne,
2068
+ scrollLeft: k,
2069
+ viewportWidth: O,
2070
+ timelineWidth: re,
2071
+ isInitialLayoutReady: P
2072
+ }), [
2073
+ n,
2074
+ D,
2075
+ A,
2076
+ j,
2077
+ M,
2078
+ N,
2079
+ ne,
2080
+ k,
2081
+ O,
2082
+ re,
2083
+ P
2084
+ ]);
2085
+ return /* @__PURE__ */ B(gt.Provider, {
2086
+ value: be,
2087
+ children: /* @__PURE__ */ V("div", {
2088
+ className: "bsy-gantt-chart",
2089
+ style: { visibility: P ? "visible" : "hidden" },
2090
+ children: [/* @__PURE__ */ B(ut, {
2091
+ timelineWidth: re,
2092
+ viewportWidth: O,
2093
+ scrollLeft: k,
2094
+ trackRef: S,
2095
+ virtualColumns: he,
2096
+ lowerSegments: te,
2097
+ todayLineLeft: ae,
2098
+ todayCenterMs: ie,
2099
+ showTodayLine: m,
2100
+ viewMode: n,
2101
+ availableModes: r,
2102
+ formatMessage: y,
2103
+ onViewModeChange: i,
2104
+ onTodayClick: I,
2105
+ onScrollPrev: R,
2106
+ onScrollNext: z
2107
+ }), /* @__PURE__ */ B("div", {
2108
+ ref: b,
2109
+ className: "bsy-gantt-chart__timeline-host",
2110
+ children: /* @__PURE__ */ B("div", {
2111
+ ref: x,
2112
+ className: "bsy-gantt-chart__timeline-content",
2113
+ role: "region",
2114
+ "aria-label": v("gantt.aria.timeline"),
2115
+ onScroll: (e) => {
2116
+ F(e), f && f.sync("timeline", e.currentTarget.scrollTop);
2117
+ },
2118
+ children: /* @__PURE__ */ B(Ut, {
2119
+ contentRef: x,
2120
+ normalizedItems: Z,
2121
+ safeRowHeight: 34,
2122
+ viewportHeight: me,
2123
+ lowerSegments: te,
2124
+ virtualColumns: he,
2125
+ weekendSegments: ge,
2126
+ dragState: H,
2127
+ dragPermissionById: Q,
2128
+ tooltip: d,
2129
+ handleTaskMouseDown: fe,
2130
+ handleResizeMouseDown: pe,
2131
+ handleBarClick: ye,
2132
+ collapsedKeys: h,
2133
+ handleOffscreenJump: L,
2134
+ todayLineLeft: ae,
2135
+ shouldShowTodayMarker: _e
2136
+ })
2137
+ })
2138
+ })]
2139
+ })
2140
+ });
2141
+ }
2142
+ var Gt = U(Wt);
2143
+ //#endregion
2144
+ export { Gt as t };