@jaeungkim/gantt-chart 0.3.1 → 1.0.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/LICENSE +21 -0
- package/README.md +222 -124
- package/dist/Gantt.d.ts +5 -0
- package/dist/bars/components/GanttBar.d.ts +20 -0
- package/dist/bars/components/GanttBarsLayer.d.ts +24 -0
- package/dist/bars/components/GanttDragGuides.d.ts +1 -0
- package/dist/bars/hooks/useGanttBarDrag.d.ts +16 -0
- package/dist/bars/hooks/useGanttDrawCreate.d.ts +25 -0
- package/dist/bars/hooks/useGanttProgressDrag.d.ts +11 -0
- package/dist/core/calendar.d.ts +27 -0
- package/dist/core/dates.d.ts +16 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/reorder.d.ts +55 -0
- package/dist/core/tree.d.ts +34 -0
- package/dist/core/types.d.ts +43 -0
- package/dist/dependencies/components/GanttDependencyArrows.d.ts +13 -0
- package/dist/dependencies/hooks/useGanttLinkDrag.d.ts +20 -0
- package/dist/dependencies/utils/arrowPath.d.ts +20 -0
- package/dist/dependencies/utils/link.d.ts +17 -0
- package/dist/detail/components/GanttDetailPanel.d.ts +21 -0
- package/dist/detail/hooks/useGanttDetail.d.ts +42 -0
- package/dist/detail/utils/edit.d.ts +21 -0
- package/dist/gantt-chart.css +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -51
- package/dist/index.js +4749 -0
- package/dist/interaction/hooks/useGanttInteraction.d.ts +2 -0
- package/dist/interaction/hooks/useGanttKeyboardNav.d.ts +33 -0
- package/dist/interaction/hooks/useGanttSelection.d.ts +12 -0
- package/dist/interaction/utils/a11y.d.ts +84 -0
- package/dist/props.d.ts +121 -0
- package/dist/rows/components/GanttRowsLayer.d.ts +13 -0
- package/dist/rows/hooks/useGanttCollapse.d.ts +18 -0
- package/dist/rows/hooks/useGanttRowModel.d.ts +19 -0
- package/dist/rows/utils/rows.d.ts +21 -0
- package/dist/shared/constants.d.ts +24 -0
- package/dist/shared/context.d.ts +4 -0
- package/dist/shared/hooks/useLatestRef.d.ts +2 -0
- package/dist/shared/hooks/useResolvedTheme.d.ts +8 -0
- package/dist/shared/store.d.ts +81 -0
- package/dist/shared/task.d.ts +55 -0
- package/dist/shared/types.d.ts +115 -0
- package/dist/shared/utils/holidays.d.ts +12 -0
- package/dist/shared/utils/i18n.d.ts +5 -0
- package/dist/shared/utils/pointerGesture.d.ts +11 -0
- package/dist/shared/virtual/axis.d.ts +13 -0
- package/dist/shared/virtual/useVirtualWindow.d.ts +16 -0
- package/dist/shared/virtual/window.d.ts +30 -0
- package/dist/task-list/components/GanttGridSplitter.d.ts +6 -0
- package/dist/task-list/components/GanttTaskAddRow.d.ts +7 -0
- package/dist/task-list/components/GanttTaskGrid.d.ts +24 -0
- package/dist/task-list/hooks/useGanttRowDrag.d.ts +17 -0
- package/dist/task-list/hooks/useGanttTaskListPane.d.ts +11 -0
- package/dist/task-list/hooks/useGanttTaskMove.d.ts +16 -0
- package/dist/timeline/components/GanttChartHeader.d.ts +10 -0
- package/dist/timeline/components/GanttHolidayLabels.d.ts +6 -0
- package/dist/timeline/components/GanttNonWorkingLayer.d.ts +6 -0
- package/dist/timeline/components/GanttTodayLine.d.ts +6 -0
- package/dist/timeline/hooks/useGanttScrollApi.d.ts +62 -0
- package/dist/timeline/hooks/useGanttViewport.d.ts +47 -0
- package/dist/timeline/hooks/useGanttVirtualization.d.ts +28 -0
- package/dist/timeline/utils/geometry.d.ts +52 -0
- package/dist/timeline/utils/header.d.ts +8 -0
- package/dist/timeline/utils/transform.d.ts +4 -0
- package/dist/timeline/utils/viewport.d.ts +31 -0
- package/dist/useGanttSelectors.d.ts +11 -0
- package/package.json +53 -38
- package/dist/index.cjs.js +0 -4
- package/dist/index.es.js +0 -2394
- package/dist/readmeImg.png +0 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,4749 @@
|
|
|
1
|
+
import { jsx as P, jsxs as J, Fragment as we } from "react/jsx-runtime";
|
|
2
|
+
import Ft, { createContext as Vn, useContext as Zn, useMemo as j, useCallback as z, useEffect as it, useId as gn, useRef as Z, useLayoutEffect as Rt, useState as ut, Fragment as Jn, useSyncExternalStore as Qn, forwardRef as tr, useImperativeHandle as er } from "react";
|
|
3
|
+
const Fe = (t) => {
|
|
4
|
+
let n;
|
|
5
|
+
const r = /* @__PURE__ */ new Set(), o = (u, l) => {
|
|
6
|
+
const f = typeof u == "function" ? u(n) : u;
|
|
7
|
+
if (!Object.is(f, n)) {
|
|
8
|
+
const h = n;
|
|
9
|
+
n = l ?? (typeof f != "object" || f === null) ? f : Object.assign({}, n, f), r.forEach((w) => w(n, h));
|
|
10
|
+
}
|
|
11
|
+
}, s = () => n, i = { setState: o, getState: s, getInitialState: () => c, subscribe: (u) => (r.add(u), () => r.delete(u)) }, c = n = t(o, s, i);
|
|
12
|
+
return i;
|
|
13
|
+
}, nr = ((t) => t ? Fe(t) : Fe), rr = (t) => t;
|
|
14
|
+
function or(t, n = rr) {
|
|
15
|
+
const r = Ft.useSyncExternalStore(
|
|
16
|
+
t.subscribe,
|
|
17
|
+
Ft.useCallback(() => n(t.getState()), [t, n]),
|
|
18
|
+
Ft.useCallback(() => n(t.getInitialState()), [t, n])
|
|
19
|
+
);
|
|
20
|
+
return Ft.useDebugValue(r), r;
|
|
21
|
+
}
|
|
22
|
+
const $n = Vn(null);
|
|
23
|
+
function yt() {
|
|
24
|
+
const t = Zn($n);
|
|
25
|
+
if (!t)
|
|
26
|
+
throw new Error(
|
|
27
|
+
"Gantt store is missing. Render this component inside <ReactGanttChart>."
|
|
28
|
+
);
|
|
29
|
+
return t;
|
|
30
|
+
}
|
|
31
|
+
function Q(t) {
|
|
32
|
+
return or(yt(), t);
|
|
33
|
+
}
|
|
34
|
+
function sr(t) {
|
|
35
|
+
const n = [];
|
|
36
|
+
for (const r of t) {
|
|
37
|
+
const o = n[n.length - 1];
|
|
38
|
+
o && o.label === r.label ? o.widthPx += r.widthPx : n.push({ ...r });
|
|
39
|
+
}
|
|
40
|
+
return n;
|
|
41
|
+
}
|
|
42
|
+
function Dn(t) {
|
|
43
|
+
const n = [0];
|
|
44
|
+
let r = 0;
|
|
45
|
+
for (const o of t)
|
|
46
|
+
r += o.widthPx, n.push(r);
|
|
47
|
+
return n;
|
|
48
|
+
}
|
|
49
|
+
function se(t, n) {
|
|
50
|
+
if (t.length < 2) return null;
|
|
51
|
+
let r = 0, o = t.length - 2;
|
|
52
|
+
for (; r < o; ) {
|
|
53
|
+
const s = Math.ceil((r + o) / 2);
|
|
54
|
+
t[s] <= n ? r = s : o = s - 1;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
index: r,
|
|
58
|
+
left: t[r],
|
|
59
|
+
width: t[r + 1] - t[r]
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function wn(t) {
|
|
63
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
64
|
+
}
|
|
65
|
+
var ee = { exports: {} }, ar = ee.exports, Ue;
|
|
66
|
+
function ir() {
|
|
67
|
+
return Ue || (Ue = 1, (function(t, n) {
|
|
68
|
+
(function(r, o) {
|
|
69
|
+
t.exports = o();
|
|
70
|
+
})(ar, (function() {
|
|
71
|
+
var r = 1e3, o = 6e4, s = 36e5, e = "millisecond", a = "second", i = "minute", c = "hour", u = "day", l = "week", f = "month", h = "quarter", w = "year", p = "date", d = "Invalid Date", m = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, D = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, b = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(T) {
|
|
72
|
+
var M = ["th", "st", "nd", "rd"], I = T % 100;
|
|
73
|
+
return "[" + T + (M[(I - 20) % 10] || M[I] || M[0]) + "]";
|
|
74
|
+
} }, S = function(T, M, I) {
|
|
75
|
+
var y = String(T);
|
|
76
|
+
return !y || y.length >= M ? T : "" + Array(M + 1 - y.length).join(I) + T;
|
|
77
|
+
}, L = { s: S, z: function(T) {
|
|
78
|
+
var M = -T.utcOffset(), I = Math.abs(M), y = Math.floor(I / 60), $ = I % 60;
|
|
79
|
+
return (M <= 0 ? "+" : "-") + S(y, 2, "0") + ":" + S($, 2, "0");
|
|
80
|
+
}, m: function T(M, I) {
|
|
81
|
+
if (M.date() < I.date()) return -T(I, M);
|
|
82
|
+
var y = 12 * (I.year() - M.year()) + (I.month() - M.month()), $ = M.clone().add(y, f), k = I - $ < 0, E = M.clone().add(y + (k ? -1 : 1), f);
|
|
83
|
+
return +(-(y + (I - $) / (k ? $ - E : E - $)) || 0);
|
|
84
|
+
}, a: function(T) {
|
|
85
|
+
return T < 0 ? Math.ceil(T) || 0 : Math.floor(T);
|
|
86
|
+
}, p: function(T) {
|
|
87
|
+
return { M: f, y: w, w: l, d: u, D: p, h: c, m: i, s: a, ms: e, Q: h }[T] || String(T || "").toLowerCase().replace(/s$/, "");
|
|
88
|
+
}, u: function(T) {
|
|
89
|
+
return T === void 0;
|
|
90
|
+
} }, N = "en", x = {};
|
|
91
|
+
x[N] = b;
|
|
92
|
+
var _ = "$isDayjsObject", A = function(T) {
|
|
93
|
+
return T instanceof F || !(!T || !T[_]);
|
|
94
|
+
}, v = function T(M, I, y) {
|
|
95
|
+
var $;
|
|
96
|
+
if (!M) return N;
|
|
97
|
+
if (typeof M == "string") {
|
|
98
|
+
var k = M.toLowerCase();
|
|
99
|
+
x[k] && ($ = k), I && (x[k] = I, $ = k);
|
|
100
|
+
var E = M.split("-");
|
|
101
|
+
if (!$ && E.length > 1) return T(E[0]);
|
|
102
|
+
} else {
|
|
103
|
+
var C = M.name;
|
|
104
|
+
x[C] = M, $ = C;
|
|
105
|
+
}
|
|
106
|
+
return !y && $ && (N = $), $ || !y && N;
|
|
107
|
+
}, g = function(T, M) {
|
|
108
|
+
if (A(T)) return T.clone();
|
|
109
|
+
var I = typeof M == "object" ? M : {};
|
|
110
|
+
return I.date = T, I.args = arguments, new F(I);
|
|
111
|
+
}, R = L;
|
|
112
|
+
R.l = v, R.i = A, R.w = function(T, M) {
|
|
113
|
+
return g(T, { locale: M.$L, utc: M.$u, x: M.$x, $offset: M.$offset });
|
|
114
|
+
};
|
|
115
|
+
var F = (function() {
|
|
116
|
+
function T(I) {
|
|
117
|
+
this.$L = v(I.locale, null, !0), this.parse(I), this.$x = this.$x || I.x || {}, this[_] = !0;
|
|
118
|
+
}
|
|
119
|
+
var M = T.prototype;
|
|
120
|
+
return M.parse = function(I) {
|
|
121
|
+
this.$d = (function(y) {
|
|
122
|
+
var $ = y.date, k = y.utc;
|
|
123
|
+
if ($ === null) return /* @__PURE__ */ new Date(NaN);
|
|
124
|
+
if (R.u($)) return /* @__PURE__ */ new Date();
|
|
125
|
+
if ($ instanceof Date) return new Date($);
|
|
126
|
+
if (typeof $ == "string" && !/Z$/i.test($)) {
|
|
127
|
+
var E = $.match(m);
|
|
128
|
+
if (E) {
|
|
129
|
+
var C = E[2] - 1 || 0, X = (E[7] || "0").substring(0, 3);
|
|
130
|
+
return k ? new Date(Date.UTC(E[1], C, E[3] || 1, E[4] || 0, E[5] || 0, E[6] || 0, X)) : new Date(E[1], C, E[3] || 1, E[4] || 0, E[5] || 0, E[6] || 0, X);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return new Date($);
|
|
134
|
+
})(I), this.init();
|
|
135
|
+
}, M.init = function() {
|
|
136
|
+
var I = this.$d;
|
|
137
|
+
this.$y = I.getFullYear(), this.$M = I.getMonth(), this.$D = I.getDate(), this.$W = I.getDay(), this.$H = I.getHours(), this.$m = I.getMinutes(), this.$s = I.getSeconds(), this.$ms = I.getMilliseconds();
|
|
138
|
+
}, M.$utils = function() {
|
|
139
|
+
return R;
|
|
140
|
+
}, M.isValid = function() {
|
|
141
|
+
return this.$d.toString() !== d;
|
|
142
|
+
}, M.isSame = function(I, y) {
|
|
143
|
+
var $ = g(I);
|
|
144
|
+
return this.startOf(y) <= $ && $ <= this.endOf(y);
|
|
145
|
+
}, M.isAfter = function(I, y) {
|
|
146
|
+
return g(I) < this.startOf(y);
|
|
147
|
+
}, M.isBefore = function(I, y) {
|
|
148
|
+
return this.endOf(y) < g(I);
|
|
149
|
+
}, M.$g = function(I, y, $) {
|
|
150
|
+
return R.u(I) ? this[y] : this.set($, I);
|
|
151
|
+
}, M.unix = function() {
|
|
152
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
153
|
+
}, M.valueOf = function() {
|
|
154
|
+
return this.$d.getTime();
|
|
155
|
+
}, M.startOf = function(I, y) {
|
|
156
|
+
var $ = this, k = !!R.u(y) || y, E = R.p(I), C = function(O, G) {
|
|
157
|
+
var B = R.w($.$u ? Date.UTC($.$y, G, O) : new Date($.$y, G, O), $);
|
|
158
|
+
return k ? B : B.endOf(u);
|
|
159
|
+
}, X = function(O, G) {
|
|
160
|
+
return R.w($.toDate()[O].apply($.toDate("s"), (k ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(G)), $);
|
|
161
|
+
}, q = this.$W, tt = this.$M, rt = this.$D, wt = "set" + (this.$u ? "UTC" : "");
|
|
162
|
+
switch (E) {
|
|
163
|
+
case w:
|
|
164
|
+
return k ? C(1, 0) : C(31, 11);
|
|
165
|
+
case f:
|
|
166
|
+
return k ? C(1, tt) : C(0, tt + 1);
|
|
167
|
+
case l:
|
|
168
|
+
var ot = this.$locale().weekStart || 0, gt = (q < ot ? q + 7 : q) - ot;
|
|
169
|
+
return C(k ? rt - gt : rt + (6 - gt), tt);
|
|
170
|
+
case u:
|
|
171
|
+
case p:
|
|
172
|
+
return X(wt + "Hours", 0);
|
|
173
|
+
case c:
|
|
174
|
+
return X(wt + "Minutes", 1);
|
|
175
|
+
case i:
|
|
176
|
+
return X(wt + "Seconds", 2);
|
|
177
|
+
case a:
|
|
178
|
+
return X(wt + "Milliseconds", 3);
|
|
179
|
+
default:
|
|
180
|
+
return this.clone();
|
|
181
|
+
}
|
|
182
|
+
}, M.endOf = function(I) {
|
|
183
|
+
return this.startOf(I, !1);
|
|
184
|
+
}, M.$set = function(I, y) {
|
|
185
|
+
var $, k = R.p(I), E = "set" + (this.$u ? "UTC" : ""), C = ($ = {}, $[u] = E + "Date", $[p] = E + "Date", $[f] = E + "Month", $[w] = E + "FullYear", $[c] = E + "Hours", $[i] = E + "Minutes", $[a] = E + "Seconds", $[e] = E + "Milliseconds", $)[k], X = k === u ? this.$D + (y - this.$W) : y;
|
|
186
|
+
if (k === f || k === w) {
|
|
187
|
+
var q = this.clone().set(p, 1);
|
|
188
|
+
q.$d[C](X), q.init(), this.$d = q.set(p, Math.min(this.$D, q.daysInMonth())).$d;
|
|
189
|
+
} else C && this.$d[C](X);
|
|
190
|
+
return this.init(), this;
|
|
191
|
+
}, M.set = function(I, y) {
|
|
192
|
+
return this.clone().$set(I, y);
|
|
193
|
+
}, M.get = function(I) {
|
|
194
|
+
return this[R.p(I)]();
|
|
195
|
+
}, M.add = function(I, y) {
|
|
196
|
+
var $, k = this;
|
|
197
|
+
I = Number(I);
|
|
198
|
+
var E = R.p(y), C = function(tt) {
|
|
199
|
+
var rt = g(k);
|
|
200
|
+
return R.w(rt.date(rt.date() + Math.round(tt * I)), k);
|
|
201
|
+
};
|
|
202
|
+
if (E === f) return this.set(f, this.$M + I);
|
|
203
|
+
if (E === w) return this.set(w, this.$y + I);
|
|
204
|
+
if (E === u) return C(1);
|
|
205
|
+
if (E === l) return C(7);
|
|
206
|
+
var X = ($ = {}, $[i] = o, $[c] = s, $[a] = r, $)[E] || 1, q = this.$d.getTime() + I * X;
|
|
207
|
+
return R.w(q, this);
|
|
208
|
+
}, M.subtract = function(I, y) {
|
|
209
|
+
return this.add(-1 * I, y);
|
|
210
|
+
}, M.format = function(I) {
|
|
211
|
+
var y = this, $ = this.$locale();
|
|
212
|
+
if (!this.isValid()) return $.invalidDate || d;
|
|
213
|
+
var k = I || "YYYY-MM-DDTHH:mm:ssZ", E = R.z(this), C = this.$H, X = this.$m, q = this.$M, tt = $.weekdays, rt = $.months, wt = $.meridiem, ot = function(G, B, ct, st) {
|
|
214
|
+
return G && (G[B] || G(y, k)) || ct[B].slice(0, st);
|
|
215
|
+
}, gt = function(G) {
|
|
216
|
+
return R.s(C % 12 || 12, G, "0");
|
|
217
|
+
}, O = wt || function(G, B, ct) {
|
|
218
|
+
var st = G < 12 ? "AM" : "PM";
|
|
219
|
+
return ct ? st.toLowerCase() : st;
|
|
220
|
+
};
|
|
221
|
+
return k.replace(D, (function(G, B) {
|
|
222
|
+
return B || (function(ct) {
|
|
223
|
+
switch (ct) {
|
|
224
|
+
case "YY":
|
|
225
|
+
return String(y.$y).slice(-2);
|
|
226
|
+
case "YYYY":
|
|
227
|
+
return R.s(y.$y, 4, "0");
|
|
228
|
+
case "M":
|
|
229
|
+
return q + 1;
|
|
230
|
+
case "MM":
|
|
231
|
+
return R.s(q + 1, 2, "0");
|
|
232
|
+
case "MMM":
|
|
233
|
+
return ot($.monthsShort, q, rt, 3);
|
|
234
|
+
case "MMMM":
|
|
235
|
+
return ot(rt, q);
|
|
236
|
+
case "D":
|
|
237
|
+
return y.$D;
|
|
238
|
+
case "DD":
|
|
239
|
+
return R.s(y.$D, 2, "0");
|
|
240
|
+
case "d":
|
|
241
|
+
return String(y.$W);
|
|
242
|
+
case "dd":
|
|
243
|
+
return ot($.weekdaysMin, y.$W, tt, 2);
|
|
244
|
+
case "ddd":
|
|
245
|
+
return ot($.weekdaysShort, y.$W, tt, 3);
|
|
246
|
+
case "dddd":
|
|
247
|
+
return tt[y.$W];
|
|
248
|
+
case "H":
|
|
249
|
+
return String(C);
|
|
250
|
+
case "HH":
|
|
251
|
+
return R.s(C, 2, "0");
|
|
252
|
+
case "h":
|
|
253
|
+
return gt(1);
|
|
254
|
+
case "hh":
|
|
255
|
+
return gt(2);
|
|
256
|
+
case "a":
|
|
257
|
+
return O(C, X, !0);
|
|
258
|
+
case "A":
|
|
259
|
+
return O(C, X, !1);
|
|
260
|
+
case "m":
|
|
261
|
+
return String(X);
|
|
262
|
+
case "mm":
|
|
263
|
+
return R.s(X, 2, "0");
|
|
264
|
+
case "s":
|
|
265
|
+
return String(y.$s);
|
|
266
|
+
case "ss":
|
|
267
|
+
return R.s(y.$s, 2, "0");
|
|
268
|
+
case "SSS":
|
|
269
|
+
return R.s(y.$ms, 3, "0");
|
|
270
|
+
case "Z":
|
|
271
|
+
return E;
|
|
272
|
+
}
|
|
273
|
+
return null;
|
|
274
|
+
})(G) || E.replace(":", "");
|
|
275
|
+
}));
|
|
276
|
+
}, M.utcOffset = function() {
|
|
277
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
278
|
+
}, M.diff = function(I, y, $) {
|
|
279
|
+
var k, E = this, C = R.p(y), X = g(I), q = (X.utcOffset() - this.utcOffset()) * o, tt = this - X, rt = function() {
|
|
280
|
+
return R.m(E, X);
|
|
281
|
+
};
|
|
282
|
+
switch (C) {
|
|
283
|
+
case w:
|
|
284
|
+
k = rt() / 12;
|
|
285
|
+
break;
|
|
286
|
+
case f:
|
|
287
|
+
k = rt();
|
|
288
|
+
break;
|
|
289
|
+
case h:
|
|
290
|
+
k = rt() / 3;
|
|
291
|
+
break;
|
|
292
|
+
case l:
|
|
293
|
+
k = (tt - q) / 6048e5;
|
|
294
|
+
break;
|
|
295
|
+
case u:
|
|
296
|
+
k = (tt - q) / 864e5;
|
|
297
|
+
break;
|
|
298
|
+
case c:
|
|
299
|
+
k = tt / s;
|
|
300
|
+
break;
|
|
301
|
+
case i:
|
|
302
|
+
k = tt / o;
|
|
303
|
+
break;
|
|
304
|
+
case a:
|
|
305
|
+
k = tt / r;
|
|
306
|
+
break;
|
|
307
|
+
default:
|
|
308
|
+
k = tt;
|
|
309
|
+
}
|
|
310
|
+
return $ ? k : R.a(k);
|
|
311
|
+
}, M.daysInMonth = function() {
|
|
312
|
+
return this.endOf(f).$D;
|
|
313
|
+
}, M.$locale = function() {
|
|
314
|
+
return x[this.$L];
|
|
315
|
+
}, M.locale = function(I, y) {
|
|
316
|
+
if (!I) return this.$L;
|
|
317
|
+
var $ = this.clone(), k = v(I, y, !0);
|
|
318
|
+
return k && ($.$L = k), $;
|
|
319
|
+
}, M.clone = function() {
|
|
320
|
+
return R.w(this.$d, this);
|
|
321
|
+
}, M.toDate = function() {
|
|
322
|
+
return new Date(this.valueOf());
|
|
323
|
+
}, M.toJSON = function() {
|
|
324
|
+
return this.isValid() ? this.toISOString() : null;
|
|
325
|
+
}, M.toISOString = function() {
|
|
326
|
+
return this.$d.toISOString();
|
|
327
|
+
}, M.toString = function() {
|
|
328
|
+
return this.$d.toUTCString();
|
|
329
|
+
}, T;
|
|
330
|
+
})(), U = F.prototype;
|
|
331
|
+
return g.prototype = U, [["$ms", e], ["$s", a], ["$m", i], ["$H", c], ["$W", u], ["$M", f], ["$y", w], ["$D", p]].forEach((function(T) {
|
|
332
|
+
U[T[1]] = function(M) {
|
|
333
|
+
return this.$g(M, T[0], T[1]);
|
|
334
|
+
};
|
|
335
|
+
})), g.extend = function(T, M) {
|
|
336
|
+
return T.$i || (T(M, F, g), T.$i = !0), g;
|
|
337
|
+
}, g.locale = v, g.isDayjs = A, g.unix = function(T) {
|
|
338
|
+
return g(1e3 * T);
|
|
339
|
+
}, g.en = x[N], g.Ls = x, g.p = {}, g;
|
|
340
|
+
}));
|
|
341
|
+
})(ee)), ee.exports;
|
|
342
|
+
}
|
|
343
|
+
var cr = ir();
|
|
344
|
+
const ae = /* @__PURE__ */ wn(cr);
|
|
345
|
+
var ne = { exports: {} }, lr = ne.exports, We;
|
|
346
|
+
function ur() {
|
|
347
|
+
return We || (We = 1, (function(t, n) {
|
|
348
|
+
(function(r, o) {
|
|
349
|
+
t.exports = o();
|
|
350
|
+
})(lr, (function() {
|
|
351
|
+
var r = "minute", o = /[+-]\d\d(?::?\d\d)?/g, s = /([+-]|\d\d)/g;
|
|
352
|
+
return function(e, a, i) {
|
|
353
|
+
var c = a.prototype;
|
|
354
|
+
i.utc = function(d) {
|
|
355
|
+
var m = { date: d, utc: !0, args: arguments };
|
|
356
|
+
return new a(m);
|
|
357
|
+
}, c.utc = function(d) {
|
|
358
|
+
var m = i(this.toDate(), { locale: this.$L, utc: !0 });
|
|
359
|
+
return d ? m.add(this.utcOffset(), r) : m;
|
|
360
|
+
}, c.local = function() {
|
|
361
|
+
return i(this.toDate(), { locale: this.$L, utc: !1 });
|
|
362
|
+
};
|
|
363
|
+
var u = c.parse;
|
|
364
|
+
c.parse = function(d) {
|
|
365
|
+
d.utc && (this.$u = !0), this.$utils().u(d.$offset) || (this.$offset = d.$offset), u.call(this, d);
|
|
366
|
+
};
|
|
367
|
+
var l = c.init;
|
|
368
|
+
c.init = function() {
|
|
369
|
+
if (this.$u) {
|
|
370
|
+
var d = this.$d;
|
|
371
|
+
this.$y = d.getUTCFullYear(), this.$M = d.getUTCMonth(), this.$D = d.getUTCDate(), this.$W = d.getUTCDay(), this.$H = d.getUTCHours(), this.$m = d.getUTCMinutes(), this.$s = d.getUTCSeconds(), this.$ms = d.getUTCMilliseconds();
|
|
372
|
+
} else l.call(this);
|
|
373
|
+
};
|
|
374
|
+
var f = c.utcOffset;
|
|
375
|
+
c.utcOffset = function(d, m) {
|
|
376
|
+
var D = this.$utils().u;
|
|
377
|
+
if (D(d)) return this.$u ? 0 : D(this.$offset) ? f.call(this) : this.$offset;
|
|
378
|
+
if (typeof d == "string" && (d = (function(N) {
|
|
379
|
+
N === void 0 && (N = "");
|
|
380
|
+
var x = N.match(o);
|
|
381
|
+
if (!x) return null;
|
|
382
|
+
var _ = ("" + x[0]).match(s) || ["-", 0, 0], A = _[0], v = 60 * +_[1] + +_[2];
|
|
383
|
+
return v === 0 ? 0 : A === "+" ? v : -v;
|
|
384
|
+
})(d), d === null)) return this;
|
|
385
|
+
var b = Math.abs(d) <= 16 ? 60 * d : d;
|
|
386
|
+
if (b === 0) return this.utc(m);
|
|
387
|
+
var S = this.clone();
|
|
388
|
+
if (m) return S.$offset = b, S.$u = !1, S;
|
|
389
|
+
var L = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
|
|
390
|
+
return (S = this.local().add(b + L, r)).$offset = b, S.$x.$localOffset = L, S;
|
|
391
|
+
};
|
|
392
|
+
var h = c.format;
|
|
393
|
+
c.format = function(d) {
|
|
394
|
+
var m = d || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
|
|
395
|
+
return h.call(this, m);
|
|
396
|
+
}, c.valueOf = function() {
|
|
397
|
+
var d = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
|
|
398
|
+
return this.$d.valueOf() - 6e4 * d;
|
|
399
|
+
}, c.isUTC = function() {
|
|
400
|
+
return !!this.$u;
|
|
401
|
+
}, c.toISOString = function() {
|
|
402
|
+
return this.toDate().toISOString();
|
|
403
|
+
}, c.toString = function() {
|
|
404
|
+
return this.toDate().toUTCString();
|
|
405
|
+
};
|
|
406
|
+
var w = c.toDate;
|
|
407
|
+
c.toDate = function(d) {
|
|
408
|
+
return d === "s" && this.$offset ? i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : w.call(this);
|
|
409
|
+
};
|
|
410
|
+
var p = c.diff;
|
|
411
|
+
c.diff = function(d, m, D) {
|
|
412
|
+
if (d && this.$u === d.$u) return p.call(this, d, m, D);
|
|
413
|
+
var b = this.local(), S = i(d).local();
|
|
414
|
+
return p.call(b, S, m, D);
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
}));
|
|
418
|
+
})(ne)), ne.exports;
|
|
419
|
+
}
|
|
420
|
+
var dr = ur();
|
|
421
|
+
const fr = /* @__PURE__ */ wn(dr);
|
|
422
|
+
ae.extend(fr);
|
|
423
|
+
const H = ae.utc;
|
|
424
|
+
function vn(t) {
|
|
425
|
+
return Math.floor(t.month() / 3) + 1;
|
|
426
|
+
}
|
|
427
|
+
function hr(t) {
|
|
428
|
+
return t.startOf("month").month(Math.floor(t.month() / 3) * 3);
|
|
429
|
+
}
|
|
430
|
+
function mr(t, n = 0) {
|
|
431
|
+
const r = (t.day() - n + 7) % 7;
|
|
432
|
+
return t.startOf("day").subtract(r, "day");
|
|
433
|
+
}
|
|
434
|
+
const xt = 38, ve = 28, pr = 18, gr = 73, Ge = 120, Xe = 800, Be = 16, $r = 220, Dr = 5, wr = 56, Wt = 8, ze = Wt + 5, yn = 44, ke = Wt * 3, vr = yn * 3, yr = ke, br = 24, je = 4, Sr = 450, Mr = {
|
|
435
|
+
day: "MMM D, YYYY HH:mm [UTC]",
|
|
436
|
+
week: "MMM D, YYYY",
|
|
437
|
+
month: "MMM D, YYYY",
|
|
438
|
+
quarter: "MMM YYYY",
|
|
439
|
+
year: "MMM YYYY"
|
|
440
|
+
}, xr = {
|
|
441
|
+
day: "HH:mm [UTC]",
|
|
442
|
+
week: "MMM D",
|
|
443
|
+
month: "MMM D",
|
|
444
|
+
quarter: "MMM YYYY",
|
|
445
|
+
year: "MMM YYYY"
|
|
446
|
+
}, Ir = 44, dt = {
|
|
447
|
+
day: {
|
|
448
|
+
// Quarter-day cells - the only scale that draws a task shorter than a day at its true length
|
|
449
|
+
labelUnit: "day",
|
|
450
|
+
tickUnit: "hour",
|
|
451
|
+
unitPerTick: 6,
|
|
452
|
+
tickAlign: "day",
|
|
453
|
+
dragStepUnit: "hour",
|
|
454
|
+
dragStepAmount: 1,
|
|
455
|
+
basePxPerDragStep: 12,
|
|
456
|
+
// 24-hour: there is no AM/PM marker here, so a 12-hour label would appear twice a day
|
|
457
|
+
formatTickLabel: (t) => t.format("HH"),
|
|
458
|
+
formatHeaderLabel: (t) => t.format("MMM D, YYYY")
|
|
459
|
+
},
|
|
460
|
+
week: {
|
|
461
|
+
labelUnit: "month",
|
|
462
|
+
tickUnit: "day",
|
|
463
|
+
unitPerTick: 1,
|
|
464
|
+
dragStepUnit: "hour",
|
|
465
|
+
dragStepAmount: 6,
|
|
466
|
+
basePxPerDragStep: 18,
|
|
467
|
+
formatTickLabel: (t) => t.format("D"),
|
|
468
|
+
formatHeaderLabel: (t) => t.format("MMM YYYY")
|
|
469
|
+
},
|
|
470
|
+
month: {
|
|
471
|
+
// Week cells - a day cell would be 18px here, too narrow for a date or an edge grab
|
|
472
|
+
labelUnit: "month",
|
|
473
|
+
tickUnit: "day",
|
|
474
|
+
unitPerTick: 7,
|
|
475
|
+
tickAlign: "week",
|
|
476
|
+
dragStepUnit: "day",
|
|
477
|
+
dragStepAmount: 1,
|
|
478
|
+
basePxPerDragStep: 18,
|
|
479
|
+
formatTickLabel: (t) => t.format("MMM D"),
|
|
480
|
+
formatHeaderLabel: (t) => t.format("MMM YYYY")
|
|
481
|
+
},
|
|
482
|
+
quarter: {
|
|
483
|
+
labelUnit: "quarter",
|
|
484
|
+
tickUnit: "month",
|
|
485
|
+
unitPerTick: 1,
|
|
486
|
+
dragStepUnit: "day",
|
|
487
|
+
dragStepAmount: 7,
|
|
488
|
+
basePxPerDragStep: 28,
|
|
489
|
+
formatTickLabel: (t) => t.format("MMM"),
|
|
490
|
+
formatHeaderLabel: (t) => `Q${vn(t)} ${t.format("YYYY")}`
|
|
491
|
+
},
|
|
492
|
+
year: {
|
|
493
|
+
// Quarter cells under a year header - the coarsest zoom; 4-week drag steps keep the weekday
|
|
494
|
+
labelUnit: "year",
|
|
495
|
+
tickUnit: "month",
|
|
496
|
+
unitPerTick: 3,
|
|
497
|
+
tickAlign: "quarter",
|
|
498
|
+
dragStepUnit: "day",
|
|
499
|
+
dragStepAmount: 28,
|
|
500
|
+
basePxPerDragStep: 28,
|
|
501
|
+
formatTickLabel: (t) => t.format("MMM"),
|
|
502
|
+
formatHeaderLabel: (t) => t.format("YYYY")
|
|
503
|
+
}
|
|
504
|
+
}, re = {
|
|
505
|
+
year: "numeric",
|
|
506
|
+
month: "short",
|
|
507
|
+
day: "numeric"
|
|
508
|
+
}, _t = { year: "numeric", month: "short" }, ye = { year: "numeric" }, bn = {
|
|
509
|
+
hour: "2-digit",
|
|
510
|
+
minute: "2-digit",
|
|
511
|
+
hourCycle: "h23"
|
|
512
|
+
}, Or = {
|
|
513
|
+
day: { hour: "2-digit", hourCycle: "h23" },
|
|
514
|
+
week: { day: "numeric" },
|
|
515
|
+
// Week columns - the day number alone would not say which month the week is in
|
|
516
|
+
month: { month: "short", day: "numeric" },
|
|
517
|
+
quarter: { month: "short" },
|
|
518
|
+
year: { month: "short" }
|
|
519
|
+
}, kr = {
|
|
520
|
+
day: re,
|
|
521
|
+
week: _t,
|
|
522
|
+
month: _t,
|
|
523
|
+
quarter: ye,
|
|
524
|
+
year: ye
|
|
525
|
+
}, Pr = {
|
|
526
|
+
day: { ...re, ...bn, timeZoneName: "short" },
|
|
527
|
+
week: re,
|
|
528
|
+
month: re,
|
|
529
|
+
quarter: _t,
|
|
530
|
+
year: _t
|
|
531
|
+
}, qe = {
|
|
532
|
+
day: { ...bn, timeZoneName: "short" },
|
|
533
|
+
week: { month: "short", day: "numeric" },
|
|
534
|
+
month: { month: "short", day: "numeric" },
|
|
535
|
+
quarter: _t,
|
|
536
|
+
year: _t
|
|
537
|
+
}, Tr = " – ", Ke = /* @__PURE__ */ new Set();
|
|
538
|
+
function Ut(t, n) {
|
|
539
|
+
const r = new Intl.DateTimeFormat(t, { timeZone: "UTC", ...n });
|
|
540
|
+
return (o) => r.format(o.toDate());
|
|
541
|
+
}
|
|
542
|
+
function Er(t) {
|
|
543
|
+
return (n, r) => {
|
|
544
|
+
try {
|
|
545
|
+
return t.formatRange(n.toDate(), r.toDate());
|
|
546
|
+
} catch {
|
|
547
|
+
return Sn(t.format(n.toDate()), t.format(r.toDate()));
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
function Sn(t, n) {
|
|
552
|
+
return t === n ? t : `${t}${Tr}${n}`;
|
|
553
|
+
}
|
|
554
|
+
function Lr(t) {
|
|
555
|
+
const n = Ut(t, ye);
|
|
556
|
+
return (r) => {
|
|
557
|
+
const o = n(r), s = `Q${vn(r)}`;
|
|
558
|
+
return /\d$/.test(o) ? `${s} ${o}` : `${o} ${s}`;
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
function Mn(t, n) {
|
|
562
|
+
return t === "week" && (n == null ? void 0 : n.firstDayOfWeek) !== void 0 ? "week" : dt[t].labelUnit;
|
|
563
|
+
}
|
|
564
|
+
function Yt(t, n) {
|
|
565
|
+
var l;
|
|
566
|
+
const r = (l = n == null ? void 0 : n.formats) == null ? void 0 : l[t], o = Mn(t, n) === "week" ? "day" : t, s = dt[t], e = dt[o], a = n != null && n.locale ? Ar(n.locale, t, o) : null, i = r == null ? void 0 : r.tooltip, c = i ?? (a == null ? void 0 : a.edge) ?? ((f) => f.format(xr[t])), u = !i && (a != null && a.range) ? a.range : (f, h) => Sn(c(f), c(h));
|
|
567
|
+
return {
|
|
568
|
+
edge: c,
|
|
569
|
+
range: u,
|
|
570
|
+
tick: (r == null ? void 0 : r.tick) ?? (a == null ? void 0 : a.tick) ?? ((f) => {
|
|
571
|
+
var h;
|
|
572
|
+
return ((h = s.formatTickLabel) == null ? void 0 : h.call(s, f)) ?? "";
|
|
573
|
+
}),
|
|
574
|
+
header: (r == null ? void 0 : r.header) ?? (a == null ? void 0 : a.header) ?? ((f) => {
|
|
575
|
+
var h;
|
|
576
|
+
return ((h = e.formatHeaderLabel) == null ? void 0 : h.call(e, f)) ?? f.format();
|
|
577
|
+
}),
|
|
578
|
+
tooltip: (r == null ? void 0 : r.tooltip) ?? (a == null ? void 0 : a.tooltip) ?? ((f) => f.format(Mr[t]))
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
function Ar(t, n, r) {
|
|
582
|
+
try {
|
|
583
|
+
return {
|
|
584
|
+
tick: Ut(t, Or[n]),
|
|
585
|
+
header: r === "quarter" ? Lr(t) : Ut(t, kr[r]),
|
|
586
|
+
tooltip: Ut(t, Pr[n]),
|
|
587
|
+
edge: Ut(t, qe[n]),
|
|
588
|
+
range: Er(
|
|
589
|
+
new Intl.DateTimeFormat(t, {
|
|
590
|
+
timeZone: "UTC",
|
|
591
|
+
...qe[n]
|
|
592
|
+
})
|
|
593
|
+
)
|
|
594
|
+
};
|
|
595
|
+
} catch {
|
|
596
|
+
return Ke.has(t) || (Ke.add(t), console.warn(
|
|
597
|
+
`[gantt-chart] Unusable locale "${t}" - falling back to the built-in labels.`
|
|
598
|
+
)), null;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
function xn(t) {
|
|
602
|
+
const n = Math.max(0, Math.round(t / 36e5));
|
|
603
|
+
return n < 24 ? `${n}h` : `${Math.round(n / 24)}d`;
|
|
604
|
+
}
|
|
605
|
+
const At = Object.keys(dt), Nr = {
|
|
606
|
+
minute: 6e4,
|
|
607
|
+
hour: 36e5,
|
|
608
|
+
day: 864e5,
|
|
609
|
+
week: 6048e5
|
|
610
|
+
};
|
|
611
|
+
function Rr(t) {
|
|
612
|
+
const { basePxPerDragStep: n, dragStepUnit: r, dragStepAmount: o } = dt[t];
|
|
613
|
+
return n / (o * Nr[r]);
|
|
614
|
+
}
|
|
615
|
+
function In(t, n) {
|
|
616
|
+
const r = At.indexOf(t);
|
|
617
|
+
if (r === -1) return t;
|
|
618
|
+
const o = Math.min(
|
|
619
|
+
At.length - 1,
|
|
620
|
+
Math.max(0, r + n)
|
|
621
|
+
);
|
|
622
|
+
return At[o];
|
|
623
|
+
}
|
|
624
|
+
function _r(t, n) {
|
|
625
|
+
for (const r of At)
|
|
626
|
+
if (t * Rr(r) <= n) return r;
|
|
627
|
+
return At[At.length - 1];
|
|
628
|
+
}
|
|
629
|
+
const Yr = 24, Hr = 120, Cr = {
|
|
630
|
+
delta: 0,
|
|
631
|
+
lastEventAt: 0,
|
|
632
|
+
locked: !1
|
|
633
|
+
};
|
|
634
|
+
function Fr(t, n, r) {
|
|
635
|
+
const o = r - t.lastEventAt >= Hr;
|
|
636
|
+
if (!o && t.locked)
|
|
637
|
+
return { state: { delta: 0, lastEventAt: r, locked: !0 }, step: 0 };
|
|
638
|
+
const s = (o ? 0 : t.delta) + n;
|
|
639
|
+
return Math.abs(s) < Yr ? { state: { delta: s, lastEventAt: r, locked: !1 }, step: 0 } : {
|
|
640
|
+
state: { delta: 0, lastEventAt: r, locked: !0 },
|
|
641
|
+
step: Math.sign(s)
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
const Ur = 48, Ve = 22;
|
|
645
|
+
function be(t, n, r) {
|
|
646
|
+
const o = r - n;
|
|
647
|
+
if (o <= 0) return 0;
|
|
648
|
+
const s = Math.min(Ur, o / 2);
|
|
649
|
+
return s <= 0 ? 0 : t < n + s ? -Ve * Math.min(1, (n + s - t) / s) : t > r - s ? Ve * Math.min(1, (t - (r - s)) / s) : 0;
|
|
650
|
+
}
|
|
651
|
+
const Se = { before: 0, after: 0 }, Qt = 2e3;
|
|
652
|
+
function Wr({
|
|
653
|
+
current: t,
|
|
654
|
+
scrollLeft: n,
|
|
655
|
+
viewportPx: r,
|
|
656
|
+
totalPx: o,
|
|
657
|
+
pxPerTick: s,
|
|
658
|
+
canExtend: e
|
|
659
|
+
}) {
|
|
660
|
+
if (s <= 0 || r <= 0) return null;
|
|
661
|
+
const a = Math.max(1, Math.ceil(r / s)), i = r / 2;
|
|
662
|
+
return (e == null ? void 0 : e.before) !== !1 && n <= i && t.before < Qt ? {
|
|
663
|
+
...t,
|
|
664
|
+
before: Math.min(Qt, t.before + a)
|
|
665
|
+
} : (e == null ? void 0 : e.after) !== !1 && o - (n + r) <= i && t.after < Qt ? {
|
|
666
|
+
...t,
|
|
667
|
+
after: Math.min(Qt, t.after + a)
|
|
668
|
+
} : null;
|
|
669
|
+
}
|
|
670
|
+
function Gt(t) {
|
|
671
|
+
return typeof t != "number" || Number.isNaN(t) ? null : Math.min(100, Math.max(0, t));
|
|
672
|
+
}
|
|
673
|
+
function Xt(t) {
|
|
674
|
+
const n = new Map(t.map((i) => [i.id, i])), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), e = [], a = (i) => {
|
|
675
|
+
const c = i.parentId;
|
|
676
|
+
if (!c || c === i.id || !n.has(c)) return null;
|
|
677
|
+
const u = /* @__PURE__ */ new Set([i.id]);
|
|
678
|
+
let l = n.get(c);
|
|
679
|
+
for (; l; ) {
|
|
680
|
+
if (u.has(l.id)) return null;
|
|
681
|
+
if (u.add(l.id), !l.parentId) break;
|
|
682
|
+
l = n.get(l.parentId);
|
|
683
|
+
}
|
|
684
|
+
return c;
|
|
685
|
+
};
|
|
686
|
+
for (const i of t)
|
|
687
|
+
r.set(i.id, a(i));
|
|
688
|
+
for (const i of t) {
|
|
689
|
+
const c = r.get(i.id);
|
|
690
|
+
if (!c) {
|
|
691
|
+
e.push(i.id);
|
|
692
|
+
continue;
|
|
693
|
+
}
|
|
694
|
+
const u = o.get(c);
|
|
695
|
+
u ? u.push(i.id) : o.set(c, [i.id]);
|
|
696
|
+
}
|
|
697
|
+
for (const i of t) {
|
|
698
|
+
let c = 0, u = r.get(i.id) ?? null;
|
|
699
|
+
for (; u; )
|
|
700
|
+
c++, u = r.get(u) ?? null;
|
|
701
|
+
s.set(i.id, c);
|
|
702
|
+
}
|
|
703
|
+
return { childIds: o, parentOf: r, depthOf: s, rootIds: e };
|
|
704
|
+
}
|
|
705
|
+
function ie(t, n, r = Xt(t)) {
|
|
706
|
+
if (!r.parentOf.has(n)) return [];
|
|
707
|
+
const o = [n];
|
|
708
|
+
for (let s = 0; s < o.length; s++) {
|
|
709
|
+
const e = r.childIds.get(o[s]);
|
|
710
|
+
e && o.push(...e);
|
|
711
|
+
}
|
|
712
|
+
return o;
|
|
713
|
+
}
|
|
714
|
+
function Gr(t, n, r = Xt(t)) {
|
|
715
|
+
const o = n instanceof Set ? n : new Set(n);
|
|
716
|
+
if (!o.size) return t;
|
|
717
|
+
const s = (e) => {
|
|
718
|
+
let a = r.parentOf.get(e) ?? null;
|
|
719
|
+
for (; a; ) {
|
|
720
|
+
if (o.has(a)) return !0;
|
|
721
|
+
a = r.parentOf.get(a) ?? null;
|
|
722
|
+
}
|
|
723
|
+
return !1;
|
|
724
|
+
};
|
|
725
|
+
return t.filter((e) => !s(e.id));
|
|
726
|
+
}
|
|
727
|
+
function Xr(t) {
|
|
728
|
+
let n = 0, r = 0, o = 0, s = !1;
|
|
729
|
+
for (const a of t) {
|
|
730
|
+
const i = Gt(a.progress);
|
|
731
|
+
i !== null && (s = !0);
|
|
732
|
+
const c = i ?? 0, u = Math.max(
|
|
733
|
+
0,
|
|
734
|
+
H(a.endDate).valueOf() - H(a.startDate).valueOf()
|
|
735
|
+
);
|
|
736
|
+
n += c * u, r += u, o += c;
|
|
737
|
+
}
|
|
738
|
+
if (!s) return;
|
|
739
|
+
const e = r > 0 ? n / r : o / t.length;
|
|
740
|
+
return Math.round(e);
|
|
741
|
+
}
|
|
742
|
+
function Br(t, n = Xt(t)) {
|
|
743
|
+
if (!n.childIds.size) return t;
|
|
744
|
+
const r = new Map(t.map((a) => [a.id, a])), o = [...n.childIds.keys()].filter((a) => r.has(a)).sort((a, i) => (n.depthOf.get(i) ?? 0) - (n.depthOf.get(a) ?? 0)), s = /* @__PURE__ */ new Map(), e = (a) => s.get(a) ?? r.get(a);
|
|
745
|
+
for (const a of o) {
|
|
746
|
+
const i = r.get(a);
|
|
747
|
+
if (!i) continue;
|
|
748
|
+
const c = (n.childIds.get(a) ?? []).map(e).filter((f) => f !== void 0);
|
|
749
|
+
if (!c.length) continue;
|
|
750
|
+
let u = 1 / 0, l = -1 / 0;
|
|
751
|
+
for (const f of c) {
|
|
752
|
+
const h = H(f.startDate).valueOf(), w = H(f.endDate).valueOf();
|
|
753
|
+
Number.isNaN(h) || (u = Math.min(u, h)), Number.isNaN(w) || (l = Math.max(l, w));
|
|
754
|
+
}
|
|
755
|
+
!Number.isFinite(u) || !Number.isFinite(l) || s.set(a, {
|
|
756
|
+
...i,
|
|
757
|
+
startDate: H(u).toISOString(),
|
|
758
|
+
endDate: H(l).toISOString(),
|
|
759
|
+
progress: i.progress ?? Xr(c)
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
return s.size ? t.map((a) => s.get(a.id) ?? a) : t;
|
|
763
|
+
}
|
|
764
|
+
function Ze(t) {
|
|
765
|
+
return t.split(".").map(Number);
|
|
766
|
+
}
|
|
767
|
+
function ce(t) {
|
|
768
|
+
return [...t].sort((n, r) => {
|
|
769
|
+
const o = Ze(n.sequence), s = Ze(r.sequence), e = Math.max(o.length, s.length);
|
|
770
|
+
for (let a = 0; a < e; a++) {
|
|
771
|
+
const i = o[a] || 0, c = s[a] || 0;
|
|
772
|
+
if (i !== c) return i - c;
|
|
773
|
+
}
|
|
774
|
+
return 0;
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
const Nt = "";
|
|
778
|
+
function Pe(t, n) {
|
|
779
|
+
const r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
780
|
+
if (n) {
|
|
781
|
+
const s = new Map(t.map((e) => [e.id, e]));
|
|
782
|
+
for (const e of t) {
|
|
783
|
+
const a = e.parentId;
|
|
784
|
+
let i = null;
|
|
785
|
+
if (a && a !== e.id && s.has(a)) {
|
|
786
|
+
const c = /* @__PURE__ */ new Set([e.id]);
|
|
787
|
+
let u = s.get(a);
|
|
788
|
+
for (i = a; u; ) {
|
|
789
|
+
if (c.has(u.id)) {
|
|
790
|
+
i = null;
|
|
791
|
+
break;
|
|
792
|
+
}
|
|
793
|
+
if (c.add(u.id), !u.parentId) break;
|
|
794
|
+
u = s.get(u.parentId);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
r.set(e.id, i);
|
|
798
|
+
}
|
|
799
|
+
} else {
|
|
800
|
+
const s = /* @__PURE__ */ new Map();
|
|
801
|
+
for (const e of t)
|
|
802
|
+
s.has(e.sequence) || s.set(e.sequence, e.id);
|
|
803
|
+
for (const e of t) {
|
|
804
|
+
const a = e.sequence.lastIndexOf("."), i = a === -1 ? null : e.sequence.slice(0, a), c = i ? s.get(i) ?? null : null;
|
|
805
|
+
r.set(e.id, c === e.id ? null : c);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
for (const s of t) {
|
|
809
|
+
const e = r.get(s.id) ?? Nt, a = o.get(e);
|
|
810
|
+
a ? a.push(s.id) : o.set(e, [s.id]);
|
|
811
|
+
}
|
|
812
|
+
return { children: o, parentOf: r };
|
|
813
|
+
}
|
|
814
|
+
const zr = [];
|
|
815
|
+
function oe(t, n) {
|
|
816
|
+
const { children: r, parentOf: o } = Pe(
|
|
817
|
+
ce(t),
|
|
818
|
+
n
|
|
819
|
+
);
|
|
820
|
+
return {
|
|
821
|
+
parentOf: o,
|
|
822
|
+
childrenOf: (s) => r.get(s ?? Nt) ?? zr
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
function jr(t, n, r, o) {
|
|
826
|
+
const s = o === "child" ? r : t.parentOf.get(r) ?? null, e = t.childrenOf(s), a = o === "child" ? e.length : e.indexOf(r) + (o === "after" ? 1 : 0), i = e.indexOf(n);
|
|
827
|
+
return {
|
|
828
|
+
taskId: n,
|
|
829
|
+
toParentId: s,
|
|
830
|
+
toIndex: i !== -1 && i < a ? a - 1 : a
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
function On(t, n, r) {
|
|
834
|
+
const o = new Map(t.map((h) => [h.id, h])), s = o.get(n.taskId);
|
|
835
|
+
if (!s) return "unknown-task";
|
|
836
|
+
const e = n.toParentId ? o.get(n.toParentId) : null;
|
|
837
|
+
if (n.toParentId && !e) return "unknown-parent";
|
|
838
|
+
if (r.canReorder && !r.canReorder(s)) return "read-only";
|
|
839
|
+
const a = ce(t), { children: i, parentOf: c } = Pe(a, r.hierarchy), u = c.get(s.id) ?? null;
|
|
840
|
+
if (!r.hierarchy && n.toParentId !== u)
|
|
841
|
+
return "reparent-disabled";
|
|
842
|
+
if (n.toParentId && new Set(ie(a, s.id)).has(n.toParentId))
|
|
843
|
+
return "cycle";
|
|
844
|
+
const f = (i.get(u ?? Nt) ?? []).indexOf(s.id);
|
|
845
|
+
return n.toParentId === u && n.toIndex === f ? "no-op" : null;
|
|
846
|
+
}
|
|
847
|
+
function qr(t, n, r) {
|
|
848
|
+
if (On(t, n, r)) return null;
|
|
849
|
+
const o = ce(t), { children: s, parentOf: e } = Pe(o, r.hierarchy), a = e.get(n.taskId) ?? null, i = a ?? Nt, c = n.toParentId ?? Nt, u = [...s.get(i) ?? []], l = u.indexOf(n.taskId);
|
|
850
|
+
u.splice(l, 1), s.set(i, u);
|
|
851
|
+
const f = c === i ? u : [...s.get(c) ?? []], h = Math.min(Math.max(n.toIndex, 0), f.length);
|
|
852
|
+
f.splice(h, 0, n.taskId), s.set(c, f);
|
|
853
|
+
const w = /* @__PURE__ */ new Map(), p = (m, D) => {
|
|
854
|
+
(s.get(m) ?? []).forEach((S, L) => {
|
|
855
|
+
const N = D ? `${D}.${L + 1}` : `${L + 1}`;
|
|
856
|
+
w.set(S, N), p(S, N);
|
|
857
|
+
});
|
|
858
|
+
};
|
|
859
|
+
return p(Nt, ""), {
|
|
860
|
+
tasks: t.map((m) => {
|
|
861
|
+
const D = w.get(m.id) ?? m.sequence, b = r.hierarchy && m.id === n.taskId ? n.toParentId : m.parentId;
|
|
862
|
+
return D === m.sequence && b === m.parentId ? m : { ...m, sequence: D, parentId: b };
|
|
863
|
+
}),
|
|
864
|
+
change: {
|
|
865
|
+
taskId: n.taskId,
|
|
866
|
+
fromParentId: a,
|
|
867
|
+
fromIndex: l,
|
|
868
|
+
toParentId: n.toParentId,
|
|
869
|
+
toIndex: h,
|
|
870
|
+
afterId: f[h - 1] ?? null,
|
|
871
|
+
beforeId: f[h + 1] ?? null
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
function Kr(t) {
|
|
876
|
+
return t.split(".").length - 1;
|
|
877
|
+
}
|
|
878
|
+
function Vr(t, n, r, o) {
|
|
879
|
+
return ce(t).map((e, a) => {
|
|
880
|
+
var h;
|
|
881
|
+
const i = o ? o.depthOf.get(e.id) ?? 0 : Kr(e.sequence), c = (((h = o == null ? void 0 : o.childIds.get(e.id)) == null ? void 0 : h.length) ?? 0) > 0, u = a + 1, { barMarginLeftAmount: l, barWidthSize: f } = to(
|
|
882
|
+
H(e.startDate),
|
|
883
|
+
H(e.endDate),
|
|
884
|
+
n,
|
|
885
|
+
r
|
|
886
|
+
);
|
|
887
|
+
return {
|
|
888
|
+
...e,
|
|
889
|
+
barLeft: l,
|
|
890
|
+
barWidth: f,
|
|
891
|
+
depth: i,
|
|
892
|
+
isSummary: c,
|
|
893
|
+
order: u,
|
|
894
|
+
originalOrder: u
|
|
895
|
+
};
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
const Zr = "off";
|
|
899
|
+
function Jr(t, n, r) {
|
|
900
|
+
if (!t.length || !n.length) return 0;
|
|
901
|
+
const o = t[0].startDate, s = n[0].startDate, e = o.valueOf() - s.valueOf();
|
|
902
|
+
return e === 0 ? 0 : e > 0 ? Lt(o, n, r) ?? 0 : -(Lt(s, t, r) ?? 0);
|
|
903
|
+
}
|
|
904
|
+
function Qr(t, n, r) {
|
|
905
|
+
const { tickUnit: o, unitPerTick: s } = dt[n];
|
|
906
|
+
if (o !== "day" && o !== "hour") return [];
|
|
907
|
+
const e = o === "day" ? s : 1, a = [];
|
|
908
|
+
let i = 0, c = null;
|
|
909
|
+
for (const u of t) {
|
|
910
|
+
const l = u.widthPx / e;
|
|
911
|
+
for (let f = 0; f < e; f++) {
|
|
912
|
+
const h = r(u.startDate.add(f, "day"));
|
|
913
|
+
h && (h.key === c ? a[a.length - 1].width += l : a.push({
|
|
914
|
+
left: i + f * l,
|
|
915
|
+
width: l,
|
|
916
|
+
...h.label !== void 0 && { label: h.label },
|
|
917
|
+
...h.color !== void 0 && { color: h.color }
|
|
918
|
+
})), c = (h == null ? void 0 : h.key) ?? null;
|
|
919
|
+
}
|
|
920
|
+
i += u.widthPx;
|
|
921
|
+
}
|
|
922
|
+
return a;
|
|
923
|
+
}
|
|
924
|
+
function Et(t, n, r) {
|
|
925
|
+
const { dragStepUnit: o, dragStepAmount: s } = dt[r];
|
|
926
|
+
return t.add(n * s, o);
|
|
927
|
+
}
|
|
928
|
+
function pe(t, n, r) {
|
|
929
|
+
const { dragStepUnit: o, dragStepAmount: s, basePxPerDragStep: e } = dt[r];
|
|
930
|
+
return n.diff(t, o, !0) / s * e;
|
|
931
|
+
}
|
|
932
|
+
function Te(t, n, r, o, s) {
|
|
933
|
+
const { min: e, max: a } = o;
|
|
934
|
+
if (!e && !a) return { startDate: n, endDate: r };
|
|
935
|
+
if (t === "bar") {
|
|
936
|
+
let u = n, l = r;
|
|
937
|
+
if (a && l.valueOf() > a.valueOf()) {
|
|
938
|
+
const f = l.valueOf() - a.valueOf();
|
|
939
|
+
u = u.subtract(f, "millisecond"), l = a;
|
|
940
|
+
}
|
|
941
|
+
if (e && u.valueOf() < e.valueOf()) {
|
|
942
|
+
const f = e.valueOf() - u.valueOf();
|
|
943
|
+
u = e, l = l.add(f, "millisecond");
|
|
944
|
+
}
|
|
945
|
+
return { startDate: u, endDate: l };
|
|
946
|
+
}
|
|
947
|
+
if (t === "left") {
|
|
948
|
+
let u = n;
|
|
949
|
+
e && u.valueOf() < e.valueOf() && (u = e), a && u.valueOf() > a.valueOf() && (u = a);
|
|
950
|
+
const l = Et(r, -1, s);
|
|
951
|
+
return u.valueOf() > l.valueOf() && (u = l), { startDate: u, endDate: r };
|
|
952
|
+
}
|
|
953
|
+
let i = r;
|
|
954
|
+
a && i.valueOf() > a.valueOf() && (i = a), e && i.valueOf() < e.valueOf() && (i = e);
|
|
955
|
+
const c = Et(n, 1, s);
|
|
956
|
+
return i.valueOf() < c.valueOf() && (i = c), { startDate: n, endDate: i };
|
|
957
|
+
}
|
|
958
|
+
function kn(t, n, r) {
|
|
959
|
+
const o = Math.min(0, n), s = Math.max(0, n);
|
|
960
|
+
let e = n;
|
|
961
|
+
for (const a of t) {
|
|
962
|
+
const { startDate: i } = Te(
|
|
963
|
+
"bar",
|
|
964
|
+
a.start.add(n, "millisecond"),
|
|
965
|
+
a.end.add(n, "millisecond"),
|
|
966
|
+
a.bounds,
|
|
967
|
+
r
|
|
968
|
+
), c = Math.min(
|
|
969
|
+
s,
|
|
970
|
+
Math.max(o, i.valueOf() - a.start.valueOf())
|
|
971
|
+
);
|
|
972
|
+
Math.abs(c) < Math.abs(e) && (e = c);
|
|
973
|
+
}
|
|
974
|
+
return e;
|
|
975
|
+
}
|
|
976
|
+
function to(t, n, r, o) {
|
|
977
|
+
if (!r.length)
|
|
978
|
+
return { barMarginLeftAmount: 0, barWidthSize: 0 };
|
|
979
|
+
const s = dt[o], { tickUnit: e, unitPerTick: a } = s;
|
|
980
|
+
let i = 0, c = 0, u = !1;
|
|
981
|
+
const l = t.valueOf(), f = n.valueOf();
|
|
982
|
+
for (const h of r) {
|
|
983
|
+
const w = h.startDate, p = w.add(a, e), d = h.widthPx, m = w.valueOf(), D = p.valueOf();
|
|
984
|
+
if (D <= l) {
|
|
985
|
+
i += d;
|
|
986
|
+
continue;
|
|
987
|
+
}
|
|
988
|
+
if (m >= f)
|
|
989
|
+
break;
|
|
990
|
+
const b = l > m ? t : w, S = f < D ? n : p, L = D - m, x = (S.valueOf() - b.valueOf()) / L;
|
|
991
|
+
if (!u && b.valueOf() > m) {
|
|
992
|
+
const _ = (b.valueOf() - m) / L;
|
|
993
|
+
i += _ * d;
|
|
994
|
+
}
|
|
995
|
+
c += x * d, u = !0;
|
|
996
|
+
}
|
|
997
|
+
return {
|
|
998
|
+
barMarginLeftAmount: i,
|
|
999
|
+
barWidthSize: Math.max(c, 1)
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
function Lt(t, n, r) {
|
|
1003
|
+
if (!n.length) return null;
|
|
1004
|
+
const { tickUnit: o, unitPerTick: s } = dt[r], e = t.valueOf();
|
|
1005
|
+
if (e < n[0].startDate.valueOf()) return null;
|
|
1006
|
+
let a = 0;
|
|
1007
|
+
for (const i of n) {
|
|
1008
|
+
const c = i.startDate.valueOf(), u = i.startDate.add(s, o).valueOf();
|
|
1009
|
+
if (e < u)
|
|
1010
|
+
return a + (e - c) / (u - c) * i.widthPx;
|
|
1011
|
+
a += i.widthPx;
|
|
1012
|
+
}
|
|
1013
|
+
return null;
|
|
1014
|
+
}
|
|
1015
|
+
function Pn(t, n, r) {
|
|
1016
|
+
if (!n.length || t < 0) return null;
|
|
1017
|
+
const { tickUnit: o, unitPerTick: s } = dt[r];
|
|
1018
|
+
let e = 0;
|
|
1019
|
+
for (const a of n) {
|
|
1020
|
+
if (t < e + a.widthPx) {
|
|
1021
|
+
const i = a.startDate.valueOf(), c = a.startDate.add(s, o).valueOf() - i, u = a.widthPx > 0 ? (t - e) / a.widthPx : 0;
|
|
1022
|
+
return H(i + u * c);
|
|
1023
|
+
}
|
|
1024
|
+
e += a.widthPx;
|
|
1025
|
+
}
|
|
1026
|
+
return null;
|
|
1027
|
+
}
|
|
1028
|
+
function eo(t, n) {
|
|
1029
|
+
if (!t.length) return null;
|
|
1030
|
+
const { tickUnit: r, unitPerTick: o } = dt[n], s = t[t.length - 1];
|
|
1031
|
+
return {
|
|
1032
|
+
start: t[0].startDate,
|
|
1033
|
+
end: s.startDate.add(o, r)
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
function Je(t, n) {
|
|
1037
|
+
if (t <= 0) return 0;
|
|
1038
|
+
let r = 0;
|
|
1039
|
+
for (let o = 0; o < n.length; o++)
|
|
1040
|
+
if (r += n[o].widthPx, t < r) return o;
|
|
1041
|
+
return n.length - 1;
|
|
1042
|
+
}
|
|
1043
|
+
function Tn(t, n, r, o) {
|
|
1044
|
+
if (!r.length) return null;
|
|
1045
|
+
const { tickUnit: s, unitPerTick: e } = dt[o], a = Je(Math.min(t, n), r), i = Je(Math.max(t, n), r);
|
|
1046
|
+
let c = 0;
|
|
1047
|
+
for (let l = 0; l < a; l++)
|
|
1048
|
+
c += r[l].widthPx;
|
|
1049
|
+
let u = 0;
|
|
1050
|
+
for (let l = a; l <= i; l++)
|
|
1051
|
+
u += r[l].widthPx;
|
|
1052
|
+
return {
|
|
1053
|
+
startDate: r[a].startDate,
|
|
1054
|
+
endDate: r[i].startDate.add(e, s),
|
|
1055
|
+
leftPx: c,
|
|
1056
|
+
widthPx: u
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
function no(t) {
|
|
1060
|
+
let n = 1 / 0, r = -1 / 0;
|
|
1061
|
+
for (const o of t) {
|
|
1062
|
+
const s = o.startDate ? H(o.startDate).valueOf() : NaN;
|
|
1063
|
+
Number.isNaN(s) || (n = Math.min(n, s));
|
|
1064
|
+
const e = o.endDate ? H(o.endDate).valueOf() : NaN;
|
|
1065
|
+
Number.isNaN(e) || (r = Math.max(r, e));
|
|
1066
|
+
}
|
|
1067
|
+
return {
|
|
1068
|
+
minDate: H(n),
|
|
1069
|
+
maxDate: H(r)
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
function ro(t, n, r, o) {
|
|
1073
|
+
const s = dt[r], { tickUnit: e, unitPerTick: a } = s, i = Dr * a;
|
|
1074
|
+
return {
|
|
1075
|
+
paddedMinDate: t.subtract(
|
|
1076
|
+
i + o.before * a,
|
|
1077
|
+
e
|
|
1078
|
+
),
|
|
1079
|
+
paddedMaxDate: n.add(
|
|
1080
|
+
i + o.after * a,
|
|
1081
|
+
e
|
|
1082
|
+
)
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
function oo(t, n, r) {
|
|
1086
|
+
const o = dt[r], {
|
|
1087
|
+
tickUnit: s,
|
|
1088
|
+
unitPerTick: e,
|
|
1089
|
+
basePxPerDragStep: a,
|
|
1090
|
+
dragStepUnit: i,
|
|
1091
|
+
dragStepAmount: c
|
|
1092
|
+
} = o, u = [];
|
|
1093
|
+
let l = o.tickAlign ? En(t, o.tickAlign) : t.startOf(s);
|
|
1094
|
+
const f = n.valueOf(), h = a / c;
|
|
1095
|
+
for (; l.valueOf() < f; ) {
|
|
1096
|
+
const w = l.add(e, s), d = w.diff(l, i) * h;
|
|
1097
|
+
u.push({
|
|
1098
|
+
startDate: l,
|
|
1099
|
+
widthPx: d
|
|
1100
|
+
}), l = w;
|
|
1101
|
+
}
|
|
1102
|
+
return u;
|
|
1103
|
+
}
|
|
1104
|
+
function En(t, n, r) {
|
|
1105
|
+
return n === "quarter" ? hr(t) : n === "week" ? mr(t, r) : t.startOf(n);
|
|
1106
|
+
}
|
|
1107
|
+
function so(t, n, r) {
|
|
1108
|
+
const o = Mn(n, r), { header: s } = Yt(n, r);
|
|
1109
|
+
if (t.length === 0) return [];
|
|
1110
|
+
const e = [];
|
|
1111
|
+
let a = null;
|
|
1112
|
+
for (const i of t) {
|
|
1113
|
+
const c = En(
|
|
1114
|
+
i.startDate,
|
|
1115
|
+
o,
|
|
1116
|
+
r == null ? void 0 : r.firstDayOfWeek
|
|
1117
|
+
), u = c.valueOf(), l = s(c);
|
|
1118
|
+
a && a.startDate.valueOf() === u ? a.widthPx += i.widthPx : (a && e.push(a), a = {
|
|
1119
|
+
label: l,
|
|
1120
|
+
widthPx: i.widthPx,
|
|
1121
|
+
startDate: c
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
return a && e.push(a), e;
|
|
1125
|
+
}
|
|
1126
|
+
function ao(t, n, r, o = !1, s = Se) {
|
|
1127
|
+
const e = r == null ? void 0 : r.start, a = r == null ? void 0 : r.end;
|
|
1128
|
+
if (!t.length && !(e && a))
|
|
1129
|
+
return { bottomCells: [], transformedTasks: [] };
|
|
1130
|
+
const i = o ? Xt(t) : void 0, c = i ? Br(t, i) : t;
|
|
1131
|
+
let u = e, l = a;
|
|
1132
|
+
if (!u || !l) {
|
|
1133
|
+
const { minDate: w, maxDate: p } = no(c), { paddedMinDate: d, paddedMaxDate: m } = ro(
|
|
1134
|
+
w,
|
|
1135
|
+
p,
|
|
1136
|
+
n,
|
|
1137
|
+
s
|
|
1138
|
+
);
|
|
1139
|
+
u = u ?? d, l = l ?? m;
|
|
1140
|
+
}
|
|
1141
|
+
const f = oo(
|
|
1142
|
+
u,
|
|
1143
|
+
l,
|
|
1144
|
+
n
|
|
1145
|
+
), h = Vr(
|
|
1146
|
+
c,
|
|
1147
|
+
f,
|
|
1148
|
+
n,
|
|
1149
|
+
i
|
|
1150
|
+
);
|
|
1151
|
+
return { bottomCells: f, transformedTasks: h };
|
|
1152
|
+
}
|
|
1153
|
+
function io({
|
|
1154
|
+
bottomRowCells: t,
|
|
1155
|
+
selectedScale: n,
|
|
1156
|
+
width: r,
|
|
1157
|
+
virtual: o
|
|
1158
|
+
}) {
|
|
1159
|
+
const s = Q((u) => u.localeOptions), e = j(
|
|
1160
|
+
() => Yt(n, s),
|
|
1161
|
+
[n, s]
|
|
1162
|
+
), { virtualCells: a, leadingCellPx: i } = o, c = j(
|
|
1163
|
+
() => sr(
|
|
1164
|
+
so(t, n, s)
|
|
1165
|
+
),
|
|
1166
|
+
[t, n, s]
|
|
1167
|
+
);
|
|
1168
|
+
return /* @__PURE__ */ P("header", { className: "gantt-header", style: { width: `${r}px` }, children: /* @__PURE__ */ J("div", { className: "gantt-header-content", children: [
|
|
1169
|
+
/* @__PURE__ */ P("div", { className: "gantt-top-header", children: /* @__PURE__ */ P("div", { className: "gantt-top-groups", children: c.map((u, l) => /* @__PURE__ */ P(
|
|
1170
|
+
"div",
|
|
1171
|
+
{
|
|
1172
|
+
className: "gantt-top-group",
|
|
1173
|
+
style: { width: `${u.widthPx}px` },
|
|
1174
|
+
children: /* @__PURE__ */ P("p", { className: "gantt-top-group-label", children: u.label })
|
|
1175
|
+
},
|
|
1176
|
+
`${u.label}-${l}`
|
|
1177
|
+
)) }) }),
|
|
1178
|
+
/* @__PURE__ */ J("div", { className: "gantt-bottom-row", children: [
|
|
1179
|
+
/* @__PURE__ */ P("div", { style: { width: `${i}px` }, "aria-hidden": "true" }),
|
|
1180
|
+
a.map((u) => {
|
|
1181
|
+
const l = t[u.index];
|
|
1182
|
+
return l ? /* @__PURE__ */ P(
|
|
1183
|
+
"div",
|
|
1184
|
+
{
|
|
1185
|
+
className: "gantt-bottom-cell",
|
|
1186
|
+
style: { width: `${u.size}px` },
|
|
1187
|
+
children: e.tick(l.startDate)
|
|
1188
|
+
},
|
|
1189
|
+
`bottom-${u.index}`
|
|
1190
|
+
) : null;
|
|
1191
|
+
})
|
|
1192
|
+
] })
|
|
1193
|
+
] }) });
|
|
1194
|
+
}
|
|
1195
|
+
const Ln = {};
|
|
1196
|
+
function Dt(t, n = Ln) {
|
|
1197
|
+
const r = (e, a) => e !== void 0 ? e : t.readOnly !== void 0 ? !t.readOnly : a !== void 0 ? a : !n.readOnly, o = t.allowReorder ?? (t.readOnly === !0 ? !1 : n.allowReorder ?? !1), s = t.isSummary === !0;
|
|
1198
|
+
return {
|
|
1199
|
+
canMove: r(t.allowMove, n.allowMove),
|
|
1200
|
+
canResize: !s && r(t.allowResize, n.allowResize),
|
|
1201
|
+
canChangeProgress: !s && r(t.allowProgressChange, n.allowProgressChange),
|
|
1202
|
+
canCreateLink: r(t.allowLinkCreate, n.allowLinkCreate),
|
|
1203
|
+
canDeleteLink: r(t.allowLinkDelete, n.allowLinkDelete),
|
|
1204
|
+
canReorder: o,
|
|
1205
|
+
minDate: t.minDate ?? n.minDate,
|
|
1206
|
+
maxDate: t.maxDate ?? n.maxDate
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
function co(t = Ln) {
|
|
1210
|
+
return t.allowTaskCreate ?? !t.readOnly;
|
|
1211
|
+
}
|
|
1212
|
+
function lo(t) {
|
|
1213
|
+
const n = t == null ? void 0 : t.trim();
|
|
1214
|
+
return n ? {
|
|
1215
|
+
"--gantt-bar-color": n,
|
|
1216
|
+
"--gantt-bar-color-hover": `color-mix(in srgb, ${n} 86%, #000)`,
|
|
1217
|
+
"--gantt-progress-color": `color-mix(in srgb, ${n} 62%, #000)`,
|
|
1218
|
+
// Black or white, whichever the bar color can carry: `l` is the color's own lightness, and
|
|
1219
|
+
// dividing by the threshold then multiplying by -infinity clamps to one end or the other.
|
|
1220
|
+
// 0.5637 is cbrt(0.1791), the OKLab lightness of the relative luminance where black and white
|
|
1221
|
+
// tie on WCAG contrast. Anything higher (MUI ships 0.7 for its own palette) picks white on
|
|
1222
|
+
// mid-tone colors that read better in black; measured, 0.7 gets 8 of 18 sample colors wrong.
|
|
1223
|
+
// Done in CSS, not here, because `var(--brand)` is a legal color and JS cannot read its lightness.
|
|
1224
|
+
"--gantt-bar-text-color": `oklch(from ${n} clamp(0, (l / 0.5637 - 1) * -infinity, 1) 0 h)`
|
|
1225
|
+
} : {};
|
|
1226
|
+
}
|
|
1227
|
+
const Me = { offsetX: 0, offsetWidth: 0 };
|
|
1228
|
+
function Qe(t, n, r, o, s) {
|
|
1229
|
+
if (r < 0 || s < 0)
|
|
1230
|
+
return `M ${n} ${r} h ${(o - n) / 2}`;
|
|
1231
|
+
const e = 7, a = 11, i = 25, c = 20, u = `M ${n} ${r}`, l = o - n, f = s - r, h = Math.abs(l), w = Math.abs(f), p = s <= r, d = s >= r, m = o >= n, D = o <= n, b = h > c, S = Math.abs(l / 2), L = Math.abs(f / 2);
|
|
1232
|
+
function N() {
|
|
1233
|
+
function v() {
|
|
1234
|
+
return (m || D) && d && !b ? "downSmallHorizontal" : (m || D) && p && !b ? "upSmallHorizontal" : d && D ? "downLeft" : d && m ? "downRight" : p && D ? "upLeft" : p && m ? "upRight" : "";
|
|
1235
|
+
}
|
|
1236
|
+
let g = u;
|
|
1237
|
+
switch (v()) {
|
|
1238
|
+
case "downRight": {
|
|
1239
|
+
g += ` h ${S - e}`, g += ` a ${e} ${e} 0 0 1 ${e} ${e}`, g += ` v ${f - e * 2}`, g += ` a ${e} ${e} 0 0 0 ${e} ${e}`, g += ` h ${S - e}`;
|
|
1240
|
+
break;
|
|
1241
|
+
}
|
|
1242
|
+
case "upRight": {
|
|
1243
|
+
g += ` h ${S - e}`, g += ` a ${e} ${e} 0 0 0 ${e} -${e}`, g += ` v -${w - e * 2}`, g += ` a ${e} ${e} 0 0 1 ${e} -${e}`, g += ` h ${S - e}`;
|
|
1244
|
+
break;
|
|
1245
|
+
}
|
|
1246
|
+
case "downLeft":
|
|
1247
|
+
case "downSmallHorizontal": {
|
|
1248
|
+
const F = r + f / 2;
|
|
1249
|
+
g += ` h ${a}`, g += ` a ${e} ${e} 0 0 1 ${e} ${e}`, g += ` v ${F - r - e * 2}`, g += ` a ${e} ${e} 0 0 1 -${e} ${e}`, g += ` h ${l - 2 * a}`, g += ` a ${e} ${e} 0 0 0 -${e} ${e}`, g += ` v ${F - r - e * 2}`, g += ` a ${e} ${e} 0 0 0 ${e} ${e}`, g += ` h ${a}`;
|
|
1250
|
+
break;
|
|
1251
|
+
}
|
|
1252
|
+
case "upLeft":
|
|
1253
|
+
case "upSmallHorizontal": {
|
|
1254
|
+
const F = r + f / 2;
|
|
1255
|
+
g += ` h ${a}`, g += ` a ${e} ${e} 0 0 0 ${e} -${e}`, g += ` v -${r - F - e * 2}`, g += ` a ${e} ${e} 0 0 0 -${e} -${e}`, g += ` h ${l - 2 * a}`, g += ` a ${e} ${e} 0 0 1 -${e} -${e}`, g += ` v -${r - F - e * 2}`, g += ` a ${e} ${e} 0 0 1 ${e} -${e}`, g += ` h ${a}`;
|
|
1256
|
+
break;
|
|
1257
|
+
}
|
|
1258
|
+
default:
|
|
1259
|
+
return g;
|
|
1260
|
+
}
|
|
1261
|
+
return g;
|
|
1262
|
+
}
|
|
1263
|
+
function x() {
|
|
1264
|
+
let v = u;
|
|
1265
|
+
return d && D ? (v += ` h ${i - a}`, v += ` a ${e} ${e} 0 0 1 ${e} ${e}`, v += ` v ${f - e * 2}`, v += ` a ${e} ${e} 0 0 1 -${e} ${e}`, v += ` h ${l - e * 2}`) : d && m ? (v += ` h ${l + i - a}`, v += ` a ${e} ${e} 0 0 1 ${e} ${e}`, v += ` v ${f - e * 2}`, v += ` a ${e} ${e} 0 0 1 -${e} ${e}`, v += ` h -${i - a}`) : p && D ? (v += ` h ${i - a}`, v += ` a ${e} ${e} 0 0 0 ${e} -${e}`, v += ` v ${f + e * 2}`, v += ` a ${e} ${e} 0 0 0 -${e} -${e}`, v += ` h ${l - i + a}`) : p && m && (v += ` h ${l + i - a}`, v += ` a ${e} ${e} 0 0 0 ${e} -${e}`, v += ` v ${f + e * 2}`, v += ` a ${e} ${e} 0 0 0 -${e} -${e}`, v += ` h -${i - a}`), v;
|
|
1266
|
+
}
|
|
1267
|
+
function _() {
|
|
1268
|
+
function v() {
|
|
1269
|
+
return (m || D) && d && !b ? "downSmallHorizontal" : (m || D) && p && !b ? "upSmallHorizontal" : d && D ? "downLeft" : d && m ? "downRight" : p && D ? "upLeft" : p && m ? "upRight" : "";
|
|
1270
|
+
}
|
|
1271
|
+
let g = u;
|
|
1272
|
+
switch (v()) {
|
|
1273
|
+
case "downRight":
|
|
1274
|
+
case "downSmallHorizontal": {
|
|
1275
|
+
g += ` h ${-a}`, g += ` a ${e} ${e} 0 0 0 -${e} ${e}`, g += ` v ${L - e * 2}`, g += ` a ${e} ${e} 0 0 0 ${e} ${e}`, g += ` h ${a * 2 + l}`, g += ` a ${e} ${e} 0 0 1 ${e} ${e}`, g += ` v ${L - e * 2}`, g += ` a ${e} ${e} 0 0 1 -${e} ${e}`, g += ` h ${-a}`;
|
|
1276
|
+
break;
|
|
1277
|
+
}
|
|
1278
|
+
case "upRight":
|
|
1279
|
+
case "upSmallHorizontal": {
|
|
1280
|
+
g += ` h ${-a}`, g += ` a ${e} ${e} 0 0 1 -${e} -${e}`, g += ` v ${-(L - e * 2)}`, g += ` a ${e} ${e} 0 0 1 ${e} -${e}`, g += ` h ${a * 2 + l}`, g += ` a ${e} ${e} 0 0 0 ${e} -${e}`, g += ` v ${-(L - e * 2)}`, g += ` a ${e} ${e} 0 0 0 -${e} -${e}`, g += ` h ${-a}`;
|
|
1281
|
+
break;
|
|
1282
|
+
}
|
|
1283
|
+
case "downLeft": {
|
|
1284
|
+
g += ` h ${-S + e}`, g += ` a ${e} ${e} 0 0 0 -${e} ${e}`, g += ` v ${w - e * 2}`, g += ` a ${e} ${e} 0 0 1 -${e} ${e}`, g += ` h ${-S + e}`;
|
|
1285
|
+
break;
|
|
1286
|
+
}
|
|
1287
|
+
case "upLeft": {
|
|
1288
|
+
g += ` h ${-(S - e)}`, g += ` a ${e} ${e} 0 0 1 -${e} -${e}`, g += ` v ${-(w - e * 2)}`, g += ` a ${e} ${e} 0 0 0 -${e} -${e}`, g += ` h ${-S + e}`;
|
|
1289
|
+
break;
|
|
1290
|
+
}
|
|
1291
|
+
default:
|
|
1292
|
+
return g;
|
|
1293
|
+
}
|
|
1294
|
+
return g;
|
|
1295
|
+
}
|
|
1296
|
+
function A() {
|
|
1297
|
+
let v = u;
|
|
1298
|
+
return d && D ? (v += ` h ${l - i}`, v += ` a ${e} ${e} 0 0 0 -${e} ${e}`, v += ` v ${f - e * 2}`, v += ` a ${e} ${e} 0 0 0 ${e} ${e}`, v += ` h ${i}`) : d && m ? (v += ` h ${-i}`, v += ` a ${e} ${e} 0 0 0 -${e} ${e}`, v += ` v ${f - e * 2}`, v += ` a ${e} ${e} 0 0 0 ${e} ${e}`, v += ` h ${l + i}`) : p && D ? (v += ` h ${l - i}`, v += ` a ${e} ${e} 0 0 1 -${e} -${e}`, v += ` v ${f + e * 2}`, v += ` a ${e} ${e} 0 0 1 ${e} -${e}`, v += ` h ${i}`) : p && m && (v += ` h ${-i}`, v += ` a ${e} ${e} 0 0 1 -${e} -${e}`, v += ` v ${f + e * 2}`, v += ` a ${e} ${e} 0 0 1 ${e} -${e}`, v += ` h ${l + i}`), v;
|
|
1299
|
+
}
|
|
1300
|
+
switch (t) {
|
|
1301
|
+
case "FS":
|
|
1302
|
+
return N();
|
|
1303
|
+
case "FF":
|
|
1304
|
+
return x();
|
|
1305
|
+
case "SF":
|
|
1306
|
+
return _();
|
|
1307
|
+
case "SS":
|
|
1308
|
+
return A();
|
|
1309
|
+
default:
|
|
1310
|
+
return `${u} L ${o} ${s}`;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
function xe(t, n) {
|
|
1314
|
+
const r = t.barLeft + n.offsetX;
|
|
1315
|
+
return {
|
|
1316
|
+
startX: r,
|
|
1317
|
+
endX: r + t.barWidth + n.offsetWidth
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
function tn(t, n, r = Me) {
|
|
1321
|
+
const { startX: o, endX: s } = xe(t, r);
|
|
1322
|
+
return {
|
|
1323
|
+
x: n === "start" ? o : s,
|
|
1324
|
+
y: (t.order - 1) * xt + xt / 2
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
function uo(t, n, r, o, s) {
|
|
1328
|
+
const e = xt, a = t.order - 1, i = n.order - 1, c = e / 2, u = i * e + c, l = a * e + c, f = xe(n, o), h = xe(t, r), p = {
|
|
1329
|
+
FS: [f.endX, h.startX],
|
|
1330
|
+
SS: [f.startX, h.startX],
|
|
1331
|
+
FF: [f.endX, h.endX],
|
|
1332
|
+
SF: [f.startX, h.endX]
|
|
1333
|
+
}[s];
|
|
1334
|
+
if (!p)
|
|
1335
|
+
return null;
|
|
1336
|
+
const [d, m] = p;
|
|
1337
|
+
return { fromX: d, fromY: u, toX: m, toY: l };
|
|
1338
|
+
}
|
|
1339
|
+
function fo(t) {
|
|
1340
|
+
return new Map(t.map((n) => [n.id, n]));
|
|
1341
|
+
}
|
|
1342
|
+
const te = 32;
|
|
1343
|
+
function ho(t, n) {
|
|
1344
|
+
const r = Math.min(t.fromY, t.toY) - te;
|
|
1345
|
+
if (Math.max(t.fromY, t.toY) + te < n.topPx || r > n.bottomPx) return !1;
|
|
1346
|
+
const s = Math.min(t.fromX, t.toX) - te, e = Math.max(t.fromX, t.toX) + te;
|
|
1347
|
+
return n.isBarVisible(s, e - s);
|
|
1348
|
+
}
|
|
1349
|
+
function mo(t, n) {
|
|
1350
|
+
const r = [];
|
|
1351
|
+
for (const o of t.values()) {
|
|
1352
|
+
const s = n[o.id] ?? Me;
|
|
1353
|
+
for (const e of o.dependencies ?? []) {
|
|
1354
|
+
const a = t.get(e.targetId);
|
|
1355
|
+
if (!a) continue;
|
|
1356
|
+
const i = uo(
|
|
1357
|
+
o,
|
|
1358
|
+
a,
|
|
1359
|
+
s,
|
|
1360
|
+
n[a.id] ?? Me,
|
|
1361
|
+
e.type
|
|
1362
|
+
);
|
|
1363
|
+
i && r.push({
|
|
1364
|
+
...e,
|
|
1365
|
+
sourceId: o.id,
|
|
1366
|
+
...i
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
return r;
|
|
1371
|
+
}
|
|
1372
|
+
function An(t, n) {
|
|
1373
|
+
const r = (o) => o === "end" ? "F" : "S";
|
|
1374
|
+
return `${r(t)}${r(n)}`;
|
|
1375
|
+
}
|
|
1376
|
+
function po(t, n, r, o, s) {
|
|
1377
|
+
const e = Math.floor(r / o);
|
|
1378
|
+
if (e < 0) return null;
|
|
1379
|
+
let a = null, i = 1 / 0;
|
|
1380
|
+
for (const f of t) {
|
|
1381
|
+
if (f.order - 1 !== e) continue;
|
|
1382
|
+
const h = f.barLeft ?? 0, w = h + (f.barWidth ?? 0), p = n < h ? h - n : Math.max(0, n - w);
|
|
1383
|
+
p < i && (i = p, a = f);
|
|
1384
|
+
}
|
|
1385
|
+
if (!a) return null;
|
|
1386
|
+
const c = a.barLeft ?? 0, u = a.barWidth ?? 0, l = Math.min(s, u / 3);
|
|
1387
|
+
return { task: a, anchor: n > c + u - l ? "end" : "start" };
|
|
1388
|
+
}
|
|
1389
|
+
function go(t, n, r) {
|
|
1390
|
+
var i;
|
|
1391
|
+
if (n === r) return "self";
|
|
1392
|
+
const o = new Map(t.map((c) => [c.id, c])), s = (i = o.get(r)) == null ? void 0 : i.dependencies;
|
|
1393
|
+
if (s != null && s.some((c) => c.targetId === n))
|
|
1394
|
+
return "duplicate";
|
|
1395
|
+
const e = /* @__PURE__ */ new Set([n]), a = [n];
|
|
1396
|
+
for (; a.length; ) {
|
|
1397
|
+
const c = o.get(a.pop());
|
|
1398
|
+
for (const u of (c == null ? void 0 : c.dependencies) ?? []) {
|
|
1399
|
+
if (u.targetId === r) return "cycle";
|
|
1400
|
+
e.has(u.targetId) || (e.add(u.targetId), a.push(u.targetId));
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
return null;
|
|
1404
|
+
}
|
|
1405
|
+
const $o = {
|
|
1406
|
+
self: "Cannot link a task to itself",
|
|
1407
|
+
duplicate: "These tasks are already linked",
|
|
1408
|
+
cycle: "That would create a circular dependency"
|
|
1409
|
+
};
|
|
1410
|
+
function Do(t, n, r, o) {
|
|
1411
|
+
let s = !1;
|
|
1412
|
+
const e = t.map((a) => a.id !== r ? a : (s = !0, {
|
|
1413
|
+
...a,
|
|
1414
|
+
dependencies: [
|
|
1415
|
+
...a.dependencies ?? [],
|
|
1416
|
+
{ targetId: n, type: o }
|
|
1417
|
+
]
|
|
1418
|
+
}));
|
|
1419
|
+
return s ? e : t;
|
|
1420
|
+
}
|
|
1421
|
+
function wo(t, n, r) {
|
|
1422
|
+
let o = !1;
|
|
1423
|
+
const s = t.map((e) => {
|
|
1424
|
+
if (e.id !== r || !e.dependencies) return e;
|
|
1425
|
+
const a = e.dependencies.filter(
|
|
1426
|
+
(i) => i.targetId !== n
|
|
1427
|
+
);
|
|
1428
|
+
return a.length === e.dependencies.length ? e : (o = !0, { ...e, dependencies: a });
|
|
1429
|
+
});
|
|
1430
|
+
return o ? s : t;
|
|
1431
|
+
}
|
|
1432
|
+
const vo = 8, yo = 14, bo = 220;
|
|
1433
|
+
function So(t) {
|
|
1434
|
+
const n = t;
|
|
1435
|
+
return n ? n.isContentEditable || n.tagName === "INPUT" || n.tagName === "TEXTAREA" || n.tagName === "SELECT" : !1;
|
|
1436
|
+
}
|
|
1437
|
+
function Mo({
|
|
1438
|
+
transformedTasks: t,
|
|
1439
|
+
rowCount: n,
|
|
1440
|
+
virtual: r,
|
|
1441
|
+
interaction: o,
|
|
1442
|
+
onTasksChange: s,
|
|
1443
|
+
onDependencyDelete: e
|
|
1444
|
+
}) {
|
|
1445
|
+
const a = yt(), i = Q((x) => x.dragOffsets), c = Q((x) => x.linkDraft), u = Q((x) => x.getTotalWidth()), l = Q((x) => x.selectedDependency), f = Q((x) => x.selectedTaskId), h = Q((x) => x.hoveredTaskId), w = j(
|
|
1446
|
+
() => fo(t),
|
|
1447
|
+
[t]
|
|
1448
|
+
), p = {
|
|
1449
|
+
topPx: r.rowStartPx,
|
|
1450
|
+
bottomPx: r.rowEndPx,
|
|
1451
|
+
isBarVisible: r.isBarVisible
|
|
1452
|
+
}, d = mo(w, i).filter(
|
|
1453
|
+
(x) => ho(x, p)
|
|
1454
|
+
), m = (x) => (l == null ? void 0 : l.sourceId) === x.sourceId && (l == null ? void 0 : l.targetId) === x.targetId, D = (x) => h !== null && (x.sourceId === h || x.targetId === h) || f !== null && (x.sourceId === f || x.targetId === f), b = z(() => {
|
|
1455
|
+
var I;
|
|
1456
|
+
const { rawTasks: x, selectedDependency: _, setRawTasks: A, setSelectedDependency: v } = a.getState();
|
|
1457
|
+
if (!_) return;
|
|
1458
|
+
const { sourceId: g, targetId: R } = _, F = x.find((y) => y.id === g), U = (I = F == null ? void 0 : F.dependencies) == null ? void 0 : I.find(
|
|
1459
|
+
(y) => y.targetId === R
|
|
1460
|
+
);
|
|
1461
|
+
if (!F || !U || !Dt(F, o).canDeleteLink) return;
|
|
1462
|
+
const T = {
|
|
1463
|
+
predecessorId: R,
|
|
1464
|
+
successorId: g,
|
|
1465
|
+
type: U.type
|
|
1466
|
+
};
|
|
1467
|
+
if ((e == null ? void 0 : e(T)) === !1) return;
|
|
1468
|
+
v(null);
|
|
1469
|
+
const M = wo(x, R, g);
|
|
1470
|
+
A(M), s == null || s(M);
|
|
1471
|
+
}, [a, o, e, s]);
|
|
1472
|
+
it(() => {
|
|
1473
|
+
if (!l) return;
|
|
1474
|
+
const x = (A) => {
|
|
1475
|
+
So(A.target) || (A.key === "Delete" || A.key === "Backspace" ? (A.preventDefault(), b()) : A.key === "Escape" && a.getState().setSelectedDependency(null));
|
|
1476
|
+
}, _ = () => {
|
|
1477
|
+
a.getState().setSelectedDependency(null);
|
|
1478
|
+
};
|
|
1479
|
+
return document.addEventListener("keydown", x), document.addEventListener("pointerdown", _), () => {
|
|
1480
|
+
document.removeEventListener("keydown", x), document.removeEventListener("pointerdown", _);
|
|
1481
|
+
};
|
|
1482
|
+
}, [l, b, a]);
|
|
1483
|
+
const S = j(() => {
|
|
1484
|
+
if (!c) return null;
|
|
1485
|
+
const x = w.get(c.fromTaskId);
|
|
1486
|
+
if (!x) return null;
|
|
1487
|
+
const _ = tn(
|
|
1488
|
+
x,
|
|
1489
|
+
c.fromAnchor,
|
|
1490
|
+
i[x.id]
|
|
1491
|
+
), A = c.hoverTaskId ? w.get(c.hoverTaskId) : void 0, v = c.hoverAnchor && An(c.fromAnchor, c.hoverAnchor), g = !c.rejection && A !== void 0 && c.hoverAnchor !== null, R = g && A && c.hoverAnchor ? tn(
|
|
1492
|
+
A,
|
|
1493
|
+
c.hoverAnchor,
|
|
1494
|
+
i[A.id]
|
|
1495
|
+
) : { x: c.toX, y: c.toY }, F = R.x > u - bo;
|
|
1496
|
+
return {
|
|
1497
|
+
from: _,
|
|
1498
|
+
d: g && v ? Qe(v, _.x, _.y, R.x, R.y) : `M ${_.x} ${_.y} L ${R.x} ${R.y}`,
|
|
1499
|
+
armed: g,
|
|
1500
|
+
type: v,
|
|
1501
|
+
rejection: c.rejection,
|
|
1502
|
+
label: {
|
|
1503
|
+
x: F ? R.x - 12 : R.x + 12,
|
|
1504
|
+
y: Math.max(yo, R.y - 8),
|
|
1505
|
+
anchor: F ? "end" : "start"
|
|
1506
|
+
}
|
|
1507
|
+
};
|
|
1508
|
+
}, [c, w, i, u]), N = `gantt-arrowhead-${gn().replace(/[^a-zA-Z0-9]/g, "")}`;
|
|
1509
|
+
return /* @__PURE__ */ J(
|
|
1510
|
+
"svg",
|
|
1511
|
+
{
|
|
1512
|
+
className: `gantt-dependency-arrows${c ? " linking" : ""}`,
|
|
1513
|
+
style: {
|
|
1514
|
+
height: `${n * xt}px`
|
|
1515
|
+
},
|
|
1516
|
+
children: [
|
|
1517
|
+
/* @__PURE__ */ P("defs", { children: /* @__PURE__ */ P(
|
|
1518
|
+
"marker",
|
|
1519
|
+
{
|
|
1520
|
+
id: N,
|
|
1521
|
+
markerWidth: "5",
|
|
1522
|
+
markerHeight: "5",
|
|
1523
|
+
refX: "4.5",
|
|
1524
|
+
refY: "2.5",
|
|
1525
|
+
orient: "auto",
|
|
1526
|
+
children: /* @__PURE__ */ P(
|
|
1527
|
+
"polygon",
|
|
1528
|
+
{
|
|
1529
|
+
className: "gantt-dependency-arrow-head",
|
|
1530
|
+
points: "0 0, 5 2.5, 0 5"
|
|
1531
|
+
}
|
|
1532
|
+
)
|
|
1533
|
+
}
|
|
1534
|
+
) }),
|
|
1535
|
+
d.map((x, _) => {
|
|
1536
|
+
const A = Qe(
|
|
1537
|
+
x.type,
|
|
1538
|
+
x.fromX,
|
|
1539
|
+
x.fromY,
|
|
1540
|
+
x.toX,
|
|
1541
|
+
x.toY
|
|
1542
|
+
), v = m(x), g = w.get(x.sourceId), R = g !== void 0 && Dt(g, o).canDeleteLink;
|
|
1543
|
+
return /* @__PURE__ */ J("g", { children: [
|
|
1544
|
+
R && /* @__PURE__ */ P(
|
|
1545
|
+
"path",
|
|
1546
|
+
{
|
|
1547
|
+
className: "gantt-dependency-hit",
|
|
1548
|
+
d: A,
|
|
1549
|
+
fill: "none",
|
|
1550
|
+
onPointerDown: (F) => {
|
|
1551
|
+
F.stopPropagation(), a.getState().setSelectedDependency({
|
|
1552
|
+
sourceId: x.sourceId,
|
|
1553
|
+
targetId: x.targetId
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
),
|
|
1558
|
+
/* @__PURE__ */ P(
|
|
1559
|
+
"path",
|
|
1560
|
+
{
|
|
1561
|
+
className: `gantt-dependency-arrow${v ? " selected" : ""}${D(x) ? " related" : ""}`,
|
|
1562
|
+
d: A,
|
|
1563
|
+
markerEnd: `url(#${N})`,
|
|
1564
|
+
fill: "none"
|
|
1565
|
+
}
|
|
1566
|
+
),
|
|
1567
|
+
v && /* @__PURE__ */ J(
|
|
1568
|
+
"g",
|
|
1569
|
+
{
|
|
1570
|
+
className: "gantt-dependency-delete",
|
|
1571
|
+
transform: `translate(${(x.fromX + x.toX) / 2} ${(x.fromY + x.toY) / 2})`,
|
|
1572
|
+
role: "button",
|
|
1573
|
+
"aria-label": `Delete ${x.type} dependency`,
|
|
1574
|
+
onPointerDown: (F) => {
|
|
1575
|
+
F.stopPropagation(), b();
|
|
1576
|
+
},
|
|
1577
|
+
children: [
|
|
1578
|
+
/* @__PURE__ */ P("circle", { r: vo }),
|
|
1579
|
+
/* @__PURE__ */ P("path", { d: "M -3 -3 L 3 3 M 3 -3 L -3 3" })
|
|
1580
|
+
]
|
|
1581
|
+
}
|
|
1582
|
+
)
|
|
1583
|
+
] }, `arrow-${_}`);
|
|
1584
|
+
}),
|
|
1585
|
+
S && /* @__PURE__ */ J("g", { className: "gantt-link-preview", children: [
|
|
1586
|
+
/* @__PURE__ */ P(
|
|
1587
|
+
"path",
|
|
1588
|
+
{
|
|
1589
|
+
className: `gantt-link-preview-line${S.rejection ? " invalid" : ""}${S.armed ? " armed" : ""}`,
|
|
1590
|
+
d: S.d,
|
|
1591
|
+
fill: "none",
|
|
1592
|
+
markerEnd: S.rejection ? void 0 : `url(#${N})`
|
|
1593
|
+
}
|
|
1594
|
+
),
|
|
1595
|
+
/* @__PURE__ */ P(
|
|
1596
|
+
"circle",
|
|
1597
|
+
{
|
|
1598
|
+
className: "gantt-link-preview-origin",
|
|
1599
|
+
cx: S.from.x,
|
|
1600
|
+
cy: S.from.y,
|
|
1601
|
+
r: "3"
|
|
1602
|
+
}
|
|
1603
|
+
),
|
|
1604
|
+
S.armed && S.type && /* @__PURE__ */ P(
|
|
1605
|
+
"text",
|
|
1606
|
+
{
|
|
1607
|
+
className: "gantt-link-preview-type",
|
|
1608
|
+
x: S.label.x,
|
|
1609
|
+
y: S.label.y,
|
|
1610
|
+
textAnchor: S.label.anchor,
|
|
1611
|
+
children: S.type
|
|
1612
|
+
}
|
|
1613
|
+
),
|
|
1614
|
+
S.rejection && /* @__PURE__ */ P(
|
|
1615
|
+
"text",
|
|
1616
|
+
{
|
|
1617
|
+
className: "gantt-link-preview-reason",
|
|
1618
|
+
x: S.label.x,
|
|
1619
|
+
y: S.label.y,
|
|
1620
|
+
textAnchor: S.label.anchor,
|
|
1621
|
+
children: $o[S.rejection]
|
|
1622
|
+
}
|
|
1623
|
+
)
|
|
1624
|
+
] })
|
|
1625
|
+
]
|
|
1626
|
+
}
|
|
1627
|
+
);
|
|
1628
|
+
}
|
|
1629
|
+
function xo() {
|
|
1630
|
+
const t = Q((d) => d.currentTask), n = Q((d) => d.dragOffsets), r = Q((d) => d.dragMode), o = Q((d) => d.selectedScale), s = Q((d) => d.localeOptions), e = Q((d) => d.bottomRowCells), { edge: a, range: i } = j(
|
|
1631
|
+
() => Yt(o, s),
|
|
1632
|
+
[o, s]
|
|
1633
|
+
), c = j(
|
|
1634
|
+
() => Dn(e),
|
|
1635
|
+
[e]
|
|
1636
|
+
), u = t ? n[t.id] : void 0;
|
|
1637
|
+
if (!t || !u) return null;
|
|
1638
|
+
const l = t.barLeft + u.offsetX, f = l + t.barWidth + u.offsetWidth, h = se(c, l), w = se(c, f);
|
|
1639
|
+
if (!h || !w) return null;
|
|
1640
|
+
const p = r === "left" ? [{ cell: h, label: a(u.offsetStartDate) }] : r === "right" ? [{ cell: w, label: a(u.offsetEndDate) }] : h.index === w.index ? [
|
|
1641
|
+
{
|
|
1642
|
+
cell: h,
|
|
1643
|
+
label: i(u.offsetStartDate, u.offsetEndDate)
|
|
1644
|
+
}
|
|
1645
|
+
] : [
|
|
1646
|
+
{ cell: h, label: a(u.offsetStartDate) },
|
|
1647
|
+
{ cell: w, label: a(u.offsetEndDate) }
|
|
1648
|
+
];
|
|
1649
|
+
return /* @__PURE__ */ J("div", { className: "gantt-drag-guides", "aria-hidden": "true", children: [
|
|
1650
|
+
p.map(({ cell: d, label: m }) => /* @__PURE__ */ P(
|
|
1651
|
+
"div",
|
|
1652
|
+
{
|
|
1653
|
+
className: "gantt-drag-cell",
|
|
1654
|
+
style: { left: `${d.left}px`, width: `${d.width}px` },
|
|
1655
|
+
children: /* @__PURE__ */ P("span", { children: m })
|
|
1656
|
+
},
|
|
1657
|
+
d.index
|
|
1658
|
+
)),
|
|
1659
|
+
/* @__PURE__ */ P(
|
|
1660
|
+
"div",
|
|
1661
|
+
{
|
|
1662
|
+
className: "gantt-drag-footprint",
|
|
1663
|
+
style: {
|
|
1664
|
+
left: `${l}px`,
|
|
1665
|
+
width: `${Math.max(f - l, 2)}px`
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
)
|
|
1669
|
+
] });
|
|
1670
|
+
}
|
|
1671
|
+
function Io({
|
|
1672
|
+
width: t,
|
|
1673
|
+
onWidthChange: n
|
|
1674
|
+
}) {
|
|
1675
|
+
const r = (a) => Math.min(Xe, Math.max(Ge, a)), o = (a) => {
|
|
1676
|
+
if (!a.isPrimary || a.button !== 0) return;
|
|
1677
|
+
const i = a.clientX, c = t;
|
|
1678
|
+
a.currentTarget.setPointerCapture(a.pointerId);
|
|
1679
|
+
const u = (f) => {
|
|
1680
|
+
f.pointerId === a.pointerId && n(r(c + f.clientX - i));
|
|
1681
|
+
}, l = (f) => {
|
|
1682
|
+
f.pointerId === a.pointerId && (document.removeEventListener("pointermove", u), document.removeEventListener("pointerup", l), document.removeEventListener("pointercancel", l));
|
|
1683
|
+
};
|
|
1684
|
+
document.addEventListener("pointermove", u), document.addEventListener("pointerup", l), document.addEventListener("pointercancel", l);
|
|
1685
|
+
}, s = (a) => {
|
|
1686
|
+
var h, w;
|
|
1687
|
+
const i = (h = a.parentElement) == null ? void 0 : h.querySelectorAll(
|
|
1688
|
+
".gantt-grid-cell-text"
|
|
1689
|
+
);
|
|
1690
|
+
if (!(i != null && i.length)) return;
|
|
1691
|
+
const c = (w = a.parentElement) == null ? void 0 : w.querySelector(".gantt-grid");
|
|
1692
|
+
if (!c) return;
|
|
1693
|
+
const u = c.getBoundingClientRect().width / c.offsetWidth || 1, l = document.createRange();
|
|
1694
|
+
let f = 0;
|
|
1695
|
+
i.forEach((p) => {
|
|
1696
|
+
const d = p.closest(".gantt-grid-row");
|
|
1697
|
+
if (!d) return;
|
|
1698
|
+
l.selectNodeContents(p);
|
|
1699
|
+
const m = l.getBoundingClientRect().width;
|
|
1700
|
+
let b = p.getBoundingClientRect().left - d.getBoundingClientRect().left + m;
|
|
1701
|
+
for (let S = p.nextElementSibling; S; S = S.nextElementSibling)
|
|
1702
|
+
b += S.getBoundingClientRect().width;
|
|
1703
|
+
f = Math.max(f, b);
|
|
1704
|
+
}), n(r(Math.ceil(f / u + 10) + 1));
|
|
1705
|
+
}, e = (a) => {
|
|
1706
|
+
if (a.key === "Enter") {
|
|
1707
|
+
a.preventDefault(), s(a.currentTarget);
|
|
1708
|
+
return;
|
|
1709
|
+
}
|
|
1710
|
+
a.key !== "ArrowLeft" && a.key !== "ArrowRight" || (a.preventDefault(), n(r(t + (a.key === "ArrowLeft" ? -16 : 16))));
|
|
1711
|
+
};
|
|
1712
|
+
return /* @__PURE__ */ P(
|
|
1713
|
+
"div",
|
|
1714
|
+
{
|
|
1715
|
+
className: "gantt-grid-splitter",
|
|
1716
|
+
style: { left: `${t - 2}px` },
|
|
1717
|
+
onPointerDown: o,
|
|
1718
|
+
onDoubleClick: (a) => s(a.currentTarget),
|
|
1719
|
+
onKeyDown: e,
|
|
1720
|
+
role: "separator",
|
|
1721
|
+
"aria-orientation": "vertical",
|
|
1722
|
+
"aria-label": "Resize task list",
|
|
1723
|
+
"aria-valuenow": t,
|
|
1724
|
+
"aria-valuemin": Ge,
|
|
1725
|
+
"aria-valuemax": Xe,
|
|
1726
|
+
tabIndex: 0
|
|
1727
|
+
}
|
|
1728
|
+
);
|
|
1729
|
+
}
|
|
1730
|
+
function Oo({
|
|
1731
|
+
width: t,
|
|
1732
|
+
onAdd: n
|
|
1733
|
+
}) {
|
|
1734
|
+
return /* @__PURE__ */ P("div", { className: "gantt-grid-footer", style: { width: `${t}px` }, children: /* @__PURE__ */ J("button", { type: "button", className: "gantt-grid-add", onClick: n, children: [
|
|
1735
|
+
/* @__PURE__ */ P("svg", { viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ P("path", { d: "M6 2.5 V9.5 M2.5 6 H9.5" }) }),
|
|
1736
|
+
"Add task"
|
|
1737
|
+
] }) });
|
|
1738
|
+
}
|
|
1739
|
+
function ko({ leftPx: t }) {
|
|
1740
|
+
return t === null ? null : /* @__PURE__ */ P(
|
|
1741
|
+
"div",
|
|
1742
|
+
{
|
|
1743
|
+
className: "gantt-today-marker",
|
|
1744
|
+
style: { left: `${t}px` },
|
|
1745
|
+
"aria-hidden": "true"
|
|
1746
|
+
}
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1749
|
+
function Po({ leftPx: t }) {
|
|
1750
|
+
return t === null ? null : /* @__PURE__ */ P(
|
|
1751
|
+
"div",
|
|
1752
|
+
{
|
|
1753
|
+
className: "gantt-today-dot",
|
|
1754
|
+
style: { left: `${t}px` },
|
|
1755
|
+
"aria-hidden": "true"
|
|
1756
|
+
}
|
|
1757
|
+
);
|
|
1758
|
+
}
|
|
1759
|
+
function ht(t) {
|
|
1760
|
+
const n = Z(t);
|
|
1761
|
+
return Rt(() => {
|
|
1762
|
+
n.current = t;
|
|
1763
|
+
}), n;
|
|
1764
|
+
}
|
|
1765
|
+
const To = 400, Eo = 10;
|
|
1766
|
+
function le(t, n, r = document) {
|
|
1767
|
+
if (t.pointerType === "mouse")
|
|
1768
|
+
return n(t.clientX, t.clientY), null;
|
|
1769
|
+
let o = t.clientX, s = t.clientY, e;
|
|
1770
|
+
const a = () => {
|
|
1771
|
+
e !== void 0 && clearTimeout(e), e = void 0, r.removeEventListener("pointermove", i), r.removeEventListener("pointerup", c), r.removeEventListener("pointercancel", c);
|
|
1772
|
+
};
|
|
1773
|
+
function i(u) {
|
|
1774
|
+
const l = u;
|
|
1775
|
+
if (l.pointerId !== t.pointerId) return;
|
|
1776
|
+
if (Math.abs(l.clientX - t.clientX) + Math.abs(l.clientY - t.clientY) > Eo) {
|
|
1777
|
+
a();
|
|
1778
|
+
return;
|
|
1779
|
+
}
|
|
1780
|
+
o = l.clientX, s = l.clientY;
|
|
1781
|
+
}
|
|
1782
|
+
function c(u) {
|
|
1783
|
+
u.pointerId === t.pointerId && a();
|
|
1784
|
+
}
|
|
1785
|
+
return r.addEventListener("pointermove", i), r.addEventListener("pointerup", c), r.addEventListener("pointercancel", c), e = setTimeout(() => {
|
|
1786
|
+
a(), n(o, s);
|
|
1787
|
+
}, To), a;
|
|
1788
|
+
}
|
|
1789
|
+
function ue() {
|
|
1790
|
+
const t = (n) => n.preventDefault();
|
|
1791
|
+
return document.addEventListener("touchmove", t, { passive: !1 }), () => document.removeEventListener("touchmove", t);
|
|
1792
|
+
}
|
|
1793
|
+
const en = 0.25;
|
|
1794
|
+
function Lo({
|
|
1795
|
+
rows: t,
|
|
1796
|
+
virtualItems: n,
|
|
1797
|
+
bodyRef: r,
|
|
1798
|
+
hierarchy: o,
|
|
1799
|
+
move: s
|
|
1800
|
+
}) {
|
|
1801
|
+
const e = yt(), a = Q((p) => p.reorderDraft), i = ht(t), c = ht(n), u = ht(s), l = Z(null), f = Z(null);
|
|
1802
|
+
it(
|
|
1803
|
+
() => () => {
|
|
1804
|
+
var p, d;
|
|
1805
|
+
(p = l.current) == null || p.call(l), (d = f.current) == null || d.call(f);
|
|
1806
|
+
},
|
|
1807
|
+
[]
|
|
1808
|
+
);
|
|
1809
|
+
const h = (p, d, m, D) => {
|
|
1810
|
+
const b = oe(e.getState().rawTasks, o);
|
|
1811
|
+
try {
|
|
1812
|
+
D.setPointerCapture(d);
|
|
1813
|
+
} catch {
|
|
1814
|
+
}
|
|
1815
|
+
const S = m === "mouse" ? null : ue(), L = document.body.style.cursor;
|
|
1816
|
+
document.body.style.cursor = "grabbing";
|
|
1817
|
+
const N = (U) => {
|
|
1818
|
+
const T = r.current;
|
|
1819
|
+
if (!T) return null;
|
|
1820
|
+
const M = U - T.getBoundingClientRect().top, I = c.current.find(
|
|
1821
|
+
(X) => M >= X.start && M < X.start + X.size
|
|
1822
|
+
);
|
|
1823
|
+
if (!I) return null;
|
|
1824
|
+
const y = i.current[I.index], $ = y == null ? void 0 : y.tasks[0];
|
|
1825
|
+
if (!y || !$ || y.tasks.length > 1) return null;
|
|
1826
|
+
const k = (M - I.start) / I.size, E = k < en ? "before" : k > 1 - en ? "after" : "child", C = jr(b, p, $.id, E);
|
|
1827
|
+
return {
|
|
1828
|
+
taskId: p,
|
|
1829
|
+
rowIndex: I.index,
|
|
1830
|
+
mode: E,
|
|
1831
|
+
depth: E === "child" ? y.depth + 1 : y.depth,
|
|
1832
|
+
move: C,
|
|
1833
|
+
rejection: u.current.validate(C)
|
|
1834
|
+
};
|
|
1835
|
+
};
|
|
1836
|
+
let x = null;
|
|
1837
|
+
const _ = (U) => {
|
|
1838
|
+
U.pointerId === d && (x = U.clientY, e.getState().setReorderDraft(N(U.clientY)));
|
|
1839
|
+
}, A = () => {
|
|
1840
|
+
S == null || S(), document.body.style.cursor = L, document.removeEventListener("pointermove", _), document.removeEventListener("pointerup", F), document.removeEventListener("pointercancel", g), document.removeEventListener("keydown", R);
|
|
1841
|
+
try {
|
|
1842
|
+
D.releasePointerCapture(d);
|
|
1843
|
+
} catch {
|
|
1844
|
+
}
|
|
1845
|
+
}, v = () => {
|
|
1846
|
+
A(), f.current = null, e.getState().setReorderDraft(null);
|
|
1847
|
+
}, g = (U) => {
|
|
1848
|
+
U.pointerId === d && v();
|
|
1849
|
+
};
|
|
1850
|
+
function R(U) {
|
|
1851
|
+
U.key === "Escape" && v();
|
|
1852
|
+
}
|
|
1853
|
+
function F(U) {
|
|
1854
|
+
if (U.pointerId !== d) return;
|
|
1855
|
+
const T = x === null ? null : N(x) ?? e.getState().reorderDraft;
|
|
1856
|
+
v(), T != null && T.move && !T.rejection && u.current.apply(T.move);
|
|
1857
|
+
}
|
|
1858
|
+
f.current = v, document.addEventListener("pointermove", _), document.addEventListener("pointerup", F), document.addEventListener("pointercancel", g), document.addEventListener("keydown", R);
|
|
1859
|
+
};
|
|
1860
|
+
return { onGripPointerDown: (p, d) => {
|
|
1861
|
+
var L, N;
|
|
1862
|
+
if (!d.isPrimary || d.button !== 0 || f.current) return;
|
|
1863
|
+
(L = l.current) == null || L.call(l), l.current = null;
|
|
1864
|
+
const m = (N = i.current[p]) == null ? void 0 : N.tasks[0];
|
|
1865
|
+
if (!m) return;
|
|
1866
|
+
const D = d.currentTarget, { pointerId: b, pointerType: S } = d;
|
|
1867
|
+
l.current = le(
|
|
1868
|
+
{ pointerType: S, pointerId: b, clientX: d.clientX, clientY: d.clientY },
|
|
1869
|
+
() => {
|
|
1870
|
+
l.current = null, h(m.id, b, S, D);
|
|
1871
|
+
}
|
|
1872
|
+
);
|
|
1873
|
+
}, draft: a };
|
|
1874
|
+
}
|
|
1875
|
+
const nn = 5, ge = (t, n) => Math.min(Math.max(t, 0), Math.max(n, 0));
|
|
1876
|
+
function Ao(t, n, r) {
|
|
1877
|
+
var c;
|
|
1878
|
+
const o = r[n.row];
|
|
1879
|
+
if (!o) return null;
|
|
1880
|
+
const s = r.length - 1, e = ge(n.col, o.cells - 1), a = t.key === "ArrowRight" ? 1 : -1, i = t.key === "ArrowLeft" || t.key === "ArrowRight";
|
|
1881
|
+
if (i && (t.altKey || t.shiftKey)) {
|
|
1882
|
+
const u = t.altKey ? t.shiftKey ? "left" : "bar" : "right";
|
|
1883
|
+
return { kind: "nudge", row: n.row, col: e, mode: u, steps: a };
|
|
1884
|
+
}
|
|
1885
|
+
if (t.altKey && (t.key === "ArrowUp" || t.key === "ArrowDown"))
|
|
1886
|
+
return {
|
|
1887
|
+
kind: "reorder",
|
|
1888
|
+
row: n.row,
|
|
1889
|
+
col: e,
|
|
1890
|
+
delta: t.key === "ArrowDown" ? 1 : -1
|
|
1891
|
+
};
|
|
1892
|
+
if (i && (t.ctrlKey || t.metaKey))
|
|
1893
|
+
return { kind: "reparent", row: n.row, col: e, direction: a };
|
|
1894
|
+
if ((t.ctrlKey || t.metaKey) && (t.key === "ArrowUp" || t.key === "ArrowDown"))
|
|
1895
|
+
return { kind: "zoom", direction: t.key === "ArrowUp" ? -1 : 1 };
|
|
1896
|
+
switch (t.key) {
|
|
1897
|
+
case "ArrowDown":
|
|
1898
|
+
return {
|
|
1899
|
+
kind: "focus",
|
|
1900
|
+
focus: { row: Math.min(n.row + 1, s), col: e }
|
|
1901
|
+
};
|
|
1902
|
+
case "ArrowUp":
|
|
1903
|
+
return {
|
|
1904
|
+
kind: "focus",
|
|
1905
|
+
focus: { row: Math.max(n.row - 1, 0), col: e }
|
|
1906
|
+
};
|
|
1907
|
+
case "ArrowRight":
|
|
1908
|
+
return e === 0 && o.expandable && !o.expanded ? { kind: "toggle", row: n.row, col: e } : {
|
|
1909
|
+
kind: "focus",
|
|
1910
|
+
focus: { row: n.row, col: ge(e + 1, o.cells - 1) }
|
|
1911
|
+
};
|
|
1912
|
+
case "ArrowLeft":
|
|
1913
|
+
return e === 0 && o.expandable && o.expanded ? { kind: "toggle", row: n.row, col: e } : {
|
|
1914
|
+
kind: "focus",
|
|
1915
|
+
focus: { row: n.row, col: ge(e - 1, o.cells - 1) }
|
|
1916
|
+
};
|
|
1917
|
+
case "Home":
|
|
1918
|
+
return t.ctrlKey || t.metaKey ? { kind: "focus", focus: { row: 0, col: 0 } } : { kind: "focus", focus: { row: n.row, col: 0 } };
|
|
1919
|
+
case "End": {
|
|
1920
|
+
const u = t.ctrlKey || t.metaKey ? s : n.row;
|
|
1921
|
+
return {
|
|
1922
|
+
kind: "focus",
|
|
1923
|
+
focus: { row: u, col: Math.max((((c = r[u]) == null ? void 0 : c.cells) ?? 1) - 1, 0) }
|
|
1924
|
+
};
|
|
1925
|
+
}
|
|
1926
|
+
case "Enter":
|
|
1927
|
+
case " ":
|
|
1928
|
+
return o.expandable ? { kind: "toggle", row: n.row, col: e } : { kind: "activate", row: n.row, col: e };
|
|
1929
|
+
case "Delete":
|
|
1930
|
+
case "Backspace":
|
|
1931
|
+
return { kind: "delete", row: n.row, col: e };
|
|
1932
|
+
case "+":
|
|
1933
|
+
case "=":
|
|
1934
|
+
return { kind: "progress", row: n.row, col: e, delta: nn };
|
|
1935
|
+
case "-":
|
|
1936
|
+
case "_":
|
|
1937
|
+
return { kind: "progress", row: n.row, col: e, delta: -nn };
|
|
1938
|
+
default:
|
|
1939
|
+
return null;
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
function No(t, n, r) {
|
|
1943
|
+
if (!(!t || !t.tasks.length))
|
|
1944
|
+
return t.tasks[Math.max(0, n - r)] ?? t.tasks[0];
|
|
1945
|
+
}
|
|
1946
|
+
function Nn(t, n, r = null) {
|
|
1947
|
+
const o = [t.name];
|
|
1948
|
+
return t.isSummary && o.push("summary"), o.push(
|
|
1949
|
+
`${n(H(t.startDate))} to ${n(H(t.endDate))}`
|
|
1950
|
+
), r !== null && o.push(`${r}% complete`), o.join(", ");
|
|
1951
|
+
}
|
|
1952
|
+
function Ro(t, n, r, o) {
|
|
1953
|
+
const s = o ? `under ${o}` : "at the top level";
|
|
1954
|
+
return `${t} moved to ${n} of ${r} ${s}`;
|
|
1955
|
+
}
|
|
1956
|
+
function Rn(t, n, r) {
|
|
1957
|
+
var o;
|
|
1958
|
+
return {
|
|
1959
|
+
role: "row",
|
|
1960
|
+
"aria-level": t.level,
|
|
1961
|
+
"aria-posinset": t.posinset,
|
|
1962
|
+
"aria-setsize": t.setsize,
|
|
1963
|
+
"aria-rowindex": n + 1 + r.headerOffset,
|
|
1964
|
+
...r.expandable ? { "aria-expanded": r.expanded } : null,
|
|
1965
|
+
...(o = r.ownedIds) != null && o.length ? { "aria-owns": r.ownedIds.join(" ") } : null
|
|
1966
|
+
};
|
|
1967
|
+
}
|
|
1968
|
+
function rn(t, n) {
|
|
1969
|
+
return !t && !n ? null : { min: t ? H(t) : void 0, max: n ? H(n) : void 0 };
|
|
1970
|
+
}
|
|
1971
|
+
function _o(t, n, r, o, s, e) {
|
|
1972
|
+
const { canMove: a, canResize: i, minDate: c, maxDate: u } = Dt(
|
|
1973
|
+
n,
|
|
1974
|
+
e
|
|
1975
|
+
);
|
|
1976
|
+
if ((r === "bar" ? !a : !i) || !o) return null;
|
|
1977
|
+
const l = new Set(
|
|
1978
|
+
n.isSummary && r === "bar" ? ie(t, n.id) : [n.id]
|
|
1979
|
+
), f = rn(c, u), h = H(n.startDate), w = H(n.endDate);
|
|
1980
|
+
let p = r === "right" ? h : Et(h, o, s), d = r === "left" ? w : Et(w, o, s), m = null;
|
|
1981
|
+
if (r === "bar") {
|
|
1982
|
+
const b = [];
|
|
1983
|
+
for (const S of t) {
|
|
1984
|
+
if (!l.has(S.id)) continue;
|
|
1985
|
+
const L = Dt(S, e), N = S.id === n.id ? f : rn(L.minDate, L.maxDate);
|
|
1986
|
+
N && b.push({
|
|
1987
|
+
start: S.id === n.id ? h : H(S.startDate),
|
|
1988
|
+
end: S.id === n.id ? w : H(S.endDate),
|
|
1989
|
+
bounds: N
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1992
|
+
if (b.length) {
|
|
1993
|
+
if (m = kn(
|
|
1994
|
+
b,
|
|
1995
|
+
p.valueOf() - h.valueOf(),
|
|
1996
|
+
s
|
|
1997
|
+
), m === 0) return null;
|
|
1998
|
+
p = h.add(m, "millisecond"), d = w.add(m, "millisecond");
|
|
1999
|
+
}
|
|
2000
|
+
} else if (f) {
|
|
2001
|
+
const b = Te(r, p, d, f, s);
|
|
2002
|
+
p = b.startDate, d = b.endDate;
|
|
2003
|
+
}
|
|
2004
|
+
if (r !== "bar" && !d.isAfter(p) || r === "left" && p.valueOf() === h.valueOf() || r === "right" && d.valueOf() === w.valueOf())
|
|
2005
|
+
return null;
|
|
2006
|
+
const D = (b) => m !== null ? H(b).add(m, "millisecond").toISOString() : Et(H(b), o, s).toISOString();
|
|
2007
|
+
return t.map((b) => {
|
|
2008
|
+
if (!l.has(b.id)) return b;
|
|
2009
|
+
switch (r) {
|
|
2010
|
+
case "bar":
|
|
2011
|
+
return {
|
|
2012
|
+
...b,
|
|
2013
|
+
startDate: D(b.startDate),
|
|
2014
|
+
endDate: D(b.endDate)
|
|
2015
|
+
};
|
|
2016
|
+
case "left":
|
|
2017
|
+
return { ...b, startDate: p.toISOString() };
|
|
2018
|
+
default:
|
|
2019
|
+
return { ...b, endDate: d.toISOString() };
|
|
2020
|
+
}
|
|
2021
|
+
});
|
|
2022
|
+
}
|
|
2023
|
+
function Yo(t, n, r, o) {
|
|
2024
|
+
if (!Dt(n, o).canChangeProgress) return null;
|
|
2025
|
+
const s = Gt(n.progress);
|
|
2026
|
+
if (s === null) return null;
|
|
2027
|
+
const e = Math.min(100, Math.max(0, s + r));
|
|
2028
|
+
return e === s ? null : t.map(
|
|
2029
|
+
(a) => a.id === n.id ? { ...a, progress: e } : a
|
|
2030
|
+
);
|
|
2031
|
+
}
|
|
2032
|
+
function Ho(t, n, r) {
|
|
2033
|
+
if (!Dt(n, r).canMove) return null;
|
|
2034
|
+
const o = new Set(ie(t, n.id));
|
|
2035
|
+
if (!o.size) return null;
|
|
2036
|
+
const s = t.filter((e) => !o.has(e.id));
|
|
2037
|
+
return s.length === t.length ? null : s;
|
|
2038
|
+
}
|
|
2039
|
+
function Ee(t, n) {
|
|
2040
|
+
var r;
|
|
2041
|
+
return n && !!((r = t.tasks[0]) != null && r.isSummary);
|
|
2042
|
+
}
|
|
2043
|
+
function on(t) {
|
|
2044
|
+
return H(t.endDate).valueOf();
|
|
2045
|
+
}
|
|
2046
|
+
function Co(t) {
|
|
2047
|
+
if (t.length < 2) return t.length ? [[...t]] : [];
|
|
2048
|
+
const n = t.map((s, e) => ({ task: s, index: e })).sort((s, e) => {
|
|
2049
|
+
const a = H(s.task.startDate).valueOf() - H(e.task.startDate).valueOf();
|
|
2050
|
+
return a !== 0 ? a : s.index - e.index;
|
|
2051
|
+
}), r = [], o = [];
|
|
2052
|
+
for (const { task: s } of n) {
|
|
2053
|
+
const e = H(s.startDate).valueOf(), a = o.findIndex((i) => i <= e);
|
|
2054
|
+
a === -1 ? (r.push([s]), o.push(on(s))) : (r[a].push(s), o[a] = Math.max(o[a], on(s)));
|
|
2055
|
+
}
|
|
2056
|
+
return r;
|
|
2057
|
+
}
|
|
2058
|
+
function Fo(t) {
|
|
2059
|
+
const n = /* @__PURE__ */ new Map();
|
|
2060
|
+
for (const s of t) {
|
|
2061
|
+
if (!s.lane) continue;
|
|
2062
|
+
const e = n.get(s.lane);
|
|
2063
|
+
e ? e.push(s) : n.set(s.lane, [s]);
|
|
2064
|
+
}
|
|
2065
|
+
if (!n.size) return t.map((s) => [s]);
|
|
2066
|
+
const r = [], o = /* @__PURE__ */ new Set();
|
|
2067
|
+
for (const s of t) {
|
|
2068
|
+
if (!s.lane) {
|
|
2069
|
+
r.push([s]);
|
|
2070
|
+
continue;
|
|
2071
|
+
}
|
|
2072
|
+
o.has(s.lane) || (o.add(s.lane), r.push(...Co(n.get(s.lane) ?? [])));
|
|
2073
|
+
}
|
|
2074
|
+
return r;
|
|
2075
|
+
}
|
|
2076
|
+
function Uo(t) {
|
|
2077
|
+
const n = Fo(t), r = n.map((i) => i.map((c) => c.id).join("+")), o = [], s = /* @__PURE__ */ new Map(), e = [];
|
|
2078
|
+
n.forEach((i, c) => {
|
|
2079
|
+
const u = i[0].depth, l = u === 0 ? "" : e[u - 1] ?? "";
|
|
2080
|
+
o.push(l), s.set(l, (s.get(l) ?? 0) + 1), e[u] = r[c], e.length = u + 1;
|
|
2081
|
+
});
|
|
2082
|
+
const a = /* @__PURE__ */ new Map();
|
|
2083
|
+
return n.map((i, c) => {
|
|
2084
|
+
const u = o[c], l = (a.get(u) ?? 0) + 1;
|
|
2085
|
+
a.set(u, l);
|
|
2086
|
+
const f = i[0].depth, h = c + 1;
|
|
2087
|
+
return {
|
|
2088
|
+
id: r[c],
|
|
2089
|
+
// Only rewrapped when the row number moved, so unchanged tasks keep identity
|
|
2090
|
+
tasks: i.map((w) => w.order === h ? w : { ...w, order: h }),
|
|
2091
|
+
depth: f,
|
|
2092
|
+
level: f + 1,
|
|
2093
|
+
posinset: l,
|
|
2094
|
+
setsize: s.get(u) ?? 1
|
|
2095
|
+
};
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
function Wo({
|
|
2099
|
+
rows: t,
|
|
2100
|
+
virtualItems: n,
|
|
2101
|
+
totalHeight: r,
|
|
2102
|
+
width: o,
|
|
2103
|
+
showRowNumbers: s,
|
|
2104
|
+
hierarchy: e,
|
|
2105
|
+
collapsedIds: a,
|
|
2106
|
+
onToggleCollapse: i,
|
|
2107
|
+
focus: c,
|
|
2108
|
+
reorderEnabled: u,
|
|
2109
|
+
interaction: l,
|
|
2110
|
+
move: f,
|
|
2111
|
+
selectedTaskId: h,
|
|
2112
|
+
onRowClick: w,
|
|
2113
|
+
onRowDoubleClick: p
|
|
2114
|
+
}) {
|
|
2115
|
+
const d = Z(null), { onGripPointerDown: m, draft: D } = Lo({
|
|
2116
|
+
rows: t,
|
|
2117
|
+
virtualItems: n,
|
|
2118
|
+
bodyRef: d,
|
|
2119
|
+
hierarchy: e,
|
|
2120
|
+
move: f
|
|
2121
|
+
}), b = D ? n.find((S) => S.index === D.rowIndex) : void 0;
|
|
2122
|
+
return /* @__PURE__ */ J(
|
|
2123
|
+
"div",
|
|
2124
|
+
{
|
|
2125
|
+
className: "gantt-grid",
|
|
2126
|
+
style: { width: `${o}px` },
|
|
2127
|
+
role: "presentation",
|
|
2128
|
+
children: [
|
|
2129
|
+
/* @__PURE__ */ J(
|
|
2130
|
+
"div",
|
|
2131
|
+
{
|
|
2132
|
+
className: "gantt-grid-header",
|
|
2133
|
+
style: { height: `${gr}px` },
|
|
2134
|
+
role: "row",
|
|
2135
|
+
"aria-rowindex": 1,
|
|
2136
|
+
children: [
|
|
2137
|
+
/* @__PURE__ */ P("div", { className: "gantt-grid-header-cell", role: "columnheader", children: /* @__PURE__ */ P("span", { className: "gantt-sr-only", children: "Task name" }) }),
|
|
2138
|
+
/* @__PURE__ */ P("span", { className: "gantt-sr-only", role: "columnheader", children: "Timeline" })
|
|
2139
|
+
]
|
|
2140
|
+
}
|
|
2141
|
+
),
|
|
2142
|
+
/* @__PURE__ */ J(
|
|
2143
|
+
"div",
|
|
2144
|
+
{
|
|
2145
|
+
ref: d,
|
|
2146
|
+
className: "gantt-grid-body",
|
|
2147
|
+
style: { height: `${r}px` },
|
|
2148
|
+
role: "rowgroup",
|
|
2149
|
+
children: [
|
|
2150
|
+
n.map((S) => {
|
|
2151
|
+
const L = t[S.index];
|
|
2152
|
+
if (!L) return null;
|
|
2153
|
+
const N = L.tasks[0], x = Ee(L, e), _ = a.has(L.id), A = c.row === S.index, v = Rn(L, S.index, {
|
|
2154
|
+
headerOffset: 1,
|
|
2155
|
+
expandable: x,
|
|
2156
|
+
expanded: !_,
|
|
2157
|
+
ownedIds: L.tasks.map((F) => `task-${F.id}`)
|
|
2158
|
+
}), g = {
|
|
2159
|
+
height: `${S.size}px`,
|
|
2160
|
+
transform: `translateY(${S.start}px)`
|
|
2161
|
+
};
|
|
2162
|
+
if (!N) return null;
|
|
2163
|
+
const R = u && L.tasks.length === 1 && Dt(N, l).canReorder;
|
|
2164
|
+
return /* @__PURE__ */ P(
|
|
2165
|
+
"div",
|
|
2166
|
+
{
|
|
2167
|
+
"data-row-id": L.id,
|
|
2168
|
+
className: [
|
|
2169
|
+
"gantt-grid-row",
|
|
2170
|
+
N.isSummary ? "summary" : "",
|
|
2171
|
+
N.id === h ? "selected" : "",
|
|
2172
|
+
N.id === (D == null ? void 0 : D.taskId) ? "dragging" : "",
|
|
2173
|
+
N.className ?? ""
|
|
2174
|
+
].filter(Boolean).join(" "),
|
|
2175
|
+
style: g,
|
|
2176
|
+
onClick: w && ((F) => w(N, F)),
|
|
2177
|
+
onDoubleClick: p && ((F) => p(N, F)),
|
|
2178
|
+
...v,
|
|
2179
|
+
children: /* @__PURE__ */ J(
|
|
2180
|
+
"div",
|
|
2181
|
+
{
|
|
2182
|
+
className: "gantt-grid-cell",
|
|
2183
|
+
title: N.name,
|
|
2184
|
+
role: "gridcell",
|
|
2185
|
+
tabIndex: A && c.col === 0 ? 0 : -1,
|
|
2186
|
+
"data-gantt-cell": `${S.index}:0`,
|
|
2187
|
+
children: [
|
|
2188
|
+
u && (R ? /* @__PURE__ */ P(
|
|
2189
|
+
"button",
|
|
2190
|
+
{
|
|
2191
|
+
type: "button",
|
|
2192
|
+
className: "gantt-grid-grip",
|
|
2193
|
+
onPointerDown: (F) => {
|
|
2194
|
+
F.stopPropagation(), m(S.index, F);
|
|
2195
|
+
},
|
|
2196
|
+
tabIndex: -1,
|
|
2197
|
+
"aria-hidden": "true",
|
|
2198
|
+
children: /* @__PURE__ */ J("svg", { viewBox: "0 0 12 12", "aria-hidden": "true", children: [
|
|
2199
|
+
/* @__PURE__ */ P("circle", { cx: "4.5", cy: "2.5", r: "1.1" }),
|
|
2200
|
+
/* @__PURE__ */ P("circle", { cx: "7.5", cy: "2.5", r: "1.1" }),
|
|
2201
|
+
/* @__PURE__ */ P("circle", { cx: "4.5", cy: "6", r: "1.1" }),
|
|
2202
|
+
/* @__PURE__ */ P("circle", { cx: "7.5", cy: "6", r: "1.1" }),
|
|
2203
|
+
/* @__PURE__ */ P("circle", { cx: "4.5", cy: "9.5", r: "1.1" }),
|
|
2204
|
+
/* @__PURE__ */ P("circle", { cx: "7.5", cy: "9.5", r: "1.1" })
|
|
2205
|
+
] })
|
|
2206
|
+
}
|
|
2207
|
+
) : (
|
|
2208
|
+
// Holds the space so the row's text does not jog
|
|
2209
|
+
/* @__PURE__ */ P("span", { className: "gantt-grid-grip-spacer" })
|
|
2210
|
+
)),
|
|
2211
|
+
s && /* @__PURE__ */ P("span", { className: "gantt-grid-no", children: N.sequence }),
|
|
2212
|
+
/* @__PURE__ */ P(
|
|
2213
|
+
"span",
|
|
2214
|
+
{
|
|
2215
|
+
className: "gantt-grid-indent",
|
|
2216
|
+
style: { width: `${L.depth * Be}px` }
|
|
2217
|
+
}
|
|
2218
|
+
),
|
|
2219
|
+
x ? /* @__PURE__ */ P(
|
|
2220
|
+
"button",
|
|
2221
|
+
{
|
|
2222
|
+
type: "button",
|
|
2223
|
+
className: `gantt-grid-expander${_ ? "" : " open"}`,
|
|
2224
|
+
onClick: (F) => {
|
|
2225
|
+
F.stopPropagation(), i(L.id);
|
|
2226
|
+
},
|
|
2227
|
+
tabIndex: -1,
|
|
2228
|
+
"aria-hidden": "true",
|
|
2229
|
+
children: /* @__PURE__ */ P("svg", { viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ P("path", { d: "M4 2.5 L8 6 L4 9.5" }) })
|
|
2230
|
+
}
|
|
2231
|
+
) : (
|
|
2232
|
+
// Holds the space so untoggled rows start their text in the same place
|
|
2233
|
+
/* @__PURE__ */ P("span", { className: "gantt-grid-expander-spacer" })
|
|
2234
|
+
),
|
|
2235
|
+
/* @__PURE__ */ P("span", { className: "gantt-grid-cell-text", children: N.name }),
|
|
2236
|
+
L.tasks.length > 1 && /* @__PURE__ */ J("span", { className: "gantt-grid-lane-count", children: [
|
|
2237
|
+
"+",
|
|
2238
|
+
L.tasks.length - 1
|
|
2239
|
+
] })
|
|
2240
|
+
]
|
|
2241
|
+
}
|
|
2242
|
+
)
|
|
2243
|
+
},
|
|
2244
|
+
`grid-row-${L.id}`
|
|
2245
|
+
);
|
|
2246
|
+
}),
|
|
2247
|
+
D && b && /* @__PURE__ */ P(
|
|
2248
|
+
"div",
|
|
2249
|
+
{
|
|
2250
|
+
className: [
|
|
2251
|
+
"gantt-grid-drop",
|
|
2252
|
+
D.mode === "child" ? "child" : "",
|
|
2253
|
+
D.rejection ? "blocked" : ""
|
|
2254
|
+
].filter(Boolean).join(" "),
|
|
2255
|
+
style: D.mode === "child" ? { top: `${b.start}px`, height: `${b.size}px` } : {
|
|
2256
|
+
top: `${b.start + (D.mode === "after" ? b.size : 0)}px`,
|
|
2257
|
+
marginLeft: `${D.depth * Be}px`
|
|
2258
|
+
},
|
|
2259
|
+
"aria-hidden": "true"
|
|
2260
|
+
}
|
|
2261
|
+
)
|
|
2262
|
+
]
|
|
2263
|
+
}
|
|
2264
|
+
)
|
|
2265
|
+
]
|
|
2266
|
+
}
|
|
2267
|
+
);
|
|
2268
|
+
}
|
|
2269
|
+
function sn(t, n) {
|
|
2270
|
+
return !t && !n ? null : {
|
|
2271
|
+
min: t ? H(t) : void 0,
|
|
2272
|
+
max: n ? H(n) : void 0
|
|
2273
|
+
};
|
|
2274
|
+
}
|
|
2275
|
+
function Go(t, n = {}, r, o) {
|
|
2276
|
+
const s = yt(), e = Z(null), a = Z(null), i = Z(!1), c = Z(null), u = Z(n);
|
|
2277
|
+
u.current = n, it(() => () => {
|
|
2278
|
+
var L;
|
|
2279
|
+
return (L = c.current) == null ? void 0 : L.call(c);
|
|
2280
|
+
}, []);
|
|
2281
|
+
const l = Q((L) => L.selectedScale), { basePxPerDragStep: f } = dt[l], { canMove: h, canResize: w, minDate: p, maxDate: d } = Dt(
|
|
2282
|
+
t,
|
|
2283
|
+
r
|
|
2284
|
+
), m = (L) => {
|
|
2285
|
+
const N = L.currentTarget.getBoundingClientRect(), x = L.pointerType !== "mouse", _ = x ? yn : Wt, A = x ? vr : ke;
|
|
2286
|
+
if (w && N.width >= A) {
|
|
2287
|
+
const v = L.clientX - N.left;
|
|
2288
|
+
if (v <= _) return "left";
|
|
2289
|
+
if (v >= N.width - _) return "right";
|
|
2290
|
+
}
|
|
2291
|
+
return h ? "bar" : null;
|
|
2292
|
+
}, D = (L) => {
|
|
2293
|
+
var v;
|
|
2294
|
+
if (!L.isPrimary || L.button !== 0 || e.current) return;
|
|
2295
|
+
(v = c.current) == null || v.call(c), c.current = null;
|
|
2296
|
+
const N = m(L);
|
|
2297
|
+
if (!N) return;
|
|
2298
|
+
const x = L.currentTarget, { pointerId: _, pointerType: A } = L;
|
|
2299
|
+
c.current = le(
|
|
2300
|
+
{ pointerType: A, pointerId: _, clientX: L.clientX, clientY: L.clientY },
|
|
2301
|
+
(g) => {
|
|
2302
|
+
c.current = null, b(N, _, A, g, x);
|
|
2303
|
+
}
|
|
2304
|
+
);
|
|
2305
|
+
}, b = (L, N, x, _, A) => {
|
|
2306
|
+
a.current = L, i.current = !1;
|
|
2307
|
+
const v = A.closest(
|
|
2308
|
+
".gantt-scroll-container"
|
|
2309
|
+
), g = s.getState().rawTasks, R = t.isSummary ? ie(g, t.id) : [t.id], F = new Set(R), U = new Map(
|
|
2310
|
+
g.filter((O) => F.has(O.id)).map((O) => [
|
|
2311
|
+
O.id,
|
|
2312
|
+
{ start: H(O.startDate), end: H(O.endDate) }
|
|
2313
|
+
])
|
|
2314
|
+
);
|
|
2315
|
+
U.set(t.id, {
|
|
2316
|
+
start: H(t.startDate),
|
|
2317
|
+
end: H(t.endDate)
|
|
2318
|
+
});
|
|
2319
|
+
const T = sn(p, d), M = [];
|
|
2320
|
+
for (const O of g) {
|
|
2321
|
+
if (!F.has(O.id)) continue;
|
|
2322
|
+
const G = U.get(O.id);
|
|
2323
|
+
if (!G) continue;
|
|
2324
|
+
const B = Dt(O, r), ct = O.id === t.id ? T : sn(B.minDate, B.maxDate);
|
|
2325
|
+
ct && M.push({
|
|
2326
|
+
start: G.start,
|
|
2327
|
+
end: G.end,
|
|
2328
|
+
bounds: ct
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2331
|
+
e.current = {
|
|
2332
|
+
mode: L,
|
|
2333
|
+
pointerId: N,
|
|
2334
|
+
initialClientX: _,
|
|
2335
|
+
initialStartDate: H(t.startDate),
|
|
2336
|
+
initialEndDate: H(t.endDate),
|
|
2337
|
+
initialBarWidth: t.barWidth,
|
|
2338
|
+
dragSteps: 0,
|
|
2339
|
+
basePxPerDragStep: f,
|
|
2340
|
+
lastClientX: _,
|
|
2341
|
+
autoScrollPx: 0,
|
|
2342
|
+
scaleKey: l,
|
|
2343
|
+
taskId: t.id,
|
|
2344
|
+
taskIds: R,
|
|
2345
|
+
initialDates: U,
|
|
2346
|
+
snapDays: 0,
|
|
2347
|
+
bounds: T,
|
|
2348
|
+
boundedMembers: M,
|
|
2349
|
+
moveDeltaMs: null,
|
|
2350
|
+
clamped: null
|
|
2351
|
+
}, s.getState().setCurrentTask(t), s.getState().setDragMode(L), A.focus({ preventScroll: !0 });
|
|
2352
|
+
try {
|
|
2353
|
+
A.setPointerCapture(N);
|
|
2354
|
+
} catch {
|
|
2355
|
+
}
|
|
2356
|
+
const I = x === "mouse" ? null : ue(), y = () => {
|
|
2357
|
+
const O = e.current;
|
|
2358
|
+
if (!O) return;
|
|
2359
|
+
const G = O.lastClientX - O.initialClientX + O.autoScrollPx, B = Math.round(G / O.basePxPerDragStep), ct = Math.floor(
|
|
2360
|
+
(O.initialBarWidth - O.basePxPerDragStep) / O.basePxPerDragStep
|
|
2361
|
+
);
|
|
2362
|
+
let st = B;
|
|
2363
|
+
if (O.mode === "left" && (st = Math.min(B, ct)), O.mode === "right" && (st = Math.max(B, -ct)), st === O.dragSteps) return;
|
|
2364
|
+
O.dragSteps = st, i.current = !0;
|
|
2365
|
+
const bt = st * O.basePxPerDragStep, at = (W) => Et(W, st, O.scaleKey);
|
|
2366
|
+
let nt, K, V = 0, $t = 0;
|
|
2367
|
+
switch (O.mode) {
|
|
2368
|
+
case "bar":
|
|
2369
|
+
nt = at(O.initialStartDate), K = at(O.initialEndDate), V = bt, $t = 0;
|
|
2370
|
+
break;
|
|
2371
|
+
case "left":
|
|
2372
|
+
nt = at(O.initialStartDate), K = O.initialEndDate, V = bt, $t = -bt;
|
|
2373
|
+
break;
|
|
2374
|
+
case "right":
|
|
2375
|
+
nt = O.initialStartDate, K = at(O.initialEndDate), V = 0, $t = bt;
|
|
2376
|
+
break;
|
|
2377
|
+
}
|
|
2378
|
+
let lt = 0;
|
|
2379
|
+
if (o != null && o.skipsNonWorkingDays) {
|
|
2380
|
+
const W = O.mode === "right" ? K : nt, et = o.snapForward(W);
|
|
2381
|
+
lt = et.diff(W, "day"), O.mode === "left" && et.valueOf() >= K.valueOf() && (lt = 0);
|
|
2382
|
+
}
|
|
2383
|
+
O.snapDays = lt;
|
|
2384
|
+
const St = lt ? pe(
|
|
2385
|
+
nt,
|
|
2386
|
+
nt.add(lt, "day"),
|
|
2387
|
+
O.scaleKey
|
|
2388
|
+
) : 0;
|
|
2389
|
+
if (lt && (O.mode !== "right" && (nt = nt.add(lt, "day"), V += St), O.mode !== "left" && (K = K.add(lt, "day")), O.mode === "left" && ($t -= St), O.mode === "right" && ($t += St)), O.mode === "bar") {
|
|
2390
|
+
if (O.boundedMembers.length) {
|
|
2391
|
+
const W = nt.valueOf() - O.initialStartDate.valueOf(), et = kn(
|
|
2392
|
+
O.boundedMembers,
|
|
2393
|
+
W,
|
|
2394
|
+
O.scaleKey
|
|
2395
|
+
);
|
|
2396
|
+
O.moveDeltaMs = et, nt = O.initialStartDate.add(et, "millisecond"), K = O.initialEndDate.add(et, "millisecond");
|
|
2397
|
+
}
|
|
2398
|
+
} else if (O.bounds) {
|
|
2399
|
+
const W = Te(
|
|
2400
|
+
O.mode,
|
|
2401
|
+
nt,
|
|
2402
|
+
K,
|
|
2403
|
+
O.bounds,
|
|
2404
|
+
O.scaleKey
|
|
2405
|
+
);
|
|
2406
|
+
O.clamped = W, nt = W.startDate, K = W.endDate;
|
|
2407
|
+
}
|
|
2408
|
+
if (O.moveDeltaMs !== null || O.clamped) {
|
|
2409
|
+
const W = pe(
|
|
2410
|
+
O.initialStartDate,
|
|
2411
|
+
nt,
|
|
2412
|
+
O.scaleKey
|
|
2413
|
+
), et = pe(
|
|
2414
|
+
O.initialEndDate,
|
|
2415
|
+
K,
|
|
2416
|
+
O.scaleKey
|
|
2417
|
+
);
|
|
2418
|
+
V = W, $t = et - W;
|
|
2419
|
+
}
|
|
2420
|
+
const Mt = O.moveDeltaMs !== null ? (W) => W.add(O.moveDeltaMs, "millisecond") : (W) => at(W).add(lt, "day"), Ot = O.moveDeltaMs !== null ? V : bt + St, Y = {};
|
|
2421
|
+
for (const W of O.taskIds) {
|
|
2422
|
+
const et = O.initialDates.get(W), mt = W === O.taskId || !et, ft = mt ? nt : Mt(et.start), Bt = mt ? K : Mt(et.end);
|
|
2423
|
+
Y[W] = {
|
|
2424
|
+
offsetX: mt ? V : Ot,
|
|
2425
|
+
offsetWidth: mt ? $t : 0,
|
|
2426
|
+
offsetStartDate: ft,
|
|
2427
|
+
offsetEndDate: Bt
|
|
2428
|
+
};
|
|
2429
|
+
}
|
|
2430
|
+
s.getState().setDragOffsets(Y);
|
|
2431
|
+
};
|
|
2432
|
+
let $ = null, k = 0;
|
|
2433
|
+
const E = () => {
|
|
2434
|
+
$ !== null && cancelAnimationFrame($), $ = null, k = 0;
|
|
2435
|
+
}, C = (O) => {
|
|
2436
|
+
!v || !O.autoScrollPx || (v.scrollBy({ left: -O.autoScrollPx, behavior: "smooth" }), O.autoScrollPx = 0);
|
|
2437
|
+
}, X = () => {
|
|
2438
|
+
$ = null;
|
|
2439
|
+
const O = e.current;
|
|
2440
|
+
if (!O || !v || k === 0) return;
|
|
2441
|
+
const G = v.scrollLeft;
|
|
2442
|
+
v.scrollLeft = G + k;
|
|
2443
|
+
const B = v.scrollLeft - G;
|
|
2444
|
+
B !== 0 && (O.autoScrollPx += B, y()), $ = requestAnimationFrame(X);
|
|
2445
|
+
}, q = (O) => {
|
|
2446
|
+
if (u.current.autoScroll === !1 || !v) return;
|
|
2447
|
+
const G = v.getBoundingClientRect(), B = v.querySelector(".gantt-grid");
|
|
2448
|
+
k = be(
|
|
2449
|
+
O,
|
|
2450
|
+
G.left + ((B == null ? void 0 : B.offsetWidth) ?? 0),
|
|
2451
|
+
G.right
|
|
2452
|
+
), k === 0 ? E() : $ === null && ($ = requestAnimationFrame(X));
|
|
2453
|
+
}, tt = (O) => {
|
|
2454
|
+
const G = e.current;
|
|
2455
|
+
!G || O.pointerId !== G.pointerId || (G.lastClientX = O.clientX, q(O.clientX), y());
|
|
2456
|
+
}, rt = () => {
|
|
2457
|
+
E(), document.removeEventListener("pointermove", tt), document.removeEventListener("pointerup", gt), document.removeEventListener("pointercancel", ot), I == null || I();
|
|
2458
|
+
}, wt = (O) => {
|
|
2459
|
+
C(O), e.current = null, a.current = null, s.getState().setCurrentTask(null), s.getState().setDragMode(null), s.getState().clearDragOffsets(O.taskIds);
|
|
2460
|
+
}, ot = (O) => {
|
|
2461
|
+
const G = e.current;
|
|
2462
|
+
G && O.pointerId !== G.pointerId || (rt(), G && wt(G));
|
|
2463
|
+
}, gt = (O) => {
|
|
2464
|
+
var lt, St, Mt, Ot;
|
|
2465
|
+
const G = e.current;
|
|
2466
|
+
if (G && O.pointerId !== G.pointerId) return;
|
|
2467
|
+
rt();
|
|
2468
|
+
const B = G;
|
|
2469
|
+
if (!B)
|
|
2470
|
+
return;
|
|
2471
|
+
if (B.dragSteps === 0) {
|
|
2472
|
+
wt(B);
|
|
2473
|
+
return;
|
|
2474
|
+
}
|
|
2475
|
+
const ct = s.getState().rawTasks, st = (Y) => B.moveDeltaMs !== null ? H(Y).add(B.moveDeltaMs, "millisecond").toISOString() : Et(H(Y), B.dragSteps, B.scaleKey).add(B.snapDays, "day").toISOString(), bt = (lt = B.clamped) == null ? void 0 : lt.startDate.toISOString(), at = (St = B.clamped) == null ? void 0 : St.endDate.toISOString(), nt = new Set(B.taskIds), K = ct.map((Y) => {
|
|
2476
|
+
if (!nt.has(Y.id)) return Y;
|
|
2477
|
+
switch (B.mode) {
|
|
2478
|
+
case "bar":
|
|
2479
|
+
return {
|
|
2480
|
+
...Y,
|
|
2481
|
+
startDate: st(Y.startDate),
|
|
2482
|
+
endDate: st(Y.endDate)
|
|
2483
|
+
};
|
|
2484
|
+
case "left":
|
|
2485
|
+
return {
|
|
2486
|
+
...Y,
|
|
2487
|
+
startDate: bt ?? st(Y.startDate)
|
|
2488
|
+
};
|
|
2489
|
+
case "right":
|
|
2490
|
+
return {
|
|
2491
|
+
...Y,
|
|
2492
|
+
endDate: at ?? st(Y.endDate)
|
|
2493
|
+
};
|
|
2494
|
+
}
|
|
2495
|
+
});
|
|
2496
|
+
e.current = null, a.current = null, s.getState().setCurrentTask(null), s.getState().setDragMode(null);
|
|
2497
|
+
const V = new Map(
|
|
2498
|
+
K.filter((Y) => nt.has(Y.id)).map((Y) => [Y.id, Y])
|
|
2499
|
+
), $t = s.getState().rawTasks.map((Y) => V.get(Y.id) ?? Y);
|
|
2500
|
+
s.getState().setRawTasks($t), (Ot = (Mt = u.current).onTasksChange) == null || Ot.call(Mt, $t);
|
|
2501
|
+
};
|
|
2502
|
+
document.addEventListener("pointermove", tt), document.addEventListener("pointerup", gt), document.addEventListener("pointercancel", ot);
|
|
2503
|
+
}, S = () => i.current ? (i.current = !1, !0) : !1;
|
|
2504
|
+
return {
|
|
2505
|
+
onPointerDown: D,
|
|
2506
|
+
dragMode: a.current,
|
|
2507
|
+
consumeDragClick: S
|
|
2508
|
+
};
|
|
2509
|
+
}
|
|
2510
|
+
const $e = {
|
|
2511
|
+
hoverTaskId: null,
|
|
2512
|
+
hoverAnchor: null,
|
|
2513
|
+
rejection: null
|
|
2514
|
+
};
|
|
2515
|
+
function Xo({
|
|
2516
|
+
task: t,
|
|
2517
|
+
interaction: n,
|
|
2518
|
+
onTasksChange: r,
|
|
2519
|
+
onDependencyCreate: o
|
|
2520
|
+
}) {
|
|
2521
|
+
const s = yt(), e = Z(null), a = Z(null);
|
|
2522
|
+
return it(() => () => {
|
|
2523
|
+
var c;
|
|
2524
|
+
return (c = a.current) == null ? void 0 : c.call(a);
|
|
2525
|
+
}, []), { startLink: (c) => (u) => {
|
|
2526
|
+
if (!u.isPrimary || u.button !== 0 || e.current !== null) return;
|
|
2527
|
+
u.stopPropagation(), u.preventDefault();
|
|
2528
|
+
const l = u.currentTarget, f = l.closest(".gantt-content"), h = l.closest(".gantt-scroll-container");
|
|
2529
|
+
if (!f) return;
|
|
2530
|
+
const w = u.pointerId;
|
|
2531
|
+
e.current = w;
|
|
2532
|
+
try {
|
|
2533
|
+
l.setPointerCapture(w);
|
|
2534
|
+
} catch {
|
|
2535
|
+
}
|
|
2536
|
+
const p = u.clientX, d = u.clientY;
|
|
2537
|
+
let m = !1, D = p, b = d;
|
|
2538
|
+
const S = document.body.style.cursor, L = ($, k) => {
|
|
2539
|
+
const E = f.getBoundingClientRect(), C = po(
|
|
2540
|
+
s.getState().rowTasks,
|
|
2541
|
+
$ - E.left,
|
|
2542
|
+
k - E.top,
|
|
2543
|
+
xt,
|
|
2544
|
+
br
|
|
2545
|
+
);
|
|
2546
|
+
if (!C) return $e;
|
|
2547
|
+
const X = s.getState().rawTasks, q = X.find((rt) => rt.id === C.task.id);
|
|
2548
|
+
return C.task.id === t.id || q !== void 0 && Dt(q, n).canCreateLink ? {
|
|
2549
|
+
hoverTaskId: C.task.id,
|
|
2550
|
+
hoverAnchor: C.anchor,
|
|
2551
|
+
rejection: go(X, t.id, C.task.id)
|
|
2552
|
+
} : $e;
|
|
2553
|
+
}, N = ($, k) => {
|
|
2554
|
+
const E = f.getBoundingClientRect();
|
|
2555
|
+
s.getState().setLinkDraft({
|
|
2556
|
+
fromTaskId: t.id,
|
|
2557
|
+
fromAnchor: c,
|
|
2558
|
+
toX: $ - E.left,
|
|
2559
|
+
toY: k - E.top,
|
|
2560
|
+
...L($, k)
|
|
2561
|
+
});
|
|
2562
|
+
};
|
|
2563
|
+
let x = null, _ = 0, A = 0;
|
|
2564
|
+
const v = () => {
|
|
2565
|
+
x !== null && cancelAnimationFrame(x), x = null, _ = 0, A = 0;
|
|
2566
|
+
}, g = () => {
|
|
2567
|
+
if (x = null, !h || _ === 0 && A === 0) return;
|
|
2568
|
+
const $ = h.scrollLeft, k = h.scrollTop;
|
|
2569
|
+
if (h.scrollLeft = $ + _, h.scrollTop = k + A, h.scrollLeft === $ && h.scrollTop === k) {
|
|
2570
|
+
v();
|
|
2571
|
+
return;
|
|
2572
|
+
}
|
|
2573
|
+
N(D, b), x = requestAnimationFrame(g);
|
|
2574
|
+
}, R = ($, k) => {
|
|
2575
|
+
if (!h) return;
|
|
2576
|
+
const E = h.getBoundingClientRect(), C = h.querySelector(".gantt-grid");
|
|
2577
|
+
_ = be(
|
|
2578
|
+
$,
|
|
2579
|
+
E.left + ((C == null ? void 0 : C.offsetWidth) ?? 0),
|
|
2580
|
+
E.right
|
|
2581
|
+
), A = be(k, E.top, E.bottom), _ === 0 && A === 0 ? v() : x === null && (x = requestAnimationFrame(g));
|
|
2582
|
+
}, F = ($) => {
|
|
2583
|
+
if ($.pointerId === w) {
|
|
2584
|
+
if (D = $.clientX, b = $.clientY, !m) {
|
|
2585
|
+
if (Math.abs(D - p) < je && Math.abs(b - d) < je)
|
|
2586
|
+
return;
|
|
2587
|
+
m = !0, s.getState().setSelectedDependency(null), document.body.style.cursor = "crosshair";
|
|
2588
|
+
}
|
|
2589
|
+
R(D, b), N(D, b);
|
|
2590
|
+
}
|
|
2591
|
+
}, U = () => {
|
|
2592
|
+
v(), document.body.style.cursor = S, document.removeEventListener("pointermove", F), document.removeEventListener("pointerup", y), document.removeEventListener("pointercancel", M), document.removeEventListener("keydown", I);
|
|
2593
|
+
try {
|
|
2594
|
+
l.releasePointerCapture(w);
|
|
2595
|
+
} catch {
|
|
2596
|
+
}
|
|
2597
|
+
}, T = () => {
|
|
2598
|
+
U(), a.current = null, e.current = null, s.getState().setLinkDraft(null);
|
|
2599
|
+
}, M = ($) => {
|
|
2600
|
+
$.pointerId === w && T();
|
|
2601
|
+
};
|
|
2602
|
+
function I($) {
|
|
2603
|
+
$.key === "Escape" && T();
|
|
2604
|
+
}
|
|
2605
|
+
function y($) {
|
|
2606
|
+
if ($.pointerId !== w) return;
|
|
2607
|
+
const E = m ? L($.clientX, $.clientY) : $e;
|
|
2608
|
+
if (T(), !E.hoverTaskId || !E.hoverAnchor || E.rejection) return;
|
|
2609
|
+
const C = {
|
|
2610
|
+
predecessorId: t.id,
|
|
2611
|
+
successorId: E.hoverTaskId,
|
|
2612
|
+
type: An(c, E.hoverAnchor)
|
|
2613
|
+
};
|
|
2614
|
+
if ((o == null ? void 0 : o(C)) === !1) return;
|
|
2615
|
+
const X = Do(
|
|
2616
|
+
s.getState().rawTasks,
|
|
2617
|
+
C.predecessorId,
|
|
2618
|
+
C.successorId,
|
|
2619
|
+
C.type
|
|
2620
|
+
);
|
|
2621
|
+
s.getState().setRawTasks(X), r == null || r(X);
|
|
2622
|
+
}
|
|
2623
|
+
a.current = T, document.addEventListener("pointermove", F), document.addEventListener("pointerup", y), document.addEventListener("pointercancel", M), document.addEventListener("keydown", I);
|
|
2624
|
+
} };
|
|
2625
|
+
}
|
|
2626
|
+
function Bo(t, n, r = {}) {
|
|
2627
|
+
const o = yt(), [s, e] = ut(null), a = Z(null), i = Z(null);
|
|
2628
|
+
it(() => () => {
|
|
2629
|
+
var h;
|
|
2630
|
+
return (h = i.current) == null ? void 0 : h.call(i);
|
|
2631
|
+
}, []);
|
|
2632
|
+
const c = (h) => {
|
|
2633
|
+
const w = n.current;
|
|
2634
|
+
if (!w) return null;
|
|
2635
|
+
const p = w.getBoundingClientRect();
|
|
2636
|
+
if (p.width === 0) return null;
|
|
2637
|
+
const d = (h - p.left) / p.width;
|
|
2638
|
+
return Math.round(Math.min(1, Math.max(0, d)) * 100);
|
|
2639
|
+
}, { onTasksChange: u } = r, l = (h) => {
|
|
2640
|
+
var p;
|
|
2641
|
+
h.stopPropagation(), h.preventDefault(), (p = i.current) == null || p.call(i), i.current = null;
|
|
2642
|
+
const { pointerType: w } = h;
|
|
2643
|
+
i.current = le(
|
|
2644
|
+
{
|
|
2645
|
+
pointerType: w,
|
|
2646
|
+
pointerId: h.pointerId,
|
|
2647
|
+
clientX: h.clientX,
|
|
2648
|
+
clientY: h.clientY
|
|
2649
|
+
},
|
|
2650
|
+
() => {
|
|
2651
|
+
i.current = null, f(w);
|
|
2652
|
+
}
|
|
2653
|
+
);
|
|
2654
|
+
}, f = (h) => {
|
|
2655
|
+
const w = h === "mouse" ? null : ue(), p = (m) => {
|
|
2656
|
+
const D = c(m.clientX);
|
|
2657
|
+
D !== null && (a.current = D, e(D));
|
|
2658
|
+
}, d = () => {
|
|
2659
|
+
document.removeEventListener("pointermove", p), document.removeEventListener("pointerup", d), document.removeEventListener("pointercancel", d), w == null || w();
|
|
2660
|
+
const m = a.current;
|
|
2661
|
+
if (a.current = null, m === null) {
|
|
2662
|
+
e(null);
|
|
2663
|
+
return;
|
|
2664
|
+
}
|
|
2665
|
+
const D = o.getState().rawTasks.map(
|
|
2666
|
+
(b) => b.id === t.id ? { ...b, progress: m } : b
|
|
2667
|
+
);
|
|
2668
|
+
o.getState().setRawTasks(D), e(null), u == null || u(D);
|
|
2669
|
+
};
|
|
2670
|
+
document.addEventListener("pointermove", p), document.addEventListener("pointerup", d), document.addEventListener("pointercancel", d);
|
|
2671
|
+
};
|
|
2672
|
+
return {
|
|
2673
|
+
onProgressPointerDown: l,
|
|
2674
|
+
progress: s ?? Gt(t.progress),
|
|
2675
|
+
isDraggingProgress: s !== null
|
|
2676
|
+
};
|
|
2677
|
+
}
|
|
2678
|
+
function zo({
|
|
2679
|
+
currentTask: t,
|
|
2680
|
+
options: n,
|
|
2681
|
+
interaction: r,
|
|
2682
|
+
tabIndex: o,
|
|
2683
|
+
cellCoord: s,
|
|
2684
|
+
calendar: e,
|
|
2685
|
+
autoScrollOnDrag: a,
|
|
2686
|
+
onDependencyCreate: i
|
|
2687
|
+
}) {
|
|
2688
|
+
const {
|
|
2689
|
+
onTasksChange: c,
|
|
2690
|
+
onTaskClick: u,
|
|
2691
|
+
onTaskDoubleClick: l,
|
|
2692
|
+
showTooltip: f = !0
|
|
2693
|
+
} = n, h = Z(null), { onPointerDown: w, dragMode: p, consumeDragClick: d } = Go(
|
|
2694
|
+
t,
|
|
2695
|
+
{ onTasksChange: c, autoScroll: a },
|
|
2696
|
+
r,
|
|
2697
|
+
e
|
|
2698
|
+
), { canMove: m, canResize: D, canChangeProgress: b, canCreateLink: S } = Dt(t, r), [L, N] = ut(!1), [x, _] = ut(!1), A = yt(), v = Q((Y) => Y.setHoveredTaskId), g = Z(null), R = z(() => {
|
|
2699
|
+
g.current !== null && (clearTimeout(g.current), g.current = null);
|
|
2700
|
+
}, []);
|
|
2701
|
+
it(() => {
|
|
2702
|
+
const Y = t.id;
|
|
2703
|
+
return () => {
|
|
2704
|
+
R(), A.getState().hoveredTaskId === Y && A.getState().setHoveredTaskId(null);
|
|
2705
|
+
};
|
|
2706
|
+
}, [t.id, R, A]);
|
|
2707
|
+
const { startLink: F } = Xo({
|
|
2708
|
+
task: t,
|
|
2709
|
+
interaction: r,
|
|
2710
|
+
onTasksChange: c,
|
|
2711
|
+
onDependencyCreate: i
|
|
2712
|
+
}), U = Q((Y) => {
|
|
2713
|
+
const W = Y.linkDraft;
|
|
2714
|
+
return W ? W.hoverTaskId === t.id ? ` link-${W.rejection ? "invalid" : "valid"} link-at-${W.hoverAnchor}` : W.fromTaskId === t.id ? ` link-source link-at-${W.fromAnchor}` : "" : "";
|
|
2715
|
+
}), T = S && /* @__PURE__ */ P(we, { children: ["start", "end"].map((Y) => /* @__PURE__ */ P(
|
|
2716
|
+
"span",
|
|
2717
|
+
{
|
|
2718
|
+
className: `gantt-link-handle ${Y}`,
|
|
2719
|
+
onPointerDown: F(Y),
|
|
2720
|
+
role: "button",
|
|
2721
|
+
tabIndex: -1,
|
|
2722
|
+
"aria-label": `Link from the ${Y} of ${t.name}`
|
|
2723
|
+
},
|
|
2724
|
+
Y
|
|
2725
|
+
)) }), M = Q((Y) => Y.dragOffsets[t.id]), I = Q((Y) => {
|
|
2726
|
+
var W;
|
|
2727
|
+
return ((W = Y.currentTask) == null ? void 0 : W.id) === t.id;
|
|
2728
|
+
}), y = Q((Y) => Y.selectedScale), $ = Q((Y) => Y.localeOptions), k = Q(
|
|
2729
|
+
(Y) => Y.selectedTaskId === t.id
|
|
2730
|
+
), E = (M == null ? void 0 : M.offsetX) ?? 0, C = (M == null ? void 0 : M.offsetWidth) ?? 0, X = t.barLeft + E, q = t.barWidth + C, tt = Math.max(q, yr), rt = tt < wr, { onProgressPointerDown: wt, progress: ot, isDraggingProgress: gt } = Bo(t, h, {
|
|
2731
|
+
onTasksChange: c
|
|
2732
|
+
}), O = ot !== null, G = z(
|
|
2733
|
+
(Y) => {
|
|
2734
|
+
const W = h.current;
|
|
2735
|
+
if (!W) return;
|
|
2736
|
+
const et = W.getBoundingClientRect();
|
|
2737
|
+
if (et.width < ke) {
|
|
2738
|
+
N(!1);
|
|
2739
|
+
return;
|
|
2740
|
+
}
|
|
2741
|
+
const mt = Y.clientX - et.left;
|
|
2742
|
+
N(
|
|
2743
|
+
mt <= Wt || mt >= et.width - Wt
|
|
2744
|
+
);
|
|
2745
|
+
},
|
|
2746
|
+
[]
|
|
2747
|
+
), B = (Y) => {
|
|
2748
|
+
d() || u == null || u(t, Y);
|
|
2749
|
+
}, ct = (Y) => {
|
|
2750
|
+
l == null || l(t, Y);
|
|
2751
|
+
}, st = m ? "grab" : "default", bt = I ? m || D ? "grabbing" : st : L && D ? "ew-resize" : st, { tooltip: at } = j(
|
|
2752
|
+
() => Yt(y, $),
|
|
2753
|
+
[y, $]
|
|
2754
|
+
), nt = Nn(
|
|
2755
|
+
t,
|
|
2756
|
+
at,
|
|
2757
|
+
O ? ot : null
|
|
2758
|
+
), K = (Y) => {
|
|
2759
|
+
if (!M) return "";
|
|
2760
|
+
const W = at(M.offsetStartDate), et = at(M.offsetEndDate);
|
|
2761
|
+
switch (Y) {
|
|
2762
|
+
case "left":
|
|
2763
|
+
return `Start: ${W}`;
|
|
2764
|
+
case "right":
|
|
2765
|
+
return `End: ${et}`;
|
|
2766
|
+
case "bar":
|
|
2767
|
+
default:
|
|
2768
|
+
return `${W} → ${et}`;
|
|
2769
|
+
}
|
|
2770
|
+
}, V = f ? gt ? "progress" : I && M ? p === "left" || p === "right" ? "resize" : "move" : x ? "hover" : null : null;
|
|
2771
|
+
it(() => {
|
|
2772
|
+
if (!x) return;
|
|
2773
|
+
const Y = (W) => {
|
|
2774
|
+
W.key === "Escape" && _(!1);
|
|
2775
|
+
};
|
|
2776
|
+
return document.addEventListener("keydown", Y), () => document.removeEventListener("keydown", Y);
|
|
2777
|
+
}, [x]);
|
|
2778
|
+
const $t = () => {
|
|
2779
|
+
if (!V) return null;
|
|
2780
|
+
const Y = V !== "hover", W = Y && M ? M.offsetStartDate : H(t.startDate), et = Y && M ? M.offsetEndDate : H(t.endDate);
|
|
2781
|
+
return V === "progress" ? /* @__PURE__ */ J("div", { className: "gantt-bar-tooltip", role: "status", "aria-live": "polite", children: [
|
|
2782
|
+
ot,
|
|
2783
|
+
"%"
|
|
2784
|
+
] }) : Y ? /* @__PURE__ */ P(
|
|
2785
|
+
"div",
|
|
2786
|
+
{
|
|
2787
|
+
className: "gantt-bar-tooltip gantt-sr-only",
|
|
2788
|
+
role: "status",
|
|
2789
|
+
"aria-live": "polite",
|
|
2790
|
+
children: K(p)
|
|
2791
|
+
}
|
|
2792
|
+
) : /* @__PURE__ */ J("div", { className: "gantt-bar-tooltip gantt-bar-tooltip-detail", role: "tooltip", children: [
|
|
2793
|
+
/* @__PURE__ */ P("span", { className: "gantt-tooltip-name", children: t.name }),
|
|
2794
|
+
/* @__PURE__ */ P("span", { className: "gantt-tooltip-meta", children: `${at(W)} → ${at(et)}` }),
|
|
2795
|
+
/* @__PURE__ */ J("span", { className: "gantt-tooltip-meta", children: [
|
|
2796
|
+
xn(et.valueOf() - W.valueOf()),
|
|
2797
|
+
ot !== null ? ` · ${ot}%` : ""
|
|
2798
|
+
] })
|
|
2799
|
+
] });
|
|
2800
|
+
}, lt = lo(t.color), St = {
|
|
2801
|
+
transform: `translateX(${X}px)`,
|
|
2802
|
+
width: tt,
|
|
2803
|
+
height: t.isSummary ? pr : ve,
|
|
2804
|
+
cursor: bt,
|
|
2805
|
+
...lt
|
|
2806
|
+
}, Mt = [
|
|
2807
|
+
k ? "selected" : "",
|
|
2808
|
+
t.className ?? ""
|
|
2809
|
+
].filter(Boolean).join(" "), Ot = Mt ? ` ${Mt}` : "";
|
|
2810
|
+
return /* @__PURE__ */ J(
|
|
2811
|
+
"div",
|
|
2812
|
+
{
|
|
2813
|
+
ref: h,
|
|
2814
|
+
id: `task-${t.id}`,
|
|
2815
|
+
"data-task-id": t.id,
|
|
2816
|
+
className: `gantt-task-bar${I ? " dragging" : ""}${V ? " has-tooltip" : ""}${rt ? " compact" : ""}${t.isSummary ? " summary" : ""}${D ? "" : " no-resize"}${U}${Ot}`,
|
|
2817
|
+
onPointerDown: w,
|
|
2818
|
+
onClick: B,
|
|
2819
|
+
onDoubleClick: ct,
|
|
2820
|
+
onMouseMove: G,
|
|
2821
|
+
onPointerEnter: (Y) => {
|
|
2822
|
+
Y.pointerType === "mouse" && (v(t.id), R(), g.current = setTimeout(
|
|
2823
|
+
() => _(!0),
|
|
2824
|
+
Sr
|
|
2825
|
+
));
|
|
2826
|
+
},
|
|
2827
|
+
onMouseLeave: () => {
|
|
2828
|
+
N(!1), v(null), R(), _(!1);
|
|
2829
|
+
},
|
|
2830
|
+
style: St,
|
|
2831
|
+
role: "gridcell",
|
|
2832
|
+
tabIndex: o,
|
|
2833
|
+
"data-gantt-cell": s,
|
|
2834
|
+
"aria-label": nt,
|
|
2835
|
+
children: [
|
|
2836
|
+
O && /* @__PURE__ */ J(we, { children: [
|
|
2837
|
+
/* @__PURE__ */ P(
|
|
2838
|
+
"div",
|
|
2839
|
+
{
|
|
2840
|
+
className: "gantt-progress-fill",
|
|
2841
|
+
style: { width: `${ot}%` }
|
|
2842
|
+
}
|
|
2843
|
+
),
|
|
2844
|
+
b && /* @__PURE__ */ P(
|
|
2845
|
+
"div",
|
|
2846
|
+
{
|
|
2847
|
+
className: `gantt-progress-handle${gt ? " dragging" : ""}`,
|
|
2848
|
+
style: {
|
|
2849
|
+
left: `clamp(${ze}px, ${ot}%, calc(100% - ${ze}px))`
|
|
2850
|
+
},
|
|
2851
|
+
onPointerDown: wt,
|
|
2852
|
+
role: "slider",
|
|
2853
|
+
tabIndex: -1,
|
|
2854
|
+
"aria-label": `${t.name} progress`,
|
|
2855
|
+
"aria-valuemin": 0,
|
|
2856
|
+
"aria-valuemax": 100,
|
|
2857
|
+
"aria-valuenow": ot
|
|
2858
|
+
}
|
|
2859
|
+
)
|
|
2860
|
+
] }),
|
|
2861
|
+
/* @__PURE__ */ P(
|
|
2862
|
+
"span",
|
|
2863
|
+
{
|
|
2864
|
+
className: `gantt-task-name${rt ? " outside" : ""}`,
|
|
2865
|
+
children: t.name
|
|
2866
|
+
}
|
|
2867
|
+
),
|
|
2868
|
+
T,
|
|
2869
|
+
$t()
|
|
2870
|
+
]
|
|
2871
|
+
}
|
|
2872
|
+
);
|
|
2873
|
+
}
|
|
2874
|
+
function jo({
|
|
2875
|
+
rows: t,
|
|
2876
|
+
virtualItems: n,
|
|
2877
|
+
gridColumnCount: r,
|
|
2878
|
+
focus: o,
|
|
2879
|
+
isBarVisible: s,
|
|
2880
|
+
options: e,
|
|
2881
|
+
interaction: a,
|
|
2882
|
+
calendar: i,
|
|
2883
|
+
autoScrollOnDrag: c,
|
|
2884
|
+
onDependencyCreate: u
|
|
2885
|
+
}) {
|
|
2886
|
+
return n.flatMap((l) => {
|
|
2887
|
+
const f = t[l.index];
|
|
2888
|
+
return f ? f.tasks.map((h, w) => {
|
|
2889
|
+
if (!s(h.barLeft, h.barWidth)) return null;
|
|
2890
|
+
const p = r + w;
|
|
2891
|
+
return (
|
|
2892
|
+
// styles.css lifts this wrapper's z-index while its bar has a tooltip or is being
|
|
2893
|
+
// dragged; any opaque stacking context here would trap the subtree (test-guarded).
|
|
2894
|
+
/* @__PURE__ */ P(
|
|
2895
|
+
"div",
|
|
2896
|
+
{
|
|
2897
|
+
className: "gantt-bar-wrap",
|
|
2898
|
+
style: {
|
|
2899
|
+
position: "absolute",
|
|
2900
|
+
top: 0,
|
|
2901
|
+
left: 0,
|
|
2902
|
+
height: `${l.size - 1}px`,
|
|
2903
|
+
transform: `translateY(${l.start}px)`,
|
|
2904
|
+
display: "flex",
|
|
2905
|
+
alignItems: "center"
|
|
2906
|
+
},
|
|
2907
|
+
children: /* @__PURE__ */ P(
|
|
2908
|
+
zo,
|
|
2909
|
+
{
|
|
2910
|
+
currentTask: h,
|
|
2911
|
+
options: e,
|
|
2912
|
+
interaction: a,
|
|
2913
|
+
calendar: i,
|
|
2914
|
+
autoScrollOnDrag: c,
|
|
2915
|
+
onDependencyCreate: u,
|
|
2916
|
+
tabIndex: o.row === l.index && o.col === p ? 0 : -1,
|
|
2917
|
+
cellCoord: `${l.index}:${p}`
|
|
2918
|
+
}
|
|
2919
|
+
)
|
|
2920
|
+
},
|
|
2921
|
+
h.id
|
|
2922
|
+
)
|
|
2923
|
+
);
|
|
2924
|
+
}) : [];
|
|
2925
|
+
});
|
|
2926
|
+
}
|
|
2927
|
+
function qo({
|
|
2928
|
+
ranges: t
|
|
2929
|
+
}) {
|
|
2930
|
+
const n = Q((s) => s.bottomRowCells), r = j(
|
|
2931
|
+
() => Dn(n),
|
|
2932
|
+
[n]
|
|
2933
|
+
), o = j(() => {
|
|
2934
|
+
const s = /* @__PURE__ */ new Set();
|
|
2935
|
+
return t.flatMap((e) => {
|
|
2936
|
+
if (!e.label) return [];
|
|
2937
|
+
const a = se(r, e.left), i = se(r, e.left + e.width - 1);
|
|
2938
|
+
if (!a || !i) return [];
|
|
2939
|
+
const c = e.width >= Ir && !s.has(a.index);
|
|
2940
|
+
return c && s.add(a.index), [
|
|
2941
|
+
{
|
|
2942
|
+
label: e.label,
|
|
2943
|
+
shown: c,
|
|
2944
|
+
left: e.left,
|
|
2945
|
+
width: e.width,
|
|
2946
|
+
// Relative to the band, which is what the hover target is positioned at
|
|
2947
|
+
cellLeft: a.left - e.left,
|
|
2948
|
+
cellWidth: i.left + i.width - a.left
|
|
2949
|
+
}
|
|
2950
|
+
];
|
|
2951
|
+
});
|
|
2952
|
+
}, [t, r]);
|
|
2953
|
+
return o.length ? /* @__PURE__ */ P("div", { className: "gantt-holiday-labels", children: o.map((s) => /* @__PURE__ */ P(
|
|
2954
|
+
"div",
|
|
2955
|
+
{
|
|
2956
|
+
className: "gantt-holiday-band",
|
|
2957
|
+
style: { left: `${s.left}px`, width: `${s.width}px` },
|
|
2958
|
+
children: /* @__PURE__ */ P(
|
|
2959
|
+
"div",
|
|
2960
|
+
{
|
|
2961
|
+
className: `gantt-holiday-cell${s.shown ? " shown" : ""}`,
|
|
2962
|
+
style: {
|
|
2963
|
+
left: `${s.cellLeft}px`,
|
|
2964
|
+
width: `${s.cellWidth}px`
|
|
2965
|
+
},
|
|
2966
|
+
children: /* @__PURE__ */ P("span", { children: s.label })
|
|
2967
|
+
}
|
|
2968
|
+
)
|
|
2969
|
+
},
|
|
2970
|
+
s.left
|
|
2971
|
+
)) }) : null;
|
|
2972
|
+
}
|
|
2973
|
+
function Ko({
|
|
2974
|
+
ranges: t
|
|
2975
|
+
}) {
|
|
2976
|
+
return t.length ? /* @__PURE__ */ P("div", { className: "gantt-non-working-layer", "aria-hidden": "true", children: t.map((n) => /* @__PURE__ */ P(
|
|
2977
|
+
"div",
|
|
2978
|
+
{
|
|
2979
|
+
className: "gantt-non-working-range",
|
|
2980
|
+
style: {
|
|
2981
|
+
left: `${n.left}px`,
|
|
2982
|
+
width: `${n.width}px`,
|
|
2983
|
+
...n.color && {
|
|
2984
|
+
background: `color-mix(in srgb, ${n.color} 14%, transparent)`
|
|
2985
|
+
}
|
|
2986
|
+
}
|
|
2987
|
+
},
|
|
2988
|
+
n.left
|
|
2989
|
+
)) }) : null;
|
|
2990
|
+
}
|
|
2991
|
+
function Vo({
|
|
2992
|
+
rows: t,
|
|
2993
|
+
virtualItems: n,
|
|
2994
|
+
ownedByTaskList: r,
|
|
2995
|
+
hierarchy: o,
|
|
2996
|
+
collapsedIds: s
|
|
2997
|
+
}) {
|
|
2998
|
+
return /* @__PURE__ */ P("div", { className: "gantt-rows", role: "presentation", children: n.map((e) => {
|
|
2999
|
+
const a = t[e.index];
|
|
3000
|
+
if (!a) return null;
|
|
3001
|
+
const i = {
|
|
3002
|
+
// border-box, so the 1px border sits inside the height
|
|
3003
|
+
height: `${e.size}px`,
|
|
3004
|
+
transform: `translateY(${e.start}px)`
|
|
3005
|
+
};
|
|
3006
|
+
return r ? /* @__PURE__ */ P(
|
|
3007
|
+
"div",
|
|
3008
|
+
{
|
|
3009
|
+
className: "gantt-task-row",
|
|
3010
|
+
style: i,
|
|
3011
|
+
"aria-hidden": "true"
|
|
3012
|
+
},
|
|
3013
|
+
`row-${a.id}`
|
|
3014
|
+
) : /* @__PURE__ */ P(
|
|
3015
|
+
"div",
|
|
3016
|
+
{
|
|
3017
|
+
className: "gantt-task-row",
|
|
3018
|
+
style: i,
|
|
3019
|
+
...Rn(a, e.index, {
|
|
3020
|
+
headerOffset: 0,
|
|
3021
|
+
expandable: Ee(a, o),
|
|
3022
|
+
expanded: !s.has(a.id),
|
|
3023
|
+
ownedIds: a.tasks.map((c) => `task-${c.id}`)
|
|
3024
|
+
})
|
|
3025
|
+
},
|
|
3026
|
+
`row-${a.id}`
|
|
3027
|
+
);
|
|
3028
|
+
}) });
|
|
3029
|
+
}
|
|
3030
|
+
const Zo = [];
|
|
3031
|
+
function Jo({
|
|
3032
|
+
collapsedIds: t,
|
|
3033
|
+
defaultCollapsedIds: n,
|
|
3034
|
+
onCollapsedChange: r
|
|
3035
|
+
}) {
|
|
3036
|
+
const [o, s] = ut(
|
|
3037
|
+
() => n ?? Zo
|
|
3038
|
+
), e = t ?? o, a = j(() => new Set(e), [e]), i = z(
|
|
3039
|
+
(l) => {
|
|
3040
|
+
t === void 0 && s(l), r == null || r(l);
|
|
3041
|
+
},
|
|
3042
|
+
[t, r]
|
|
3043
|
+
), c = z(
|
|
3044
|
+
(l) => {
|
|
3045
|
+
i(
|
|
3046
|
+
e.includes(l) ? e.filter((f) => f !== l) : [...e, l]
|
|
3047
|
+
);
|
|
3048
|
+
},
|
|
3049
|
+
[e, i]
|
|
3050
|
+
), u = z(
|
|
3051
|
+
(l) => {
|
|
3052
|
+
e.includes(l) && i(e.filter((f) => f !== l));
|
|
3053
|
+
},
|
|
3054
|
+
[e, i]
|
|
3055
|
+
);
|
|
3056
|
+
return { collapsedIds: a, toggle: c, expand: u };
|
|
3057
|
+
}
|
|
3058
|
+
const an = 4;
|
|
3059
|
+
function Qo(t, n, r) {
|
|
3060
|
+
const o = Lt(t, n, r) ?? 0, s = Tn(o, o, n, r);
|
|
3061
|
+
return s ? {
|
|
3062
|
+
startDate: s.startDate.toISOString(),
|
|
3063
|
+
endDate: s.endDate.toISOString()
|
|
3064
|
+
} : null;
|
|
3065
|
+
}
|
|
3066
|
+
function ts(t, n) {
|
|
3067
|
+
const r = n * xt;
|
|
3068
|
+
return t < r ? null : r;
|
|
3069
|
+
}
|
|
3070
|
+
function es({
|
|
3071
|
+
enabled: t,
|
|
3072
|
+
rowCount: n,
|
|
3073
|
+
onTaskCreate: r
|
|
3074
|
+
}) {
|
|
3075
|
+
const o = yt(), [s, e] = ut(null), a = Z(null), i = Z(null), c = (l) => {
|
|
3076
|
+
var w;
|
|
3077
|
+
if (!t || !l.isPrimary || l.button !== 0 || a.current !== null || l.target !== l.currentTarget) return;
|
|
3078
|
+
(w = i.current) == null || w.call(i), i.current = null;
|
|
3079
|
+
const f = l.currentTarget, h = l.pointerId;
|
|
3080
|
+
i.current = le(
|
|
3081
|
+
{ pointerType: l.pointerType, pointerId: h, clientX: l.clientX, clientY: l.clientY },
|
|
3082
|
+
(p, d) => {
|
|
3083
|
+
i.current = null, u(f, h, l.pointerType, p, d);
|
|
3084
|
+
}
|
|
3085
|
+
);
|
|
3086
|
+
}, u = (l, f, h, w, p) => {
|
|
3087
|
+
const d = l.getBoundingClientRect(), m = w - d.left, D = ts(p - d.top, n);
|
|
3088
|
+
if (D === null) return;
|
|
3089
|
+
a.current = f;
|
|
3090
|
+
const b = h === "mouse" ? null : ue(), S = (g) => {
|
|
3091
|
+
const { bottomRowCells: R, selectedScale: F } = o.getState(), U = l.getBoundingClientRect();
|
|
3092
|
+
return Tn(
|
|
3093
|
+
m,
|
|
3094
|
+
g - U.left,
|
|
3095
|
+
R,
|
|
3096
|
+
F
|
|
3097
|
+
);
|
|
3098
|
+
}, L = (g) => {
|
|
3099
|
+
if (g.pointerId !== f) return;
|
|
3100
|
+
const R = l.getBoundingClientRect();
|
|
3101
|
+
if (Math.abs(g.clientX - R.left - m) < an) {
|
|
3102
|
+
e(null);
|
|
3103
|
+
return;
|
|
3104
|
+
}
|
|
3105
|
+
const F = S(g.clientX);
|
|
3106
|
+
e(
|
|
3107
|
+
F && {
|
|
3108
|
+
leftPx: F.leftPx,
|
|
3109
|
+
widthPx: F.widthPx,
|
|
3110
|
+
topPx: D
|
|
3111
|
+
}
|
|
3112
|
+
);
|
|
3113
|
+
}, N = () => {
|
|
3114
|
+
document.removeEventListener("pointermove", L), document.removeEventListener("pointerup", v), document.removeEventListener("pointercancel", _), document.removeEventListener("keydown", A);
|
|
3115
|
+
}, x = () => {
|
|
3116
|
+
N(), b == null || b(), a.current = null, e(null);
|
|
3117
|
+
}, _ = (g) => {
|
|
3118
|
+
g.pointerId === f && x();
|
|
3119
|
+
}, A = (g) => {
|
|
3120
|
+
g.key === "Escape" && x();
|
|
3121
|
+
}, v = (g) => {
|
|
3122
|
+
if (g.pointerId !== f) return;
|
|
3123
|
+
const R = l.getBoundingClientRect(), U = Math.abs(g.clientX - R.left - m) >= an ? S(g.clientX) : null;
|
|
3124
|
+
x(), U && (r == null || r({
|
|
3125
|
+
startDate: U.startDate.toISOString(),
|
|
3126
|
+
endDate: U.endDate.toISOString()
|
|
3127
|
+
}));
|
|
3128
|
+
};
|
|
3129
|
+
document.addEventListener("pointermove", L), document.addEventListener("pointerup", v), document.addEventListener("pointercancel", _), document.addEventListener("keydown", A);
|
|
3130
|
+
};
|
|
3131
|
+
return { onDrawPointerDown: c, ghost: s };
|
|
3132
|
+
}
|
|
3133
|
+
function ns({
|
|
3134
|
+
readOnly: t,
|
|
3135
|
+
allowMove: n,
|
|
3136
|
+
allowResize: r,
|
|
3137
|
+
allowProgressChange: o,
|
|
3138
|
+
allowLinkCreate: s,
|
|
3139
|
+
allowLinkDelete: e,
|
|
3140
|
+
allowTaskCreate: a,
|
|
3141
|
+
allowReorder: i,
|
|
3142
|
+
minDate: c,
|
|
3143
|
+
maxDate: u
|
|
3144
|
+
}) {
|
|
3145
|
+
return j(
|
|
3146
|
+
() => ({
|
|
3147
|
+
readOnly: t,
|
|
3148
|
+
allowMove: n,
|
|
3149
|
+
allowResize: r,
|
|
3150
|
+
allowProgressChange: o,
|
|
3151
|
+
allowLinkCreate: s,
|
|
3152
|
+
allowLinkDelete: e,
|
|
3153
|
+
allowTaskCreate: a,
|
|
3154
|
+
allowReorder: i,
|
|
3155
|
+
minDate: c,
|
|
3156
|
+
maxDate: u
|
|
3157
|
+
}),
|
|
3158
|
+
[
|
|
3159
|
+
t,
|
|
3160
|
+
n,
|
|
3161
|
+
r,
|
|
3162
|
+
o,
|
|
3163
|
+
s,
|
|
3164
|
+
e,
|
|
3165
|
+
a,
|
|
3166
|
+
i,
|
|
3167
|
+
c,
|
|
3168
|
+
u
|
|
3169
|
+
]
|
|
3170
|
+
);
|
|
3171
|
+
}
|
|
3172
|
+
const rs = 3;
|
|
3173
|
+
function os({
|
|
3174
|
+
rows: t,
|
|
3175
|
+
rawTasks: n,
|
|
3176
|
+
gridColumnCount: r,
|
|
3177
|
+
hierarchy: o,
|
|
3178
|
+
collapsedIds: s,
|
|
3179
|
+
selectedScale: e,
|
|
3180
|
+
localeOptions: a,
|
|
3181
|
+
interaction: i,
|
|
3182
|
+
onActivate: c,
|
|
3183
|
+
onToggleCollapse: u,
|
|
3184
|
+
onTasksChange: l,
|
|
3185
|
+
move: f,
|
|
3186
|
+
scrollToRow: h,
|
|
3187
|
+
scrollApi: w,
|
|
3188
|
+
bodyRef: p
|
|
3189
|
+
}) {
|
|
3190
|
+
const d = yt(), [m, D] = ut({ row: 0, col: 0 }), [b, S] = ut(0), [L, N] = ut(""), x = j(
|
|
3191
|
+
() => ({
|
|
3192
|
+
row: Math.min(m.row, Math.max(t.length - 1, 0)),
|
|
3193
|
+
col: m.col
|
|
3194
|
+
}),
|
|
3195
|
+
[m, t.length]
|
|
3196
|
+
), _ = j(
|
|
3197
|
+
() => t.map((U) => ({
|
|
3198
|
+
cells: Math.max(r + U.tasks.length, 1),
|
|
3199
|
+
firstBarCell: r,
|
|
3200
|
+
expandable: Ee(U, o),
|
|
3201
|
+
expanded: !s.has(U.id)
|
|
3202
|
+
})),
|
|
3203
|
+
[t, r, o, s]
|
|
3204
|
+
), { tooltip: A } = j(
|
|
3205
|
+
() => Yt(e, a),
|
|
3206
|
+
[e, a]
|
|
3207
|
+
), v = z(
|
|
3208
|
+
(U) => {
|
|
3209
|
+
d.getState().setRawTasks(U), l == null || l(U);
|
|
3210
|
+
},
|
|
3211
|
+
[d, l]
|
|
3212
|
+
), g = z(
|
|
3213
|
+
(U) => {
|
|
3214
|
+
const T = d.getState().rawTasks, M = oe(T, o), I = M.parentOf.get(U.id) ?? null, y = M.childrenOf(I), $ = T.find((k) => k.id === I);
|
|
3215
|
+
N(
|
|
3216
|
+
Ro(
|
|
3217
|
+
U.name,
|
|
3218
|
+
y.indexOf(U.id) + 1,
|
|
3219
|
+
y.length,
|
|
3220
|
+
($ == null ? void 0 : $.name) ?? null
|
|
3221
|
+
)
|
|
3222
|
+
), S((k) => k + 1);
|
|
3223
|
+
},
|
|
3224
|
+
[d, o]
|
|
3225
|
+
), R = z(
|
|
3226
|
+
(U) => {
|
|
3227
|
+
const T = Ao(U, x, _);
|
|
3228
|
+
if (!T) return;
|
|
3229
|
+
if (U.preventDefault(), T.kind === "zoom") {
|
|
3230
|
+
const $ = In(e, T.direction);
|
|
3231
|
+
$ !== e && (w.setScale($), N(`${$} scale`));
|
|
3232
|
+
return;
|
|
3233
|
+
}
|
|
3234
|
+
const M = t[T.kind === "focus" ? x.row : T.row], I = _[x.row], y = T.kind === "focus" ? void 0 : No(M, T.col, (I == null ? void 0 : I.firstBarCell) ?? 0);
|
|
3235
|
+
switch (T.kind) {
|
|
3236
|
+
case "focus":
|
|
3237
|
+
D(T.focus), S(($) => $ + 1);
|
|
3238
|
+
break;
|
|
3239
|
+
case "toggle":
|
|
3240
|
+
M && u(M.id);
|
|
3241
|
+
break;
|
|
3242
|
+
case "activate":
|
|
3243
|
+
y && (c == null || c(y.id), N(Nn(y, A, null)));
|
|
3244
|
+
break;
|
|
3245
|
+
case "delete": {
|
|
3246
|
+
if (!y) return;
|
|
3247
|
+
const $ = Ho(n, y, i);
|
|
3248
|
+
if (!$) {
|
|
3249
|
+
N(`${y.name} cannot be deleted`);
|
|
3250
|
+
break;
|
|
3251
|
+
}
|
|
3252
|
+
v($), N(`${y.name} deleted`);
|
|
3253
|
+
break;
|
|
3254
|
+
}
|
|
3255
|
+
case "nudge": {
|
|
3256
|
+
if (!y) return;
|
|
3257
|
+
const $ = _o(
|
|
3258
|
+
n,
|
|
3259
|
+
y,
|
|
3260
|
+
T.mode,
|
|
3261
|
+
T.steps,
|
|
3262
|
+
e,
|
|
3263
|
+
i
|
|
3264
|
+
);
|
|
3265
|
+
if (!$) {
|
|
3266
|
+
N(`${y.name} cannot be changed`);
|
|
3267
|
+
break;
|
|
3268
|
+
}
|
|
3269
|
+
v($);
|
|
3270
|
+
const k = $.find((E) => E.id === y.id);
|
|
3271
|
+
k && N(
|
|
3272
|
+
`${y.name}, ${A(H(k.startDate))} to ${A(H(k.endDate))}`
|
|
3273
|
+
), S((E) => E + 1);
|
|
3274
|
+
break;
|
|
3275
|
+
}
|
|
3276
|
+
case "progress": {
|
|
3277
|
+
if (!y) return;
|
|
3278
|
+
const $ = Yo(
|
|
3279
|
+
n,
|
|
3280
|
+
y,
|
|
3281
|
+
T.delta,
|
|
3282
|
+
i
|
|
3283
|
+
);
|
|
3284
|
+
if (!$) {
|
|
3285
|
+
N(`${y.name} progress cannot be changed`);
|
|
3286
|
+
break;
|
|
3287
|
+
}
|
|
3288
|
+
v($);
|
|
3289
|
+
const k = $.find((E) => E.id === y.id);
|
|
3290
|
+
N(`${y.name}, ${(k == null ? void 0 : k.progress) ?? 0}% complete`), S((E) => E + 1);
|
|
3291
|
+
break;
|
|
3292
|
+
}
|
|
3293
|
+
case "reorder": {
|
|
3294
|
+
if (!y) return;
|
|
3295
|
+
const $ = oe(n, o), k = $.parentOf.get(y.id) ?? null, E = $.childrenOf(k), C = E.indexOf(y.id) + T.delta;
|
|
3296
|
+
if (C < 0 || C >= E.length) break;
|
|
3297
|
+
f.apply({ taskId: y.id, toParentId: k, toIndex: C }) && g(y);
|
|
3298
|
+
break;
|
|
3299
|
+
}
|
|
3300
|
+
case "reparent": {
|
|
3301
|
+
if (!y || !o) return;
|
|
3302
|
+
const $ = oe(n, o), k = $.parentOf.get(y.id) ?? null, E = $.childrenOf(k);
|
|
3303
|
+
if (T.direction > 0) {
|
|
3304
|
+
const q = E[E.indexOf(y.id) - 1];
|
|
3305
|
+
if (!q) break;
|
|
3306
|
+
f.apply({
|
|
3307
|
+
taskId: y.id,
|
|
3308
|
+
toParentId: q,
|
|
3309
|
+
toIndex: $.childrenOf(q).length
|
|
3310
|
+
}) && g(y);
|
|
3311
|
+
break;
|
|
3312
|
+
}
|
|
3313
|
+
if (!k) break;
|
|
3314
|
+
const C = $.parentOf.get(k) ?? null, X = $.childrenOf(C);
|
|
3315
|
+
f.apply({
|
|
3316
|
+
taskId: y.id,
|
|
3317
|
+
toParentId: C,
|
|
3318
|
+
toIndex: X.indexOf(k) + 1
|
|
3319
|
+
}) && g(y);
|
|
3320
|
+
break;
|
|
3321
|
+
}
|
|
3322
|
+
}
|
|
3323
|
+
},
|
|
3324
|
+
[
|
|
3325
|
+
x,
|
|
3326
|
+
_,
|
|
3327
|
+
t,
|
|
3328
|
+
c,
|
|
3329
|
+
u,
|
|
3330
|
+
n,
|
|
3331
|
+
i,
|
|
3332
|
+
e,
|
|
3333
|
+
w,
|
|
3334
|
+
v,
|
|
3335
|
+
A,
|
|
3336
|
+
o,
|
|
3337
|
+
f,
|
|
3338
|
+
g
|
|
3339
|
+
]
|
|
3340
|
+
), F = z(
|
|
3341
|
+
(U) => {
|
|
3342
|
+
var y, $, k;
|
|
3343
|
+
const T = (k = ($ = (y = U.target).closest) == null ? void 0 : $.call(y, "[data-gantt-cell]")) == null ? void 0 : k.getAttribute("data-gantt-cell");
|
|
3344
|
+
if (!T) return;
|
|
3345
|
+
const [M, I] = T.split(":").map(Number);
|
|
3346
|
+
D(
|
|
3347
|
+
(E) => E.row === M && E.col === I ? E : { row: M, col: I }
|
|
3348
|
+
);
|
|
3349
|
+
},
|
|
3350
|
+
[]
|
|
3351
|
+
);
|
|
3352
|
+
return it(() => {
|
|
3353
|
+
if (!b) return;
|
|
3354
|
+
let U = rs, T = 0;
|
|
3355
|
+
const M = () => {
|
|
3356
|
+
var $, k;
|
|
3357
|
+
const I = ($ = p.current) == null ? void 0 : $.querySelector(
|
|
3358
|
+
`[data-gantt-cell="${x.row}:${x.col}"]`
|
|
3359
|
+
);
|
|
3360
|
+
if (I) {
|
|
3361
|
+
I.focus({ preventScroll: !0 }), I.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
3362
|
+
return;
|
|
3363
|
+
}
|
|
3364
|
+
if (--U <= 0) return;
|
|
3365
|
+
h(x.row, "auto");
|
|
3366
|
+
const y = (k = t[x.row]) == null ? void 0 : k.tasks[0];
|
|
3367
|
+
y && w.scrollToTask(y.id, { smooth: !1 }), T = requestAnimationFrame(M);
|
|
3368
|
+
};
|
|
3369
|
+
return M(), () => cancelAnimationFrame(T);
|
|
3370
|
+
}, [b]), { focus: x, announcement: L, onKeyDown: R, onFocusCapture: F };
|
|
3371
|
+
}
|
|
3372
|
+
function ss({
|
|
3373
|
+
rawTasks: t,
|
|
3374
|
+
tasks: n,
|
|
3375
|
+
hierarchy: r,
|
|
3376
|
+
collapsedIds: o
|
|
3377
|
+
}) {
|
|
3378
|
+
const s = j(
|
|
3379
|
+
() => r ? Xt(t) : void 0,
|
|
3380
|
+
[r, t]
|
|
3381
|
+
), e = j(() => !r || !o.size ? n : Gr(n, o, s), [r, o, n, s]), a = j(() => Uo(e), [e]), i = j(() => a.flatMap((c) => c.tasks), [a]);
|
|
3382
|
+
return { rows: a, tasks: i };
|
|
3383
|
+
}
|
|
3384
|
+
const cn = (t) => Symbol.iterator in t, ln = (t) => (
|
|
3385
|
+
// HACK: avoid checking entries type
|
|
3386
|
+
"entries" in t
|
|
3387
|
+
), un = (t, n) => {
|
|
3388
|
+
const r = t instanceof Map ? t : new Map(t.entries()), o = n instanceof Map ? n : new Map(n.entries());
|
|
3389
|
+
if (r.size !== o.size)
|
|
3390
|
+
return !1;
|
|
3391
|
+
for (const [s, e] of r)
|
|
3392
|
+
if (!o.has(s) || !Object.is(e, o.get(s)))
|
|
3393
|
+
return !1;
|
|
3394
|
+
return !0;
|
|
3395
|
+
}, as = (t, n) => {
|
|
3396
|
+
const r = t[Symbol.iterator](), o = n[Symbol.iterator]();
|
|
3397
|
+
let s = r.next(), e = o.next();
|
|
3398
|
+
for (; !s.done && !e.done; ) {
|
|
3399
|
+
if (!Object.is(s.value, e.value))
|
|
3400
|
+
return !1;
|
|
3401
|
+
s = r.next(), e = o.next();
|
|
3402
|
+
}
|
|
3403
|
+
return !!s.done && !!e.done;
|
|
3404
|
+
};
|
|
3405
|
+
function is(t, n) {
|
|
3406
|
+
return Object.is(t, n) ? !0 : typeof t != "object" || t === null || typeof n != "object" || n === null || Object.getPrototypeOf(t) !== Object.getPrototypeOf(n) ? !1 : cn(t) && cn(n) ? ln(t) && ln(n) ? un(t, n) : as(t, n) : un(
|
|
3407
|
+
{ entries: () => Object.entries(t) },
|
|
3408
|
+
{ entries: () => Object.entries(n) }
|
|
3409
|
+
);
|
|
3410
|
+
}
|
|
3411
|
+
function cs(t) {
|
|
3412
|
+
const n = Ft.useRef(void 0);
|
|
3413
|
+
return (r) => {
|
|
3414
|
+
const o = t(r);
|
|
3415
|
+
return is(n.current, o) ? n.current : n.current = o;
|
|
3416
|
+
};
|
|
3417
|
+
}
|
|
3418
|
+
function ls() {
|
|
3419
|
+
return Q(
|
|
3420
|
+
cs((t) => ({
|
|
3421
|
+
rawTasks: t.rawTasks,
|
|
3422
|
+
transformedTasks: t.transformedTasks,
|
|
3423
|
+
bottomRowCells: t.bottomRowCells,
|
|
3424
|
+
selectedScale: t.selectedScale,
|
|
3425
|
+
selectedTaskId: t.selectedTaskId,
|
|
3426
|
+
syncTasksFromProps: t.syncTasksFromProps,
|
|
3427
|
+
setSelectedScale: t.setSelectedScale,
|
|
3428
|
+
setLocaleOptions: t.setLocaleOptions,
|
|
3429
|
+
getTotalWidth: t.getTotalWidth
|
|
3430
|
+
}))
|
|
3431
|
+
);
|
|
3432
|
+
}
|
|
3433
|
+
function us({
|
|
3434
|
+
selectable: t,
|
|
3435
|
+
onTaskSelect: n,
|
|
3436
|
+
onTaskClick: r
|
|
3437
|
+
}) {
|
|
3438
|
+
const o = yt(), s = t ?? n !== void 0, e = z(
|
|
3439
|
+
(i) => {
|
|
3440
|
+
if (!s) return;
|
|
3441
|
+
const c = (i == null ? void 0 : i.id) ?? null;
|
|
3442
|
+
o.getState().selectedTaskId !== c && (o.getState().setSelectedTaskId(c), n == null || n(i));
|
|
3443
|
+
},
|
|
3444
|
+
[s, n, o]
|
|
3445
|
+
), a = z(
|
|
3446
|
+
(i, c) => {
|
|
3447
|
+
r == null || r(i, c), e(i);
|
|
3448
|
+
},
|
|
3449
|
+
[r, e]
|
|
3450
|
+
);
|
|
3451
|
+
return {
|
|
3452
|
+
select: e,
|
|
3453
|
+
onTaskClick: a
|
|
3454
|
+
};
|
|
3455
|
+
}
|
|
3456
|
+
function ds(t, n) {
|
|
3457
|
+
const { canResize: r, canChangeProgress: o } = Dt(t, n);
|
|
3458
|
+
return {
|
|
3459
|
+
name: !(t.readOnly ?? (n == null ? void 0 : n.readOnly) ?? !1),
|
|
3460
|
+
dates: r,
|
|
3461
|
+
progress: o
|
|
3462
|
+
};
|
|
3463
|
+
}
|
|
3464
|
+
function fs(t, n) {
|
|
3465
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(n)) return null;
|
|
3466
|
+
const r = H(`${n}T${H(t).format("HH:mm:ss.SSS")}`);
|
|
3467
|
+
return r.isValid() ? r : null;
|
|
3468
|
+
}
|
|
3469
|
+
const hs = (t, n, r) => n && t.isBefore(H(n)) ? H(n) : r && t.isAfter(H(r)) ? H(r) : t;
|
|
3470
|
+
function ms(t, n, r, o) {
|
|
3471
|
+
switch (n) {
|
|
3472
|
+
case "name":
|
|
3473
|
+
return r.trim() === "" ? null : { name: r };
|
|
3474
|
+
case "progress": {
|
|
3475
|
+
const s = r.trim() === "" ? null : Gt(Number(r));
|
|
3476
|
+
return s === null ? null : { progress: s };
|
|
3477
|
+
}
|
|
3478
|
+
default: {
|
|
3479
|
+
const { minDate: s, maxDate: e } = Dt(t, o), a = fs(t[n], r);
|
|
3480
|
+
if (a === null) return null;
|
|
3481
|
+
const i = hs(a, s, e), c = n === "startDate" ? i : H(t.startDate);
|
|
3482
|
+
return (n === "endDate" ? i : H(t.endDate)).isAfter(c) ? { [n]: i.toISOString() } : null;
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3486
|
+
function ps(t, n, r) {
|
|
3487
|
+
return t.map(
|
|
3488
|
+
(o) => o.id === n ? { ...o, ...r } : o
|
|
3489
|
+
);
|
|
3490
|
+
}
|
|
3491
|
+
function gs(t, n, r, o) {
|
|
3492
|
+
const { rawTasks: s, setRawTasks: e } = t.getState(), a = ps(s, n, r);
|
|
3493
|
+
e(a), o == null || o(a);
|
|
3494
|
+
}
|
|
3495
|
+
function De({ value: t, commit: n, ...r }) {
|
|
3496
|
+
const [o, s] = ut(t), [e, a] = ut(t);
|
|
3497
|
+
e !== t && (a(t), s(t));
|
|
3498
|
+
const i = () => {
|
|
3499
|
+
o !== t && n(o), s(t);
|
|
3500
|
+
};
|
|
3501
|
+
return /* @__PURE__ */ P(
|
|
3502
|
+
"input",
|
|
3503
|
+
{
|
|
3504
|
+
className: "gantt-detail-input",
|
|
3505
|
+
...r,
|
|
3506
|
+
value: o,
|
|
3507
|
+
onChange: (c) => s(c.target.value),
|
|
3508
|
+
onBlur: i,
|
|
3509
|
+
onKeyDown: (c) => {
|
|
3510
|
+
c.key === "Enter" && i(), c.key === "Escape" && (c.stopPropagation(), s(t));
|
|
3511
|
+
}
|
|
3512
|
+
}
|
|
3513
|
+
);
|
|
3514
|
+
}
|
|
3515
|
+
function $s({
|
|
3516
|
+
task: t,
|
|
3517
|
+
tasks: n,
|
|
3518
|
+
scale: r,
|
|
3519
|
+
localeOptions: o,
|
|
3520
|
+
interaction: s,
|
|
3521
|
+
onClose: e,
|
|
3522
|
+
onTasksChange: a,
|
|
3523
|
+
render: i,
|
|
3524
|
+
open: c,
|
|
3525
|
+
onTransitionEnd: u
|
|
3526
|
+
}) {
|
|
3527
|
+
const l = Z(null), f = yt(), h = gn(), w = Z(null);
|
|
3528
|
+
it(() => {
|
|
3529
|
+
const A = l.current;
|
|
3530
|
+
return w.current = document.activeElement, () => {
|
|
3531
|
+
const v = document.activeElement;
|
|
3532
|
+
if (!(v === null || v === document.body || ((A == null ? void 0 : A.contains(v)) ?? !1))) return;
|
|
3533
|
+
const R = w.current;
|
|
3534
|
+
R instanceof HTMLElement && R.isConnected && R.focus({ preventScroll: !0 });
|
|
3535
|
+
};
|
|
3536
|
+
}, []), it(() => {
|
|
3537
|
+
const A = (v) => {
|
|
3538
|
+
v.key === "Escape" && e();
|
|
3539
|
+
};
|
|
3540
|
+
return document.addEventListener("keydown", A), () => document.removeEventListener("keydown", A);
|
|
3541
|
+
}, [e]);
|
|
3542
|
+
const { tooltip: p } = j(
|
|
3543
|
+
() => Yt(r, o),
|
|
3544
|
+
[r, o]
|
|
3545
|
+
), d = z(
|
|
3546
|
+
(A) => gs(f, t.id, A, a),
|
|
3547
|
+
[f, t.id, a]
|
|
3548
|
+
), m = z(
|
|
3549
|
+
(A, v) => {
|
|
3550
|
+
const g = ms(t, A, v, s);
|
|
3551
|
+
g && d(g);
|
|
3552
|
+
},
|
|
3553
|
+
[t, s, d]
|
|
3554
|
+
), D = ds(t, s), b = Gt(t.progress), S = H(t.startDate), L = H(t.endDate), N = (t.dependencies ?? []).map(
|
|
3555
|
+
(A) => {
|
|
3556
|
+
var v;
|
|
3557
|
+
return ((v = n.find((g) => g.id === A.targetId)) == null ? void 0 : v.name) ?? A.targetId;
|
|
3558
|
+
}
|
|
3559
|
+
), x = (A, v) => /* @__PURE__ */ P(
|
|
3560
|
+
De,
|
|
3561
|
+
{
|
|
3562
|
+
id: `${h}-${A}`,
|
|
3563
|
+
type: "date",
|
|
3564
|
+
value: H(v).format("YYYY-MM-DD"),
|
|
3565
|
+
commit: (g) => m(A, g)
|
|
3566
|
+
}
|
|
3567
|
+
), _ = [
|
|
3568
|
+
D.dates ? {
|
|
3569
|
+
caption: "Start",
|
|
3570
|
+
inputId: `${h}-startDate`,
|
|
3571
|
+
value: x("startDate", t.startDate)
|
|
3572
|
+
} : { caption: "Start", value: p(S) },
|
|
3573
|
+
D.dates ? {
|
|
3574
|
+
caption: "End",
|
|
3575
|
+
inputId: `${h}-endDate`,
|
|
3576
|
+
value: x("endDate", t.endDate)
|
|
3577
|
+
} : { caption: "End", value: p(L) },
|
|
3578
|
+
{ caption: "Duration", value: xn(L.valueOf() - S.valueOf()) }
|
|
3579
|
+
];
|
|
3580
|
+
return b !== null && _.push(
|
|
3581
|
+
D.progress ? {
|
|
3582
|
+
caption: "Progress",
|
|
3583
|
+
inputId: `${h}-progress`,
|
|
3584
|
+
value: /* @__PURE__ */ P(
|
|
3585
|
+
De,
|
|
3586
|
+
{
|
|
3587
|
+
id: `${h}-progress`,
|
|
3588
|
+
type: "number",
|
|
3589
|
+
min: 0,
|
|
3590
|
+
max: 100,
|
|
3591
|
+
step: 1,
|
|
3592
|
+
value: String(b),
|
|
3593
|
+
commit: (A) => m("progress", A)
|
|
3594
|
+
}
|
|
3595
|
+
)
|
|
3596
|
+
} : { caption: "Progress", value: `${b}%` }
|
|
3597
|
+
), N.length > 0 && _.push({ caption: "Depends on", value: N.join(", ") }), /* @__PURE__ */ P(
|
|
3598
|
+
"aside",
|
|
3599
|
+
{
|
|
3600
|
+
ref: l,
|
|
3601
|
+
className: c ? "gantt-detail gantt-detail-open" : "gantt-detail",
|
|
3602
|
+
role: "complementary",
|
|
3603
|
+
"aria-label": "Task details",
|
|
3604
|
+
onTransitionEnd: u,
|
|
3605
|
+
children: i ? i({ task: t, close: e, scale: r, update: d }) : /* @__PURE__ */ J(we, { children: [
|
|
3606
|
+
/* @__PURE__ */ J("div", { className: "gantt-detail-header", children: [
|
|
3607
|
+
D.name ? /* @__PURE__ */ P(
|
|
3608
|
+
De,
|
|
3609
|
+
{
|
|
3610
|
+
type: "text",
|
|
3611
|
+
"aria-label": "Task name",
|
|
3612
|
+
value: t.name,
|
|
3613
|
+
commit: (A) => m("name", A)
|
|
3614
|
+
}
|
|
3615
|
+
) : /* @__PURE__ */ P("h2", { className: "gantt-detail-title", children: t.name }),
|
|
3616
|
+
/* @__PURE__ */ P(
|
|
3617
|
+
"button",
|
|
3618
|
+
{
|
|
3619
|
+
type: "button",
|
|
3620
|
+
className: "gantt-detail-close",
|
|
3621
|
+
onClick: e,
|
|
3622
|
+
"aria-label": "Close task details",
|
|
3623
|
+
children: "✕"
|
|
3624
|
+
}
|
|
3625
|
+
)
|
|
3626
|
+
] }),
|
|
3627
|
+
/* @__PURE__ */ P("dl", { className: "gantt-detail-fields", children: _.map(({ caption: A, value: v, inputId: g }) => /* @__PURE__ */ J(Jn, { children: [
|
|
3628
|
+
/* @__PURE__ */ P("dt", { children: g ? /* @__PURE__ */ P("label", { htmlFor: g, children: A }) : A }),
|
|
3629
|
+
/* @__PURE__ */ P("dd", { children: v })
|
|
3630
|
+
] }, A)) })
|
|
3631
|
+
] })
|
|
3632
|
+
}
|
|
3633
|
+
);
|
|
3634
|
+
}
|
|
3635
|
+
function Ds({
|
|
3636
|
+
enabled: t,
|
|
3637
|
+
detailTaskId: n,
|
|
3638
|
+
uncontrolled: r,
|
|
3639
|
+
tasks: o
|
|
3640
|
+
}) {
|
|
3641
|
+
if (!t) return { openId: null, task: null, stale: !1 };
|
|
3642
|
+
const s = n !== void 0 ? n : r;
|
|
3643
|
+
if (s === null) return { openId: null, task: null, stale: !1 };
|
|
3644
|
+
const e = o.find((a) => a.id === s) ?? null;
|
|
3645
|
+
return { openId: s, task: e, stale: e === null };
|
|
3646
|
+
}
|
|
3647
|
+
function ws({
|
|
3648
|
+
enabled: t,
|
|
3649
|
+
tasks: n,
|
|
3650
|
+
detailTaskId: r,
|
|
3651
|
+
onDetailChange: o,
|
|
3652
|
+
onTaskClick: s
|
|
3653
|
+
}) {
|
|
3654
|
+
const [e, a] = ut(null), i = r !== void 0, { openId: c, task: u } = j(
|
|
3655
|
+
() => Ds({ enabled: t, detailTaskId: r, uncontrolled: e, tasks: n }),
|
|
3656
|
+
[t, r, e, n]
|
|
3657
|
+
), l = z(
|
|
3658
|
+
(p) => {
|
|
3659
|
+
t && p !== c && (i || a(p), o == null || o(
|
|
3660
|
+
p ? n.find((d) => d.id === p) ?? null : null
|
|
3661
|
+
));
|
|
3662
|
+
},
|
|
3663
|
+
[t, c, i, o, n]
|
|
3664
|
+
), f = z(
|
|
3665
|
+
(p) => {
|
|
3666
|
+
n.some((d) => d.id === p) && l(p);
|
|
3667
|
+
},
|
|
3668
|
+
[l, n]
|
|
3669
|
+
), h = z(() => l(null), [l]), w = z(
|
|
3670
|
+
(p, d) => {
|
|
3671
|
+
s == null || s(p, d), l(p.id);
|
|
3672
|
+
},
|
|
3673
|
+
[s, l]
|
|
3674
|
+
);
|
|
3675
|
+
return { task: u, open: f, close: h, onTaskClick: w };
|
|
3676
|
+
}
|
|
3677
|
+
const vs = 400;
|
|
3678
|
+
function ys(t) {
|
|
3679
|
+
const [n, r] = ut(t), [o, s] = ut(!1);
|
|
3680
|
+
t !== null && t !== n && r(t);
|
|
3681
|
+
const e = t !== null;
|
|
3682
|
+
it(() => {
|
|
3683
|
+
let i = requestAnimationFrame(() => {
|
|
3684
|
+
if (!e) {
|
|
3685
|
+
s(!1);
|
|
3686
|
+
return;
|
|
3687
|
+
}
|
|
3688
|
+
i = requestAnimationFrame(() => s(!0));
|
|
3689
|
+
});
|
|
3690
|
+
return () => cancelAnimationFrame(i);
|
|
3691
|
+
}, [e]), it(() => {
|
|
3692
|
+
if (e || n === null) return;
|
|
3693
|
+
const i = setTimeout(() => r(null), vs);
|
|
3694
|
+
return () => clearTimeout(i);
|
|
3695
|
+
}, [e, n]);
|
|
3696
|
+
const a = z(
|
|
3697
|
+
(i) => {
|
|
3698
|
+
i.target === i.currentTarget && i.propertyName === "flex-basis" && (e || r(null));
|
|
3699
|
+
},
|
|
3700
|
+
[e]
|
|
3701
|
+
);
|
|
3702
|
+
return { task: n, open: o, onTransitionEnd: a };
|
|
3703
|
+
}
|
|
3704
|
+
function bs({
|
|
3705
|
+
scrollRef: t,
|
|
3706
|
+
bottomRowCells: n,
|
|
3707
|
+
transformedTasks: r,
|
|
3708
|
+
selectedScale: o,
|
|
3709
|
+
rowHeight: s,
|
|
3710
|
+
viewportInsetPx: e = 0,
|
|
3711
|
+
zoomTo: a,
|
|
3712
|
+
setSelectedScale: i
|
|
3713
|
+
}) {
|
|
3714
|
+
const c = z(
|
|
3715
|
+
(p, d) => {
|
|
3716
|
+
const m = t.current;
|
|
3717
|
+
if (!m) return;
|
|
3718
|
+
const D = (d == null ? void 0 : d.align) === "start" ? p : p - (m.clientWidth - e) / 2;
|
|
3719
|
+
m.scrollTo({
|
|
3720
|
+
left: Math.max(0, D),
|
|
3721
|
+
behavior: (d == null ? void 0 : d.smooth) === !1 ? "auto" : "smooth"
|
|
3722
|
+
});
|
|
3723
|
+
},
|
|
3724
|
+
[t, e]
|
|
3725
|
+
), u = z(
|
|
3726
|
+
(p, d) => {
|
|
3727
|
+
const m = Lt(H(p), n, o);
|
|
3728
|
+
m !== null && c(m, d);
|
|
3729
|
+
},
|
|
3730
|
+
[n, o, c]
|
|
3731
|
+
), l = z(
|
|
3732
|
+
(p) => u(H(), p),
|
|
3733
|
+
[u]
|
|
3734
|
+
), f = z(
|
|
3735
|
+
(p, d) => {
|
|
3736
|
+
const m = r.findIndex((N) => N.id === p);
|
|
3737
|
+
if (m === -1) return;
|
|
3738
|
+
const D = r[m], b = t.current;
|
|
3739
|
+
if (!b) return;
|
|
3740
|
+
const S = (D.order - 1) * s, L = S < b.scrollTop || S + s > b.scrollTop + b.clientHeight;
|
|
3741
|
+
b.scrollTo({
|
|
3742
|
+
top: L ? Math.max(0, S - b.clientHeight / 2 + s / 2) : b.scrollTop,
|
|
3743
|
+
left: Math.max(
|
|
3744
|
+
0,
|
|
3745
|
+
(d == null ? void 0 : d.align) === "start" ? D.barLeft : D.barLeft + D.barWidth / 2 - (b.clientWidth - e) / 2
|
|
3746
|
+
),
|
|
3747
|
+
behavior: (d == null ? void 0 : d.smooth) === !1 ? "auto" : "smooth"
|
|
3748
|
+
});
|
|
3749
|
+
},
|
|
3750
|
+
[r, s, t, e]
|
|
3751
|
+
), h = z(
|
|
3752
|
+
(p) => {
|
|
3753
|
+
if (!(p in dt)) return;
|
|
3754
|
+
const d = t.current, m = d ? Math.max(0, d.clientWidth - e) / 2 : 0, D = d ? Pn(d.scrollLeft + m, n, o) : null;
|
|
3755
|
+
if (!D) {
|
|
3756
|
+
i(p);
|
|
3757
|
+
return;
|
|
3758
|
+
}
|
|
3759
|
+
a(p, { date: D, viewportX: m });
|
|
3760
|
+
},
|
|
3761
|
+
[
|
|
3762
|
+
t,
|
|
3763
|
+
e,
|
|
3764
|
+
n,
|
|
3765
|
+
o,
|
|
3766
|
+
i,
|
|
3767
|
+
a
|
|
3768
|
+
]
|
|
3769
|
+
), w = z(() => {
|
|
3770
|
+
const p = t.current;
|
|
3771
|
+
if (!p || !r.length) return;
|
|
3772
|
+
let d = 1 / 0, m = -1 / 0;
|
|
3773
|
+
for (const D of r)
|
|
3774
|
+
d = Math.min(d, H(D.startDate).valueOf()), m = Math.max(m, H(D.endDate).valueOf());
|
|
3775
|
+
!Number.isFinite(d) || !Number.isFinite(m) || a(_r(m - d, p.clientWidth - e), {
|
|
3776
|
+
date: H(d),
|
|
3777
|
+
viewportX: 0
|
|
3778
|
+
});
|
|
3779
|
+
}, [r, t, e, a]);
|
|
3780
|
+
return j(
|
|
3781
|
+
() => ({
|
|
3782
|
+
scrollToDate: u,
|
|
3783
|
+
scrollToToday: l,
|
|
3784
|
+
scrollToTask: f,
|
|
3785
|
+
setScale: h,
|
|
3786
|
+
zoomToFit: w,
|
|
3787
|
+
getScrollElement: () => t.current
|
|
3788
|
+
}),
|
|
3789
|
+
[u, l, f, h, w, t]
|
|
3790
|
+
);
|
|
3791
|
+
}
|
|
3792
|
+
function Ss({
|
|
3793
|
+
showTaskList: t
|
|
3794
|
+
}) {
|
|
3795
|
+
const n = t ?? !1, [r, o] = ut($r);
|
|
3796
|
+
return {
|
|
3797
|
+
width: r,
|
|
3798
|
+
setWidth: o,
|
|
3799
|
+
visible: n,
|
|
3800
|
+
inset: n ? r : 0
|
|
3801
|
+
};
|
|
3802
|
+
}
|
|
3803
|
+
function Ms({
|
|
3804
|
+
hierarchy: t,
|
|
3805
|
+
interaction: n,
|
|
3806
|
+
collapsedIds: r,
|
|
3807
|
+
onTasksChange: o,
|
|
3808
|
+
onTaskMove: s,
|
|
3809
|
+
onExpand: e
|
|
3810
|
+
}) {
|
|
3811
|
+
const a = yt(), i = j(
|
|
3812
|
+
() => ({
|
|
3813
|
+
hierarchy: t,
|
|
3814
|
+
canReorder: (l) => Dt(l, n).canReorder
|
|
3815
|
+
}),
|
|
3816
|
+
[t, n]
|
|
3817
|
+
), c = z(
|
|
3818
|
+
(l) => On(a.getState().rawTasks, l, i),
|
|
3819
|
+
[a, i]
|
|
3820
|
+
), u = z(
|
|
3821
|
+
(l) => {
|
|
3822
|
+
const f = qr(a.getState().rawTasks, l, i);
|
|
3823
|
+
return !f || (s == null ? void 0 : s(f.change)) === !1 ? !1 : (a.getState().setRawTasks(f.tasks), o == null || o(f.tasks), l.toParentId && r.has(l.toParentId) && (e == null || e(l.toParentId)), !0);
|
|
3824
|
+
},
|
|
3825
|
+
[a, i, s, o, r, e]
|
|
3826
|
+
);
|
|
3827
|
+
return { validate: c, apply: u };
|
|
3828
|
+
}
|
|
3829
|
+
function _n(t, n) {
|
|
3830
|
+
const r = Math.max(1, n);
|
|
3831
|
+
return {
|
|
3832
|
+
count: t,
|
|
3833
|
+
total: t * r,
|
|
3834
|
+
sizeAt: () => r,
|
|
3835
|
+
offsetAt: (o) => Ie(o, 0, t) * r,
|
|
3836
|
+
indexAt: (o) => Ie(Math.floor(o / r), 0, t - 1)
|
|
3837
|
+
};
|
|
3838
|
+
}
|
|
3839
|
+
function xs(t, n) {
|
|
3840
|
+
const r = new Float64Array(t + 1);
|
|
3841
|
+
for (let o = 0; o < t; o += 1)
|
|
3842
|
+
r[o + 1] = r[o] + Math.max(0, n(o));
|
|
3843
|
+
return {
|
|
3844
|
+
count: t,
|
|
3845
|
+
total: r[t],
|
|
3846
|
+
sizeAt: (o) => o >= 0 && o < t ? r[o + 1] - r[o] : 0,
|
|
3847
|
+
offsetAt: (o) => r[Ie(o, 0, t)],
|
|
3848
|
+
indexAt: (o) => {
|
|
3849
|
+
if (t === 0) return 0;
|
|
3850
|
+
let s = 0, e = t - 1;
|
|
3851
|
+
for (; s < e; ) {
|
|
3852
|
+
const a = s + e >> 1;
|
|
3853
|
+
r[a + 1] <= o ? s = a + 1 : e = a;
|
|
3854
|
+
}
|
|
3855
|
+
return s;
|
|
3856
|
+
}
|
|
3857
|
+
};
|
|
3858
|
+
}
|
|
3859
|
+
function Is(t, n, r = 0) {
|
|
3860
|
+
return typeof n == "number" ? _n(t, n) : xs(t, (o) => n[o] ?? r);
|
|
3861
|
+
}
|
|
3862
|
+
function Ie(t, n, r) {
|
|
3863
|
+
return t < n ? n : t > r ? r : t;
|
|
3864
|
+
}
|
|
3865
|
+
const Os = 24;
|
|
3866
|
+
function Oe(t) {
|
|
3867
|
+
return {
|
|
3868
|
+
start: 0,
|
|
3869
|
+
end: t - 1,
|
|
3870
|
+
padStart: 0,
|
|
3871
|
+
padEnd: 0,
|
|
3872
|
+
virtualized: !1
|
|
3873
|
+
};
|
|
3874
|
+
}
|
|
3875
|
+
function dn(t, n, r, o = 5, s = 0) {
|
|
3876
|
+
if (t.count === 0 || t.count <= Os || r <= 0 || t.total <= r)
|
|
3877
|
+
return Oe(t.count);
|
|
3878
|
+
const e = o + (s < 0 ? o : 0), a = o + (s > 0 ? o : 0), i = Math.max(0, n), c = Math.max(0, t.indexAt(i) - e), u = Math.min(t.count - 1, t.indexAt(i + r) + a);
|
|
3879
|
+
return {
|
|
3880
|
+
start: c,
|
|
3881
|
+
end: u,
|
|
3882
|
+
padStart: t.offsetAt(c),
|
|
3883
|
+
padEnd: Math.max(0, t.total - t.offsetAt(u + 1)),
|
|
3884
|
+
virtualized: !0
|
|
3885
|
+
};
|
|
3886
|
+
}
|
|
3887
|
+
function fn(t, n) {
|
|
3888
|
+
const r = [];
|
|
3889
|
+
for (let o = n.start; o <= n.end; o += 1) {
|
|
3890
|
+
const s = t.offsetAt(o), e = t.sizeAt(o);
|
|
3891
|
+
r.push({ index: o, key: o, start: s, end: s + e, size: e });
|
|
3892
|
+
}
|
|
3893
|
+
return r;
|
|
3894
|
+
}
|
|
3895
|
+
function ks(t, n) {
|
|
3896
|
+
return n.end < n.start ? { startPx: 0, endPx: 0 } : {
|
|
3897
|
+
startPx: t.offsetAt(n.start),
|
|
3898
|
+
endPx: t.offsetAt(n.end + 1)
|
|
3899
|
+
};
|
|
3900
|
+
}
|
|
3901
|
+
function hn(t, n) {
|
|
3902
|
+
return t.start === n.start && t.end === n.end && t.virtualized === n.virtualized && t.padStart === n.padStart && t.padEnd === n.padEnd;
|
|
3903
|
+
}
|
|
3904
|
+
function Ps({
|
|
3905
|
+
scrollRef: t,
|
|
3906
|
+
row: n,
|
|
3907
|
+
col: r
|
|
3908
|
+
}) {
|
|
3909
|
+
const [o, s] = ut(() => ({
|
|
3910
|
+
row: Oe(n.count),
|
|
3911
|
+
col: Oe(r.count)
|
|
3912
|
+
})), e = Z({ top: 0, left: 0 }), a = Z(0), i = z(() => {
|
|
3913
|
+
const l = t.current;
|
|
3914
|
+
if (!l) return;
|
|
3915
|
+
const { scrollTop: f, scrollLeft: h, clientHeight: w, clientWidth: p } = l, d = mn(f, e.current.top), m = mn(h, e.current.left);
|
|
3916
|
+
e.current = { top: f, left: h };
|
|
3917
|
+
const D = {
|
|
3918
|
+
row: dn(n, f, w, 5, d),
|
|
3919
|
+
col: dn(r, h, p, 5, m)
|
|
3920
|
+
};
|
|
3921
|
+
s(
|
|
3922
|
+
(b) => hn(b.row, D.row) && hn(b.col, D.col) ? b : D
|
|
3923
|
+
);
|
|
3924
|
+
}, [t, n, r]), c = z(() => {
|
|
3925
|
+
a.current === 0 && (a.current = requestAnimationFrame(() => {
|
|
3926
|
+
a.current = 0, i();
|
|
3927
|
+
}));
|
|
3928
|
+
}, [i]);
|
|
3929
|
+
Rt(() => {
|
|
3930
|
+
const l = t.current;
|
|
3931
|
+
if (!l) return;
|
|
3932
|
+
i(), l.addEventListener("scroll", c, { passive: !0 });
|
|
3933
|
+
const f = new ResizeObserver(i);
|
|
3934
|
+
return f.observe(l), () => {
|
|
3935
|
+
l.removeEventListener("scroll", c), f.disconnect();
|
|
3936
|
+
};
|
|
3937
|
+
}, [t, c, i]), it(
|
|
3938
|
+
() => () => {
|
|
3939
|
+
a.current !== 0 && cancelAnimationFrame(a.current);
|
|
3940
|
+
},
|
|
3941
|
+
[]
|
|
3942
|
+
);
|
|
3943
|
+
const u = z(
|
|
3944
|
+
(l, f = "start") => {
|
|
3945
|
+
const h = t.current;
|
|
3946
|
+
if (!h || l < 0 || l >= n.count) return;
|
|
3947
|
+
const w = h.clientHeight, p = n.offsetAt(l), d = n.sizeAt(l), m = h.scrollTop;
|
|
3948
|
+
let D = p;
|
|
3949
|
+
if (f === "center") D = p - (w - d) / 2;
|
|
3950
|
+
else if (f === "end") D = p - w + d;
|
|
3951
|
+
else if (f === "auto") {
|
|
3952
|
+
if (p >= m && p + d <= m + w) return;
|
|
3953
|
+
D = p < m ? p : p - w + d;
|
|
3954
|
+
}
|
|
3955
|
+
h.scrollTo({ top: Math.max(0, D) });
|
|
3956
|
+
},
|
|
3957
|
+
[t, n]
|
|
3958
|
+
);
|
|
3959
|
+
return { row: o.row, col: o.col, scrollToRow: u };
|
|
3960
|
+
}
|
|
3961
|
+
function mn(t, n) {
|
|
3962
|
+
return t > n ? 1 : t < n ? -1 : 0;
|
|
3963
|
+
}
|
|
3964
|
+
function Ts({
|
|
3965
|
+
rowCount: t,
|
|
3966
|
+
bottomRowCells: n,
|
|
3967
|
+
scrollRef: r
|
|
3968
|
+
}) {
|
|
3969
|
+
var w;
|
|
3970
|
+
const o = j(() => _n(t, xt), [t]), s = j(() => {
|
|
3971
|
+
const p = n.map((d) => d.widthPx);
|
|
3972
|
+
return Is(p.length, p);
|
|
3973
|
+
}, [n]), { row: e, col: a, scrollToRow: i } = Ps({
|
|
3974
|
+
scrollRef: r,
|
|
3975
|
+
row: o,
|
|
3976
|
+
col: s
|
|
3977
|
+
}), c = j(
|
|
3978
|
+
() => fn(o, e),
|
|
3979
|
+
[o, e]
|
|
3980
|
+
), u = j(
|
|
3981
|
+
() => fn(s, a),
|
|
3982
|
+
[s, a]
|
|
3983
|
+
), { startPx: l, endPx: f } = ks(s, a), h = z(
|
|
3984
|
+
(p, d) => p + d >= l && p <= f,
|
|
3985
|
+
[l, f]
|
|
3986
|
+
);
|
|
3987
|
+
return {
|
|
3988
|
+
virtualRows: c,
|
|
3989
|
+
totalHeight: o.total,
|
|
3990
|
+
virtualCells: u,
|
|
3991
|
+
leadingCellPx: ((w = u[0]) == null ? void 0 : w.start) ?? 0,
|
|
3992
|
+
rowStartPx: e.padStart,
|
|
3993
|
+
rowEndPx: o.offsetAt(e.end + 1),
|
|
3994
|
+
isBarVisible: h,
|
|
3995
|
+
scrollToRow: i
|
|
3996
|
+
};
|
|
3997
|
+
}
|
|
3998
|
+
function Es({
|
|
3999
|
+
enabled: t,
|
|
4000
|
+
scrollRef: n,
|
|
4001
|
+
selectedScale: r,
|
|
4002
|
+
bottomRowCells: o,
|
|
4003
|
+
totalWidth: s,
|
|
4004
|
+
viewportInsetPx: e,
|
|
4005
|
+
pinnedStart: a,
|
|
4006
|
+
pinnedEnd: i
|
|
4007
|
+
}) {
|
|
4008
|
+
const [c, u] = ut({ scale: r, value: Se }), l = c.scale === r ? c.value : Se, f = ht(r), h = ht(o), w = ht(s), p = ht(e), d = ht(l);
|
|
4009
|
+
return it(() => {
|
|
4010
|
+
if (!t) return;
|
|
4011
|
+
const m = n.current;
|
|
4012
|
+
if (!m) return;
|
|
4013
|
+
const D = () => {
|
|
4014
|
+
const b = h.current, S = w.current;
|
|
4015
|
+
if (!b.length || S <= 0) return;
|
|
4016
|
+
const L = Wr({
|
|
4017
|
+
current: d.current,
|
|
4018
|
+
scrollLeft: m.scrollLeft,
|
|
4019
|
+
viewportPx: m.clientWidth - p.current,
|
|
4020
|
+
totalPx: S,
|
|
4021
|
+
pxPerTick: S / b.length,
|
|
4022
|
+
canExtend: { before: !a, after: !i }
|
|
4023
|
+
});
|
|
4024
|
+
L && (d.current = L, u({ scale: f.current, value: L }));
|
|
4025
|
+
};
|
|
4026
|
+
return D(), m.addEventListener("scroll", D, { passive: !0 }), () => m.removeEventListener("scroll", D);
|
|
4027
|
+
}, [
|
|
4028
|
+
t,
|
|
4029
|
+
o,
|
|
4030
|
+
a,
|
|
4031
|
+
i,
|
|
4032
|
+
n,
|
|
4033
|
+
h,
|
|
4034
|
+
w,
|
|
4035
|
+
d,
|
|
4036
|
+
p,
|
|
4037
|
+
f
|
|
4038
|
+
]), l;
|
|
4039
|
+
}
|
|
4040
|
+
function Ls({
|
|
4041
|
+
rawTasks: t,
|
|
4042
|
+
selectedScale: n,
|
|
4043
|
+
visibleRange: r,
|
|
4044
|
+
hierarchy: o,
|
|
4045
|
+
extension: s,
|
|
4046
|
+
scrollRef: e,
|
|
4047
|
+
bottomRowCells: a
|
|
4048
|
+
}) {
|
|
4049
|
+
const i = ht(n), c = ht(a), u = Q((m) => m.setBottomRowCells), l = Q((m) => m.setTransformedTasks), f = Q((m) => m.clearAllDragOffsets), h = Q((m) => m.setSelectedScale), w = Z([]), p = Z(0), d = Z(null);
|
|
4050
|
+
return Rt(() => {
|
|
4051
|
+
const { bottomCells: m, transformedTasks: D } = ao(
|
|
4052
|
+
t,
|
|
4053
|
+
n,
|
|
4054
|
+
r,
|
|
4055
|
+
o,
|
|
4056
|
+
s
|
|
4057
|
+
), b = w.current;
|
|
4058
|
+
b.length && m.length && (p.current += Jr(
|
|
4059
|
+
b,
|
|
4060
|
+
m,
|
|
4061
|
+
n
|
|
4062
|
+
)), w.current = m, u(m), l(D), f();
|
|
4063
|
+
}, [
|
|
4064
|
+
t,
|
|
4065
|
+
n,
|
|
4066
|
+
r,
|
|
4067
|
+
o,
|
|
4068
|
+
s,
|
|
4069
|
+
u,
|
|
4070
|
+
l,
|
|
4071
|
+
f
|
|
4072
|
+
]), Rt(() => {
|
|
4073
|
+
const m = e.current, D = d.current;
|
|
4074
|
+
if (D) {
|
|
4075
|
+
d.current = null, p.current = 0;
|
|
4076
|
+
const S = Lt(
|
|
4077
|
+
D.date,
|
|
4078
|
+
a,
|
|
4079
|
+
i.current
|
|
4080
|
+
);
|
|
4081
|
+
if (m && S !== null) {
|
|
4082
|
+
m.scrollLeft = Math.max(0, S - D.viewportX);
|
|
4083
|
+
return;
|
|
4084
|
+
}
|
|
4085
|
+
}
|
|
4086
|
+
const b = p.current;
|
|
4087
|
+
b && (p.current = 0, m && (m.scrollLeft += b));
|
|
4088
|
+
}, [a, e, i]), z(
|
|
4089
|
+
(m, D) => {
|
|
4090
|
+
if (m === i.current) {
|
|
4091
|
+
const b = e.current, S = Lt(D.date, c.current, m);
|
|
4092
|
+
b && S !== null && (b.scrollLeft = Math.max(0, S - D.viewportX));
|
|
4093
|
+
return;
|
|
4094
|
+
}
|
|
4095
|
+
d.current = D, h(m);
|
|
4096
|
+
},
|
|
4097
|
+
[h, e, i, c]
|
|
4098
|
+
);
|
|
4099
|
+
}
|
|
4100
|
+
function As({
|
|
4101
|
+
enabled: t,
|
|
4102
|
+
scrollRef: n,
|
|
4103
|
+
selectedScale: r,
|
|
4104
|
+
bottomRowCells: o,
|
|
4105
|
+
viewportInsetPx: s,
|
|
4106
|
+
zoomTo: e
|
|
4107
|
+
}) {
|
|
4108
|
+
const a = ht(r), i = ht(o), c = ht(s);
|
|
4109
|
+
it(() => {
|
|
4110
|
+
if (!t) return;
|
|
4111
|
+
const u = n.current;
|
|
4112
|
+
if (!u) return;
|
|
4113
|
+
const l = { ...Cr }, f = (h) => {
|
|
4114
|
+
if (!h.ctrlKey && !h.metaKey) return;
|
|
4115
|
+
h.preventDefault();
|
|
4116
|
+
const { state: w, step: p } = Fr(
|
|
4117
|
+
l,
|
|
4118
|
+
h.deltaY,
|
|
4119
|
+
h.timeStamp
|
|
4120
|
+
);
|
|
4121
|
+
if (Object.assign(l, w), !p) return;
|
|
4122
|
+
const d = In(a.current, p);
|
|
4123
|
+
if (d === a.current) return;
|
|
4124
|
+
const m = u.getBoundingClientRect(), D = c.current, b = Math.min(
|
|
4125
|
+
Math.max(h.clientX - m.left, D),
|
|
4126
|
+
u.clientWidth
|
|
4127
|
+
) - D, S = Pn(
|
|
4128
|
+
u.scrollLeft + b,
|
|
4129
|
+
i.current,
|
|
4130
|
+
a.current
|
|
4131
|
+
);
|
|
4132
|
+
S && e(d, { date: S, viewportX: b });
|
|
4133
|
+
};
|
|
4134
|
+
return u.addEventListener("wheel", f, { passive: !1 }), () => u.removeEventListener("wheel", f);
|
|
4135
|
+
}, [t, e, n, a, i, c]);
|
|
4136
|
+
}
|
|
4137
|
+
function Ns(t, n) {
|
|
4138
|
+
const r = ht(n), o = Z(t);
|
|
4139
|
+
it(() => {
|
|
4140
|
+
var s;
|
|
4141
|
+
t !== o.current && (o.current = t, (s = r.current) == null || s.call(r, t));
|
|
4142
|
+
}, [t, r]);
|
|
4143
|
+
}
|
|
4144
|
+
function Rs(t, n, r) {
|
|
4145
|
+
const o = ht(n), s = ht(r), e = Z("");
|
|
4146
|
+
it(() => {
|
|
4147
|
+
const a = s.current;
|
|
4148
|
+
if (!a) return;
|
|
4149
|
+
const i = eo(t, o.current);
|
|
4150
|
+
if (!i) return;
|
|
4151
|
+
const c = `${i.start.valueOf()}:${i.end.valueOf()}`;
|
|
4152
|
+
c !== e.current && (e.current = c, a(i));
|
|
4153
|
+
}, [t, o, s]);
|
|
4154
|
+
}
|
|
4155
|
+
function _s(t, n, r) {
|
|
4156
|
+
const o = Z(!1);
|
|
4157
|
+
it(() => {
|
|
4158
|
+
if (o.current || !t || !n.length) return;
|
|
4159
|
+
o.current = !0;
|
|
4160
|
+
const s = t === "today" ? H() : t;
|
|
4161
|
+
r.scrollToDate(s, { smooth: !1 });
|
|
4162
|
+
}, [t, n, r]);
|
|
4163
|
+
}
|
|
4164
|
+
const Yn = "(prefers-color-scheme: dark)", Hn = () => typeof window < "u" && typeof window.matchMedia == "function", Cn = () => Hn() && window.matchMedia(Yn).matches, Ys = () => {
|
|
4165
|
+
if (typeof document > "u") return "light";
|
|
4166
|
+
const t = getComputedStyle(document.documentElement).colorScheme, n = t.includes("light"), r = t.includes("dark");
|
|
4167
|
+
return n && r ? Cn() ? "dark" : "light" : r ? "dark" : "light";
|
|
4168
|
+
}, Hs = (t) => {
|
|
4169
|
+
if (typeof window > "u") return () => {
|
|
4170
|
+
};
|
|
4171
|
+
const n = Hn() ? window.matchMedia(Yn) : null;
|
|
4172
|
+
n == null || n.addEventListener("change", t);
|
|
4173
|
+
const r = new MutationObserver(t);
|
|
4174
|
+
return r.observe(document.documentElement, {
|
|
4175
|
+
attributes: !0,
|
|
4176
|
+
attributeFilter: ["class", "style", "data-theme"]
|
|
4177
|
+
}), () => {
|
|
4178
|
+
n == null || n.removeEventListener("change", t), r.disconnect();
|
|
4179
|
+
};
|
|
4180
|
+
}, Cs = () => "light";
|
|
4181
|
+
function Fs(t) {
|
|
4182
|
+
const n = Qn(
|
|
4183
|
+
Hs,
|
|
4184
|
+
t === "system" ? () => Cn() ? "dark" : "light" : Ys,
|
|
4185
|
+
Cs
|
|
4186
|
+
);
|
|
4187
|
+
return t === "light" || t === "dark" ? t : n;
|
|
4188
|
+
}
|
|
4189
|
+
function Us(t = "month") {
|
|
4190
|
+
return nr()((n, r) => ({
|
|
4191
|
+
rawTasks: [],
|
|
4192
|
+
transformedTasks: [],
|
|
4193
|
+
rowTasks: [],
|
|
4194
|
+
bottomRowCells: [],
|
|
4195
|
+
selectedScale: t,
|
|
4196
|
+
currentTask: null,
|
|
4197
|
+
dragMode: null,
|
|
4198
|
+
dragOffsets: {},
|
|
4199
|
+
localeOptions: void 0,
|
|
4200
|
+
linkDraft: null,
|
|
4201
|
+
reorderDraft: null,
|
|
4202
|
+
selectedDependency: null,
|
|
4203
|
+
selectedTaskId: null,
|
|
4204
|
+
hoveredTaskId: null,
|
|
4205
|
+
setCurrentTask: (o) => n({ currentTask: o }),
|
|
4206
|
+
setDragMode: (o) => {
|
|
4207
|
+
r().dragMode !== o && n({ dragMode: o });
|
|
4208
|
+
},
|
|
4209
|
+
setLinkDraft: (o) => n({ linkDraft: o }),
|
|
4210
|
+
setReorderDraft: (o) => n({ reorderDraft: o }),
|
|
4211
|
+
setSelectedDependency: (o) => n(
|
|
4212
|
+
(s) => {
|
|
4213
|
+
var e, a;
|
|
4214
|
+
return ((e = s.selectedDependency) == null ? void 0 : e.sourceId) === (o == null ? void 0 : o.sourceId) && ((a = s.selectedDependency) == null ? void 0 : a.targetId) === (o == null ? void 0 : o.targetId) ? s : { selectedDependency: o };
|
|
4215
|
+
}
|
|
4216
|
+
),
|
|
4217
|
+
setLocaleOptions: (o) => n({ localeOptions: o }),
|
|
4218
|
+
setSelectedTaskId: (o) => {
|
|
4219
|
+
r().selectedTaskId !== o && n({ selectedTaskId: o });
|
|
4220
|
+
},
|
|
4221
|
+
// Guarded: without it a pointer moving inside one bar re-renders the arrow layer every event
|
|
4222
|
+
setHoveredTaskId: (o) => {
|
|
4223
|
+
r().hoveredTaskId !== o && n({ hoveredTaskId: o });
|
|
4224
|
+
},
|
|
4225
|
+
setSelectedScale: (o) => {
|
|
4226
|
+
r().selectedScale !== o && n({ selectedScale: o });
|
|
4227
|
+
},
|
|
4228
|
+
setRawTasks: (o) => n({ rawTasks: o }),
|
|
4229
|
+
syncTasksFromProps: (o) => n(
|
|
4230
|
+
(s) => JSON.stringify(s.rawTasks) === JSON.stringify(o) ? s : { rawTasks: o }
|
|
4231
|
+
),
|
|
4232
|
+
setBottomRowCells: (o) => n({ bottomRowCells: o }),
|
|
4233
|
+
setTransformedTasks: (o) => n({ transformedTasks: o }),
|
|
4234
|
+
setRowTasks: (o) => n({ rowTasks: o }),
|
|
4235
|
+
// Runs every drag frame - one store update even when a whole subtree moves
|
|
4236
|
+
setDragOffsets: (o) => n((s) => ({
|
|
4237
|
+
dragOffsets: { ...s.dragOffsets, ...o }
|
|
4238
|
+
})),
|
|
4239
|
+
clearDragOffsets: (o) => n((s) => {
|
|
4240
|
+
const e = { ...s.dragOffsets };
|
|
4241
|
+
let a = !1;
|
|
4242
|
+
for (const i of o)
|
|
4243
|
+
i in e && (delete e[i], a = !0);
|
|
4244
|
+
return a ? { dragOffsets: e } : s;
|
|
4245
|
+
}),
|
|
4246
|
+
// Keeps an in-progress drag's offset, so a drag started right after a drop is not swept away.
|
|
4247
|
+
clearAllDragOffsets: () => n((o) => {
|
|
4248
|
+
var a;
|
|
4249
|
+
const s = (a = o.currentTask) == null ? void 0 : a.id, e = Object.keys(o.dragOffsets);
|
|
4250
|
+
return e.length ? !s || !o.dragOffsets[s] ? { dragOffsets: {} } : e.length === 1 ? o : { dragOffsets: { [s]: o.dragOffsets[s] } } : o;
|
|
4251
|
+
}),
|
|
4252
|
+
getTotalWidth: () => r().bottomRowCells.reduce((s, e) => s + e.widthPx, 0)
|
|
4253
|
+
}));
|
|
4254
|
+
}
|
|
4255
|
+
const Tt = "day", pn = 366, Ws = 18263, Gs = "YYYY-MM-DD", Xs = [1, 2, 3, 4, 5];
|
|
4256
|
+
function Fn(t) {
|
|
4257
|
+
const n = t ? (s) => !t(s) : () => !0, r = (s, e) => {
|
|
4258
|
+
if (!e || !t) return s.add(e, Tt);
|
|
4259
|
+
const a = e > 0 ? 1 : -1;
|
|
4260
|
+
let i = Math.abs(e), c = s, u = Math.abs(e) + pn * Math.abs(e);
|
|
4261
|
+
for (; i > 0; )
|
|
4262
|
+
if (c = c.add(a, Tt), n(c) && i--, u-- <= 0) return s.add(e, Tt);
|
|
4263
|
+
return c;
|
|
4264
|
+
}, o = (s, e) => {
|
|
4265
|
+
const a = s.startOf(Tt), i = e.startOf(Tt), c = i.diff(a, Tt);
|
|
4266
|
+
if (!t || c === 0 || Math.abs(c) > Ws) return c;
|
|
4267
|
+
const u = c > 0 ? 1 : -1;
|
|
4268
|
+
let l = u > 0 ? a : i;
|
|
4269
|
+
const f = u > 0 ? i : a;
|
|
4270
|
+
let h = 0;
|
|
4271
|
+
for (; l.valueOf() < f.valueOf(); )
|
|
4272
|
+
l = l.add(1, Tt), n(l) && h++;
|
|
4273
|
+
return h === 0 ? 0 : h * u;
|
|
4274
|
+
};
|
|
4275
|
+
return {
|
|
4276
|
+
skipsNonWorkingDays: t !== null,
|
|
4277
|
+
isWorkingDay: n,
|
|
4278
|
+
addDays: r,
|
|
4279
|
+
daysBetween: o,
|
|
4280
|
+
// daysBetween is day-granular, so correct by whole steps once time of day is counted.
|
|
4281
|
+
daysUntil(s, e) {
|
|
4282
|
+
let a = o(s, e);
|
|
4283
|
+
const i = e.valueOf();
|
|
4284
|
+
for (let c = 0; c < 2 && r(s, a).valueOf() < i; c++) a++;
|
|
4285
|
+
for (let c = 0; c < 2 && r(s, a - 1).valueOf() >= i; c++) a--;
|
|
4286
|
+
return a;
|
|
4287
|
+
},
|
|
4288
|
+
daysUpTo(s, e) {
|
|
4289
|
+
let a = o(s, e);
|
|
4290
|
+
const i = e.valueOf();
|
|
4291
|
+
for (let c = 0; c < 2 && r(s, a).valueOf() > i; c++) a--;
|
|
4292
|
+
for (let c = 0; c < 2 && r(s, a + 1).valueOf() <= i; c++) a++;
|
|
4293
|
+
return a;
|
|
4294
|
+
},
|
|
4295
|
+
snapForward(s) {
|
|
4296
|
+
if (!t || n(s)) return s;
|
|
4297
|
+
let e = s;
|
|
4298
|
+
for (let a = 0; a < pn; a++)
|
|
4299
|
+
if (e = e.add(1, Tt), n(e)) return e;
|
|
4300
|
+
return s;
|
|
4301
|
+
}
|
|
4302
|
+
};
|
|
4303
|
+
}
|
|
4304
|
+
const Bs = Fn(null);
|
|
4305
|
+
function zs(t = {}) {
|
|
4306
|
+
const n = new Set(t.workingWeekdays ?? Xs), r = new Set(t.holidays ?? []);
|
|
4307
|
+
return Fn(
|
|
4308
|
+
(o) => !n.has(o.day()) || r.has(o.format(Gs))
|
|
4309
|
+
);
|
|
4310
|
+
}
|
|
4311
|
+
const js = "YYYY-MM-DD", qs = 366, Ks = { byDate: /* @__PURE__ */ new Map(), dates: [] };
|
|
4312
|
+
function Vs(t) {
|
|
4313
|
+
if (!(t != null && t.length)) return Ks;
|
|
4314
|
+
const n = /* @__PURE__ */ new Map();
|
|
4315
|
+
for (const r of t) {
|
|
4316
|
+
const o = typeof r == "string" ? { date: r } : r, s = ae(o.date);
|
|
4317
|
+
if (!s.isValid()) continue;
|
|
4318
|
+
const e = o.endDate ? ae(o.endDate) : s, a = e.isValid() && !e.isBefore(s, "day") ? Math.min(e.diff(s, "day"), qs - 1) : 0;
|
|
4319
|
+
for (let i = 0; i <= a; i++) {
|
|
4320
|
+
const c = s.add(i, "day").format(js);
|
|
4321
|
+
n.has(c) || n.set(c, o);
|
|
4322
|
+
}
|
|
4323
|
+
}
|
|
4324
|
+
return { byDate: n, dates: [...n.keys()] };
|
|
4325
|
+
}
|
|
4326
|
+
const Zs = 600, Js = "100%", Qs = [], ra = tr(function(n, r) {
|
|
4327
|
+
const [o] = ut(() => Us(n.defaultScale));
|
|
4328
|
+
return /* @__PURE__ */ P($n.Provider, { value: o, children: /* @__PURE__ */ P(ta, { ...n, forwardedRef: r }) });
|
|
4329
|
+
});
|
|
4330
|
+
function ta({
|
|
4331
|
+
tasks: t = Qs,
|
|
4332
|
+
onTasksChange: n,
|
|
4333
|
+
height: r = Zs,
|
|
4334
|
+
width: o = Js,
|
|
4335
|
+
theme: s,
|
|
4336
|
+
className: e,
|
|
4337
|
+
showNonWorkingDays: a = !0,
|
|
4338
|
+
workingWeekdays: i,
|
|
4339
|
+
holidays: c,
|
|
4340
|
+
initialScrollTo: u,
|
|
4341
|
+
readOnly: l,
|
|
4342
|
+
allowMove: f,
|
|
4343
|
+
allowResize: h,
|
|
4344
|
+
allowProgressChange: w,
|
|
4345
|
+
minDate: p,
|
|
4346
|
+
maxDate: d,
|
|
4347
|
+
visibleStart: m,
|
|
4348
|
+
visibleEnd: D,
|
|
4349
|
+
locale: b,
|
|
4350
|
+
formats: S,
|
|
4351
|
+
firstDayOfWeek: L,
|
|
4352
|
+
showTaskList: N,
|
|
4353
|
+
showRowNumbers: x = !1,
|
|
4354
|
+
hierarchy: _ = !1,
|
|
4355
|
+
collapsedIds: A,
|
|
4356
|
+
defaultCollapsedIds: v,
|
|
4357
|
+
onCollapsedChange: g,
|
|
4358
|
+
workingCalendar: R = !1,
|
|
4359
|
+
allowLinkCreate: F,
|
|
4360
|
+
allowLinkDelete: U,
|
|
4361
|
+
allowTaskCreate: T,
|
|
4362
|
+
allowReorder: M,
|
|
4363
|
+
onTaskMove: I,
|
|
4364
|
+
onDependencyCreate: y,
|
|
4365
|
+
onDependencyDelete: $,
|
|
4366
|
+
onTaskCreate: k,
|
|
4367
|
+
onTaskClick: E,
|
|
4368
|
+
onTaskDoubleClick: C,
|
|
4369
|
+
onTaskSelect: X,
|
|
4370
|
+
selectable: q,
|
|
4371
|
+
renderDetail: tt,
|
|
4372
|
+
showDetail: rt,
|
|
4373
|
+
detailTaskId: wt,
|
|
4374
|
+
onDetailChange: ot,
|
|
4375
|
+
showTooltip: gt,
|
|
4376
|
+
zoomOnWheel: O = !1,
|
|
4377
|
+
infiniteScroll: G = !1,
|
|
4378
|
+
onRangeChange: B,
|
|
4379
|
+
onScaleChange: ct,
|
|
4380
|
+
autoScrollOnDrag: st = !0,
|
|
4381
|
+
forwardedRef: bt
|
|
4382
|
+
}) {
|
|
4383
|
+
const {
|
|
4384
|
+
rawTasks: at,
|
|
4385
|
+
transformedTasks: nt,
|
|
4386
|
+
bottomRowCells: K,
|
|
4387
|
+
selectedScale: V,
|
|
4388
|
+
selectedTaskId: $t,
|
|
4389
|
+
syncTasksFromProps: lt,
|
|
4390
|
+
setSelectedScale: St,
|
|
4391
|
+
setLocaleOptions: Mt,
|
|
4392
|
+
getTotalWidth: Ot
|
|
4393
|
+
} = ls(), Y = j(
|
|
4394
|
+
() => b === void 0 && S === void 0 && L === void 0 ? void 0 : { locale: b, formats: S, firstDayOfWeek: L },
|
|
4395
|
+
[b, S, L]
|
|
4396
|
+
);
|
|
4397
|
+
Rt(() => {
|
|
4398
|
+
Mt(Y);
|
|
4399
|
+
}, [Y, Mt]);
|
|
4400
|
+
const W = Z(null), et = Z(null), mt = ns({
|
|
4401
|
+
readOnly: l,
|
|
4402
|
+
allowMove: f,
|
|
4403
|
+
allowResize: h,
|
|
4404
|
+
allowProgressChange: w,
|
|
4405
|
+
allowLinkCreate: F,
|
|
4406
|
+
allowLinkDelete: U,
|
|
4407
|
+
allowTaskCreate: T,
|
|
4408
|
+
allowReorder: M,
|
|
4409
|
+
minDate: p,
|
|
4410
|
+
maxDate: d
|
|
4411
|
+
}), ft = Ss({ showTaskList: N }), Bt = ft.visible ? 1 : 0, zt = Ot(), Un = Es({
|
|
4412
|
+
enabled: G,
|
|
4413
|
+
scrollRef: W,
|
|
4414
|
+
selectedScale: V,
|
|
4415
|
+
bottomRowCells: K,
|
|
4416
|
+
totalWidth: zt,
|
|
4417
|
+
viewportInsetPx: ft.inset,
|
|
4418
|
+
pinnedStart: !!m,
|
|
4419
|
+
pinnedEnd: !!D
|
|
4420
|
+
}), kt = Jo({
|
|
4421
|
+
collapsedIds: A,
|
|
4422
|
+
defaultCollapsedIds: v,
|
|
4423
|
+
onCollapsedChange: g
|
|
4424
|
+
}), Le = Ms({
|
|
4425
|
+
hierarchy: _,
|
|
4426
|
+
interaction: mt,
|
|
4427
|
+
collapsedIds: kt.collapsedIds,
|
|
4428
|
+
onTasksChange: n,
|
|
4429
|
+
onTaskMove: I,
|
|
4430
|
+
onExpand: kt.expand
|
|
4431
|
+
}), Wn = j(
|
|
4432
|
+
() => M === !0 || at.some((pt) => pt.allowReorder === !0),
|
|
4433
|
+
[M, at]
|
|
4434
|
+
), jt = j(() => Vs(c), [c]), de = j(
|
|
4435
|
+
() => zs({
|
|
4436
|
+
workingWeekdays: i,
|
|
4437
|
+
holidays: jt.dates
|
|
4438
|
+
}),
|
|
4439
|
+
[i, jt]
|
|
4440
|
+
), Ae = z(
|
|
4441
|
+
(pt) => {
|
|
4442
|
+
if (de.isWorkingDay(pt)) return null;
|
|
4443
|
+
const Jt = jt.byDate.get(pt.format("YYYY-MM-DD"));
|
|
4444
|
+
return Jt ? { key: Jt.date, label: Jt.label, color: Jt.color } : { key: Zr };
|
|
4445
|
+
},
|
|
4446
|
+
[de, jt]
|
|
4447
|
+
), Gn = R ? de : Bs, fe = rt ?? tt !== void 0, he = us({
|
|
4448
|
+
// The panel turns selection on unless the host has said otherwise
|
|
4449
|
+
selectable: q ?? (fe ? !0 : void 0),
|
|
4450
|
+
onTaskSelect: X,
|
|
4451
|
+
onTaskClick: E
|
|
4452
|
+
}), vt = ws({
|
|
4453
|
+
enabled: fe,
|
|
4454
|
+
tasks: nt,
|
|
4455
|
+
detailTaskId: wt,
|
|
4456
|
+
onDetailChange: ot,
|
|
4457
|
+
onTaskClick: he.onTaskClick
|
|
4458
|
+
}), qt = ys(vt.task), Xn = j(
|
|
4459
|
+
() => ({
|
|
4460
|
+
onTasksChange: n,
|
|
4461
|
+
onTaskClick: vt.onTaskClick,
|
|
4462
|
+
onTaskDoubleClick: C,
|
|
4463
|
+
showTooltip: gt
|
|
4464
|
+
}),
|
|
4465
|
+
[n, vt.onTaskClick, C, gt]
|
|
4466
|
+
), { rows: Pt, tasks: Kt } = ss({
|
|
4467
|
+
rawTasks: at,
|
|
4468
|
+
tasks: nt,
|
|
4469
|
+
hierarchy: _,
|
|
4470
|
+
collapsedIds: kt.collapsedIds
|
|
4471
|
+
}), Ne = Q((pt) => pt.setRowTasks);
|
|
4472
|
+
Rt(() => {
|
|
4473
|
+
Ne(Kt);
|
|
4474
|
+
}, [Kt, Ne]);
|
|
4475
|
+
const Ht = k !== void 0 && co(mt), { onDrawPointerDown: Bn, ghost: Vt } = es({
|
|
4476
|
+
enabled: Ht,
|
|
4477
|
+
rowCount: Pt.length,
|
|
4478
|
+
onTaskCreate: k
|
|
4479
|
+
}), me = z(() => {
|
|
4480
|
+
if (!Ht) return;
|
|
4481
|
+
const pt = Qo(H(), K, V);
|
|
4482
|
+
pt && (k == null || k(pt));
|
|
4483
|
+
}, [Ht, K, V, k]), It = Ts({
|
|
4484
|
+
rowCount: Pt.length,
|
|
4485
|
+
bottomRowCells: K,
|
|
4486
|
+
scrollRef: W
|
|
4487
|
+
}), zn = Fs(s), Re = Z(null);
|
|
4488
|
+
it(() => {
|
|
4489
|
+
const pt = JSON.stringify(t);
|
|
4490
|
+
pt !== Re.current && (Re.current = pt, lt(t));
|
|
4491
|
+
}, [t, lt]);
|
|
4492
|
+
const jn = j(
|
|
4493
|
+
() => m || D ? {
|
|
4494
|
+
start: m ? H(m) : void 0,
|
|
4495
|
+
end: D ? H(D) : void 0
|
|
4496
|
+
} : void 0,
|
|
4497
|
+
[m, D]
|
|
4498
|
+
), _e = Ls({
|
|
4499
|
+
rawTasks: at,
|
|
4500
|
+
selectedScale: V,
|
|
4501
|
+
visibleRange: jn,
|
|
4502
|
+
hierarchy: _,
|
|
4503
|
+
extension: Un,
|
|
4504
|
+
scrollRef: W,
|
|
4505
|
+
bottomRowCells: K
|
|
4506
|
+
});
|
|
4507
|
+
As({
|
|
4508
|
+
enabled: O,
|
|
4509
|
+
scrollRef: W,
|
|
4510
|
+
selectedScale: V,
|
|
4511
|
+
bottomRowCells: K,
|
|
4512
|
+
viewportInsetPx: ft.inset,
|
|
4513
|
+
zoomTo: _e
|
|
4514
|
+
}), Rs(K, V, B), Ns(V, ct);
|
|
4515
|
+
const Ye = j(
|
|
4516
|
+
() => Lt(H(), K, V),
|
|
4517
|
+
[K, V]
|
|
4518
|
+
), He = j(() => a ? Qr(
|
|
4519
|
+
K,
|
|
4520
|
+
V,
|
|
4521
|
+
Ae
|
|
4522
|
+
) : [], [a, Ae, K, V]), Zt = bs({
|
|
4523
|
+
scrollRef: W,
|
|
4524
|
+
bottomRowCells: K,
|
|
4525
|
+
transformedTasks: Kt,
|
|
4526
|
+
selectedScale: V,
|
|
4527
|
+
rowHeight: xt,
|
|
4528
|
+
viewportInsetPx: ft.inset,
|
|
4529
|
+
zoomTo: _e,
|
|
4530
|
+
setSelectedScale: St
|
|
4531
|
+
});
|
|
4532
|
+
er(
|
|
4533
|
+
bt,
|
|
4534
|
+
() => ({
|
|
4535
|
+
...Zt,
|
|
4536
|
+
openDetail: vt.open,
|
|
4537
|
+
closeDetail: vt.close,
|
|
4538
|
+
addTask: me
|
|
4539
|
+
}),
|
|
4540
|
+
[Zt, vt.open, vt.close, me]
|
|
4541
|
+
);
|
|
4542
|
+
const Ct = os({
|
|
4543
|
+
// Enter opens the panel, the way a click does
|
|
4544
|
+
onActivate: fe ? vt.open : void 0,
|
|
4545
|
+
rows: Pt,
|
|
4546
|
+
rawTasks: at,
|
|
4547
|
+
gridColumnCount: Bt,
|
|
4548
|
+
hierarchy: _,
|
|
4549
|
+
collapsedIds: kt.collapsedIds,
|
|
4550
|
+
selectedScale: V,
|
|
4551
|
+
localeOptions: Y,
|
|
4552
|
+
interaction: mt,
|
|
4553
|
+
onToggleCollapse: kt.toggle,
|
|
4554
|
+
onTasksChange: n,
|
|
4555
|
+
move: Le,
|
|
4556
|
+
scrollToRow: It.scrollToRow,
|
|
4557
|
+
scrollApi: Zt,
|
|
4558
|
+
bodyRef: et
|
|
4559
|
+
});
|
|
4560
|
+
_s(u, K, Zt);
|
|
4561
|
+
const qn = z(
|
|
4562
|
+
(pt) => {
|
|
4563
|
+
pt.target === pt.currentTarget && (he.select(null), vt.close());
|
|
4564
|
+
},
|
|
4565
|
+
[he, vt]
|
|
4566
|
+
), Kn = {
|
|
4567
|
+
height: typeof r == "number" ? `${r}px` : r,
|
|
4568
|
+
width: typeof o == "number" ? `${o}px` : o,
|
|
4569
|
+
// How far the pinned task list reaches in; left-pinned timeline content offsets by this
|
|
4570
|
+
"--gantt-pane-inset": `${ft.inset}px`,
|
|
4571
|
+
// Row height as a token, so CSS keeps the row pitch without a second copy of the number
|
|
4572
|
+
"--gantt-row-height": `${xt}px`
|
|
4573
|
+
}, Ce = { width: `${zt}px` };
|
|
4574
|
+
return /* @__PURE__ */ J(
|
|
4575
|
+
"section",
|
|
4576
|
+
{
|
|
4577
|
+
className: e ? `gantt-container ${e}` : "gantt-container",
|
|
4578
|
+
"data-theme": zn,
|
|
4579
|
+
style: Kn,
|
|
4580
|
+
children: [
|
|
4581
|
+
/* @__PURE__ */ P("div", { className: "gantt-sr-only", role: "status", "aria-live": "polite", children: Ct.announcement }),
|
|
4582
|
+
/* @__PURE__ */ J("div", { className: "gantt-layout", children: [
|
|
4583
|
+
/* @__PURE__ */ J("div", { className: "gantt-main", children: [
|
|
4584
|
+
/* @__PURE__ */ P("div", { ref: W, className: "gantt-scroll-container", children: /* @__PURE__ */ J(
|
|
4585
|
+
"div",
|
|
4586
|
+
{
|
|
4587
|
+
ref: et,
|
|
4588
|
+
className: "gantt-body",
|
|
4589
|
+
role: "treegrid",
|
|
4590
|
+
"aria-label": "Gantt chart",
|
|
4591
|
+
"aria-rowcount": Pt.length + (ft.visible ? 1 : 0),
|
|
4592
|
+
onKeyDown: Ct.onKeyDown,
|
|
4593
|
+
onFocusCapture: Ct.onFocusCapture,
|
|
4594
|
+
children: [
|
|
4595
|
+
ft.visible && /* @__PURE__ */ P(
|
|
4596
|
+
Wo,
|
|
4597
|
+
{
|
|
4598
|
+
rows: Pt,
|
|
4599
|
+
virtualItems: It.virtualRows,
|
|
4600
|
+
totalHeight: It.totalHeight,
|
|
4601
|
+
width: ft.width,
|
|
4602
|
+
showRowNumbers: x,
|
|
4603
|
+
hierarchy: _,
|
|
4604
|
+
collapsedIds: kt.collapsedIds,
|
|
4605
|
+
onToggleCollapse: kt.toggle,
|
|
4606
|
+
focus: Ct.focus,
|
|
4607
|
+
selectedTaskId: $t,
|
|
4608
|
+
onRowClick: vt.onTaskClick,
|
|
4609
|
+
onRowDoubleClick: C,
|
|
4610
|
+
reorderEnabled: Wn,
|
|
4611
|
+
interaction: mt,
|
|
4612
|
+
move: Le
|
|
4613
|
+
}
|
|
4614
|
+
),
|
|
4615
|
+
/* @__PURE__ */ J(
|
|
4616
|
+
"div",
|
|
4617
|
+
{
|
|
4618
|
+
className: "gantt-timeline",
|
|
4619
|
+
style: Ce,
|
|
4620
|
+
role: "presentation",
|
|
4621
|
+
children: [
|
|
4622
|
+
/* @__PURE__ */ J("div", { className: "gantt-header-wrapper", style: Ce, children: [
|
|
4623
|
+
/* @__PURE__ */ P(
|
|
4624
|
+
io,
|
|
4625
|
+
{
|
|
4626
|
+
bottomRowCells: K,
|
|
4627
|
+
selectedScale: V,
|
|
4628
|
+
width: zt,
|
|
4629
|
+
virtual: It
|
|
4630
|
+
}
|
|
4631
|
+
),
|
|
4632
|
+
/* @__PURE__ */ P(qo, { ranges: He }),
|
|
4633
|
+
/* @__PURE__ */ P(xo, {}),
|
|
4634
|
+
/* @__PURE__ */ P(Po, { leftPx: Ye })
|
|
4635
|
+
] }),
|
|
4636
|
+
/* @__PURE__ */ J(
|
|
4637
|
+
"div",
|
|
4638
|
+
{
|
|
4639
|
+
className: `gantt-content${Ht ? " drawable" : ""}`,
|
|
4640
|
+
style: {
|
|
4641
|
+
height: `${It.totalHeight}px`,
|
|
4642
|
+
width: `${zt}px`
|
|
4643
|
+
},
|
|
4644
|
+
role: "presentation",
|
|
4645
|
+
onPointerDown: Bn,
|
|
4646
|
+
onClick: qn,
|
|
4647
|
+
children: [
|
|
4648
|
+
/* @__PURE__ */ P(Ko, { ranges: He }),
|
|
4649
|
+
/* @__PURE__ */ P(
|
|
4650
|
+
Vo,
|
|
4651
|
+
{
|
|
4652
|
+
rows: Pt,
|
|
4653
|
+
virtualItems: It.virtualRows,
|
|
4654
|
+
ownedByTaskList: ft.visible,
|
|
4655
|
+
hierarchy: _,
|
|
4656
|
+
collapsedIds: kt.collapsedIds
|
|
4657
|
+
}
|
|
4658
|
+
),
|
|
4659
|
+
/* @__PURE__ */ P(ko, { leftPx: Ye }),
|
|
4660
|
+
Vt && /* @__PURE__ */ P(
|
|
4661
|
+
"div",
|
|
4662
|
+
{
|
|
4663
|
+
className: "gantt-draw-ghost",
|
|
4664
|
+
style: {
|
|
4665
|
+
left: `${Vt.leftPx}px`,
|
|
4666
|
+
width: `${Vt.widthPx}px`,
|
|
4667
|
+
// Same geometry as the bar this becomes, centred in the row
|
|
4668
|
+
height: `${ve}px`,
|
|
4669
|
+
marginTop: `${(xt - ve) / 2}px`,
|
|
4670
|
+
transform: `translateY(${Vt.topPx}px)`
|
|
4671
|
+
},
|
|
4672
|
+
"aria-hidden": "true"
|
|
4673
|
+
}
|
|
4674
|
+
),
|
|
4675
|
+
/* @__PURE__ */ P(
|
|
4676
|
+
Mo,
|
|
4677
|
+
{
|
|
4678
|
+
transformedTasks: Kt,
|
|
4679
|
+
rowCount: Pt.length,
|
|
4680
|
+
virtual: It,
|
|
4681
|
+
interaction: mt,
|
|
4682
|
+
onTasksChange: n,
|
|
4683
|
+
onDependencyDelete: $
|
|
4684
|
+
}
|
|
4685
|
+
),
|
|
4686
|
+
/* @__PURE__ */ P(
|
|
4687
|
+
jo,
|
|
4688
|
+
{
|
|
4689
|
+
rows: Pt,
|
|
4690
|
+
virtualItems: It.virtualRows,
|
|
4691
|
+
gridColumnCount: Bt,
|
|
4692
|
+
focus: Ct.focus,
|
|
4693
|
+
isBarVisible: It.isBarVisible,
|
|
4694
|
+
options: Xn,
|
|
4695
|
+
interaction: mt,
|
|
4696
|
+
calendar: Gn,
|
|
4697
|
+
autoScrollOnDrag: st,
|
|
4698
|
+
onDependencyCreate: y
|
|
4699
|
+
}
|
|
4700
|
+
)
|
|
4701
|
+
]
|
|
4702
|
+
}
|
|
4703
|
+
)
|
|
4704
|
+
]
|
|
4705
|
+
}
|
|
4706
|
+
)
|
|
4707
|
+
]
|
|
4708
|
+
}
|
|
4709
|
+
) }),
|
|
4710
|
+
ft.visible && /* @__PURE__ */ P(
|
|
4711
|
+
Io,
|
|
4712
|
+
{
|
|
4713
|
+
width: ft.width,
|
|
4714
|
+
onWidthChange: ft.setWidth
|
|
4715
|
+
}
|
|
4716
|
+
),
|
|
4717
|
+
ft.visible && Ht && /* @__PURE__ */ P(Oo, { width: ft.width, onAdd: me })
|
|
4718
|
+
] }),
|
|
4719
|
+
qt.task && /* @__PURE__ */ P(
|
|
4720
|
+
$s,
|
|
4721
|
+
{
|
|
4722
|
+
task: qt.task,
|
|
4723
|
+
tasks: nt,
|
|
4724
|
+
scale: V,
|
|
4725
|
+
localeOptions: Y,
|
|
4726
|
+
interaction: mt,
|
|
4727
|
+
onClose: vt.close,
|
|
4728
|
+
onTasksChange: n,
|
|
4729
|
+
render: tt,
|
|
4730
|
+
open: qt.open,
|
|
4731
|
+
onTransitionEnd: qt.onTransitionEnd
|
|
4732
|
+
}
|
|
4733
|
+
)
|
|
4734
|
+
] })
|
|
4735
|
+
]
|
|
4736
|
+
}
|
|
4737
|
+
);
|
|
4738
|
+
}
|
|
4739
|
+
export {
|
|
4740
|
+
Bs as CALENDAR_DAYS,
|
|
4741
|
+
ra as ReactGanttChart,
|
|
4742
|
+
Xt as buildTaskTree,
|
|
4743
|
+
ie as collectSubtreeIds,
|
|
4744
|
+
zs as createWorkingCalendar,
|
|
4745
|
+
qr as moveTask,
|
|
4746
|
+
Br as rollUpTasks,
|
|
4747
|
+
ce as sortTasksBySequence,
|
|
4748
|
+
On as validateMove
|
|
4749
|
+
};
|