@object-ui/plugin-gantt 17.2.0 → 17.5.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/CHANGELOG.md +529 -0
- package/README.md +0 -11
- package/dist/GanttView.d.ts +9 -0
- package/dist/GanttView.d.ts.map +1 -1
- package/dist/ObjectGantt.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1088 -1039
- package/dist/index.umd.cjs +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/useGanttTranslation.d.ts.map +1 -1
- package/package.json +15 -15
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
2
|
import { useCallback as t, useContext as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
3
3
|
import { ComponentRegistry as s, buildExpandFields as c, extractRecords as l, getRecordDisplayName as u, resolveDataSource as d } from "@object-ui/core";
|
|
4
|
-
import {
|
|
5
|
-
import { toast as
|
|
6
|
-
import { GanttConfigSchema as
|
|
7
|
-
import { resolveFieldCurrency as
|
|
8
|
-
import { RecordDetailDrawer as
|
|
9
|
-
import { AlertDialog as
|
|
10
|
-
import { formatCurrency as
|
|
11
|
-
import { Activity as
|
|
12
|
-
import { Fragment as
|
|
4
|
+
import { ElementDataSourceGate as f, SchemaRendererContext as p, useNavigationOverlay as m, useObjectTranslation as h, useSchemaContext as g } from "@object-ui/react";
|
|
5
|
+
import { toast as ee } from "sonner";
|
|
6
|
+
import { GanttConfigSchema as te } from "@objectstack/spec/ui";
|
|
7
|
+
import { resolveFieldCurrency as ne, useDisplayLocale as _, useLocalization as v } from "@object-ui/i18n";
|
|
8
|
+
import { RecordDetailDrawer as re, deriveRecordPageHref as ie } from "@object-ui/plugin-detail";
|
|
9
|
+
import { AlertDialog as ae, AlertDialogAction as oe, AlertDialogCancel as se, AlertDialogContent as ce, AlertDialogDescription as le, AlertDialogFooter as ue, AlertDialogHeader as de, AlertDialogTitle as fe, Button as y, cn as pe, useResizeObserver as b } from "@object-ui/components";
|
|
10
|
+
import { formatCurrency as me, formatDate as he, formatDateTime as ge, formatNumber as _e, formatPercent as ve, getSemanticColorName as ye, getSemanticHex as x, humanizeLabel as S } from "@object-ui/fields";
|
|
11
|
+
import { Activity as be, ArrowRight as xe, ChevronDown as Se, ChevronLeft as Ce, ChevronRight as we, Download as C, FileDown as Te, Lock as Ee, Maximize2 as De, Minimize2 as w, PanelLeft as Oe, PanelLeftClose as ke, Redo2 as T, RefreshCw as E, Save as Ae, Undo2 as je, Wand2 as D, ZoomIn as O, ZoomOut as Me } from "lucide-react";
|
|
12
|
+
import { Fragment as Ne, jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
13
13
|
//#region src/scheduling.ts
|
|
14
|
-
var j =
|
|
14
|
+
var j = 864e5, M = (e) => e.toISOString().slice(0, 10);
|
|
15
15
|
function N(e, t) {
|
|
16
16
|
if (t.skipWeekends) {
|
|
17
17
|
let t = e.getUTCDay();
|
|
@@ -19,38 +19,38 @@ function N(e, t) {
|
|
|
19
19
|
}
|
|
20
20
|
return !(t.holidays && t.holidays.has(M(e)));
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function P(e) {
|
|
23
23
|
let t = new Date(e);
|
|
24
24
|
return t.setUTCHours(0, 0, 0, 0), t;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
let n =
|
|
26
|
+
function Pe(e, t) {
|
|
27
|
+
let n = P(e);
|
|
28
28
|
for (; !N(n, t);) n = new Date(n.getTime() + j);
|
|
29
29
|
return n.getTime();
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function F(e, t, n) {
|
|
32
32
|
if (t <= e) return 0;
|
|
33
|
-
let r = 0, i =
|
|
33
|
+
let r = 0, i = P(e), a = P(t).getTime();
|
|
34
34
|
for (; i.getTime() < a;) N(i, n) && r++, i = new Date(i.getTime() + j);
|
|
35
35
|
return r;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
if (t <= 0) return
|
|
39
|
-
let r =
|
|
37
|
+
function Fe(e, t, n) {
|
|
38
|
+
if (t <= 0) return P(e).getTime();
|
|
39
|
+
let r = P(e), i = t;
|
|
40
40
|
for (; i > 0;) N(r, n) && i--, r = new Date(r.getTime() + j);
|
|
41
41
|
return r.getTime();
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
if (t <= 0) return
|
|
45
|
-
let r =
|
|
43
|
+
function Ie(e, t, n) {
|
|
44
|
+
if (t <= 0) return P(e).getTime();
|
|
45
|
+
let r = P(e), i = t;
|
|
46
46
|
for (; i > 0;) r = /* @__PURE__ */ new Date(r.getTime() - j), N(r, n) && i--;
|
|
47
47
|
return r.getTime();
|
|
48
48
|
}
|
|
49
49
|
var I = (e) => String(e);
|
|
50
|
-
function
|
|
50
|
+
function Le(e) {
|
|
51
51
|
return e === "ss" || e === "ff" || e === "sf" ? e : "fs";
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Re(e) {
|
|
54
54
|
let t = new Set(e.map((e) => I(e.id))), n = [];
|
|
55
55
|
for (let r of e) {
|
|
56
56
|
let e = I(r.id);
|
|
@@ -61,18 +61,18 @@ function Ie(e) {
|
|
|
61
61
|
o === e || !t.has(o) || n.push({
|
|
62
62
|
pred: o,
|
|
63
63
|
succ: e,
|
|
64
|
-
type:
|
|
64
|
+
type: Le(r ? i.type : void 0)
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
return n;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function ze(e) {
|
|
71
71
|
let t = /* @__PURE__ */ new Set();
|
|
72
72
|
for (let n of e) n.parent != null && n.parent !== "" && t.add(I(n.parent));
|
|
73
73
|
return t;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function L(e, t) {
|
|
76
76
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
77
77
|
for (let t of e) n.set(t, 0), r.set(t, []);
|
|
78
78
|
for (let e of t) r.get(e.pred).push(e.succ), n.set(e.succ, (n.get(e.succ) ?? 0) + 1);
|
|
@@ -98,7 +98,7 @@ function Re(e, t) {
|
|
|
98
98
|
hasCycle: !1
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function Be(e, t) {
|
|
102
102
|
let n = {
|
|
103
103
|
criticalIds: /* @__PURE__ */ new Set(),
|
|
104
104
|
criticalEdges: /* @__PURE__ */ new Set()
|
|
@@ -106,10 +106,10 @@ function ze(e, t) {
|
|
|
106
106
|
if (!e.length) return n;
|
|
107
107
|
let r = /* @__PURE__ */ new Map();
|
|
108
108
|
for (let n of e) {
|
|
109
|
-
let e = t ?
|
|
109
|
+
let e = t ? F(n.start.getTime(), n.end.getTime(), t) : (n.end.getTime() - n.start.getTime()) / j;
|
|
110
110
|
r.set(I(n.id), Number.isFinite(e) && e > 0 ? e : 0);
|
|
111
111
|
}
|
|
112
|
-
let i =
|
|
112
|
+
let i = Re(e), a = e.map((e) => I(e.id)), { order: o, hasCycle: s } = L(a, i);
|
|
113
113
|
if (s) return n;
|
|
114
114
|
let c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
115
115
|
for (let e of a) c.set(e, []), l.set(e, []);
|
|
@@ -140,17 +140,17 @@ function ze(e, t) {
|
|
|
140
140
|
criticalEdges: te
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function Ve(e, t, n) {
|
|
144
144
|
if (!e.length) return {
|
|
145
145
|
changes: [],
|
|
146
146
|
skippedLocked: []
|
|
147
147
|
};
|
|
148
|
-
let r =
|
|
148
|
+
let r = Re(e), i = e.map((e) => I(e.id)), { order: a, hasCycle: o } = L(i, r);
|
|
149
149
|
if (o) return {
|
|
150
150
|
changes: [],
|
|
151
151
|
skippedLocked: []
|
|
152
152
|
};
|
|
153
|
-
let s =
|
|
153
|
+
let s = ze(e), c = /* @__PURE__ */ new Map();
|
|
154
154
|
for (let t of e) c.set(I(t.id), t);
|
|
155
155
|
let l = /* @__PURE__ */ new Map();
|
|
156
156
|
for (let t of e) {
|
|
@@ -167,7 +167,7 @@ function Be(e, t, n) {
|
|
|
167
167
|
for (let e of a) {
|
|
168
168
|
let r = c.get(e);
|
|
169
169
|
if (!r) continue;
|
|
170
|
-
let i = t ?
|
|
170
|
+
let i = t ? F(p.get(e), m.get(e), t) : m.get(e) - p.get(e), a = r.start.getTime(), o = a;
|
|
171
171
|
for (let n of f.get(e) ?? []) {
|
|
172
172
|
let e = p.get(n.pred), r = m.get(n.pred), a;
|
|
173
173
|
switch (n.type) {
|
|
@@ -175,14 +175,12 @@ function Be(e, t, n) {
|
|
|
175
175
|
a = e;
|
|
176
176
|
break;
|
|
177
177
|
case "ff":
|
|
178
|
-
a = t ?
|
|
178
|
+
a = t ? Ie(r, i, t) : r - i;
|
|
179
179
|
break;
|
|
180
180
|
case "sf":
|
|
181
|
-
a = t ?
|
|
182
|
-
break;
|
|
183
|
-
default:
|
|
184
|
-
a = r;
|
|
181
|
+
a = t ? Ie(e, i, t) : e - i;
|
|
185
182
|
break;
|
|
183
|
+
default: a = r;
|
|
186
184
|
}
|
|
187
185
|
a > o && (o = a);
|
|
188
186
|
}
|
|
@@ -193,8 +191,8 @@ function Be(e, t, n) {
|
|
|
193
191
|
continue;
|
|
194
192
|
}
|
|
195
193
|
if (l && !t && n?.snapStart && (o = Math.max(o, n.snapStart(o))), t) {
|
|
196
|
-
let n =
|
|
197
|
-
p.set(e, n), m.set(e,
|
|
194
|
+
let n = Pe(o, t);
|
|
195
|
+
p.set(e, n), m.set(e, Fe(n, i, t));
|
|
198
196
|
} else p.set(e, o), m.set(e, o + i);
|
|
199
197
|
}
|
|
200
198
|
}
|
|
@@ -228,7 +226,7 @@ function Be(e, t, n) {
|
|
|
228
226
|
skippedLocked: h
|
|
229
227
|
};
|
|
230
228
|
}
|
|
231
|
-
function
|
|
229
|
+
function He(e, t, n) {
|
|
232
230
|
let r = String(t), i = String(n);
|
|
233
231
|
if (r === i) return !0;
|
|
234
232
|
let a = /* @__PURE__ */ new Map();
|
|
@@ -248,28 +246,28 @@ function Ve(e, t, n) {
|
|
|
248
246
|
}
|
|
249
247
|
//#endregion
|
|
250
248
|
//#region src/shifts.ts
|
|
251
|
-
var
|
|
252
|
-
1440 *
|
|
253
|
-
var
|
|
254
|
-
function
|
|
249
|
+
var Ue = 6e4;
|
|
250
|
+
1440 * Ue;
|
|
251
|
+
var We = 1440;
|
|
252
|
+
function Ge(e) {
|
|
255
253
|
if (typeof e != "string") return null;
|
|
256
254
|
let t = /^(\d{1,2}):(\d{2})$/.exec(e.trim());
|
|
257
255
|
if (!t) return null;
|
|
258
256
|
let n = Number(t[1]), r = Number(t[2]);
|
|
259
257
|
return n < 0 || n > 23 || r < 0 || r > 59 ? null : n * 60 + r;
|
|
260
258
|
}
|
|
261
|
-
function
|
|
259
|
+
function Ke(e) {
|
|
262
260
|
if (!e || !Array.isArray(e.bands) || e.bands.length === 0) return null;
|
|
263
|
-
let t =
|
|
261
|
+
let t = Ge(e.dayStart) ?? 0, n = [];
|
|
264
262
|
for (let t = 0; t < e.bands.length; t++) {
|
|
265
|
-
let r = e.bands[t], i =
|
|
263
|
+
let r = e.bands[t], i = Ge(r.start), a = Ge(r.end);
|
|
266
264
|
if (i == null || a == null || !r.label) return null;
|
|
267
|
-
let o = (a - i +
|
|
265
|
+
let o = (a - i + We) % We || We;
|
|
268
266
|
n.push({
|
|
269
267
|
key: r.key ?? `band${t}`,
|
|
270
268
|
label: r.label,
|
|
271
269
|
color: r.color,
|
|
272
|
-
durMs: o *
|
|
270
|
+
durMs: o * Ue
|
|
273
271
|
});
|
|
274
272
|
}
|
|
275
273
|
return {
|
|
@@ -278,19 +276,19 @@ function We(e) {
|
|
|
278
276
|
showMidnight: e.showMidnight !== !1
|
|
279
277
|
};
|
|
280
278
|
}
|
|
281
|
-
function
|
|
279
|
+
function qe(e, t) {
|
|
282
280
|
let n = new Date(e);
|
|
283
281
|
return n.setHours(0, 0, 0, 0), n.setMinutes(t), n.getTime() > e.getTime() && n.setDate(n.getDate() - 1), n;
|
|
284
282
|
}
|
|
285
|
-
function
|
|
283
|
+
function R(e, t) {
|
|
286
284
|
if (t.bands.length === 0) return null;
|
|
287
|
-
let n =
|
|
285
|
+
let n = qe(e, t.dayStartMin).getTime(), r = e.getTime() - n, i = 0;
|
|
288
286
|
for (let e of t.bands) if (i += e.durMs, r < i) return e;
|
|
289
287
|
return t.bands[t.bands.length - 1];
|
|
290
288
|
}
|
|
291
289
|
//#endregion
|
|
292
290
|
//#region src/useGanttTranslation.ts
|
|
293
|
-
var
|
|
291
|
+
var Je = {
|
|
294
292
|
"gantt.column.taskName": "Task Name",
|
|
295
293
|
"gantt.column.start": "Start",
|
|
296
294
|
"gantt.column.end": "End",
|
|
@@ -345,16 +343,24 @@ var R = {
|
|
|
345
343
|
"gantt.linkType.sf": "Start → Finish",
|
|
346
344
|
"gantt.linkEnd.start": "start",
|
|
347
345
|
"gantt.linkEnd.end": "end",
|
|
346
|
+
"gantt.link.rejected.self": "A task cannot depend on itself.",
|
|
347
|
+
"gantt.link.rejected.locked": "This row is locked and cannot take a new dependency.",
|
|
348
|
+
"gantt.link.rejected.group": "A summary row cannot take a dependency — link one of its tasks instead.",
|
|
349
|
+
"gantt.link.rejected.cycle": "That link would create a circular dependency.",
|
|
348
350
|
"gantt.conflict.title": "Schedule conflict",
|
|
349
|
-
"gantt.conflict.body": "This move conflicts with dependency constraints. Auto-reschedule {count} affected task(s)?",
|
|
351
|
+
"gantt.conflict.body": "This move conflicts with dependency constraints. Auto-reschedule {{count}} affected task(s)?",
|
|
350
352
|
"gantt.conflict.confirm": "Auto-reschedule",
|
|
351
353
|
"gantt.conflict.cancel": "Keep as is",
|
|
352
354
|
"gantt.autoScheduleDlg.title": "Auto-schedule",
|
|
353
|
-
"gantt.autoScheduleDlg.body": "Shift {count} task(s) later to satisfy dependency links?",
|
|
354
|
-
"gantt.autoScheduleDlg.skipped": "{count} locked task(s) also violate links and were skipped.",
|
|
355
|
+
"gantt.autoScheduleDlg.body": "Shift {{count}} task(s) later to satisfy dependency links?",
|
|
356
|
+
"gantt.autoScheduleDlg.skipped": "{{count}} locked task(s) also violate links and were skipped.",
|
|
355
357
|
"gantt.autoScheduleDlg.confirm": "Apply",
|
|
356
358
|
"gantt.autoScheduleDlg.cancel": "Cancel",
|
|
357
359
|
"gantt.autoScheduleDlg.none": "All dependencies satisfied — nothing to reschedule.",
|
|
360
|
+
"gantt.quickFilter.all": "All",
|
|
361
|
+
"gantt.quickFilter.clear": "Clear filters",
|
|
362
|
+
"gantt.quickFilter.empty": "No options",
|
|
363
|
+
"gantt.quickFilter.resultSummary": "Showing {shown} / {total} tasks",
|
|
358
364
|
"gantt.resource.header": "Resource",
|
|
359
365
|
"gantt.resource.peak": "Peak",
|
|
360
366
|
"gantt.resource.over": "overloaded",
|
|
@@ -364,55 +370,55 @@ var R = {
|
|
|
364
370
|
"gantt.lockedHint": "No edit permission",
|
|
365
371
|
"gantt.writeFailed": "Save failed — the change was rolled back"
|
|
366
372
|
};
|
|
367
|
-
function
|
|
368
|
-
let n =
|
|
369
|
-
if (t) for (let [e, r] of Object.entries(t)) n = n.
|
|
373
|
+
function z(e, t) {
|
|
374
|
+
let n = Je[e] || e;
|
|
375
|
+
if (t) for (let [e, r] of Object.entries(t)) n = n.split(`{{${e}}}`).join(String(r));
|
|
370
376
|
return n;
|
|
371
377
|
}
|
|
372
|
-
function
|
|
373
|
-
let e =
|
|
378
|
+
function Ye() {
|
|
379
|
+
let e = h();
|
|
374
380
|
return {
|
|
375
381
|
t: (t, n) => {
|
|
376
382
|
let r = e.t(t, n);
|
|
377
|
-
return typeof r == "string" && r !== t ? r :
|
|
383
|
+
return typeof r == "string" && r !== t ? r : z(t, n);
|
|
378
384
|
},
|
|
379
385
|
language: e.language
|
|
380
386
|
};
|
|
381
387
|
}
|
|
382
388
|
//#endregion
|
|
383
389
|
//#region src/GanttView.tsx
|
|
384
|
-
var
|
|
385
|
-
function
|
|
390
|
+
var Xe = 8;
|
|
391
|
+
function Ze(e, t) {
|
|
386
392
|
if (t.width <= 0) return "move";
|
|
387
|
-
let n = Math.min(
|
|
393
|
+
let n = Math.min(Xe, t.width / 3), r = e - t.left;
|
|
388
394
|
return r <= n ? "resize-left" : r >= t.width - n ? "resize-right" : "move";
|
|
389
395
|
}
|
|
390
|
-
function
|
|
396
|
+
function Qe(e) {
|
|
391
397
|
return 110;
|
|
392
398
|
}
|
|
393
|
-
function
|
|
399
|
+
function $e(e) {
|
|
394
400
|
return e < 640 ? 140 : e < 1024 ? 220 : 320;
|
|
395
401
|
}
|
|
396
|
-
function
|
|
402
|
+
function et(e) {
|
|
397
403
|
return e >= 280;
|
|
398
404
|
}
|
|
399
|
-
function
|
|
405
|
+
function tt(e) {
|
|
400
406
|
return e < 640 ? 32 : 40;
|
|
401
407
|
}
|
|
402
|
-
var
|
|
408
|
+
var nt = [
|
|
403
409
|
"day",
|
|
404
410
|
"week",
|
|
405
411
|
"month",
|
|
406
412
|
"quarter",
|
|
407
413
|
"year"
|
|
408
|
-
],
|
|
414
|
+
], rt = {
|
|
409
415
|
day: 1,
|
|
410
416
|
week: 7,
|
|
411
417
|
month: 30.44,
|
|
412
418
|
quarter: 91.31,
|
|
413
419
|
year: 365.25
|
|
414
|
-
},
|
|
415
|
-
function
|
|
420
|
+
}, it = 864e5;
|
|
421
|
+
function at(e, t) {
|
|
416
422
|
let n = new Intl.DateTimeFormat("en-US", {
|
|
417
423
|
timeZone: e,
|
|
418
424
|
hour12: !1,
|
|
@@ -425,7 +431,7 @@ function z(e, t) {
|
|
|
425
431
|
}), r = (e) => Number(n.formatToParts(t).find((t) => t.type === e)?.value ?? 0);
|
|
426
432
|
return Date.UTC(r("year"), r("month") - 1, r("day"), r("hour") % 24, r("minute"), r("second")) - Math.floor(t.getTime() / 1e3) * 1e3;
|
|
427
433
|
}
|
|
428
|
-
function
|
|
434
|
+
function ot(e) {
|
|
429
435
|
let t = {
|
|
430
436
|
delta: 0,
|
|
431
437
|
to: (e) => e,
|
|
@@ -434,11 +440,11 @@ function it(e) {
|
|
|
434
440
|
};
|
|
435
441
|
if (!e) return t;
|
|
436
442
|
try {
|
|
437
|
-
|
|
443
|
+
at(e, /* @__PURE__ */ new Date());
|
|
438
444
|
} catch {
|
|
439
445
|
return console.warn(`[GanttView] invalid timeZone "${e}" — falling back to the browser zone`), t;
|
|
440
446
|
}
|
|
441
|
-
let n = (t) =>
|
|
447
|
+
let n = (t) => at(e, t) - -t.getTimezoneOffset() * 6e4, r = n(/* @__PURE__ */ new Date());
|
|
442
448
|
return r === 0 ? t : {
|
|
443
449
|
delta: r,
|
|
444
450
|
to: (e) => new Date(e.getTime() + n(e)),
|
|
@@ -446,11 +452,11 @@ function it(e) {
|
|
|
446
452
|
now: () => new Date(Date.now() + n(/* @__PURE__ */ new Date()))
|
|
447
453
|
};
|
|
448
454
|
}
|
|
449
|
-
function
|
|
455
|
+
function st(e, t) {
|
|
450
456
|
let n = new Date(e);
|
|
451
457
|
return n.setHours(0, 0, 0, 0), t === "week" ? n.setDate(n.getDate() - (n.getDay() + 6) % 7) : t === "month" ? n.setDate(1) : t === "quarter" ? n.setMonth(Math.floor(n.getMonth() / 3) * 3, 1) : t === "year" && n.setMonth(0, 1), n;
|
|
452
458
|
}
|
|
453
|
-
function
|
|
459
|
+
function ct(e, t, n) {
|
|
454
460
|
let r = e.length - 1, i = 0;
|
|
455
461
|
for (; i < r && e[i + 1] < t;) i++;
|
|
456
462
|
let a = i;
|
|
@@ -460,7 +466,7 @@ function ot(e, t, n) {
|
|
|
460
466
|
end: a
|
|
461
467
|
};
|
|
462
468
|
}
|
|
463
|
-
function
|
|
469
|
+
function lt(e, t, n) {
|
|
464
470
|
let r = new Date(e);
|
|
465
471
|
if (n === "day") r.setDate(r.getDate() + t);
|
|
466
472
|
else if (n === "week") r.setDate(r.getDate() + t * 7);
|
|
@@ -472,7 +478,7 @@ function st(e, t, n) {
|
|
|
472
478
|
}
|
|
473
479
|
return r;
|
|
474
480
|
}
|
|
475
|
-
function
|
|
481
|
+
function ut(e, t, n, r = 2) {
|
|
476
482
|
return new Promise((i) => {
|
|
477
483
|
let a = new Blob([e], { type: "image/svg+xml;charset=utf-8" }), o = URL.createObjectURL(a), s = new Image();
|
|
478
484
|
s.onload = () => {
|
|
@@ -485,11 +491,11 @@ function ct(e, t, n, r = 2) {
|
|
|
485
491
|
}, s.src = o;
|
|
486
492
|
});
|
|
487
493
|
}
|
|
488
|
-
function
|
|
494
|
+
function dt(e, t) {
|
|
489
495
|
let n = document.createElement("a");
|
|
490
496
|
n.href = URL.createObjectURL(e), n.download = t, document.body.appendChild(n), n.click(), n.remove(), setTimeout(() => URL.revokeObjectURL(n.href), 1e3);
|
|
491
497
|
}
|
|
492
|
-
function
|
|
498
|
+
function ft(e, t, n) {
|
|
493
499
|
let r = (e) => {
|
|
494
500
|
let t = new Uint8Array(e.length);
|
|
495
501
|
for (let n = 0; n < e.length; n++) t[n] = e.charCodeAt(n) & 255;
|
|
@@ -504,18 +510,18 @@ function ut(e, t, n) {
|
|
|
504
510
|
for (let e of o) d += `${String(e).padStart(10, "0")} 00000 n \n`;
|
|
505
511
|
return d += `trailer\n<< /Size 6 /Root 1 0 R >>\nstartxref\n${u}\n%%EOF\n`, c(r(d)), new Blob(a, { type: "application/pdf" });
|
|
506
512
|
}
|
|
507
|
-
function
|
|
513
|
+
function pt(e) {
|
|
508
514
|
let t = e.slice(e.indexOf(",") + 1), n = atob(t), r = new Uint8Array(n.length);
|
|
509
515
|
for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
|
|
510
516
|
return r;
|
|
511
517
|
}
|
|
512
|
-
var
|
|
513
|
-
function
|
|
518
|
+
var mt = "gantt-layout:";
|
|
519
|
+
function ht(e) {
|
|
514
520
|
if (!e || typeof window > "u") return null;
|
|
515
521
|
try {
|
|
516
|
-
let t = window.localStorage.getItem(
|
|
522
|
+
let t = window.localStorage.getItem(mt + e);
|
|
517
523
|
if (!t) return null;
|
|
518
|
-
let n = JSON.parse(t), r = n.viewMode &&
|
|
524
|
+
let n = JSON.parse(t), r = n.viewMode && nt.includes(n.viewMode) ? n.viewMode : null;
|
|
519
525
|
if (!r) return null;
|
|
520
526
|
let i = typeof n.columnWidth == "number" && isFinite(n.columnWidth) ? n.columnWidth : null, a = typeof n.taskListWidth == "number" && isFinite(n.taskListWidth) ? n.taskListWidth : null, o = Array.isArray(n.collapsedIds) ? n.collapsedIds.filter((e) => typeof e == "string") : void 0;
|
|
521
527
|
return {
|
|
@@ -529,22 +535,22 @@ function pt(e) {
|
|
|
529
535
|
return null;
|
|
530
536
|
}
|
|
531
537
|
}
|
|
532
|
-
function
|
|
538
|
+
function gt(e, t) {
|
|
533
539
|
if (!(typeof window > "u")) try {
|
|
534
|
-
window.localStorage.setItem(
|
|
540
|
+
window.localStorage.setItem(mt + e, JSON.stringify(t));
|
|
535
541
|
} catch {}
|
|
536
542
|
}
|
|
537
|
-
function
|
|
538
|
-
let x = e.useMemo(() =>
|
|
543
|
+
function _t({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTaskClick: o, onTaskUpdate: s, onTaskDelete: c, onViewChange: l, onDependencyCreate: u, onBeforeDependencyCreate: d, onDependencyDelete: f, onTaskReorder: p, className: m, inlineEdit: h = !1, autoSchedule: g = !1, rescheduleOnConflict: te = !1, criticalPathDefault: ne = !1, workingCalendar: _, shiftSegments: v, showBaselines: re = !0, readOnly: ie = !1, mobileReadOnly: ae = !1, groupBy: oe, ungroupedLabel: se = "Ungrouped", defaultCollapsedDepth: ce, summaryExtent: le = "children", persistLayoutKey: ue, onLayoutChange: de, onRefresh: fe, refreshing: me = !1, dependencyTypes: he = !0, timeZone: ge, exportFileName: _e, interactions: ve, onBeforeTaskUpdate: ye }) {
|
|
544
|
+
let x = e.useMemo(() => ot(ge), [ge]), S = e.useMemo(() => x.delta === 0 ? t : t.map((e) => ({
|
|
539
545
|
...e,
|
|
540
546
|
start: x.to(e.start),
|
|
541
547
|
end: x.to(e.end),
|
|
542
548
|
baselineStart: e.baselineStart ? x.to(e.baselineStart) : e.baselineStart,
|
|
543
549
|
baselineEnd: e.baselineEnd ? x.to(e.baselineEnd) : e.baselineEnd
|
|
544
|
-
})), [t, x]),
|
|
550
|
+
})), [t, x]), j = e.useMemo(() => r && x.delta !== 0 ? x.to(r) : r, [r, x]), M = e.useMemo(() => i && x.delta !== 0 ? x.to(i) : i, [i, x]), N = e.useMemo(() => !a || x.delta === 0 ? a : a.map((e) => ({
|
|
545
551
|
...e,
|
|
546
552
|
date: x.to(new Date(e.date))
|
|
547
|
-
})), [a, x]), { t: P, language:
|
|
553
|
+
})), [a, x]), { t: P, language: Pe } = Ye(), F = Pe || void 0, [Fe, Ie] = e.useState(() => x.now()), I = e.useRef(null), { width: Le } = b(I), Re = Le || (typeof window < "u" ? window.innerWidth : 1024), ze = Re < 640, L = ie || ae && ze, Ue = ve?.move !== !1, We = ve?.resize !== !1, Ge = ve?.progress !== !1, Ke = ve?.link !== !1, R = e.useMemo(() => {
|
|
548
554
|
if (!(L || !s)) return x.delta === 0 ? s : (e, t) => {
|
|
549
555
|
let n = { ...t };
|
|
550
556
|
n.start instanceof Date && (n.start = x.from(n.start)), n.end instanceof Date && (n.end = x.from(n.end)), s(e, n);
|
|
@@ -553,46 +559,46 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
553
559
|
L,
|
|
554
560
|
s,
|
|
555
561
|
x
|
|
556
|
-
]),
|
|
557
|
-
|
|
558
|
-
let
|
|
562
|
+
]), Je = L ? void 0 : c, z = L || !Ke ? void 0 : u, at = L || !Ke ? void 0 : f, mt = L ? void 0 : p, _t = !L && h, vt = !L && g, yt = !L && te, B = tt(Re), bt = Qe(Re), xt = e.useRef(void 0);
|
|
563
|
+
xt.current === void 0 && (xt.current = ht(ue));
|
|
564
|
+
let St = xt.current, [Ct, wt] = e.useState(St ? St.columnWidth : null), [Tt, Et] = e.useState(St ? St.taskListWidth ?? null : null), [V, Dt] = e.useState(n && nt.includes(n) ? n : St?.viewMode ?? "day");
|
|
559
565
|
e.useEffect(() => {
|
|
560
|
-
n &&
|
|
566
|
+
n && nt.includes(n) && Dt(n);
|
|
561
567
|
}, [n]);
|
|
562
|
-
let
|
|
568
|
+
let Ot = e.useRef(null), kt = e.useRef(null), At = e.useRef(!0), [jt, Mt] = e.useState(St ? St.taskListCollapsed : !1), Nt = e.useRef(!1);
|
|
563
569
|
e.useEffect(() => {
|
|
564
|
-
!
|
|
565
|
-
}, [
|
|
566
|
-
let
|
|
567
|
-
if (
|
|
568
|
-
let e =
|
|
569
|
-
|
|
570
|
-
let n = Math.max(1, (t.getTime() - e.getTime()) /
|
|
570
|
+
!Nt.current && ze && (Mt(!0), Nt.current = !0);
|
|
571
|
+
}, [ze]);
|
|
572
|
+
let Pt = Math.max(160, Re - 200), H = jt ? 0 : Tt == null ? $e(Re) : Math.max(160, Math.min(Tt, Pt)), Ft = e.useMemo(() => {
|
|
573
|
+
if (Ct != null || M || S.length === 0) return null;
|
|
574
|
+
let e = j ? new Date(j) : new Date(Math.min(...S.map((e) => e.start.getTime()))), t = new Date(Math.max(...S.map((e) => e.end.getTime())));
|
|
575
|
+
j || e.setDate(e.getDate() - 7), t.setDate(t.getDate() + 14), e = st(e, V), t.setHours(23, 59, 59, 999);
|
|
576
|
+
let n = Math.max(1, (t.getTime() - e.getTime()) / it), r = Math.max(0, Re - H);
|
|
571
577
|
if (r <= 0) return null;
|
|
572
|
-
let i = r / n *
|
|
573
|
-
if (i <=
|
|
578
|
+
let i = r / n * rt[V];
|
|
579
|
+
if (i <= bt) return null;
|
|
574
580
|
let a = Math.min(i, r * .6);
|
|
575
|
-
return a >
|
|
581
|
+
return a > bt ? a : null;
|
|
576
582
|
}, [
|
|
577
|
-
|
|
583
|
+
Ct,
|
|
584
|
+
S,
|
|
578
585
|
j,
|
|
579
586
|
M,
|
|
580
|
-
N,
|
|
581
587
|
V,
|
|
582
|
-
|
|
588
|
+
Re,
|
|
583
589
|
H,
|
|
584
|
-
|
|
585
|
-
]),
|
|
586
|
-
if (!
|
|
590
|
+
bt
|
|
591
|
+
]), It = Ct ?? Ft ?? bt, Lt = It / rt[V], Rt = et(H), [zt, Bt] = e.useState(null), [Vt, Ht] = e.useState({}), [Ut, Wt] = e.useState(null), U = e.useMemo(() => {
|
|
592
|
+
if (!oe) return S;
|
|
587
593
|
let e = /* @__PURE__ */ new Set();
|
|
588
|
-
for (let t of
|
|
594
|
+
for (let t of S) {
|
|
589
595
|
let n = t.parent != null && t.parent !== "" ? String(t.parent) : null;
|
|
590
596
|
n && e.add(n);
|
|
591
597
|
}
|
|
592
598
|
let t = /* @__PURE__ */ new Map();
|
|
593
|
-
for (let n of
|
|
599
|
+
for (let n of S) {
|
|
594
600
|
if (e.has(String(n.id))) continue;
|
|
595
|
-
let r =
|
|
601
|
+
let r = oe(n), i = r ? String(r.key) : "__ungrouped__", a = r ? r.label : se, o = t.get(i);
|
|
596
602
|
o || (o = {
|
|
597
603
|
key: i,
|
|
598
604
|
label: a,
|
|
@@ -619,10 +625,10 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
619
625
|
}
|
|
620
626
|
return n;
|
|
621
627
|
}, [
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
]),
|
|
628
|
+
oe,
|
|
629
|
+
S,
|
|
630
|
+
se
|
|
631
|
+
]), Gt = e.useMemo(() => {
|
|
626
632
|
let e = new Set(U.map((e) => String(e.id))), t = /* @__PURE__ */ new Map();
|
|
627
633
|
for (let n of U) {
|
|
628
634
|
let r = n.parent != null && n.parent !== "" ? String(n.parent) : null;
|
|
@@ -632,41 +638,41 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
632
638
|
}
|
|
633
639
|
}
|
|
634
640
|
return t;
|
|
635
|
-
}, [U]),
|
|
641
|
+
}, [U]), Kt = e.useMemo(() => {
|
|
636
642
|
let e = /* @__PURE__ */ new Map();
|
|
637
643
|
for (let t of U) e.set(String(t.id), t);
|
|
638
644
|
return e;
|
|
639
|
-
}, [U]),
|
|
645
|
+
}, [U]), qt = e.useCallback((e) => {
|
|
640
646
|
let t = [], n = /* @__PURE__ */ new Set(), r = (e) => {
|
|
641
|
-
for (let i of
|
|
647
|
+
for (let i of Gt.get(e) ?? []) {
|
|
642
648
|
let e = String(i.id);
|
|
643
649
|
n.has(e) || (n.add(e), t.push(i), r(e));
|
|
644
650
|
}
|
|
645
651
|
};
|
|
646
652
|
return r(String(e)), t;
|
|
647
|
-
}, [
|
|
653
|
+
}, [Gt]), [W, Jt] = e.useState(null), Yt = e.useRef(null);
|
|
648
654
|
e.useEffect(() => {
|
|
649
|
-
|
|
655
|
+
Yt.current = W;
|
|
650
656
|
}, [W]);
|
|
651
|
-
let
|
|
652
|
-
let t = V === "day" && v && v.bands.length > 0 && v ? Math.min(...v.bands.map((e) => e.durMs)) :
|
|
657
|
+
let Xt = e.useRef(!1), Zt = e.useCallback((e) => {
|
|
658
|
+
let t = V === "day" && v && v.bands.length > 0 && v ? Math.min(...v.bands.map((e) => e.durMs)) : it, n = (e, t) => nr.current ? nr.current(e, t) : lt(e, t, "day"), r = new Date(e.originStart), i = new Date(e.originEnd);
|
|
653
659
|
return e.mode === "move" ? (r = n(e.originStart, e.unitDelta), i = new Date(e.originEnd.getTime() + (r.getTime() - e.originStart.getTime()))) : e.mode === "resize-left" ? (r = n(e.originStart, e.unitDelta), i.getTime() - r.getTime() < t && (r = new Date(i.getTime() - t))) : e.mode === "resize-right" && (i = n(e.originEnd, e.unitDelta), i.getTime() - r.getTime() < t && (i = new Date(r.getTime() + t))), {
|
|
654
660
|
start: r,
|
|
655
661
|
end: i
|
|
656
662
|
};
|
|
657
|
-
}, [V, v]),
|
|
658
|
-
|
|
659
|
-
let
|
|
663
|
+
}, [V, v]), Qt = e.useRef(S);
|
|
664
|
+
Qt.current = S;
|
|
665
|
+
let $t = e.useRef([]), en = e.useRef([]), [tn, nn] = e.useState(0), rn = e.useCallback((e) => {
|
|
660
666
|
if (!R) return;
|
|
661
667
|
let t = e.filter((e) => !e.task.locked);
|
|
662
668
|
(async () => {
|
|
663
669
|
let e = t;
|
|
664
|
-
if (
|
|
670
|
+
if (ye) {
|
|
665
671
|
let n = [];
|
|
666
672
|
for (let e of t) {
|
|
667
673
|
let t;
|
|
668
674
|
try {
|
|
669
|
-
t = await
|
|
675
|
+
t = await ye(e.task, e.changes) !== !1;
|
|
670
676
|
} catch {
|
|
671
677
|
t = !1;
|
|
672
678
|
}
|
|
@@ -687,54 +693,54 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
687
693
|
after: i
|
|
688
694
|
});
|
|
689
695
|
}
|
|
690
|
-
n.length && (
|
|
696
|
+
n.length && ($t.current.push(n), en.current = [], nn((e) => e + 1));
|
|
691
697
|
})();
|
|
692
|
-
}, [R,
|
|
698
|
+
}, [R, ye]), [an, on] = e.useState(null), sn = e.useCallback((e) => {
|
|
693
699
|
if (!v) return e;
|
|
694
700
|
let t = new Date(e);
|
|
695
701
|
t.setHours(0, 0, 0, 0);
|
|
696
702
|
for (let n = -1; n <= 1; n++) {
|
|
697
|
-
let r = t.getTime() + n *
|
|
703
|
+
let r = t.getTime() + n * it + v.dayStartMin * 6e4;
|
|
698
704
|
for (let t of v.bands) {
|
|
699
705
|
if (r >= e) return r;
|
|
700
706
|
r += t.durMs;
|
|
701
707
|
}
|
|
702
708
|
}
|
|
703
709
|
return e;
|
|
704
|
-
}, [v]),
|
|
705
|
-
summaryExtent:
|
|
706
|
-
snapStart: v ?
|
|
710
|
+
}, [v]), cn = e.useMemo(() => ({
|
|
711
|
+
summaryExtent: le,
|
|
712
|
+
snapStart: v ? sn : void 0
|
|
707
713
|
}), [
|
|
708
|
-
|
|
714
|
+
le,
|
|
709
715
|
v,
|
|
710
|
-
|
|
711
|
-
]),
|
|
712
|
-
if (!
|
|
716
|
+
sn
|
|
717
|
+
]), ln = e.useCallback((e) => {
|
|
718
|
+
if (!yt) return;
|
|
713
719
|
let t = /* @__PURE__ */ new Map();
|
|
714
720
|
for (let { task: n, changes: r } of e) t.set(String(n.id), {
|
|
715
721
|
start: r.start ?? n.start,
|
|
716
722
|
end: r.end ?? n.end
|
|
717
723
|
});
|
|
718
|
-
let { changes: n } =
|
|
724
|
+
let { changes: n } = Ve(Qt.current.map((e) => {
|
|
719
725
|
let n = t.get(String(e.id));
|
|
720
726
|
return n ? {
|
|
721
727
|
...e,
|
|
722
728
|
start: n.start,
|
|
723
729
|
end: n.end
|
|
724
730
|
} : e;
|
|
725
|
-
}), _,
|
|
731
|
+
}), _, cn), r = n.filter((e) => {
|
|
726
732
|
let n = t.get(e.id);
|
|
727
733
|
return !n || e.start.getTime() !== n.start.getTime() || e.end.getTime() !== n.end.getTime();
|
|
728
734
|
});
|
|
729
|
-
r.length &&
|
|
735
|
+
r.length && on(r);
|
|
730
736
|
}, [
|
|
731
|
-
|
|
737
|
+
yt,
|
|
732
738
|
_,
|
|
733
|
-
|
|
734
|
-
]),
|
|
735
|
-
if (!
|
|
736
|
-
let e =
|
|
737
|
-
let t =
|
|
739
|
+
cn
|
|
740
|
+
]), un = e.useCallback(() => {
|
|
741
|
+
if (!an) return;
|
|
742
|
+
let e = an.map((e) => {
|
|
743
|
+
let t = Qt.current.find((t) => String(t.id) === e.id);
|
|
738
744
|
return t ? {
|
|
739
745
|
task: t,
|
|
740
746
|
changes: {
|
|
@@ -743,48 +749,48 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
743
749
|
}
|
|
744
750
|
} : null;
|
|
745
751
|
}).filter(Boolean);
|
|
746
|
-
e.length &&
|
|
747
|
-
}, [
|
|
752
|
+
e.length && rn(e), on(null);
|
|
753
|
+
}, [an, rn]), dn = e.useCallback((e, t) => {
|
|
748
754
|
if (R) for (let n of e) {
|
|
749
|
-
let e =
|
|
755
|
+
let e = Qt.current.find((e) => String(e.id) === n.taskId);
|
|
750
756
|
e && R(e, t === "undo" ? n.before : n.after);
|
|
751
757
|
}
|
|
752
|
-
}, [R]),
|
|
753
|
-
let e = Qt.current.pop();
|
|
754
|
-
e && (un(e, "undo"), $t.current.push(e), tn((e) => e + 1));
|
|
755
|
-
}, [un]), fn = e.useCallback(() => {
|
|
758
|
+
}, [R]), fn = e.useCallback(() => {
|
|
756
759
|
let e = $t.current.pop();
|
|
757
|
-
e && (
|
|
758
|
-
}, [
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}
|
|
760
|
+
e && (dn(e, "undo"), en.current.push(e), nn((e) => e + 1));
|
|
761
|
+
}, [dn]), pn = e.useCallback(() => {
|
|
762
|
+
let e = en.current.pop();
|
|
763
|
+
e && (dn(e, "redo"), $t.current.push(e), nn((e) => e + 1));
|
|
764
|
+
}, [dn]), { canUndo: mn, canRedo: hn } = e.useMemo(() => ({
|
|
765
|
+
canUndo: $t.current.length > 0,
|
|
766
|
+
canRedo: en.current.length > 0
|
|
767
|
+
}), [tn]);
|
|
762
768
|
e.useEffect(() => {
|
|
763
769
|
if (!W) return;
|
|
764
|
-
let e = V === "day" && v && v.bands.length > 0 && v ?
|
|
765
|
-
let n =
|
|
770
|
+
let e = V === "day" && v && v.bands.length > 0 && v ? Lt * Math.min(...v.bands.map((e) => e.durMs)) / it : Lt, t = (t) => {
|
|
771
|
+
let n = Yt.current;
|
|
766
772
|
if (!n) return;
|
|
767
773
|
let r = Math.round((t.clientX - n.originClientX) / Math.max(e, 1));
|
|
768
|
-
r !== n.unitDelta &&
|
|
774
|
+
r !== n.unitDelta && Jt({
|
|
769
775
|
...n,
|
|
770
776
|
unitDelta: r
|
|
771
777
|
});
|
|
772
778
|
}, n = () => {
|
|
773
|
-
let e =
|
|
779
|
+
let e = Yt.current;
|
|
774
780
|
if (e) {
|
|
775
781
|
if (e.unitDelta !== 0) {
|
|
776
|
-
let t =
|
|
782
|
+
let t = S.find((t) => t.id === e.taskId);
|
|
777
783
|
if (t && R) {
|
|
778
|
-
let { start: n, end: r } =
|
|
784
|
+
let { start: n, end: r } = Zt(e);
|
|
779
785
|
if (e.group) {
|
|
780
|
-
let r = n.getTime() - e.originStart.getTime(), i = [t, ...
|
|
786
|
+
let r = n.getTime() - e.originStart.getTime(), i = [t, ...qt(t.id).filter((e) => !e.locked)].map((e) => ({
|
|
781
787
|
task: e,
|
|
782
788
|
changes: {
|
|
783
789
|
start: new Date(e.start.getTime() + r),
|
|
784
790
|
end: new Date(e.end.getTime() + r)
|
|
785
791
|
}
|
|
786
792
|
}));
|
|
787
|
-
|
|
793
|
+
rn(i), ln(i);
|
|
788
794
|
} else {
|
|
789
795
|
let e = [{
|
|
790
796
|
task: t,
|
|
@@ -793,14 +799,14 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
793
799
|
end: r
|
|
794
800
|
}
|
|
795
801
|
}];
|
|
796
|
-
|
|
802
|
+
rn(e), ln(e);
|
|
797
803
|
}
|
|
798
804
|
}
|
|
799
|
-
|
|
800
|
-
|
|
805
|
+
Xt.current = !0, window.setTimeout(() => {
|
|
806
|
+
Xt.current = !1;
|
|
801
807
|
}, 0);
|
|
802
808
|
}
|
|
803
|
-
|
|
809
|
+
Jt(null);
|
|
804
810
|
}
|
|
805
811
|
};
|
|
806
812
|
return window.addEventListener("pointermove", t), window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n), () => {
|
|
@@ -808,19 +814,19 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
808
814
|
};
|
|
809
815
|
}, [
|
|
810
816
|
W,
|
|
811
|
-
Ft,
|
|
812
817
|
It,
|
|
818
|
+
Lt,
|
|
813
819
|
V,
|
|
814
820
|
v,
|
|
815
|
-
|
|
821
|
+
S,
|
|
816
822
|
R,
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
823
|
+
Zt,
|
|
824
|
+
qt,
|
|
825
|
+
rn,
|
|
826
|
+
ln
|
|
821
827
|
]);
|
|
822
|
-
let
|
|
823
|
-
!R || e.data?.__group || e.locked || (n.stopPropagation(), n.preventDefault(),
|
|
828
|
+
let gn = e.useCallback((e, t, n, r) => {
|
|
829
|
+
!R || e.data?.__group || e.locked || (n.stopPropagation(), n.preventDefault(), Jt({
|
|
824
830
|
taskId: e.id,
|
|
825
831
|
mode: t,
|
|
826
832
|
group: r?.group ?? !1,
|
|
@@ -829,144 +835,145 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
829
835
|
originClientX: n.clientX,
|
|
830
836
|
unitDelta: 0
|
|
831
837
|
}));
|
|
832
|
-
}, [R]), [
|
|
838
|
+
}, [R]), [_n, vn] = e.useState(null), yn = e.useRef(null);
|
|
833
839
|
e.useEffect(() => {
|
|
834
|
-
|
|
835
|
-
}, [
|
|
836
|
-
if (!
|
|
840
|
+
yn.current = _n;
|
|
841
|
+
}, [_n]), e.useEffect(() => {
|
|
842
|
+
if (!_n) return;
|
|
837
843
|
let e = (e) => {
|
|
838
|
-
let t =
|
|
844
|
+
let t = yn.current;
|
|
839
845
|
if (!t) return;
|
|
840
846
|
let n = Math.min(100, Math.max(0, Math.round(t.originProgress + (e.clientX - t.originClientX) / Math.max(t.barWidth, 1) * 100)));
|
|
841
|
-
n !== t.value &&
|
|
847
|
+
n !== t.value && vn({
|
|
842
848
|
...t,
|
|
843
849
|
value: n
|
|
844
850
|
});
|
|
845
851
|
}, t = () => {
|
|
846
|
-
let e =
|
|
852
|
+
let e = yn.current;
|
|
847
853
|
if (e) {
|
|
848
854
|
if (e.value !== e.originProgress) {
|
|
849
|
-
let t =
|
|
850
|
-
t && R &&
|
|
855
|
+
let t = S.find((t) => t.id === e.taskId);
|
|
856
|
+
t && R && rn([{
|
|
851
857
|
task: t,
|
|
852
858
|
changes: { progress: e.value }
|
|
853
|
-
}]),
|
|
854
|
-
|
|
859
|
+
}]), Xt.current = !0, window.setTimeout(() => {
|
|
860
|
+
Xt.current = !1;
|
|
855
861
|
}, 0);
|
|
856
862
|
}
|
|
857
|
-
|
|
863
|
+
vn(null);
|
|
858
864
|
}
|
|
859
865
|
};
|
|
860
866
|
return window.addEventListener("pointermove", e), window.addEventListener("pointerup", t), window.addEventListener("pointercancel", t), () => {
|
|
861
867
|
window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", t), window.removeEventListener("pointercancel", t);
|
|
862
868
|
};
|
|
863
869
|
}, [
|
|
864
|
-
|
|
865
|
-
|
|
870
|
+
_n,
|
|
871
|
+
S,
|
|
866
872
|
R,
|
|
867
|
-
|
|
873
|
+
rn
|
|
868
874
|
]);
|
|
869
|
-
let
|
|
875
|
+
let bn = e.useMemo(() => {
|
|
870
876
|
let e = [];
|
|
871
|
-
for (let t of
|
|
877
|
+
for (let t of S) for (let n of t.dependencies ?? []) {
|
|
872
878
|
let r = typeof n == "object" && n ? n.id : n;
|
|
873
|
-
r
|
|
879
|
+
r != null && r !== "" && e.push([String(r), String(t.id)]);
|
|
874
880
|
}
|
|
875
881
|
return e;
|
|
876
|
-
}, [
|
|
882
|
+
}, [S]), xn = e.useCallback((e, t) => String(t.id) === String(e) ? "self" : t.locked ? "locked" : t.type === "group" ? "group" : He(bn, e, t.id) ? "cycle" : null, [bn]), Sn = e.useCallback((e, t) => xn(e, t) === null, [xn]), Cn = e.useRef(null), [G, wn] = e.useState(null), Tn = e.useRef(null);
|
|
877
883
|
e.useEffect(() => {
|
|
878
|
-
|
|
884
|
+
Tn.current = G;
|
|
879
885
|
}, [G]), e.useEffect(() => {
|
|
880
886
|
if (!G) return;
|
|
881
887
|
let e = (e) => {
|
|
882
|
-
let t =
|
|
888
|
+
let t = Cn.current?.getBoundingClientRect();
|
|
883
889
|
if (!t) return;
|
|
884
890
|
let n = e.clientX - t.left, r = e.clientY - t.top;
|
|
885
|
-
|
|
891
|
+
wn((e) => e && {
|
|
886
892
|
...e,
|
|
887
893
|
x: n,
|
|
888
894
|
y: r
|
|
889
895
|
});
|
|
890
896
|
}, t = () => {
|
|
891
|
-
let e =
|
|
897
|
+
let e = Tn.current;
|
|
892
898
|
if (e && e.targetId != null && z) {
|
|
893
|
-
let t =
|
|
894
|
-
t && n &&
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
}, 0),
|
|
899
|
+
let t = S.find((t) => String(t.id) === String(e.sourceId)), n = S.find((t) => String(t.id) === String(e.targetId)), r = e.targetEnd ?? "start", i = he ? `${e.sourceEnd === "end" ? "f" : "s"}${r === "end" ? "f" : "s"}` : "fs";
|
|
900
|
+
t && n && Sn(e.sourceId, n) && (d?.(t, n, i) ?? !0) && z(t, n, i);
|
|
901
|
+
} else e && e.rejectedReason && z && ee.error(P(`gantt.link.rejected.${e.rejectedReason}`));
|
|
902
|
+
Xt.current = !0, window.setTimeout(() => {
|
|
903
|
+
Xt.current = !1;
|
|
904
|
+
}, 0), wn(null);
|
|
899
905
|
};
|
|
900
906
|
return window.addEventListener("pointermove", e), window.addEventListener("pointerup", t), window.addEventListener("pointercancel", t), () => {
|
|
901
907
|
window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", t), window.removeEventListener("pointercancel", t);
|
|
902
908
|
};
|
|
903
909
|
}, [
|
|
904
910
|
G,
|
|
905
|
-
|
|
911
|
+
S,
|
|
906
912
|
z,
|
|
907
913
|
d,
|
|
908
|
-
|
|
909
|
-
|
|
914
|
+
Sn,
|
|
915
|
+
he,
|
|
916
|
+
P
|
|
910
917
|
]);
|
|
911
|
-
let [
|
|
918
|
+
let [En, Dn] = e.useState(null), On = e.useRef(null);
|
|
912
919
|
e.useEffect(() => {
|
|
913
|
-
if (!
|
|
920
|
+
if (!En) return;
|
|
914
921
|
let e = (e) => {
|
|
915
|
-
|
|
922
|
+
On.current && e.target instanceof Node && On.current.contains(e.target) || Dn(null);
|
|
916
923
|
}, t = (e) => {
|
|
917
|
-
e.key === "Escape" &&
|
|
924
|
+
e.key === "Escape" && Dn(null);
|
|
918
925
|
};
|
|
919
926
|
return window.addEventListener("pointerdown", e, !0), window.addEventListener("keydown", t), () => {
|
|
920
927
|
window.removeEventListener("pointerdown", e, !0), window.removeEventListener("keydown", t);
|
|
921
928
|
};
|
|
922
|
-
}, [
|
|
923
|
-
let [
|
|
929
|
+
}, [En]);
|
|
930
|
+
let [kn, An] = e.useState(null), jn = e.useRef(null);
|
|
924
931
|
e.useEffect(() => {
|
|
925
|
-
if (!
|
|
932
|
+
if (!kn) return;
|
|
926
933
|
let e = (e) => {
|
|
927
|
-
|
|
934
|
+
jn.current && e.target instanceof Node && jn.current.contains(e.target) || An(null);
|
|
928
935
|
}, t = (e) => {
|
|
929
|
-
e.key === "Escape" &&
|
|
936
|
+
e.key === "Escape" && An(null);
|
|
930
937
|
};
|
|
931
938
|
return window.addEventListener("pointerdown", e, !0), window.addEventListener("keydown", t), () => {
|
|
932
939
|
window.removeEventListener("pointerdown", e, !0), window.removeEventListener("keydown", t);
|
|
933
940
|
};
|
|
934
|
-
}, [
|
|
935
|
-
let [
|
|
941
|
+
}, [kn]);
|
|
942
|
+
let [Mn, Nn] = e.useState(null), [Pn, Fn] = e.useState(""), In = e.useRef(null);
|
|
936
943
|
e.useEffect(() => {
|
|
937
|
-
if (!
|
|
944
|
+
if (!Mn) return;
|
|
938
945
|
let e = (e) => {
|
|
939
|
-
|
|
946
|
+
In.current && e.target instanceof Node && In.current.contains(e.target) || Nn(null);
|
|
940
947
|
}, t = (e) => {
|
|
941
|
-
e.key === "Escape" &&
|
|
948
|
+
e.key === "Escape" && Nn(null);
|
|
942
949
|
};
|
|
943
950
|
return window.addEventListener("pointerdown", e, !0), window.addEventListener("keydown", t), () => {
|
|
944
951
|
window.removeEventListener("pointerdown", e, !0), window.removeEventListener("keydown", t);
|
|
945
952
|
};
|
|
946
|
-
}, [
|
|
947
|
-
let [
|
|
948
|
-
t.preventDefault(), t.stopPropagation(),
|
|
953
|
+
}, [Mn]);
|
|
954
|
+
let [Ln, Rn] = e.useState(null), zn = !!(o || R || z || Je), Bn = e.useCallback((e, t) => {
|
|
955
|
+
t.preventDefault(), t.stopPropagation(), Rn(e.id), zn && Dn({
|
|
949
956
|
x: t.clientX,
|
|
950
957
|
y: t.clientY,
|
|
951
958
|
taskId: e.id
|
|
952
959
|
});
|
|
953
|
-
}, [
|
|
954
|
-
r.preventDefault(), r.stopPropagation(), !(!z && !
|
|
960
|
+
}, [zn]), Vn = e.useCallback((e, t, n, r) => {
|
|
961
|
+
r.preventDefault(), r.stopPropagation(), !(!z && !at) && An({
|
|
955
962
|
x: r.clientX,
|
|
956
963
|
y: r.clientY,
|
|
957
964
|
sourceId: e,
|
|
958
965
|
targetId: t,
|
|
959
966
|
type: n
|
|
960
967
|
});
|
|
961
|
-
}, [z,
|
|
962
|
-
|
|
968
|
+
}, [z, at]), [Hn, Un] = e.useState(() => new Set(St?.collapsedIds ?? [])), Wn = e.useCallback((e) => {
|
|
969
|
+
Un((t) => {
|
|
963
970
|
let n = new Set(t), r = String(e);
|
|
964
971
|
return n.has(r) ? n.delete(r) : n.add(r), n;
|
|
965
972
|
});
|
|
966
|
-
}, []),
|
|
973
|
+
}, []), Gn = e.useRef(St?.collapsedIds != null);
|
|
967
974
|
e.useEffect(() => {
|
|
968
|
-
if (
|
|
969
|
-
|
|
975
|
+
if (Gn.current || ce == null || U.length === 0) return;
|
|
976
|
+
Gn.current = !0;
|
|
970
977
|
let e = new Map(U.map((e) => [String(e.id), e])), t = /* @__PURE__ */ new Set();
|
|
971
978
|
for (let n of U) {
|
|
972
979
|
let r = n.parent != null && n.parent !== "" ? String(n.parent) : null;
|
|
@@ -979,10 +986,10 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
979
986
|
}, r = /* @__PURE__ */ new Set();
|
|
980
987
|
for (let e of U) {
|
|
981
988
|
let i = String(e.id);
|
|
982
|
-
t.has(i) && n(e) >=
|
|
989
|
+
t.has(i) && n(e) >= ce && r.add(i);
|
|
983
990
|
}
|
|
984
|
-
r.size &&
|
|
985
|
-
}, [
|
|
991
|
+
r.size && Un((e) => e.size ? e : r);
|
|
992
|
+
}, [ce, U]);
|
|
986
993
|
let K = e.useMemo(() => {
|
|
987
994
|
let e = new Set(U.map((e) => String(e.id))), t = /* @__PURE__ */ new Map(), n = [];
|
|
988
995
|
for (let r of U) {
|
|
@@ -1007,7 +1014,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1007
1014
|
for (let a of s) {
|
|
1008
1015
|
let s = i(a, n);
|
|
1009
1016
|
(!e || s.start < e) && (e = s.start), (!t || s.end > t) && (t = s.end);
|
|
1010
|
-
let c = Math.max(s.end.getTime() - s.start.getTime(),
|
|
1017
|
+
let c = Math.max(s.end.getTime() - s.start.getTime(), it);
|
|
1011
1018
|
r += c * s.progress, o += c;
|
|
1012
1019
|
}
|
|
1013
1020
|
n.delete(a), c = {
|
|
@@ -1023,7 +1030,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1023
1030
|
let r = String(e.id);
|
|
1024
1031
|
if (o.has(r)) return;
|
|
1025
1032
|
o.add(r);
|
|
1026
|
-
let l = t.get(r) ?? [], u = l.length > 0, d = u || e.type === "summary", f = u &&
|
|
1033
|
+
let l = t.get(r) ?? [], u = l.length > 0, d = u || e.type === "summary", f = u && le === "self" && e.hasOwnDates !== !1, p = u && !f ? i(e, /* @__PURE__ */ new Set()) : {
|
|
1027
1034
|
start: e.start,
|
|
1028
1035
|
end: e.end,
|
|
1029
1036
|
progress: e.progress
|
|
@@ -1035,32 +1042,34 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1035
1042
|
isSummary: d,
|
|
1036
1043
|
isMilestone: m,
|
|
1037
1044
|
...p
|
|
1038
|
-
}), u)
|
|
1039
|
-
|
|
1045
|
+
}), u) {
|
|
1046
|
+
if (Hn.has(r)) s(e);
|
|
1047
|
+
else for (let e of l) c(e, n + 1);
|
|
1048
|
+
}
|
|
1040
1049
|
};
|
|
1041
1050
|
for (let e of n) c(e, 0);
|
|
1042
1051
|
for (let e of U) o.has(String(e.id)) || c(e, 0);
|
|
1043
1052
|
return a;
|
|
1044
1053
|
}, [
|
|
1045
1054
|
U,
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
]),
|
|
1055
|
+
Hn,
|
|
1056
|
+
le
|
|
1057
|
+
]), Kn = e.useCallback((e) => {
|
|
1049
1058
|
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return;
|
|
1050
1059
|
if ((e.ctrlKey || e.metaKey) && (e.key === "z" || e.key === "Z")) {
|
|
1051
|
-
e.preventDefault(), e.shiftKey ?
|
|
1060
|
+
e.preventDefault(), e.shiftKey ? pn() : fn();
|
|
1052
1061
|
return;
|
|
1053
1062
|
}
|
|
1054
1063
|
if ((e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "Y")) {
|
|
1055
|
-
e.preventDefault(),
|
|
1064
|
+
e.preventDefault(), pn();
|
|
1056
1065
|
return;
|
|
1057
1066
|
}
|
|
1058
1067
|
if (!K.length) return;
|
|
1059
|
-
let t =
|
|
1068
|
+
let t = Ln == null ? -1 : K.findIndex((e) => String(e.task.id) === String(Ln));
|
|
1060
1069
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
1061
1070
|
e.preventDefault();
|
|
1062
1071
|
let n = e.key === "ArrowDown" ? Math.min(K.length - 1, t + 1) : Math.max(0, t <= 0 ? 0 : t - 1);
|
|
1063
|
-
|
|
1072
|
+
Rn(K[n].task.id);
|
|
1064
1073
|
let r = Z.current;
|
|
1065
1074
|
if (r) {
|
|
1066
1075
|
let e = n * B;
|
|
@@ -1070,31 +1079,31 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1070
1079
|
}
|
|
1071
1080
|
if (t < 0) return;
|
|
1072
1081
|
let n = K[t];
|
|
1073
|
-
e.key === "Enter" ? (e.preventDefault(), o?.(n.task)) : e.key === "Delete" || e.key === "Backspace" ?
|
|
1082
|
+
e.key === "Enter" ? (e.preventDefault(), o?.(n.task)) : e.key === "Delete" || e.key === "Backspace" ? Je && (e.preventDefault(), Je(n.task)) : (e.key === "ArrowRight" && n.hasChildren && Hn.has(String(n.task.id)) || e.key === "ArrowLeft" && n.hasChildren && !Hn.has(String(n.task.id))) && (e.preventDefault(), Wn(n.task.id));
|
|
1074
1083
|
}, [
|
|
1075
1084
|
K,
|
|
1076
|
-
|
|
1085
|
+
Ln,
|
|
1077
1086
|
o,
|
|
1078
|
-
|
|
1079
|
-
Bn,
|
|
1087
|
+
Je,
|
|
1080
1088
|
Hn,
|
|
1089
|
+
Wn,
|
|
1081
1090
|
B,
|
|
1082
|
-
|
|
1083
|
-
|
|
1091
|
+
fn,
|
|
1092
|
+
pn
|
|
1084
1093
|
]), q = e.useMemo(() => {
|
|
1085
|
-
let e =
|
|
1086
|
-
return !
|
|
1094
|
+
let e = j ? new Date(j) : x.now(), t = M ? new Date(M) : x.now();
|
|
1095
|
+
return !j && S.length > 0 && (e = new Date(Math.min(...S.map((e) => e.start.getTime()))), e.setDate(e.getDate() - 7)), !M && S.length > 0 && (t = new Date(Math.max(...S.map((e) => e.end.getTime()))), t.setDate(t.getDate() + 14)), e = V === "day" && v && v.bands.length > 0 ? qe(e, v.dayStartMin) : st(e, V), t.setHours(23, 59, 59, 999), {
|
|
1087
1096
|
start: e,
|
|
1088
1097
|
end: t
|
|
1089
1098
|
};
|
|
1090
1099
|
}, [
|
|
1091
|
-
M,
|
|
1092
|
-
N,
|
|
1093
1100
|
j,
|
|
1101
|
+
M,
|
|
1102
|
+
S,
|
|
1094
1103
|
V,
|
|
1095
1104
|
v,
|
|
1096
1105
|
x
|
|
1097
|
-
]),
|
|
1106
|
+
]), qn = V === "day" && !!v && v.bands.length > 0, Jn = !qn && V === "day" && !!_ && (!!_.skipWeekends || !!(_.holidays && _.holidays.size)), Yn = e.useCallback((e) => {
|
|
1098
1107
|
if (!_) return !0;
|
|
1099
1108
|
if (_.skipWeekends) {
|
|
1100
1109
|
let t = e.getDay();
|
|
@@ -1107,10 +1116,10 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1107
1116
|
return !0;
|
|
1108
1117
|
}, [_]), J = e.useMemo(() => {
|
|
1109
1118
|
let e = [];
|
|
1110
|
-
if (
|
|
1119
|
+
if (qn && v) {
|
|
1111
1120
|
let t = new Date(q.start);
|
|
1112
1121
|
for (; t <= q.end;) for (let n of v.bands) {
|
|
1113
|
-
let r = n.durMs /
|
|
1122
|
+
let r = n.durMs / it * Lt;
|
|
1114
1123
|
e.push({
|
|
1115
1124
|
date: new Date(t),
|
|
1116
1125
|
label: n.label,
|
|
@@ -1124,12 +1133,12 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1124
1133
|
}
|
|
1125
1134
|
let t = new Date(q.start);
|
|
1126
1135
|
for (; t <= q.end;) {
|
|
1127
|
-
let n =
|
|
1128
|
-
if (
|
|
1136
|
+
let n = lt(t, 1, V);
|
|
1137
|
+
if (Jn && !Yn(t)) {
|
|
1129
1138
|
t = n;
|
|
1130
1139
|
continue;
|
|
1131
1140
|
}
|
|
1132
|
-
let r = (n.getTime() - t.getTime()) /
|
|
1141
|
+
let r = (n.getTime() - t.getTime()) / it * Lt, i, a;
|
|
1133
1142
|
V === "day" ? (i = String(t.getDate()), a = t.toLocaleDateString(F, { weekday: "narrow" })) : i = V === "week" ? t.toLocaleDateString(F, {
|
|
1134
1143
|
month: "numeric",
|
|
1135
1144
|
day: "numeric"
|
|
@@ -1145,34 +1154,34 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1145
1154
|
}, [
|
|
1146
1155
|
q,
|
|
1147
1156
|
V,
|
|
1148
|
-
|
|
1157
|
+
Lt,
|
|
1149
1158
|
F,
|
|
1150
|
-
|
|
1159
|
+
Jn,
|
|
1160
|
+
Yn,
|
|
1151
1161
|
qn,
|
|
1152
|
-
Gn,
|
|
1153
1162
|
v
|
|
1154
1163
|
]), Y = e.useMemo(() => {
|
|
1155
1164
|
let e = Array(J.length + 1), t = 0;
|
|
1156
1165
|
for (let n = 0; n < J.length; n++) e[n] = t, t += J[n].width;
|
|
1157
1166
|
return e[J.length] = t, e;
|
|
1158
|
-
}, [J]),
|
|
1167
|
+
}, [J]), Xn = Y[Y.length - 1], Zn = e.useMemo(() => J.map((e) => e.date.getTime()), [J]), Qn = e.useMemo(() => J.map((e) => e.realMs == null ? lt(e.date, 1, V).getTime() - e.date.getTime() : e.realMs), [J, V]), X = e.useCallback((e) => {
|
|
1159
1168
|
let t = J.length;
|
|
1160
1169
|
if (t === 0) return 0;
|
|
1161
1170
|
let n = e.getTime(), r = 0, i = t - 1, a = 0;
|
|
1162
1171
|
for (; r <= i;) {
|
|
1163
1172
|
let e = r + i >> 1;
|
|
1164
|
-
|
|
1173
|
+
Zn[e] <= n ? (a = e, r = e + 1) : i = e - 1;
|
|
1165
1174
|
}
|
|
1166
|
-
let o =
|
|
1167
|
-
return (
|
|
1175
|
+
let o = Qn[a] || 864e5, s = (n - Zn[a]) / o;
|
|
1176
|
+
return (Jn || qn) && (s = Math.max(0, Math.min(s, 1))), Y[a] + s * J[a].width;
|
|
1168
1177
|
}, [
|
|
1169
1178
|
J,
|
|
1170
|
-
|
|
1171
|
-
|
|
1179
|
+
Zn,
|
|
1180
|
+
Qn,
|
|
1172
1181
|
Y,
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
]),
|
|
1182
|
+
Jn,
|
|
1183
|
+
qn
|
|
1184
|
+
]), $n = e.useCallback((e) => {
|
|
1176
1185
|
let t = J.length;
|
|
1177
1186
|
if (t === 0) return new Date(q.start);
|
|
1178
1187
|
let n = 0, r = t - 1, i = 0;
|
|
@@ -1181,44 +1190,44 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1181
1190
|
Y[t] <= e ? (i = t, n = t + 1) : r = t - 1;
|
|
1182
1191
|
}
|
|
1183
1192
|
let a = J[i].width || 1, o = (e - Y[i]) / a;
|
|
1184
|
-
return new Date(
|
|
1193
|
+
return new Date(Zn[i] + o * (Qn[i] || 864e5));
|
|
1185
1194
|
}, [
|
|
1186
1195
|
J,
|
|
1187
|
-
|
|
1188
|
-
|
|
1196
|
+
Zn,
|
|
1197
|
+
Qn,
|
|
1189
1198
|
Y,
|
|
1190
1199
|
q
|
|
1191
|
-
]),
|
|
1200
|
+
]), er = e.useCallback((e) => {
|
|
1192
1201
|
let t = Z.current;
|
|
1193
|
-
|
|
1194
|
-
}, [l,
|
|
1202
|
+
kt.current == null && t && t.clientWidth > 0 && (kt.current = $n(t.scrollLeft)), Ot.current = kt.current, At.current = !0, Dt(e), l?.(e);
|
|
1203
|
+
}, [l, $n]);
|
|
1195
1204
|
e.useLayoutEffect(() => {
|
|
1196
|
-
let e =
|
|
1205
|
+
let e = Ot.current;
|
|
1197
1206
|
if (e == null) return;
|
|
1198
|
-
|
|
1207
|
+
Ot.current = null;
|
|
1199
1208
|
let t = Z.current;
|
|
1200
1209
|
if (!t || t.clientWidth === 0) return;
|
|
1201
|
-
let n = Math.max(0, t.scrollWidth - t.clientWidth), r = Math.max(0, Math.min(Math.round(X(
|
|
1210
|
+
let n = Math.max(0, t.scrollWidth - t.clientWidth), r = Math.max(0, Math.min(Math.round(X(st(e, V))), n));
|
|
1202
1211
|
t.scrollLeft !== r && (t.scrollLeft = r);
|
|
1203
1212
|
}, [V, X]);
|
|
1204
|
-
let
|
|
1213
|
+
let tr = e.useCallback((e, t) => {
|
|
1205
1214
|
let n = J.length;
|
|
1206
1215
|
if (n === 0 || t === 0) return new Date(e);
|
|
1207
1216
|
let r = e.getTime(), i = 0, a = n - 1, o = 0;
|
|
1208
1217
|
for (; i <= a;) {
|
|
1209
1218
|
let e = i + a >> 1;
|
|
1210
|
-
|
|
1219
|
+
Zn[e] <= r ? (o = e, i = e + 1) : a = e - 1;
|
|
1211
1220
|
}
|
|
1212
|
-
let s = Math.min(n - 1, Math.max(0, o + t)), c = r -
|
|
1213
|
-
return new Date(
|
|
1214
|
-
}, [J,
|
|
1215
|
-
|
|
1216
|
-
let
|
|
1221
|
+
let s = Math.min(n - 1, Math.max(0, o + t)), c = r - Zn[o];
|
|
1222
|
+
return new Date(Zn[s] + c);
|
|
1223
|
+
}, [J, Zn]), nr = e.useRef(null);
|
|
1224
|
+
nr.current = Jn || qn ? tr : null;
|
|
1225
|
+
let rr = e.useMemo(() => {
|
|
1217
1226
|
let e = [];
|
|
1218
|
-
if (
|
|
1227
|
+
if (qn && v) {
|
|
1219
1228
|
let t = 0;
|
|
1220
1229
|
for (let n of J) {
|
|
1221
|
-
let r = String(
|
|
1230
|
+
let r = String(qe(n.date, v.dayStartMin).getTime()), i = e[e.length - 1];
|
|
1222
1231
|
i && i.key === r ? i.width += n.width : e.push({
|
|
1223
1232
|
key: r,
|
|
1224
1233
|
label: n.date.toLocaleDateString(F, {
|
|
@@ -1249,9 +1258,9 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1249
1258
|
J,
|
|
1250
1259
|
V,
|
|
1251
1260
|
F,
|
|
1252
|
-
|
|
1261
|
+
qn,
|
|
1253
1262
|
v
|
|
1254
|
-
]),
|
|
1263
|
+
]), ir = e.useMemo(() => (N ?? []).map((e, t) => {
|
|
1255
1264
|
let n = e.date instanceof Date ? e.date : new Date(e.date);
|
|
1256
1265
|
return {
|
|
1257
1266
|
index: t,
|
|
@@ -1261,15 +1270,15 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1261
1270
|
valid: !isNaN(n.getTime()) && n >= q.start && n <= q.end
|
|
1262
1271
|
};
|
|
1263
1272
|
}).filter((e) => e.valid), [
|
|
1264
|
-
|
|
1273
|
+
N,
|
|
1265
1274
|
q,
|
|
1266
1275
|
X
|
|
1267
|
-
]),
|
|
1276
|
+
]), ar = e.useRef(null), or = e.useRef(null), sr = e.useRef(null), Z = e.useRef(null);
|
|
1268
1277
|
e.useEffect(() => {
|
|
1269
1278
|
let e = Z.current;
|
|
1270
1279
|
if (!e) return;
|
|
1271
1280
|
let t = () => {
|
|
1272
|
-
|
|
1281
|
+
At.current = !1;
|
|
1273
1282
|
}, n = /* @__PURE__ */ new Set([
|
|
1274
1283
|
"ArrowLeft",
|
|
1275
1284
|
"ArrowRight",
|
|
@@ -1288,103 +1297,103 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1288
1297
|
e.removeEventListener("wheel", t), e.removeEventListener("touchstart", t), e.removeEventListener("pointerdown", t), e.removeEventListener("keydown", r);
|
|
1289
1298
|
};
|
|
1290
1299
|
}, []);
|
|
1291
|
-
let [
|
|
1300
|
+
let [cr, lr] = e.useState(null), ur = e.useRef([]), dr = e.useRef(null), [fr, pr] = e.useState({
|
|
1292
1301
|
top: 0,
|
|
1293
1302
|
left: 0
|
|
1294
|
-
}), [
|
|
1303
|
+
}), [mr, hr] = e.useState({
|
|
1295
1304
|
width: 4e3,
|
|
1296
1305
|
height: 600
|
|
1297
|
-
}),
|
|
1306
|
+
}), gr = e.useCallback(() => {
|
|
1298
1307
|
let e = Z.current;
|
|
1299
1308
|
if (!e) return;
|
|
1300
1309
|
let t = e.clientWidth || 4e3, n = e.clientHeight || 600;
|
|
1301
|
-
|
|
1310
|
+
hr((e) => e.width === t && e.height === n ? e : {
|
|
1302
1311
|
width: t,
|
|
1303
1312
|
height: n
|
|
1304
1313
|
});
|
|
1305
1314
|
}, []);
|
|
1306
1315
|
e.useLayoutEffect(() => {
|
|
1307
|
-
|
|
1316
|
+
gr();
|
|
1308
1317
|
let e = Z.current;
|
|
1309
1318
|
if (!e || typeof ResizeObserver > "u") return;
|
|
1310
|
-
let t = new ResizeObserver(
|
|
1319
|
+
let t = new ResizeObserver(gr);
|
|
1311
1320
|
return t.observe(e), () => t.disconnect();
|
|
1312
|
-
}, [
|
|
1313
|
-
let
|
|
1321
|
+
}, [gr]);
|
|
1322
|
+
let _r = e.useMemo(() => ct(Y, fr.left - 240, fr.left + mr.width + 240), [
|
|
1314
1323
|
Y,
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
]),
|
|
1318
|
-
let e =
|
|
1319
|
-
return e.push(
|
|
1320
|
-
}, [
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
+
fr.left,
|
|
1325
|
+
mr.width
|
|
1326
|
+
]), vr = e.useMemo(() => {
|
|
1327
|
+
let e = rr.map((e) => e.offset);
|
|
1328
|
+
return e.push(Xn), e;
|
|
1329
|
+
}, [rr, Xn]), yr = e.useMemo(() => ct(vr, fr.left - 240, fr.left + mr.width + 240), [
|
|
1330
|
+
vr,
|
|
1331
|
+
fr.left,
|
|
1332
|
+
mr.width
|
|
1324
1333
|
]), Q = e.useMemo(() => ({
|
|
1325
|
-
startIdx: Math.max(0, Math.floor(
|
|
1326
|
-
endIdx: Math.min(K.length, Math.ceil((
|
|
1334
|
+
startIdx: Math.max(0, Math.floor(fr.top / B) - 6),
|
|
1335
|
+
endIdx: Math.min(K.length, Math.ceil((fr.top + mr.height) / B) + 6)
|
|
1327
1336
|
}), [
|
|
1328
|
-
|
|
1329
|
-
|
|
1337
|
+
fr.top,
|
|
1338
|
+
mr.height,
|
|
1330
1339
|
B,
|
|
1331
1340
|
K.length
|
|
1332
|
-
]),
|
|
1341
|
+
]), br = K.length * B, [xr, Sr] = e.useState(!1);
|
|
1333
1342
|
e.useEffect(() => {
|
|
1334
|
-
let e = () =>
|
|
1343
|
+
let e = () => Sr(!!document.fullscreenElement);
|
|
1335
1344
|
return document.addEventListener("fullscreenchange", e), () => document.removeEventListener("fullscreenchange", e);
|
|
1336
1345
|
}, []);
|
|
1337
|
-
let
|
|
1338
|
-
let e =
|
|
1346
|
+
let Cr = e.useCallback(() => {
|
|
1347
|
+
let e = I.current;
|
|
1339
1348
|
e && (document.fullscreenElement ? document.exitFullscreen?.() : e.requestFullscreen?.());
|
|
1340
|
-
}, []),
|
|
1349
|
+
}, []), wr = e.useRef(null), Tr = e.useCallback((e) => {
|
|
1341
1350
|
if (e.touches.length === 2) {
|
|
1342
1351
|
let t = e.touches[0].clientX - e.touches[1].clientX, n = e.touches[0].clientY - e.touches[1].clientY;
|
|
1343
|
-
|
|
1352
|
+
wr.current = {
|
|
1344
1353
|
baseDistance: Math.max(1, Math.sqrt(t * t + n * n)),
|
|
1345
|
-
baseColumn:
|
|
1354
|
+
baseColumn: It
|
|
1346
1355
|
};
|
|
1347
1356
|
}
|
|
1348
|
-
}, [
|
|
1349
|
-
if (e.touches.length !== 2 || !
|
|
1350
|
-
let t = e.touches[0].clientX - e.touches[1].clientX, n = e.touches[0].clientY - e.touches[1].clientY, r = Math.max(1, Math.sqrt(t * t + n * n)) /
|
|
1351
|
-
|
|
1352
|
-
}, []),
|
|
1353
|
-
|
|
1354
|
-
}, []),
|
|
1357
|
+
}, [It]), Er = e.useCallback((e) => {
|
|
1358
|
+
if (e.touches.length !== 2 || !wr.current) return;
|
|
1359
|
+
let t = e.touches[0].clientX - e.touches[1].clientX, n = e.touches[0].clientY - e.touches[1].clientY, r = Math.max(1, Math.sqrt(t * t + n * n)) / wr.current.baseDistance, i = Math.max(15, Math.min(120, Math.round(wr.current.baseColumn * r)));
|
|
1360
|
+
wt(i);
|
|
1361
|
+
}, []), Dr = e.useCallback(() => {
|
|
1362
|
+
wr.current = null;
|
|
1363
|
+
}, []), Or = e.useMemo(() => {
|
|
1355
1364
|
let e = x.now();
|
|
1356
1365
|
return e < q.start || e > q.end ? null : Math.round(X(e));
|
|
1357
1366
|
}, [
|
|
1358
1367
|
q,
|
|
1359
1368
|
X,
|
|
1360
1369
|
x
|
|
1361
|
-
]),
|
|
1362
|
-
if (
|
|
1363
|
-
let e = Math.max(0,
|
|
1370
|
+
]), kr = e.useCallback(() => {
|
|
1371
|
+
if (Or == null || !Z.current) return;
|
|
1372
|
+
let e = Math.max(0, Or - Z.current.clientWidth / 2);
|
|
1364
1373
|
Z.current.scrollTo({
|
|
1365
1374
|
left: e,
|
|
1366
1375
|
behavior: "smooth"
|
|
1367
1376
|
});
|
|
1368
|
-
}, [
|
|
1377
|
+
}, [Or]), Ar = e.useRef(!1);
|
|
1369
1378
|
e.useEffect(() => {
|
|
1370
|
-
if (
|
|
1379
|
+
if (Ar.current || S.length === 0) return;
|
|
1371
1380
|
let e = window.requestAnimationFrame(() => {
|
|
1372
1381
|
let e = Z.current;
|
|
1373
1382
|
if (!e || e.clientWidth === 0) return;
|
|
1374
|
-
let t =
|
|
1383
|
+
let t = Or;
|
|
1375
1384
|
if (t == null) {
|
|
1376
|
-
let e = new Date(Math.min(...
|
|
1385
|
+
let e = new Date(Math.min(...S.map((e) => e.start.getTime())));
|
|
1377
1386
|
t = Math.round(X(e));
|
|
1378
1387
|
}
|
|
1379
|
-
e.scrollLeft = Math.max(0, t - e.clientWidth / 2),
|
|
1388
|
+
e.scrollLeft = Math.max(0, t - e.clientWidth / 2), Ar.current = !0;
|
|
1380
1389
|
});
|
|
1381
1390
|
return () => window.cancelAnimationFrame(e);
|
|
1382
1391
|
}, [
|
|
1383
|
-
|
|
1384
|
-
|
|
1392
|
+
S,
|
|
1393
|
+
Or,
|
|
1385
1394
|
X
|
|
1386
1395
|
]);
|
|
1387
|
-
let
|
|
1396
|
+
let jr = e.useCallback((e, t = "left") => {
|
|
1388
1397
|
let n = Z.current;
|
|
1389
1398
|
if (!n || e < q.start || e > q.end) return !1;
|
|
1390
1399
|
let r = Math.round(X(e)), i = t === "center" ? r - n.clientWidth / 2 : r - 24;
|
|
@@ -1392,17 +1401,17 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1392
1401
|
left: Math.max(0, i),
|
|
1393
1402
|
behavior: "smooth"
|
|
1394
1403
|
}), !0;
|
|
1395
|
-
}, [q, X]),
|
|
1404
|
+
}, [q, X]), Mr = e.useCallback((e, t, n) => {
|
|
1396
1405
|
let r = Z.current;
|
|
1397
1406
|
if (!r) return;
|
|
1398
1407
|
let i = X(e), a = X(t), o = Math.max(0, r.scrollWidth - r.clientWidth), s = Math.min(96, r.clientWidth * .15), c = a - i <= r.clientWidth - s ? (i + a) / 2 - r.clientWidth / 2 : i - s, l = Math.max(0, Math.min(c, o));
|
|
1399
|
-
|
|
1408
|
+
ur.current.forEach((e) => window.clearTimeout(e)), ur.current = [], dr.current?.(), dr.current = null, lr(null);
|
|
1400
1409
|
let u = () => {
|
|
1401
1410
|
if (n == null) return;
|
|
1402
1411
|
let e = window.requestAnimationFrame(() => {
|
|
1403
|
-
|
|
1412
|
+
lr(n), ur.current.push(window.setTimeout(() => lr((e) => e === n ? null : e), 1500));
|
|
1404
1413
|
});
|
|
1405
|
-
|
|
1414
|
+
dr.current = () => window.cancelAnimationFrame(e);
|
|
1406
1415
|
}, d = Math.abs(r.scrollLeft - l) > 2;
|
|
1407
1416
|
if (r.scrollTo({
|
|
1408
1417
|
left: l,
|
|
@@ -1414,13 +1423,13 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1414
1423
|
let f = "onscrollend" in r, p = !1, m = () => {
|
|
1415
1424
|
p || (p = !0, r.removeEventListener("scrollend", m), u());
|
|
1416
1425
|
};
|
|
1417
|
-
r.addEventListener("scrollend", m),
|
|
1426
|
+
r.addEventListener("scrollend", m), ur.current.push(window.setTimeout(m, f ? 1500 : 500)), dr.current = () => r.removeEventListener("scrollend", m);
|
|
1418
1427
|
}, [X]);
|
|
1419
1428
|
e.useEffect(() => () => {
|
|
1420
|
-
|
|
1429
|
+
ur.current.forEach((e) => window.clearTimeout(e)), dr.current?.();
|
|
1421
1430
|
}, []);
|
|
1422
|
-
let
|
|
1423
|
-
let e =
|
|
1431
|
+
let Nr = e.useCallback(() => jr(st(x.now(), "week")), [jr, x]), Pr = e.useCallback(() => jr(st(x.now(), "month")), [jr, x]), Fr = e.useRef(null), Ir = e.useRef(null), Lr = e.useRef(null), Rr = e.useRef(null), zr = e.useRef(null), Br = e.useRef(null), Vr = e.useRef(null), Hr = e.useRef(null), Ur = e.useCallback(() => {
|
|
1432
|
+
let e = sr.current, t = Fr.current, n = Ir.current, r = Lr.current;
|
|
1424
1433
|
if (e && t && n && r) {
|
|
1425
1434
|
let i = e.scrollWidth > e.clientWidth + 1;
|
|
1426
1435
|
if (t.style.display = i ? "block" : "none", i) {
|
|
@@ -1431,7 +1440,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1431
1440
|
}
|
|
1432
1441
|
}
|
|
1433
1442
|
}
|
|
1434
|
-
let i =
|
|
1443
|
+
let i = zr.current, a = Br.current, o = Vr.current;
|
|
1435
1444
|
if (e && i && a && o) {
|
|
1436
1445
|
let t = e.scrollHeight > e.clientHeight + 1;
|
|
1437
1446
|
if (i.style.display = t ? "block" : "none", t) {
|
|
@@ -1444,106 +1453,106 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1444
1453
|
}
|
|
1445
1454
|
}, []);
|
|
1446
1455
|
e.useEffect(() => {
|
|
1447
|
-
|
|
1456
|
+
Ur();
|
|
1448
1457
|
});
|
|
1449
|
-
let
|
|
1458
|
+
let Wr = (e) => {
|
|
1450
1459
|
if (e.button !== 0) return;
|
|
1451
1460
|
e.preventDefault(), e.stopPropagation();
|
|
1452
|
-
let t =
|
|
1461
|
+
let t = sr.current, n = Ir.current, r = Lr.current;
|
|
1453
1462
|
if (!t || !n || !r) return;
|
|
1454
|
-
|
|
1463
|
+
Rr.current = {
|
|
1455
1464
|
startX: e.clientX,
|
|
1456
1465
|
startLeft: t.scrollLeft
|
|
1457
1466
|
};
|
|
1458
1467
|
let i = n.clientWidth, a = r.getBoundingClientRect().width, o = t.scrollWidth - t.clientWidth, s = i - a > 0 ? o / (i - a) : 0, c = (e) => {
|
|
1459
|
-
let n =
|
|
1468
|
+
let n = Rr.current;
|
|
1460
1469
|
n && (t.scrollLeft = n.startLeft + (e.clientX - n.startX) * s);
|
|
1461
1470
|
}, l = () => {
|
|
1462
|
-
|
|
1471
|
+
Rr.current = null, window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", l);
|
|
1463
1472
|
};
|
|
1464
1473
|
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l), window.addEventListener("pointercancel", l);
|
|
1465
|
-
},
|
|
1474
|
+
}, Gr = (e) => {
|
|
1466
1475
|
if (e.button !== 0 || e.target !== e.currentTarget) return;
|
|
1467
|
-
let t =
|
|
1476
|
+
let t = sr.current, n = Ir.current, r = Lr.current;
|
|
1468
1477
|
if (!t || !n || !r) return;
|
|
1469
1478
|
let i = n.getBoundingClientRect(), a = r.getBoundingClientRect().width, o = t.scrollWidth - t.clientWidth, s = i.width - a;
|
|
1470
1479
|
s <= 0 || (t.scrollLeft = Math.min(Math.max(e.clientX - i.x - a / 2, 0), s) / s * o);
|
|
1471
|
-
},
|
|
1480
|
+
}, Kr = (e) => {
|
|
1472
1481
|
if (e.button !== 0) return;
|
|
1473
1482
|
e.preventDefault(), e.stopPropagation();
|
|
1474
|
-
let t =
|
|
1483
|
+
let t = sr.current, n = Br.current, r = Vr.current;
|
|
1475
1484
|
if (!t || !n || !r) return;
|
|
1476
|
-
|
|
1485
|
+
Hr.current = {
|
|
1477
1486
|
startY: e.clientY,
|
|
1478
1487
|
startTop: t.scrollTop
|
|
1479
1488
|
};
|
|
1480
1489
|
let i = n.clientHeight, a = r.getBoundingClientRect().height, o = t.scrollHeight - t.clientHeight, s = i - a > 0 ? o / (i - a) : 0, c = (e) => {
|
|
1481
|
-
let n =
|
|
1490
|
+
let n = Hr.current;
|
|
1482
1491
|
n && (t.scrollTop = n.startTop + (e.clientY - n.startY) * s);
|
|
1483
1492
|
}, l = () => {
|
|
1484
|
-
|
|
1493
|
+
Hr.current = null, window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", l);
|
|
1485
1494
|
};
|
|
1486
1495
|
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l), window.addEventListener("pointercancel", l);
|
|
1487
|
-
},
|
|
1496
|
+
}, qr = (e) => {
|
|
1488
1497
|
if (e.button !== 0 || e.target !== e.currentTarget) return;
|
|
1489
|
-
let t =
|
|
1498
|
+
let t = sr.current, n = Br.current, r = Vr.current;
|
|
1490
1499
|
if (!t || !n || !r) return;
|
|
1491
1500
|
let i = n.getBoundingClientRect(), a = r.getBoundingClientRect().height, o = t.scrollHeight - t.clientHeight, s = i.height - a;
|
|
1492
1501
|
s <= 0 || (t.scrollTop = Math.min(Math.max(e.clientY - i.y - a / 2, 0), s) / s * o);
|
|
1493
|
-
},
|
|
1502
|
+
}, Jr = (e) => {
|
|
1494
1503
|
let t = e.currentTarget;
|
|
1495
|
-
!
|
|
1504
|
+
!At.current && t.clientWidth > 0 && (kt.current = $n(t.scrollLeft)), ar.current && (ar.current.scrollLeft = t.scrollLeft), Ur(), or.current && or.current.scrollTop !== t.scrollTop && (or.current.scrollTop = t.scrollTop), pr((e) => e.top === t.scrollTop && e.left === t.scrollLeft ? e : {
|
|
1496
1505
|
top: t.scrollTop,
|
|
1497
1506
|
left: t.scrollLeft
|
|
1498
|
-
}),
|
|
1499
|
-
},
|
|
1507
|
+
}), gr();
|
|
1508
|
+
}, Yr = (e) => {
|
|
1500
1509
|
let t = e.currentTarget, n = Z.current;
|
|
1501
|
-
n && n.scrollTop !== t.scrollTop && (n.scrollTop = t.scrollTop),
|
|
1510
|
+
n && n.scrollTop !== t.scrollTop && (n.scrollTop = t.scrollTop), pr((e) => e.top === t.scrollTop ? e : {
|
|
1502
1511
|
...e,
|
|
1503
1512
|
top: t.scrollTop
|
|
1504
1513
|
});
|
|
1505
|
-
},
|
|
1506
|
-
let n = X(e), r =
|
|
1514
|
+
}, Xr = (e, t) => {
|
|
1515
|
+
let n = X(e), r = qn && v ? Lt * Math.min(...v.bands.map((e) => e.durMs)) / it : Lt;
|
|
1507
1516
|
return {
|
|
1508
1517
|
left: n,
|
|
1509
1518
|
width: Math.max(X(t) - n, r, 3)
|
|
1510
1519
|
};
|
|
1511
|
-
},
|
|
1512
|
-
if (
|
|
1513
|
-
let e = /* @__PURE__ */ new Set([String(
|
|
1514
|
-
for (let t of
|
|
1520
|
+
}, Zr = W?.group ? W.taskId : null, Qr = e.useMemo(() => {
|
|
1521
|
+
if (Zr == null) return null;
|
|
1522
|
+
let e = /* @__PURE__ */ new Set([String(Zr)]);
|
|
1523
|
+
for (let t of qt(Zr)) t.locked || e.add(String(t.id));
|
|
1515
1524
|
return e;
|
|
1516
|
-
}, [
|
|
1525
|
+
}, [Zr, qt]), $r = e.useMemo(() => {
|
|
1517
1526
|
if (!W || W.group) return null;
|
|
1518
|
-
let e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set(), n =
|
|
1527
|
+
let e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set(), n = Kt.get(String(W.taskId));
|
|
1519
1528
|
for (; n && n.parent != null && n.parent !== "";) {
|
|
1520
1529
|
let r = String(n.parent);
|
|
1521
|
-
if (t.has(r) || !
|
|
1522
|
-
t.add(r), e.add(r), n =
|
|
1530
|
+
if (t.has(r) || !Kt.has(r)) break;
|
|
1531
|
+
t.add(r), e.add(r), n = Kt.get(r);
|
|
1523
1532
|
}
|
|
1524
1533
|
return e.size ? e : null;
|
|
1525
|
-
}, [W,
|
|
1534
|
+
}, [W, Kt]), ei = (e) => {
|
|
1526
1535
|
if (W) {
|
|
1527
|
-
if (
|
|
1528
|
-
let t =
|
|
1529
|
-
return
|
|
1536
|
+
if (Qr?.has(String(e.task.id))) {
|
|
1537
|
+
let t = Zt(W).start.getTime() - W.originStart.getTime();
|
|
1538
|
+
return Xr(new Date(e.start.getTime() + t), new Date(e.end.getTime() + t));
|
|
1530
1539
|
}
|
|
1531
1540
|
if (W.taskId === e.task.id && !W.group) {
|
|
1532
|
-
let e =
|
|
1533
|
-
return
|
|
1541
|
+
let e = Zt(W);
|
|
1542
|
+
return Xr(e.start, e.end);
|
|
1534
1543
|
}
|
|
1535
|
-
if (e.isSummary &&
|
|
1536
|
-
let t =
|
|
1537
|
-
for (let a of
|
|
1538
|
-
if ((
|
|
1544
|
+
if (e.isSummary && $r?.has(String(e.task.id)) && (le !== "self" || e.task.hasOwnDates === !1)) {
|
|
1545
|
+
let t = Zt(W), n = String(W.taskId), r = null, i = null;
|
|
1546
|
+
for (let a of qt(e.task.id)) {
|
|
1547
|
+
if ((Gt.get(String(a.id)) ?? []).length !== 0) continue;
|
|
1539
1548
|
let e = String(a.id) === n ? t.start : a.start, o = String(a.id) === n ? t.end : a.end;
|
|
1540
1549
|
(!r || e < r) && (r = e), (!i || o > i) && (i = o);
|
|
1541
1550
|
}
|
|
1542
|
-
if (r && i) return
|
|
1551
|
+
if (r && i) return Xr(r, i);
|
|
1543
1552
|
}
|
|
1544
1553
|
}
|
|
1545
|
-
return
|
|
1546
|
-
},
|
|
1554
|
+
return Xr(e.start, e.end);
|
|
1555
|
+
}, ti = e.useMemo(() => {
|
|
1547
1556
|
let e = /* @__PURE__ */ new Map();
|
|
1548
1557
|
K.forEach((t, n) => e.set(String(t.task.id), n));
|
|
1549
1558
|
let t = [];
|
|
@@ -1564,47 +1573,47 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1564
1573
|
});
|
|
1565
1574
|
}
|
|
1566
1575
|
}), t;
|
|
1567
|
-
}, [K]),
|
|
1576
|
+
}, [K]), ni = Math.max(2, Math.round(B / 2) - 14), ri = B - ni * 2, ii = Math.round(ri / 2), ai = Math.max(Math.round(B * .4), 12), oi = ai * Math.SQRT2 / 2, si = ri, ci = ni, li = Math.max(3, Math.round(B * .13)), ui = B - li - 1, di = "rgba(100, 116, 139, 0.35)", fi = "rgba(100, 116, 139, 0.6)", pi = (e) => {
|
|
1568
1577
|
let t = K[e.sourceIndex], n = K[e.targetIndex];
|
|
1569
1578
|
if (!t || !n) return null;
|
|
1570
|
-
let r =
|
|
1579
|
+
let r = ei(t), i = ei(n), a = (e) => e.isSummary ? ci + si / 2 : B / 2, o = e.sourceIndex * B + a(t), s = e.targetIndex * B + a(n), c = e.type === "fs" || e.type === "ff", l = e.type === "ff" || e.type === "sf", u = t.isMilestone ? r.left + (c ? oi : -oi) : c ? r.left + r.width : r.left, d = n.isMilestone ? i.left + (l ? oi : -oi) : l ? i.left + i.width : i.left, f = u + (c ? 10 : -10), p = d + (l ? 10 : -10), m = Math.round, h = [`M ${m(u)} ${m(o)}`, `L ${m(f)} ${m(o)}`];
|
|
1571
1580
|
if (l ? f >= p : f <= p) h.push(`L ${m(f)} ${m(s)}`, `L ${m(d)} ${m(s)}`);
|
|
1572
1581
|
else {
|
|
1573
1582
|
let t = s >= o ? (e.sourceIndex + 1) * B : e.sourceIndex * B;
|
|
1574
1583
|
h.push(`L ${m(f)} ${m(t)}`, `L ${m(p)} ${m(t)}`, `L ${m(p)} ${m(s)}`, `L ${m(d)} ${m(s)}`);
|
|
1575
1584
|
}
|
|
1576
1585
|
return h.join(" ");
|
|
1577
|
-
},
|
|
1578
|
-
|
|
1579
|
-
|
|
1586
|
+
}, mi = W?.taskId ?? Ut, [hi, gi] = e.useState(ne), _i = e.useMemo(() => hi ? Be(S, _) : null, [
|
|
1587
|
+
hi,
|
|
1588
|
+
S,
|
|
1580
1589
|
_
|
|
1581
|
-
]),
|
|
1590
|
+
]), vi = e.useCallback((e) => _i?.criticalIds.has(String(e)) ?? !1, [_i]), $ = "#dc2626", [yi, bi] = e.useState(null), [xi, Si] = e.useState(!1);
|
|
1582
1591
|
e.useEffect(() => {
|
|
1583
|
-
if (!
|
|
1584
|
-
let e = setTimeout(() =>
|
|
1592
|
+
if (!xi) return;
|
|
1593
|
+
let e = setTimeout(() => Si(!1), 2500);
|
|
1585
1594
|
return () => clearTimeout(e);
|
|
1586
|
-
}, [
|
|
1587
|
-
let
|
|
1595
|
+
}, [xi]);
|
|
1596
|
+
let Ci = e.useCallback(() => {
|
|
1588
1597
|
if (!R) return;
|
|
1589
|
-
let { changes: e, skippedLocked: t } =
|
|
1598
|
+
let { changes: e, skippedLocked: t } = Ve(S, _, cn);
|
|
1590
1599
|
if (!e.length) {
|
|
1591
|
-
|
|
1600
|
+
Si(!0);
|
|
1592
1601
|
return;
|
|
1593
1602
|
}
|
|
1594
|
-
|
|
1603
|
+
bi({
|
|
1595
1604
|
changes: e,
|
|
1596
1605
|
skipped: t.length
|
|
1597
1606
|
});
|
|
1598
1607
|
}, [
|
|
1599
|
-
|
|
1608
|
+
S,
|
|
1600
1609
|
R,
|
|
1601
1610
|
_,
|
|
1602
|
-
|
|
1603
|
-
]),
|
|
1604
|
-
if (!
|
|
1611
|
+
cn
|
|
1612
|
+
]), wi = e.useCallback(() => {
|
|
1613
|
+
if (!yi) return;
|
|
1605
1614
|
let e = [];
|
|
1606
|
-
for (let t of
|
|
1607
|
-
let n =
|
|
1615
|
+
for (let t of yi.changes) {
|
|
1616
|
+
let n = S.find((e) => String(e.id) === t.id);
|
|
1608
1617
|
n && e.push({
|
|
1609
1618
|
task: n,
|
|
1610
1619
|
changes: {
|
|
@@ -1613,20 +1622,20 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1613
1622
|
}
|
|
1614
1623
|
});
|
|
1615
1624
|
}
|
|
1616
|
-
e.length &&
|
|
1625
|
+
e.length && rn(e), bi(null);
|
|
1617
1626
|
}, [
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
]),
|
|
1622
|
-
if (typeof document > "u" || !
|
|
1627
|
+
yi,
|
|
1628
|
+
S,
|
|
1629
|
+
rn
|
|
1630
|
+
]), Ti = e.useCallback(() => {
|
|
1631
|
+
if (typeof document > "u" || !S.length) return null;
|
|
1623
1632
|
let e = (e) => String(e).replace(/[&<>"]/g, (e) => ({
|
|
1624
1633
|
"&": "&",
|
|
1625
1634
|
"<": "<",
|
|
1626
1635
|
">": ">",
|
|
1627
1636
|
"\"": """
|
|
1628
|
-
})[e]), t = Math.max(H, 200), n = Math.ceil(t +
|
|
1629
|
-
a.push(`<rect x="0" y="0" width="${n}" height="${r}" fill="#ffffff"/>`), a.push(`<rect x="0" y="0" width="${n}" height="36" fill="#f8fafc"/>`), a.push(`<g transform="translate(${t},0)" font-family="sans-serif" font-size="10" fill="#475569">`),
|
|
1637
|
+
})[e]), t = Math.max(H, 200), n = Math.ceil(t + Xn), r = Math.ceil(36 + K.length * B), i = _i?.criticalEdges ?? null, a = [];
|
|
1638
|
+
a.push(`<rect x="0" y="0" width="${n}" height="${r}" fill="#ffffff"/>`), a.push(`<rect x="0" y="0" width="${n}" height="36" fill="#f8fafc"/>`), a.push(`<g transform="translate(${t},0)" font-family="sans-serif" font-size="10" fill="#475569">`), rr.forEach((t) => {
|
|
1630
1639
|
a.push(`<line x1="${t.offset.toFixed(1)}" y1="0" x2="${t.offset.toFixed(1)}" y2="36" stroke="#e2e8f0"/>`), a.push(`<text x="${(t.offset + t.width / 2).toFixed(1)}" y="12" text-anchor="middle" font-weight="600">${e(t.label)}</text>`);
|
|
1631
1640
|
}), J.forEach((t, n) => {
|
|
1632
1641
|
let i = Y[n];
|
|
@@ -1650,37 +1659,37 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1650
1659
|
};
|
|
1651
1660
|
a.push(`<g transform="translate(${t},36)" font-family="sans-serif" font-size="9">`), K.forEach((t, n) => {
|
|
1652
1661
|
if (t.task.type === "group") return;
|
|
1653
|
-
let r = n * B, { left: i, width: s } =
|
|
1654
|
-
if (
|
|
1655
|
-
let e =
|
|
1656
|
-
a.push(`<rect x="${e.left.toFixed(1)}" y="${(r +
|
|
1662
|
+
let r = n * B, { left: i, width: s } = Xr(t.start, t.end), c = vi(t.task.id), l = c ? ` stroke="${$}" stroke-width="2"` : "";
|
|
1663
|
+
if (re && t.task.baselineStart && t.task.baselineEnd) {
|
|
1664
|
+
let e = Xr(t.task.baselineStart, t.task.baselineEnd);
|
|
1665
|
+
a.push(`<rect x="${e.left.toFixed(1)}" y="${(r + ui).toFixed(1)}" width="${Math.max(2, e.width).toFixed(1)}" height="${li}" rx="1" fill="${di}" stroke="${fi}"/>`);
|
|
1657
1666
|
}
|
|
1658
1667
|
if (t.isMilestone) {
|
|
1659
|
-
let e = i, n = r + B / 2, o =
|
|
1668
|
+
let e = i, n = r + B / 2, o = ai / 2, s = c ? $ : t.task.color || "#3b82f6";
|
|
1660
1669
|
a.push(`<polygon points="${e},${n - o} ${e + o},${n} ${e},${n + o} ${e - o},${n}" fill="${s}"/>`);
|
|
1661
1670
|
} else if (t.isSummary) {
|
|
1662
1671
|
let n = t.task.color || "#64748b";
|
|
1663
|
-
a.push(`<rect x="${i.toFixed(1)}" y="${(r +
|
|
1672
|
+
a.push(`<rect x="${i.toFixed(1)}" y="${(r + ci).toFixed(1)}" width="${s.toFixed(1)}" height="${si}" rx="3" fill="${n}"${l}/>`);
|
|
1664
1673
|
let c = s * Math.min(100, Math.max(0, t.progress)) / 100;
|
|
1665
|
-
a.push(`<rect x="${i.toFixed(1)}" y="${(r +
|
|
1674
|
+
a.push(`<rect x="${i.toFixed(1)}" y="${(r + ci).toFixed(1)}" width="${c.toFixed(1)}" height="${si}" rx="3" fill="rgba(0,0,0,0.2)"/>`);
|
|
1666
1675
|
let u = o(t.task.title, s);
|
|
1667
1676
|
u && a.push(`<text x="${(i + 6).toFixed(1)}" y="${(r + B / 2 + 3).toFixed(1)}" fill="#ffffff" font-weight="500">${e(u)}</text>`);
|
|
1668
1677
|
} else {
|
|
1669
1678
|
let n = t.task.color || "#3b82f6";
|
|
1670
|
-
a.push(`<rect x="${i.toFixed(1)}" y="${(r +
|
|
1679
|
+
a.push(`<rect x="${i.toFixed(1)}" y="${(r + ni).toFixed(1)}" width="${s.toFixed(1)}" height="${ri}" rx="3" fill="${n}"${l}/>`);
|
|
1671
1680
|
let c = s * Math.min(100, Math.max(0, t.progress)) / 100;
|
|
1672
|
-
a.push(`<rect x="${i.toFixed(1)}" y="${(r +
|
|
1681
|
+
a.push(`<rect x="${i.toFixed(1)}" y="${(r + ni).toFixed(1)}" width="${c.toFixed(1)}" height="${ri}" rx="3" fill="rgba(0,0,0,0.18)"/>`);
|
|
1673
1682
|
let u = o(t.task.title, s);
|
|
1674
1683
|
u ? a.push(`<text x="${(i + 6).toFixed(1)}" y="${(r + B / 2 + 3).toFixed(1)}" fill="#ffffff" font-weight="500">${e(u)}</text>`) : s >= 24 && a.push(`<text x="${(i + s / 2).toFixed(1)}" y="${(r + B / 2 + 3).toFixed(1)}" text-anchor="middle" fill="#ffffff">${Math.round(t.progress)}%</text>`);
|
|
1675
1684
|
}
|
|
1676
|
-
}),
|
|
1677
|
-
let t =
|
|
1685
|
+
}), ti.forEach((e) => {
|
|
1686
|
+
let t = pi(e);
|
|
1678
1687
|
if (!t) return;
|
|
1679
1688
|
let n = i?.has(`${String(e.sourceId)}->${String(e.targetId)}`) ?? !1, r = n ? $ : "#94a3b8";
|
|
1680
1689
|
a.push(`<path d="${t}" fill="none" stroke="${r}" stroke-width="${n ? 2 : 1.5}"/>`);
|
|
1681
|
-
}),
|
|
1690
|
+
}), Or != null && a.push(`<line x1="${Or.toFixed(1)}" y1="0" x2="${Or.toFixed(1)}" y2="${K.length * B}" stroke="#ef4444" stroke-width="1.5"/>`);
|
|
1682
1691
|
let s = K.length * B;
|
|
1683
|
-
return
|
|
1692
|
+
return ir.forEach((t) => {
|
|
1684
1693
|
let n = /var\(/.test(t.color) ? "#6366f1" : t.color;
|
|
1685
1694
|
if (a.push(`<line x1="${t.left.toFixed(1)}" y1="0" x2="${t.left.toFixed(1)}" y2="${s}" stroke="${e(n)}" stroke-width="1.5"/>`), t.label) {
|
|
1686
1695
|
let r = t.label.length * 6 + 8;
|
|
@@ -1692,74 +1701,74 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1692
1701
|
H: r
|
|
1693
1702
|
};
|
|
1694
1703
|
}, [
|
|
1695
|
-
|
|
1704
|
+
S,
|
|
1696
1705
|
K,
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1706
|
+
ti,
|
|
1707
|
+
pi,
|
|
1708
|
+
Xr,
|
|
1709
|
+
vi,
|
|
1710
|
+
_i,
|
|
1702
1711
|
J,
|
|
1703
1712
|
Y,
|
|
1704
|
-
|
|
1713
|
+
Xn,
|
|
1705
1714
|
H,
|
|
1706
1715
|
B,
|
|
1707
|
-
|
|
1708
|
-
ti,
|
|
1709
|
-
oi,
|
|
1710
|
-
ai,
|
|
1716
|
+
ni,
|
|
1711
1717
|
ri,
|
|
1712
|
-
Er,
|
|
1713
|
-
V,
|
|
1714
|
-
ne,
|
|
1715
1718
|
ci,
|
|
1716
1719
|
si,
|
|
1717
|
-
|
|
1720
|
+
ai,
|
|
1721
|
+
Or,
|
|
1722
|
+
V,
|
|
1723
|
+
re,
|
|
1718
1724
|
ui,
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1725
|
+
li,
|
|
1726
|
+
di,
|
|
1727
|
+
fi,
|
|
1728
|
+
ir,
|
|
1729
|
+
rr
|
|
1730
|
+
]), Ei = e.useCallback(() => {
|
|
1731
|
+
let e = (_e ?? "").replace(/[\\/:*?"<>|\s]+/g, " ").trim() || "gantt", t = /* @__PURE__ */ new Date(), n = (e) => String(e).padStart(2, "0");
|
|
1723
1732
|
return `${e}-${`${t.getFullYear()}${n(t.getMonth() + 1)}${n(t.getDate())}-${n(t.getHours())}${n(t.getMinutes())}`}`;
|
|
1724
|
-
}, [
|
|
1725
|
-
let e =
|
|
1733
|
+
}, [_e]), Di = e.useCallback(async () => {
|
|
1734
|
+
let e = Ti();
|
|
1726
1735
|
if (!e) return;
|
|
1727
|
-
let t = await
|
|
1736
|
+
let t = await ut(e.svg, e.W, e.H);
|
|
1728
1737
|
t && t.toBlob((e) => {
|
|
1729
|
-
e &&
|
|
1738
|
+
e && dt(e, `${Ei()}.png`);
|
|
1730
1739
|
}, "image/png");
|
|
1731
|
-
}, [
|
|
1732
|
-
let e =
|
|
1740
|
+
}, [Ti, Ei]), Oi = e.useCallback(async () => {
|
|
1741
|
+
let e = Ti();
|
|
1733
1742
|
if (!e) return;
|
|
1734
|
-
let t = await
|
|
1735
|
-
t &&
|
|
1736
|
-
}, [
|
|
1743
|
+
let t = await ut(e.svg, e.W, e.H);
|
|
1744
|
+
t && dt(ft(pt(t.toDataURL("image/jpeg", .92)), t.width, t.height), `${Ei()}.pdf`);
|
|
1745
|
+
}, [Ti, Ei]), [ki, Ai] = e.useState(!1), ji = e.useCallback(() => {
|
|
1737
1746
|
let e = {
|
|
1738
1747
|
viewMode: V,
|
|
1739
|
-
columnWidth:
|
|
1740
|
-
taskListCollapsed:
|
|
1741
|
-
taskListWidth:
|
|
1742
|
-
collapsedIds: Array.from(
|
|
1748
|
+
columnWidth: Ct,
|
|
1749
|
+
taskListCollapsed: jt,
|
|
1750
|
+
taskListWidth: Tt,
|
|
1751
|
+
collapsedIds: Array.from(Hn)
|
|
1743
1752
|
};
|
|
1744
|
-
|
|
1753
|
+
ue && gt(ue, e), de?.(e), Ai(!0);
|
|
1745
1754
|
}, [
|
|
1746
1755
|
V,
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1756
|
+
Ct,
|
|
1757
|
+
jt,
|
|
1758
|
+
Tt,
|
|
1759
|
+
Hn,
|
|
1760
|
+
ue,
|
|
1761
|
+
de
|
|
1753
1762
|
]);
|
|
1754
1763
|
return e.useEffect(() => {
|
|
1755
|
-
if (!
|
|
1756
|
-
let e = setTimeout(() =>
|
|
1764
|
+
if (!ki) return;
|
|
1765
|
+
let e = setTimeout(() => Ai(!1), 1500);
|
|
1757
1766
|
return () => clearTimeout(e);
|
|
1758
|
-
}, [
|
|
1759
|
-
ref:
|
|
1760
|
-
className:
|
|
1767
|
+
}, [ki]), /* @__PURE__ */ A("div", {
|
|
1768
|
+
ref: I,
|
|
1769
|
+
className: pe("flex flex-col h-full bg-background overflow-hidden min-w-0", m),
|
|
1761
1770
|
"data-readonly": L ? "true" : void 0,
|
|
1762
|
-
"data-mobile-readonly":
|
|
1771
|
+
"data-mobile-readonly": ae && ze ? "true" : void 0,
|
|
1763
1772
|
children: [
|
|
1764
1773
|
/* @__PURE__ */ k("style", { children: "\n .gantt-resize-handle:hover { background-color: rgba(255, 255, 255, 0.4); }\n .gantt-bar-hover:hover { filter: brightness(1.1); }\n .gantt-row-open-btn { opacity: 0; transition: opacity 0.15s ease; }\n /* :where keeps the row-hover reveal at zero specificity so the\n button's own :hover/:focus-visible full-opacity rule can win. */\n :where(.group\\/task-row:hover) .gantt-row-open-btn { opacity: 0.6; }\n .gantt-row-open-btn:hover, .gantt-row-open-btn:focus-visible { opacity: 1; }\n /* 定位闪烁: blink the located bar 3× with a thick ring + colored glow so\n it's hard to miss. The ring is an outline (not box-shadow) and the glow\n is a drop-shadow *filter* — both stay clear of the critical-path bar's\n inline box-shadow, which they'd otherwise clobber. */\n @keyframes gantt-flash {\n 0%, 25%, 50%, 100% {\n outline-color: rgba(37, 99, 235, 0);\n filter: drop-shadow(0 0 0 rgba(37, 99, 235, 0));\n }\n 12%, 37%, 62% {\n outline-color: rgba(37, 99, 235, 1);\n filter: drop-shadow(0 0 9px rgba(37, 99, 235, 0.9));\n }\n }\n .gantt-flash {\n outline: 3px solid transparent;\n outline-offset: 3px;\n border-radius: 2px;\n animation: gantt-flash 1.5s ease-in-out;\n }\n @media (min-width: 640px) {\n .gantt-sm-h50 { height: 50px; }\n .gantt-sm-w20 { width: 80px; }\n .gantt-sm-hidden { display: none; }\n }\n /* The timeline's NATIVE scrollbars are fully hidden — both axes are\n replaced by the self-drawn bars (水平底部 / 垂直右侧). Styling the\n native bar is a dead end: overlay-scrollbar engines (macOS \"show\n while scrolling\", embedded Chromium) ignore ::-webkit-scrollbar\n theming yet still flash their own auto-hiding bar on scroll, which\n doubled up with the self-drawn one (双滚动条). scrollbar-width:none\n is honored by overlay engines too; the ::-webkit rule covers older\n WebKit. Wheel/trackpad/programmatic scrolling is unaffected. */\n [data-testid=\"gantt-timeline\"] { scrollbar-width: none; }\n [data-testid=\"gantt-timeline\"]::-webkit-scrollbar { display: none; width: 0; height: 0; }\n /* The task-list pane scrolls in lockstep with the timeline, so its own\n vertical scrollbar (butted against the divider) was a confusing second\n bar. Hide it — the pane stays wheel/drag-scrollable and synced. */\n .gantt-task-list::-webkit-scrollbar { width: 0; height: 0; }\n .gantt-task-list { scrollbar-width: none; }\n " }),
|
|
1765
1774
|
/* @__PURE__ */ A("div", {
|
|
@@ -1772,14 +1781,14 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1772
1781
|
size: "icon",
|
|
1773
1782
|
className: "h-8 w-8",
|
|
1774
1783
|
"aria-label": P("gantt.toolbar.prevPeriod"),
|
|
1775
|
-
children: /* @__PURE__ */ k(
|
|
1784
|
+
children: /* @__PURE__ */ k(Ce, { className: "h-4 w-4" })
|
|
1776
1785
|
}),
|
|
1777
1786
|
/* @__PURE__ */ k(y, {
|
|
1778
1787
|
variant: "ghost",
|
|
1779
1788
|
size: "icon",
|
|
1780
1789
|
className: "h-8 w-8",
|
|
1781
1790
|
"aria-label": P("gantt.toolbar.nextPeriod"),
|
|
1782
|
-
children: /* @__PURE__ */ k(
|
|
1791
|
+
children: /* @__PURE__ */ k(we, { className: "h-4 w-4" })
|
|
1783
1792
|
}),
|
|
1784
1793
|
/* @__PURE__ */ k("span", {
|
|
1785
1794
|
className: "font-semibold text-xs sm:text-sm",
|
|
@@ -1792,7 +1801,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1792
1801
|
className: "inline-flex items-center gap-1 rounded-full border bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",
|
|
1793
1802
|
"data-testid": "gantt-readonly-badge",
|
|
1794
1803
|
title: P("gantt.readOnlyHint"),
|
|
1795
|
-
children: [/* @__PURE__ */ k(
|
|
1804
|
+
children: [/* @__PURE__ */ k(Ee, { className: "h-3 w-3" }), P("gantt.readOnly")]
|
|
1796
1805
|
})
|
|
1797
1806
|
]
|
|
1798
1807
|
}), /* @__PURE__ */ A("div", {
|
|
@@ -1802,11 +1811,11 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1802
1811
|
className: "flex bg-muted rounded-md p-1",
|
|
1803
1812
|
role: "group",
|
|
1804
1813
|
"aria-label": P("gantt.toolbar.viewMode"),
|
|
1805
|
-
children:
|
|
1814
|
+
children: nt.map((e) => /* @__PURE__ */ k(y, {
|
|
1806
1815
|
variant: "ghost",
|
|
1807
1816
|
size: "sm",
|
|
1808
|
-
className:
|
|
1809
|
-
onClick: () =>
|
|
1817
|
+
className: pe("h-6 px-1.5 sm:px-2 text-xs", V === e && "bg-background shadow-sm hover:bg-background"),
|
|
1818
|
+
onClick: () => er(e),
|
|
1810
1819
|
"aria-pressed": V === e,
|
|
1811
1820
|
"data-testid": `gantt-view-mode-${e}`,
|
|
1812
1821
|
children: P(`gantt.viewMode.${e}`)
|
|
@@ -1819,23 +1828,23 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1819
1828
|
size: "icon",
|
|
1820
1829
|
className: "h-6 w-6",
|
|
1821
1830
|
onClick: () => {
|
|
1822
|
-
if (
|
|
1831
|
+
if (It > 15) wt(Math.max(15, It - 10));
|
|
1823
1832
|
else {
|
|
1824
|
-
let e =
|
|
1825
|
-
e <
|
|
1833
|
+
let e = nt.indexOf(V);
|
|
1834
|
+
e < nt.length - 1 && (er(nt[e + 1]), wt(bt));
|
|
1826
1835
|
}
|
|
1827
1836
|
},
|
|
1828
1837
|
"aria-label": P("gantt.toolbar.zoomOut"),
|
|
1829
|
-
children: /* @__PURE__ */ k(
|
|
1838
|
+
children: /* @__PURE__ */ k(Me, { className: "h-3 w-3" })
|
|
1830
1839
|
}), /* @__PURE__ */ k(y, {
|
|
1831
1840
|
variant: "ghost",
|
|
1832
1841
|
size: "icon",
|
|
1833
1842
|
className: "h-6 w-6",
|
|
1834
1843
|
onClick: () => {
|
|
1835
|
-
if (
|
|
1844
|
+
if (It < 120) wt(Math.min(120, It + 10));
|
|
1836
1845
|
else {
|
|
1837
|
-
let e =
|
|
1838
|
-
e > 0 && (
|
|
1846
|
+
let e = nt.indexOf(V);
|
|
1847
|
+
e > 0 && (er(nt[e - 1]), wt(bt));
|
|
1839
1848
|
}
|
|
1840
1849
|
},
|
|
1841
1850
|
"aria-label": P("gantt.toolbar.zoomIn"),
|
|
@@ -1846,18 +1855,18 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1846
1855
|
variant: "ghost",
|
|
1847
1856
|
size: "icon",
|
|
1848
1857
|
className: "h-8 w-8",
|
|
1849
|
-
onClick: () =>
|
|
1850
|
-
"aria-label": P(
|
|
1851
|
-
"aria-pressed":
|
|
1858
|
+
onClick: () => Mt((e) => !e),
|
|
1859
|
+
"aria-label": P(jt ? "gantt.toolbar.showTaskList" : "gantt.toolbar.hideTaskList"),
|
|
1860
|
+
"aria-pressed": jt,
|
|
1852
1861
|
"data-testid": "gantt-toggle-task-list",
|
|
1853
|
-
children: k(
|
|
1862
|
+
children: k(jt ? Oe : ke, { className: "h-4 w-4" })
|
|
1854
1863
|
}),
|
|
1855
1864
|
/* @__PURE__ */ k(y, {
|
|
1856
1865
|
variant: "ghost",
|
|
1857
1866
|
size: "sm",
|
|
1858
1867
|
className: "h-8 px-2 text-xs",
|
|
1859
|
-
onClick:
|
|
1860
|
-
disabled:
|
|
1868
|
+
onClick: kr,
|
|
1869
|
+
disabled: Or == null,
|
|
1861
1870
|
"aria-label": P("gantt.toolbar.jumpToToday"),
|
|
1862
1871
|
"data-testid": "gantt-jump-today",
|
|
1863
1872
|
children: P("gantt.toolbar.today")
|
|
@@ -1866,7 +1875,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1866
1875
|
variant: "ghost",
|
|
1867
1876
|
size: "sm",
|
|
1868
1877
|
className: "h-8 px-2 text-xs",
|
|
1869
|
-
onClick:
|
|
1878
|
+
onClick: Nr,
|
|
1870
1879
|
"aria-label": P("gantt.toolbar.thisWeek"),
|
|
1871
1880
|
"data-testid": "gantt-jump-week",
|
|
1872
1881
|
children: P("gantt.toolbar.thisWeek")
|
|
@@ -1875,7 +1884,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1875
1884
|
variant: "ghost",
|
|
1876
1885
|
size: "sm",
|
|
1877
1886
|
className: "h-8 px-2 text-xs",
|
|
1878
|
-
onClick:
|
|
1887
|
+
onClick: Pr,
|
|
1879
1888
|
"aria-label": P("gantt.toolbar.thisMonth"),
|
|
1880
1889
|
"data-testid": "gantt-jump-month",
|
|
1881
1890
|
children: P("gantt.toolbar.thisMonth")
|
|
@@ -1885,27 +1894,27 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1885
1894
|
size: "icon",
|
|
1886
1895
|
className: "h-8 w-8",
|
|
1887
1896
|
onClick: () => void fe(),
|
|
1888
|
-
disabled:
|
|
1897
|
+
disabled: me,
|
|
1889
1898
|
"aria-label": P("gantt.toolbar.refresh"),
|
|
1890
|
-
"aria-busy":
|
|
1899
|
+
"aria-busy": me,
|
|
1891
1900
|
"data-testid": "gantt-refresh",
|
|
1892
1901
|
children: /* @__PURE__ */ k(E, { className: "h-4 w-4" })
|
|
1893
1902
|
}) : null,
|
|
1894
|
-
R ? /* @__PURE__ */ A(
|
|
1903
|
+
R ? /* @__PURE__ */ A(Ne, { children: [/* @__PURE__ */ k(y, {
|
|
1895
1904
|
variant: "ghost",
|
|
1896
1905
|
size: "icon",
|
|
1897
1906
|
className: "h-8 w-8",
|
|
1898
|
-
onClick:
|
|
1899
|
-
disabled: !
|
|
1907
|
+
onClick: fn,
|
|
1908
|
+
disabled: !mn,
|
|
1900
1909
|
"aria-label": P("gantt.toolbar.undo"),
|
|
1901
1910
|
"data-testid": "gantt-undo",
|
|
1902
|
-
children: /* @__PURE__ */ k(
|
|
1911
|
+
children: /* @__PURE__ */ k(je, { className: "h-4 w-4" })
|
|
1903
1912
|
}), /* @__PURE__ */ k(y, {
|
|
1904
1913
|
variant: "ghost",
|
|
1905
1914
|
size: "icon",
|
|
1906
1915
|
className: "h-8 w-8",
|
|
1907
|
-
onClick:
|
|
1908
|
-
disabled: !
|
|
1916
|
+
onClick: pn,
|
|
1917
|
+
disabled: !hn,
|
|
1909
1918
|
"aria-label": P("gantt.toolbar.redo"),
|
|
1910
1919
|
"data-testid": "gantt-redo",
|
|
1911
1920
|
children: /* @__PURE__ */ k(T, { className: "h-4 w-4" })
|
|
@@ -1914,18 +1923,18 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1914
1923
|
variant: "ghost",
|
|
1915
1924
|
size: "icon",
|
|
1916
1925
|
className: "h-8 w-8",
|
|
1917
|
-
onClick: () =>
|
|
1926
|
+
onClick: () => gi((e) => !e),
|
|
1918
1927
|
"aria-label": P("gantt.toolbar.criticalPath"),
|
|
1919
|
-
"aria-pressed":
|
|
1928
|
+
"aria-pressed": hi,
|
|
1920
1929
|
"data-testid": "gantt-critical-path",
|
|
1921
|
-
style:
|
|
1922
|
-
children: /* @__PURE__ */ k(
|
|
1930
|
+
style: hi ? { color: $ } : void 0,
|
|
1931
|
+
children: /* @__PURE__ */ k(be, { className: "h-4 w-4" })
|
|
1923
1932
|
}),
|
|
1924
|
-
|
|
1933
|
+
vt && R ? /* @__PURE__ */ k(y, {
|
|
1925
1934
|
variant: "ghost",
|
|
1926
1935
|
size: "icon",
|
|
1927
1936
|
className: "h-8 w-8",
|
|
1928
|
-
onClick:
|
|
1937
|
+
onClick: Ci,
|
|
1929
1938
|
"aria-label": P("gantt.toolbar.autoSchedule"),
|
|
1930
1939
|
"data-testid": "gantt-auto-schedule",
|
|
1931
1940
|
children: /* @__PURE__ */ k(D, { className: "h-4 w-4" })
|
|
@@ -1934,40 +1943,40 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1934
1943
|
variant: "ghost",
|
|
1935
1944
|
size: "icon",
|
|
1936
1945
|
className: "h-8 w-8",
|
|
1937
|
-
onClick:
|
|
1946
|
+
onClick: Di,
|
|
1938
1947
|
"aria-label": P("gantt.toolbar.exportPng"),
|
|
1939
1948
|
"data-testid": "gantt-export-png",
|
|
1940
|
-
children: /* @__PURE__ */ k(
|
|
1949
|
+
children: /* @__PURE__ */ k(C, { className: "h-4 w-4" })
|
|
1941
1950
|
}),
|
|
1942
1951
|
/* @__PURE__ */ k(y, {
|
|
1943
1952
|
variant: "ghost",
|
|
1944
1953
|
size: "icon",
|
|
1945
1954
|
className: "h-8 w-8",
|
|
1946
|
-
onClick:
|
|
1955
|
+
onClick: Oi,
|
|
1947
1956
|
"aria-label": P("gantt.toolbar.exportPdf"),
|
|
1948
1957
|
"data-testid": "gantt-export-pdf",
|
|
1949
|
-
children: /* @__PURE__ */ k(
|
|
1958
|
+
children: /* @__PURE__ */ k(Te, { className: "h-4 w-4" })
|
|
1950
1959
|
}),
|
|
1951
|
-
|
|
1960
|
+
de || ue ? /* @__PURE__ */ k(y, {
|
|
1952
1961
|
variant: "ghost",
|
|
1953
1962
|
size: "icon",
|
|
1954
1963
|
className: "h-8 w-8",
|
|
1955
|
-
onClick:
|
|
1964
|
+
onClick: ji,
|
|
1956
1965
|
"aria-label": P("gantt.toolbar.saveLayout"),
|
|
1957
|
-
"aria-pressed":
|
|
1966
|
+
"aria-pressed": ki,
|
|
1958
1967
|
"data-testid": "gantt-save-layout",
|
|
1959
|
-
style:
|
|
1960
|
-
children: /* @__PURE__ */ k(
|
|
1968
|
+
style: ki ? { color: $ } : void 0,
|
|
1969
|
+
children: /* @__PURE__ */ k(Ae, { className: "h-4 w-4" })
|
|
1961
1970
|
}) : null,
|
|
1962
1971
|
/* @__PURE__ */ k(y, {
|
|
1963
1972
|
variant: "ghost",
|
|
1964
1973
|
size: "icon",
|
|
1965
1974
|
className: "h-8 w-8",
|
|
1966
|
-
onClick:
|
|
1967
|
-
"aria-label": P(
|
|
1968
|
-
"aria-pressed":
|
|
1975
|
+
onClick: Cr,
|
|
1976
|
+
"aria-label": P(xr ? "gantt.toolbar.exitFullscreen" : "gantt.toolbar.enterFullscreen"),
|
|
1977
|
+
"aria-pressed": xr,
|
|
1969
1978
|
"data-testid": "gantt-fullscreen",
|
|
1970
|
-
children: k(
|
|
1979
|
+
children: k(xr ? w : De, { className: "h-4 w-4" })
|
|
1971
1980
|
})
|
|
1972
1981
|
]
|
|
1973
1982
|
})]
|
|
@@ -1975,10 +1984,10 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1975
1984
|
/* @__PURE__ */ A("div", {
|
|
1976
1985
|
className: "relative flex flex-col flex-1 overflow-hidden outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
1977
1986
|
tabIndex: 0,
|
|
1978
|
-
onKeyDown:
|
|
1987
|
+
onKeyDown: Kn,
|
|
1979
1988
|
"data-testid": "gantt-body",
|
|
1980
1989
|
children: [
|
|
1981
|
-
!
|
|
1990
|
+
!jt && H > 0 && /* @__PURE__ */ k("div", {
|
|
1982
1991
|
className: "absolute top-0 bottom-0 z-30 group/splitter",
|
|
1983
1992
|
style: {
|
|
1984
1993
|
left: H - 3,
|
|
@@ -1991,15 +2000,15 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
1991
2000
|
onPointerDown: (e) => {
|
|
1992
2001
|
if (e.button !== 0) return;
|
|
1993
2002
|
e.preventDefault();
|
|
1994
|
-
let t = e.clientX, n = H, r = Math.max(160,
|
|
2003
|
+
let t = e.clientX, n = H, r = Math.max(160, Re - 200), i = (e) => {
|
|
1995
2004
|
let i = Math.max(160, Math.min(n + (e.clientX - t), r));
|
|
1996
|
-
|
|
2005
|
+
Et(i);
|
|
1997
2006
|
}, a = () => {
|
|
1998
2007
|
window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a), window.removeEventListener("pointercancel", a), document.body.style.cursor = "";
|
|
1999
2008
|
};
|
|
2000
2009
|
document.body.style.cursor = "col-resize", window.addEventListener("pointermove", i), window.addEventListener("pointerup", a), window.addEventListener("pointercancel", a);
|
|
2001
2010
|
},
|
|
2002
|
-
onDoubleClick: () =>
|
|
2011
|
+
onDoubleClick: () => Et(null),
|
|
2003
2012
|
children: /* @__PURE__ */ k("div", { className: "absolute inset-y-0 left-1/2 -translate-x-1/2 w-px bg-border group-hover/splitter:w-[3px] group-hover/splitter:bg-primary transition-all" })
|
|
2004
2013
|
}),
|
|
2005
2014
|
/* @__PURE__ */ A("div", {
|
|
@@ -2015,7 +2024,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2015
2024
|
className: "flex-1 truncate",
|
|
2016
2025
|
children: P("gantt.column.taskName")
|
|
2017
2026
|
}),
|
|
2018
|
-
|
|
2027
|
+
Rt && /* @__PURE__ */ A(Ne, { children: [/* @__PURE__ */ k("div", {
|
|
2019
2028
|
className: "w-16 gantt-sm-w20 text-right",
|
|
2020
2029
|
children: P("gantt.column.start")
|
|
2021
2030
|
}), /* @__PURE__ */ k("div", {
|
|
@@ -2031,15 +2040,15 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2031
2040
|
]
|
|
2032
2041
|
}), /* @__PURE__ */ k("div", {
|
|
2033
2042
|
className: "flex-1 overflow-hidden",
|
|
2034
|
-
ref:
|
|
2043
|
+
ref: ar,
|
|
2035
2044
|
children: /* @__PURE__ */ A("div", {
|
|
2036
2045
|
className: "flex flex-col h-full",
|
|
2037
|
-
style: { width:
|
|
2046
|
+
style: { width: Xn },
|
|
2038
2047
|
children: [/* @__PURE__ */ k("div", {
|
|
2039
2048
|
className: "relative border-b",
|
|
2040
2049
|
style: { height: "45%" },
|
|
2041
2050
|
"data-testid": "gantt-header-groups",
|
|
2042
|
-
children:
|
|
2051
|
+
children: rr.slice(yr.start, yr.end).map((e) => /* @__PURE__ */ k("div", {
|
|
2043
2052
|
className: "absolute top-0 bottom-0 flex items-center justify-center border-r text-[10px] font-medium text-muted-foreground overflow-hidden",
|
|
2044
2053
|
style: {
|
|
2045
2054
|
left: e.offset,
|
|
@@ -2053,10 +2062,10 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2053
2062
|
}), /* @__PURE__ */ k("div", {
|
|
2054
2063
|
className: "relative flex-1",
|
|
2055
2064
|
"data-testid": "gantt-header-units",
|
|
2056
|
-
children: J.slice(
|
|
2057
|
-
let n =
|
|
2065
|
+
children: J.slice(_r.start, _r.end).map((e, t) => {
|
|
2066
|
+
let n = _r.start + t;
|
|
2058
2067
|
return /* @__PURE__ */ A("div", {
|
|
2059
|
-
className:
|
|
2068
|
+
className: pe("absolute top-0 bottom-0 flex items-center justify-center gap-1 border-r text-xs text-muted-foreground overflow-hidden", e.isWeekend && "bg-muted/50"),
|
|
2060
2069
|
style: {
|
|
2061
2070
|
left: Y[n],
|
|
2062
2071
|
width: e.width,
|
|
@@ -2065,7 +2074,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2065
2074
|
children: [/* @__PURE__ */ k("span", {
|
|
2066
2075
|
className: "font-medium text-foreground truncate",
|
|
2067
2076
|
children: e.label
|
|
2068
|
-
}), e.sublabel &&
|
|
2077
|
+
}), e.sublabel && It >= 32 && /* @__PURE__ */ k("span", {
|
|
2069
2078
|
className: "text-[10px] opacity-70",
|
|
2070
2079
|
children: e.sublabel
|
|
2071
2080
|
})]
|
|
@@ -2080,8 +2089,8 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2080
2089
|
children: [
|
|
2081
2090
|
/* @__PURE__ */ A("div", {
|
|
2082
2091
|
className: "gantt-task-list overflow-y-auto overflow-x-hidden border-r bg-card z-10 shadow-sm",
|
|
2083
|
-
ref:
|
|
2084
|
-
onScroll:
|
|
2092
|
+
ref: or,
|
|
2093
|
+
onScroll: Yr,
|
|
2085
2094
|
style: {
|
|
2086
2095
|
width: H,
|
|
2087
2096
|
minWidth: H
|
|
@@ -2094,9 +2103,9 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2094
2103
|
"aria-hidden": "true"
|
|
2095
2104
|
}),
|
|
2096
2105
|
K.slice(Q.startIdx, Q.endIdx).map((e) => {
|
|
2097
|
-
let t = e.task, n =
|
|
2106
|
+
let t = e.task, n = _t && zt === t.id, r = Hn.has(String(t.id)), i = Ln != null && String(Ln) === String(t.id);
|
|
2098
2107
|
return /* @__PURE__ */ A("div", {
|
|
2099
|
-
className:
|
|
2108
|
+
className: pe("group/task-row relative flex items-center border-b px-2 sm:px-4 hover:bg-accent/50 cursor-pointer transition-colors", i && "bg-accent/50"),
|
|
2100
2109
|
style: {
|
|
2101
2110
|
height: B,
|
|
2102
2111
|
touchAction: "manipulation"
|
|
@@ -2106,26 +2115,26 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2106
2115
|
"aria-level": e.depth + 1,
|
|
2107
2116
|
"aria-selected": i,
|
|
2108
2117
|
"aria-expanded": e.hasChildren ? !r : void 0,
|
|
2109
|
-
draggable: !!
|
|
2110
|
-
onDragStart:
|
|
2118
|
+
draggable: !!mt && !n && !t.locked,
|
|
2119
|
+
onDragStart: mt ? (e) => {
|
|
2111
2120
|
e.dataTransfer.setData("text/plain", String(t.id)), e.dataTransfer.effectAllowed = "move";
|
|
2112
2121
|
} : void 0,
|
|
2113
|
-
onDragOver:
|
|
2122
|
+
onDragOver: mt ? (e) => {
|
|
2114
2123
|
e.preventDefault(), e.dataTransfer.dropEffect = "move";
|
|
2115
2124
|
} : void 0,
|
|
2116
|
-
onDrop:
|
|
2125
|
+
onDrop: mt ? (e) => {
|
|
2117
2126
|
e.preventDefault();
|
|
2118
2127
|
let n = e.dataTransfer.getData("text/plain");
|
|
2119
2128
|
if (!n || n === String(t.id)) return;
|
|
2120
|
-
let r =
|
|
2121
|
-
r && String(r.parent ?? "") === String(t.parent ?? "") &&
|
|
2129
|
+
let r = Kt.get(n);
|
|
2130
|
+
r && String(r.parent ?? "") === String(t.parent ?? "") && mt(r, t);
|
|
2122
2131
|
} : void 0,
|
|
2123
|
-
onContextMenu: (e) =>
|
|
2132
|
+
onContextMenu: (e) => Bn(t, e),
|
|
2124
2133
|
onClick: () => {
|
|
2125
|
-
|
|
2134
|
+
Rn(t.id), n || Mr(e.start, e.end, t.id);
|
|
2126
2135
|
},
|
|
2127
2136
|
onDoubleClick: () => {
|
|
2128
|
-
n || (
|
|
2137
|
+
n || (_t && R && !e.isSummary && !t.locked ? (Bt(t.id), Ht({
|
|
2129
2138
|
title: t.title,
|
|
2130
2139
|
start: t.start.toLocaleDateString("en-CA"),
|
|
2131
2140
|
end: t.end.toLocaleDateString("en-CA"),
|
|
@@ -2142,12 +2151,12 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2142
2151
|
className: "h-4 w-4 shrink-0 flex items-center justify-center text-muted-foreground hover:text-foreground",
|
|
2143
2152
|
style: { marginLeft: -4 },
|
|
2144
2153
|
onClick: (e) => {
|
|
2145
|
-
e.stopPropagation(),
|
|
2154
|
+
e.stopPropagation(), Wn(t.id);
|
|
2146
2155
|
},
|
|
2147
2156
|
"aria-expanded": !r,
|
|
2148
2157
|
"aria-label": P(r ? "gantt.row.expand" : "gantt.row.collapse"),
|
|
2149
2158
|
"data-testid": `gantt-row-toggle-${t.id}`,
|
|
2150
|
-
children: k(r ?
|
|
2159
|
+
children: k(r ? we : Se, { className: "h-3.5 w-3.5" })
|
|
2151
2160
|
}) : /* @__PURE__ */ k("span", {
|
|
2152
2161
|
className: "w-3 shrink-0",
|
|
2153
2162
|
style: { marginLeft: -4 },
|
|
@@ -2159,28 +2168,28 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2159
2168
|
}),
|
|
2160
2169
|
n ? /* @__PURE__ */ k("input", {
|
|
2161
2170
|
className: "border rounded px-1 py-0.5 text-xs w-full bg-background",
|
|
2162
|
-
value:
|
|
2163
|
-
onChange: (e) =>
|
|
2171
|
+
value: Vt.title || "",
|
|
2172
|
+
onChange: (e) => Ht((t) => ({
|
|
2164
2173
|
...t,
|
|
2165
2174
|
title: e.target.value
|
|
2166
2175
|
})),
|
|
2167
2176
|
onKeyDown: (e) => {
|
|
2168
|
-
e.key === "Enter" ? (
|
|
2177
|
+
e.key === "Enter" ? (rn([{
|
|
2169
2178
|
task: t,
|
|
2170
2179
|
changes: {
|
|
2171
|
-
title:
|
|
2172
|
-
start: new Date(
|
|
2173
|
-
end: new Date(
|
|
2174
|
-
progress: Number(
|
|
2180
|
+
title: Vt.title,
|
|
2181
|
+
start: new Date(Vt.start),
|
|
2182
|
+
end: new Date(Vt.end),
|
|
2183
|
+
progress: Number(Vt.progress) || 0
|
|
2175
2184
|
}
|
|
2176
|
-
}]),
|
|
2185
|
+
}]), Bt(null)) : e.key === "Escape" && Bt(null);
|
|
2177
2186
|
},
|
|
2178
2187
|
onClick: (e) => e.stopPropagation(),
|
|
2179
2188
|
autoFocus: !0
|
|
2180
2189
|
}) : /* @__PURE__ */ A("span", {
|
|
2181
2190
|
className: "flex flex-col min-w-0",
|
|
2182
2191
|
children: [/* @__PURE__ */ k("span", {
|
|
2183
|
-
className:
|
|
2192
|
+
className: pe("truncate", e.isSummary && "font-semibold"),
|
|
2184
2193
|
children: t.title
|
|
2185
2194
|
}), /* @__PURE__ */ A("span", {
|
|
2186
2195
|
className: "text-[10px] text-muted-foreground gantt-sm-hidden",
|
|
@@ -2201,13 +2210,13 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2201
2210
|
}),
|
|
2202
2211
|
/* @__PURE__ */ k("div", {
|
|
2203
2212
|
className: "w-16 gantt-sm-w20 text-right text-xs text-muted-foreground hidden sm:block",
|
|
2204
|
-
hidden: !
|
|
2205
|
-
style:
|
|
2213
|
+
hidden: !Rt,
|
|
2214
|
+
style: Rt ? void 0 : { display: "none" },
|
|
2206
2215
|
children: n ? /* @__PURE__ */ k("input", {
|
|
2207
2216
|
type: "date",
|
|
2208
2217
|
className: "border rounded px-1 py-0.5 text-xs w-full bg-background",
|
|
2209
|
-
value:
|
|
2210
|
-
onChange: (e) =>
|
|
2218
|
+
value: Vt.start || "",
|
|
2219
|
+
onChange: (e) => Ht((t) => ({
|
|
2211
2220
|
...t,
|
|
2212
2221
|
start: e.target.value
|
|
2213
2222
|
})),
|
|
@@ -2219,13 +2228,13 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2219
2228
|
}),
|
|
2220
2229
|
/* @__PURE__ */ k("div", {
|
|
2221
2230
|
className: "w-16 gantt-sm-w20 text-right text-xs text-muted-foreground hidden sm:block",
|
|
2222
|
-
hidden: !
|
|
2223
|
-
style:
|
|
2231
|
+
hidden: !Rt,
|
|
2232
|
+
style: Rt ? void 0 : { display: "none" },
|
|
2224
2233
|
children: n ? /* @__PURE__ */ k("input", {
|
|
2225
2234
|
type: "date",
|
|
2226
2235
|
className: "border rounded px-1 py-0.5 text-xs w-full bg-background",
|
|
2227
|
-
value:
|
|
2228
|
-
onChange: (e) =>
|
|
2236
|
+
value: Vt.end || "",
|
|
2237
|
+
onChange: (e) => Ht((t) => ({
|
|
2229
2238
|
...t,
|
|
2230
2239
|
end: e.target.value
|
|
2231
2240
|
})),
|
|
@@ -2247,7 +2256,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2247
2256
|
onClick: (e) => {
|
|
2248
2257
|
e.stopPropagation(), o(t);
|
|
2249
2258
|
},
|
|
2250
|
-
children: /* @__PURE__ */ k(
|
|
2259
|
+
children: /* @__PURE__ */ k(xe, { className: "h-3.5 w-3.5" })
|
|
2251
2260
|
})
|
|
2252
2261
|
})
|
|
2253
2262
|
]
|
|
@@ -2262,21 +2271,21 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2262
2271
|
/* @__PURE__ */ k("div", {
|
|
2263
2272
|
className: "flex-1 overflow-auto bg-background/50 relative [-webkit-overflow-scrolling:touch]",
|
|
2264
2273
|
ref: (e) => {
|
|
2265
|
-
|
|
2274
|
+
sr.current = e, Z.current = e;
|
|
2266
2275
|
},
|
|
2267
|
-
onScroll:
|
|
2268
|
-
onTouchStart:
|
|
2269
|
-
onTouchMove:
|
|
2270
|
-
onTouchEnd:
|
|
2276
|
+
onScroll: Jr,
|
|
2277
|
+
onTouchStart: Tr,
|
|
2278
|
+
onTouchMove: Er,
|
|
2279
|
+
onTouchEnd: Dr,
|
|
2271
2280
|
"data-testid": "gantt-timeline",
|
|
2272
2281
|
children: /* @__PURE__ */ A("div", {
|
|
2273
2282
|
className: "relative",
|
|
2274
|
-
style: { width:
|
|
2283
|
+
style: { width: Xn },
|
|
2275
2284
|
children: [
|
|
2276
|
-
|
|
2285
|
+
Or != null && /* @__PURE__ */ k("div", {
|
|
2277
2286
|
className: "absolute top-0 bottom-0 w-px z-20 pointer-events-none",
|
|
2278
2287
|
style: {
|
|
2279
|
-
left:
|
|
2288
|
+
left: Or,
|
|
2280
2289
|
backgroundColor: "rgba(239, 68, 68, 0.8)"
|
|
2281
2290
|
},
|
|
2282
2291
|
"data-testid": "gantt-today-marker",
|
|
@@ -2290,7 +2299,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2290
2299
|
children: P("gantt.toolbar.today")
|
|
2291
2300
|
})
|
|
2292
2301
|
}),
|
|
2293
|
-
|
|
2302
|
+
ir.map((e) => /* @__PURE__ */ k("div", {
|
|
2294
2303
|
className: "absolute top-0 bottom-0 w-px z-20 pointer-events-none",
|
|
2295
2304
|
style: {
|
|
2296
2305
|
left: e.left,
|
|
@@ -2309,13 +2318,13 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2309
2318
|
}, e.index)),
|
|
2310
2319
|
/* @__PURE__ */ A("div", {
|
|
2311
2320
|
className: "relative",
|
|
2312
|
-
ref:
|
|
2321
|
+
ref: Cn,
|
|
2313
2322
|
children: [
|
|
2314
2323
|
/* @__PURE__ */ k("div", {
|
|
2315
2324
|
className: "absolute inset-0 pointer-events-none",
|
|
2316
2325
|
style: { zIndex: 0 },
|
|
2317
|
-
children: J.slice(
|
|
2318
|
-
let n =
|
|
2326
|
+
children: J.slice(_r.start, _r.end).map((e, t) => {
|
|
2327
|
+
let n = _r.start + t;
|
|
2319
2328
|
return /* @__PURE__ */ k("div", {
|
|
2320
2329
|
className: "absolute top-0 bottom-0 border-r",
|
|
2321
2330
|
style: {
|
|
@@ -2326,17 +2335,19 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2326
2335
|
}, n);
|
|
2327
2336
|
})
|
|
2328
2337
|
}),
|
|
2329
|
-
|
|
2338
|
+
qn && v && v.showMidnight && /* @__PURE__ */ k("div", {
|
|
2330
2339
|
className: "absolute inset-0 pointer-events-none",
|
|
2331
2340
|
style: { zIndex: 0 },
|
|
2332
|
-
children: J.slice(
|
|
2333
|
-
let n =
|
|
2341
|
+
children: J.slice(_r.start, _r.end).map((e, t) => {
|
|
2342
|
+
let n = _r.start + t, r = e.realMs ?? 0;
|
|
2334
2343
|
if (!r) return null;
|
|
2335
2344
|
let i = e.date.getTime(), a = e.date, o = new Date(a.getFullYear(), a.getMonth(), a.getDate() + 1, 0, 0, 0, 0).getTime();
|
|
2336
|
-
|
|
2345
|
+
if (o <= i || o >= i + r) return null;
|
|
2346
|
+
let s = Y[n] + (o - i) / r * e.width;
|
|
2347
|
+
return /* @__PURE__ */ k("div", {
|
|
2337
2348
|
className: "absolute top-0 bottom-0",
|
|
2338
2349
|
style: {
|
|
2339
|
-
left:
|
|
2350
|
+
left: s,
|
|
2340
2351
|
borderLeft: "1px dashed hsl(var(--muted-foreground) / 0.4)"
|
|
2341
2352
|
},
|
|
2342
2353
|
"data-testid": `gantt-midnight-${n}`,
|
|
@@ -2349,36 +2360,53 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2349
2360
|
"aria-hidden": "true"
|
|
2350
2361
|
}),
|
|
2351
2362
|
K.slice(Q.startIdx, Q.endIdx).map((t, n) => {
|
|
2352
|
-
let r = t.task, i = Q.startIdx + n, a =
|
|
2363
|
+
let r = t.task, i = Q.startIdx + n, a = vi(r.id), o = Xr(t.start, t.end), s = re && r.baselineStart && r.baselineEnd ? Xr(r.baselineStart, r.baselineEnd) : null, c = s ? /* @__PURE__ */ k("div", {
|
|
2353
2364
|
className: "absolute pointer-events-none rounded-[1px]",
|
|
2354
2365
|
style: {
|
|
2355
2366
|
left: s.left,
|
|
2356
2367
|
width: Math.max(2, s.width),
|
|
2357
|
-
top:
|
|
2358
|
-
height:
|
|
2359
|
-
backgroundColor:
|
|
2360
|
-
border: `1px solid ${
|
|
2368
|
+
top: ui,
|
|
2369
|
+
height: li,
|
|
2370
|
+
backgroundColor: di,
|
|
2371
|
+
border: `1px solid ${fi}`
|
|
2361
2372
|
},
|
|
2362
2373
|
"data-testid": `gantt-baseline-${r.id}`,
|
|
2363
2374
|
"aria-hidden": "true"
|
|
2364
|
-
}) : null, l = W?.taskId === r.id, u =
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
...e,
|
|
2368
|
-
targetId: r.id,
|
|
2369
|
-
targetEnd: n
|
|
2370
|
-
} : e);
|
|
2375
|
+
}) : null, l = W?.taskId === r.id, u = Qr?.has(String(r.id)) ?? !1, d = $r?.has(String(r.id)) ?? !1, f = l || u || d ? ei(t) : o, p = !!r.locked, m = !!R && !t.isSummary && !p, h = m && Ue, g = m && We, ee = m && Ge, te = h || g, ne = L || p, _ = G != null && G.targetId != null && String(G.targetId) === String(r.id) && String(G.sourceId) !== String(r.id), v = G != null && G.rejectedId != null && String(G.rejectedId) === String(r.id) ? {
|
|
2376
|
+
cursor: "not-allowed",
|
|
2377
|
+
boxShadow: "0 0 0 2px hsl(var(--destructive))"
|
|
2371
2378
|
} : void 0, ie = G ? (e) => {
|
|
2372
|
-
|
|
2379
|
+
let t = e.currentTarget.getBoundingClientRect(), n = t.width > 0 && e.clientX - t.left > t.width / 2 ? "end" : "start";
|
|
2380
|
+
wn((e) => {
|
|
2381
|
+
if (!e) return e;
|
|
2382
|
+
let t = xn(e.sourceId, r);
|
|
2383
|
+
return t === null ? {
|
|
2384
|
+
...e,
|
|
2385
|
+
targetId: r.id,
|
|
2386
|
+
targetEnd: n,
|
|
2387
|
+
rejectedId: null,
|
|
2388
|
+
rejectedReason: null
|
|
2389
|
+
} : {
|
|
2390
|
+
...e,
|
|
2391
|
+
targetId: null,
|
|
2392
|
+
targetEnd: null,
|
|
2393
|
+
rejectedId: r.id,
|
|
2394
|
+
rejectedReason: t
|
|
2395
|
+
};
|
|
2396
|
+
});
|
|
2397
|
+
} : void 0, ae = G ? (e) => {
|
|
2398
|
+
e.target === e.currentTarget && wn((e) => e && {
|
|
2373
2399
|
...e,
|
|
2374
2400
|
targetId: null,
|
|
2375
|
-
targetEnd: null
|
|
2401
|
+
targetEnd: null,
|
|
2402
|
+
rejectedId: null,
|
|
2403
|
+
rejectedReason: null
|
|
2376
2404
|
});
|
|
2377
|
-
} : void 0,
|
|
2405
|
+
} : void 0, oe = Math.max(1, Math.round((t.end.getTime() - t.start.getTime()) / it)), se = (i + 1) * B + 300 > br && i * B > 300, ce = Ut === r.id && !W && !_n && !G ? /* @__PURE__ */ A("div", {
|
|
2378
2406
|
className: "absolute z-30 pointer-events-none rounded-md border bg-popover text-popover-foreground px-2.5 py-1.5 text-xs shadow-md whitespace-nowrap",
|
|
2379
2407
|
style: {
|
|
2380
2408
|
left: Math.max(f.left + 8, 4),
|
|
2381
|
-
...
|
|
2409
|
+
...se ? { bottom: B - 8 } : { top: B - 8 }
|
|
2382
2410
|
},
|
|
2383
2411
|
role: "tooltip",
|
|
2384
2412
|
"data-testid": `gantt-tooltip-${r.id}`,
|
|
@@ -2415,7 +2443,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2415
2443
|
day: "numeric"
|
|
2416
2444
|
}),
|
|
2417
2445
|
" · ",
|
|
2418
|
-
|
|
2446
|
+
oe,
|
|
2419
2447
|
P("gantt.tooltip.days"),
|
|
2420
2448
|
" · ",
|
|
2421
2449
|
Math.round(t.progress),
|
|
@@ -2433,45 +2461,46 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2433
2461
|
if (r.type === "group") return /* @__PURE__ */ k("div", {
|
|
2434
2462
|
className: "relative border-b hover:bg-accent/50",
|
|
2435
2463
|
style: { height: B },
|
|
2436
|
-
onPointerMove:
|
|
2437
|
-
children:
|
|
2464
|
+
onPointerMove: ae,
|
|
2465
|
+
children: ce
|
|
2438
2466
|
}, r.id);
|
|
2439
2467
|
if (t.isSummary) {
|
|
2440
|
-
let e = r.color || "#0d9488", n =
|
|
2468
|
+
let e = r.color || "#0d9488", n = le === "self" && r.hasOwnDates !== !1, i = !!R && Ue && !p, o = !!R && We && n && !p;
|
|
2441
2469
|
return /* @__PURE__ */ A("div", {
|
|
2442
2470
|
className: "relative border-b hover:bg-accent/50",
|
|
2443
2471
|
style: { height: B },
|
|
2444
|
-
onPointerMove:
|
|
2472
|
+
onPointerMove: ae,
|
|
2445
2473
|
children: [
|
|
2446
2474
|
c,
|
|
2447
2475
|
/* @__PURE__ */ A("div", {
|
|
2448
|
-
className:
|
|
2476
|
+
className: pe("gantt-bar-hover absolute rounded-sm border shadow-sm flex items-center px-2 select-none group", i && "cursor-grab active:cursor-grabbing", l && "ring-2 ring-primary z-10", _ && "ring-2 ring-primary", cr === r.id && "gantt-flash z-10"),
|
|
2449
2477
|
style: {
|
|
2450
2478
|
left: f.left,
|
|
2451
2479
|
width: f.width,
|
|
2452
|
-
top:
|
|
2453
|
-
height:
|
|
2454
|
-
cursor: i || o ? void 0 :
|
|
2480
|
+
top: ci,
|
|
2481
|
+
height: si,
|
|
2482
|
+
cursor: i || o ? void 0 : ne ? "not-allowed" : "pointer",
|
|
2455
2483
|
backgroundColor: e,
|
|
2456
2484
|
borderColor: a ? $ : r.borderColor || "hsl(var(--primary-foreground) / 0.2)",
|
|
2457
|
-
boxShadow: a ? `0 0 0 2px ${$}` : r.borderColor ? `0 0 0 2px ${r.borderColor}` : void 0
|
|
2485
|
+
boxShadow: a ? `0 0 0 2px ${$}` : r.borderColor ? `0 0 0 2px ${r.borderColor}` : void 0,
|
|
2486
|
+
...v
|
|
2458
2487
|
},
|
|
2459
2488
|
"data-critical": a ? "true" : void 0,
|
|
2460
2489
|
"data-testid": `gantt-summary-bar-${r.id}`,
|
|
2461
2490
|
"data-progress": Math.round(t.progress),
|
|
2462
|
-
onMouseEnter: () =>
|
|
2463
|
-
onMouseLeave: () =>
|
|
2464
|
-
onPointerMove:
|
|
2491
|
+
onMouseEnter: () => Wt(r.id),
|
|
2492
|
+
onMouseLeave: () => Wt((e) => e === r.id ? null : e),
|
|
2493
|
+
onPointerMove: ie,
|
|
2465
2494
|
onPointerDown: (e) => {
|
|
2466
2495
|
if (e.button === 0) {
|
|
2467
2496
|
if (o) {
|
|
2468
|
-
let t =
|
|
2497
|
+
let t = Ze(e.clientX, e.currentTarget.getBoundingClientRect());
|
|
2469
2498
|
if (t !== "move") {
|
|
2470
|
-
|
|
2499
|
+
gn(r, t, e);
|
|
2471
2500
|
return;
|
|
2472
2501
|
}
|
|
2473
2502
|
}
|
|
2474
|
-
i &&
|
|
2503
|
+
i && gn(r, "move", e, {
|
|
2475
2504
|
group: !0,
|
|
2476
2505
|
originStart: t.start,
|
|
2477
2506
|
originEnd: t.end
|
|
@@ -2479,9 +2508,9 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2479
2508
|
}
|
|
2480
2509
|
},
|
|
2481
2510
|
onClick: () => {
|
|
2482
|
-
|
|
2511
|
+
Xt.current || Rn(r.id);
|
|
2483
2512
|
},
|
|
2484
|
-
onContextMenu: (e) =>
|
|
2513
|
+
onContextMenu: (e) => Bn(r, e),
|
|
2485
2514
|
children: [
|
|
2486
2515
|
/* @__PURE__ */ k("div", {
|
|
2487
2516
|
className: "absolute left-0 top-0 bottom-0 pointer-events-none",
|
|
@@ -2492,28 +2521,28 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2492
2521
|
borderBottomLeftRadius: "var(--radius-sm)"
|
|
2493
2522
|
}
|
|
2494
2523
|
}),
|
|
2495
|
-
o && f.width >= 14 && /* @__PURE__ */ A(
|
|
2524
|
+
o && f.width >= 14 && /* @__PURE__ */ A(Ne, { children: [/* @__PURE__ */ k("div", {
|
|
2496
2525
|
className: "gantt-resize-handle absolute left-0 top-0",
|
|
2497
2526
|
style: {
|
|
2498
|
-
width:
|
|
2499
|
-
height:
|
|
2527
|
+
width: Xe,
|
|
2528
|
+
height: ii,
|
|
2500
2529
|
cursor: "ew-resize"
|
|
2501
2530
|
},
|
|
2502
2531
|
"data-testid": `gantt-task-resize-left-${r.id}`,
|
|
2503
2532
|
onPointerDown: (e) => {
|
|
2504
|
-
e.button === 0 &&
|
|
2533
|
+
e.button === 0 && gn(r, "resize-left", e);
|
|
2505
2534
|
},
|
|
2506
2535
|
onClick: (e) => e.stopPropagation()
|
|
2507
2536
|
}), /* @__PURE__ */ k("div", {
|
|
2508
2537
|
className: "gantt-resize-handle absolute right-0 top-0",
|
|
2509
2538
|
style: {
|
|
2510
|
-
width:
|
|
2511
|
-
height:
|
|
2539
|
+
width: Xe,
|
|
2540
|
+
height: ii,
|
|
2512
2541
|
cursor: "ew-resize"
|
|
2513
2542
|
},
|
|
2514
2543
|
"data-testid": `gantt-task-resize-right-${r.id}`,
|
|
2515
2544
|
onPointerDown: (e) => {
|
|
2516
|
-
e.button === 0 &&
|
|
2545
|
+
e.button === 0 && gn(r, "resize-right", e);
|
|
2517
2546
|
},
|
|
2518
2547
|
onClick: (e) => e.stopPropagation()
|
|
2519
2548
|
})] }),
|
|
@@ -2522,7 +2551,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2522
2551
|
children: r.title
|
|
2523
2552
|
}),
|
|
2524
2553
|
z && !p && ["start", "end"].map((e) => {
|
|
2525
|
-
let t = G != null && String(G.sourceId) === String(r.id) && G.sourceEnd === e, n = t ||
|
|
2554
|
+
let t = G != null && String(G.sourceId) === String(r.id) && G.sourceEnd === e, n = t || Ut === r.id, i = n && G == null;
|
|
2526
2555
|
return /* @__PURE__ */ k("div", {
|
|
2527
2556
|
className: "absolute top-1/2 -translate-y-1/2 z-20 flex items-center transition-opacity",
|
|
2528
2557
|
style: {
|
|
@@ -2540,14 +2569,16 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2540
2569
|
onPointerDown: (t) => {
|
|
2541
2570
|
if (t.button !== 0) return;
|
|
2542
2571
|
t.stopPropagation(), t.preventDefault();
|
|
2543
|
-
let n =
|
|
2544
|
-
|
|
2572
|
+
let n = Cn.current?.getBoundingClientRect();
|
|
2573
|
+
wn({
|
|
2545
2574
|
sourceId: r.id,
|
|
2546
2575
|
sourceEnd: e,
|
|
2547
2576
|
x: n ? t.clientX - n.left : 0,
|
|
2548
2577
|
y: n ? t.clientY - n.top : 0,
|
|
2549
2578
|
targetId: null,
|
|
2550
|
-
targetEnd: null
|
|
2579
|
+
targetEnd: null,
|
|
2580
|
+
rejectedId: null,
|
|
2581
|
+
rejectedReason: null
|
|
2551
2582
|
});
|
|
2552
2583
|
},
|
|
2553
2584
|
onClick: (e) => e.stopPropagation(),
|
|
@@ -2569,77 +2600,78 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2569
2600
|
className: "absolute z-30 pointer-events-none rounded border bg-popover text-popover-foreground px-1.5 py-0.5 text-[10px] shadow whitespace-nowrap",
|
|
2570
2601
|
style: {
|
|
2571
2602
|
left: Math.max(f.left, 4),
|
|
2572
|
-
top:
|
|
2603
|
+
top: ci + si + 2
|
|
2573
2604
|
},
|
|
2574
2605
|
"data-testid": `gantt-summary-drag-chip-${r.id}`,
|
|
2575
2606
|
children: [
|
|
2576
|
-
|
|
2607
|
+
Zt(W).start.toLocaleDateString(F, {
|
|
2577
2608
|
month: "numeric",
|
|
2578
2609
|
day: "numeric"
|
|
2579
2610
|
}),
|
|
2580
2611
|
" → ",
|
|
2581
|
-
|
|
2612
|
+
Zt(W).end.toLocaleDateString(F, {
|
|
2582
2613
|
month: "numeric",
|
|
2583
2614
|
day: "numeric"
|
|
2584
2615
|
})
|
|
2585
2616
|
]
|
|
2586
2617
|
}),
|
|
2587
|
-
|
|
2618
|
+
ce
|
|
2588
2619
|
]
|
|
2589
2620
|
}, r.id);
|
|
2590
2621
|
}
|
|
2591
2622
|
if (t.isMilestone) {
|
|
2592
|
-
let e =
|
|
2623
|
+
let e = ai;
|
|
2593
2624
|
return /* @__PURE__ */ A("div", {
|
|
2594
2625
|
className: "relative border-b hover:bg-accent/50",
|
|
2595
2626
|
style: { height: B },
|
|
2596
|
-
onPointerMove:
|
|
2627
|
+
onPointerMove: ae,
|
|
2597
2628
|
children: [
|
|
2598
2629
|
c,
|
|
2599
2630
|
/* @__PURE__ */ k("div", {
|
|
2600
|
-
className:
|
|
2631
|
+
className: pe("gantt-bar-hover absolute rotate-45 rounded-[2px] border shadow-sm select-none", h && "cursor-grab active:cursor-grabbing", l && "ring-2 ring-primary z-10", _ && "ring-2 ring-primary", cr === r.id && "gantt-flash z-10"),
|
|
2601
2632
|
style: {
|
|
2602
2633
|
left: f.left - e / 2,
|
|
2603
2634
|
top: (B - e) / 2,
|
|
2604
2635
|
width: e,
|
|
2605
2636
|
height: e,
|
|
2606
|
-
cursor: h ? void 0 :
|
|
2637
|
+
cursor: h ? void 0 : ne ? "not-allowed" : "pointer",
|
|
2607
2638
|
backgroundColor: a ? $ : r.color || "#3b82f6",
|
|
2608
2639
|
borderColor: a ? $ : r.borderColor || "hsl(var(--primary-foreground) / 0.2)",
|
|
2609
|
-
boxShadow: a ? `0 0 0 2px ${$}` : r.borderColor ? `0 0 0 2px ${r.borderColor}` : void 0
|
|
2640
|
+
boxShadow: a ? `0 0 0 2px ${$}` : r.borderColor ? `0 0 0 2px ${r.borderColor}` : void 0,
|
|
2641
|
+
...v
|
|
2610
2642
|
},
|
|
2611
2643
|
"data-critical": a ? "true" : void 0,
|
|
2612
2644
|
"data-testid": `gantt-milestone-${r.id}`,
|
|
2613
|
-
onMouseEnter: () =>
|
|
2614
|
-
onMouseLeave: () =>
|
|
2645
|
+
onMouseEnter: () => Wt(r.id),
|
|
2646
|
+
onMouseLeave: () => Wt((e) => e === r.id ? null : e),
|
|
2615
2647
|
onClick: () => {
|
|
2616
|
-
|
|
2648
|
+
Xt.current || Rn(r.id);
|
|
2617
2649
|
},
|
|
2618
|
-
onContextMenu: (e) =>
|
|
2619
|
-
onPointerMove:
|
|
2650
|
+
onContextMenu: (e) => Bn(r, e),
|
|
2651
|
+
onPointerMove: ie,
|
|
2620
2652
|
onPointerDown: h ? (e) => {
|
|
2621
|
-
e.button === 0 &&
|
|
2653
|
+
e.button === 0 && gn(r, "move", e);
|
|
2622
2654
|
} : void 0
|
|
2623
2655
|
}),
|
|
2624
|
-
|
|
2656
|
+
ce
|
|
2625
2657
|
]
|
|
2626
2658
|
}, r.id);
|
|
2627
2659
|
}
|
|
2628
|
-
let
|
|
2660
|
+
let ue = _n && _n.taskId === r.id ? _n.value : r.progress;
|
|
2629
2661
|
return /* @__PURE__ */ A("div", {
|
|
2630
2662
|
className: "relative border-b hover:bg-accent/50",
|
|
2631
2663
|
style: { height: B },
|
|
2632
|
-
onPointerMove:
|
|
2633
|
-
onMouseEnter: () =>
|
|
2634
|
-
onMouseLeave: () =>
|
|
2664
|
+
onPointerMove: ae,
|
|
2665
|
+
onMouseEnter: () => Wt(r.id),
|
|
2666
|
+
onMouseLeave: () => Wt((e) => e === r.id ? null : e),
|
|
2635
2667
|
children: [
|
|
2636
2668
|
l && /* @__PURE__ */ k("div", {
|
|
2637
2669
|
className: "absolute rounded-sm border border-dashed pointer-events-none",
|
|
2638
2670
|
style: {
|
|
2639
2671
|
left: o.left,
|
|
2640
2672
|
width: o.width,
|
|
2641
|
-
top:
|
|
2642
|
-
height:
|
|
2673
|
+
top: ni,
|
|
2674
|
+
height: ri,
|
|
2643
2675
|
opacity: .35,
|
|
2644
2676
|
borderColor: "hsl(var(--primary) / 0.6)"
|
|
2645
2677
|
},
|
|
@@ -2647,70 +2679,71 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2647
2679
|
}),
|
|
2648
2680
|
c,
|
|
2649
2681
|
/* @__PURE__ */ A("div", {
|
|
2650
|
-
className:
|
|
2682
|
+
className: pe("gantt-bar-hover absolute rounded-sm bg-primary border shadow-sm flex items-center px-2 group select-none", te && "cursor-grab active:cursor-grabbing", l && "ring-2 ring-primary z-10", _ && "ring-2 ring-primary", cr === r.id && "gantt-flash z-10"),
|
|
2651
2683
|
style: {
|
|
2652
2684
|
left: f.left,
|
|
2653
2685
|
width: f.width,
|
|
2654
|
-
top:
|
|
2655
|
-
height:
|
|
2656
|
-
cursor: te ? void 0 :
|
|
2686
|
+
top: ni,
|
|
2687
|
+
height: ri,
|
|
2688
|
+
cursor: te ? void 0 : ne ? "not-allowed" : "pointer",
|
|
2657
2689
|
backgroundColor: r.color || "#3b82f6",
|
|
2658
2690
|
borderColor: a ? $ : r.borderColor || "hsl(var(--primary-foreground) / 0.2)",
|
|
2659
|
-
boxShadow: a ? `0 0 0 2px ${$}` : r.borderColor ? `0 0 0 2px ${r.borderColor}` : void 0
|
|
2691
|
+
boxShadow: a ? `0 0 0 2px ${$}` : r.borderColor ? `0 0 0 2px ${r.borderColor}` : void 0,
|
|
2692
|
+
...v
|
|
2660
2693
|
},
|
|
2661
2694
|
"data-critical": a ? "true" : void 0,
|
|
2662
2695
|
"data-testid": `gantt-task-bar-${r.id}`,
|
|
2663
2696
|
onClick: () => {
|
|
2664
|
-
|
|
2697
|
+
Xt.current || Rn(r.id);
|
|
2665
2698
|
},
|
|
2666
|
-
onContextMenu: (e) =>
|
|
2667
|
-
onPointerMove:
|
|
2699
|
+
onContextMenu: (e) => Bn(r, e),
|
|
2700
|
+
onPointerMove: ie,
|
|
2668
2701
|
onPointerDown: te ? (e) => {
|
|
2669
2702
|
if (e.button !== 0) return;
|
|
2670
|
-
let t =
|
|
2671
|
-
n &&
|
|
2703
|
+
let t = Ze(e.clientX, e.currentTarget.getBoundingClientRect()), n = t !== "move" && g ? t : h ? "move" : null;
|
|
2704
|
+
n && gn(r, n, e);
|
|
2672
2705
|
} : void 0,
|
|
2673
2706
|
children: [
|
|
2674
|
-
g && f.width >= 14 && /* @__PURE__ */ A(
|
|
2707
|
+
g && f.width >= 14 && /* @__PURE__ */ A(Ne, { children: [/* @__PURE__ */ k("div", {
|
|
2675
2708
|
className: "gantt-resize-handle absolute left-0 top-0",
|
|
2676
2709
|
style: {
|
|
2677
|
-
width:
|
|
2678
|
-
height:
|
|
2710
|
+
width: Xe,
|
|
2711
|
+
height: ii,
|
|
2679
2712
|
cursor: "ew-resize"
|
|
2680
2713
|
},
|
|
2681
2714
|
"data-testid": `gantt-task-resize-left-${r.id}`,
|
|
2682
2715
|
onPointerDown: (e) => {
|
|
2683
|
-
e.button === 0 &&
|
|
2716
|
+
e.button === 0 && gn(r, "resize-left", e);
|
|
2684
2717
|
},
|
|
2685
2718
|
onClick: (e) => e.stopPropagation()
|
|
2686
2719
|
}), /* @__PURE__ */ k("div", {
|
|
2687
2720
|
className: "gantt-resize-handle absolute right-0 top-0",
|
|
2688
2721
|
style: {
|
|
2689
|
-
width:
|
|
2690
|
-
height:
|
|
2722
|
+
width: Xe,
|
|
2723
|
+
height: ii,
|
|
2691
2724
|
cursor: "ew-resize"
|
|
2692
2725
|
},
|
|
2693
2726
|
"data-testid": `gantt-task-resize-right-${r.id}`,
|
|
2694
2727
|
onPointerDown: (e) => {
|
|
2695
|
-
e.button === 0 &&
|
|
2728
|
+
e.button === 0 && gn(r, "resize-right", e);
|
|
2696
2729
|
},
|
|
2697
2730
|
onClick: (e) => e.stopPropagation()
|
|
2698
2731
|
})] }),
|
|
2699
|
-
|
|
2732
|
+
ue > 0 && /* @__PURE__ */ k("div", {
|
|
2700
2733
|
className: "absolute left-0 top-0 bottom-0 pointer-events-none",
|
|
2701
2734
|
style: {
|
|
2702
|
-
width: `${
|
|
2735
|
+
width: `${ue}%`,
|
|
2703
2736
|
backgroundColor: "rgba(0, 0, 0, 0.2)",
|
|
2704
2737
|
borderTopLeftRadius: "var(--radius-sm)",
|
|
2705
2738
|
borderBottomLeftRadius: "var(--radius-sm)"
|
|
2706
2739
|
}
|
|
2707
2740
|
}),
|
|
2708
2741
|
ee && f.width >= 30 && /* @__PURE__ */ k("div", {
|
|
2709
|
-
className:
|
|
2710
|
-
style: { left: `${
|
|
2742
|
+
className: pe("absolute bottom-0 h-1/2 w-4 -translate-x-1/2 cursor-col-resize flex items-end justify-center pb-px", _n?.taskId === r.id ? "opacity-100" : "opacity-0 group-hover:opacity-100 transition-opacity"),
|
|
2743
|
+
style: { left: `${ue}%` },
|
|
2711
2744
|
"data-testid": `gantt-progress-handle-${r.id}`,
|
|
2712
2745
|
onPointerDown: (e) => {
|
|
2713
|
-
e.button === 0 && (e.stopPropagation(), e.preventDefault(),
|
|
2746
|
+
e.button === 0 && (e.stopPropagation(), e.preventDefault(), vn({
|
|
2714
2747
|
taskId: r.id,
|
|
2715
2748
|
originClientX: e.clientX,
|
|
2716
2749
|
originProgress: r.progress,
|
|
@@ -2729,7 +2762,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2729
2762
|
} })
|
|
2730
2763
|
}),
|
|
2731
2764
|
z && !p && ["start", "end"].map((e) => {
|
|
2732
|
-
let t = G != null && String(G.sourceId) === String(r.id) && G.sourceEnd === e, n = t ||
|
|
2765
|
+
let t = G != null && String(G.sourceId) === String(r.id) && G.sourceEnd === e, n = t || Ut === r.id, i = n && G == null;
|
|
2733
2766
|
return /* @__PURE__ */ k("div", {
|
|
2734
2767
|
className: "absolute top-1/2 -translate-y-1/2 z-20 flex items-center transition-opacity",
|
|
2735
2768
|
style: {
|
|
@@ -2747,14 +2780,16 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2747
2780
|
onPointerDown: (t) => {
|
|
2748
2781
|
if (t.button !== 0) return;
|
|
2749
2782
|
t.stopPropagation(), t.preventDefault();
|
|
2750
|
-
let n =
|
|
2751
|
-
|
|
2783
|
+
let n = Cn.current?.getBoundingClientRect();
|
|
2784
|
+
wn({
|
|
2752
2785
|
sourceId: r.id,
|
|
2753
2786
|
sourceEnd: e,
|
|
2754
2787
|
x: n ? t.clientX - n.left : 0,
|
|
2755
2788
|
y: n ? t.clientY - n.top : 0,
|
|
2756
2789
|
targetId: null,
|
|
2757
|
-
targetEnd: null
|
|
2790
|
+
targetEnd: null,
|
|
2791
|
+
rejectedId: null,
|
|
2792
|
+
rejectedReason: null
|
|
2758
2793
|
});
|
|
2759
2794
|
},
|
|
2760
2795
|
onClick: (e) => e.stopPropagation(),
|
|
@@ -2776,17 +2811,17 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2776
2811
|
}),
|
|
2777
2812
|
/* @__PURE__ */ k("span", {
|
|
2778
2813
|
className: "absolute inset-0 flex items-center px-2 text-[10px] text-white font-medium truncate opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",
|
|
2779
|
-
children: l ? `${
|
|
2814
|
+
children: l ? `${Zt(W).start.toLocaleDateString(F, {
|
|
2780
2815
|
month: "numeric",
|
|
2781
2816
|
day: "numeric"
|
|
2782
|
-
})} → ${
|
|
2817
|
+
})} → ${Zt(W).end.toLocaleDateString(F, {
|
|
2783
2818
|
month: "numeric",
|
|
2784
2819
|
day: "numeric"
|
|
2785
|
-
})}` : `${Math.round(
|
|
2820
|
+
})}` : `${Math.round(ue)}%`
|
|
2786
2821
|
})
|
|
2787
2822
|
]
|
|
2788
2823
|
}),
|
|
2789
|
-
|
|
2824
|
+
ce
|
|
2790
2825
|
]
|
|
2791
2826
|
}, r.id);
|
|
2792
2827
|
}),
|
|
@@ -2794,10 +2829,10 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2794
2829
|
style: { height: (K.length - Q.endIdx) * B },
|
|
2795
2830
|
"aria-hidden": "true"
|
|
2796
2831
|
}),
|
|
2797
|
-
(
|
|
2832
|
+
(ti.length > 0 || G) && /* @__PURE__ */ A("svg", {
|
|
2798
2833
|
className: "absolute top-0 left-0 pointer-events-none z-10",
|
|
2799
|
-
width:
|
|
2800
|
-
height:
|
|
2834
|
+
width: Xn,
|
|
2835
|
+
height: br,
|
|
2801
2836
|
"data-testid": "gantt-links",
|
|
2802
2837
|
"aria-hidden": "true",
|
|
2803
2838
|
children: [
|
|
@@ -2842,12 +2877,12 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2842
2877
|
})
|
|
2843
2878
|
})
|
|
2844
2879
|
] }),
|
|
2845
|
-
|
|
2880
|
+
ti.map((t) => {
|
|
2846
2881
|
let n = Math.min(t.sourceIndex, t.targetIndex);
|
|
2847
2882
|
if (Math.max(t.sourceIndex, t.targetIndex) < Q.startIdx - 6 || n > Q.endIdx + 6) return null;
|
|
2848
|
-
let r =
|
|
2883
|
+
let r = pi(t);
|
|
2849
2884
|
if (!r) return null;
|
|
2850
|
-
let i =
|
|
2885
|
+
let i = mi != null && (String(t.sourceId) === String(mi) || String(t.targetId) === String(mi)), a = _i?.criticalEdges.has(`${String(t.sourceId)}->${String(t.targetId)}`) ?? !1, o = a ? "gantt-link-arrow-critical" : i ? "gantt-link-arrow-active" : "gantt-link-arrow", s = !!(at || z);
|
|
2851
2886
|
return /* @__PURE__ */ A(e.Fragment, { children: [/* @__PURE__ */ k("path", {
|
|
2852
2887
|
d: r,
|
|
2853
2888
|
fill: "none",
|
|
@@ -2869,13 +2904,13 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2869
2904
|
cursor: "context-menu"
|
|
2870
2905
|
},
|
|
2871
2906
|
"data-testid": `gantt-link-hit-${t.sourceId}-${t.targetId}`,
|
|
2872
|
-
onContextMenu: (e) =>
|
|
2907
|
+
onContextMenu: (e) => Vn(t.sourceId, t.targetId, t.type, e)
|
|
2873
2908
|
})] }, t.key);
|
|
2874
2909
|
}),
|
|
2875
2910
|
G && (() => {
|
|
2876
2911
|
let e = K.findIndex((e) => String(e.task.id) === String(G.sourceId));
|
|
2877
2912
|
if (e < 0) return null;
|
|
2878
|
-
let t =
|
|
2913
|
+
let t = ei(K[e]), n = K[e].isMilestone ? t.left + (G.sourceEnd === "start" ? -oi : oi) : G.sourceEnd === "start" ? t.left : t.left + t.width, r = e * B + B / 2;
|
|
2879
2914
|
return /* @__PURE__ */ k("path", {
|
|
2880
2915
|
d: `M ${Math.round(n)} ${Math.round(r)} L ${Math.round(G.x)} ${Math.round(G.y)}`,
|
|
2881
2916
|
fill: "none",
|
|
@@ -2888,9 +2923,9 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2888
2923
|
]
|
|
2889
2924
|
}),
|
|
2890
2925
|
G && (() => {
|
|
2891
|
-
let e =
|
|
2926
|
+
let e = S.find((e) => String(e.id) === String(G.sourceId));
|
|
2892
2927
|
if (!e) return null;
|
|
2893
|
-
let t = G.targetId == null ? null :
|
|
2928
|
+
let t = G.targetId == null ? null : S.find((e) => String(e.id) === String(G.targetId)), n = (e) => P(`gantt.linkEnd.${e}`), r = t ? `${e.title} (${n(G.sourceEnd)}) → ${t.title} (${n(G.targetEnd ?? "start")})` : `${e.title} (${n(G.sourceEnd)})`;
|
|
2894
2929
|
return /* @__PURE__ */ k("div", {
|
|
2895
2930
|
className: "absolute z-30 pointer-events-none rounded-md border bg-popover text-popover-foreground px-2 py-1 text-[11px] font-medium shadow-md whitespace-nowrap",
|
|
2896
2931
|
style: {
|
|
@@ -2907,7 +2942,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2907
2942
|
})
|
|
2908
2943
|
}),
|
|
2909
2944
|
/* @__PURE__ */ k("div", {
|
|
2910
|
-
ref:
|
|
2945
|
+
ref: zr,
|
|
2911
2946
|
className: "shrink-0 border-l bg-card/95 select-none",
|
|
2912
2947
|
style: {
|
|
2913
2948
|
width: 14,
|
|
@@ -2915,14 +2950,14 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2915
2950
|
},
|
|
2916
2951
|
"data-testid": "gantt-vscrollbar",
|
|
2917
2952
|
children: /* @__PURE__ */ k("div", {
|
|
2918
|
-
ref:
|
|
2953
|
+
ref: Br,
|
|
2919
2954
|
className: "relative h-full",
|
|
2920
|
-
onPointerDown:
|
|
2955
|
+
onPointerDown: qr,
|
|
2921
2956
|
role: "scrollbar",
|
|
2922
2957
|
"aria-controls": "gantt-timeline",
|
|
2923
2958
|
"aria-orientation": "vertical",
|
|
2924
2959
|
children: /* @__PURE__ */ k("div", {
|
|
2925
|
-
ref:
|
|
2960
|
+
ref: Vr,
|
|
2926
2961
|
className: "absolute rounded-full",
|
|
2927
2962
|
style: {
|
|
2928
2963
|
left: 2,
|
|
@@ -2933,14 +2968,14 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2933
2968
|
cursor: "grab"
|
|
2934
2969
|
},
|
|
2935
2970
|
"data-testid": "gantt-vscrollbar-thumb",
|
|
2936
|
-
onPointerDown:
|
|
2971
|
+
onPointerDown: Kr
|
|
2937
2972
|
})
|
|
2938
2973
|
})
|
|
2939
2974
|
})
|
|
2940
2975
|
]
|
|
2941
2976
|
}),
|
|
2942
2977
|
/* @__PURE__ */ k("div", {
|
|
2943
|
-
ref:
|
|
2978
|
+
ref: Fr,
|
|
2944
2979
|
className: "shrink-0 border-t bg-card/95 select-none",
|
|
2945
2980
|
style: {
|
|
2946
2981
|
position: "sticky",
|
|
@@ -2950,18 +2985,18 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2950
2985
|
},
|
|
2951
2986
|
"data-testid": "gantt-hscrollbar",
|
|
2952
2987
|
children: /* @__PURE__ */ k("div", {
|
|
2953
|
-
ref:
|
|
2988
|
+
ref: Ir,
|
|
2954
2989
|
className: "relative",
|
|
2955
2990
|
style: {
|
|
2956
2991
|
marginLeft: H,
|
|
2957
2992
|
height: 14
|
|
2958
2993
|
},
|
|
2959
|
-
onPointerDown:
|
|
2994
|
+
onPointerDown: Gr,
|
|
2960
2995
|
role: "scrollbar",
|
|
2961
2996
|
"aria-controls": "gantt-timeline",
|
|
2962
2997
|
"aria-orientation": "horizontal",
|
|
2963
2998
|
children: /* @__PURE__ */ k("div", {
|
|
2964
|
-
ref:
|
|
2999
|
+
ref: Lr,
|
|
2965
3000
|
className: "absolute rounded-full",
|
|
2966
3001
|
style: {
|
|
2967
3002
|
top: 2,
|
|
@@ -2972,22 +3007,22 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2972
3007
|
cursor: "grab"
|
|
2973
3008
|
},
|
|
2974
3009
|
"data-testid": "gantt-hscrollbar-thumb",
|
|
2975
|
-
onPointerDown:
|
|
3010
|
+
onPointerDown: Wr
|
|
2976
3011
|
})
|
|
2977
3012
|
})
|
|
2978
3013
|
})
|
|
2979
3014
|
]
|
|
2980
3015
|
}),
|
|
2981
|
-
|
|
2982
|
-
let e =
|
|
3016
|
+
En && (() => {
|
|
3017
|
+
let e = S.find((e) => String(e.id) === String(En.taskId));
|
|
2983
3018
|
if (!e) return null;
|
|
2984
|
-
let t = K.find((e) => String(e.task.id) === String(
|
|
3019
|
+
let t = K.find((e) => String(e.task.id) === String(En.taskId)), n = "w-full text-left px-3 py-1.5 hover:bg-accent focus:bg-accent outline-none";
|
|
2985
3020
|
return /* @__PURE__ */ A("div", {
|
|
2986
|
-
ref:
|
|
3021
|
+
ref: On,
|
|
2987
3022
|
className: "fixed z-50 min-w-[160px] rounded-md border bg-popover text-popover-foreground shadow-md py-1 text-sm",
|
|
2988
3023
|
style: {
|
|
2989
|
-
left:
|
|
2990
|
-
top:
|
|
3024
|
+
left: En.x,
|
|
3025
|
+
top: En.y
|
|
2991
3026
|
},
|
|
2992
3027
|
role: "menu",
|
|
2993
3028
|
"data-testid": "gantt-context-menu",
|
|
@@ -2998,17 +3033,17 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
2998
3033
|
className: n,
|
|
2999
3034
|
"data-testid": "gantt-context-menu-view",
|
|
3000
3035
|
onClick: () => {
|
|
3001
|
-
|
|
3036
|
+
Dn(null), o(e);
|
|
3002
3037
|
},
|
|
3003
3038
|
children: P("gantt.menu.view")
|
|
3004
3039
|
}),
|
|
3005
|
-
|
|
3040
|
+
_t && R && t && !t.isSummary && !e.locked && /* @__PURE__ */ k("button", {
|
|
3006
3041
|
type: "button",
|
|
3007
3042
|
role: "menuitem",
|
|
3008
3043
|
className: n,
|
|
3009
3044
|
"data-testid": "gantt-context-menu-edit",
|
|
3010
3045
|
onClick: () => {
|
|
3011
|
-
|
|
3046
|
+
Dn(null), Bt(e.id), Ht({
|
|
3012
3047
|
title: e.title,
|
|
3013
3048
|
start: e.start.toLocaleDateString("en-CA"),
|
|
3014
3049
|
end: e.end.toLocaleDateString("en-CA"),
|
|
@@ -3017,14 +3052,14 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
3017
3052
|
},
|
|
3018
3053
|
children: P("gantt.menu.edit")
|
|
3019
3054
|
}),
|
|
3020
|
-
z && t && !t.isMilestone && !e.locked && /* @__PURE__ */ A(
|
|
3055
|
+
z && t && !t.isMilestone && !e.locked && /* @__PURE__ */ A(Ne, { children: [/* @__PURE__ */ k("button", {
|
|
3021
3056
|
type: "button",
|
|
3022
3057
|
role: "menuitem",
|
|
3023
3058
|
className: n,
|
|
3024
3059
|
"data-testid": "gantt-context-menu-add-predecessor",
|
|
3025
3060
|
onClick: () => {
|
|
3026
|
-
let t =
|
|
3027
|
-
|
|
3061
|
+
let t = En;
|
|
3062
|
+
Dn(null), Fn(""), Nn({
|
|
3028
3063
|
x: t.x,
|
|
3029
3064
|
y: t.y,
|
|
3030
3065
|
taskId: e.id,
|
|
@@ -3038,8 +3073,8 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
3038
3073
|
className: n,
|
|
3039
3074
|
"data-testid": "gantt-context-menu-add-successor",
|
|
3040
3075
|
onClick: () => {
|
|
3041
|
-
let t =
|
|
3042
|
-
|
|
3076
|
+
let t = En;
|
|
3077
|
+
Dn(null), Fn(""), Nn({
|
|
3043
3078
|
x: t.x,
|
|
3044
3079
|
y: t.y,
|
|
3045
3080
|
taskId: e.id,
|
|
@@ -3048,21 +3083,21 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
3048
3083
|
},
|
|
3049
3084
|
children: P("gantt.menu.addSuccessor")
|
|
3050
3085
|
})] }),
|
|
3051
|
-
|
|
3086
|
+
Je && !e.locked && /* @__PURE__ */ k("button", {
|
|
3052
3087
|
type: "button",
|
|
3053
3088
|
role: "menuitem",
|
|
3054
|
-
className:
|
|
3089
|
+
className: pe(n, "text-destructive"),
|
|
3055
3090
|
"data-testid": "gantt-context-menu-delete",
|
|
3056
3091
|
onClick: () => {
|
|
3057
|
-
|
|
3092
|
+
Dn(null), Je(e);
|
|
3058
3093
|
},
|
|
3059
3094
|
children: P("gantt.menu.delete")
|
|
3060
3095
|
})
|
|
3061
3096
|
]
|
|
3062
3097
|
});
|
|
3063
3098
|
})(),
|
|
3064
|
-
|
|
3065
|
-
let e =
|
|
3099
|
+
kn && (() => {
|
|
3100
|
+
let e = S.find((e) => String(e.id) === String(kn.sourceId)), t = S.find((e) => String(e.id) === String(kn.targetId));
|
|
3066
3101
|
if (!e || !t) return null;
|
|
3067
3102
|
let n = "w-full text-left px-3 py-1.5 hover:bg-accent focus:bg-accent outline-none", r = [
|
|
3068
3103
|
"fs",
|
|
@@ -3071,11 +3106,11 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
3071
3106
|
"sf"
|
|
3072
3107
|
], i = !!t.locked;
|
|
3073
3108
|
return /* @__PURE__ */ A("div", {
|
|
3074
|
-
ref:
|
|
3109
|
+
ref: jn,
|
|
3075
3110
|
className: "fixed z-50 min-w-[180px] rounded-md border bg-popover text-popover-foreground shadow-md py-1 text-sm",
|
|
3076
3111
|
style: {
|
|
3077
|
-
left:
|
|
3078
|
-
top:
|
|
3112
|
+
left: kn.x,
|
|
3113
|
+
top: kn.y
|
|
3079
3114
|
},
|
|
3080
3115
|
role: "menu",
|
|
3081
3116
|
"data-testid": "gantt-link-context-menu",
|
|
@@ -3093,60 +3128,60 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
3093
3128
|
"data-testid": "gantt-link-menu-locked",
|
|
3094
3129
|
children: ["🚫 ", P("gantt.lockedHint")]
|
|
3095
3130
|
}),
|
|
3096
|
-
z &&
|
|
3131
|
+
z && he && r.map((r) => /* @__PURE__ */ A("button", {
|
|
3097
3132
|
type: "button",
|
|
3098
3133
|
role: "menuitemradio",
|
|
3099
|
-
"aria-checked":
|
|
3134
|
+
"aria-checked": kn.type === r,
|
|
3100
3135
|
disabled: i,
|
|
3101
|
-
className:
|
|
3136
|
+
className: pe(n, kn.type === r && "font-semibold", i && "opacity-50 cursor-not-allowed hover:bg-transparent"),
|
|
3102
3137
|
"data-testid": `gantt-link-menu-type-${r}`,
|
|
3103
3138
|
onClick: () => {
|
|
3104
|
-
i || (
|
|
3139
|
+
i || (An(null), r !== kn.type && z(e, t, r));
|
|
3105
3140
|
},
|
|
3106
|
-
children: [
|
|
3141
|
+
children: [kn.type === r ? "✓ " : "\xA0\xA0", P(`gantt.linkType.${r}`)]
|
|
3107
3142
|
}, r)),
|
|
3108
|
-
|
|
3143
|
+
at && /* @__PURE__ */ A(Ne, { children: [/* @__PURE__ */ k("div", { className: "my-1 border-t" }), /* @__PURE__ */ k("button", {
|
|
3109
3144
|
type: "button",
|
|
3110
3145
|
role: "menuitem",
|
|
3111
3146
|
disabled: i,
|
|
3112
|
-
className:
|
|
3147
|
+
className: pe(n, "text-destructive", i && "opacity-50 cursor-not-allowed hover:bg-transparent"),
|
|
3113
3148
|
"data-testid": "gantt-link-menu-remove",
|
|
3114
3149
|
onClick: () => {
|
|
3115
|
-
i || (
|
|
3150
|
+
i || (An(null), at(e, t));
|
|
3116
3151
|
},
|
|
3117
3152
|
children: P("gantt.menu.removeDependency")
|
|
3118
3153
|
})] })
|
|
3119
3154
|
]
|
|
3120
3155
|
});
|
|
3121
3156
|
})(),
|
|
3122
|
-
|
|
3123
|
-
let e =
|
|
3157
|
+
Mn && z && (() => {
|
|
3158
|
+
let e = S.find((e) => String(e.id) === String(Mn.taskId));
|
|
3124
3159
|
if (!e) return null;
|
|
3125
|
-
let t = new Set(
|
|
3160
|
+
let t = new Set(ti.map((e) => `${String(e.sourceId)}->${String(e.targetId)}`)), n = S.filter((n) => {
|
|
3126
3161
|
if (String(n.id) === String(e.id) || n.type === "group" || n.locked) return !1;
|
|
3127
|
-
let r =
|
|
3162
|
+
let r = Mn.relation === "pred" ? `${String(n.id)}->${String(e.id)}` : `${String(e.id)}->${String(n.id)}`;
|
|
3128
3163
|
return !t.has(r);
|
|
3129
|
-
}), r =
|
|
3164
|
+
}), r = Pn.trim().toLowerCase(), i = r ? n.filter((e) => String(e.title ?? "").toLowerCase().includes(r)) : n;
|
|
3130
3165
|
return /* @__PURE__ */ A("div", {
|
|
3131
|
-
ref:
|
|
3166
|
+
ref: In,
|
|
3132
3167
|
className: "fixed z-50 min-w-[200px] max-h-[280px] overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md py-1 text-sm",
|
|
3133
3168
|
style: {
|
|
3134
|
-
left:
|
|
3135
|
-
top:
|
|
3169
|
+
left: Mn.x,
|
|
3170
|
+
top: Mn.y
|
|
3136
3171
|
},
|
|
3137
3172
|
role: "menu",
|
|
3138
3173
|
"data-testid": "gantt-dep-picker",
|
|
3139
3174
|
children: [
|
|
3140
3175
|
/* @__PURE__ */ k("div", {
|
|
3141
3176
|
className: "px-3 py-1 text-xs text-muted-foreground",
|
|
3142
|
-
children:
|
|
3177
|
+
children: Mn.relation === "pred" ? P("gantt.menu.addPredecessor") : P("gantt.menu.addSuccessor")
|
|
3143
3178
|
}),
|
|
3144
3179
|
/* @__PURE__ */ k("div", {
|
|
3145
3180
|
className: "px-2 pb-1",
|
|
3146
3181
|
children: /* @__PURE__ */ k("input", {
|
|
3147
3182
|
className: "border rounded px-2 py-1 text-sm w-full bg-background",
|
|
3148
|
-
value:
|
|
3149
|
-
onChange: (e) =>
|
|
3183
|
+
value: Pn,
|
|
3184
|
+
onChange: (e) => Fn(e.target.value),
|
|
3150
3185
|
placeholder: P("gantt.menu.searchTasks"),
|
|
3151
3186
|
"data-testid": "gantt-dep-picker-search",
|
|
3152
3187
|
autoFocus: !0
|
|
@@ -3161,17 +3196,17 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
3161
3196
|
className: "w-full text-left px-3 py-1.5 hover:bg-accent focus:bg-accent outline-none truncate",
|
|
3162
3197
|
"data-testid": `gantt-dep-picker-option-${t.id}`,
|
|
3163
3198
|
onClick: () => {
|
|
3164
|
-
|
|
3199
|
+
Nn(null), Mn.relation === "pred" ? z(t, e, "fs") : z(e, t, "fs");
|
|
3165
3200
|
},
|
|
3166
3201
|
children: t.title
|
|
3167
3202
|
}, String(t.id)))
|
|
3168
3203
|
]
|
|
3169
3204
|
});
|
|
3170
3205
|
})(),
|
|
3171
|
-
|
|
3206
|
+
yi && /* @__PURE__ */ k("div", {
|
|
3172
3207
|
className: "fixed inset-0 z-[60] flex items-center justify-center bg-black/30",
|
|
3173
3208
|
"data-testid": "gantt-autoschedule-overlay",
|
|
3174
|
-
onClick: () =>
|
|
3209
|
+
onClick: () => bi(null),
|
|
3175
3210
|
children: /* @__PURE__ */ A("div", {
|
|
3176
3211
|
className: "min-w-[280px] max-w-[360px] rounded-lg border bg-popover text-popover-foreground shadow-lg p-4",
|
|
3177
3212
|
role: "alertdialog",
|
|
@@ -3186,9 +3221,9 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
3186
3221
|
}),
|
|
3187
3222
|
/* @__PURE__ */ A("div", {
|
|
3188
3223
|
className: "text-sm text-muted-foreground mb-3",
|
|
3189
|
-
children: [P("gantt.autoScheduleDlg.body"
|
|
3224
|
+
children: [P("gantt.autoScheduleDlg.body", { count: yi.changes.length }), yi.skipped > 0 && /* @__PURE__ */ A(Ne, { children: [" ", /* @__PURE__ */ k("span", {
|
|
3190
3225
|
"data-testid": "gantt-autoschedule-skipped",
|
|
3191
|
-
children: P("gantt.autoScheduleDlg.skipped"
|
|
3226
|
+
children: P("gantt.autoScheduleDlg.skipped", { count: yi.skipped })
|
|
3192
3227
|
})] })]
|
|
3193
3228
|
}),
|
|
3194
3229
|
/* @__PURE__ */ A("div", {
|
|
@@ -3197,29 +3232,29 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
3197
3232
|
type: "button",
|
|
3198
3233
|
className: "px-3 py-1.5 text-sm rounded-md border hover:bg-accent outline-none",
|
|
3199
3234
|
"data-testid": "gantt-autoschedule-cancel",
|
|
3200
|
-
onClick: () =>
|
|
3235
|
+
onClick: () => bi(null),
|
|
3201
3236
|
children: P("gantt.autoScheduleDlg.cancel")
|
|
3202
3237
|
}), /* @__PURE__ */ k("button", {
|
|
3203
3238
|
type: "button",
|
|
3204
3239
|
className: "px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 outline-none",
|
|
3205
3240
|
"data-testid": "gantt-autoschedule-confirm",
|
|
3206
|
-
onClick:
|
|
3241
|
+
onClick: wi,
|
|
3207
3242
|
children: P("gantt.autoScheduleDlg.confirm")
|
|
3208
3243
|
})]
|
|
3209
3244
|
})
|
|
3210
3245
|
]
|
|
3211
3246
|
})
|
|
3212
3247
|
}),
|
|
3213
|
-
|
|
3248
|
+
xi && /* @__PURE__ */ k("div", {
|
|
3214
3249
|
className: "fixed bottom-6 left-1/2 -translate-x-1/2 z-[60] rounded-md border bg-popover text-popover-foreground px-3 py-1.5 text-sm shadow-md",
|
|
3215
3250
|
role: "status",
|
|
3216
3251
|
"data-testid": "gantt-autoschedule-clean",
|
|
3217
3252
|
children: P("gantt.autoScheduleDlg.none")
|
|
3218
3253
|
}),
|
|
3219
|
-
|
|
3254
|
+
an && /* @__PURE__ */ k("div", {
|
|
3220
3255
|
className: "fixed inset-0 z-[60] flex items-center justify-center bg-black/30",
|
|
3221
3256
|
"data-testid": "gantt-conflict-overlay",
|
|
3222
|
-
onClick: () =>
|
|
3257
|
+
onClick: () => on(null),
|
|
3223
3258
|
children: /* @__PURE__ */ A("div", {
|
|
3224
3259
|
className: "min-w-[280px] max-w-[360px] rounded-lg border bg-popover text-popover-foreground shadow-lg p-4",
|
|
3225
3260
|
role: "alertdialog",
|
|
@@ -3234,7 +3269,7 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
3234
3269
|
}),
|
|
3235
3270
|
/* @__PURE__ */ k("div", {
|
|
3236
3271
|
className: "text-sm text-muted-foreground mb-3",
|
|
3237
|
-
children: P("gantt.conflict.body"
|
|
3272
|
+
children: P("gantt.conflict.body", { count: an.length })
|
|
3238
3273
|
}),
|
|
3239
3274
|
/* @__PURE__ */ A("div", {
|
|
3240
3275
|
className: "flex justify-end gap-2",
|
|
@@ -3242,13 +3277,13 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
3242
3277
|
type: "button",
|
|
3243
3278
|
className: "px-3 py-1.5 text-sm rounded-md border hover:bg-accent outline-none",
|
|
3244
3279
|
"data-testid": "gantt-conflict-cancel",
|
|
3245
|
-
onClick: () =>
|
|
3280
|
+
onClick: () => on(null),
|
|
3246
3281
|
children: P("gantt.conflict.cancel")
|
|
3247
3282
|
}), /* @__PURE__ */ k("button", {
|
|
3248
3283
|
type: "button",
|
|
3249
3284
|
className: "px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 outline-none",
|
|
3250
3285
|
"data-testid": "gantt-conflict-confirm",
|
|
3251
|
-
onClick:
|
|
3286
|
+
onClick: un,
|
|
3252
3287
|
children: P("gantt.conflict.confirm")
|
|
3253
3288
|
})]
|
|
3254
3289
|
})
|
|
@@ -3260,10 +3295,10 @@ function ht({ tasks: t, viewMode: n, startDate: r, endDate: i, markers: a, onTas
|
|
|
3260
3295
|
}
|
|
3261
3296
|
//#endregion
|
|
3262
3297
|
//#region src/workload.ts
|
|
3263
|
-
function
|
|
3298
|
+
function vt(e, t, n, r) {
|
|
3264
3299
|
return t.getTime() === e.getTime() ? e.getTime() >= n.getTime() && e.getTime() < r.getTime() : e.getTime() < r.getTime() && t.getTime() > n.getTime();
|
|
3265
3300
|
}
|
|
3266
|
-
function
|
|
3301
|
+
function yt(e, t, n) {
|
|
3267
3302
|
let { assignee: r, effort: i, capacity: a = 1, unassignedLabel: o = "Unassigned" } = n, s = (e) => typeof a == "function" ? a(e) : a, c = (e) => {
|
|
3268
3303
|
let t = i ? i(e) : 1;
|
|
3269
3304
|
return Number.isFinite(t) && t > 0 ? t : 0;
|
|
@@ -3280,7 +3315,7 @@ function _t(e, t, n) {
|
|
|
3280
3315
|
for (let e of l.values()) {
|
|
3281
3316
|
let n = s(e.key), r = 0, i = 0, a = t.map((t) => {
|
|
3282
3317
|
let a = 0;
|
|
3283
|
-
for (let n of e.items)
|
|
3318
|
+
for (let n of e.items) vt(n.start, n.end, t.start, t.end) && (a += c(n));
|
|
3284
3319
|
a > r && (r = a);
|
|
3285
3320
|
let o = a > n + 1e-9;
|
|
3286
3321
|
return o && i++, {
|
|
@@ -3302,32 +3337,32 @@ function _t(e, t, n) {
|
|
|
3302
3337
|
}
|
|
3303
3338
|
//#endregion
|
|
3304
3339
|
//#region src/ResourceWorkload.tsx
|
|
3305
|
-
var
|
|
3340
|
+
var B = {
|
|
3306
3341
|
day: 26,
|
|
3307
3342
|
week: 56,
|
|
3308
3343
|
month: 76,
|
|
3309
3344
|
quarter: 88,
|
|
3310
3345
|
year: 104
|
|
3311
|
-
},
|
|
3312
|
-
function
|
|
3346
|
+
}, bt = 48, xt = 34, St = 180;
|
|
3347
|
+
function Ct(e, t, n) {
|
|
3313
3348
|
return t === "day" ? String(e.getDate()) : t === "week" ? e.toLocaleDateString(n, {
|
|
3314
3349
|
month: "numeric",
|
|
3315
3350
|
day: "numeric"
|
|
3316
3351
|
}) : t === "month" ? e.toLocaleDateString(n, { month: "short" }) : t === "year" ? String(e.getFullYear()) : `Q${Math.floor(e.getMonth() / 3) + 1}`;
|
|
3317
3352
|
}
|
|
3318
|
-
function
|
|
3319
|
-
let { t: c, language: l } =
|
|
3353
|
+
function wt({ tasks: t, assignee: n, effort: r, capacity: i = 1, viewMode: a = "day", unassignedLabel: o = "Unassigned", className: s }) {
|
|
3354
|
+
let { t: c, language: l } = Ye(), u = l || void 0, d = B[a], f = e.useMemo(() => {
|
|
3320
3355
|
if (!t.length) return [];
|
|
3321
|
-
let e = new Date(Math.min(...t.map((e) => e.start.getTime()))), n = new Date(Math.max(...t.map((e) => e.end.getTime()))), r =
|
|
3356
|
+
let e = new Date(Math.min(...t.map((e) => e.start.getTime()))), n = new Date(Math.max(...t.map((e) => e.end.getTime()))), r = st(e, a), i = lt(st(n, a), 1, a), o = [], s = 0;
|
|
3322
3357
|
for (; r < i && s++ < 4e3;) {
|
|
3323
|
-
let e =
|
|
3358
|
+
let e = lt(r, 1, a);
|
|
3324
3359
|
o.push({
|
|
3325
3360
|
date: new Date(r),
|
|
3326
3361
|
col: {
|
|
3327
3362
|
start: new Date(r),
|
|
3328
3363
|
end: new Date(e)
|
|
3329
3364
|
},
|
|
3330
|
-
label:
|
|
3365
|
+
label: Ct(r, a, u)
|
|
3331
3366
|
}), r = e;
|
|
3332
3367
|
}
|
|
3333
3368
|
return o;
|
|
@@ -3335,7 +3370,7 @@ function St({ tasks: t, assignee: n, effort: r, capacity: i = 1, viewMode: a = "
|
|
|
3335
3370
|
t,
|
|
3336
3371
|
a,
|
|
3337
3372
|
u
|
|
3338
|
-
]), p = e.useMemo(() =>
|
|
3373
|
+
]), p = e.useMemo(() => yt(t, f.map((e) => e.col), {
|
|
3339
3374
|
assignee: n,
|
|
3340
3375
|
effort: r,
|
|
3341
3376
|
capacity: i,
|
|
@@ -3364,11 +3399,11 @@ function St({ tasks: t, assignee: n, effort: r, capacity: i = 1, viewMode: a = "
|
|
|
3364
3399
|
children: /* @__PURE__ */ A("div", {
|
|
3365
3400
|
style: {
|
|
3366
3401
|
display: "flex",
|
|
3367
|
-
minWidth:
|
|
3402
|
+
minWidth: St + h
|
|
3368
3403
|
},
|
|
3369
3404
|
children: [/* @__PURE__ */ A("div", {
|
|
3370
3405
|
style: {
|
|
3371
|
-
width:
|
|
3406
|
+
width: St,
|
|
3372
3407
|
flexShrink: 0
|
|
3373
3408
|
},
|
|
3374
3409
|
children: [/* @__PURE__ */ k("div", {
|
|
@@ -3385,7 +3420,7 @@ function St({ tasks: t, assignee: n, effort: r, capacity: i = 1, viewMode: a = "
|
|
|
3385
3420
|
}), p.map((e) => /* @__PURE__ */ A("div", {
|
|
3386
3421
|
"data-testid": `resource-row-${e.key}`,
|
|
3387
3422
|
style: {
|
|
3388
|
-
height:
|
|
3423
|
+
height: bt,
|
|
3389
3424
|
display: "flex",
|
|
3390
3425
|
flexDirection: "column",
|
|
3391
3426
|
justifyContent: "center",
|
|
@@ -3441,12 +3476,12 @@ function St({ tasks: t, assignee: n, effort: r, capacity: i = 1, viewMode: a = "
|
|
|
3441
3476
|
children: e.label
|
|
3442
3477
|
}, t))
|
|
3443
3478
|
}), p.map((e) => {
|
|
3444
|
-
let t =
|
|
3479
|
+
let t = xt * (1 - Math.min(e.capacity / m, 1));
|
|
3445
3480
|
return /* @__PURE__ */ A("div", {
|
|
3446
3481
|
style: {
|
|
3447
3482
|
position: "relative",
|
|
3448
3483
|
display: "flex",
|
|
3449
|
-
height:
|
|
3484
|
+
height: bt,
|
|
3450
3485
|
borderBottom: "1px solid hsl(var(--border) / 0.5)"
|
|
3451
3486
|
},
|
|
3452
3487
|
children: [/* @__PURE__ */ k("div", {
|
|
@@ -3455,13 +3490,13 @@ function St({ tasks: t, assignee: n, effort: r, capacity: i = 1, viewMode: a = "
|
|
|
3455
3490
|
position: "absolute",
|
|
3456
3491
|
left: 0,
|
|
3457
3492
|
right: 0,
|
|
3458
|
-
top:
|
|
3493
|
+
top: 7 + t,
|
|
3459
3494
|
borderTop: "1px dashed hsl(var(--muted-foreground) / 0.6)",
|
|
3460
3495
|
pointerEvents: "none",
|
|
3461
3496
|
zIndex: 1
|
|
3462
3497
|
}
|
|
3463
3498
|
}), e.cells.map((t, n) => {
|
|
3464
|
-
let r = Math.max(t.load > 0 ? 2 : 0,
|
|
3499
|
+
let r = Math.max(t.load > 0 ? 2 : 0, xt * Math.min(t.load / m, 1));
|
|
3465
3500
|
return /* @__PURE__ */ k("div", {
|
|
3466
3501
|
"data-testid": `resource-cell-${e.key}-${n}`,
|
|
3467
3502
|
"data-load": t.load,
|
|
@@ -3475,7 +3510,7 @@ function St({ tasks: t, assignee: n, effort: r, capacity: i = 1, viewMode: a = "
|
|
|
3475
3510
|
display: "flex",
|
|
3476
3511
|
alignItems: "flex-end",
|
|
3477
3512
|
justifyContent: "center",
|
|
3478
|
-
paddingBottom:
|
|
3513
|
+
paddingBottom: 7
|
|
3479
3514
|
},
|
|
3480
3515
|
children: t.load > 0 && /* @__PURE__ */ k("div", { style: {
|
|
3481
3516
|
width: d - 6,
|
|
@@ -3501,7 +3536,7 @@ function St({ tasks: t, assignee: n, effort: r, capacity: i = 1, viewMode: a = "
|
|
|
3501
3536
|
}
|
|
3502
3537
|
//#endregion
|
|
3503
3538
|
//#region src/QuickFilterBar.tsx
|
|
3504
|
-
var
|
|
3539
|
+
var Tt = {
|
|
3505
3540
|
display: "flex",
|
|
3506
3541
|
flexWrap: "wrap",
|
|
3507
3542
|
alignItems: "center",
|
|
@@ -3510,7 +3545,7 @@ var Ct = {
|
|
|
3510
3545
|
borderBottom: "1px solid hsl(var(--border))",
|
|
3511
3546
|
background: "hsl(var(--background))",
|
|
3512
3547
|
fontSize: 13
|
|
3513
|
-
},
|
|
3548
|
+
}, Et = {
|
|
3514
3549
|
display: "inline-flex",
|
|
3515
3550
|
alignItems: "center",
|
|
3516
3551
|
gap: 6,
|
|
@@ -3523,7 +3558,7 @@ var Ct = {
|
|
|
3523
3558
|
cursor: "pointer",
|
|
3524
3559
|
whiteSpace: "nowrap",
|
|
3525
3560
|
lineHeight: "28px"
|
|
3526
|
-
},
|
|
3561
|
+
}, V = {
|
|
3527
3562
|
position: "absolute",
|
|
3528
3563
|
top: "calc(100% + 4px)",
|
|
3529
3564
|
left: 0,
|
|
@@ -3537,7 +3572,7 @@ var Ct = {
|
|
|
3537
3572
|
background: "hsl(var(--popover, var(--background)))",
|
|
3538
3573
|
color: "hsl(var(--popover-foreground, var(--foreground)))",
|
|
3539
3574
|
boxShadow: "0 8px 24px rgba(0,0,0,0.18)"
|
|
3540
|
-
},
|
|
3575
|
+
}, Dt = {
|
|
3541
3576
|
display: "flex",
|
|
3542
3577
|
alignItems: "center",
|
|
3543
3578
|
gap: 8,
|
|
@@ -3546,7 +3581,7 @@ var Ct = {
|
|
|
3546
3581
|
cursor: "pointer",
|
|
3547
3582
|
userSelect: "none"
|
|
3548
3583
|
};
|
|
3549
|
-
function
|
|
3584
|
+
function Ot({ checked: e }) {
|
|
3550
3585
|
return /* @__PURE__ */ k("span", {
|
|
3551
3586
|
"aria-hidden": !0,
|
|
3552
3587
|
style: {
|
|
@@ -3566,7 +3601,7 @@ function Et({ checked: e }) {
|
|
|
3566
3601
|
children: e ? "✓" : ""
|
|
3567
3602
|
});
|
|
3568
3603
|
}
|
|
3569
|
-
function
|
|
3604
|
+
function kt({ filter: e, selected: t, onChange: n, labels: i }) {
|
|
3570
3605
|
let [s, c] = o(!1), l = a(null);
|
|
3571
3606
|
r(() => {
|
|
3572
3607
|
if (!s) return;
|
|
@@ -3592,7 +3627,7 @@ function Dt({ filter: e, selected: t, onChange: n, labels: i }) {
|
|
|
3592
3627
|
children: [/* @__PURE__ */ A("button", {
|
|
3593
3628
|
type: "button",
|
|
3594
3629
|
style: {
|
|
3595
|
-
...
|
|
3630
|
+
...Et,
|
|
3596
3631
|
borderColor: d > 0 ? "hsl(var(--primary))" : "hsl(var(--border))",
|
|
3597
3632
|
color: d > 0 ? "hsl(var(--primary))" : "hsl(var(--foreground))"
|
|
3598
3633
|
},
|
|
@@ -3610,26 +3645,26 @@ function Dt({ filter: e, selected: t, onChange: n, labels: i }) {
|
|
|
3610
3645
|
})]
|
|
3611
3646
|
}), s && /* @__PURE__ */ k("div", {
|
|
3612
3647
|
role: "listbox",
|
|
3613
|
-
style:
|
|
3648
|
+
style: V,
|
|
3614
3649
|
"data-testid": `quick-filter-panel-${e.field}`,
|
|
3615
3650
|
children: e.options.length === 0 ? /* @__PURE__ */ k("div", {
|
|
3616
3651
|
style: {
|
|
3617
|
-
...
|
|
3652
|
+
...Dt,
|
|
3618
3653
|
cursor: "default",
|
|
3619
3654
|
opacity: .6
|
|
3620
3655
|
},
|
|
3621
3656
|
children: i.empty
|
|
3622
|
-
}) : /* @__PURE__ */ A(
|
|
3657
|
+
}) : /* @__PURE__ */ A(Ne, { children: [
|
|
3623
3658
|
/* @__PURE__ */ A("div", {
|
|
3624
3659
|
role: "option",
|
|
3625
3660
|
"aria-selected": f,
|
|
3626
3661
|
style: {
|
|
3627
|
-
...
|
|
3662
|
+
...Dt,
|
|
3628
3663
|
fontWeight: 600
|
|
3629
3664
|
},
|
|
3630
3665
|
"data-testid": `quick-filter-all-${e.field}`,
|
|
3631
3666
|
onClick: () => m(),
|
|
3632
|
-
children: [/* @__PURE__ */ k(
|
|
3667
|
+
children: [/* @__PURE__ */ k(Ot, { checked: f }), /* @__PURE__ */ k("span", { children: i.all })]
|
|
3633
3668
|
}),
|
|
3634
3669
|
/* @__PURE__ */ k("div", { style: {
|
|
3635
3670
|
height: 1,
|
|
@@ -3642,27 +3677,27 @@ function Dt({ filter: e, selected: t, onChange: n, labels: i }) {
|
|
|
3642
3677
|
role: "option",
|
|
3643
3678
|
"aria-selected": n,
|
|
3644
3679
|
style: {
|
|
3645
|
-
...
|
|
3680
|
+
...Dt,
|
|
3646
3681
|
background: n ? "hsl(var(--accent, var(--muted)))" : "transparent"
|
|
3647
3682
|
},
|
|
3648
3683
|
"data-testid": `quick-filter-option-${e.field}-${t.value}`,
|
|
3649
3684
|
onClick: () => p(t.value),
|
|
3650
|
-
children: [/* @__PURE__ */ k(
|
|
3685
|
+
children: [/* @__PURE__ */ k(Ot, { checked: n }), /* @__PURE__ */ k("span", { children: t.label })]
|
|
3651
3686
|
}, t.value);
|
|
3652
3687
|
})
|
|
3653
3688
|
] })
|
|
3654
3689
|
})]
|
|
3655
3690
|
});
|
|
3656
3691
|
}
|
|
3657
|
-
var
|
|
3692
|
+
var At = ({ filters: e, value: t, onChange: n, onClear: r, resultCount: i, totalCount: a, labels: o, className: s }) => {
|
|
3658
3693
|
if (!e.length) return null;
|
|
3659
3694
|
let c = o?.all ?? "All", l = o?.empty ?? "No options", u = o?.clear ?? "Clear", d = e.some((e) => (t[e.field]?.length ?? 0) > 0);
|
|
3660
3695
|
return /* @__PURE__ */ A("div", {
|
|
3661
|
-
style:
|
|
3696
|
+
style: Tt,
|
|
3662
3697
|
className: s,
|
|
3663
3698
|
"data-testid": "quick-filter-bar",
|
|
3664
3699
|
children: [
|
|
3665
|
-
e.map((e) => /* @__PURE__ */ k(
|
|
3700
|
+
e.map((e) => /* @__PURE__ */ k(kt, {
|
|
3666
3701
|
filter: e,
|
|
3667
3702
|
selected: t[e.field] ?? [],
|
|
3668
3703
|
onChange: (t) => n(e.field, t),
|
|
@@ -3674,7 +3709,7 @@ var Ot = ({ filters: e, value: t, onChange: n, onClear: r, resultCount: i, total
|
|
|
3674
3709
|
d && /* @__PURE__ */ k("button", {
|
|
3675
3710
|
type: "button",
|
|
3676
3711
|
style: {
|
|
3677
|
-
...
|
|
3712
|
+
...Et,
|
|
3678
3713
|
height: 28,
|
|
3679
3714
|
color: "hsl(var(--muted-foreground))"
|
|
3680
3715
|
},
|
|
@@ -3695,7 +3730,7 @@ var Ot = ({ filters: e, value: t, onChange: n, onClear: r, resultCount: i, total
|
|
|
3695
3730
|
};
|
|
3696
3731
|
//#endregion
|
|
3697
3732
|
//#region src/ObjectGantt.tsx
|
|
3698
|
-
function
|
|
3733
|
+
function jt(e) {
|
|
3699
3734
|
if (e == null) return;
|
|
3700
3735
|
let t = String(e).toLowerCase().trim();
|
|
3701
3736
|
if (t === "milestone") return "milestone";
|
|
@@ -3703,7 +3738,7 @@ function kt(e) {
|
|
|
3703
3738
|
if (t === "summary" || t === "project" || t === "phase") return "summary";
|
|
3704
3739
|
if (t === "task") return "task";
|
|
3705
3740
|
}
|
|
3706
|
-
var
|
|
3741
|
+
var Mt = {
|
|
3707
3742
|
fs: "fs",
|
|
3708
3743
|
ss: "ss",
|
|
3709
3744
|
ff: "ff",
|
|
@@ -3716,24 +3751,26 @@ var At = {
|
|
|
3716
3751
|
end_to_end: "ff",
|
|
3717
3752
|
start_to_end: "sf"
|
|
3718
3753
|
};
|
|
3719
|
-
function
|
|
3754
|
+
function Nt(e) {
|
|
3720
3755
|
if (e == null || e === "") return [];
|
|
3721
3756
|
if (typeof e == "string") return e.split(",").map((e) => e.trim()).filter(Boolean);
|
|
3722
3757
|
if (typeof e == "number") return [e];
|
|
3723
3758
|
if (!Array.isArray(e)) return [];
|
|
3724
3759
|
let t = [];
|
|
3725
|
-
for (let n of e) if (
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3760
|
+
for (let n of e) if (n != null && n !== "") {
|
|
3761
|
+
if (typeof n == "object") {
|
|
3762
|
+
let e = n.id ?? n._id ?? n.task ?? n.target;
|
|
3763
|
+
if (e == null || e === "") continue;
|
|
3764
|
+
let r = Mt[String(n.type ?? "").toLowerCase().replace(/-/g, "_")];
|
|
3765
|
+
t.push(r ? {
|
|
3766
|
+
id: e,
|
|
3767
|
+
type: r
|
|
3768
|
+
} : { id: e });
|
|
3769
|
+
} else t.push(n);
|
|
3770
|
+
}
|
|
3734
3771
|
return t;
|
|
3735
3772
|
}
|
|
3736
|
-
function
|
|
3773
|
+
function Pt(e) {
|
|
3737
3774
|
return e.data ? e.data : e.staticData ? {
|
|
3738
3775
|
provider: "value",
|
|
3739
3776
|
items: e.staticData
|
|
@@ -3742,7 +3779,7 @@ function Mt(e) {
|
|
|
3742
3779
|
object: e.objectName
|
|
3743
3780
|
} : null;
|
|
3744
3781
|
}
|
|
3745
|
-
function
|
|
3782
|
+
function H(e) {
|
|
3746
3783
|
if (e) {
|
|
3747
3784
|
if (typeof e == "string") {
|
|
3748
3785
|
let t = e.split(" "), n = t[0], r = t[1]?.toLowerCase() === "desc" ? "desc" : "asc";
|
|
@@ -3751,7 +3788,7 @@ function Nt(e) {
|
|
|
3751
3788
|
if (Array.isArray(e)) return e.reduce((e, t) => (t.field && t.order && (e[t.field] = t.order), e), {});
|
|
3752
3789
|
}
|
|
3753
3790
|
}
|
|
3754
|
-
function
|
|
3791
|
+
function Ft(e) {
|
|
3755
3792
|
let t = e instanceof Error ? e.message : String(e ?? ""), n = t.indexOf("{");
|
|
3756
3793
|
if (n >= 0) try {
|
|
3757
3794
|
let e = JSON.parse(t.slice(n)), r = e?.message ?? e?.error;
|
|
@@ -3759,7 +3796,7 @@ function H(e) {
|
|
|
3759
3796
|
} catch {}
|
|
3760
3797
|
return null;
|
|
3761
3798
|
}
|
|
3762
|
-
function
|
|
3799
|
+
function It(e) {
|
|
3763
3800
|
let t = null;
|
|
3764
3801
|
if (e.startDateField && e.endDateField) return t = {
|
|
3765
3802
|
startDateField: e.startDateField,
|
|
@@ -3792,58 +3829,58 @@ function Pt(e) {
|
|
|
3792
3829
|
dependencyTypes: e.dependencyTypes
|
|
3793
3830
|
}, t;
|
|
3794
3831
|
if (e.gantt && (t = e.gantt), t) {
|
|
3795
|
-
let e =
|
|
3832
|
+
let e = te.safeParse(t);
|
|
3796
3833
|
return e.success || console.warn("[ObjectGantt] Invalid gantt configuration:", e.error.format()), t;
|
|
3797
3834
|
}
|
|
3798
3835
|
return null;
|
|
3799
3836
|
}
|
|
3800
|
-
var
|
|
3801
|
-
let [
|
|
3802
|
-
|
|
3803
|
-
}, [
|
|
3837
|
+
var Lt = ({ schema: e, dataSource: s, className: f, onTaskClick: h, onRowClick: g, onBeforeTaskUpdate: te, ...y }) => {
|
|
3838
|
+
let [b, be] = o([]), [xe, Se] = o(!0), [Ce, we] = o(null), [C, Te] = o(null), { currency: Ee } = v(), De = _(), { t: w } = Ye(), Oe = t((e) => {
|
|
3839
|
+
ee.error(w("gantt.writeFailed"), { description: Ft(e) ?? void 0 });
|
|
3840
|
+
}, [w]), ke = Pt(e), T = i(() => ke, [JSON.stringify(ke)]), E = It(e), Ae = T?.provider === "value", je = n(p)?.apiFetch, D = i(() => d(T, s ?? null, { fetch: je }), [
|
|
3804
3841
|
T,
|
|
3805
3842
|
s,
|
|
3806
|
-
|
|
3807
|
-
]), O = T?.provider === "object" ? T.object : e.objectName ?? "", [
|
|
3843
|
+
je
|
|
3844
|
+
]), O = T?.provider === "object" ? T.object : e.objectName ?? "", [Me, Ne] = o(!1), j = a(0), M = t(async ({ silent: t = !1 } = {}) => {
|
|
3808
3845
|
let n = ++j.current, r = () => j.current === n;
|
|
3809
3846
|
try {
|
|
3810
|
-
if (t ?
|
|
3811
|
-
r() &&
|
|
3847
|
+
if (t ? Ne(!0) : Se(!0), y.data && Array.isArray(y.data)) {
|
|
3848
|
+
r() && be(y.data);
|
|
3812
3849
|
return;
|
|
3813
3850
|
}
|
|
3814
|
-
if (
|
|
3815
|
-
r() &&
|
|
3851
|
+
if (Ae && T?.provider === "value") {
|
|
3852
|
+
r() && be(T.items);
|
|
3816
3853
|
return;
|
|
3817
3854
|
}
|
|
3818
3855
|
if (!D || typeof D.find != "function") throw Error("DataSource required for object/api providers");
|
|
3819
|
-
let n = c(
|
|
3856
|
+
let n = c(C?.fields), i = await D.find(O, {
|
|
3820
3857
|
$filter: e.filter,
|
|
3821
|
-
$orderby:
|
|
3858
|
+
$orderby: H(e.sort),
|
|
3822
3859
|
...n.length > 0 ? { $expand: n } : {}
|
|
3823
3860
|
});
|
|
3824
|
-
r() &&
|
|
3861
|
+
r() && be(l(i));
|
|
3825
3862
|
} catch (e) {
|
|
3826
|
-
t ? console.error("[ObjectGantt] Failed to refresh data:", e) : r() &&
|
|
3863
|
+
t ? console.error("[ObjectGantt] Failed to refresh data:", e) : r() && we(e);
|
|
3827
3864
|
} finally {
|
|
3828
|
-
t ?
|
|
3865
|
+
t ? Ne(!1) : Se(!1);
|
|
3829
3866
|
}
|
|
3830
3867
|
}, [
|
|
3831
3868
|
D,
|
|
3832
3869
|
O,
|
|
3833
|
-
|
|
3870
|
+
Ae,
|
|
3834
3871
|
T,
|
|
3835
3872
|
e.filter,
|
|
3836
3873
|
e.sort,
|
|
3837
|
-
|
|
3874
|
+
C
|
|
3838
3875
|
]);
|
|
3839
3876
|
r(() => {
|
|
3840
3877
|
M();
|
|
3841
3878
|
}, [M]), r(() => {
|
|
3842
|
-
!
|
|
3879
|
+
!Ae && D && (async () => {
|
|
3843
3880
|
try {
|
|
3844
3881
|
if (!D || !O) return;
|
|
3845
3882
|
let e = await D.getObjectSchema(O);
|
|
3846
|
-
|
|
3883
|
+
Te(e);
|
|
3847
3884
|
} catch (e) {
|
|
3848
3885
|
console.error("Failed to fetch object schema:", e);
|
|
3849
3886
|
}
|
|
@@ -3851,12 +3888,12 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
3851
3888
|
}, [
|
|
3852
3889
|
O,
|
|
3853
3890
|
D,
|
|
3854
|
-
|
|
3891
|
+
Ae,
|
|
3855
3892
|
T
|
|
3856
3893
|
]);
|
|
3857
3894
|
let N = i(() => {
|
|
3858
|
-
if (!E || !
|
|
3859
|
-
let { startDateField: e, endDateField: t, titleField: n, progressField: r, dependenciesField: i, colorField: a, borderColorField: o, parentField: s, typeField: c, lockField: l, tooltipFields: d, baselineStartField: f, baselineEndField: p, quickFilters: m } = E, h =
|
|
3895
|
+
if (!E || !b.length) return [];
|
|
3896
|
+
let { startDateField: e, endDateField: t, titleField: n, progressField: r, dependenciesField: i, colorField: a, borderColorField: o, parentField: s, typeField: c, lockField: l, tooltipFields: d, baselineStartField: f, baselineEndField: p, quickFilters: m } = E, h = C?.fields ?? {}, g = /* @__PURE__ */ new Map();
|
|
3860
3897
|
for (let e of m ?? []) {
|
|
3861
3898
|
if (!e?.field || !Array.isArray(e.options) || !e.options.length) continue;
|
|
3862
3899
|
let t = /* @__PURE__ */ new Map();
|
|
@@ -3871,7 +3908,7 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
3871
3908
|
r = r[e];
|
|
3872
3909
|
}
|
|
3873
3910
|
return r;
|
|
3874
|
-
},
|
|
3911
|
+
}, te = (e) => {
|
|
3875
3912
|
let t = [
|
|
3876
3913
|
ee(e, n),
|
|
3877
3914
|
e?.account?.name,
|
|
@@ -3879,12 +3916,12 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
3879
3916
|
e?.contact && [e.contact.first_name, e.contact.last_name].filter(Boolean).join(" ")
|
|
3880
3917
|
];
|
|
3881
3918
|
for (let e of t) if (e != null && String(e).trim() !== "") return String(e);
|
|
3882
|
-
return u(
|
|
3883
|
-
},
|
|
3919
|
+
return u(C, e);
|
|
3920
|
+
}, _ = (e, t) => {
|
|
3884
3921
|
if (t) return t;
|
|
3885
3922
|
let n = h[e] ?? h[e.split(".")[0]];
|
|
3886
|
-
return n?.label ? n.label :
|
|
3887
|
-
},
|
|
3923
|
+
return n?.label ? n.label : S(e);
|
|
3924
|
+
}, v = (e, t) => {
|
|
3888
3925
|
if (e == null || e === "") return "—";
|
|
3889
3926
|
let n = h[t] ?? h[t.split(".")[0]], r = n?.type, i = n?.options;
|
|
3890
3927
|
if (Array.isArray(i) && i.length) {
|
|
@@ -3896,18 +3933,18 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
3896
3933
|
if (n != null) return n;
|
|
3897
3934
|
}
|
|
3898
3935
|
if (r == null && typeof e == "string") {
|
|
3899
|
-
if (/^\d{4}-\d{2}-\d{2}$/.test(e)) return
|
|
3900
|
-
if (/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}/.test(e) && !isNaN(new Date(e).getTime())) return
|
|
3936
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(e)) return he(e, void 0, { locale: De });
|
|
3937
|
+
if (/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}/.test(e) && !isNaN(new Date(e).getTime())) return ge(e, { locale: De });
|
|
3901
3938
|
}
|
|
3902
3939
|
switch (r) {
|
|
3903
|
-
case "date": return
|
|
3904
|
-
case "datetime": return
|
|
3940
|
+
case "date": return he(e, void 0, { locale: De });
|
|
3941
|
+
case "datetime": return ge(e, { locale: De });
|
|
3905
3942
|
case "number":
|
|
3906
3943
|
case "integer":
|
|
3907
3944
|
case "float":
|
|
3908
|
-
case "decimal": return
|
|
3909
|
-
case "currency": return
|
|
3910
|
-
case "percent": return
|
|
3945
|
+
case "decimal": return _e(Number(e), void 0, De);
|
|
3946
|
+
case "currency": return me(Number(e), ne(n, Ee), De);
|
|
3947
|
+
case "percent": return ve(Number(e), void 0, De);
|
|
3911
3948
|
case "boolean":
|
|
3912
3949
|
case "checkbox": return e ? "Yes" : "No";
|
|
3913
3950
|
default:
|
|
@@ -3936,49 +3973,51 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
3936
3973
|
if (!r) continue;
|
|
3937
3974
|
let i = typeof n == "object" ? n.label : void 0, a = ee(e, r);
|
|
3938
3975
|
a == null || a === "" || Array.isArray(a) && a.length === 0 || t.push({
|
|
3939
|
-
label:
|
|
3940
|
-
value:
|
|
3976
|
+
label: _(r, i),
|
|
3977
|
+
value: v(a, r)
|
|
3941
3978
|
});
|
|
3942
3979
|
}
|
|
3943
3980
|
return t.length ? t : void 0;
|
|
3944
3981
|
};
|
|
3945
|
-
return
|
|
3946
|
-
let d = n[e], m = n[t], h = f ? n[f] : void 0, g = p ? n[p] : void 0, ee = h ? new Date(h) : void 0,
|
|
3982
|
+
return b.map((n, u) => {
|
|
3983
|
+
let d = n[e], m = n[t], h = f ? n[f] : void 0, g = p ? n[p] : void 0, ee = h ? new Date(h) : void 0, ne = g ? new Date(g) : void 0, _ = te(n), v = r ? n[r] : 0, ie = i ? n[i] : [], ae = a ? n[a] : void 0;
|
|
3947
3984
|
if (!ae) {
|
|
3948
3985
|
let e = n.status ?? n.state ?? n.priority ?? n.severity;
|
|
3949
3986
|
if (e != null && e !== "") {
|
|
3950
|
-
let t =
|
|
3951
|
-
t && (ae =
|
|
3987
|
+
let t = ye(void 0, e);
|
|
3988
|
+
t && (ae = x(t));
|
|
3952
3989
|
}
|
|
3953
3990
|
}
|
|
3954
|
-
let oe = o ? n[o] : void 0, se = oe != null && oe !== "" ?
|
|
3991
|
+
let oe = o ? n[o] : void 0, se = oe != null && oe !== "" ? x(String(oe), String(oe)) : void 0;
|
|
3955
3992
|
return {
|
|
3956
3993
|
id: n.id || n._id || `task-${u}`,
|
|
3957
|
-
title:
|
|
3994
|
+
title: _,
|
|
3958
3995
|
start: d ? new Date(d) : /* @__PURE__ */ new Date(),
|
|
3959
3996
|
end: m ? new Date(m) : /* @__PURE__ */ new Date(),
|
|
3960
3997
|
hasOwnDates: !!(d && m),
|
|
3961
|
-
progress: Math.min(100, Math.max(0,
|
|
3962
|
-
dependencies:
|
|
3998
|
+
progress: Math.min(100, Math.max(0, v || 0)),
|
|
3999
|
+
dependencies: Nt(ie),
|
|
3963
4000
|
parent: s ? n[s] ?? null : void 0,
|
|
3964
|
-
type: c ?
|
|
4001
|
+
type: c ? jt(n[c]) : void 0,
|
|
3965
4002
|
locked: l ? !!n[l] : void 0,
|
|
3966
4003
|
color: ae,
|
|
3967
4004
|
borderColor: se,
|
|
3968
4005
|
baselineStart: ee && !isNaN(ee.getTime()) ? ee : void 0,
|
|
3969
|
-
baselineEnd:
|
|
4006
|
+
baselineEnd: ne && !isNaN(ne.getTime()) ? ne : void 0,
|
|
3970
4007
|
fields: re(n),
|
|
3971
4008
|
data: n
|
|
3972
4009
|
};
|
|
3973
4010
|
}).filter((e) => !isNaN(e.start.getTime()) && !isNaN(e.end.getTime()));
|
|
3974
4011
|
}, [
|
|
3975
|
-
|
|
4012
|
+
b,
|
|
3976
4013
|
E,
|
|
3977
|
-
|
|
3978
|
-
|
|
4014
|
+
C,
|
|
4015
|
+
De,
|
|
4016
|
+
Ee
|
|
4017
|
+
]), P = i(() => {
|
|
3979
4018
|
let e = E?.groupByField;
|
|
3980
4019
|
if (!e) return;
|
|
3981
|
-
let t =
|
|
4020
|
+
let t = C?.fields ?? {}, n = (e, t) => {
|
|
3982
4021
|
if (!t) return;
|
|
3983
4022
|
let n = e;
|
|
3984
4023
|
for (let e of t.split(".")) {
|
|
@@ -4005,10 +4044,10 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
4005
4044
|
label: r(i)
|
|
4006
4045
|
};
|
|
4007
4046
|
};
|
|
4008
|
-
}, [E?.groupByField,
|
|
4047
|
+
}, [E?.groupByField, C]), Pe = i(() => {
|
|
4009
4048
|
let e = E?.assigneeField;
|
|
4010
4049
|
if (!e) return;
|
|
4011
|
-
let t =
|
|
4050
|
+
let t = C?.fields ?? {}, n = (e, t) => {
|
|
4012
4051
|
if (!t) return;
|
|
4013
4052
|
let n = e;
|
|
4014
4053
|
for (let e of t.split(".")) {
|
|
@@ -4035,19 +4074,19 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
4035
4074
|
label: r(i)
|
|
4036
4075
|
};
|
|
4037
4076
|
};
|
|
4038
|
-
}, [E?.assigneeField,
|
|
4077
|
+
}, [E?.assigneeField, C]), F = i(() => {
|
|
4039
4078
|
let e = E?.effortField;
|
|
4040
4079
|
if (e) return (t) => {
|
|
4041
4080
|
let n = t.data?.[e], r = Number(n);
|
|
4042
4081
|
return Number.isFinite(r) && r > 0 ? r : 1;
|
|
4043
4082
|
};
|
|
4044
|
-
}, [E?.effortField]),
|
|
4083
|
+
}, [E?.effortField]), Fe = i(() => {
|
|
4045
4084
|
let t = e.skipWeekends, n = e.holidays;
|
|
4046
4085
|
if (!(!t && (!n || n.length === 0))) return {
|
|
4047
4086
|
skipWeekends: !!t,
|
|
4048
4087
|
holidays: n && n.length ? new Set(n) : void 0
|
|
4049
4088
|
};
|
|
4050
|
-
}, [e]),
|
|
4089
|
+
}, [e]), Ie = i(() => Ke(E?.timeSegments), [E?.timeSegments]), I = t((e, t) => {
|
|
4051
4090
|
if (!e || !t) return null;
|
|
4052
4091
|
let n = e;
|
|
4053
4092
|
for (let e of t.split(".")) {
|
|
@@ -4060,20 +4099,20 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
4060
4099
|
return String(e.id ?? e._id ?? e.value ?? e.name ?? "");
|
|
4061
4100
|
}
|
|
4062
4101
|
return String(n);
|
|
4063
|
-
}, []),
|
|
4102
|
+
}, []), Le = E?.quickFilters, [Re, ze] = o({});
|
|
4064
4103
|
r(() => {
|
|
4065
|
-
if (!
|
|
4066
|
-
let e =
|
|
4104
|
+
if (!Le?.length || !s || typeof s.find != "function") return;
|
|
4105
|
+
let e = C?.fields ?? {}, t = !1;
|
|
4067
4106
|
return (async () => {
|
|
4068
4107
|
let n = {};
|
|
4069
|
-
for (let t of
|
|
4108
|
+
for (let t of Le) {
|
|
4070
4109
|
if (t.options) continue;
|
|
4071
4110
|
let r = e[t.field] ?? e[t.field.split(".")[0]], i = r?.type;
|
|
4072
4111
|
if (i !== "lookup" && i !== "master_detail") continue;
|
|
4073
4112
|
let a = r?.reference_to ?? r?.reference ?? r?.referenceTo;
|
|
4074
4113
|
if (a) try {
|
|
4075
|
-
let e =
|
|
4076
|
-
n[t.field] =
|
|
4114
|
+
let e = await s.find(a, { $top: 1e3 }), r = l(e);
|
|
4115
|
+
n[t.field] = r.map((e) => ({
|
|
4077
4116
|
value: String(e.id ?? e._id ?? e.value ?? ""),
|
|
4078
4117
|
label: String(e.name ?? e.label ?? e.title ?? e.id ?? e._id ?? "")
|
|
4079
4118
|
}));
|
|
@@ -4081,7 +4120,7 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
4081
4120
|
console.warn(`[ObjectGantt] Failed to load quick-filter options for "${t.field}":`, e);
|
|
4082
4121
|
}
|
|
4083
4122
|
}
|
|
4084
|
-
t ||
|
|
4123
|
+
t || ze((e) => ({
|
|
4085
4124
|
...e,
|
|
4086
4125
|
...n
|
|
4087
4126
|
}));
|
|
@@ -4089,15 +4128,15 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
4089
4128
|
t = !0;
|
|
4090
4129
|
};
|
|
4091
4130
|
}, [
|
|
4092
|
-
JSON.stringify(
|
|
4131
|
+
JSON.stringify(Le),
|
|
4093
4132
|
s,
|
|
4094
|
-
|
|
4133
|
+
C
|
|
4095
4134
|
]);
|
|
4096
|
-
let
|
|
4097
|
-
if (!
|
|
4098
|
-
let e =
|
|
4099
|
-
return
|
|
4100
|
-
let n = e[t.field] ?? e[t.field.split(".")[0]], r = t.label ?? n?.label ??
|
|
4135
|
+
let L = i(() => {
|
|
4136
|
+
if (!Le?.length) return [];
|
|
4137
|
+
let e = C?.fields ?? {};
|
|
4138
|
+
return Le.map((t) => {
|
|
4139
|
+
let n = e[t.field] ?? e[t.field.split(".")[0]], r = t.label ?? n?.label ?? S(t.field), i;
|
|
4101
4140
|
if (t.options?.length) i = t.options.map((e) => typeof e == "object" ? {
|
|
4102
4141
|
value: String(e.value),
|
|
4103
4142
|
label: String(e.label ?? e.value)
|
|
@@ -4109,10 +4148,10 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
4109
4148
|
value: String(e.value ?? e),
|
|
4110
4149
|
label: String(e.label ?? e.value ?? e)
|
|
4111
4150
|
}));
|
|
4112
|
-
else if (
|
|
4151
|
+
else if (Re[t.field]?.length) i = Re[t.field];
|
|
4113
4152
|
else {
|
|
4114
4153
|
let e = /* @__PURE__ */ new Map();
|
|
4115
|
-
for (let n of
|
|
4154
|
+
for (let n of b) {
|
|
4116
4155
|
let r = I(n, t.field);
|
|
4117
4156
|
if (r != null && !e.has(r)) {
|
|
4118
4157
|
let i = n;
|
|
@@ -4133,15 +4172,15 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
4133
4172
|
};
|
|
4134
4173
|
});
|
|
4135
4174
|
}, [
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4175
|
+
Le,
|
|
4176
|
+
C,
|
|
4177
|
+
Re,
|
|
4178
|
+
b,
|
|
4140
4179
|
I
|
|
4141
|
-
]),
|
|
4142
|
-
if (!
|
|
4180
|
+
]), Be = e.persistLayout === !1 ? void 0 : `${e.objectName || (T?.provider === "object" ? T.object : "") || "gantt"}:${e.viewName || "default"}`, Ve = Be ? `gantt-layout:${Be}:filters` : null, [He, Ue] = o(() => {
|
|
4181
|
+
if (!Ve || typeof window > "u") return {};
|
|
4143
4182
|
try {
|
|
4144
|
-
let e = JSON.parse(window.localStorage.getItem(
|
|
4183
|
+
let e = JSON.parse(window.localStorage.getItem(Ve) || "null");
|
|
4145
4184
|
if (!e || typeof e != "object" || Array.isArray(e)) return {};
|
|
4146
4185
|
let t = {};
|
|
4147
4186
|
for (let [n, r] of Object.entries(e)) Array.isArray(r) && (t[n] = r.filter((e) => typeof e == "string"));
|
|
@@ -4149,26 +4188,26 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
4149
4188
|
} catch {
|
|
4150
4189
|
return {};
|
|
4151
4190
|
}
|
|
4152
|
-
}),
|
|
4153
|
-
if (!(!
|
|
4154
|
-
window.localStorage.setItem(
|
|
4191
|
+
}), We = t(() => {
|
|
4192
|
+
if (!(!Ve || typeof window > "u")) try {
|
|
4193
|
+
window.localStorage.setItem(Ve, JSON.stringify(He));
|
|
4155
4194
|
} catch {}
|
|
4156
|
-
}, [
|
|
4157
|
-
|
|
4195
|
+
}, [Ve, He]), Ge = t((e, t) => {
|
|
4196
|
+
Ue((n) => ({
|
|
4158
4197
|
...n,
|
|
4159
4198
|
[e]: t
|
|
4160
4199
|
}));
|
|
4161
|
-
}, []),
|
|
4200
|
+
}, []), qe = t(() => Ue({}), []), R = t((e) => !!E?.objectField && !String(e?.[E.objectField] ?? "").trim(), [E?.objectField]), Je = t((e) => {
|
|
4162
4201
|
let t = (E?.objectField ? String(e[E.objectField] ?? "").trim() : "") || O, n = e.id ?? e._id;
|
|
4163
4202
|
if (!t || n == null) return null;
|
|
4164
|
-
let r = O ?
|
|
4203
|
+
let r = O ? ie(O, n) : null;
|
|
4165
4204
|
return {
|
|
4166
4205
|
objectName: t,
|
|
4167
4206
|
recordId: n,
|
|
4168
4207
|
href: !O || t === O ? r : r?.replace(`/${O}/record/`, `/${t}/record/`) ?? null
|
|
4169
4208
|
};
|
|
4170
|
-
}, [E?.objectField, O]),
|
|
4171
|
-
let e = Object.entries(
|
|
4209
|
+
}, [E?.objectField, O]), z = i(() => {
|
|
4210
|
+
let e = Object.entries(He).filter(([, e]) => e.length > 0);
|
|
4172
4211
|
if (!e.length) return N;
|
|
4173
4212
|
let t = new Map(N.map((e) => [String(e.id), e])), n = /* @__PURE__ */ new Set();
|
|
4174
4213
|
for (let r of N) {
|
|
@@ -4182,9 +4221,9 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
4182
4221
|
return N.filter((e) => n.has(String(e.id)));
|
|
4183
4222
|
}, [
|
|
4184
4223
|
N,
|
|
4185
|
-
|
|
4224
|
+
He,
|
|
4186
4225
|
I
|
|
4187
|
-
]),
|
|
4226
|
+
]), Xe = i(() => {
|
|
4188
4227
|
if (E?.autoZoomToFilter !== !1 || !N.length) return null;
|
|
4189
4228
|
let e = N[0].start.getTime(), t = N[0].end.getTime();
|
|
4190
4229
|
for (let n of N) e = Math.min(e, n.start.getTime()), t = Math.max(t, n.end.getTime());
|
|
@@ -4192,162 +4231,162 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
4192
4231
|
start: new Date(e),
|
|
4193
4232
|
end: new Date(t)
|
|
4194
4233
|
};
|
|
4195
|
-
}, [N, E?.autoZoomToFilter]),
|
|
4234
|
+
}, [N, E?.autoZoomToFilter]), Ze = e.navigation ?? {
|
|
4196
4235
|
mode: "drawer",
|
|
4197
4236
|
width: "min(960px, 60vw)"
|
|
4198
|
-
},
|
|
4199
|
-
navigation:
|
|
4237
|
+
}, Qe = Ze.mode === "drawer" || Ze.mode === "modal" || Ze.mode === "split" || Ze.mode === "popover", $e = m({
|
|
4238
|
+
navigation: Ze,
|
|
4200
4239
|
objectName: e.objectName,
|
|
4201
|
-
onRowClick:
|
|
4202
|
-
}), [
|
|
4240
|
+
onRowClick: Qe ? void 0 : g
|
|
4241
|
+
}), [et, tt] = o(null), nt = $e.isOverlay && $e.isOpen ? $e.selectedRecord : null;
|
|
4203
4242
|
r(() => {
|
|
4204
|
-
if (!
|
|
4205
|
-
|
|
4243
|
+
if (!nt) {
|
|
4244
|
+
tt(null);
|
|
4206
4245
|
return;
|
|
4207
4246
|
}
|
|
4208
|
-
let e =
|
|
4247
|
+
let e = Je(nt);
|
|
4209
4248
|
if (!e) {
|
|
4210
|
-
|
|
4249
|
+
tt(null);
|
|
4211
4250
|
return;
|
|
4212
4251
|
}
|
|
4213
4252
|
let { objectName: t, recordId: n } = e;
|
|
4214
|
-
if (
|
|
4215
|
-
|
|
4253
|
+
if (T?.provider !== "api" && t === O || !s || typeof s.findOne != "function") {
|
|
4254
|
+
tt(null);
|
|
4216
4255
|
return;
|
|
4217
4256
|
}
|
|
4218
4257
|
let r = `${t}:${n}`, i = !1;
|
|
4219
4258
|
return (async () => {
|
|
4220
4259
|
try {
|
|
4221
4260
|
let [e, a] = await Promise.all([s.findOne(t, String(n)), typeof s.getObjectSchema == "function" ? s.getObjectSchema(t).catch(() => null) : Promise.resolve(null)]);
|
|
4222
|
-
i ||
|
|
4261
|
+
i || tt(e ? {
|
|
4223
4262
|
key: r,
|
|
4224
4263
|
record: e,
|
|
4225
4264
|
schema: a
|
|
4226
4265
|
} : null);
|
|
4227
4266
|
} catch (e) {
|
|
4228
|
-
console.error("[ObjectGantt] Failed to fetch drawer record, falling back to row payload:", e), i ||
|
|
4267
|
+
console.error("[ObjectGantt] Failed to fetch drawer record, falling back to row payload:", e), i || tt(null);
|
|
4229
4268
|
}
|
|
4230
4269
|
})(), () => {
|
|
4231
4270
|
i = !0;
|
|
4232
4271
|
};
|
|
4233
4272
|
}, [
|
|
4234
|
-
|
|
4235
|
-
|
|
4273
|
+
nt,
|
|
4274
|
+
Je,
|
|
4236
4275
|
T?.provider,
|
|
4237
4276
|
O,
|
|
4238
4277
|
s
|
|
4239
4278
|
]);
|
|
4240
|
-
let
|
|
4279
|
+
let rt = t(async (e, t) => {
|
|
4241
4280
|
if (!E || !D || typeof D.update != "function") return;
|
|
4242
4281
|
let { startDateField: n, endDateField: r, titleField: i, progressField: a } = E, o = {};
|
|
4243
4282
|
if (t.start instanceof Date && (o[n] = t.start.toISOString()), t.end instanceof Date && (o[r] = t.end.toISOString()), typeof t.title == "string" && i && (o[i] = t.title), typeof t.progress == "number" && a && (o[a] = t.progress), Object.keys(o).length === 0) return;
|
|
4244
4283
|
let s = e.data?.id ?? e.data?._id ?? e.id;
|
|
4245
4284
|
if (s == null) return;
|
|
4246
|
-
let c =
|
|
4247
|
-
|
|
4285
|
+
let c = b;
|
|
4286
|
+
be((e) => e.map((e) => String(e.id ?? e._id) === String(s) ? {
|
|
4248
4287
|
...e,
|
|
4249
4288
|
...o
|
|
4250
4289
|
} : e));
|
|
4251
4290
|
try {
|
|
4252
4291
|
await D.update(O, String(s), o), M({ silent: !0 });
|
|
4253
4292
|
} catch (e) {
|
|
4254
|
-
console.error("[ObjectGantt] Failed to persist task update:", e),
|
|
4293
|
+
console.error("[ObjectGantt] Failed to persist task update:", e), be(c), Oe(e);
|
|
4255
4294
|
}
|
|
4256
4295
|
}, [
|
|
4257
4296
|
E,
|
|
4258
4297
|
D,
|
|
4259
4298
|
O,
|
|
4260
|
-
|
|
4299
|
+
b,
|
|
4261
4300
|
M,
|
|
4262
|
-
|
|
4263
|
-
]),
|
|
4301
|
+
Oe
|
|
4302
|
+
]), it = (e, t) => {
|
|
4264
4303
|
let n = t.some((e) => typeof e == "object" && e.type && e.type !== "fs");
|
|
4265
4304
|
return !n && typeof e == "string" ? t.map((e) => String(typeof e == "object" ? e.id : e)).join(",") : n ? t.map((e) => typeof e == "object" ? e.type && e.type !== "fs" ? {
|
|
4266
4305
|
id: e.id,
|
|
4267
4306
|
type: e.type
|
|
4268
4307
|
} : e.id : e) : t.map((e) => typeof e == "object" ? e.id : e);
|
|
4269
|
-
},
|
|
4308
|
+
}, at = t(async (e, t, n) => {
|
|
4270
4309
|
let r = E?.dependenciesField;
|
|
4271
4310
|
if (!r || !D || typeof D.update != "function") return;
|
|
4272
|
-
let i =
|
|
4273
|
-
|
|
4311
|
+
let i = it(t, n), a = b;
|
|
4312
|
+
be((t) => t.map((t) => String(t.id ?? t._id) === String(e) ? {
|
|
4274
4313
|
...t,
|
|
4275
4314
|
[r]: i
|
|
4276
4315
|
} : t));
|
|
4277
4316
|
try {
|
|
4278
4317
|
await D.update(O, String(e), { [r]: i }), M({ silent: !0 });
|
|
4279
4318
|
} catch (e) {
|
|
4280
|
-
console.error("[ObjectGantt] Failed to persist dependency:", e),
|
|
4319
|
+
console.error("[ObjectGantt] Failed to persist dependency:", e), be(a), Oe(e);
|
|
4281
4320
|
}
|
|
4282
4321
|
}, [
|
|
4283
4322
|
E,
|
|
4284
4323
|
D,
|
|
4285
4324
|
O,
|
|
4286
|
-
|
|
4325
|
+
b,
|
|
4287
4326
|
M,
|
|
4288
|
-
|
|
4289
|
-
]),
|
|
4327
|
+
Oe
|
|
4328
|
+
]), ot = t(async (e, t, n = "fs") => {
|
|
4290
4329
|
let r = e.data?.id ?? e.data?._id ?? e.id, i = t.data?.id ?? t.data?._id ?? t.id;
|
|
4291
4330
|
if (r == null || i == null) return;
|
|
4292
4331
|
let a = E?.dependenciesField;
|
|
4293
4332
|
if (!a) return;
|
|
4294
|
-
let o =
|
|
4333
|
+
let o = b.find((e) => String(e.id ?? e._id) === String(i))?.[a], s = Nt(o), c = (e) => String(typeof e == "object" ? e.id : e), l = s.find((e) => c(e) === String(r)), u = l && typeof l == "object" ? l.type ?? "fs" : "fs";
|
|
4295
4334
|
if (l && u === n) return;
|
|
4296
4335
|
let d = n === "fs" ? r : {
|
|
4297
4336
|
id: r,
|
|
4298
4337
|
type: n
|
|
4299
4338
|
}, f = l ? s.map((e) => c(e) === String(r) ? d : e) : [...s, d];
|
|
4300
|
-
await
|
|
4339
|
+
await at(i, o, f);
|
|
4301
4340
|
}, [
|
|
4302
4341
|
E,
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
]),
|
|
4342
|
+
b,
|
|
4343
|
+
at
|
|
4344
|
+
]), st = t(async (e, t) => {
|
|
4306
4345
|
let n = e.data?.id ?? e.data?._id ?? e.id, r = t.data?.id ?? t.data?._id ?? t.id;
|
|
4307
4346
|
if (n == null || r == null) return;
|
|
4308
4347
|
let i = E?.dependenciesField;
|
|
4309
4348
|
if (!i) return;
|
|
4310
|
-
let a =
|
|
4311
|
-
c.length !== o.length && await
|
|
4349
|
+
let a = b.find((e) => String(e.id ?? e._id) === String(r))?.[i], o = Nt(a), s = (e) => String(typeof e == "object" ? e.id : e), c = o.filter((e) => s(e) !== String(n));
|
|
4350
|
+
c.length !== o.length && await at(r, a, c);
|
|
4312
4351
|
}, [
|
|
4313
4352
|
E,
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
]), [
|
|
4317
|
-
|
|
4318
|
-
}, []),
|
|
4319
|
-
if (!
|
|
4353
|
+
b,
|
|
4354
|
+
at
|
|
4355
|
+
]), [ct, lt] = o(null), [ut, dt] = o(!1), ft = t((e) => {
|
|
4356
|
+
lt(e);
|
|
4357
|
+
}, []), pt = t(async () => {
|
|
4358
|
+
if (!ct) return;
|
|
4320
4359
|
if (!D?.delete) {
|
|
4321
|
-
|
|
4360
|
+
lt(null);
|
|
4322
4361
|
return;
|
|
4323
4362
|
}
|
|
4324
|
-
let e =
|
|
4363
|
+
let e = ct.data?.id ?? ct.data?._id ?? ct.id;
|
|
4325
4364
|
if (e == null) {
|
|
4326
|
-
|
|
4365
|
+
lt(null);
|
|
4327
4366
|
return;
|
|
4328
4367
|
}
|
|
4329
|
-
|
|
4330
|
-
let t =
|
|
4331
|
-
|
|
4368
|
+
dt(!0);
|
|
4369
|
+
let t = b;
|
|
4370
|
+
be((t) => t.filter((t) => String(t.id ?? t._id) !== String(e)));
|
|
4332
4371
|
try {
|
|
4333
|
-
if (await D.delete(O, String(e)) === !1) throw Error(
|
|
4334
|
-
|
|
4372
|
+
if (await D.delete(O, String(e)) === !1) throw Error(w("gantt.writeFailed"));
|
|
4373
|
+
lt(null), M({ silent: !0 });
|
|
4335
4374
|
} catch (e) {
|
|
4336
|
-
console.error("[ObjectGantt] Failed to delete:", e),
|
|
4375
|
+
console.error("[ObjectGantt] Failed to delete:", e), be(t), lt(null), Oe(e);
|
|
4337
4376
|
} finally {
|
|
4338
|
-
|
|
4377
|
+
dt(!1);
|
|
4339
4378
|
}
|
|
4340
4379
|
}, [
|
|
4341
|
-
|
|
4380
|
+
ct,
|
|
4342
4381
|
D,
|
|
4343
4382
|
O,
|
|
4344
|
-
|
|
4383
|
+
b,
|
|
4345
4384
|
M,
|
|
4346
|
-
|
|
4347
|
-
|
|
4385
|
+
Oe,
|
|
4386
|
+
w
|
|
4348
4387
|
]);
|
|
4349
|
-
return
|
|
4350
|
-
className:
|
|
4388
|
+
return xe ? /* @__PURE__ */ k("div", {
|
|
4389
|
+
className: f,
|
|
4351
4390
|
children: /* @__PURE__ */ k("div", {
|
|
4352
4391
|
className: "flex items-center justify-center h-96",
|
|
4353
4392
|
children: /* @__PURE__ */ k("div", {
|
|
@@ -4355,105 +4394,105 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
4355
4394
|
children: "Loading Gantt chart..."
|
|
4356
4395
|
})
|
|
4357
4396
|
})
|
|
4358
|
-
}) :
|
|
4359
|
-
className:
|
|
4397
|
+
}) : Ce ? /* @__PURE__ */ k("div", {
|
|
4398
|
+
className: f,
|
|
4360
4399
|
children: /* @__PURE__ */ k("div", {
|
|
4361
4400
|
className: "flex items-center justify-center h-96",
|
|
4362
4401
|
children: /* @__PURE__ */ A("div", {
|
|
4363
4402
|
className: "text-destructive",
|
|
4364
|
-
children: ["Error: ",
|
|
4403
|
+
children: ["Error: ", Ce.message]
|
|
4365
4404
|
})
|
|
4366
4405
|
})
|
|
4367
4406
|
}) : E ? /* @__PURE__ */ A("div", {
|
|
4368
|
-
className:
|
|
4407
|
+
className: pe("flex h-full min-h-0 flex-col", f),
|
|
4369
4408
|
children: [
|
|
4370
|
-
|
|
4371
|
-
filters:
|
|
4372
|
-
value:
|
|
4373
|
-
onChange:
|
|
4374
|
-
onClear:
|
|
4375
|
-
resultCount:
|
|
4409
|
+
L.length > 0 && /* @__PURE__ */ k(At, {
|
|
4410
|
+
filters: L,
|
|
4411
|
+
value: He,
|
|
4412
|
+
onChange: Ge,
|
|
4413
|
+
onClear: qe,
|
|
4414
|
+
resultCount: z.length,
|
|
4376
4415
|
totalCount: N.length,
|
|
4377
4416
|
labels: {
|
|
4378
|
-
all: "
|
|
4379
|
-
clear: "
|
|
4380
|
-
empty: "
|
|
4381
|
-
resultSummary: (e, t) =>
|
|
4417
|
+
all: w("gantt.quickFilter.all"),
|
|
4418
|
+
clear: w("gantt.quickFilter.clear"),
|
|
4419
|
+
empty: w("gantt.quickFilter.empty"),
|
|
4420
|
+
resultSummary: (e, t) => w("gantt.quickFilter.resultSummary").replace("{shown}", String(e)).replace("{total}", String(t))
|
|
4382
4421
|
}
|
|
4383
4422
|
}),
|
|
4384
4423
|
/* @__PURE__ */ k("div", {
|
|
4385
4424
|
className: "flex-1 min-h-[420px]",
|
|
4386
|
-
children: E?.resourceView &&
|
|
4387
|
-
tasks:
|
|
4388
|
-
assignee:
|
|
4389
|
-
effort:
|
|
4425
|
+
children: E?.resourceView && Pe ? /* @__PURE__ */ k(wt, {
|
|
4426
|
+
tasks: z,
|
|
4427
|
+
assignee: Pe,
|
|
4428
|
+
effort: F,
|
|
4390
4429
|
capacity: E?.capacity ?? 1,
|
|
4391
4430
|
viewMode: e.viewMode || "day"
|
|
4392
|
-
}) : /* @__PURE__ */ k(
|
|
4393
|
-
tasks:
|
|
4394
|
-
startDate:
|
|
4395
|
-
endDate:
|
|
4431
|
+
}) : /* @__PURE__ */ k(_t, {
|
|
4432
|
+
tasks: z,
|
|
4433
|
+
startDate: Xe?.start,
|
|
4434
|
+
endDate: Xe?.end,
|
|
4396
4435
|
onTaskClick: (e) => {
|
|
4397
|
-
|
|
4436
|
+
R(e.data) || $e.handleClick(e.data), h?.(e.data);
|
|
4398
4437
|
},
|
|
4399
|
-
onTaskUpdate:
|
|
4400
|
-
onTaskDelete:
|
|
4401
|
-
onDependencyCreate: E?.dependenciesField ?
|
|
4402
|
-
onDependencyDelete: E?.dependenciesField ?
|
|
4438
|
+
onTaskUpdate: rt,
|
|
4439
|
+
onTaskDelete: ft,
|
|
4440
|
+
onDependencyCreate: E?.dependenciesField ? ot : void 0,
|
|
4441
|
+
onDependencyDelete: E?.dependenciesField ? st : void 0,
|
|
4403
4442
|
markers: e.markers,
|
|
4404
4443
|
autoSchedule: !!E?.dependenciesField,
|
|
4405
4444
|
rescheduleOnConflict: !!E?.dependenciesField,
|
|
4406
4445
|
criticalPathDefault: !!e.criticalPath,
|
|
4407
|
-
workingCalendar:
|
|
4408
|
-
shiftSegments:
|
|
4446
|
+
workingCalendar: Fe,
|
|
4447
|
+
shiftSegments: Ie,
|
|
4409
4448
|
showBaselines: e.showBaselines !== !1,
|
|
4410
4449
|
readOnly: !!e.readOnly,
|
|
4411
4450
|
mobileReadOnly: e.mobileReadOnly !== !1,
|
|
4412
|
-
persistLayoutKey:
|
|
4413
|
-
onLayoutChange:
|
|
4414
|
-
groupBy:
|
|
4451
|
+
persistLayoutKey: Be,
|
|
4452
|
+
onLayoutChange: Ve ? We : void 0,
|
|
4453
|
+
groupBy: P,
|
|
4415
4454
|
defaultCollapsedDepth: E?.defaultCollapsedDepth,
|
|
4416
4455
|
summaryExtent: E?.summaryExtent,
|
|
4417
4456
|
interactions: E?.interactions,
|
|
4418
4457
|
dependencyTypes: E?.dependencyTypes,
|
|
4419
4458
|
timeZone: E?.timeZone,
|
|
4420
|
-
onBeforeTaskUpdate:
|
|
4421
|
-
exportFileName: String(E?.exportFileName ?? e.label ??
|
|
4459
|
+
onBeforeTaskUpdate: te,
|
|
4460
|
+
exportFileName: String(E?.exportFileName ?? e.label ?? C?.label ?? e.objectName ?? "") || void 0,
|
|
4422
4461
|
inlineEdit: !0,
|
|
4423
4462
|
onRefresh: (T?.provider === "object" || T?.provider === "api") && typeof D?.find == "function" ? () => M({ silent: !0 }) : void 0,
|
|
4424
|
-
refreshing:
|
|
4463
|
+
refreshing: Me
|
|
4425
4464
|
})
|
|
4426
4465
|
}),
|
|
4427
|
-
|
|
4428
|
-
let t =
|
|
4429
|
-
if (!n ||
|
|
4430
|
-
let { objectName: r, recordId: i } = n, a = n.href ?? void 0, o = E?.titleField ? String(t[E.titleField] ??
|
|
4431
|
-
return /* @__PURE__ */ k(
|
|
4466
|
+
$e.isOverlay && $e.isOpen && $e.selectedRecord && (() => {
|
|
4467
|
+
let t = $e.selectedRecord, n = Je(t);
|
|
4468
|
+
if (!n || R(t)) return null;
|
|
4469
|
+
let { objectName: r, recordId: i } = n, a = n.href ?? void 0, o = E?.titleField ? String(t[E.titleField] ?? w("gantt.drawer.fallbackTitle")) : w("gantt.drawer.fallbackTitle"), c = !!e.readOnly || (E?.lockField ? !!t[E.lockField] : !1), l = et?.key === `${r}:${i}` ? et : null, u = l?.record ?? t, d = l?.schema ?? (r === O ? C : void 0), f = l && s ? s : D;
|
|
4470
|
+
return /* @__PURE__ */ k(re, {
|
|
4432
4471
|
open: !0,
|
|
4433
|
-
onClose:
|
|
4472
|
+
onClose: $e.close,
|
|
4434
4473
|
title: o,
|
|
4435
4474
|
record: u,
|
|
4436
4475
|
objectName: r,
|
|
4437
4476
|
recordId: i,
|
|
4438
4477
|
dataSource: f ?? void 0,
|
|
4439
4478
|
objectSchema: d,
|
|
4440
|
-
width:
|
|
4479
|
+
width: $e.width,
|
|
4441
4480
|
fullPageHref: a,
|
|
4442
4481
|
onFieldSave: c ? void 0 : async (e, t) => {
|
|
4443
4482
|
if (f?.update) {
|
|
4444
4483
|
try {
|
|
4445
4484
|
await f.update(r, String(i), { [e]: t });
|
|
4446
4485
|
} catch (e) {
|
|
4447
|
-
let t =
|
|
4486
|
+
let t = Ft(e);
|
|
4448
4487
|
throw t ? Error(t) : e;
|
|
4449
4488
|
}
|
|
4450
|
-
l &&
|
|
4489
|
+
l && tt((n) => n && n.key === l.key ? {
|
|
4451
4490
|
...n,
|
|
4452
4491
|
record: {
|
|
4453
4492
|
...n.record,
|
|
4454
4493
|
[e]: t
|
|
4455
4494
|
}
|
|
4456
|
-
} : n),
|
|
4495
|
+
} : n), be((n) => n.map((n) => String(n.id ?? n._id) === String(i) ? {
|
|
4457
4496
|
...n,
|
|
4458
4497
|
[e]: t
|
|
4459
4498
|
} : n)), M({ silent: !0 });
|
|
@@ -4462,36 +4501,36 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
4462
4501
|
onDelete: c ? void 0 : async () => {
|
|
4463
4502
|
if (D?.delete) {
|
|
4464
4503
|
try {
|
|
4465
|
-
if (await D.delete(r, String(i)) === !1) throw Error(
|
|
4504
|
+
if (await D.delete(r, String(i)) === !1) throw Error(w("gantt.writeFailed"));
|
|
4466
4505
|
} catch (e) {
|
|
4467
|
-
throw
|
|
4506
|
+
throw Oe(e), e;
|
|
4468
4507
|
}
|
|
4469
|
-
|
|
4508
|
+
be((e) => e.filter((e) => String(e.id ?? e._id) !== String(i)));
|
|
4470
4509
|
}
|
|
4471
4510
|
}
|
|
4472
4511
|
});
|
|
4473
4512
|
})(),
|
|
4474
|
-
/* @__PURE__ */ k(
|
|
4475
|
-
open: !!
|
|
4513
|
+
/* @__PURE__ */ k(ae, {
|
|
4514
|
+
open: !!ct,
|
|
4476
4515
|
onOpenChange: (e) => {
|
|
4477
|
-
!e && !
|
|
4516
|
+
!e && !ut && lt(null);
|
|
4478
4517
|
},
|
|
4479
|
-
children: /* @__PURE__ */ A(
|
|
4480
|
-
disabled:
|
|
4481
|
-
children:
|
|
4482
|
-
}), /* @__PURE__ */ k(
|
|
4518
|
+
children: /* @__PURE__ */ A(ce, { children: [/* @__PURE__ */ A(de, { children: [/* @__PURE__ */ k(fe, { children: w("gantt.delete.title") }), /* @__PURE__ */ k(le, { children: ct ? w("gantt.delete.body", { title: ct.title }) : null })] }), /* @__PURE__ */ A(ue, { children: [/* @__PURE__ */ k(se, {
|
|
4519
|
+
disabled: ut,
|
|
4520
|
+
children: w("gantt.delete.cancel")
|
|
4521
|
+
}), /* @__PURE__ */ k(oe, {
|
|
4483
4522
|
onClick: (e) => {
|
|
4484
|
-
e.preventDefault(),
|
|
4523
|
+
e.preventDefault(), pt();
|
|
4485
4524
|
},
|
|
4486
|
-
disabled:
|
|
4525
|
+
disabled: ut,
|
|
4487
4526
|
"data-testid": "gantt-delete-confirm",
|
|
4488
4527
|
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
4489
|
-
children:
|
|
4528
|
+
children: w(ut ? "gantt.delete.deleting" : "gantt.delete.confirm")
|
|
4490
4529
|
})] })] })
|
|
4491
4530
|
})
|
|
4492
4531
|
]
|
|
4493
4532
|
}) : /* @__PURE__ */ k("div", {
|
|
4494
|
-
className:
|
|
4533
|
+
className: f,
|
|
4495
4534
|
children: /* @__PURE__ */ k("div", {
|
|
4496
4535
|
className: "flex items-center justify-center h-96",
|
|
4497
4536
|
children: /* @__PURE__ */ k("div", {
|
|
@@ -4500,14 +4539,24 @@ var Ft = ({ schema: e, dataSource: s, className: m, onTaskClick: h, onRowClick:
|
|
|
4500
4539
|
})
|
|
4501
4540
|
})
|
|
4502
4541
|
});
|
|
4503
|
-
},
|
|
4504
|
-
|
|
4505
|
-
|
|
4542
|
+
}, Rt = {
|
|
4543
|
+
filter: !0,
|
|
4544
|
+
sort: !0
|
|
4545
|
+
}, zt = ({ schema: e }) => {
|
|
4546
|
+
let { dataSource: t } = g() || {};
|
|
4547
|
+
return /* @__PURE__ */ k(f, {
|
|
4506
4548
|
schema: e,
|
|
4507
|
-
|
|
4549
|
+
mapping: Rt,
|
|
4550
|
+
dataSource: t,
|
|
4551
|
+
testId: "object-gantt",
|
|
4552
|
+
errorTitle: "This gantt chart’s data source could not be resolved",
|
|
4553
|
+
children: (e) => /* @__PURE__ */ k(Lt, {
|
|
4554
|
+
schema: e,
|
|
4555
|
+
dataSource: t
|
|
4556
|
+
})
|
|
4508
4557
|
});
|
|
4509
4558
|
};
|
|
4510
|
-
s.register("object-gantt",
|
|
4559
|
+
s.register("object-gantt", zt, {
|
|
4511
4560
|
namespace: "plugin-gantt",
|
|
4512
4561
|
label: "Object Gantt",
|
|
4513
4562
|
category: "view",
|
|
@@ -4522,7 +4571,7 @@ s.register("object-gantt", It, {
|
|
|
4522
4571
|
label: "Gantt Config",
|
|
4523
4572
|
description: "startDateField, endDateField, titleField, progressField, percentageField, colorField, dependenciesField"
|
|
4524
4573
|
}]
|
|
4525
|
-
}), s.register("gantt",
|
|
4574
|
+
}), s.register("gantt", zt, {
|
|
4526
4575
|
namespace: "view",
|
|
4527
4576
|
label: "Gantt View",
|
|
4528
4577
|
category: "view",
|
|
@@ -4539,4 +4588,4 @@ s.register("object-gantt", It, {
|
|
|
4539
4588
|
}]
|
|
4540
4589
|
});
|
|
4541
4590
|
//#endregion
|
|
4542
|
-
export {
|
|
4591
|
+
export { _t as GanttView, Lt as ObjectGantt, zt as ObjectGanttRenderer, At as QuickFilterBar, wt as ResourceWorkload, R as bandAt, yt as computeWorkload, Nt as normalizeDependencies, Ke as normalizeShiftSegments, jt as normalizeTaskType, Ge as parseHHMM, qe as shiftDayStart };
|