@baishuyun/ui-base 6.16.0 → 6.17.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/Amap/Amap-CNsoge6e.js +826 -0
- package/dist/Amap/index.js +3 -10
- package/dist/Calendar/Calendar-BlsUX2vX.js +1608 -0
- package/dist/Calendar/index.js +10 -20
- package/dist/Card/index.js +2 -2
- package/dist/CheckBox/{CheckBox-B92dxWNo.js → CheckBox-CM24-quL.js} +1 -1
- package/dist/CheckBox/index.js +3 -3
- package/dist/ColorPicker/{ColorPicker-CPr5j6ZN.js → ColorPicker-B_wLqurt.js} +5 -5
- package/dist/ColorPicker/index.js +5 -5
- package/dist/ConfigProvider/index.js +1 -1
- package/dist/DatePicker/DatePicker-BRwPZeui.js +111 -0
- package/dist/DatePicker/{DatePickerPanel-CRnLvIwc.js → DatePickerPanel-UwjSXS-U.js} +3 -4
- package/dist/DatePicker/index.js +6 -8
- package/dist/DatePicker/pickerLocale-Brf7_Tnd.js +30 -0
- package/dist/DropDown/{DropDown-CvG9IFVk.js → DropDown-B_szM67V.js} +86 -82
- package/dist/DropDown/index.js +8 -9
- package/dist/Editor/index.js +2839 -880
- package/dist/Gantt/index.js +3055 -197
- package/dist/Icon/index.js +1 -1
- package/dist/InputTag/{InputTag-BfZycXw4.js → InputTag-C_5nm0eo.js} +2 -2
- package/dist/InputTag/index.js +4 -4
- package/dist/Loading/{Loading-DpbJSRYf.js → Loading-Cherk9Ax.js} +1 -1
- package/dist/Loading/index.js +3 -3
- package/dist/Modal/index.js +2 -2
- package/dist/NotFoundContent/index.js +2 -2
- package/dist/Overlay/index.js +1 -1
- package/dist/Radio/index.js +2 -2
- package/dist/ScrollBar/{ScrollBar-N2pOLv-8.js → ScrollBar-IMTuAOF5.js} +1 -1
- package/dist/ScrollBar/index.js +2 -2
- package/dist/Segmented/{Segmented-BCQRrc65.js → Segmented-DpmwFerw.js} +1 -1
- package/dist/Segmented/index.js +2 -2
- package/dist/Select/{Select-Bla1mQ8v.js → Select-VIy6OKEj.js} +262 -259
- package/dist/Select/{SelectInputSearch-CRgBcsq2.js → SelectInputSearch-MApQHnU9.js} +21 -10
- package/dist/Select/index.js +12 -13
- package/dist/Table/Table-8ac6xLZv.js +808 -0
- package/dist/Table/index.js +4 -8
- package/dist/Tabs/{Tabs-B9uCGlxM.js → Tabs-DnoZ8BO0.js} +3 -3
- package/dist/Tabs/index.js +4 -4
- package/dist/Tooltip/{Tooltip-nJU13gX4.js → Tooltip-DBrt3t2r.js} +3 -3
- package/dist/Tooltip/index.js +3 -3
- package/dist/Tree/index.js +4 -4
- package/dist/components/Editor/EditorHtmlPreview.d.ts +3 -0
- package/dist/components/Editor/Preview/HtmlPreview.d.ts +2 -3
- package/dist/components/Editor/__tests__/createTestEditor.d.ts +1 -0
- package/dist/components/Editor/constants/portableEditorStyles.d.ts +2 -0
- package/dist/components/Editor/hooks/useEditorFocus.d.ts +1 -0
- package/dist/components/Editor/hooks/useTextFormatsState.d.ts +1 -2
- package/dist/components/Editor/index.d.ts +1 -0
- package/dist/components/Editor/nodes/ExtendedLinkNode.d.ts +9 -0
- package/dist/components/Editor/utils/getToolbarItems.d.ts +14 -0
- package/dist/components/Editor/utils/placeProgrammaticCaret.d.ts +5 -0
- package/dist/components/Editor/utils/readTextFormats.d.ts +6 -0
- package/dist/components/Editor/utils/retainCodeSelection.d.ts +3 -0
- package/dist/components/Select/SelectInputSearch/SelectInputSearch.d.ts +2 -0
- package/dist/index.js +28 -50
- package/dist/style.css +1 -1
- package/dist/vendors/Tree-D0Q1IZ2D.js +267 -0
- package/dist/vendors/{version-CFii9VTt.js → version-CfjNx5v2.js} +1 -1
- package/package.json +1 -1
- package/dist/Amap/Amap-BLSziesG.js +0 -77
- package/dist/Amap/AmapCircle/index.js +0 -5
- package/dist/Amap/AmapCircle-2qupysHe.js +0 -55
- package/dist/Amap/AmapContext-CJBe6lld.js +0 -11
- package/dist/Amap/AmapMarker/index.js +0 -6
- package/dist/Amap/AmapMarker-xEqoVnFR.js +0 -153
- package/dist/Amap/AmapMarkerCluster/index.js +0 -6
- package/dist/Amap/AmapMarkerCluster-CvEQa3o9.js +0 -240
- package/dist/Amap/AmapProvider/index.js +0 -7
- package/dist/Amap/AmapProvider-B-R2DrkJ.js +0 -107
- package/dist/Amap/hooks/index.js +0 -4
- package/dist/Amap/hooks-BTcFpdd0.js +0 -121
- package/dist/Amap/useMarkerInfoWindowController-Cjx0xQXw.js +0 -94
- package/dist/Calendar/AllDaySection-pO7suGJM.js +0 -53
- package/dist/Calendar/Calendar-DUD4iffO.js +0 -795
- package/dist/Calendar/CurrentTimeIndicator-BF3_INSL.js +0 -65
- package/dist/Calendar/EventCard-DKEZQRTp.js +0 -155
- package/dist/Calendar/TimeAxis-DUc6EL-j.js +0 -13
- package/dist/Calendar/TimeGrid-BV8x9VnF.js +0 -47
- package/dist/Calendar/colorUtils-BbeSMnOs.js +0 -55
- package/dist/Calendar/context/index.js +0 -3
- package/dist/Calendar/context-CamSpkj3.js +0 -21
- package/dist/Calendar/layout-CpOabFQ2.js +0 -300
- package/dist/Calendar/subcomponents/AllDaySection/index.js +0 -11
- package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +0 -8
- package/dist/Calendar/subcomponents/EventCard/index.js +0 -9
- package/dist/Calendar/subcomponents/TimeAxis/index.js +0 -5
- package/dist/Calendar/subcomponents/TimeGrid/index.js +0 -7
- package/dist/Calendar/theme-Dc8hjcdo.js +0 -71
- package/dist/Calendar/utils/index.js +0 -111
- package/dist/Calendar/utils/layout/index.js +0 -4
- package/dist/Calendar/utils/theme/index.js +0 -3
- package/dist/DatePicker/DatePicker-BWMmI6rl.js +0 -101
- package/dist/DatePicker/ensureDayjsPlugins-CSqhjLS7.js +0 -15
- package/dist/DatePicker/pickerLocale-CcPLUbZO.js +0 -15
- package/dist/DatePicker/style/index.js +0 -3
- package/dist/DatePicker/style-W7f5wyUb.js +0 -15
- package/dist/DropDown/style/index.js +0 -3
- package/dist/DropDown/style-DZpkarne.js +0 -9
- package/dist/Editor/Buttons-vt3gwedu.js +0 -1841
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +0 -21
- package/dist/Editor/constants/index.js +0 -61
- package/dist/Gantt/GanttChart/index.js +0 -21
- package/dist/Gantt/GanttChart-DRzJdEm-.js +0 -2292
- package/dist/Gantt/GanttHighlightContext-dtyoq-oj.js +0 -12
- package/dist/Gantt/GanttTable/index.js +0 -13
- package/dist/Gantt/GanttTable-fOv1Zn2-.js +0 -84
- package/dist/Gantt/GanttToolBar/index.js +0 -17
- package/dist/Gantt/GanttToolBar-4kxZP6oS.js +0 -120
- package/dist/Gantt/collapseKeys-BV_8sIA-.js +0 -160
- package/dist/Gantt/columnResize-Bkenlbab.js +0 -46
- package/dist/Gantt/constants-mEGQ1U1Q.js +0 -39
- package/dist/Gantt/highlightTarget-D3Nf9_7S.js +0 -25
- package/dist/Gantt/theme-B7Iap-tZ.js +0 -31
- package/dist/Gantt/timelineViewConfig-DNt7yi83.js +0 -118
- package/dist/Gantt/utils/index.js +0 -7
- package/dist/Gantt/utils/theme/index.js +0 -3
- package/dist/Select/style/index.js +0 -3
- package/dist/Select/style-C4A8kUd1.js +0 -9
- package/dist/Table/Table-3LSO0xSH.js +0 -545
- package/dist/Table/constants-D7wLH8Qy.js +0 -25
- package/dist/Table/hooks/index.js +0 -3
- package/dist/Table/hooks-DSBl2e4O.js +0 -108
- package/dist/Table/processRowspan-B6HMqw0Q.js +0 -144
- package/dist/Table/style/index.js +0 -3
- package/dist/Table/style-B8Cw8HJe.js +0 -9
- package/dist/Table/utils/index.js +0 -3
- package/dist/Tree/utils/index.js +0 -26
- package/dist/vendors/Tree-DSl4lDjx.js +0 -248
- /package/dist/Card/{Card-rJeWgxu5.js → Card-DAz0dvA3.js} +0 -0
- /package/dist/CheckBox/{CheckBox-DOK5N7z6.js → CheckBox-CcHskTz_.js} +0 -0
- /package/dist/Modal/{Modal-CRKitOOj.js → Modal-eZijJ7CB.js} +0 -0
- /package/dist/NotFoundContent/{NotFoundContent-BLmzWNBi.js → NotFoundContent-DJUQ0_2D.js} +0 -0
- /package/dist/Radio/{Radio-CX9cUqb7.js → Radio-D9jhW7K6.js} +0 -0
- /package/dist/vendors/{animations-Dn_5xJ7B.js → animations-ISccYUE3.js} +0 -0
- /package/dist/vendors/{cssVars-l4-kP_14.js → cssVars-UpriQzph.js} +0 -0
- /package/dist/vendors/{mergeRefs-TiJ0xjUN.js → mergeRefs-mEH9TBYV.js} +0 -0
- /package/dist/vendors/{useFloatingOverlay-B3M9k8nj.js → useFloatingOverlay-B66lOL8v.js} +0 -0
- /package/dist/vendors/{useFloatingPortal-VpzL-EPh.js → useFloatingPortal-DJ1iKmW-.js} +0 -0
- /package/dist/vendors/{useLatchedPopupPortalRoot-4fVhqVT4.js → useLatchedPopupPortalRoot-CC6af8t-.js} +0 -0
- /package/dist/vendors/{useLocale-D31qCCff.js → useLocale-Be4e7Xfn.js} +0 -0
|
@@ -1,2292 +0,0 @@
|
|
|
1
|
-
import { t as e } from "../Icon/Icon-DrdQOEJE.js";
|
|
2
|
-
import { t } from "../vendors/useLocale-D31qCCff.js";
|
|
3
|
-
import { t as n } from "../Tooltip/Tooltip-nJU13gX4.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-mEGQ1U1Q.js";
|
|
5
|
-
import { t as d } from "./GanttHighlightContext-dtyoq-oj.js";
|
|
6
|
-
import { n as f, r as p } from "./highlightTarget-D3Nf9_7S.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-DNt7yi83.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 te, s as ne, t as N, u as re, v as ie, x as P, y as ae } from "./collapseKeys-BV_8sIA-.js";
|
|
9
|
-
import { r as oe, t as F } from "./GanttToolBar-4kxZP6oS.js";
|
|
10
|
-
import { isFunction as se, isNumber as ce, isString as I } from "lodash-es";
|
|
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 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";
|
|
22
|
-
//#region src/components/Gantt/GanttChart/utils/dragEngine.ts
|
|
23
|
-
var be = (e) => e?.type === "task" && e?.draggable !== !1 && !e?.invalid, xe = {
|
|
24
|
-
canMove: !1,
|
|
25
|
-
canResizeStart: !1,
|
|
26
|
-
canResizeEnd: !1
|
|
27
|
-
}, Se = (e) => !e || e.invalid || e.type === "summary" || e.draggable === !1 ? xe : e.dragPermission ? {
|
|
28
|
-
canMove: e.dragPermission.canMove === !0,
|
|
29
|
-
canResizeStart: e.dragPermission.canResizeStart === !0,
|
|
30
|
-
canResizeEnd: e.dragPermission.canResizeEnd === !0
|
|
31
|
-
} : {
|
|
32
|
-
canMove: !0,
|
|
33
|
-
canResizeStart: !0,
|
|
34
|
-
canResizeEnd: !0
|
|
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") => {
|
|
36
|
-
if (!t || !Number.isFinite(e)) return e;
|
|
37
|
-
let r = P(e), i = he(r).startOf("day").valueOf(), a = (r - i) / t, o;
|
|
38
|
-
return o = n === "floor" ? Math.floor(a) : n === "ceil" ? Math.ceil(a) : Math.round(a), ie(i + o * t);
|
|
39
|
-
}, De = (e, t, n) => ({
|
|
40
|
-
startMs: e + n,
|
|
41
|
-
endMs: t + n
|
|
42
|
-
}), Oe = ({ startMs: e, endMs: t, deltaMs: n, edge: r, minDurationMs: i }) => {
|
|
43
|
-
if (r === "start") {
|
|
44
|
-
let r = t - i;
|
|
45
|
-
return {
|
|
46
|
-
startMs: Math.min(e + n, r),
|
|
47
|
-
endMs: t
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
let a = e + i;
|
|
51
|
-
return {
|
|
52
|
-
startMs: e,
|
|
53
|
-
endMs: Math.max(t + n, a)
|
|
54
|
-
};
|
|
55
|
-
}, ke = (e, t, n, r) => {
|
|
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);
|
|
57
|
-
if (e.dragMode === "move") {
|
|
58
|
-
let t = Math.round((u - c) / s) * s;
|
|
59
|
-
i = e.originStartMs + t, a = e.originEndMs + t;
|
|
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));
|
|
61
|
-
return {
|
|
62
|
-
deltaUnits: e.dragMode === "resize-end" ? Math.round((a - e.originEndMs) / r) : Math.round((i - e.originStartMs) / r),
|
|
63
|
-
previewStartMs: i,
|
|
64
|
-
previewEndMs: a,
|
|
65
|
-
previewLeftPx: e.dragMode === "resize-end" ? e.originLeftPx : l
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
function Ae(e) {
|
|
69
|
-
let t = {
|
|
70
|
-
taskId: String(e.item.id),
|
|
71
|
-
newStart: e.startMs,
|
|
72
|
-
newEnd: e.endMs,
|
|
73
|
-
deltaMs: e.deltaMs,
|
|
74
|
-
snapUnitMs: e.snapUnitMs,
|
|
75
|
-
changeType: e.changeType,
|
|
76
|
-
viewMode: e.viewMode
|
|
77
|
-
};
|
|
78
|
-
if (h(e.viewMode)) return {
|
|
79
|
-
taskId: t.taskId,
|
|
80
|
-
newStart: t.newStart,
|
|
81
|
-
newEnd: t.newEnd,
|
|
82
|
-
deltaMs: t.deltaMs,
|
|
83
|
-
snapUnitMs: t.snapUnitMs,
|
|
84
|
-
changeType: t.changeType,
|
|
85
|
-
viewMode: e.viewMode
|
|
86
|
-
};
|
|
87
|
-
let n = e;
|
|
88
|
-
return {
|
|
89
|
-
taskId: t.taskId,
|
|
90
|
-
newStart: t.newStart,
|
|
91
|
-
newEnd: t.newEnd,
|
|
92
|
-
deltaMs: t.deltaMs,
|
|
93
|
-
snapUnitMs: t.snapUnitMs,
|
|
94
|
-
changeType: t.changeType,
|
|
95
|
-
viewMode: n.viewMode,
|
|
96
|
-
deltaDays: n.deltaDays
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
var je = (e) => e && se(e.then) ? e : Promise.resolve(e);
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region src/components/Gantt/GanttChart/hooks/useEdgeScroll.tsx
|
|
102
|
-
function Me(e, t) {
|
|
103
|
-
return e < 0 ? t * 10 : e >= 20 ? 0 : t * (2 + 8 * (1 - e / 20));
|
|
104
|
-
}
|
|
105
|
-
function Ne(e, t) {
|
|
106
|
-
let n = q(null), r = q(0), i = U(() => {
|
|
107
|
-
n.current !== null && cancelAnimationFrame(n.current), n.current = null, r.current = 0;
|
|
108
|
-
}, []);
|
|
109
|
-
W(() => () => {
|
|
110
|
-
n.current !== null && cancelAnimationFrame(n.current);
|
|
111
|
-
}, []);
|
|
112
|
-
let a = U(() => {
|
|
113
|
-
if (n.current !== null) return;
|
|
114
|
-
let i = () => {
|
|
115
|
-
let a = e.current, o = r.current;
|
|
116
|
-
if (!a || o === 0) {
|
|
117
|
-
n.current = null;
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
let s = a.scrollLeft, c = a.scrollWidth - a.clientWidth, l = Math.max(0, Math.min(c, s + o));
|
|
121
|
-
a.scrollLeft = l, l !== s && t?.current?.(), n.current = requestAnimationFrame(i);
|
|
122
|
-
};
|
|
123
|
-
n.current = requestAnimationFrame(i);
|
|
124
|
-
}, [e, t]);
|
|
125
|
-
return {
|
|
126
|
-
startEdgeDetection: U((t, n) => {
|
|
127
|
-
let o = e.current;
|
|
128
|
-
if (!o) return 0;
|
|
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;
|
|
130
|
-
return r.current = u, u === 0 ? i() : a(), u;
|
|
131
|
-
}, [
|
|
132
|
-
e,
|
|
133
|
-
a,
|
|
134
|
-
i
|
|
135
|
-
]),
|
|
136
|
-
stopEdgeScroll: i
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
//#endregion
|
|
140
|
-
//#region src/components/Gantt/GanttChart/hooks/useGanttDrag.tsx
|
|
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);
|
|
143
|
-
g.current = n;
|
|
144
|
-
let [_, v] = J({}), [y, b] = J(null), x = q(null), S = q({
|
|
145
|
-
shouldSuppressClick: !1,
|
|
146
|
-
at: 0
|
|
147
|
-
}), C = q(0), w = q(null), { startEdgeDetection: T, stopEdgeScroll: ee } = Ne(c ?? { current: null }, w), E = q({});
|
|
148
|
-
W(() => {
|
|
149
|
-
x.current = y;
|
|
150
|
-
}, [y]), W(() => () => {
|
|
151
|
-
for (let e of Object.values(E.current)) e.timeoutId && clearTimeout(e.timeoutId);
|
|
152
|
-
}, []);
|
|
153
|
-
let D = U(() => {
|
|
154
|
-
v((e) => {
|
|
155
|
-
let t = Object.keys(E.current);
|
|
156
|
-
if (t.length === 0) return {};
|
|
157
|
-
let n = {};
|
|
158
|
-
for (let r of t) e[r] && (n[r] = e[r]);
|
|
159
|
-
return Object.keys(n).length === Object.keys(e).length ? e : n;
|
|
160
|
-
}), S.current = {
|
|
161
|
-
shouldSuppressClick: !1,
|
|
162
|
-
at: 0
|
|
163
|
-
};
|
|
164
|
-
}, []), O = U(() => {
|
|
165
|
-
for (let e of Object.values(E.current)) e.timeoutId && clearTimeout(e.timeoutId);
|
|
166
|
-
E.current = {}, v({}), S.current = {
|
|
167
|
-
shouldSuppressClick: !1,
|
|
168
|
-
at: 0
|
|
169
|
-
};
|
|
170
|
-
}, []), k = U((e, t, n, r, i = 1) => {
|
|
171
|
-
if (!Ce(t, r) || t.invalid) return;
|
|
172
|
-
e.preventDefault(), e.stopPropagation();
|
|
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), _ = {
|
|
174
|
-
taskId: t.id,
|
|
175
|
-
item: t,
|
|
176
|
-
startClientX: e.clientX,
|
|
177
|
-
grabOffsetInBar: h,
|
|
178
|
-
originLeftPx: n,
|
|
179
|
-
originWidthPx: p,
|
|
180
|
-
originAnchorPx: m,
|
|
181
|
-
originAnchorMs: g.current.timeAtX(m),
|
|
182
|
-
originStartMs: f,
|
|
183
|
-
originEndMs: d,
|
|
184
|
-
deltaUnits: 0,
|
|
185
|
-
dragMode: r,
|
|
186
|
-
previewLeftPx: n,
|
|
187
|
-
previewStartMs: f,
|
|
188
|
-
previewEndMs: d
|
|
189
|
-
};
|
|
190
|
-
S.current = {
|
|
191
|
-
shouldSuppressClick: !1,
|
|
192
|
-
at: 0
|
|
193
|
-
}, x.current = _, b(_), u?.(!0);
|
|
194
|
-
}, [c, u]), A = U((e, t, n, r) => {
|
|
195
|
-
k(e, t, n, o, r);
|
|
196
|
-
}, [k]), j = U((e, t, n, i, a) => {
|
|
197
|
-
k(e, t, n, i === "start" ? l : r, a);
|
|
198
|
-
}, [k]);
|
|
199
|
-
return W(() => {
|
|
200
|
-
if (!y?.taskId) return;
|
|
201
|
-
let e = (e, t, n = "mousemove") => {
|
|
202
|
-
let r = x.current;
|
|
203
|
-
if (!r) return;
|
|
204
|
-
let i = c?.current, a = t ?? i?.getBoundingClientRect(), o = i?.scrollLeft ?? 0, s = g.current, l = o + (a ? e - a.left : 0) - r.grabOffsetInBar, u = r.dragMode === "resize-end" ? r.originLeftPx : l;
|
|
205
|
-
if (n === "edgeScroll") {
|
|
206
|
-
let e = r.dragMode === "resize-end" ? r.originLeftPx : u;
|
|
207
|
-
if (e === r.previewLeftPx) return;
|
|
208
|
-
let t = {
|
|
209
|
-
...r,
|
|
210
|
-
previewLeftPx: e
|
|
211
|
-
};
|
|
212
|
-
x.current = t, b(t);
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
let m = l - r.originAnchorPx;
|
|
216
|
-
if (!d) {
|
|
217
|
-
let e = {
|
|
218
|
-
...ke(r, m, s, f),
|
|
219
|
-
previewLeftPx: u
|
|
220
|
-
};
|
|
221
|
-
if (e.deltaUnits === r.deltaUnits && e.previewLeftPx === r.previewLeftPx && e.previewStartMs === r.previewStartMs && e.previewEndMs === r.previewEndMs) return;
|
|
222
|
-
let t = {
|
|
223
|
-
...r,
|
|
224
|
-
...e
|
|
225
|
-
};
|
|
226
|
-
x.current = t, b(t);
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
let h = Te(m, p), _ = {
|
|
230
|
-
...r,
|
|
231
|
-
deltaUnits: h,
|
|
232
|
-
previewLeftPx: u
|
|
233
|
-
};
|
|
234
|
-
if (r.dragMode === "move") {
|
|
235
|
-
let e = De(r.originStartMs, r.originEndMs, h * f);
|
|
236
|
-
_.previewStartMs = e.startMs, _.previewEndMs = e.endMs;
|
|
237
|
-
} else {
|
|
238
|
-
let e = Oe({
|
|
239
|
-
startMs: r.originStartMs,
|
|
240
|
-
endMs: r.originEndMs,
|
|
241
|
-
deltaMs: h * f,
|
|
242
|
-
edge: r.dragMode === "resize-start" ? "start" : "end",
|
|
243
|
-
minDurationMs: f
|
|
244
|
-
});
|
|
245
|
-
_.previewStartMs = e.startMs, _.previewEndMs = e.endMs;
|
|
246
|
-
}
|
|
247
|
-
let v = Math.round((_.previewStartMs - r.originStartMs) / f), y = {
|
|
248
|
-
..._,
|
|
249
|
-
deltaUnits: r.dragMode === "resize-end" ? Math.round((_.previewEndMs - r.originEndMs) / f) : v
|
|
250
|
-
};
|
|
251
|
-
y.deltaUnits === r.deltaUnits && y.previewLeftPx === r.previewLeftPx && y.previewStartMs === r.previewStartMs && y.previewEndMs === r.previewEndMs || (x.current = y, b(y));
|
|
252
|
-
};
|
|
253
|
-
w.current = () => {
|
|
254
|
-
let t = c?.current?.getBoundingClientRect() ?? null;
|
|
255
|
-
e(C.current, t, "edgeScroll");
|
|
256
|
-
};
|
|
257
|
-
let n = (t) => {
|
|
258
|
-
C.current = t.clientX;
|
|
259
|
-
let n = c?.current?.getBoundingClientRect() ?? null, r = T(t.clientX, n ?? void 0);
|
|
260
|
-
e(t.clientX, n, r === 0 ? "mousemove" : "edgeScroll");
|
|
261
|
-
}, r = () => {
|
|
262
|
-
ee(), w.current = null, e(C.current);
|
|
263
|
-
let n = x.current;
|
|
264
|
-
if (u?.(!1), !n) return;
|
|
265
|
-
let r = n.previewStartMs !== n.originStartMs || n.previewEndMs !== n.originEndMs;
|
|
266
|
-
S.current = {
|
|
267
|
-
shouldSuppressClick: r,
|
|
268
|
-
at: Date.now()
|
|
269
|
-
};
|
|
270
|
-
let o = r;
|
|
271
|
-
if (!Ce(n.item, n.dragMode) || !o || !i) {
|
|
272
|
-
x.current = null, b(null);
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
let c = n.taskId;
|
|
276
|
-
v((e) => ({
|
|
277
|
-
...e,
|
|
278
|
-
[c]: {
|
|
279
|
-
startMs: n.previewStartMs,
|
|
280
|
-
endMs: n.previewEndMs
|
|
281
|
-
}
|
|
282
|
-
})), x.current = null, b(null);
|
|
283
|
-
let l = (E.current[c]?.opId || 0) + 1;
|
|
284
|
-
E.current[c]?.timeoutId && clearTimeout(E.current[c].timeoutId);
|
|
285
|
-
let p = setTimeout(() => {
|
|
286
|
-
E.current[c]?.opId === l && (console.warn(`[GanttDrag] task ${c} op ${l} timed out (${a}ms)`), v((e) => {
|
|
287
|
-
let t = { ...e };
|
|
288
|
-
return delete t[c], t;
|
|
289
|
-
}), delete E.current[c]);
|
|
290
|
-
}, a);
|
|
291
|
-
E.current[c] = {
|
|
292
|
-
opId: l,
|
|
293
|
-
startedAt: Date.now(),
|
|
294
|
-
timeoutId: p
|
|
295
|
-
};
|
|
296
|
-
let m, g;
|
|
297
|
-
if (d) if (n.dragMode === "move") {
|
|
298
|
-
let e = Ee(n.previewStartMs, f, "round"), t = e - n.previewStartMs;
|
|
299
|
-
m = e, g = n.previewEndMs + t;
|
|
300
|
-
} else n.dragMode === "resize-start" ? (m = Ee(n.previewStartMs, f, "round"), g = n.previewEndMs) : (m = n.previewStartMs, g = Ee(n.previewEndMs, f, "round"));
|
|
301
|
-
else {
|
|
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;
|
|
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;
|
|
304
|
-
}
|
|
305
|
-
let _;
|
|
306
|
-
_ = h(t) ? Ae({
|
|
307
|
-
item: n.item,
|
|
308
|
-
startMs: m,
|
|
309
|
-
endMs: g,
|
|
310
|
-
deltaMs: n.deltaUnits * f,
|
|
311
|
-
snapUnitMs: f,
|
|
312
|
-
changeType: n.dragMode,
|
|
313
|
-
viewMode: t
|
|
314
|
-
}) : Ae({
|
|
315
|
-
item: n.item,
|
|
316
|
-
startMs: m,
|
|
317
|
-
endMs: g,
|
|
318
|
-
deltaDays: n.deltaUnits,
|
|
319
|
-
deltaMs: n.deltaUnits * f,
|
|
320
|
-
snapUnitMs: f,
|
|
321
|
-
changeType: n.dragMode,
|
|
322
|
-
viewMode: t
|
|
323
|
-
}), je(i(_)).catch((e) => {
|
|
324
|
-
console.error("[GanttChart] onTaskTimeChange rejected", e), E.current[c]?.opId === l && v((e) => {
|
|
325
|
-
let t = { ...e };
|
|
326
|
-
return delete t[c], t;
|
|
327
|
-
});
|
|
328
|
-
}).finally(() => {
|
|
329
|
-
E.current[c]?.opId === l && (clearTimeout(E.current[c].timeoutId), delete E.current[c]);
|
|
330
|
-
});
|
|
331
|
-
}, o = (e) => {
|
|
332
|
-
e.type === "visibilitychange" && document.visibilityState === "visible" || x.current && r();
|
|
333
|
-
};
|
|
334
|
-
return document.addEventListener("mousemove", n), document.addEventListener("mouseup", r), document.addEventListener("mouseleave", o), document.addEventListener("visibilitychange", o), window.addEventListener("blur", o), () => {
|
|
335
|
-
document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", r), document.removeEventListener("mouseleave", o), document.removeEventListener("visibilitychange", o), window.removeEventListener("blur", o), w.current = null;
|
|
336
|
-
};
|
|
337
|
-
}, [
|
|
338
|
-
y?.taskId,
|
|
339
|
-
d,
|
|
340
|
-
f,
|
|
341
|
-
p,
|
|
342
|
-
i,
|
|
343
|
-
e,
|
|
344
|
-
t,
|
|
345
|
-
T,
|
|
346
|
-
ee,
|
|
347
|
-
c,
|
|
348
|
-
u
|
|
349
|
-
]), {
|
|
350
|
-
dragState: y,
|
|
351
|
-
committedRangeById: _,
|
|
352
|
-
resetCommittedRanges: D,
|
|
353
|
-
forceResetAllCommittedRanges: O,
|
|
354
|
-
handleTaskMouseDown: A,
|
|
355
|
-
handleResizeMouseDown: j,
|
|
356
|
-
consumeRecentDragResult: U(() => {
|
|
357
|
-
let { shouldSuppressClick: e, at: t } = S.current;
|
|
358
|
-
return S.current = {
|
|
359
|
-
shouldSuppressClick: !1,
|
|
360
|
-
at: 0
|
|
361
|
-
}, e ? Date.now() - t <= 400 : !1;
|
|
362
|
-
}, [])
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
//#endregion
|
|
366
|
-
//#region src/components/Gantt/GanttChart/utils/timelineFocus.ts
|
|
367
|
-
function Fe(e, t, n) {
|
|
368
|
-
let r = Number(t) > 0 ? Number(t) : 0, i = Number(n) > 0 ? Number(n) : 0, a = Math.max(0, i - r);
|
|
369
|
-
return Number.isFinite(e) ? Math.min(Math.max(0, e), a) : 0;
|
|
370
|
-
}
|
|
371
|
-
function Ie({ anchorMs: e, toX: t, viewportWidth: n, timelineWidth: r }) {
|
|
372
|
-
let i = Number(n) > 0 ? Number(n) : 0;
|
|
373
|
-
if (!Number.isFinite(e) || typeof t != "function" || i <= 0) return 0;
|
|
374
|
-
let a = t(e);
|
|
375
|
-
return Number.isFinite(a) ? Fe(a - i / 2, i, r) : 0;
|
|
376
|
-
}
|
|
377
|
-
//#endregion
|
|
378
|
-
//#region src/components/Gantt/GanttChart/hooks/useGanttColumnVirtual.ts
|
|
379
|
-
function Le(e) {
|
|
380
|
-
let t = Number(e);
|
|
381
|
-
return Math.max((Number.isFinite(t) && t > 0 ? t : 0) * 4, 240);
|
|
382
|
-
}
|
|
383
|
-
function Re(e, t) {
|
|
384
|
-
if (!Array.isArray(e) || e.length === 0) return [];
|
|
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;
|
|
386
|
-
for (; d <= f;) {
|
|
387
|
-
let t = d + f >> 1, n = e[t];
|
|
388
|
-
n.left + n.width > c ? (p = t, f = t - 1) : d = t + 1;
|
|
389
|
-
}
|
|
390
|
-
d = 0, f = u - 1;
|
|
391
|
-
let m = -1;
|
|
392
|
-
for (; d <= f;) {
|
|
393
|
-
let t = d + f >> 1;
|
|
394
|
-
e[t].left < l ? (m = t, d = t + 1) : f = t - 1;
|
|
395
|
-
}
|
|
396
|
-
if (p > m) return [];
|
|
397
|
-
let h = [];
|
|
398
|
-
for (let e = p; e <= m; e += 1) h.push({ index: e });
|
|
399
|
-
return h;
|
|
400
|
-
}
|
|
401
|
-
function ze({ lowerSegments: e, pixelsPerDay: t, scrollLeft: n, viewportWidth: r, showWeekendHighlight: i, timelineStartMs: a, timelineWidth: o, viewMode: c }) {
|
|
402
|
-
return {
|
|
403
|
-
virtualColumns: K(() => Re(e, {
|
|
404
|
-
scrollLeft: n,
|
|
405
|
-
viewportWidth: r,
|
|
406
|
-
pixelsPerDay: t
|
|
407
|
-
}), [
|
|
408
|
-
e,
|
|
409
|
-
t,
|
|
410
|
-
n,
|
|
411
|
-
r
|
|
412
|
-
]),
|
|
413
|
-
weekendSegments: K(() => {
|
|
414
|
-
if (!i || o <= 0 || c !== "day") return [];
|
|
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 = [];
|
|
416
|
-
for (let e = u; e <= d; e += 1) {
|
|
417
|
-
let n = a + e * s, r = ae(n);
|
|
418
|
-
(r === 0 || r === 6) && f.push({
|
|
419
|
-
id: `weekend-${n}`,
|
|
420
|
-
left: e * t,
|
|
421
|
-
width: t
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
return f;
|
|
425
|
-
}, [
|
|
426
|
-
i,
|
|
427
|
-
o,
|
|
428
|
-
n,
|
|
429
|
-
r,
|
|
430
|
-
t,
|
|
431
|
-
a,
|
|
432
|
-
c
|
|
433
|
-
])
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
he.extend(ge), he.extend(ve);
|
|
437
|
-
var Be = {
|
|
438
|
-
day: {
|
|
439
|
-
amount: 1,
|
|
440
|
-
unit: "day"
|
|
441
|
-
},
|
|
442
|
-
week: {
|
|
443
|
-
amount: 1,
|
|
444
|
-
unit: "week"
|
|
445
|
-
},
|
|
446
|
-
month: {
|
|
447
|
-
amount: 1,
|
|
448
|
-
unit: "month"
|
|
449
|
-
},
|
|
450
|
-
quarter: {
|
|
451
|
-
amount: 1,
|
|
452
|
-
unit: "quarter"
|
|
453
|
-
},
|
|
454
|
-
quarterMonth: {
|
|
455
|
-
amount: 1,
|
|
456
|
-
unit: "month"
|
|
457
|
-
},
|
|
458
|
-
year: {
|
|
459
|
-
amount: 6,
|
|
460
|
-
unit: "month",
|
|
461
|
-
align: (e) => {
|
|
462
|
-
let t = e.month();
|
|
463
|
-
return t !== 0 && t !== 6 ? t < 6 ? e.startOf("year") : e.month(6).startOf("month") : e;
|
|
464
|
-
}
|
|
465
|
-
},
|
|
466
|
-
halfDay: {
|
|
467
|
-
amount: 12,
|
|
468
|
-
unit: "hour"
|
|
469
|
-
},
|
|
470
|
-
sixHour: {
|
|
471
|
-
amount: 6,
|
|
472
|
-
unit: "hour"
|
|
473
|
-
},
|
|
474
|
-
hour: {
|
|
475
|
-
amount: 1,
|
|
476
|
-
unit: "hour"
|
|
477
|
-
},
|
|
478
|
-
halfHour: {
|
|
479
|
-
amount: 30,
|
|
480
|
-
unit: "minute"
|
|
481
|
-
},
|
|
482
|
-
tenMinute: {
|
|
483
|
-
amount: 10,
|
|
484
|
-
unit: "minute"
|
|
485
|
-
},
|
|
486
|
-
oneMinute: {
|
|
487
|
-
amount: 1,
|
|
488
|
-
unit: "minute"
|
|
489
|
-
}
|
|
490
|
-
}, Ve = (e, t, n) => {
|
|
491
|
-
switch (t) {
|
|
492
|
-
case "halfDay": return e.hour() < 12 ? n("header.lower.halfDayAm") : n("header.lower.halfDayPm");
|
|
493
|
-
case "sixHour": {
|
|
494
|
-
let t = e.hour();
|
|
495
|
-
return n("header.lower.sixHourRange", {
|
|
496
|
-
start: t,
|
|
497
|
-
end: t + 6
|
|
498
|
-
});
|
|
499
|
-
}
|
|
500
|
-
case "hour": return String(e.hour());
|
|
501
|
-
case "halfHour": return e.format("HH:mm");
|
|
502
|
-
case "tenMinute": return String(e.minute());
|
|
503
|
-
case "oneMinute": return e.format("mm");
|
|
504
|
-
default: return e.format("DD");
|
|
505
|
-
}
|
|
506
|
-
}, He = (e, t, n) => {
|
|
507
|
-
let r = C(e.valueOf());
|
|
508
|
-
switch (t) {
|
|
509
|
-
case "day": return r.format("DD");
|
|
510
|
-
case "week": return n("header.lower.week", { week: r.isoWeek() });
|
|
511
|
-
case "month":
|
|
512
|
-
case "quarterMonth": return D(e.valueOf(), n);
|
|
513
|
-
case "quarter": return n("header.lower.quarter", { quarter: r.quarter() });
|
|
514
|
-
case "year": return r.month() < 6 ? n("firstHalf") : n("secondHalf");
|
|
515
|
-
default: return Ve(r, t, n);
|
|
516
|
-
}
|
|
517
|
-
}, Ue = (e, t) => {
|
|
518
|
-
let n = C(e.valueOf()), r = y(t).headerLayout;
|
|
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")}`;
|
|
520
|
-
}, We = (e, t, n) => {
|
|
521
|
-
let r = C(e.valueOf()), i = y(t).headerLayout;
|
|
522
|
-
if (i === "dayNested") return { label: n("header.top.monthDay", {
|
|
523
|
-
month: r.month() + 1,
|
|
524
|
-
day: r.date()
|
|
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", {
|
|
543
|
-
year: r.year(),
|
|
544
|
-
month: r.month() + 1
|
|
545
|
-
}) } : { label: n("header.top.year", { year: r.year() }) };
|
|
546
|
-
}, Ge = (e, t, n, r, i, a, o) => {
|
|
547
|
-
let s = _(r), c = A ?? 100;
|
|
548
|
-
e.push({
|
|
549
|
-
id: `${r}-${t}`,
|
|
550
|
-
startMs: t,
|
|
551
|
-
endMs: n,
|
|
552
|
-
left: s ? e.length * c : M(t, i, a, r),
|
|
553
|
-
width: s ? c : Math.max(1, ee(t, n, a, r)),
|
|
554
|
-
label: He(he(t), r, o)
|
|
555
|
-
});
|
|
556
|
-
}, Ke = ({ viewMode: e, timelineStartMs: t, timelineEndMs: n, pixelsPerDay: r, formatMessage: i }) => {
|
|
557
|
-
let a = [], o = Be[e] || Be.day, s = he(P(t));
|
|
558
|
-
_(e) && (s = s.startOf("month"));
|
|
559
|
-
let c = he(P(n));
|
|
560
|
-
for (; s.isBefore(c);) {
|
|
561
|
-
o.align && (s = o.align(s));
|
|
562
|
-
let n = s.add(o.amount, o.unit);
|
|
563
|
-
Ge(a, ie(s.valueOf()), ie(n.valueOf()), e, t, r, i), s = n;
|
|
564
|
-
}
|
|
565
|
-
return a;
|
|
566
|
-
}, qe = ({ lowerSegments: e, viewMode: t, formatMessage: n }) => {
|
|
567
|
-
if (!Array.isArray(e) || e.length === 0) return [];
|
|
568
|
-
let r = [], i = null;
|
|
569
|
-
for (let a of e) {
|
|
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,
|
|
574
|
-
left: a.left,
|
|
575
|
-
width: a.width,
|
|
576
|
-
...We(e, t, n)
|
|
577
|
-
};
|
|
578
|
-
continue;
|
|
579
|
-
}
|
|
580
|
-
i.width += a.width;
|
|
581
|
-
}
|
|
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");
|
|
587
|
-
return e.startMs <= t && t < e.endMs;
|
|
588
|
-
}, Ze = (e, t) => (Ye(e), Ye(t), e.startMs < t.endMs && t.startMs < e.endMs), Qe = (e, t) => {
|
|
589
|
-
Ye(e), Ye(t);
|
|
590
|
-
let n = Math.max(e.startMs, t.startMs), r = Math.min(e.endMs, t.endMs);
|
|
591
|
-
return n < r ? {
|
|
592
|
-
startMs: n,
|
|
593
|
-
endMs: r
|
|
594
|
-
} : null;
|
|
595
|
-
}, $e = (e, t) => {
|
|
596
|
-
if (!Number.isFinite(e) || e <= 0) throw RangeError(`${t} must be finite and greater than zero`);
|
|
597
|
-
}, et = (e, t) => {
|
|
598
|
-
if (Number.isFinite(e)) return e;
|
|
599
|
-
if (Number.isFinite(t)) return t;
|
|
600
|
-
throw RangeError("focusMs or fallbackFocusMs must be finite");
|
|
601
|
-
}, tt = ({ startMs: e, endMs: t, viewMode: n, viewportWidth: r, pixelsPerDay: i }) => {
|
|
602
|
-
let a = (t - e) / s;
|
|
603
|
-
if (a * i >= r) return {
|
|
604
|
-
startMs: e,
|
|
605
|
-
endMs: t
|
|
606
|
-
};
|
|
607
|
-
let o = Math.ceil(r / i), c = Math.ceil((o - a) / 2) * s;
|
|
608
|
-
return S(e - c, t + c, n);
|
|
609
|
-
}, nt = ({ range: e, focusMs: t, viewMode: n, viewportWidth: r, pixelsPerDay: i }) => {
|
|
610
|
-
let a = (r / 2 + 281) / i * s;
|
|
611
|
-
return tt({
|
|
612
|
-
...S(Math.min(e.startMs, t - a), Math.max(e.endMs, t + a), n),
|
|
613
|
-
viewMode: n,
|
|
614
|
-
viewportWidth: r,
|
|
615
|
-
pixelsPerDay: i
|
|
616
|
-
});
|
|
617
|
-
}, rt = ({ renderWindow: e, timelineCoords: t, scrollLeft: n, viewportWidth: r }) => {
|
|
618
|
-
if (!Je(e)) throw RangeError("renderWindow must be a valid timeline range");
|
|
619
|
-
if (!Number.isFinite(n) || n < 0) throw RangeError("scrollLeft must be finite and non-negative");
|
|
620
|
-
$e(r, "viewportWidth");
|
|
621
|
-
let i = {
|
|
622
|
-
startMs: t.timeAtX(n),
|
|
623
|
-
endMs: t.timeAtX(n + r)
|
|
624
|
-
};
|
|
625
|
-
if (!Je(i)) throw RangeError("TimelineCoords must produce an increasing finite visible range");
|
|
626
|
-
let a = Qe(i, e);
|
|
627
|
-
if (!a) throw RangeError("Visible range must intersect renderWindow");
|
|
628
|
-
let o = t.timeAtX(n + r / 2);
|
|
629
|
-
if (!Number.isFinite(o)) throw RangeError("TimelineCoords must produce a finite focus");
|
|
630
|
-
return {
|
|
631
|
-
renderWindow: e,
|
|
632
|
-
visibleRange: a,
|
|
633
|
-
focusMs: o
|
|
634
|
-
};
|
|
635
|
-
}, it = ({ scrollLeft: e, viewportWidth: t, timelineWidth: n, guardBandPx: r }) => {
|
|
636
|
-
if (!Number.isFinite(e) || e < 0) throw RangeError("scrollLeft must be finite and non-negative");
|
|
637
|
-
if ($e(t, "viewportWidth"), $e(n, "timelineWidth"), !Number.isFinite(r) || r < 0) throw RangeError("guardBandPx must be finite and non-negative");
|
|
638
|
-
let i = Math.max(0, n - t);
|
|
639
|
-
if (i === 0) return null;
|
|
640
|
-
let a = Math.min(e, i), o = a <= r;
|
|
641
|
-
return o === i - a <= r ? null : o ? "left" : "right";
|
|
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({
|
|
645
|
-
range: j(r, o),
|
|
646
|
-
focusMs: o,
|
|
647
|
-
viewMode: n,
|
|
648
|
-
viewportWidth: i,
|
|
649
|
-
pixelsPerDay: a
|
|
650
|
-
});
|
|
651
|
-
if (!Je(s)) throw RangeError("Viewport engine produced an invalid render window");
|
|
652
|
-
return s;
|
|
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"), {
|
|
656
|
-
focusMs: a,
|
|
657
|
-
scrollLeft: Ie({
|
|
658
|
-
anchorMs: a,
|
|
659
|
-
toX: n.toX,
|
|
660
|
-
viewportWidth: r,
|
|
661
|
-
timelineWidth: i
|
|
662
|
-
})
|
|
663
|
-
};
|
|
664
|
-
}, st = (e) => {
|
|
665
|
-
if (v(e)) {
|
|
666
|
-
let t = g(e);
|
|
667
|
-
return Ee(Date.now(), t, "floor") + t / 2;
|
|
668
|
-
}
|
|
669
|
-
return T(Date.now()) + s / 2;
|
|
670
|
-
}, ct = (e, t) => {
|
|
671
|
-
if (v(t)) {
|
|
672
|
-
let n = g(t);
|
|
673
|
-
return Ee(e, n, "floor") + n + 1;
|
|
674
|
-
}
|
|
675
|
-
return T(e) + s + 1;
|
|
676
|
-
}, lt = (e) => {
|
|
677
|
-
let [t, n] = J(() => st(e)), r = q(null), i = U(() => {
|
|
678
|
-
r.current &&= (clearTimeout(r.current), null);
|
|
679
|
-
}, []), a = U(() => {
|
|
680
|
-
i();
|
|
681
|
-
let t = Date.now(), o = ct(t, e);
|
|
682
|
-
r.current = setTimeout(() => {
|
|
683
|
-
n(st(e)), a();
|
|
684
|
-
}, Math.max(1, o - t));
|
|
685
|
-
}, [i, e]);
|
|
686
|
-
W(() => (n(st(e)), a(), i), [
|
|
687
|
-
e,
|
|
688
|
-
a,
|
|
689
|
-
i
|
|
690
|
-
]);
|
|
691
|
-
let o = ue();
|
|
692
|
-
return W(() => {
|
|
693
|
-
o === "visible" && (n(st(e)), a());
|
|
694
|
-
}, [
|
|
695
|
-
o,
|
|
696
|
-
a,
|
|
697
|
-
e
|
|
698
|
-
]), t;
|
|
699
|
-
};
|
|
700
|
-
//#endregion
|
|
701
|
-
//#region src/components/Gantt/GanttChart/hooks/useTimelineViewportController.ts
|
|
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) => {
|
|
704
|
-
let t = S.current;
|
|
705
|
-
if (!t || !e) return !1;
|
|
706
|
-
let n = e.scrollLeft || 0;
|
|
707
|
-
return Math.abs(n - t.targetLeft) > 1;
|
|
708
|
-
}, []), E = U((e) => {
|
|
709
|
-
let t = S.current;
|
|
710
|
-
t && Math.abs(e - t.targetLeft) <= 1 && (S.current = null);
|
|
711
|
-
}, []), D = U(() => {
|
|
712
|
-
x.current !== null && (cancelAnimationFrame(x.current), x.current = null), b.current = null;
|
|
713
|
-
}, []), O = U((e) => {
|
|
714
|
-
D();
|
|
715
|
-
let t = { left: e };
|
|
716
|
-
b.current = t, x.current = requestAnimationFrame(() => {
|
|
717
|
-
x.current = null, b.current === t && (b.current = null);
|
|
718
|
-
});
|
|
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(() => {
|
|
721
|
-
N.current = null;
|
|
722
|
-
let e = te.current;
|
|
723
|
-
j((t) => t === e ? t : e);
|
|
724
|
-
}));
|
|
725
|
-
}, []), P = U(() => {
|
|
726
|
-
T.current !== null && (cancelAnimationFrame(T.current), T.current = null);
|
|
727
|
-
}, []);
|
|
728
|
-
W(() => () => {
|
|
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(() => {
|
|
732
|
-
let e = _.current;
|
|
733
|
-
return e !== null && Number.isFinite(e) ? e : st(n);
|
|
734
|
-
}, [n]), L = U((e) => {
|
|
735
|
-
Number.isFinite(e) && (_.current = e);
|
|
736
|
-
}, []), R = U((e) => {
|
|
737
|
-
S.current = null;
|
|
738
|
-
let t = at({
|
|
739
|
-
focusMs: e,
|
|
740
|
-
fallbackFocusMs: I(),
|
|
741
|
-
viewMode: n,
|
|
742
|
-
timeRangeConfig: u,
|
|
743
|
-
viewportWidth: h || 1e3,
|
|
744
|
-
pixelsPerDay: l
|
|
745
|
-
});
|
|
746
|
-
return oe(t), v.current = !0, t;
|
|
747
|
-
}, [
|
|
748
|
-
u,
|
|
749
|
-
l,
|
|
750
|
-
I,
|
|
751
|
-
n,
|
|
752
|
-
h
|
|
753
|
-
]);
|
|
754
|
-
W(() => {
|
|
755
|
-
F.current = n, R(I());
|
|
756
|
-
}, [e?.bufferDaysBefore, e?.bufferDaysAfter]), le(() => {
|
|
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;
|
|
758
|
-
n > 0 && n !== h && g(n);
|
|
759
|
-
}, [
|
|
760
|
-
r,
|
|
761
|
-
i?.width,
|
|
762
|
-
h
|
|
763
|
-
]);
|
|
764
|
-
let z = K(() => ce || at({
|
|
765
|
-
focusMs: I(),
|
|
766
|
-
viewMode: n,
|
|
767
|
-
timeRangeConfig: u,
|
|
768
|
-
viewportWidth: h || 1e3,
|
|
769
|
-
pixelsPerDay: l
|
|
770
|
-
}), [
|
|
771
|
-
ce,
|
|
772
|
-
u,
|
|
773
|
-
l,
|
|
774
|
-
I,
|
|
775
|
-
n,
|
|
776
|
-
h
|
|
777
|
-
]), { timelineStartMs: B, timelineEndMs: V } = K(() => ({
|
|
778
|
-
timelineStartMs: z.startMs,
|
|
779
|
-
timelineEndMs: z.endMs
|
|
780
|
-
}), [z]), H = K(() => Ke({
|
|
781
|
-
viewMode: n,
|
|
782
|
-
timelineStartMs: B,
|
|
783
|
-
timelineEndMs: V,
|
|
784
|
-
pixelsPerDay: l,
|
|
785
|
-
formatMessage: o
|
|
786
|
-
}), [
|
|
787
|
-
n,
|
|
788
|
-
B,
|
|
789
|
-
V,
|
|
790
|
-
l,
|
|
791
|
-
o
|
|
792
|
-
]), G = K(() => ne({
|
|
793
|
-
viewMode: n,
|
|
794
|
-
timelineStartMs: B,
|
|
795
|
-
timelineEndMs: V,
|
|
796
|
-
pixelsPerDay: l,
|
|
797
|
-
lowerSegments: H
|
|
798
|
-
}), [
|
|
799
|
-
n,
|
|
800
|
-
B,
|
|
801
|
-
V,
|
|
802
|
-
l,
|
|
803
|
-
H
|
|
804
|
-
]), Y = K(() => {
|
|
805
|
-
if (H.length === 0) return 0;
|
|
806
|
-
let e = H[H.length - 1];
|
|
807
|
-
return e.left + e.width;
|
|
808
|
-
}, [H]), ue = U(() => v.current ? !1 : (R(I()), !0), [I, R]);
|
|
809
|
-
le(() => {
|
|
810
|
-
F.current !== n && (F.current = n, R(I()));
|
|
811
|
-
}, [
|
|
812
|
-
n,
|
|
813
|
-
I,
|
|
814
|
-
R
|
|
815
|
-
]);
|
|
816
|
-
let de = lt(n), fe = K(() => Y <= 0 ? null : G.toX(de), [
|
|
817
|
-
de,
|
|
818
|
-
G,
|
|
819
|
-
Y
|
|
820
|
-
]), X = U((e) => {
|
|
821
|
-
let t = a?.current;
|
|
822
|
-
t && t.style.setProperty("--gantt-scroll-left", `${e}px`);
|
|
823
|
-
}, [a]), pe = U((e, t) => {
|
|
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(() => {
|
|
832
|
-
let e = r.current, t = h;
|
|
833
|
-
if (!e || t <= 0 || Y <= 0) return !1;
|
|
834
|
-
let { scrollLeft: n } = ot({
|
|
835
|
-
focusMs: _.current ?? NaN,
|
|
836
|
-
fallbackFocusMs: I(),
|
|
837
|
-
timelineCoords: G,
|
|
838
|
-
viewportWidth: t,
|
|
839
|
-
timelineWidth: Y
|
|
840
|
-
});
|
|
841
|
-
return pe(e, n);
|
|
842
|
-
}, [
|
|
843
|
-
pe,
|
|
844
|
-
r,
|
|
845
|
-
I,
|
|
846
|
-
G,
|
|
847
|
-
Y,
|
|
848
|
-
h
|
|
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) => {
|
|
858
|
-
let t = e.currentTarget.scrollLeft, n = h, r = b.current, i = r !== null && Math.abs(t - r.left) <= 1;
|
|
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({
|
|
866
|
-
renderWindow: {
|
|
867
|
-
startMs: B,
|
|
868
|
-
endMs: V
|
|
869
|
-
},
|
|
870
|
-
timelineCoords: G,
|
|
871
|
-
scrollLeft: e,
|
|
872
|
-
viewportWidth: n
|
|
873
|
-
}).focusMs);
|
|
874
|
-
}
|
|
875
|
-
E(t);
|
|
876
|
-
}, [
|
|
877
|
-
X,
|
|
878
|
-
D,
|
|
879
|
-
ge,
|
|
880
|
-
G,
|
|
881
|
-
h,
|
|
882
|
-
ie,
|
|
883
|
-
L,
|
|
884
|
-
E,
|
|
885
|
-
V,
|
|
886
|
-
B,
|
|
887
|
-
Y
|
|
888
|
-
]), ye = U(() => {
|
|
889
|
-
let e = st(n);
|
|
890
|
-
L(e), R(e);
|
|
891
|
-
}, [
|
|
892
|
-
R,
|
|
893
|
-
L,
|
|
894
|
-
n
|
|
895
|
-
]), be = U((e) => {
|
|
896
|
-
let t = r.current, n = e?.targetMs;
|
|
897
|
-
if (!t || !Number.isFinite(n)) return;
|
|
898
|
-
let i = t.clientWidth > 0 ? t.clientWidth : h;
|
|
899
|
-
if (n < B || n >= V) {
|
|
900
|
-
S.current = null, L(n), R(n);
|
|
901
|
-
return;
|
|
902
|
-
}
|
|
903
|
-
let a = Ie({
|
|
904
|
-
anchorMs: n,
|
|
905
|
-
toX: G.toX,
|
|
906
|
-
viewportWidth: i,
|
|
907
|
-
timelineWidth: Y
|
|
908
|
-
}), o = t.scrollLeft || 0;
|
|
909
|
-
if (!(i > 0 && Math.abs(a - o) <= i * 1.5)) {
|
|
910
|
-
L(n), R(n);
|
|
911
|
-
return;
|
|
912
|
-
}
|
|
913
|
-
let s = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
|
|
914
|
-
s === "smooth" ? S.current = { targetLeft: a } : (S.current = null, O(a)), t.scrollTo({
|
|
915
|
-
left: a,
|
|
916
|
-
behavior: s
|
|
917
|
-
}), L(n), s === "auto" && (X(a), j(a), M.current = a);
|
|
918
|
-
}, [
|
|
919
|
-
X,
|
|
920
|
-
r,
|
|
921
|
-
O,
|
|
922
|
-
R,
|
|
923
|
-
L,
|
|
924
|
-
G,
|
|
925
|
-
V,
|
|
926
|
-
B,
|
|
927
|
-
Y,
|
|
928
|
-
h
|
|
929
|
-
]);
|
|
930
|
-
W(() => {
|
|
931
|
-
if (!f.current || !h || !Y || v.current || !y.current) return;
|
|
932
|
-
let e = r.current, t = e?.scrollLeft ?? A, n = it({
|
|
933
|
-
scrollLeft: Math.max(0, t),
|
|
934
|
-
viewportWidth: h,
|
|
935
|
-
timelineWidth: Y,
|
|
936
|
-
guardBandPx: 280
|
|
937
|
-
});
|
|
938
|
-
s || c || ee(e) || (e && E(e.scrollLeft || 0), n && ue());
|
|
939
|
-
}, [
|
|
940
|
-
A,
|
|
941
|
-
Y,
|
|
942
|
-
h,
|
|
943
|
-
r,
|
|
944
|
-
ee,
|
|
945
|
-
E,
|
|
946
|
-
ue,
|
|
947
|
-
s,
|
|
948
|
-
c,
|
|
949
|
-
C
|
|
950
|
-
]), le(() => {
|
|
951
|
-
!f.current || h <= 0 || R(I());
|
|
952
|
-
}, [
|
|
953
|
-
I,
|
|
954
|
-
R,
|
|
955
|
-
h
|
|
956
|
-
]), le(() => {
|
|
957
|
-
v.current && (h <= 0 || Y <= 0 || ge() || _e());
|
|
958
|
-
}, [
|
|
959
|
-
ge,
|
|
960
|
-
_e,
|
|
961
|
-
Y,
|
|
962
|
-
h,
|
|
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());
|
|
968
|
-
return;
|
|
969
|
-
}
|
|
970
|
-
v.current = !0, ge() || _e();
|
|
971
|
-
}
|
|
972
|
-
}, [
|
|
973
|
-
I,
|
|
974
|
-
R,
|
|
975
|
-
ge,
|
|
976
|
-
_e,
|
|
977
|
-
L,
|
|
978
|
-
ae,
|
|
979
|
-
Y,
|
|
980
|
-
h,
|
|
981
|
-
n
|
|
982
|
-
]);
|
|
983
|
-
let xe = U((e) => {
|
|
984
|
-
let t = h;
|
|
985
|
-
t <= 0 || L(G.timeAtX(e + t / 2));
|
|
986
|
-
}, [
|
|
987
|
-
h,
|
|
988
|
-
G,
|
|
989
|
-
L
|
|
990
|
-
]), Se = U(() => {
|
|
991
|
-
let e = r.current;
|
|
992
|
-
if (!e) return;
|
|
993
|
-
let t = h, n = e.scrollLeft || 0, i = Math.max(0, n - t);
|
|
994
|
-
if (Math.abs(i - n) <= 1) {
|
|
995
|
-
S.current = null;
|
|
996
|
-
let e = G.timeAtX(n - t / 2);
|
|
997
|
-
L(e), R(e);
|
|
998
|
-
return;
|
|
999
|
-
}
|
|
1000
|
-
S.current = { targetLeft: i }, e.scrollTo({
|
|
1001
|
-
left: i,
|
|
1002
|
-
behavior: "smooth"
|
|
1003
|
-
}), xe(i);
|
|
1004
|
-
}, [
|
|
1005
|
-
r,
|
|
1006
|
-
R,
|
|
1007
|
-
L,
|
|
1008
|
-
G,
|
|
1009
|
-
xe,
|
|
1010
|
-
h
|
|
1011
|
-
]), Ce = U(() => {
|
|
1012
|
-
let e = r.current;
|
|
1013
|
-
if (!e) return;
|
|
1014
|
-
let t = h, n = e.scrollLeft || 0, i = Math.max(0, Y - t), a = Fe(n + t, t, Y);
|
|
1015
|
-
if (Math.abs(a - n) <= 1) {
|
|
1016
|
-
if (S.current = null, a >= i - 1) {
|
|
1017
|
-
let e = G.timeAtX(n + t * 1.5);
|
|
1018
|
-
L(e), R(e);
|
|
1019
|
-
}
|
|
1020
|
-
return;
|
|
1021
|
-
}
|
|
1022
|
-
S.current = { targetLeft: a }, e.scrollTo({
|
|
1023
|
-
left: a,
|
|
1024
|
-
behavior: "smooth"
|
|
1025
|
-
}), xe(a);
|
|
1026
|
-
}, [
|
|
1027
|
-
r,
|
|
1028
|
-
R,
|
|
1029
|
-
L,
|
|
1030
|
-
G,
|
|
1031
|
-
h,
|
|
1032
|
-
Y,
|
|
1033
|
-
xe
|
|
1034
|
-
]);
|
|
1035
|
-
W(() => {
|
|
1036
|
-
let e = r.current;
|
|
1037
|
-
if (!e) return;
|
|
1038
|
-
let t = () => {
|
|
1039
|
-
S.current && (S.current = null, w((e) => e + 1));
|
|
1040
|
-
};
|
|
1041
|
-
return e.addEventListener("scrollend", t), () => e.removeEventListener("scrollend", t);
|
|
1042
|
-
}, [r]);
|
|
1043
|
-
let we = (!se || v.current) && Y > 0 && h > 0 ? ot({
|
|
1044
|
-
focusMs: _.current ?? NaN,
|
|
1045
|
-
fallbackFocusMs: I(),
|
|
1046
|
-
timelineCoords: G,
|
|
1047
|
-
viewportWidth: h,
|
|
1048
|
-
timelineWidth: Y
|
|
1049
|
-
}).scrollLeft : A, { visibleStartMs: Te, visibleEndMs: Ee } = K(() => {
|
|
1050
|
-
if (Y <= 0 || h <= 0) return {
|
|
1051
|
-
visibleStartMs: B,
|
|
1052
|
-
visibleEndMs: B
|
|
1053
|
-
};
|
|
1054
|
-
let e = Fe(we, h, Y), { visibleRange: t } = rt({
|
|
1055
|
-
renderWindow: {
|
|
1056
|
-
startMs: B,
|
|
1057
|
-
endMs: V
|
|
1058
|
-
},
|
|
1059
|
-
timelineCoords: G,
|
|
1060
|
-
scrollLeft: e,
|
|
1061
|
-
viewportWidth: h
|
|
1062
|
-
});
|
|
1063
|
-
return {
|
|
1064
|
-
visibleStartMs: t.startMs,
|
|
1065
|
-
visibleEndMs: t.endMs
|
|
1066
|
-
};
|
|
1067
|
-
}, [
|
|
1068
|
-
we,
|
|
1069
|
-
G,
|
|
1070
|
-
V,
|
|
1071
|
-
B,
|
|
1072
|
-
Y,
|
|
1073
|
-
h
|
|
1074
|
-
]);
|
|
1075
|
-
return {
|
|
1076
|
-
pixelsPerDay: l,
|
|
1077
|
-
viewportWidth: h,
|
|
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,
|
|
1088
|
-
isInitialLayoutReady: p,
|
|
1089
|
-
handleContentScroll: ve,
|
|
1090
|
-
handleTodayClick: ye,
|
|
1091
|
-
handleOffscreenJump: be,
|
|
1092
|
-
handleScrollPrev: Se,
|
|
1093
|
-
handleScrollNext: Ce
|
|
1094
|
-
};
|
|
1095
|
-
}
|
|
1096
|
-
//#endregion
|
|
1097
|
-
//#region src/components/Gantt/GanttChart/hooks/useNormalizedItems.ts
|
|
1098
|
-
function dt({ visibleItems: e, committedRangeById: t = {}, viewMode: n = "day" }) {
|
|
1099
|
-
return { normalizedItems: K(() => {
|
|
1100
|
-
let r = Array.isArray(e) ? e : [], i = [], a = b(n) ? n : "day";
|
|
1101
|
-
for (let e = 0; e < r.length; e++) {
|
|
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({
|
|
1103
|
-
rawStartMs: s,
|
|
1104
|
-
rawEndMs: c,
|
|
1105
|
-
baseStartMs: l,
|
|
1106
|
-
baseEndMs: u
|
|
1107
|
-
}, a), h = m.startMs, g = m.endMs;
|
|
1108
|
-
if (!p && f?.startMs && f?.endMs) {
|
|
1109
|
-
let e = f.startMs, t = f.endMs;
|
|
1110
|
-
Number.isFinite(e) && Number.isFinite(t) && t > e && (h = e, g = t);
|
|
1111
|
-
}
|
|
1112
|
-
i.push({
|
|
1113
|
-
...n,
|
|
1114
|
-
id: o,
|
|
1115
|
-
rowIndex: e,
|
|
1116
|
-
parentId: n?.parentId ?? void 0,
|
|
1117
|
-
groupKey: n?.groupKey ?? void 0,
|
|
1118
|
-
recordId: n?.recordId ?? void 0,
|
|
1119
|
-
rawStartMs: s,
|
|
1120
|
-
rawEndMs: c,
|
|
1121
|
-
baseStartMs: l,
|
|
1122
|
-
baseEndMs: u,
|
|
1123
|
-
startMs: h,
|
|
1124
|
-
endMs: g,
|
|
1125
|
-
invalid: p,
|
|
1126
|
-
progress: n?.progress === null || n?.progress === void 0 ? null : w(n.progress)
|
|
1127
|
-
});
|
|
1128
|
-
}
|
|
1129
|
-
return i;
|
|
1130
|
-
}, [
|
|
1131
|
-
e,
|
|
1132
|
-
t,
|
|
1133
|
-
n
|
|
1134
|
-
]) };
|
|
1135
|
-
}
|
|
1136
|
-
//#endregion
|
|
1137
|
-
//#region src/components/Gantt/GanttChart/hooks/useGanttScrollbars.tsx
|
|
1138
|
-
function ft(e, t) {
|
|
1139
|
-
let [n, r] = J(!1);
|
|
1140
|
-
return le(() => {
|
|
1141
|
-
let n = e.current, i = t.current;
|
|
1142
|
-
if (!n || !i) return;
|
|
1143
|
-
let a = ye({
|
|
1144
|
-
target: n,
|
|
1145
|
-
elements: { viewport: i }
|
|
1146
|
-
}, { scrollbars: {
|
|
1147
|
-
theme: "os-theme-bsy",
|
|
1148
|
-
autoHide: "leave",
|
|
1149
|
-
autoHideDelay: 600,
|
|
1150
|
-
clickScroll: !0
|
|
1151
|
-
} }), o = a.elements().scrollbarHorizontal.scrollbar, s = !1, c = null, l = (e) => {
|
|
1152
|
-
e.pointerType === "mouse" && e.button !== 0 || (s = !0, c = e.pointerId, r(!0));
|
|
1153
|
-
}, u = (e) => {
|
|
1154
|
-
if (!s) return;
|
|
1155
|
-
let t = e.pointerId, n = "pointerId" in e && ce(t) ? t : null;
|
|
1156
|
-
n !== null && c !== null && n !== c || (s = !1, c = null, r(!1));
|
|
1157
|
-
}, d = { capture: !0 };
|
|
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), () => {
|
|
1159
|
-
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();
|
|
1160
|
-
};
|
|
1161
|
-
}, [e, t]), n;
|
|
1162
|
-
}
|
|
1163
|
-
//#endregion
|
|
1164
|
-
//#region src/components/Gantt/GanttChart/utils/timelineMarkers.ts
|
|
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;
|
|
1167
|
-
}
|
|
1168
|
-
var Z = {
|
|
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({
|
|
1251
|
-
lowerSegments: a,
|
|
1252
|
-
viewMode: l,
|
|
1253
|
-
formatMessage: d
|
|
1254
|
-
}), [
|
|
1255
|
-
a,
|
|
1256
|
-
l,
|
|
1257
|
-
d
|
|
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);
|
|
1261
|
-
}, [
|
|
1262
|
-
g,
|
|
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
|
|
1268
|
-
});
|
|
1269
|
-
return /* @__PURE__ */ z("div", {
|
|
1270
|
-
className: Z.calendar,
|
|
1271
|
-
children: [/* @__PURE__ */ z("div", {
|
|
1272
|
-
ref: r,
|
|
1273
|
-
className: Z.calendarTrack,
|
|
1274
|
-
"data-testid": "gantt-calendar-track",
|
|
1275
|
-
style: { width: e },
|
|
1276
|
-
children: [
|
|
1277
|
-
i.map((e) => {
|
|
1278
|
-
let t = a[e.index];
|
|
1279
|
-
return t ? /* @__PURE__ */ R("div", {
|
|
1280
|
-
className: Z.headerColLine,
|
|
1281
|
-
style: {
|
|
1282
|
-
left: t.left,
|
|
1283
|
-
top: 34,
|
|
1284
|
-
height: 34
|
|
1285
|
-
}
|
|
1286
|
-
}, `header-line-${t.id}`) : null;
|
|
1287
|
-
}),
|
|
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
|
-
}),
|
|
1313
|
-
i.map((e) => {
|
|
1314
|
-
let t = a[e.index];
|
|
1315
|
-
if (!t) return null;
|
|
1316
|
-
let n = t.id === y;
|
|
1317
|
-
return /* @__PURE__ */ R("div", {
|
|
1318
|
-
className: Y(Z.headerCell, Z.headerCellBottom, n && Z.isActive),
|
|
1319
|
-
"data-testid": "gantt-header-cell-bottom",
|
|
1320
|
-
style: {
|
|
1321
|
-
left: t.left,
|
|
1322
|
-
width: t.width,
|
|
1323
|
-
height: 34,
|
|
1324
|
-
top: 34
|
|
1325
|
-
},
|
|
1326
|
-
children: t.label
|
|
1327
|
-
}, t.id);
|
|
1328
|
-
}),
|
|
1329
|
-
S && /* @__PURE__ */ R("span", {
|
|
1330
|
-
className: Z.todayIndicatorHeaderDot,
|
|
1331
|
-
style: { left: o ?? void 0 }
|
|
1332
|
-
})
|
|
1333
|
-
]
|
|
1334
|
-
}), /* @__PURE__ */ R("div", {
|
|
1335
|
-
className: Z.calendarToolbar,
|
|
1336
|
-
"data-testid": "gantt-calendar-toolbar",
|
|
1337
|
-
children: /* @__PURE__ */ R(F, {
|
|
1338
|
-
viewMode: l,
|
|
1339
|
-
availableModes: u,
|
|
1340
|
-
onViewModeChange: f,
|
|
1341
|
-
onTodayClick: p,
|
|
1342
|
-
onScrollPrev: m,
|
|
1343
|
-
onScrollNext: h
|
|
1344
|
-
})
|
|
1345
|
-
})]
|
|
1346
|
-
});
|
|
1347
|
-
});
|
|
1348
|
-
//#endregion
|
|
1349
|
-
//#region src/components/Gantt/GanttChart/hooks/useGanttRowVirtualScroll.ts
|
|
1350
|
-
function vt({ items: e, contentRef: t, safeRowHeight: n, viewportHeight: r, overscan: i = 4 }) {
|
|
1351
|
-
let [a, o] = J(!1), s = _e({
|
|
1352
|
-
count: e.length,
|
|
1353
|
-
getScrollElement: () => t.current,
|
|
1354
|
-
estimateSize: () => n,
|
|
1355
|
-
overscan: i,
|
|
1356
|
-
onChange: (e) => {
|
|
1357
|
-
let t = !!e?.isScrolling;
|
|
1358
|
-
o((e) => e === t ? e : t);
|
|
1359
|
-
}
|
|
1360
|
-
});
|
|
1361
|
-
return {
|
|
1362
|
-
virtualRows: s.getVirtualItems(),
|
|
1363
|
-
canvasHeight: Math.max(s.getTotalSize(), r),
|
|
1364
|
-
isScrolling: a
|
|
1365
|
-
};
|
|
1366
|
-
}
|
|
1367
|
-
//#endregion
|
|
1368
|
-
//#region src/components/Gantt/GanttChart/hooks/useOffscreenIndicators.ts
|
|
1369
|
-
function yt({ virtualRows: e, normalizedItems: t, visibleStartMs: n, visibleEndMs: r, enabled: i = !0, excludeTaskId: a = null }) {
|
|
1370
|
-
return K(() => {
|
|
1371
|
-
if (!i || !Array.isArray(e) || !Array.isArray(t) || !Number.isFinite(n) || !Number.isFinite(r) || n >= r) return [];
|
|
1372
|
-
let o = [];
|
|
1373
|
-
return e.forEach((e) => {
|
|
1374
|
-
let i = t[e.index];
|
|
1375
|
-
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;
|
|
1376
|
-
let s = i.endMs <= n, c = i.startMs >= r;
|
|
1377
|
-
!s && !c || o.push({
|
|
1378
|
-
rowKey: `offscreen-${i.id}-${e.key}`,
|
|
1379
|
-
rowTop: e.start,
|
|
1380
|
-
rowHeight: e.size,
|
|
1381
|
-
showLeft: s,
|
|
1382
|
-
showRight: c,
|
|
1383
|
-
targetMs: i.startMs,
|
|
1384
|
-
taskId: i.id
|
|
1385
|
-
});
|
|
1386
|
-
}), o;
|
|
1387
|
-
}, [
|
|
1388
|
-
e,
|
|
1389
|
-
t,
|
|
1390
|
-
n,
|
|
1391
|
-
r,
|
|
1392
|
-
i,
|
|
1393
|
-
a
|
|
1394
|
-
]);
|
|
1395
|
-
}
|
|
1396
|
-
//#endregion
|
|
1397
|
-
//#region src/components/Gantt/GanttChart/hooks/useRowHoverHighlight.ts
|
|
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(() => {
|
|
1400
|
-
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
1401
|
-
for (; n < e.length;) {
|
|
1402
|
-
let r = e[n]?.parentId;
|
|
1403
|
-
if (r) {
|
|
1404
|
-
let i = n;
|
|
1405
|
-
for (; i < e.length && e[i]?.parentId === r;) i += 1;
|
|
1406
|
-
for (let e = n; e < i; e += 1) t.set(e, {
|
|
1407
|
-
startIndex: n,
|
|
1408
|
-
endIndex: i - 1
|
|
1409
|
-
});
|
|
1410
|
-
n = i;
|
|
1411
|
-
} else t.set(n, null), n += 1;
|
|
1412
|
-
}
|
|
1413
|
-
return t;
|
|
1414
|
-
}, [e]), u = q(l);
|
|
1415
|
-
u.current = l;
|
|
1416
|
-
let m = U((e, n) => {
|
|
1417
|
-
let r = o.current;
|
|
1418
|
-
r && (r.style.top = `${e * t}px`, r.style.height = `${(n - e + 1) * t}px`, r.style.display = "block");
|
|
1419
|
-
}, [t]), h = U(() => {
|
|
1420
|
-
let e = o.current;
|
|
1421
|
-
e && (e.style.display = "none");
|
|
1422
|
-
}, []), g = U((t) => {
|
|
1423
|
-
if (!t) {
|
|
1424
|
-
h();
|
|
1425
|
-
return;
|
|
1426
|
-
}
|
|
1427
|
-
let n = t.type, r = t.id, i = -1, a = -1;
|
|
1428
|
-
for (let t = 0; t < e.length; t += 1) {
|
|
1429
|
-
let o = p(e[t]);
|
|
1430
|
-
o && o.type === n && o.id === r && (i === -1 && (i = t), a = t);
|
|
1431
|
-
}
|
|
1432
|
-
if (i === -1) {
|
|
1433
|
-
h();
|
|
1434
|
-
return;
|
|
1435
|
-
}
|
|
1436
|
-
m(i, a);
|
|
1437
|
-
}, [
|
|
1438
|
-
e,
|
|
1439
|
-
m,
|
|
1440
|
-
h
|
|
1441
|
-
]), _ = U((r) => {
|
|
1442
|
-
if (i?.()) {
|
|
1443
|
-
a.current !== null && (a.current = null, h()), c.current = !1;
|
|
1444
|
-
return;
|
|
1445
|
-
}
|
|
1446
|
-
c.current = !0;
|
|
1447
|
-
let o = r.currentTarget, l = o.getBoundingClientRect(), d = r.clientY - l.top + o.scrollTop, g = Math.floor(d / t);
|
|
1448
|
-
if (g < 0 || g >= e.length) {
|
|
1449
|
-
a.current !== null && (a.current = null, h(), s.current !== null && (s.current = null, n?.(null)));
|
|
1450
|
-
return;
|
|
1451
|
-
}
|
|
1452
|
-
if (a.current !== g) {
|
|
1453
|
-
a.current = g;
|
|
1454
|
-
let t = u.current.get(g);
|
|
1455
|
-
m(t ? t.startIndex : g, t ? t.endIndex : g);
|
|
1456
|
-
let r = p(e[g]);
|
|
1457
|
-
f(s.current, r) || (s.current = r, n?.(r));
|
|
1458
|
-
}
|
|
1459
|
-
}, [
|
|
1460
|
-
t,
|
|
1461
|
-
e,
|
|
1462
|
-
n,
|
|
1463
|
-
m,
|
|
1464
|
-
h,
|
|
1465
|
-
i
|
|
1466
|
-
]), v = U(() => {
|
|
1467
|
-
c.current = !1, a.current = null, h(), s.current !== null && (s.current = null, n?.(null));
|
|
1468
|
-
}, [n, h]);
|
|
1469
|
-
return W(() => {
|
|
1470
|
-
if (r) return r((e, t) => {
|
|
1471
|
-
if (t?.source === "table") {
|
|
1472
|
-
c.current = !1, a.current = null, s.current = e, g(e);
|
|
1473
|
-
return;
|
|
1474
|
-
}
|
|
1475
|
-
c.current || g(e);
|
|
1476
|
-
});
|
|
1477
|
-
}, [r, g]), {
|
|
1478
|
-
hoverBgRef: o,
|
|
1479
|
-
handleContentMouseMove: _,
|
|
1480
|
-
handleContentMouseLeave: v
|
|
1481
|
-
};
|
|
1482
|
-
}
|
|
1483
|
-
//#endregion
|
|
1484
|
-
//#region src/components/Gantt/GanttChart/GanttInteractionContext.ts
|
|
1485
|
-
var xt = pe({
|
|
1486
|
-
tooltip: null,
|
|
1487
|
-
isScrolling: !1,
|
|
1488
|
-
collapsedKeys: void 0,
|
|
1489
|
-
onBarClick: () => {},
|
|
1490
|
-
onTaskMouseDown: () => {},
|
|
1491
|
-
onResizeMouseDown: () => {}
|
|
1492
|
-
}), St = (e) => me(xt, e), Ct = pe({
|
|
1493
|
-
viewMode: "day",
|
|
1494
|
-
pixelsPerDay: 1,
|
|
1495
|
-
timelineStartMs: 0,
|
|
1496
|
-
timelineEndMs: 0,
|
|
1497
|
-
visibleStartMs: 0,
|
|
1498
|
-
visibleEndMs: 0,
|
|
1499
|
-
timelineCoords: {
|
|
1500
|
-
toX: () => 0,
|
|
1501
|
-
toWidth: () => 0,
|
|
1502
|
-
timeAtX: () => 0
|
|
1503
|
-
},
|
|
1504
|
-
scrollLeft: 0,
|
|
1505
|
-
viewportWidth: 0,
|
|
1506
|
-
timelineWidth: 0,
|
|
1507
|
-
isInitialLayoutReady: !1
|
|
1508
|
-
}), Q = (e) => me(Ct, e), wt = (e, t) => {
|
|
1509
|
-
let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
|
|
1510
|
-
return `rgba(${parseInt(r.slice(0, 2), 16)}, ${parseInt(r.slice(2, 4), 16)}, ${parseInt(r.slice(4, 6), 16)}, ${t})`;
|
|
1511
|
-
}, Tt = (e, t) => {
|
|
1512
|
-
if (!I(e)) return null;
|
|
1513
|
-
let n = e.trim();
|
|
1514
|
-
return i.test(n) ? wt(n, t) : null;
|
|
1515
|
-
}, Et = (e, t = 2.5) => {
|
|
1516
|
-
if (!e || !I(e)) return "#121211";
|
|
1517
|
-
let n, r, i;
|
|
1518
|
-
if (e.startsWith("#")) {
|
|
1519
|
-
let t = e.replace("#", ""), a = t.length === 3 ? [...t].map((e) => e + e) : [
|
|
1520
|
-
t.slice(0, 2),
|
|
1521
|
-
t.slice(2, 4),
|
|
1522
|
-
t.slice(4, 6)
|
|
1523
|
-
];
|
|
1524
|
-
[n, r, i] = a.map((e) => parseInt(e, 16));
|
|
1525
|
-
} else {
|
|
1526
|
-
let t = (e.match(/\d+/g) || []).map(Number);
|
|
1527
|
-
if ([n, r, i] = t.slice(0, 3), n === void 0 || Number.isNaN(n)) return "#121211";
|
|
1528
|
-
}
|
|
1529
|
-
let a = (e) => {
|
|
1530
|
-
let t = e / 255;
|
|
1531
|
-
return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
1532
|
-
};
|
|
1533
|
-
return 1.05 / (.2126 * a(n) + .7152 * a(r) + .0722 * a(i) + .05) >= t ? "#ffffff" : "#121211";
|
|
1534
|
-
}, Dt, Ot = () => {
|
|
1535
|
-
if (Dt !== void 0) return Dt;
|
|
1536
|
-
try {
|
|
1537
|
-
Dt = document.createElement("canvas").getContext("2d");
|
|
1538
|
-
} catch {
|
|
1539
|
-
Dt = null;
|
|
1540
|
-
}
|
|
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") => {
|
|
1543
|
-
if (!e) return 0;
|
|
1544
|
-
let n = String(e), r = Ot();
|
|
1545
|
-
return r ? (r.font = t, r.measureText(n).width + 20) : n.length * 12 + 20;
|
|
1546
|
-
};
|
|
1547
|
-
//#endregion
|
|
1548
|
-
//#region src/components/Gantt/GanttChart/hooks/useBarTooltipHover.ts
|
|
1549
|
-
function At() {
|
|
1550
|
-
let [e, t] = J(null), n = q("idle"), r = U((e) => {
|
|
1551
|
-
n.current === "frozen" && (n.current = "open");
|
|
1552
|
-
let r = e.currentTarget.getBoundingClientRect();
|
|
1553
|
-
t({
|
|
1554
|
-
x: e.clientX,
|
|
1555
|
-
y: r.y,
|
|
1556
|
-
top: r.top,
|
|
1557
|
-
bottom: r.bottom,
|
|
1558
|
-
height: r.height
|
|
1559
|
-
});
|
|
1560
|
-
}, []), i = U(() => {
|
|
1561
|
-
n.current === "open" ? n.current = "frozen" : t(null);
|
|
1562
|
-
}, []), a = U((e) => {
|
|
1563
|
-
n.current = e ? "open" : "idle", e || t(null);
|
|
1564
|
-
}, []);
|
|
1565
|
-
return {
|
|
1566
|
-
virtualReference: K(() => {
|
|
1567
|
-
if (e) return { getBoundingClientRect: () => ({
|
|
1568
|
-
width: 0,
|
|
1569
|
-
height: e.height,
|
|
1570
|
-
x: e.x,
|
|
1571
|
-
y: e.y,
|
|
1572
|
-
top: e.top,
|
|
1573
|
-
bottom: e.bottom,
|
|
1574
|
-
left: e.x,
|
|
1575
|
-
right: e.x,
|
|
1576
|
-
toJSON: () => ({})
|
|
1577
|
-
}) };
|
|
1578
|
-
}, [e]),
|
|
1579
|
-
handleMouseMove: r,
|
|
1580
|
-
handleMouseLeave: i,
|
|
1581
|
-
handleTooltipVisibleChange: a
|
|
1582
|
-
};
|
|
1583
|
-
}
|
|
1584
|
-
//#endregion
|
|
1585
|
-
//#region src/components/Gantt/GanttChart/GanttBarTooltip/GanttBarTooltip.tsx
|
|
1586
|
-
var jt = {
|
|
1587
|
-
borderRadius: "10px",
|
|
1588
|
-
padding: 0,
|
|
1589
|
-
backgroundColor: "#fff",
|
|
1590
|
-
boxShadow: "0 0 12px 0 rgba(0, 0, 0, 0.08)"
|
|
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), [
|
|
1593
|
-
r,
|
|
1594
|
-
t,
|
|
1595
|
-
e
|
|
1596
|
-
]);
|
|
1597
|
-
return l ? /* @__PURE__ */ R(n, {
|
|
1598
|
-
content: l,
|
|
1599
|
-
placement: "bottom",
|
|
1600
|
-
showArrow: !1,
|
|
1601
|
-
hoverDelay: 300,
|
|
1602
|
-
moveToFloatingKeepOpen: !0,
|
|
1603
|
-
widthMode: "manual",
|
|
1604
|
-
maxWidth: 400,
|
|
1605
|
-
offset: 5,
|
|
1606
|
-
virtualReference: a,
|
|
1607
|
-
onVisibleChange: c,
|
|
1608
|
-
style: jt,
|
|
1609
|
-
children: i({
|
|
1610
|
-
onMouseMove: o,
|
|
1611
|
-
onMouseLeave: s
|
|
1612
|
-
})
|
|
1613
|
-
}) : /* @__PURE__ */ R(L, { children: i({
|
|
1614
|
-
onMouseMove: () => {},
|
|
1615
|
-
onMouseLeave: () => {}
|
|
1616
|
-
}) });
|
|
1617
|
-
}, Nt = (e, t, n) => ({
|
|
1618
|
-
...e,
|
|
1619
|
-
clientX: t,
|
|
1620
|
-
clientY: n,
|
|
1621
|
-
preventDefault: () => e.preventDefault(),
|
|
1622
|
-
stopPropagation: () => e.stopPropagation()
|
|
1623
|
-
});
|
|
1624
|
-
function Pt({ enabled: e, onTaskMouseDown: t, onBarClick: n }) {
|
|
1625
|
-
let r = q(null), i = q(null), a = q(t), o = q(n);
|
|
1626
|
-
W(() => {
|
|
1627
|
-
a.current = t, o.current = n;
|
|
1628
|
-
}, [t, n]);
|
|
1629
|
-
let s = U(() => {
|
|
1630
|
-
r.current = null;
|
|
1631
|
-
let e = i.current;
|
|
1632
|
-
e && (document.removeEventListener("mousemove", e.move), document.removeEventListener("mouseup", e.up), i.current = null);
|
|
1633
|
-
}, []);
|
|
1634
|
-
return W(() => () => s(), [s]), { handlePointerMouseDown: U((t, n, c, l = 1) => {
|
|
1635
|
-
if (!e) return;
|
|
1636
|
-
s();
|
|
1637
|
-
let u = {
|
|
1638
|
-
item: n,
|
|
1639
|
-
baseLeft: c,
|
|
1640
|
-
width: l,
|
|
1641
|
-
startClientX: t.clientX,
|
|
1642
|
-
startClientY: t.clientY,
|
|
1643
|
-
dragStarted: !1
|
|
1644
|
-
};
|
|
1645
|
-
r.current = u;
|
|
1646
|
-
let d = (e) => {
|
|
1647
|
-
if (r.current !== u || u.dragStarted) return;
|
|
1648
|
-
let t = e.clientX - u.startClientX, i = e.clientY - u.startClientY;
|
|
1649
|
-
Math.hypot(t, i) < 5 || (u.dragStarted = !0, s(), a.current?.(Nt(e, u.startClientX, u.startClientY), n, c, u.width));
|
|
1650
|
-
}, f = (e) => {
|
|
1651
|
-
r.current === u && (s(), u.dragStarted || o.current?.(e, n));
|
|
1652
|
-
};
|
|
1653
|
-
i.current = {
|
|
1654
|
-
move: d,
|
|
1655
|
-
up: f
|
|
1656
|
-
}, document.addEventListener("mousemove", d), document.addEventListener("mouseup", f);
|
|
1657
|
-
}, [e, s]) };
|
|
1658
|
-
}
|
|
1659
|
-
var Ft = B.memo(({ item: e, barTop: n, dragTaskId: r, dragPreview: i, dragPermission: a }) => {
|
|
1660
|
-
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(() => {
|
|
1661
|
-
let t = e.color;
|
|
1662
|
-
return {
|
|
1663
|
-
baseColor: t,
|
|
1664
|
-
containerBgColor: Tt(t, .2) || t,
|
|
1665
|
-
hoverBorderColor: Tt(t, .5) || "transparent",
|
|
1666
|
-
insideLabelColor: Et(t)
|
|
1667
|
-
};
|
|
1668
|
-
}, [e.color]), C = K(() => {
|
|
1669
|
-
if (y == null || b == null || y >= b || l >= u) return null;
|
|
1670
|
-
let e = Qe({
|
|
1671
|
-
startMs: y,
|
|
1672
|
-
endMs: b
|
|
1673
|
-
}, {
|
|
1674
|
-
startMs: l,
|
|
1675
|
-
endMs: u
|
|
1676
|
-
});
|
|
1677
|
-
if (!e) return null;
|
|
1678
|
-
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 ? c.toWidth(y, b) : n, p = s ? i.previewLeftPx : t, m = s ? p + f : r, h = s ? p : Math.max(0, p), g = Math.min(d, m);
|
|
1679
|
-
return g <= 0 || h >= d || h >= g ? null : {
|
|
1680
|
-
clippedRange: e,
|
|
1681
|
-
rawBarLeft: p,
|
|
1682
|
-
calculatedBarLeft: h,
|
|
1683
|
-
calculatedBarWidth: g - h,
|
|
1684
|
-
clippedStart: s ? !1 : a || h !== p,
|
|
1685
|
-
clippedEnd: o || g !== m
|
|
1686
|
-
};
|
|
1687
|
-
}, [
|
|
1688
|
-
y,
|
|
1689
|
-
b,
|
|
1690
|
-
l,
|
|
1691
|
-
u,
|
|
1692
|
-
d,
|
|
1693
|
-
c,
|
|
1694
|
-
v,
|
|
1695
|
-
i
|
|
1696
|
-
]), { 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({
|
|
1697
|
-
enabled: te,
|
|
1698
|
-
onTaskMouseDown: h,
|
|
1699
|
-
onBarClick: m
|
|
1700
|
-
});
|
|
1701
|
-
if (!C) return null;
|
|
1702
|
-
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 = {
|
|
1703
|
-
left: F,
|
|
1704
|
-
top: n,
|
|
1705
|
-
width: `var(--bsy-gantt-bar-actual-width, ${D}px)`,
|
|
1706
|
-
height: 26,
|
|
1707
|
-
background: T,
|
|
1708
|
-
cursor: te ? "move" : "default",
|
|
1709
|
-
"--bsy-gantt-bar-fill-color": w,
|
|
1710
|
-
"--bsy-gantt-bar-hover-border-color": ee,
|
|
1711
|
-
"--bsy-gantt-bar-calc-width": `${D}px`,
|
|
1712
|
-
"--bsy-gantt-bar-label-color": E
|
|
1713
|
-
};
|
|
1714
|
-
return /* @__PURE__ */ R(Mt, {
|
|
1715
|
-
item: e,
|
|
1716
|
-
tooltip: _,
|
|
1717
|
-
disabled: v,
|
|
1718
|
-
children: ({ onMouseMove: t, onMouseLeave: n }) => /* @__PURE__ */ z("div", {
|
|
1719
|
-
className: Y(Z.bar, {
|
|
1720
|
-
[Z.isReadonly]: !te,
|
|
1721
|
-
[Z.isDragging]: v,
|
|
1722
|
-
[Z.isMicro]: re && B
|
|
1723
|
-
}),
|
|
1724
|
-
"data-testid": "gantt-bar",
|
|
1725
|
-
style: W,
|
|
1726
|
-
onMouseDown: (t) => {
|
|
1727
|
-
te && oe(t, e, F, H);
|
|
1728
|
-
},
|
|
1729
|
-
onClick: (t) => {
|
|
1730
|
-
te || m(t, e);
|
|
1731
|
-
},
|
|
1732
|
-
onMouseMove: t,
|
|
1733
|
-
onMouseLeave: n,
|
|
1734
|
-
children: [
|
|
1735
|
-
e.type === "task" ? /* @__PURE__ */ R("div", {
|
|
1736
|
-
className: Y(Z.barProgress, { [Z.isFull]: A }),
|
|
1737
|
-
"data-testid": "gantt-bar-progress",
|
|
1738
|
-
style: { width: j }
|
|
1739
|
-
}) : null,
|
|
1740
|
-
/* @__PURE__ */ R("span", {
|
|
1741
|
-
className: Y(Z.barLabel, { [Z.isHidden]: ae }),
|
|
1742
|
-
style: { color: "var(--bsy-gantt-bar-label-color)" },
|
|
1743
|
-
children: ne
|
|
1744
|
-
}),
|
|
1745
|
-
ae ? /* @__PURE__ */ R("span", {
|
|
1746
|
-
className: Y(Z.barLabel, Z.isOutside),
|
|
1747
|
-
"data-testid": "gantt-bar-label-outside",
|
|
1748
|
-
children: ne
|
|
1749
|
-
}) : null,
|
|
1750
|
-
M.canResizeStart && !se || M.canResizeEnd && !ce && U ? /* @__PURE__ */ z(L, { children: [M.canResizeStart && !se ? /* @__PURE__ */ R("button", {
|
|
1751
|
-
type: "button",
|
|
1752
|
-
className: Y(Z.barResizeHandle, Z.barResizeHandleLeft),
|
|
1753
|
-
"data-testid": "gantt-bar-resize-left",
|
|
1754
|
-
onMouseDown: (t) => g(t, e, F, "start", D),
|
|
1755
|
-
"aria-label": o("gantt.timeBegin")
|
|
1756
|
-
}) : null, M.canResizeEnd && !ce && U ? /* @__PURE__ */ R("button", {
|
|
1757
|
-
type: "button",
|
|
1758
|
-
className: Y(Z.barResizeHandle, Z.barResizeHandleRight),
|
|
1759
|
-
"data-testid": "gantt-bar-resize-right",
|
|
1760
|
-
onMouseDown: (t) => g(t, e, F, "end", D),
|
|
1761
|
-
"aria-label": o("gantt.timeEnd")
|
|
1762
|
-
}) : null] }) : null
|
|
1763
|
-
]
|
|
1764
|
-
}, `bar-${e.id}`)
|
|
1765
|
-
});
|
|
1766
|
-
}, (e, t) => {
|
|
1767
|
-
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;
|
|
1768
|
-
let n = e.dragPreview, r = t.dragPreview;
|
|
1769
|
-
return !(n !== r && (!n || !r || n.previewStartMs !== r.previewStartMs || n.previewEndMs !== r.previewEndMs || n.previewLeftPx !== r.previewLeftPx));
|
|
1770
|
-
}), $ = {
|
|
1771
|
-
root: "_root_1g3ub_1",
|
|
1772
|
-
arrow: "_arrow_1g3ub_9",
|
|
1773
|
-
label: "_label_1g3ub_13",
|
|
1774
|
-
isCollapsed: "_isCollapsed_1g3ub_29",
|
|
1775
|
-
labelText: "_labelText_1g3ub_33",
|
|
1776
|
-
track: "_track_1g3ub_40",
|
|
1777
|
-
progress: "_progress_1g3ub_49",
|
|
1778
|
-
summaryTooltip: "_summaryTooltip_1g3ub_59",
|
|
1779
|
-
summaryTooltipLine: "_summaryTooltipLine_1g3ub_69"
|
|
1780
|
-
}, It = (e) => String(e).padStart(2, "0");
|
|
1781
|
-
function Lt(e, t) {
|
|
1782
|
-
if (e == null) return t("summary.empty");
|
|
1783
|
-
let n = C(e);
|
|
1784
|
-
return t("summary.datetime", {
|
|
1785
|
-
year: n.year(),
|
|
1786
|
-
month: It(n.month() + 1),
|
|
1787
|
-
day: It(n.date()),
|
|
1788
|
-
hour: It(n.hour()),
|
|
1789
|
-
minute: It(n.minute()),
|
|
1790
|
-
second: It(n.second())
|
|
1791
|
-
});
|
|
1792
|
-
}
|
|
1793
|
-
function Rt(e, t) {
|
|
1794
|
-
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);
|
|
1795
|
-
return /* @__PURE__ */ z("div", {
|
|
1796
|
-
className: $.summaryTooltip,
|
|
1797
|
-
children: [
|
|
1798
|
-
/* @__PURE__ */ R("p", {
|
|
1799
|
-
className: $.summaryTooltipLine,
|
|
1800
|
-
children: t("summary.startTime", { datetime: i })
|
|
1801
|
-
}),
|
|
1802
|
-
/* @__PURE__ */ R("p", {
|
|
1803
|
-
className: $.summaryTooltipLine,
|
|
1804
|
-
children: t("summary.endTime", { datetime: a })
|
|
1805
|
-
}),
|
|
1806
|
-
n ? /* @__PURE__ */ R("p", {
|
|
1807
|
-
className: $.summaryTooltipLine,
|
|
1808
|
-
children: t("summary.progress", { percent: Math.round(r * 100) })
|
|
1809
|
-
}) : null
|
|
1810
|
-
]
|
|
1811
|
-
});
|
|
1812
|
-
}
|
|
1813
|
-
//#endregion
|
|
1814
|
-
//#region src/components/Gantt/GanttChart/GanttSummaryBar/GanttSummaryBar.tsx
|
|
1815
|
-
var zt = 24, Bt = {
|
|
1816
|
-
borderRadius: "6px",
|
|
1817
|
-
padding: 0,
|
|
1818
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
1819
|
-
boxShadow: "none"
|
|
1820
|
-
};
|
|
1821
|
-
function Vt(e, t) {
|
|
1822
|
-
return e == null || e === "__empty__" ? t : e;
|
|
1823
|
-
}
|
|
1824
|
-
var Ht = ({ item: r, barTop: i }) => {
|
|
1825
|
-
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({
|
|
1826
|
-
rawStartMs: r.rawStartMs,
|
|
1827
|
-
rawEndMs: r.rawEndMs,
|
|
1828
|
-
progress: r.progress
|
|
1829
|
-
}, o), [
|
|
1830
|
-
r.rawStartMs,
|
|
1831
|
-
r.rawEndMs,
|
|
1832
|
-
r.progress,
|
|
1833
|
-
o
|
|
1834
|
-
]), y = K(() => {
|
|
1835
|
-
if (r.startMs === null || r.endMs === null || r.startMs >= r.endMs || c >= l) return null;
|
|
1836
|
-
let e = Qe({
|
|
1837
|
-
startMs: r.startMs,
|
|
1838
|
-
endMs: r.endMs
|
|
1839
|
-
}, {
|
|
1840
|
-
startMs: c,
|
|
1841
|
-
endMs: l
|
|
1842
|
-
});
|
|
1843
|
-
return e ? {
|
|
1844
|
-
barLeft: s.toX(e.startMs),
|
|
1845
|
-
barWidth: s.toWidth(e.startMs, e.endMs),
|
|
1846
|
-
wrapperTop: i + (26 - zt) / 2,
|
|
1847
|
-
clippedRange: e,
|
|
1848
|
-
itemStartMs: r.startMs,
|
|
1849
|
-
itemEndMs: r.endMs
|
|
1850
|
-
} : null;
|
|
1851
|
-
}, [
|
|
1852
|
-
r.startMs,
|
|
1853
|
-
r.endMs,
|
|
1854
|
-
c,
|
|
1855
|
-
l,
|
|
1856
|
-
s,
|
|
1857
|
-
i
|
|
1858
|
-
]);
|
|
1859
|
-
if (!y) return null;
|
|
1860
|
-
let { barLeft: b, barWidth: x, wrapperTop: S, clippedRange: C, itemStartMs: w, itemEndMs: T } = y, ee = w + (T - w) * _, E = Math.min(C.endMs, Math.max(C.startMs, ee)), D = s.toWidth(C.startMs, E), O = `${Math.max(0, Math.min(1, D / x)) * 100}%`, k = Math.max(0, u - b), A = Vt(r.label, a("gantt.emptyGroup")), j = N(d, r.groupKey);
|
|
1861
|
-
return /* @__PURE__ */ R(n, {
|
|
1862
|
-
content: v,
|
|
1863
|
-
placement: "bottom-start",
|
|
1864
|
-
showArrow: !1,
|
|
1865
|
-
hoverDelay: 300,
|
|
1866
|
-
moveToFloatingKeepOpen: !1,
|
|
1867
|
-
widthMode: "content",
|
|
1868
|
-
offset: 5,
|
|
1869
|
-
virtualReference: p,
|
|
1870
|
-
onVisibleChange: g,
|
|
1871
|
-
style: Bt,
|
|
1872
|
-
children: /* @__PURE__ */ z("div", {
|
|
1873
|
-
className: $.root,
|
|
1874
|
-
"data-testid": "gantt-summary-bar",
|
|
1875
|
-
style: {
|
|
1876
|
-
left: b,
|
|
1877
|
-
top: S,
|
|
1878
|
-
width: x
|
|
1879
|
-
},
|
|
1880
|
-
onClick: (e) => f?.(e, r),
|
|
1881
|
-
onMouseMove: m,
|
|
1882
|
-
onMouseLeave: h,
|
|
1883
|
-
children: [/* @__PURE__ */ z("div", {
|
|
1884
|
-
className: $.label,
|
|
1885
|
-
"data-testid": "gantt-summary-bar-label",
|
|
1886
|
-
style: {
|
|
1887
|
-
maxWidth: k,
|
|
1888
|
-
overflow: "hidden"
|
|
1889
|
-
},
|
|
1890
|
-
children: [/* @__PURE__ */ R(e, {
|
|
1891
|
-
name: "xiangxiazhankai1",
|
|
1892
|
-
size: 16,
|
|
1893
|
-
className: Y($.arrow, { [$.isCollapsed]: j })
|
|
1894
|
-
}), /* @__PURE__ */ R("span", {
|
|
1895
|
-
className: $.labelText,
|
|
1896
|
-
children: A
|
|
1897
|
-
})]
|
|
1898
|
-
}), /* @__PURE__ */ R("div", {
|
|
1899
|
-
className: $.track,
|
|
1900
|
-
children: /* @__PURE__ */ R("div", {
|
|
1901
|
-
className: $.progress,
|
|
1902
|
-
"data-testid": "gantt-summary-bar-progress",
|
|
1903
|
-
style: { width: O }
|
|
1904
|
-
})
|
|
1905
|
-
})]
|
|
1906
|
-
})
|
|
1907
|
-
});
|
|
1908
|
-
};
|
|
1909
|
-
function Ut(e, t) {
|
|
1910
|
-
return e.barTop === t.barTop && e.item === t.item;
|
|
1911
|
-
}
|
|
1912
|
-
var Wt = B.memo(Ht, Ut), Gt = B.memo(({ indicators: n = [], onJump: r }) => {
|
|
1913
|
-
let { t: i } = t();
|
|
1914
|
-
if (!Array.isArray(n) || n.length === 0) return null;
|
|
1915
|
-
let a = (e, t) => {
|
|
1916
|
-
e.preventDefault(), e.stopPropagation(), r?.({
|
|
1917
|
-
targetMs: t.targetMs,
|
|
1918
|
-
taskId: t.taskId
|
|
1919
|
-
});
|
|
1920
|
-
};
|
|
1921
|
-
return /* @__PURE__ */ R(L, { children: n.map((t) => /* @__PURE__ */ R("div", {
|
|
1922
|
-
className: Z.offscreenRow,
|
|
1923
|
-
style: {
|
|
1924
|
-
top: t.rowTop,
|
|
1925
|
-
height: t.rowHeight
|
|
1926
|
-
},
|
|
1927
|
-
children: /* @__PURE__ */ z("div", {
|
|
1928
|
-
className: Z.offscreenTrack,
|
|
1929
|
-
children: [t.showLeft ? /* @__PURE__ */ R("button", {
|
|
1930
|
-
type: "button",
|
|
1931
|
-
className: Y(Z.offscreenBtn, Z.offscreenBtnLeft),
|
|
1932
|
-
"data-testid": "gantt-offscreen-btn-left",
|
|
1933
|
-
"aria-label": i("gantt.aria.jumpLeft"),
|
|
1934
|
-
onClick: (e) => a(e, t),
|
|
1935
|
-
children: /* @__PURE__ */ R(e, {
|
|
1936
|
-
name: "left",
|
|
1937
|
-
size: 16
|
|
1938
|
-
})
|
|
1939
|
-
}) : null, t.showRight ? /* @__PURE__ */ R("button", {
|
|
1940
|
-
type: "button",
|
|
1941
|
-
className: Y(Z.offscreenBtn, Z.offscreenBtnRight),
|
|
1942
|
-
"data-testid": "gantt-offscreen-btn-right",
|
|
1943
|
-
"aria-label": i("gantt.aria.jumpRight"),
|
|
1944
|
-
onClick: (e) => a(e, t),
|
|
1945
|
-
children: /* @__PURE__ */ R(e, {
|
|
1946
|
-
name: "arrow-right",
|
|
1947
|
-
size: 16
|
|
1948
|
-
})
|
|
1949
|
-
}) : null]
|
|
1950
|
-
})
|
|
1951
|
-
}, t.rowKey)) });
|
|
1952
|
-
}), Kt = ({ left: e, height: t, className: n = "" }) => /* @__PURE__ */ R("div", {
|
|
1953
|
-
className: Y(Z.todayIndicator, n),
|
|
1954
|
-
"data-testid": "gantt-today-indicator-content-line",
|
|
1955
|
-
style: {
|
|
1956
|
-
left: e,
|
|
1957
|
-
height: t
|
|
1958
|
-
},
|
|
1959
|
-
children: /* @__PURE__ */ R("span", { className: Z.todayIndicatorLine })
|
|
1960
|
-
}), qt = H(function({ canvasHeight: e, weekendSegments: t, virtualColumns: n, lowerSegments: r, shouldShowTodayMarker: i, todayLineLeft: a }) {
|
|
1961
|
-
return /* @__PURE__ */ z(L, { children: [
|
|
1962
|
-
t.map((t) => /* @__PURE__ */ R("div", {
|
|
1963
|
-
className: Z.weekendBg,
|
|
1964
|
-
style: {
|
|
1965
|
-
left: t.left,
|
|
1966
|
-
width: t.width,
|
|
1967
|
-
height: e
|
|
1968
|
-
}
|
|
1969
|
-
}, t.id)),
|
|
1970
|
-
n.map((t) => {
|
|
1971
|
-
let n = r[t.index];
|
|
1972
|
-
return n ? /* @__PURE__ */ R("div", {
|
|
1973
|
-
className: Z.colLine,
|
|
1974
|
-
style: {
|
|
1975
|
-
left: n.left,
|
|
1976
|
-
height: e
|
|
1977
|
-
}
|
|
1978
|
-
}, `line-${n.id}`) : null;
|
|
1979
|
-
}),
|
|
1980
|
-
i ? /* @__PURE__ */ R(Kt, {
|
|
1981
|
-
left: a ?? 0,
|
|
1982
|
-
height: e,
|
|
1983
|
-
className: Z.todayIndicatorContentLine
|
|
1984
|
-
}) : null
|
|
1985
|
-
] });
|
|
1986
|
-
}), Jt = ({ virtualRows: e, normalizedItems: t, dragState: n, dragPermissionById: r, timelineStartMs: i, timelineEndMs: a }) => {
|
|
1987
|
-
let o = n?.taskId ?? null;
|
|
1988
|
-
return e.map((e) => {
|
|
1989
|
-
let s = t[e.index];
|
|
1990
|
-
if (!s || s.invalid) return null;
|
|
1991
|
-
let c = o === s.id;
|
|
1992
|
-
if (!c && (s.startMs === null || s.endMs === null || s.startMs >= s.endMs || !Ze({
|
|
1993
|
-
startMs: s.startMs,
|
|
1994
|
-
endMs: s.endMs
|
|
1995
|
-
}, {
|
|
1996
|
-
startMs: i,
|
|
1997
|
-
endMs: a
|
|
1998
|
-
}))) return null;
|
|
1999
|
-
let l = e.start + (e.size - 26) / 2;
|
|
2000
|
-
return s.type === "summary" ? /* @__PURE__ */ R(Wt, {
|
|
2001
|
-
item: s,
|
|
2002
|
-
barTop: l
|
|
2003
|
-
}, `summary-${s.id}`) : /* @__PURE__ */ R(Ft, {
|
|
2004
|
-
item: s,
|
|
2005
|
-
barTop: l,
|
|
2006
|
-
dragTaskId: o,
|
|
2007
|
-
dragPreview: c ? n : null,
|
|
2008
|
-
dragPermission: r[s.id]
|
|
2009
|
-
}, `bar-${s.id}`);
|
|
2010
|
-
});
|
|
2011
|
-
}, Yt = H(function({ virtualRows: e, normalizedItems: t, dragState: n, dragPermissionById: r, handleOffscreenJump: i, hoverBgRef: a }) {
|
|
2012
|
-
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({
|
|
2013
|
-
virtualRows: e,
|
|
2014
|
-
normalizedItems: t,
|
|
2015
|
-
visibleStartMs: c,
|
|
2016
|
-
visibleEndMs: l,
|
|
2017
|
-
enabled: u,
|
|
2018
|
-
excludeTaskId: n?.taskId ?? null
|
|
2019
|
-
});
|
|
2020
|
-
return /* @__PURE__ */ z(L, { children: [
|
|
2021
|
-
e.map((e) => /* @__PURE__ */ R("div", {
|
|
2022
|
-
className: Z.rowLine,
|
|
2023
|
-
"data-testid": "gantt-row-line",
|
|
2024
|
-
style: {
|
|
2025
|
-
top: e.start,
|
|
2026
|
-
height: e.size
|
|
2027
|
-
}
|
|
2028
|
-
}, `row-line-${e.key}`)),
|
|
2029
|
-
/* @__PURE__ */ R("div", {
|
|
2030
|
-
ref: a,
|
|
2031
|
-
className: Z.rowHoverBg,
|
|
2032
|
-
"data-testid": "gantt-row-hover-bg",
|
|
2033
|
-
style: { display: "none" }
|
|
2034
|
-
}),
|
|
2035
|
-
u && Jt({
|
|
2036
|
-
virtualRows: e,
|
|
2037
|
-
normalizedItems: t,
|
|
2038
|
-
dragState: n,
|
|
2039
|
-
dragPermissionById: r,
|
|
2040
|
-
timelineStartMs: o,
|
|
2041
|
-
timelineEndMs: s
|
|
2042
|
-
}),
|
|
2043
|
-
u ? /* @__PURE__ */ R(Gt, {
|
|
2044
|
-
indicators: d,
|
|
2045
|
-
onJump: i
|
|
2046
|
-
}) : null
|
|
2047
|
-
] });
|
|
2048
|
-
}), 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 }) {
|
|
2049
|
-
let _ = Q((e) => e.timelineWidth), { virtualRows: v, canvasHeight: y, isScrolling: b } = vt({
|
|
2050
|
-
items: t,
|
|
2051
|
-
contentRef: e,
|
|
2052
|
-
safeRowHeight: n,
|
|
2053
|
-
viewportHeight: r
|
|
2054
|
-
}), { hoverBgRef: x, handleContentMouseMove: S, handleContentMouseLeave: C } = bt({
|
|
2055
|
-
normalizedItems: t,
|
|
2056
|
-
safeRowHeight: n
|
|
2057
|
-
}), w = K(() => ({
|
|
2058
|
-
width: _,
|
|
2059
|
-
height: y
|
|
2060
|
-
}), [_, y]), T = K(() => ({
|
|
2061
|
-
tooltip: l ?? null,
|
|
2062
|
-
isScrolling: b,
|
|
2063
|
-
collapsedKeys: p,
|
|
2064
|
-
onBarClick: f,
|
|
2065
|
-
onTaskMouseDown: u,
|
|
2066
|
-
onResizeMouseDown: d
|
|
2067
|
-
}), [
|
|
2068
|
-
l,
|
|
2069
|
-
b,
|
|
2070
|
-
p,
|
|
2071
|
-
f,
|
|
2072
|
-
u,
|
|
2073
|
-
d
|
|
2074
|
-
]);
|
|
2075
|
-
return /* @__PURE__ */ z("div", {
|
|
2076
|
-
className: Z.canvas,
|
|
2077
|
-
"data-testid": "gantt-canvas",
|
|
2078
|
-
style: w,
|
|
2079
|
-
onMouseMove: S,
|
|
2080
|
-
onMouseLeave: C,
|
|
2081
|
-
children: [/* @__PURE__ */ R(qt, {
|
|
2082
|
-
canvasHeight: y,
|
|
2083
|
-
weekendSegments: o,
|
|
2084
|
-
virtualColumns: a,
|
|
2085
|
-
lowerSegments: i,
|
|
2086
|
-
shouldShowTodayMarker: g,
|
|
2087
|
-
todayLineLeft: h
|
|
2088
|
-
}), /* @__PURE__ */ R(xt.Provider, {
|
|
2089
|
-
value: T,
|
|
2090
|
-
children: /* @__PURE__ */ R(Yt, {
|
|
2091
|
-
virtualRows: v,
|
|
2092
|
-
normalizedItems: t,
|
|
2093
|
-
dragState: s,
|
|
2094
|
-
dragPermissionById: c,
|
|
2095
|
-
handleOffscreenJump: m,
|
|
2096
|
-
hoverBgRef: x
|
|
2097
|
-
})
|
|
2098
|
-
})]
|
|
2099
|
-
});
|
|
2100
|
-
});
|
|
2101
|
-
//#endregion
|
|
2102
|
-
//#region src/components/Gantt/GanttChart/GanttChart.tsx
|
|
2103
|
-
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 }, _) {
|
|
2104
|
-
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({
|
|
2105
|
-
timeRangeConfig: a,
|
|
2106
|
-
pixelsPerDayConfig: o,
|
|
2107
|
-
viewMode: n,
|
|
2108
|
-
contentRef: x,
|
|
2109
|
-
contentSize: C,
|
|
2110
|
-
headerTrackRef: S,
|
|
2111
|
-
formatMessage: y,
|
|
2112
|
-
isHorizontalScrollbarInteracting: T,
|
|
2113
|
-
isTaskBarInteracting: ee
|
|
2114
|
-
});
|
|
2115
|
-
G(_, () => ({
|
|
2116
|
-
scrollToToday: se,
|
|
2117
|
-
scrollPrev: I,
|
|
2118
|
-
scrollNext: L
|
|
2119
|
-
}), [
|
|
2120
|
-
se,
|
|
2121
|
-
I,
|
|
2122
|
-
L
|
|
2123
|
-
]);
|
|
2124
|
-
let { dragState: B, committedRangeById: V, resetCommittedRanges: H, forceResetAllCommittedRanges: le, handleTaskMouseDown: Y, handleResizeMouseDown: ue, consumeRecentDragResult: fe } = Pe({
|
|
2125
|
-
pixelsPerDay: D,
|
|
2126
|
-
viewMode: n,
|
|
2127
|
-
timelineCoords: N,
|
|
2128
|
-
onTaskTimeChange: s,
|
|
2129
|
-
containerRef: x,
|
|
2130
|
-
onDragInteractionChange: E
|
|
2131
|
-
});
|
|
2132
|
-
W(() => {
|
|
2133
|
-
let t = new Set((e || []).map((e) => String(e?.id ?? ""))), n = w.current, r = !1;
|
|
2134
|
-
if (n) {
|
|
2135
|
-
if (n.size !== t.size) r = !0;
|
|
2136
|
-
else for (let e of n) if (!t.has(e)) {
|
|
2137
|
-
r = !0;
|
|
2138
|
-
break;
|
|
2139
|
-
}
|
|
2140
|
-
}
|
|
2141
|
-
if (w.current = t, r) {
|
|
2142
|
-
le();
|
|
2143
|
-
return;
|
|
2144
|
-
}
|
|
2145
|
-
H();
|
|
2146
|
-
}, [
|
|
2147
|
-
e,
|
|
2148
|
-
H,
|
|
2149
|
-
le
|
|
2150
|
-
]);
|
|
2151
|
-
let { normalizedItems: X } = dt({
|
|
2152
|
-
visibleItems: e,
|
|
2153
|
-
committedRangeById: V,
|
|
2154
|
-
viewMode: n
|
|
2155
|
-
}), pe = K(() => {
|
|
2156
|
-
let e = {};
|
|
2157
|
-
return X.forEach((t) => {
|
|
2158
|
-
e[t.id] = Se(t);
|
|
2159
|
-
}), e;
|
|
2160
|
-
}, [X]), me = U((e, t, n, r) => {
|
|
2161
|
-
let i = pe[t.id];
|
|
2162
|
-
i?.canMove && Y(e, {
|
|
2163
|
-
...t,
|
|
2164
|
-
dragPermission: i
|
|
2165
|
-
}, n, r);
|
|
2166
|
-
}, [pe, Y]), he = U((e, t, n, r, i) => {
|
|
2167
|
-
let a = pe[t.id];
|
|
2168
|
-
(r === "start" ? a?.canResizeStart : a?.canResizeEnd) && ue(e, {
|
|
2169
|
-
...t,
|
|
2170
|
-
dragPermission: a
|
|
2171
|
-
}, n, r, i);
|
|
2172
|
-
}, [pe, ue]);
|
|
2173
|
-
W(() => {
|
|
2174
|
-
if (!f || !x.current) return;
|
|
2175
|
-
let e = x.current;
|
|
2176
|
-
return f.registerTimelineScroller({ setScrollTop: (t) => {
|
|
2177
|
-
e.scrollTop = t;
|
|
2178
|
-
} });
|
|
2179
|
-
}, [f]);
|
|
2180
|
-
let ge = C?.height || 0, { virtualColumns: _e, weekendSegments: ve } = ze({
|
|
2181
|
-
lowerSegments: ne,
|
|
2182
|
-
pixelsPerDay: D,
|
|
2183
|
-
scrollLeft: k,
|
|
2184
|
-
viewportWidth: O,
|
|
2185
|
-
showWeekendHighlight: p,
|
|
2186
|
-
timelineStartMs: A,
|
|
2187
|
-
timelineWidth: re,
|
|
2188
|
-
viewMode: n
|
|
2189
|
-
}), ye = pt(m, P, re, ie, {
|
|
2190
|
-
startMs: A,
|
|
2191
|
-
endMs: j
|
|
2192
|
-
}), be = U((e, t) => {
|
|
2193
|
-
if (!(e.target instanceof Element && e.target.closest(`.${Z.barResizeHandle}`)) && !fe()) {
|
|
2194
|
-
if (t?.type === "summary") {
|
|
2195
|
-
let e = t.groupKey;
|
|
2196
|
-
if (!e || !g) return;
|
|
2197
|
-
g(String(e));
|
|
2198
|
-
return;
|
|
2199
|
-
}
|
|
2200
|
-
l && l(t, t.rowIndex, e);
|
|
2201
|
-
}
|
|
2202
|
-
}, [
|
|
2203
|
-
fe,
|
|
2204
|
-
l,
|
|
2205
|
-
g
|
|
2206
|
-
]), xe = K(() => ({
|
|
2207
|
-
viewMode: n,
|
|
2208
|
-
pixelsPerDay: D,
|
|
2209
|
-
timelineStartMs: A,
|
|
2210
|
-
timelineEndMs: j,
|
|
2211
|
-
visibleStartMs: M,
|
|
2212
|
-
visibleEndMs: te,
|
|
2213
|
-
timelineCoords: N,
|
|
2214
|
-
scrollLeft: k,
|
|
2215
|
-
viewportWidth: O,
|
|
2216
|
-
timelineWidth: re,
|
|
2217
|
-
isInitialLayoutReady: ae
|
|
2218
|
-
}), [
|
|
2219
|
-
n,
|
|
2220
|
-
D,
|
|
2221
|
-
A,
|
|
2222
|
-
j,
|
|
2223
|
-
M,
|
|
2224
|
-
te,
|
|
2225
|
-
N,
|
|
2226
|
-
k,
|
|
2227
|
-
O,
|
|
2228
|
-
re,
|
|
2229
|
-
ae
|
|
2230
|
-
]);
|
|
2231
|
-
return /* @__PURE__ */ R(Ct.Provider, {
|
|
2232
|
-
value: xe,
|
|
2233
|
-
children: /* @__PURE__ */ z("div", {
|
|
2234
|
-
className: Z.root,
|
|
2235
|
-
"data-testid": "gantt-chart",
|
|
2236
|
-
style: { visibility: ae ? "visible" : "hidden" },
|
|
2237
|
-
children: [/* @__PURE__ */ R(_t, {
|
|
2238
|
-
timelineWidth: re,
|
|
2239
|
-
viewportWidth: O,
|
|
2240
|
-
scrollLeft: k,
|
|
2241
|
-
trackRef: S,
|
|
2242
|
-
virtualColumns: _e,
|
|
2243
|
-
lowerSegments: ne,
|
|
2244
|
-
todayLineLeft: P,
|
|
2245
|
-
todayCenterMs: ie,
|
|
2246
|
-
showTodayLine: m,
|
|
2247
|
-
viewMode: n,
|
|
2248
|
-
availableModes: r,
|
|
2249
|
-
formatMessage: y,
|
|
2250
|
-
onViewModeChange: i,
|
|
2251
|
-
onTodayClick: se,
|
|
2252
|
-
onScrollPrev: I,
|
|
2253
|
-
onScrollNext: L
|
|
2254
|
-
}), /* @__PURE__ */ R("div", {
|
|
2255
|
-
ref: b,
|
|
2256
|
-
className: Z.timelineHost,
|
|
2257
|
-
children: /* @__PURE__ */ R("div", {
|
|
2258
|
-
ref: x,
|
|
2259
|
-
className: Z.timelineContent,
|
|
2260
|
-
"data-testid": "gantt-timeline-content",
|
|
2261
|
-
role: "region",
|
|
2262
|
-
"aria-label": v("gantt.aria.timeline"),
|
|
2263
|
-
onScroll: (e) => {
|
|
2264
|
-
F(e), f && f.sync("timeline", e.currentTarget.scrollTop);
|
|
2265
|
-
},
|
|
2266
|
-
children: /* @__PURE__ */ R(Xt, {
|
|
2267
|
-
contentRef: x,
|
|
2268
|
-
normalizedItems: X,
|
|
2269
|
-
safeRowHeight: 34,
|
|
2270
|
-
viewportHeight: ge,
|
|
2271
|
-
lowerSegments: ne,
|
|
2272
|
-
virtualColumns: _e,
|
|
2273
|
-
weekendSegments: ve,
|
|
2274
|
-
dragState: B,
|
|
2275
|
-
dragPermissionById: pe,
|
|
2276
|
-
tooltip: d,
|
|
2277
|
-
handleTaskMouseDown: me,
|
|
2278
|
-
handleResizeMouseDown: he,
|
|
2279
|
-
handleBarClick: be,
|
|
2280
|
-
collapsedKeys: h,
|
|
2281
|
-
handleOffscreenJump: ce,
|
|
2282
|
-
todayLineLeft: P,
|
|
2283
|
-
shouldShowTodayMarker: ye
|
|
2284
|
-
})
|
|
2285
|
-
})
|
|
2286
|
-
})]
|
|
2287
|
-
})
|
|
2288
|
-
});
|
|
2289
|
-
}
|
|
2290
|
-
var Qt = V(Zt);
|
|
2291
|
-
//#endregion
|
|
2292
|
-
export { Qt as t };
|