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