@svar-ui/vue-gantt 2.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.
@@ -0,0 +1,2385 @@
1
+ import { openBlock as c, createElementBlock as m, normalizeStyle as J, normalizeClass as ke, createElementVNode as Q, createBlock as ve, resolveDynamicComponent as ut, Fragment as le, createTextVNode as Et, toDisplayString as $e, computed as R, createCommentVNode as ee, useModel as qe, inject as he, ref as P, watchEffect as me, onWatcherCleanup as bt, onMounted as Ze, onUnmounted as Qe, watch as Fe, withDirectives as rt, createVNode as ge, unref as w, mergeModels as Tt, mergeDefaults as Nt, renderList as be, withModifiers as Ut, withCtx as Be, useAttrs as Vt, provide as Ge, renderSlot as Je, mergeProps as Dt, normalizeProps as Yt } from "vue";
2
+ import { asDirective as ct, subscribe as $, writable as Xt, subscribeLater as ie } from "@svar-ui/lib-vue";
3
+ import { locate as Ce, getID as Me, locateID as Re, clickOutside as Kt, setID as Ke, dateToString as dt, locale as ft } from "@svar-ui/lib-dom";
4
+ import { en as vt } from "@svar-ui/gantt-locales";
5
+ import { en as $t } from "@svar-ui/core-locales";
6
+ import { EventBusRouter as qt } from "@svar-ui/lib-state";
7
+ import { prepareEditTask as Ot, grid as Zt, isSegmentMoveAllowed as Qt, extendDragOptions as Jt, defaultColumns as el, defaultTaskTypes as tl, DataStore as ll, normalizeLinks as nl, normalizeZoom as al, parseTaskDates as sl, getToolbarButtons as St, isHandledAction as Pt, handleAction as At, getMenuOptions as It, getEditorItems as ol } from "@svar-ui/gantt-store";
8
+ import { defaultColumns as da, defaultEditorItems as fa, defaultMenuOptions as va, defaultTaskTypes as pa, defaultToolbarButtons as ma, getEditorItems as ha, getMenuOptions as ga, getToolbarButtons as xa, registerScaleUnit as ya } from "@svar-ui/gantt-store";
9
+ import { hotkeys as Ft } from "@svar-ui/grid-store";
10
+ import { Grid as il, HeaderMenu as ul } from "@svar-ui/vue-grid";
11
+ import { Button as Ct, Field as rl, Text as cl, Combo as dl, DatePicker as fl, TimePicker as vl, RichSelect as pl, TwoState as ml, Slider as hl, Counter as gl, Checkbox as xl, Locale as yl, Willow as Rt, WillowDark as Mt } from "@svar-ui/vue-core";
12
+ import { Toolbar as kl } from "@svar-ui/vue-toolbar";
13
+ import { ContextMenu as wl } from "@svar-ui/vue-menu";
14
+ import { registerEditorItem as De, Editor as bl } from "@svar-ui/vue-editor";
15
+ import { registerEditorItem as wa } from "@svar-ui/vue-editor";
16
+ const Tl = "2.6.0", $l = {
17
+ version: Tl
18
+ };
19
+ function _l(l, t, e) {
20
+ const a = l.getBoundingClientRect(), u = t.querySelector(".wx-body").getBoundingClientRect();
21
+ return {
22
+ top: a.top - u.top,
23
+ left: a.left - u.left,
24
+ dt: a.bottom - e.clientY,
25
+ db: e.clientY - a.top
26
+ };
27
+ }
28
+ function Lt(l) {
29
+ return l && Me(l, "data-context-id");
30
+ }
31
+ const Ht = 5;
32
+ function Sl(l, t) {
33
+ let e, a, u, S, b, f, y, T, A;
34
+ function L(o) {
35
+ S = o.clientX, b = o.clientY, f = {
36
+ ..._l(e, l, o),
37
+ y: t.getTask(u).$y
38
+ }, document.body.style.userSelect = "none";
39
+ }
40
+ function j(o) {
41
+ e = Ce(o), Lt(e) && (u = Me(e), A = setTimeout(() => {
42
+ T = !0, t && t.touchStart && t.touchStart(), L(o.touches[0]);
43
+ }, 500), l.addEventListener("touchmove", M), l.addEventListener("contextmenu", d), window.addEventListener("touchend", I));
44
+ }
45
+ function d(o) {
46
+ if (T || A)
47
+ return o.preventDefault(), !1;
48
+ }
49
+ function H(o) {
50
+ o.which === 1 && (e = Ce(o), Lt(e) && (u = Me(e), l.addEventListener("mousemove", K), window.addEventListener("mouseup", h), L(o)));
51
+ }
52
+ function B(o) {
53
+ l.removeEventListener("mousemove", K), l.removeEventListener("touchmove", M), document.body.removeEventListener("mouseup", h), document.body.removeEventListener("touchend", I), document.body.style.userSelect = "", o && (l.removeEventListener("mousedown", H), l.removeEventListener("touchstart", j));
54
+ }
55
+ function Z(o) {
56
+ const C = o.clientX - S, U = o.clientY - b;
57
+ if (!a) {
58
+ if (Math.abs(C) < Ht && Math.abs(U) < Ht || t && t.start && t.start({ id: u, e: o }) === !1)
59
+ return;
60
+ a = e.cloneNode(!0), a.style.pointerEvents = "none", a.classList.add("wx-reorder-task"), a.style.position = "absolute", a.style.left = f.left + "px", a.style.top = f.top + "px", e.style.visibility = "hidden", e.parentNode.insertBefore(a, e);
61
+ }
62
+ if (a) {
63
+ const Y = Math.round(Math.max(0, f.top + U));
64
+ if (t && t.move && t.move({ id: u, top: Y, detail: y }) === !1)
65
+ return;
66
+ const te = t.getTask(u), ue = te.$y;
67
+ if (!f.start && f.y === ue) return _();
68
+ f.start = !0, f.y = te.$y - 4, a.style.top = Y + "px";
69
+ const re = document.elementFromPoint(
70
+ o.clientX,
71
+ o.clientY
72
+ ), ce = Ce(re);
73
+ if (ce && ce !== e) {
74
+ const E = Me(ce), G = ce.getBoundingClientRect(), fe = G.top + G.height / 2, xe = o.clientY + f.db > fe && ce.nextElementSibling !== e, z = o.clientY - f.dt < fe && ce.previousElementSibling !== e;
75
+ y?.after === E || y?.before === E ? y = null : xe ? y = { id: u, after: E } : z && (y = { id: u, before: E });
76
+ }
77
+ }
78
+ }
79
+ function K(o) {
80
+ Z(o);
81
+ }
82
+ function M(o) {
83
+ T ? (o.preventDefault(), Z(o.touches[0])) : A && (clearTimeout(A), A = null);
84
+ }
85
+ function I() {
86
+ T = null, A && (clearTimeout(A), A = null), _();
87
+ }
88
+ function h() {
89
+ _();
90
+ }
91
+ function _() {
92
+ e && (e.style.visibility = ""), a && (a.parentNode.removeChild(a), t && t.end && t.end({ id: u, top: f.top })), u = e = a = f = y = null, B();
93
+ }
94
+ return l.style.position !== "absolute" && (l.style.position = "relative"), l.addEventListener("mousedown", H), l.addEventListener("touchstart", j), {
95
+ destroy() {
96
+ B(!0);
97
+ }
98
+ };
99
+ }
100
+ const pe = (l, t) => {
101
+ const e = l.__vccOpts || l;
102
+ for (const [a, u] of t)
103
+ e[a] = u;
104
+ return e;
105
+ }, Il = {
106
+ key: 1,
107
+ class: "wx-toggle-placeholder"
108
+ }, Cl = { class: "wx-text" }, Rl = {
109
+ __name: "TextCell",
110
+ props: {
111
+ row: {},
112
+ column: {}
113
+ },
114
+ setup(l) {
115
+ function t(e, a) {
116
+ return `justify-content:${a.align};padding-left: ${(e.$level - 1) * 20}px`;
117
+ }
118
+ return (e, a) => (c(), m("div", {
119
+ class: "wx-content",
120
+ style: J(t(l.row, l.column))
121
+ }, [
122
+ !l.row.$empty && (l.row.data || l.row.lazy) ? (c(), m("i", {
123
+ key: 0,
124
+ class: ke(
125
+ "wx-toggle-icon wxi-menu-" + (l.row.open ? "down" : "right")
126
+ ),
127
+ "data-action": "open-task"
128
+ }, null, 2)) : (c(), m("i", Il)),
129
+ Q("div", Cl, [
130
+ l.column._cell ? (c(), ve(ut(l.column._cell), {
131
+ key: 0,
132
+ row: l.row,
133
+ column: l.column
134
+ }, null, 8, ["row", "column"])) : (c(), m(le, { key: 1 }, [
135
+ Et($e(l.row.text), 1)
136
+ ], 64))
137
+ ])
138
+ ], 4));
139
+ }
140
+ }, Ml = /* @__PURE__ */ pe(Rl, [["__scopeId", "data-v-6381f23e"]]), Ll = ["data-action"], Hl = {
141
+ __name: "ActionCell",
142
+ props: {
143
+ column: {},
144
+ cell: {}
145
+ },
146
+ setup(l) {
147
+ const t = l, e = R(() => t.column.id);
148
+ return (a, u) => l.cell || l.column.id === "add-task" ? (c(), m("div", {
149
+ key: 0,
150
+ style: J({ textAlign: l.column.align })
151
+ }, [
152
+ Q("i", {
153
+ class: "wx-action-icon wxi-plus",
154
+ "data-action": e.value
155
+ }, null, 8, Ll)
156
+ ], 4)) : ee("", !0);
157
+ }
158
+ }, Bt = /* @__PURE__ */ pe(Hl, [["__scopeId", "data-v-abfc4b0a"]]), Bl = /* @__PURE__ */ Object.assign({ name: "GanttGridGrid" }, {
159
+ __name: "Grid",
160
+ props: /* @__PURE__ */ Tt({
161
+ readonly: {},
162
+ compactMode: {},
163
+ width: { default: 0 },
164
+ columnWidth: {}
165
+ }, {
166
+ display: { default: "all" },
167
+ displayModifiers: {},
168
+ tableAPI: {},
169
+ tableAPIModifiers: {}
170
+ }),
171
+ emits: ["update:display", "update:tableAPI"],
172
+ setup(l) {
173
+ const t = ct(Sl), e = l, a = qe(l, "display"), u = qe(l, "tableAPI"), b = he("wx-i18n").getGroup("gantt"), f = he("gantt-store"), {
174
+ scrollTop: y,
175
+ cellHeight: T,
176
+ focusTask: A,
177
+ _selected: L,
178
+ area: j,
179
+ _tasks: d,
180
+ _scales: H,
181
+ _headerLength: B,
182
+ columns: Z,
183
+ _sort: K,
184
+ calendar: M,
185
+ durationUnit: I,
186
+ splitTasks: h,
187
+ filterValues: _
188
+ } = f.getReactiveState(), o = $(y), C = $(T), U = $(L), Y = $(j), te = $(d, !0), ue = $(H), re = $(B), ce = $(Z), E = $(K), G = $(M), fe = $(I), xe = $(h), z = $(_);
189
+ let X = P(null);
190
+ function D(r, p) {
191
+ if (p === "add-task")
192
+ f.exec(p, {
193
+ target: r,
194
+ task: { text: b("New Task") },
195
+ mode: "child",
196
+ show: !0,
197
+ focus: r ? "grid" : null
198
+ });
199
+ else if (p === "open-task") {
200
+ const g = Le.value.find((n) => n.id === r);
201
+ (g.data || g.lazy) && f.exec(p, { id: r, mode: !g.open });
202
+ }
203
+ }
204
+ function k(r) {
205
+ const p = Re(r), g = r.target.dataset.action;
206
+ g && r.preventDefault(), p ? g === "add-task" || g === "open-task" ? D(p, g) : f.exec("select-task", {
207
+ id: p,
208
+ toggle: r.ctrlKey || r.metaKey,
209
+ range: r.shiftKey,
210
+ show: "xy",
211
+ focus: "grid"
212
+ }) : g === "add-task" && D(null, g);
213
+ }
214
+ function F(r) {
215
+ if (!e.readonly) {
216
+ const p = Re(r), g = Re(r, "data-col-id");
217
+ !(g && ye.value.find((i) => i.id === g))?.editor && p && f.exec("show-editor", { id: p });
218
+ }
219
+ }
220
+ let V;
221
+ function Te(r) {
222
+ const p = r.id, { before: g, after: n } = r, i = r.onMove;
223
+ let s = g || n, x = g ? "before" : "after";
224
+ if (i) {
225
+ if (x === "after") {
226
+ const q = Se.value.findIndex((oe) => oe.id === p), ae = Se.value.findIndex((oe) => oe.id === s), se = Se.value[ae];
227
+ q - ae === 1 ? x = "before" : se.data && se.open && (x = "before", s = se.data[0].id);
228
+ }
229
+ V = { id: p, [x]: s };
230
+ } else V = null;
231
+ f.exec("move-task", {
232
+ id: p,
233
+ mode: x,
234
+ target: s,
235
+ inProgress: i
236
+ });
237
+ }
238
+ function v({ id: r }) {
239
+ if (e.readonly || (f.getTask(r).open && f.exec("open-task", { id: r, mode: !1 }), X.value = Le.value.find((p) => p.id === r), !X.value)) return !1;
240
+ }
241
+ function O({ id: r, top: p }) {
242
+ V ? Te({ ...V, onMove: !1 }) : f.exec("drag-task", {
243
+ id: r,
244
+ top: p + Oe.value,
245
+ inProgress: !1
246
+ }), X.value = null;
247
+ }
248
+ function N({ id: r, top: p, detail: g }) {
249
+ g && Te({ ...g, onMove: !0 }), f.exec("drag-task", {
250
+ id: r,
251
+ top: p + Oe.value,
252
+ inProgress: !0
253
+ });
254
+ }
255
+ const W = P(0), de = P(0), ne = P(null), _e = P(null), ze = P(!1);
256
+ function pt(r) {
257
+ const { key: p, isInput: g } = r;
258
+ if (!g && (p === "arrowup" || p === "arrowdown"))
259
+ return r.eventSource = "grid", f.exec("hotkey", r), !1;
260
+ if (p === "enter") {
261
+ const n = u.value.getState().focusCell;
262
+ if (n) {
263
+ const { row: i, column: s } = n;
264
+ s === "add-task" ? D(i, "add-task") : s === "text" && D(i, "open-task");
265
+ }
266
+ }
267
+ }
268
+ function et(r) {
269
+ u.value = r, r.intercept("hotkey", pt), r.intercept("scroll", () => !1), r.intercept("select-row", () => !1), r.intercept("sort-rows", (p) => {
270
+ const { key: g, add: n } = p;
271
+ let i = E.value ? E.value.find((x) => x.key === g) : null, s = "asc";
272
+ return i && (s = !i || i.order === "asc" ? "desc" : "asc"), f.exec("sort-tasks", {
273
+ key: g,
274
+ order: s,
275
+ add: n
276
+ }), !1;
277
+ }), r.intercept("filter-rows", (p) => {
278
+ const { key: g, value: n } = p;
279
+ return f.exec("filter-tasks", {
280
+ key: g,
281
+ value: n,
282
+ open: !0
283
+ }), !1;
284
+ }), r.on("resize-column", () => {
285
+ Ue(!0);
286
+ }), r.on("hide-column", (p) => {
287
+ p.mode || Ve(), Ue();
288
+ }), r.intercept("update-cell", (p) => {
289
+ const { id: g, column: n, value: i } = p, s = Le.value.find((x) => x.id === g);
290
+ if (s) {
291
+ const x = { ...s };
292
+ let q = i;
293
+ q && !isNaN(q) && !(q instanceof Date) && (q *= 1), x[n] = q, Ot(
294
+ x,
295
+ {
296
+ calendar: G.value,
297
+ durationUnit: fe.value,
298
+ splitTasks: xe.value
299
+ },
300
+ n
301
+ ), f.exec("update-task", {
302
+ id: g,
303
+ task: x
304
+ });
305
+ }
306
+ return !1;
307
+ });
308
+ }
309
+ const ye = R(() => {
310
+ let r = ce.value.map((n) => {
311
+ n = { ...n };
312
+ const i = [...n.header];
313
+ return i.forEach((s) => {
314
+ s.text && (s.text = b(s.text));
315
+ }), n.header = i, n;
316
+ });
317
+ const p = r.findIndex((n) => n.id === "text"), g = r.findIndex((n) => n.id === "add-task");
318
+ if (p !== -1 && (r[p].cell && (r[p]._cell = r[p].cell), r[p].cell = Ml), g !== -1) {
319
+ r[g].cell = r[g].cell || Bt;
320
+ const n = r[g].header[0];
321
+ if (r[g].header[0].cell = n.cell || Bt, e.readonly)
322
+ r.splice(g, 1);
323
+ else if (e.compactMode) {
324
+ const [i] = r.splice(g, 1);
325
+ r.unshift(i);
326
+ }
327
+ }
328
+ return r.length > 0 && (r[r.length - 1].resize = !1), r;
329
+ }), Oe = R(() => Y.value.from), je = R(() => ue.value.height), tt = R(
330
+ () => !e.compactMode && a.value !== "grid" ? e.columnWidth > e.width : e.columnWidth > W.value
331
+ ), Ne = R(
332
+ () => a.value === "all" ? `${e.width}px` : a.value === "grid" ? "calc(100% - 4px)" : ye.value.find((r) => r.id === "add-task") ? "50px" : "0"
333
+ ), mt = R(
334
+ () => `min-height:${de.value + C.value * 4}px;`
335
+ ), lt = R(
336
+ () => mt.value + (tt.value && a.value === "all" ? `width:${e.columnWidth}px;` : a.value === "grid" ? tt.value ? `width:${e.columnWidth}px;` : "width:100%;" : "")
337
+ ), ht = R(() => U.value.map((r) => r.id)), Le = R(() => te.value.slice(Y.value.start, Y.value.end)), Se = R(() => (X.value && !Le.value.find((p) => p.id === X.value.id) ? [...Le.value, X.value] : Le.value).map((p) => ({ ...p })));
338
+ function nt() {
339
+ return ye.value.some((r) => r.flexgrow && !r.hidden);
340
+ }
341
+ const gt = R(() => (ze.value, nt()));
342
+ function Ue(r) {
343
+ if (!nt()) {
344
+ const p = Ye.value.reduce((g, n) => (r && n.$width && (n.$width = n.width), g + (n.hidden ? 0 : n.width)), 0);
345
+ e.columnWidth;
346
+ }
347
+ ze.value = !0, ze.value = !1;
348
+ }
349
+ function Ve() {
350
+ ye.value.filter((p) => p.flexgrow && !p.hidden).length === 1 && ye.value.forEach((p) => {
351
+ p.$width && !p.flexgrow && !p.hidden && (p.width = p.$width);
352
+ });
353
+ }
354
+ const at = R(() => {
355
+ if (Se.value && E.value?.length) {
356
+ const r = {};
357
+ return E.value.forEach(({ key: p, order: g }, n) => {
358
+ r[p] = {
359
+ order: g,
360
+ ...E.value.length > 1 && { index: n }
361
+ };
362
+ }), r;
363
+ }
364
+ return {};
365
+ }), st = R(() => at.value ? { ...z.value } : z.value), Ye = R(() => {
366
+ let r = a.value === "chart" ? ye.value.filter((g) => g.id === "add-task") : ye.value;
367
+ const p = a.value === "all" ? e.width : W.value;
368
+ if (!gt.value) {
369
+ let g = e.columnWidth, n = !1;
370
+ if (ye.value.some((i) => i.$width)) {
371
+ let i = 0;
372
+ g = ye.value.reduce((s, x) => (x.hidden || (i += x.width, s += x.$width || x.width), s), 0), i > g && g >= p && (n = !0);
373
+ }
374
+ if (n || g < p) {
375
+ let i = 1;
376
+ return n || (i = (p - 50) / (g - 50 || 1)), r.map((s) => (s.id !== "add-task" && !s.hidden && (s.$width || (s.$width = s.width), s.width = s.$width * i), s));
377
+ }
378
+ }
379
+ return r;
380
+ });
381
+ function Xe() {
382
+ ne.value && Se.value !== null && (ne.value.querySelector(".wx-body").style.top = -(o.value - Oe.value) + "px");
383
+ }
384
+ me(() => {
385
+ ne.value && (o.value, Oe.value, Xe());
386
+ }), me(() => {
387
+ if (ne.value) {
388
+ Ye.value, lt.value, a.value, Ne.value, Se.value;
389
+ const r = new ResizeObserver(() => {
390
+ Xe();
391
+ });
392
+ r.observe(ne.value.querySelector(".wx-table-box .wx-body")), bt(() => {
393
+ r.disconnect();
394
+ });
395
+ }
396
+ });
397
+ let Pe;
398
+ Ze(() => {
399
+ _e.value && (Pe = new ResizeObserver((r) => {
400
+ for (const p of r)
401
+ W.value = p.contentRect.width, de.value = p.contentRect.height;
402
+ }), Pe.observe(_e.value));
403
+ }), Qe(() => {
404
+ Pe?.disconnect();
405
+ });
406
+ let We = !1;
407
+ const Ie = $(A);
408
+ Fe(Ie, (r) => {
409
+ if (!r) return;
410
+ const { id: p, column: g } = r;
411
+ g && (We || (We = !0, requestAnimationFrame(() => {
412
+ const n = u.value.getState().focusCell;
413
+ u.value.exec("focus-cell", {
414
+ row: p,
415
+ column: n?.column || ye.value[0]?.id
416
+ }), We = !1;
417
+ })));
418
+ });
419
+ const xt = R(() => ({
420
+ start: v,
421
+ end: O,
422
+ move: N,
423
+ getTask: f.getTask
424
+ })), yt = R(() => [...ht.value]), kt = R(() => ({
425
+ rowHeight: C.value,
426
+ headerHeight: je.value / re.value
427
+ }));
428
+ return (r, p) => (c(), m("div", {
429
+ class: "wx-table-container",
430
+ style: J({ flex: `0 0 ${Ne.value}` }),
431
+ ref_key: "tableContainer",
432
+ ref: _e
433
+ }, [
434
+ rt((c(), m("div", {
435
+ ref_key: "table",
436
+ ref: ne,
437
+ style: J(lt.value),
438
+ class: "wx-table",
439
+ onClick: k,
440
+ onDblclick: F
441
+ }, [
442
+ ge(w(il), {
443
+ init: et,
444
+ sizes: kt.value,
445
+ rowStyle: (g) => g.$reorder ? "wx-reorder-task" : "",
446
+ columnStyle: (g) => `wx-text-${g.align} ${g.id === "add-task" ? "wx-action" : ""}`,
447
+ data: Se.value,
448
+ columns: Ye.value,
449
+ selectedRows: yt.value,
450
+ sortMarks: at.value,
451
+ filterValues: st.value
452
+ }, null, 8, ["sizes", "rowStyle", "columnStyle", "data", "columns", "selectedRows", "sortMarks", "filterValues"])
453
+ ], 36)), [
454
+ [w(t), xt.value]
455
+ ])
456
+ ], 4));
457
+ }
458
+ }), zl = /* @__PURE__ */ pe(Bl, [["__scopeId", "data-v-814ee4d3"]]), Wl = {
459
+ __name: "CellGrid",
460
+ props: /* @__PURE__ */ Nt({
461
+ borders: { default: "" }
462
+ }, {
463
+ borders: ""
464
+ }),
465
+ setup(l) {
466
+ const t = he("gantt-store"), { cellWidth: e, cellHeight: a } = t.getReactiveState(), u = $(e), S = $(a), b = P(null), f = P("#e4e4e4");
467
+ return me(() => {
468
+ if (typeof getComputedStyle < "u" && b.value) {
469
+ const y = getComputedStyle(b.value).getPropertyValue(
470
+ "--wx-gantt-border"
471
+ );
472
+ f.value = y ? y.substring(y.indexOf("#")) : "#1d1e261a";
473
+ }
474
+ }), (y, T) => (c(), m("div", {
475
+ ref_key: "node",
476
+ ref: b,
477
+ style: J(`width:100%; height:100%; background:url(${w(Zt)(
478
+ w(u),
479
+ w(S),
480
+ f.value,
481
+ l.borders
482
+ )}); position: absolute;`)
483
+ }, null, 4));
484
+ }
485
+ }, El = { class: "wx-links" }, Dl = ["points", "onclick", "data-link-id"], Ol = ["points"], Pl = /* @__PURE__ */ Object.assign({ name: "GanttChartLinks" }, {
486
+ __name: "Links",
487
+ props: {
488
+ onSelectLink: { type: Function },
489
+ selectedLink: {},
490
+ readonly: {}
491
+ },
492
+ setup(l) {
493
+ const t = ct(Kt), e = l, a = he("gantt-store"), { _links: u, criticalPath: S } = a.getReactiveState(), b = $(u), f = $(S);
494
+ function y(T) {
495
+ const A = T?.target?.classList;
496
+ !A?.contains("wx-line") && !A?.contains("wx-delete-button") && e.onSelectLink(null);
497
+ }
498
+ return (T, A) => (c(), m("svg", El, [
499
+ (c(!0), m(le, null, be(w(b), (L) => (c(), m("polyline", {
500
+ key: L.id,
501
+ class: ke([
502
+ "wx-line",
503
+ {
504
+ "wx-critical": w(f) && L.critical,
505
+ "wx-line-selectable": !l.readonly
506
+ }
507
+ ]),
508
+ points: L.$p,
509
+ onclick: () => !l.readonly && l.onSelectLink(L.id),
510
+ "data-link-id": w(Ke)(L.id)
511
+ }, null, 10, Dl))), 128)),
512
+ !l.readonly && l.selectedLink ? rt((c(), m("polyline", {
513
+ key: 0,
514
+ class: "wx-line wx-line-selected wx-line-selectable wx-delete-link",
515
+ points: l.selectedLink.$p
516
+ }, null, 8, Ol)), [
517
+ [w(t), y]
518
+ ]) : ee("", !0)
519
+ ]));
520
+ }
521
+ }), Al = /* @__PURE__ */ pe(Pl, [["__scopeId", "data-v-4939b3a5"]]), Fl = ["data-tooltip-id"], Gl = /* @__PURE__ */ Object.assign({ name: "GanttChartRollups" }, {
522
+ __name: "Rollups",
523
+ props: {
524
+ rollup: {},
525
+ parent: {}
526
+ },
527
+ setup(l) {
528
+ return (t, e) => (c(), m("div", {
529
+ "data-tooltip-id": l.rollup.id,
530
+ class: ke(`wx-rollup wx-${l.rollup.type}-rollup`),
531
+ style: J(`left:${l.rollup.$x_rollup}px;top:${l.parent.$y + l.parent.$h + l.rollup.$y_rollup_relative}px;width:${l.rollup.$w_rollup}px;height:${l.rollup.$h_rollup}px;`)
532
+ }, null, 14, Fl));
533
+ }
534
+ }), jl = /* @__PURE__ */ pe(Gl, [["__scopeId", "data-v-e1e1122e"]]), Nl = { class: "wx-segments" }, Ul = ["data-segment"], Vl = {
535
+ key: 0,
536
+ class: "wx-progress-wrapper"
537
+ }, Yl = { class: "wx-content" }, Xl = {
538
+ __name: "BarSegments",
539
+ props: {
540
+ task: {},
541
+ type: {}
542
+ },
543
+ setup(l) {
544
+ const t = l;
545
+ function e(u) {
546
+ const S = t.task.segments[u];
547
+ return `left:${S.$x}px;top:0px;width:${S.$w}px;height:100%;`;
548
+ }
549
+ function a(u) {
550
+ if (!t.task.progress) return 0;
551
+ const S = t.task.duration * t.task.progress / 100, b = t.task.segments;
552
+ let f = 0, y = 0, T = null;
553
+ do {
554
+ const A = b[y];
555
+ y === u && (f > S ? T = 0 : T = Math.min((S - f) / A.duration, 1) * 100), f += A.duration, y++;
556
+ } while (T === null && y < b.length);
557
+ return T || 0;
558
+ }
559
+ return (u, S) => (c(), m("div", Nl, [
560
+ (c(!0), m(le, null, be(l.task.segments, (b, f) => (c(), m("div", {
561
+ key: f,
562
+ class: ke(["wx-segment", "wx-bar", `wx-${l.type}`]),
563
+ "data-segment": f,
564
+ style: J(e(f))
565
+ }, [
566
+ l.task.progress ? (c(), m("div", Vl, [
567
+ Q("div", {
568
+ class: "wx-progress-percent",
569
+ style: J(`width:${a(f)}%`)
570
+ }, null, 4)
571
+ ])) : ee("", !0),
572
+ Q("div", Yl, $e(b.text || ""), 1)
573
+ ], 14, Ul))), 128))
574
+ ]));
575
+ }
576
+ }, Kl = /* @__PURE__ */ pe(Xl, [["__scopeId", "data-v-558dfded"]]), ql = ["data-id", "data-tooltip-id", "tabindex"], Zl = {
577
+ key: 0,
578
+ class: "wx-progress-wrapper"
579
+ }, Ql = {
580
+ key: 4,
581
+ class: "wx-content"
582
+ }, Jl = {
583
+ key: 1,
584
+ class: "wx-text-out"
585
+ }, en = /* @__PURE__ */ Object.assign({ name: "GanttChartBars" }, {
586
+ __name: "Bars",
587
+ props: {
588
+ readonly: {},
589
+ taskTemplate: {}
590
+ },
591
+ setup(l) {
592
+ const t = l, e = he("gantt-store"), {
593
+ _tasks: a,
594
+ _links: u,
595
+ area: S,
596
+ _scales: b,
597
+ taskTypes: f,
598
+ baselines: y,
599
+ _selected: T,
600
+ rollups: A,
601
+ _rollups: L,
602
+ focusTask: j,
603
+ criticalPath: d,
604
+ tasks: H,
605
+ schedule: B,
606
+ splitTasks: Z,
607
+ summary: K,
608
+ slack: M
609
+ } = e.getReactiveState(), I = $(a, !0), h = $(u), _ = $(S), o = $(b), C = $(f), U = $(y), Y = $(T), te = $(A), ue = $(L), re = $(d), ce = $(H), E = $(B), G = $(Z), fe = $(K), xe = $(M), z = R(
610
+ () => I.value.slice(_.value.start, _.value.end).map((n) => ({ ...n }))
611
+ ), X = R(() => o.value.lengthUnitWidth);
612
+ let D = !1;
613
+ const k = P(void 0), F = P(null);
614
+ let V = null;
615
+ const Te = P(null), v = R(
616
+ () => Te.value && {
617
+ ...h.value.find((n) => n.id === Te.value)
618
+ }
619
+ ), O = P(void 0);
620
+ let N;
621
+ function W(n) {
622
+ if (n.button !== 0) return;
623
+ const i = Ce(n);
624
+ i && ne(i, n);
625
+ }
626
+ function de(n) {
627
+ const i = Ce(n);
628
+ i && (N = setTimeout(() => {
629
+ O.value = !0, ne(i, n.touches[0]);
630
+ }, 300));
631
+ }
632
+ function ne(n, i) {
633
+ const { clientX: s } = i, x = Me(n), q = e.getTask(x), ae = i.target.classList;
634
+ if (!i.target.closest(".wx-delete-button") && !t.readonly) {
635
+ if (ae.contains("wx-progress-marker")) {
636
+ const { progress: se } = e.getTask(x);
637
+ V = {
638
+ id: x,
639
+ x: s,
640
+ progress: se,
641
+ dx: 0,
642
+ node: n,
643
+ marker: i.target
644
+ }, i.target.classList.add("wx-progress-in-drag");
645
+ } else {
646
+ const se = _e(n, i, q) || "move";
647
+ if (F.value = {
648
+ id: x,
649
+ mode: se,
650
+ x: s,
651
+ dx: 0,
652
+ l: q.$x,
653
+ w: q.$w
654
+ }, G.value && q.segments?.length) {
655
+ const oe = Ce(i, "data-segment");
656
+ oe && (F.value.segmentIndex = oe.dataset.segment * 1, Jt(q, F.value));
657
+ }
658
+ }
659
+ tt();
660
+ }
661
+ }
662
+ function _e(n, i, s) {
663
+ if (i.target.classList.contains("wx-line") || (s || (s = e.getTask(Me(n))), s.type === "milestone" || s.type === "summary")) return "";
664
+ const x = Ce(i, "data-segment");
665
+ x && (n = x);
666
+ const { left: q, width: ae } = n.getBoundingClientRect(), se = (i.clientX - q) / ae;
667
+ let oe = 0.2 / (ae > 200 ? ae / 200 : 1);
668
+ return se < oe ? "start" : se > 1 - oe ? "end" : "";
669
+ }
670
+ function ze(n) {
671
+ O.value ? (n.preventDefault(), et(n, n.touches[0])) : N && (clearTimeout(N), N = null);
672
+ }
673
+ function pt(n) {
674
+ et(n, n);
675
+ }
676
+ function et(n, i) {
677
+ const { clientX: s } = i;
678
+ if (!t.readonly)
679
+ if (V) {
680
+ const { node: x, x: q, id: ae } = V, se = V.dx = s - q, oe = Math.round(se / x.offsetWidth * 100);
681
+ let He = V.progress + oe;
682
+ V.value = He = Math.min(
683
+ Math.max(0, He),
684
+ 100
685
+ ), e.exec("update-task", {
686
+ id: ae,
687
+ task: { progress: He },
688
+ inProgress: !0
689
+ });
690
+ } else if (F.value) {
691
+ st(null);
692
+ const { mode: x, l: q, w: ae, x: se, id: oe, start: He, segment: Ae, index: Ee } = F.value, wt = e.getTask(oe), we = s - se, _t = Math.round(X.value) || 1;
693
+ if (!He && Math.abs(we) < 20 || x === "start" && ae - we < _t || x === "end" && ae + we < _t || x === "move" && (we < 0 && q + we < 0 || we > 0 && q + ae + we > We.value) || F.value.segment && !Qt(wt, F.value))
694
+ return;
695
+ F.value.dx = we;
696
+ let ot, it;
697
+ if (x === "start" ? (ot = q + we, it = ae - we) : x === "end" ? (ot = q, it = ae + we) : x === "move" && (ot = q + we, it = ae), e.exec("drag-task", {
698
+ id: oe,
699
+ width: it,
700
+ left: ot,
701
+ inProgress: !0,
702
+ ...Ae && { segmentIndex: Ee }
703
+ }), !F.value.start && (x === "move" && wt.$x === q || x !== "move" && wt.$w === ae))
704
+ return D = !0, je();
705
+ F.value.start = !0;
706
+ } else {
707
+ const x = Ce(n);
708
+ if (x) {
709
+ const q = e.getTask(Me(x)), se = Ce(n, "data-segment") || x, oe = _e(se, i, q);
710
+ se.style.cursor = oe && !t.readonly ? "col-resize" : "pointer";
711
+ }
712
+ }
713
+ }
714
+ function ye() {
715
+ je();
716
+ }
717
+ function Oe() {
718
+ O.value = null, N && (clearTimeout(N), N = null), je();
719
+ }
720
+ function je() {
721
+ if (V) {
722
+ const { dx: n, id: i, marker: s, value: x } = V;
723
+ V = null, typeof x < "u" && n && e.exec("update-task", {
724
+ id: i,
725
+ task: { progress: x },
726
+ inProgress: !1
727
+ }), s.classList.remove("wx-progress-in-drag"), D = !0, Ne();
728
+ } else if (F.value) {
729
+ const { id: n, mode: i, dx: s, l: x, w: q, start: ae, segment: se, index: oe } = F.value;
730
+ if (F.value = null, ae) {
731
+ const He = Math.round(s / X.value);
732
+ if (!He)
733
+ e.exec("drag-task", {
734
+ id: n,
735
+ width: q,
736
+ left: x,
737
+ inProgress: !1,
738
+ ...se && { segmentIndex: oe }
739
+ });
740
+ else {
741
+ let Ae = {}, Ee = e.getTask(n);
742
+ se && (Ee = Ee.segments[oe]), i === "move" ? (Ae.start = Ee.start, Ae.end = Ee.end) : Ae[i] = Ee[i], e.exec("update-task", {
743
+ id: n,
744
+ diff: He,
745
+ task: Ae,
746
+ ...se && { segmentIndex: oe }
747
+ });
748
+ }
749
+ D = !0;
750
+ }
751
+ Ne();
752
+ }
753
+ }
754
+ function tt() {
755
+ document.body.style.userSelect = "none";
756
+ }
757
+ function Ne() {
758
+ document.body.style.userSelect = "";
759
+ }
760
+ function mt(n) {
761
+ if (!t.readonly) {
762
+ const i = Re(n.target);
763
+ if (i && !n.target.classList.contains("wx-link")) {
764
+ const s = Re(n.target, "data-segment");
765
+ e.exec("show-editor", {
766
+ id: i,
767
+ ...s !== null && { segmentIndex: s }
768
+ });
769
+ }
770
+ }
771
+ }
772
+ function lt(n) {
773
+ if (D) {
774
+ D = !1;
775
+ return;
776
+ }
777
+ const i = Re(n.target);
778
+ if (i) {
779
+ const s = n.target.classList;
780
+ if (s.contains("wx-link")) {
781
+ const x = s.contains("wx-left");
782
+ if (!k.value) {
783
+ k.value = { id: i, start: x };
784
+ return;
785
+ }
786
+ k.value.id !== i && !Ve(i, x) && e.exec("add-link", {
787
+ link: {
788
+ source: k.value.id,
789
+ target: i,
790
+ type: Ue(k.value.start, x)
791
+ }
792
+ });
793
+ } else if (s.contains("wx-delete-button-icon"))
794
+ e.exec("delete-link", { id: Te.value }), Te.value = null;
795
+ else {
796
+ const x = Re(n.target, "data-segment");
797
+ e.exec("select-task", {
798
+ id: i,
799
+ toggle: n.ctrlKey || n.metaKey,
800
+ range: n.shiftKey,
801
+ ...x !== null && { segmentIndex: x }
802
+ });
803
+ }
804
+ }
805
+ at();
806
+ }
807
+ function ht(n) {
808
+ return `left:${n.$x}px;top:${n.$y}px;width:${n.$w}px;height:${n.$h}px;line-height:${n.$h}px;`;
809
+ }
810
+ function Le(n) {
811
+ return `left:${n.$x_base}px;top:${n.$y_base}px;width:${n.$w_base}px;height:${n.$h_base}px;`;
812
+ }
813
+ function Se(n) {
814
+ return `left:${n.$x_slack}px;top:${n.$y}px;width:${n.$w_slack}px;height:${n.$h}px;`;
815
+ }
816
+ function nt(n) {
817
+ if (O.value || N)
818
+ return n.preventDefault(), !1;
819
+ }
820
+ const gt = ["e2s", "s2s", "e2e", "s2e"];
821
+ function Ue(n, i) {
822
+ return gt[(n ? 1 : 0) + (i ? 0 : 2)];
823
+ }
824
+ function Ve(n, i) {
825
+ const s = k.value.id, x = k.value.start;
826
+ return n === s ? !0 : h.value.find((q) => q.target === n && q.source === s && q.type === Ue(x, i));
827
+ }
828
+ function at() {
829
+ k.value && (k.value = null);
830
+ }
831
+ function st(n) {
832
+ Te.value = n;
833
+ }
834
+ const Ye = R(() => C.value.map((n) => n.id));
835
+ function Xe(n) {
836
+ let i = Ye.value.includes(n) ? n : "task";
837
+ return ["task", "milestone", "summary"].includes(n) || (i = `task ${i}`), i;
838
+ }
839
+ function Pe(n) {
840
+ e.exec(n.action, n.data);
841
+ }
842
+ const We = P(0), Ie = P(null), xt = R(
843
+ () => Y.value.length && Ie.value && Ie.value.contains(document.activeElement)
844
+ ), yt = R(
845
+ () => xt.value && Y.value[Y.value.length - 1].id
846
+ ), kt = $(j);
847
+ Fe(kt, (n) => {
848
+ if (n && n.column === !1) {
849
+ const { id: i } = n, s = Ie.value?.querySelector(
850
+ `.wx-bar[data-id='${Ke(i)}']`
851
+ );
852
+ s && s.focus();
853
+ }
854
+ });
855
+ const r = (n) => re.value && n.critical;
856
+ function p(n) {
857
+ if (E.value.auto) {
858
+ const i = ce.value.getSummaryId(n, !0), s = ce.value.getSummaryId(
859
+ k.value.id,
860
+ !0
861
+ );
862
+ return k.value?.id && !(Array.isArray(i) ? i : [i]).includes(k.value.id) && !(Array.isArray(s) ? s : [s]).includes(n);
863
+ }
864
+ return k.value;
865
+ }
866
+ let g;
867
+ return Ze(() => {
868
+ window.addEventListener("mouseup", ye), Ie.value && (We.value = Ie.value.offsetWidth, g = new ResizeObserver((n) => {
869
+ for (const i of n)
870
+ We.value = i.target.offsetWidth;
871
+ }), g.observe(Ie.value));
872
+ }), Qe(() => {
873
+ window.removeEventListener("mouseup", ye), g?.disconnect();
874
+ }), (n, i) => (c(), m("div", {
875
+ ref_key: "container",
876
+ ref: Ie,
877
+ class: "wx-bars",
878
+ style: J(`line-height: ${z.value.length ? z.value[0].$h : 0}px`),
879
+ onContextmenu: nt,
880
+ onMousedown: W,
881
+ onMousemove: pt,
882
+ onTouchstart: de,
883
+ onTouchmove: ze,
884
+ onTouchend: Oe,
885
+ onClick: lt,
886
+ onDblclick: mt,
887
+ onDragstart: i[0] || (i[0] = Ut(() => {
888
+ }, ["prevent"]))
889
+ }, [
890
+ w(xe) ? (c(!0), m(le, { key: 0 }, be(z.value, (s) => (c(), m(le, {
891
+ key: s.id
892
+ }, [
893
+ s.$visibleSlack ? (c(), m("div", {
894
+ key: 0,
895
+ class: ke("wx-slack wx-slack-" + s.type),
896
+ style: J(Se(s))
897
+ }, null, 6)) : ee("", !0)
898
+ ], 64))), 128)) : ee("", !0),
899
+ ge(Al, {
900
+ onSelectLink: st,
901
+ selectedLink: v.value,
902
+ readonly: t.readonly
903
+ }, null, 8, ["selectedLink", "readonly"]),
904
+ (c(!0), m(le, null, be(z.value, (s) => (c(), m(le, {
905
+ key: s.id
906
+ }, [
907
+ s.$skip ? ee("", !0) : (c(), m("div", {
908
+ key: 0,
909
+ class: ke([
910
+ "wx-bar",
911
+ "wx-" + Xe(s.type),
912
+ {
913
+ "wx-touch": O.value && F.value && s.id === F.value.id,
914
+ "wx-selected": k.value && k.value.id === s.id,
915
+ "wx-critical": r(s),
916
+ "wx-reorder-task": s.$reorder,
917
+ "wx-split": w(G) && s.segments
918
+ }
919
+ ]),
920
+ style: J(ht(s)),
921
+ "data-id": w(Ke)(s.id),
922
+ "data-tooltip-id": w(Ke)(s.id),
923
+ tabindex: yt.value === s.id ? "0" : "-1"
924
+ }, [
925
+ t.readonly ? ee("", !0) : (c(), m(le, { key: 0 }, [
926
+ s.id === v.value?.target && v.value?.type[2] === "s" ? (c(), ve(w(Ct), {
927
+ key: 0,
928
+ type: "danger",
929
+ css: "wx-left wx-delete-button wx-delete-link"
930
+ }, {
931
+ default: Be(() => [...i[1] || (i[1] = [
932
+ Q("i", { class: "wxi-close wx-delete-button-icon" }, null, -1)
933
+ ])]),
934
+ _: 1
935
+ })) : (c(), m("div", {
936
+ key: 1,
937
+ class: ke([
938
+ "wx-link",
939
+ "wx-left",
940
+ {
941
+ "wx-visible": k.value,
942
+ "wx-target": !k.value || !Ve(s.id, !0) && p(s.id),
943
+ "wx-selected": k.value && k.value.id === s.id && k.value.start,
944
+ "wx-critical": r(s)
945
+ }
946
+ ])
947
+ }, [...i[2] || (i[2] = [
948
+ Q("div", { class: "wx-inner" }, null, -1)
949
+ ])], 2))
950
+ ], 64)),
951
+ s.type !== "milestone" ? (c(), m(le, { key: 1 }, [
952
+ s.progress && !(w(G) && s.segments) ? (c(), m("div", Zl, [
953
+ Q("div", {
954
+ class: "wx-progress-percent",
955
+ style: J("width:" + s.progress + "%")
956
+ }, null, 4)
957
+ ])) : ee("", !0),
958
+ !t.readonly && !(w(G) && s.segments) && !(s.type === "summary" && w(fe)?.autoProgress) ? (c(), m("div", {
959
+ key: 1,
960
+ class: "wx-progress-marker",
961
+ style: J(
962
+ "left:calc(" + s.progress + "% - 10px);"
963
+ )
964
+ }, $e(s.progress), 5)) : ee("", !0),
965
+ t.taskTemplate ? (c(), ve(ut(t.taskTemplate), {
966
+ key: 2,
967
+ data: s,
968
+ api: w(e),
969
+ onaction: Pe
970
+ }, null, 8, ["data", "api"])) : w(G) && s.segments ? (c(), ve(Kl, {
971
+ key: 3,
972
+ task: s,
973
+ type: Xe(s.type)
974
+ }, null, 8, ["task", "type"])) : (c(), m("div", Ql, $e(s.text || ""), 1))
975
+ ], 64)) : (c(), m(le, { key: 2 }, [
976
+ i[3] || (i[3] = Q("div", { class: "wx-content" }, null, -1)),
977
+ t.taskTemplate ? (c(), ve(ut(t.taskTemplate), {
978
+ key: 0,
979
+ data: s,
980
+ api: w(e),
981
+ onaction: Pe
982
+ }, null, 8, ["data", "api"])) : (c(), m("div", Jl, $e(s.text), 1))
983
+ ], 64)),
984
+ t.readonly ? ee("", !0) : (c(), m(le, { key: 3 }, [
985
+ s.id === v.value?.target && v.value?.type[2] === "e" ? (c(), ve(w(Ct), {
986
+ key: 0,
987
+ type: "danger",
988
+ css: "wx-right wx-delete-button wx-delete-link"
989
+ }, {
990
+ default: Be(() => [...i[4] || (i[4] = [
991
+ Q("i", { class: "wxi-close wx-delete-button-icon" }, null, -1)
992
+ ])]),
993
+ _: 1
994
+ })) : (c(), m("div", {
995
+ key: 1,
996
+ class: ke([
997
+ "wx-link",
998
+ "wx-right",
999
+ {
1000
+ "wx-visible": k.value,
1001
+ "wx-target": !k.value || !Ve(
1002
+ s.id,
1003
+ !1
1004
+ ) && p(
1005
+ s.id
1006
+ ),
1007
+ "wx-selected": k.value && k.value.id === s.id && !k.value.start,
1008
+ "wx-critical": r(s)
1009
+ }
1010
+ ])
1011
+ }, [...i[5] || (i[5] = [
1012
+ Q("div", { class: "wx-inner" }, null, -1)
1013
+ ])], 2))
1014
+ ], 64))
1015
+ ], 14, ql)),
1016
+ w(te) && w(ue)?.[s.id] ? (c(!0), m(le, { key: 1 }, be(w(ue)[s.id], (x) => (c(), ve(jl, {
1017
+ key: x.id,
1018
+ rollup: x,
1019
+ parent: s
1020
+ }, null, 8, ["rollup", "parent"]))), 128)) : ee("", !0),
1021
+ w(U) && !s.$skip_baseline ? (c(), m("div", {
1022
+ key: 2,
1023
+ class: ke([
1024
+ "wx-baseline",
1025
+ { "wx-milestone": s.type === "milestone" }
1026
+ ]),
1027
+ style: J(Le(s))
1028
+ }, null, 6)) : ee("", !0)
1029
+ ], 64))), 128))
1030
+ ], 36));
1031
+ }
1032
+ }), tn = /* @__PURE__ */ pe(en, [["__scopeId", "data-v-a2fa1ccc"]]), ln = {
1033
+ __name: "TimeScale",
1034
+ props: {
1035
+ highlightTime: { type: Function }
1036
+ },
1037
+ setup(l) {
1038
+ const t = l, e = he("gantt-store"), { _scales: a } = e.getReactiveState(), u = $(a);
1039
+ return (S, b) => (c(), m("div", {
1040
+ class: "wx-scale",
1041
+ style: J({ width: w(u).width + "px" })
1042
+ }, [
1043
+ (c(!0), m(le, null, be(w(u).rows, (f, y) => (c(), m("div", {
1044
+ key: y,
1045
+ class: "wx-row",
1046
+ style: J({ height: f.height + "px" })
1047
+ }, [
1048
+ (c(!0), m(le, null, be(f.cells, (T, A) => (c(), m("div", {
1049
+ key: A,
1050
+ class: ke([
1051
+ "wx-cell",
1052
+ T.css,
1053
+ t.highlightTime ? t.highlightTime(T.date, T.unit) : ""
1054
+ ]),
1055
+ style: J({ width: T.width + "px" })
1056
+ }, $e(T.value), 7))), 128))
1057
+ ], 4))), 128))
1058
+ ], 4));
1059
+ }
1060
+ }, nn = /* @__PURE__ */ pe(ln, [["__scopeId", "data-v-3207e419"]]), an = { class: "wx-content" }, sn = {
1061
+ key: 0,
1062
+ class: "wx-gantt-holidays",
1063
+ style: { height: "100%" }
1064
+ }, on = ["data-id"], zt = 1, Wt = 3e-3, un = /* @__PURE__ */ Object.assign({ name: "GanttChartChart" }, {
1065
+ __name: "Chart",
1066
+ props: {
1067
+ readonly: {},
1068
+ fullWidth: {},
1069
+ fullHeight: {},
1070
+ taskTemplate: {},
1071
+ cellBorders: {},
1072
+ highlightTime: {}
1073
+ },
1074
+ setup(l) {
1075
+ const t = ct(Ft), e = l, a = he("gantt-store"), {
1076
+ _selected: u,
1077
+ scrollTop: S,
1078
+ scrollLeft: b,
1079
+ cellHeight: f,
1080
+ _scales: y,
1081
+ zoom: T,
1082
+ _markers: A
1083
+ } = a.getReactiveState(), L = $(u, !0), j = $(S), d = $(b), H = $(f), B = $(y), Z = $(T), K = $(A), M = P(0), I = P(null), h = R(() => {
1084
+ const z = [];
1085
+ return L.value.length && H.value && L.value.forEach((X) => {
1086
+ z.push(`height: ${H.value}px;top: ${X.$y - 3}px`);
1087
+ }), z;
1088
+ });
1089
+ Fe(M, () => {
1090
+ U();
1091
+ });
1092
+ const _ = R(() => Math.max(M.value, e.fullHeight));
1093
+ me(() => {
1094
+ I.value && (I.value.scrollTop = j.value, I.value.scrollLeft = d.value);
1095
+ });
1096
+ function o() {
1097
+ C(), U();
1098
+ }
1099
+ function C() {
1100
+ const z = {};
1101
+ I.value.scrollTop !== j.value && (z.top = I.value.scrollTop), I.value.scrollLeft !== d.value && (z.left = I.value.scrollLeft), a.exec("scroll-chart", z);
1102
+ }
1103
+ function U() {
1104
+ const z = M.value || 0, X = Math.ceil(z / H.value) + 1, D = Math.floor((I.value?.scrollTop || 0) / H.value), k = Math.max(0, D - zt), F = D + X + zt, V = k * H.value;
1105
+ a.exec("render-data", {
1106
+ start: k,
1107
+ end: F,
1108
+ from: V
1109
+ });
1110
+ }
1111
+ let Y = performance.now();
1112
+ function te(z) {
1113
+ const D = Math.abs(z) < 50 ? 4e-3 : 0.01, k = performance.now(), F = Math.min(k - Y, 50);
1114
+ Y = k;
1115
+ const V = ue(
1116
+ -z * D,
1117
+ -Wt * F,
1118
+ Wt * F
1119
+ );
1120
+ return Math.exp(V);
1121
+ }
1122
+ function ue(z, X, D) {
1123
+ return Math.max(Math.min(z, D), X);
1124
+ }
1125
+ let re = !1;
1126
+ function ce(z) {
1127
+ if (Z.value && (z.ctrlKey || z.metaKey)) {
1128
+ z.preventDefault();
1129
+ const X = te(z.deltaY), D = z.clientX - I.value.getBoundingClientRect().left;
1130
+ re || (re = !0, requestAnimationFrame(() => {
1131
+ a.exec("zoom-scale", {
1132
+ dir: X > 1 ? 1 : -1,
1133
+ ratio: Math.abs(1 - X),
1134
+ offset: D
1135
+ }), re = !1;
1136
+ }));
1137
+ }
1138
+ }
1139
+ function E(z) {
1140
+ const X = e.highlightTime(z.date, z.unit);
1141
+ return X ? {
1142
+ css: X,
1143
+ width: z.width
1144
+ } : null;
1145
+ }
1146
+ const G = R(() => (B.value.minUnit === "hour" || B.value.minUnit === "day") && e.highlightTime ? B.value.rows[B.value.rows.length - 1].cells.map(E) : null);
1147
+ function fe(z) {
1148
+ z.eventSource = "chart", a.exec("hotkey", z);
1149
+ }
1150
+ let xe;
1151
+ return Ze(() => {
1152
+ I.value && (M.value = I.value.clientHeight, xe = new ResizeObserver((z) => {
1153
+ for (const X of z)
1154
+ M.value = X.target.clientHeight;
1155
+ }), xe.observe(I.value));
1156
+ }), Qe(() => {
1157
+ xe?.disconnect();
1158
+ }), (z, X) => rt((c(), m("div", {
1159
+ class: "wx-chart",
1160
+ tabindex: "-1",
1161
+ ref_key: "chart",
1162
+ ref: I,
1163
+ onScroll: o,
1164
+ onWheel: ce
1165
+ }, [
1166
+ ge(nn, {
1167
+ highlightTime: e.highlightTime
1168
+ }, null, 8, ["highlightTime"]),
1169
+ w(K).length ? (c(), m("div", {
1170
+ key: 0,
1171
+ class: "wx-markers",
1172
+ style: J(`height:${_.value}px;`)
1173
+ }, [
1174
+ (c(!0), m(le, null, be(w(K), (D) => (c(), m("div", {
1175
+ key: D.id || D.left,
1176
+ class: ke("wx-marker " + (D.css || "")),
1177
+ style: J(`left:${D.left}px`)
1178
+ }, [
1179
+ Q("div", an, $e(D.text), 1)
1180
+ ], 6))), 128))
1181
+ ], 4)) : ee("", !0),
1182
+ Q("div", {
1183
+ class: "wx-area",
1184
+ style: J(`width:${e.fullWidth}px;height:${_.value}px`)
1185
+ }, [
1186
+ G.value ? (c(), m("div", sn, [
1187
+ (c(!0), m(le, null, be(G.value, (D, k) => (c(), m(le, { key: k }, [
1188
+ D ? (c(), m("div", {
1189
+ key: 0,
1190
+ class: ke(D.css),
1191
+ style: J(`width: ${D.width}px; left:${k * D.width}px`)
1192
+ }, null, 6)) : ee("", !0)
1193
+ ], 64))), 128))
1194
+ ])) : ee("", !0),
1195
+ ge(Wl, {
1196
+ borders: e.cellBorders
1197
+ }, null, 8, ["borders"]),
1198
+ w(L).length ? (c(!0), m(le, { key: 1 }, be(w(L), (D, k) => (c(), m(le, {
1199
+ key: D.id
1200
+ }, [
1201
+ D.$y ? (c(), m("div", {
1202
+ key: 0,
1203
+ class: "wx-selected",
1204
+ "data-id": w(Ke)(D.id),
1205
+ style: J(h.value[k])
1206
+ }, null, 12, on)) : ee("", !0)
1207
+ ], 64))), 128)) : ee("", !0),
1208
+ ge(tn, {
1209
+ readonly: e.readonly,
1210
+ taskTemplate: e.taskTemplate
1211
+ }, null, 8, ["readonly", "taskTemplate"])
1212
+ ], 4)
1213
+ ], 32)), [
1214
+ [w(t), {
1215
+ keys: {
1216
+ arrowup: !0,
1217
+ arrowdown: !0
1218
+ },
1219
+ exec: (D) => fe(D)
1220
+ }]
1221
+ ]);
1222
+ }
1223
+ }), rn = /* @__PURE__ */ pe(un, [["__scopeId", "data-v-def875eb"]]), cn = /* @__PURE__ */ Object.assign({ name: "GanttResizer" }, {
1224
+ __name: "Resizer",
1225
+ props: /* @__PURE__ */ Tt({
1226
+ position: { default: "after" },
1227
+ size: { default: 4 },
1228
+ dir: { default: "x" },
1229
+ onmove: { type: Function },
1230
+ compactMode: {},
1231
+ containerWidth: { default: 0 },
1232
+ leftThreshold: { default: 50 },
1233
+ rightThreshold: { default: 50 }
1234
+ }, {
1235
+ value: { default: 0 },
1236
+ valueModifiers: {},
1237
+ display: { default: "all" },
1238
+ displayModifiers: {}
1239
+ }),
1240
+ emits: ["update:value", "update:display"],
1241
+ setup(l) {
1242
+ const t = l, e = qe(l, "value"), a = qe(l, "display");
1243
+ function u(h) {
1244
+ let _ = 0;
1245
+ t.position === "center" ? _ = t.size / 2 : t.position === "before" && (_ = t.size);
1246
+ const o = {
1247
+ size: [t.size + "px", "auto"],
1248
+ p: [h - _ + "px", "0px"],
1249
+ p2: ["auto", "0px"]
1250
+ };
1251
+ if (t.dir !== "x") for (let C in o) o[C] = o[C].reverse();
1252
+ return o;
1253
+ }
1254
+ let S = 0, b;
1255
+ const f = P(!1), y = P(null);
1256
+ me(() => {
1257
+ y.value === null && e.value > 0 && (y.value = e.value);
1258
+ });
1259
+ function T(h) {
1260
+ return t.dir === "x" ? h.clientX : h.clientY;
1261
+ }
1262
+ function A(h) {
1263
+ !t.compactMode && (a.value === "grid" || a.value === "chart") || (S = T(h), b = e.value, f.value = !0, document.body.style.cursor = I.value, document.body.style.userSelect = "none", window.addEventListener("mousemove", j), window.addEventListener("mouseup", d));
1264
+ }
1265
+ let L;
1266
+ function j(h) {
1267
+ const _ = b + T(h) - S;
1268
+ e.value = _;
1269
+ let o;
1270
+ _ <= t.leftThreshold ? o = "chart" : t.containerWidth - _ <= t.rightThreshold ? o = "grid" : o = "all", a.value !== o && (a.value = o), L && clearTimeout(L), L = setTimeout(
1271
+ () => t.onmove && t.onmove(e.value),
1272
+ 100
1273
+ );
1274
+ }
1275
+ function d() {
1276
+ document.body.style.cursor = "", document.body.style.userSelect = "", f.value = !1, window.removeEventListener("mousemove", j), window.removeEventListener("mouseup", d);
1277
+ }
1278
+ function H() {
1279
+ a.value = "all", y.value !== null && (e.value = y.value, t.onmove && t.onmove(y.value));
1280
+ }
1281
+ function B(h) {
1282
+ t.compactMode ? a.value = a.value === "chart" ? "grid" : "chart" : a.value === "grid" || a.value === "chart" ? H() : a.value = h === "left" ? "chart" : "grid";
1283
+ }
1284
+ function Z() {
1285
+ B("left");
1286
+ }
1287
+ function K() {
1288
+ B("right");
1289
+ }
1290
+ const M = R(() => u(e.value)), I = R(
1291
+ () => a.value !== "all" ? "auto" : t.dir === "x" ? "ew-resize" : "ns-resize"
1292
+ );
1293
+ return (h, _) => (c(), m("div", {
1294
+ class: ke([
1295
+ "wx-resizer",
1296
+ `wx-resizer-${l.dir}`,
1297
+ `wx-resizer-display-${a.value}`,
1298
+ { "wx-resizer-active": f.value }
1299
+ ]),
1300
+ onMousedown: A,
1301
+ style: J(`width:${M.value.size[0]}; height: ${M.value.size[1]}; cursor:${I.value};`)
1302
+ }, [
1303
+ Q("div", { class: "wx-button-expand-box" }, [
1304
+ Q("div", { class: "wx-button-expand-content wx-button-expand-left" }, [
1305
+ Q("i", {
1306
+ class: "wxi-menu-left",
1307
+ onClick: Z
1308
+ })
1309
+ ]),
1310
+ Q("div", { class: "wx-button-expand-content wx-button-expand-right" }, [
1311
+ Q("i", {
1312
+ class: "wxi-menu-right",
1313
+ onClick: K
1314
+ })
1315
+ ])
1316
+ ]),
1317
+ _[0] || (_[0] = Q("div", { class: "wx-resizer-line" }, null, -1))
1318
+ ], 38));
1319
+ }
1320
+ }), dn = /* @__PURE__ */ pe(cn, [["__scopeId", "data-v-206d8277"]]), fn = 650;
1321
+ function Gt(l) {
1322
+ let t;
1323
+ function e() {
1324
+ t = new ResizeObserver((u) => {
1325
+ for (let S of u)
1326
+ if (S.target === document.body) {
1327
+ let b = S.contentRect.width <= fn;
1328
+ l(b);
1329
+ }
1330
+ }), t.observe(document.body);
1331
+ }
1332
+ function a() {
1333
+ t && (t.disconnect(), t = null);
1334
+ }
1335
+ return {
1336
+ observe: e,
1337
+ disconnect: a
1338
+ };
1339
+ }
1340
+ const vn = {
1341
+ tabindex: "0",
1342
+ class: "wx-layout"
1343
+ }, pn = /* @__PURE__ */ Object.assign({ name: "GanttLayout" }, {
1344
+ __name: "Layout",
1345
+ props: /* @__PURE__ */ Tt({
1346
+ taskTemplate: {},
1347
+ readonly: {},
1348
+ cellBorders: {},
1349
+ highlightTime: {}
1350
+ }, {
1351
+ tableAPI: {},
1352
+ tableAPIModifiers: {}
1353
+ }),
1354
+ emits: ["update:tableAPI"],
1355
+ setup(l) {
1356
+ const t = ct(Ft), e = qe(l, "tableAPI"), a = he("gantt-store"), {
1357
+ _tasks: u,
1358
+ _scales: S,
1359
+ cellHeight: b,
1360
+ columns: f,
1361
+ scrollTop: y,
1362
+ undo: T
1363
+ } = a.getReactiveState(), A = $(u), L = $(S), j = $(b), d = $(f), H = $(y), B = $(T), Z = P(!1), K = P(0), M = P(void 0), I = P(void 0), h = P(void 0), _ = P(null), o = P("all");
1364
+ me(() => {
1365
+ const k = Gt(U);
1366
+ k.observe(), bt(() => {
1367
+ k.disconnect();
1368
+ });
1369
+ });
1370
+ let C = null;
1371
+ function U(k) {
1372
+ k !== Z.value && (Z.value = k, Z.value ? (C = o.value, o.value === "all" && (o.value = "grid")) : (!C || C === "all") && (o.value = "all"));
1373
+ }
1374
+ const Y = R(() => {
1375
+ let k;
1376
+ return d.value.every((F) => F.width && !F.flexgrow) ? k = d.value.reduce((F, V) => F + parseInt(V.width), 0) : o.value === "chart" ? k = parseInt(
1377
+ d.value.find((F) => F.id === "action")?.width
1378
+ ) || 50 : k = 440, k;
1379
+ });
1380
+ me(() => {
1381
+ K.value = Y.value;
1382
+ });
1383
+ const te = R(() => M.value - h.value), ue = R(() => L.value.width), re = R(() => A.value.length * j.value), ce = R(
1384
+ () => L.value.height + re.value + te.value
1385
+ );
1386
+ me(() => {
1387
+ let k;
1388
+ _.value && (k = new ResizeObserver(E), k.observe(_.value)), bt(() => {
1389
+ k && k.disconnect();
1390
+ });
1391
+ });
1392
+ function E() {
1393
+ a.exec("resize-chart", {
1394
+ width: M.value - K.value,
1395
+ height: I.value - L.value.height,
1396
+ scrollSize: te.value
1397
+ });
1398
+ }
1399
+ const G = P(null);
1400
+ function fe() {
1401
+ a.exec("scroll-chart", {
1402
+ top: G.value.scrollTop
1403
+ });
1404
+ }
1405
+ function xe() {
1406
+ G.value && H.value !== G.value.scrollTop && (G.value.scrollTop = H.value);
1407
+ }
1408
+ me(() => {
1409
+ H.value, xe();
1410
+ });
1411
+ let z;
1412
+ Ze(() => {
1413
+ G.value && (z = new ResizeObserver(() => {
1414
+ I.value = G.value?.offsetHeight, M.value = G.value?.offsetWidth;
1415
+ }), z.observe(G.value), I.value = G.value.offsetHeight, M.value = G.value.offsetWidth);
1416
+ }), Qe(() => {
1417
+ z?.disconnect();
1418
+ });
1419
+ const X = P(null);
1420
+ let D;
1421
+ return Ze(() => {
1422
+ X.value && (D = new ResizeObserver(() => {
1423
+ h.value = X.value?.offsetWidth;
1424
+ }), D.observe(X.value), h.value = X.value.offsetWidth);
1425
+ }), Qe(() => {
1426
+ D?.disconnect();
1427
+ }), (k, F) => (c(), m("div", {
1428
+ class: "wx-gantt",
1429
+ ref_key: "ganttDiv",
1430
+ ref: G,
1431
+ onScroll: fe
1432
+ }, [
1433
+ Q("div", {
1434
+ ref_key: "pseudoRowsDiv",
1435
+ ref: X,
1436
+ class: "wx-pseudo-rows",
1437
+ style: J(`height:${ce.value}px;width:100%;`)
1438
+ }, [
1439
+ Q("div", {
1440
+ class: "wx-stuck",
1441
+ style: J(`height:${I.value}px;width:${h.value}px;`)
1442
+ }, [
1443
+ rt((c(), m("div", vn, [
1444
+ w(d).length ? (c(), m(le, { key: 0 }, [
1445
+ ge(zl, {
1446
+ display: o.value,
1447
+ "onUpdate:display": F[0] || (F[0] = (V) => o.value = V),
1448
+ compactMode: Z.value,
1449
+ columnWidth: Y.value,
1450
+ width: K.value,
1451
+ readonly: l.readonly,
1452
+ fullHeight: re.value,
1453
+ tableAPI: e.value,
1454
+ "onUpdate:tableAPI": F[1] || (F[1] = (V) => e.value = V)
1455
+ }, null, 8, ["display", "compactMode", "columnWidth", "width", "readonly", "fullHeight", "tableAPI"]),
1456
+ ge(dn, {
1457
+ value: K.value,
1458
+ "onUpdate:value": F[2] || (F[2] = (V) => K.value = V),
1459
+ display: o.value,
1460
+ "onUpdate:display": F[3] || (F[3] = (V) => o.value = V),
1461
+ compactMode: Z.value,
1462
+ containerWidth: M.value
1463
+ }, null, 8, ["value", "display", "compactMode", "containerWidth"])
1464
+ ], 64)) : ee("", !0),
1465
+ Q("div", {
1466
+ class: "wx-content",
1467
+ ref_key: "chart",
1468
+ ref: _
1469
+ }, [
1470
+ ge(rn, {
1471
+ readonly: l.readonly,
1472
+ fullWidth: ue.value,
1473
+ fullHeight: re.value,
1474
+ taskTemplate: l.taskTemplate,
1475
+ cellBorders: l.cellBorders,
1476
+ highlightTime: l.highlightTime
1477
+ }, null, 8, ["readonly", "fullWidth", "fullHeight", "taskTemplate", "cellBorders", "highlightTime"])
1478
+ ], 512)
1479
+ ])), [
1480
+ [w(t), {
1481
+ keys: {
1482
+ "ctrl+c": !0,
1483
+ "ctrl+v": !0,
1484
+ "ctrl+x": !0,
1485
+ "ctrl+d": !0,
1486
+ backspace: !0,
1487
+ "ctrl+z": w(B),
1488
+ "ctrl+y": w(B)
1489
+ },
1490
+ exec: (V) => {
1491
+ V.isInput || w(a).exec("hotkey", V);
1492
+ }
1493
+ }]
1494
+ ])
1495
+ ], 4)
1496
+ ], 4)
1497
+ ], 544));
1498
+ }
1499
+ }), mn = /* @__PURE__ */ pe(pn, [["__scopeId", "data-v-b6d88a7d"]]);
1500
+ function hn(l) {
1501
+ return {
1502
+ year: "%Y",
1503
+ quarter: `${l("Q")} %Q`,
1504
+ month: "%M",
1505
+ week: `${l("Week")} %w`,
1506
+ day: "%M %j",
1507
+ hour: "%H:%i"
1508
+ };
1509
+ }
1510
+ function gn(l, t) {
1511
+ return typeof l == "function" ? l : dt(l, t);
1512
+ }
1513
+ function jt(l, t) {
1514
+ return l.map(({ format: e, ...a }) => ({
1515
+ ...a,
1516
+ format: gn(e, t)
1517
+ }));
1518
+ }
1519
+ function xn(l, t) {
1520
+ const e = hn(t);
1521
+ for (let a in e)
1522
+ e[a] = dt(e[a], l);
1523
+ return e;
1524
+ }
1525
+ function yn(l, t) {
1526
+ if (!l || !l.length) return l;
1527
+ const e = dt("%d-%m-%Y", t);
1528
+ return l.map((a) => a.template ? a : a.id === "start" || a.id === "end" ? {
1529
+ ...a,
1530
+ //store locale template for unscheduled tasks
1531
+ _template: (u) => e(u),
1532
+ template: (u) => e(u)
1533
+ } : a.id === "duration" ? {
1534
+ ...a,
1535
+ _template: (u) => u,
1536
+ template: (u) => u
1537
+ } : a);
1538
+ }
1539
+ function kn(l, t) {
1540
+ return l.levels ? {
1541
+ ...l,
1542
+ levels: l.levels.map((e) => ({
1543
+ ...e,
1544
+ scales: jt(e.scales, t)
1545
+ }))
1546
+ } : l;
1547
+ }
1548
+ const ea = /* @__PURE__ */ Object.assign({ name: "GanttComponentsGantt" }, {
1549
+ __name: "Gantt",
1550
+ props: {
1551
+ taskTemplate: { default: null },
1552
+ markers: { default: () => [] },
1553
+ taskTypes: { default: () => tl },
1554
+ tasks: { default: () => [] },
1555
+ selected: { default: () => [] },
1556
+ activeTask: { default: null },
1557
+ links: { default: () => [] },
1558
+ scales: {
1559
+ default: () => [
1560
+ { unit: "month", step: 1, format: "%F %Y" },
1561
+ { unit: "day", step: 1, format: "%j" }
1562
+ ]
1563
+ },
1564
+ columns: { default: () => el },
1565
+ start: { default: null },
1566
+ end: { default: null },
1567
+ lengthUnit: { default: "day" },
1568
+ durationUnit: { default: "day" },
1569
+ cellWidth: { default: 100 },
1570
+ cellHeight: { default: 38 },
1571
+ scaleHeight: { default: 36 },
1572
+ readonly: { type: Boolean, default: !1 },
1573
+ cellBorders: { default: "full" },
1574
+ zoom: { type: [Boolean, Object, Array], default: !1 },
1575
+ baselines: { type: [Boolean, Object], default: !1 },
1576
+ rollups: { type: [Boolean, Object], default: !1 },
1577
+ highlightTime: { type: Function, default: null },
1578
+ init: { type: Function, default: null },
1579
+ autoScale: { type: Boolean, default: !0 },
1580
+ unscheduledTasks: { type: Boolean, default: !1 },
1581
+ criticalPath: { default: null },
1582
+ schedule: { default: () => ({ type: "forward" }) },
1583
+ projectStart: { default: null },
1584
+ projectEnd: { default: null },
1585
+ calendar: { default: null },
1586
+ undo: { type: Boolean, default: !1 },
1587
+ splitTasks: { type: Boolean, default: !1 },
1588
+ summary: { default: null },
1589
+ slack: { type: Boolean, default: !1 },
1590
+ _export: { type: Boolean, default: !1 }
1591
+ },
1592
+ setup(l, { expose: t }) {
1593
+ const e = l, a = Vt(), u = new ll(Xt), S = { ...$t, ...vt };
1594
+ let b = he("wx-i18n", null);
1595
+ b ? b = b.extend(S, !0) : b = ft(S), Ge("wx-i18n", b);
1596
+ const { calendar: f } = b.getRaw(), y = R(() => {
1597
+ let E = {
1598
+ zoom: kn(e.zoom, f),
1599
+ scales: jt(e.scales, f),
1600
+ columns: yn(e.columns, f),
1601
+ links: nl(e.links),
1602
+ cellWidth: e.cellWidth
1603
+ };
1604
+ return E.zoom && (E = {
1605
+ ...E,
1606
+ ...al(
1607
+ E.zoom,
1608
+ xn(f, b.getGroup("gantt")),
1609
+ E.scales,
1610
+ e.cellWidth
1611
+ )
1612
+ }), E;
1613
+ });
1614
+ Fe(
1615
+ () => [e.tasks, e.durationUnit, e.calendar],
1616
+ () => {
1617
+ e._export || sl(e.tasks, {
1618
+ durationUnit: e.durationUnit,
1619
+ splitTasks: e.splitTasks,
1620
+ calendar: e.calendar
1621
+ });
1622
+ },
1623
+ { immediate: !0, flush: "pre" }
1624
+ );
1625
+ let T = u.in;
1626
+ const A = /-/g;
1627
+ let L = new qt((E, G) => {
1628
+ const fe = "on" + E.replace(A, "");
1629
+ a[fe] && a[fe](G);
1630
+ });
1631
+ T.setNext(L);
1632
+ const j = P(void 0), d = P(null);
1633
+ me(() => {
1634
+ e.calendar && e.tasks && (d.value = (E, G) => G === "day" && !e.calendar.getDayHours(E) || G === "hour" && !e.calendar.getDayHours(E) ? "wx-weekend" : "");
1635
+ });
1636
+ const H = R(
1637
+ () => d.value || e.highlightTime
1638
+ ), B = u.getState.bind(u), Z = u.getReactive.bind(u), K = () => ({ data: u }), M = T.exec, I = (E) => L = L.setNext(E), h = T.intercept.bind(T), _ = T.on.bind(T), o = T.detach.bind(T), C = (E) => u.getTask(E), U = () => u.serialize(), Y = (E) => E ? new Promise((G) => setTimeout(() => G(j.value), 1)) : j.value, te = () => u.getHistory(), ue = {
1639
+ getState: B,
1640
+ getReactiveState: Z,
1641
+ getStores: K,
1642
+ exec: M,
1643
+ setNext: I,
1644
+ intercept: h,
1645
+ on: _,
1646
+ detach: o,
1647
+ getTable: Y,
1648
+ getTask: C,
1649
+ serialize: U,
1650
+ getHistory: te
1651
+ };
1652
+ t({
1653
+ getState: B,
1654
+ getReactiveState: Z,
1655
+ getStores: K,
1656
+ exec: M,
1657
+ setNext: I,
1658
+ intercept: h,
1659
+ on: _,
1660
+ detach: o,
1661
+ getTable: Y,
1662
+ getTask: C,
1663
+ serialize: U,
1664
+ getHistory: te
1665
+ }), Ge("gantt-store", {
1666
+ getReactiveState: u.getReactive.bind(u),
1667
+ exec: T.exec.bind(T),
1668
+ getTask: u.getTask.bind(u)
1669
+ });
1670
+ let re = !0;
1671
+ return me(() => {
1672
+ const E = y.value;
1673
+ u.init({
1674
+ tasks: e.tasks,
1675
+ links: E.links,
1676
+ start: e.start,
1677
+ columns: E.columns,
1678
+ end: e.end,
1679
+ lengthUnit: e.lengthUnit,
1680
+ cellWidth: E.cellWidth,
1681
+ cellHeight: e.cellHeight,
1682
+ scaleHeight: e.scaleHeight,
1683
+ scales: E.scales,
1684
+ taskTypes: e.taskTypes,
1685
+ zoom: E.zoom,
1686
+ selected: e.selected,
1687
+ activeTask: e.activeTask,
1688
+ baselines: e.baselines,
1689
+ rollups: e.rollups === !0 ? { type: "closest" } : e.rollups,
1690
+ autoScale: e.autoScale,
1691
+ unscheduledTasks: e.unscheduledTasks,
1692
+ markers: e.markers,
1693
+ durationUnit: e.durationUnit,
1694
+ criticalPath: e.criticalPath,
1695
+ schedule: e.schedule,
1696
+ projectStart: e.projectStart,
1697
+ projectEnd: e.projectEnd,
1698
+ calendar: e.calendar,
1699
+ slack: e.slack,
1700
+ undo: e.undo,
1701
+ _weekStart: f.weekStart,
1702
+ splitTasks: e.splitTasks,
1703
+ summary: e.summary
1704
+ }), re && e.init && (e.init(ue), re = !1);
1705
+ }), (E, G) => (c(), ve(mn, {
1706
+ taskTemplate: e.taskTemplate,
1707
+ readonly: e.readonly,
1708
+ cellBorders: e.cellBorders,
1709
+ highlightTime: H.value,
1710
+ tableAPI: j.value,
1711
+ "onUpdate:tableAPI": G[0] || (G[0] = (fe) => j.value = fe)
1712
+ }, null, 8, ["taskTemplate", "readonly", "cellBorders", "highlightTime", "tableAPI"]));
1713
+ }
1714
+ }), ta = /* @__PURE__ */ Object.assign({ name: "GanttToolbar" }, {
1715
+ __name: "Toolbar",
1716
+ props: {
1717
+ api: { default: null },
1718
+ items: { default: () => [] }
1719
+ },
1720
+ setup(l) {
1721
+ const t = l;
1722
+ let e = he("wx-i18n", null);
1723
+ e || (e = ft(vt), Ge("wx-i18n", e));
1724
+ const a = he("wx-i18n").getGroup("gantt"), u = ie(() => t.api?.getReactiveState()?._selected), S = ie(() => t.api?.getReactiveState()?.undo), b = ie(() => t.api?.getReactiveState()?.history), f = ie(() => t.api?.getReactiveState()?.splitTasks), y = ["undo", "redo"], T = R(() => {
1725
+ const L = St({ undo: !0, splitTasks: !0 });
1726
+ return (t.items.length ? t.items : St({
1727
+ undo: S().value,
1728
+ splitTasks: f().value
1729
+ })).map((d) => (d = { ...d, disabled: !1 }, d.handler = Pt(L, d.id) ? (H) => At(t.api, H.id, null, a) : d.handler, d.text && (d.text = a(d.text)), d.menuText && (d.menuText = a(d.menuText)), d));
1730
+ }), A = R(() => {
1731
+ const L = u().value, j = [];
1732
+ return T.value.forEach((d) => {
1733
+ const H = d.id;
1734
+ if (H === "add-task")
1735
+ j.push(d);
1736
+ else if (y.includes(H))
1737
+ y.includes(H) && j.push({
1738
+ ...d,
1739
+ disabled: d.isDisabled(b().value)
1740
+ });
1741
+ else {
1742
+ if (!L?.length || !t.api) return;
1743
+ j.push({
1744
+ ...d,
1745
+ disabled: d.isDisabled && L.some(
1746
+ (B) => d.isDisabled(B, t.api.getState())
1747
+ )
1748
+ });
1749
+ }
1750
+ }), j.filter((d, H) => {
1751
+ if (t.api && d.isHidden)
1752
+ return !L.some(
1753
+ (B) => d.isHidden(B, t.api.getState())
1754
+ );
1755
+ if (d.comp === "separator") {
1756
+ const B = j[H + 1];
1757
+ if (!B || B.comp === "separator") return !1;
1758
+ }
1759
+ return !0;
1760
+ });
1761
+ });
1762
+ return (L, j) => (c(), ve(w(kl), { items: A.value }, null, 8, ["items"]));
1763
+ }
1764
+ }), wn = ["oncontextmenu"], bn = {
1765
+ __name: "ContextMenu",
1766
+ props: {
1767
+ options: { default: () => [] },
1768
+ api: { default: null },
1769
+ resolver: { default: null },
1770
+ filter: { default: null },
1771
+ at: { default: "point" },
1772
+ onclick: { type: Function },
1773
+ css: {}
1774
+ },
1775
+ setup(l, { expose: t }) {
1776
+ const e = l;
1777
+ let a = null, u = he("wx-i18n", null);
1778
+ u || (u = ft({ ...vt, ...$t }), Ge("wx-i18n", u));
1779
+ const S = he("wx-i18n").getGroup("gantt"), b = ie(() => e.api?.getReactiveState()?.taskTypes), f = ie(() => e.api?.getReactiveState()?.selected), y = ie(() => e.api?.getReactiveState()?._selected), T = ie(() => e.api?.getReactiveState()?.splitTasks), A = ie(() => e.api?.getReactiveState()?.summary), L = R(() => ({
1780
+ splitTasks: T().value,
1781
+ taskTypes: b().value,
1782
+ summary: A().value
1783
+ })), j = R(() => It(L.value));
1784
+ function d() {
1785
+ const o = e.options.length ? e.options : It(L.value);
1786
+ return H(o);
1787
+ }
1788
+ function H(o) {
1789
+ return o.map((C) => (C = { ...C }, C.text && (C.text = S(C.text)), C.subtext && (C.subtext = S(C.subtext)), C.data && (C.data = H(C.data)), C));
1790
+ }
1791
+ function B(o, C) {
1792
+ let U = o ? e.api.getTask(o) : null;
1793
+ if (e.resolver) {
1794
+ const Y = e.resolver(o, C);
1795
+ U = Y === !0 ? U : Y;
1796
+ }
1797
+ if (U) {
1798
+ const Y = Re(C.target, "data-segment");
1799
+ Y !== null ? a = { id: U.id, segmentIndex: Y } : a = U.id, f().value.includes(U.id) || e.api.exec("select-task", { id: U.id });
1800
+ }
1801
+ return U;
1802
+ }
1803
+ function Z(o) {
1804
+ const C = o.action;
1805
+ C && (Pt(j.value, C.id) && At(e.api, C.id, a, S), e.onclick && e.onclick(o));
1806
+ }
1807
+ function K(o, C) {
1808
+ const U = y().value?.length ? y().value : C ? [C] : [];
1809
+ let Y = e.filter ? U.every((te) => e.filter(o, te)) : !0;
1810
+ if (Y && (o.isHidden && (Y = !U.some(
1811
+ (te) => o.isHidden(te, e.api.getState(), a)
1812
+ )), o.isDisabled)) {
1813
+ const te = U.some(
1814
+ (ue) => o.isDisabled(ue, e.api.getState(), a)
1815
+ );
1816
+ o.disabled = te;
1817
+ }
1818
+ return Y;
1819
+ }
1820
+ let M = !1;
1821
+ me(() => {
1822
+ e.api && !M && (M = !0, e.api.on("scroll-chart", () => h.value.show()), e.api.on("drag-task", () => h.value.show()));
1823
+ });
1824
+ const I = R(() => d()), h = P(null);
1825
+ function _(o, C) {
1826
+ h.value.show(o, C);
1827
+ }
1828
+ return t({ show: _ }), (o, C) => (c(), m(le, null, [
1829
+ ge(w(wl), {
1830
+ filter: K,
1831
+ options: I.value,
1832
+ dataKey: "id",
1833
+ resolver: B,
1834
+ onclick: Z,
1835
+ css: l.css,
1836
+ at: l.at,
1837
+ ref_key: "menu",
1838
+ ref: h
1839
+ }, null, 8, ["options", "css", "at"]),
1840
+ Q("span", {
1841
+ oncontextmenu: h.value?.show,
1842
+ "data-menu-ignore": "true"
1843
+ }, [
1844
+ Je(o.$slots, "default", {}, void 0, !0)
1845
+ ], 8, wn)
1846
+ ], 64));
1847
+ }
1848
+ }, la = /* @__PURE__ */ pe(bn, [["__scopeId", "data-v-463453b1"]]), Tn = {
1849
+ key: 0,
1850
+ class: "wx-links"
1851
+ }, $n = { class: "wx-cell" }, _n = { class: "wx-task-name" }, Sn = {
1852
+ key: 0,
1853
+ class: "wx-cell wx-link-lag"
1854
+ }, In = { class: "wx-cell" }, Cn = { class: "wx-wrapper" }, Rn = { class: "wx-cell" }, Mn = ["onclick"], Ln = /* @__PURE__ */ Object.assign({ name: "GanttEditorLinks" }, {
1855
+ __name: "Links",
1856
+ props: {
1857
+ api: {},
1858
+ autoSave: {},
1859
+ onlinkschange: { type: Function },
1860
+ onchange: { type: Function },
1861
+ comp: { type: String },
1862
+ label: { type: String },
1863
+ isHidden: { type: Function },
1864
+ setter: { type: Function },
1865
+ getter: { type: Function },
1866
+ hidden: { type: Boolean },
1867
+ error: { type: String },
1868
+ value: { type: String }
1869
+ },
1870
+ setup(l) {
1871
+ const t = he("wx-i18n").getGroup("gantt"), e = l;
1872
+ Ge("wx-input-id", null);
1873
+ const {
1874
+ activeTask: a,
1875
+ _activeTask: u,
1876
+ _links: S,
1877
+ schedule: b,
1878
+ unscheduledTasks: f
1879
+ } = e.api.getReactiveState(), y = $(a), T = $(u), A = $(S), L = $(b), j = $(f), d = P();
1880
+ me(() => {
1881
+ d.value = H();
1882
+ });
1883
+ function H() {
1884
+ if (y.value) {
1885
+ const M = A.value.filter((h) => h.target === y.value).map((h) => ({ link: h, task: e.api.getTask(h.source) })), I = A.value.filter((h) => h.source === y.value).map((h) => ({ link: h, task: e.api.getTask(h.target) }));
1886
+ return [
1887
+ { title: t("Predecessors"), data: M },
1888
+ { title: t("Successors"), data: I }
1889
+ ];
1890
+ }
1891
+ }
1892
+ const B = [
1893
+ { id: "e2s", label: t("End-to-start") },
1894
+ { id: "s2s", label: t("Start-to-start") },
1895
+ { id: "e2e", label: t("End-to-end") },
1896
+ { id: "s2e", label: t("Start-to-end") }
1897
+ ];
1898
+ function Z(M) {
1899
+ e.autoSave ? e.api.exec("delete-link", { id: M }) : (d.value = d.value.map((I) => ({
1900
+ ...I,
1901
+ data: I.data.filter((h) => h.link.id !== M)
1902
+ })), e.onlinkschange?.({
1903
+ id: M,
1904
+ action: "delete-link",
1905
+ data: { id: M }
1906
+ }));
1907
+ }
1908
+ function K(M, I) {
1909
+ e.autoSave ? e.api.exec("update-link", {
1910
+ id: M,
1911
+ link: I
1912
+ }) : (d.value = d.value.map((h) => ({
1913
+ ...h,
1914
+ data: h.data.map(
1915
+ (_) => _.link.id === M ? { ..._, link: { ..._.link, ...I } } : _
1916
+ )
1917
+ })), e.onlinkschange?.({
1918
+ id: M,
1919
+ action: "update-link",
1920
+ data: {
1921
+ id: M,
1922
+ link: I
1923
+ }
1924
+ }));
1925
+ }
1926
+ return (M, I) => (c(!0), m(le, null, be(d.value, (h) => (c(), m(le, {
1927
+ key: h.title
1928
+ }, [
1929
+ h.data.length ? (c(), m("div", Tn, [
1930
+ ge(w(rl), {
1931
+ label: h.title,
1932
+ position: "top"
1933
+ }, {
1934
+ default: Be(() => [
1935
+ Q("table", null, [
1936
+ Q("tbody", null, [
1937
+ (c(!0), m(le, null, be(h.data, (_) => (c(), m("tr", {
1938
+ key: _.link.id
1939
+ }, [
1940
+ Q("td", $n, [
1941
+ Q("div", _n, $e(_.task.text || ""), 1)
1942
+ ]),
1943
+ w(L)?.auto && _.link.type === "e2s" ? (c(), m("td", Sn, [
1944
+ ge(w(cl), {
1945
+ type: "number",
1946
+ placeholder: w(t)("Lag"),
1947
+ value: _.link.lag,
1948
+ disabled: w(j) && w(T).unscheduled,
1949
+ onchange: (o) => {
1950
+ o.input || K(_.link.id, {
1951
+ lag: o.value
1952
+ });
1953
+ }
1954
+ }, null, 8, ["placeholder", "value", "disabled", "onchange"])
1955
+ ])) : ee("", !0),
1956
+ Q("td", In, [
1957
+ Q("div", Cn, [
1958
+ ge(w(dl), {
1959
+ value: _.link.type,
1960
+ placeholder: w(t)("Select link type"),
1961
+ options: B,
1962
+ onchange: (o) => K(_.link.id, {
1963
+ type: o.value
1964
+ })
1965
+ }, {
1966
+ default: Be(({ option: o }) => [
1967
+ Et($e(o.label), 1)
1968
+ ]),
1969
+ _: 1
1970
+ }, 8, ["value", "placeholder", "onchange"])
1971
+ ])
1972
+ ]),
1973
+ Q("td", Rn, [
1974
+ Q("i", {
1975
+ class: "wxi-delete wx-delete-icon",
1976
+ onclick: () => Z(_.link.id),
1977
+ role: "button"
1978
+ }, null, 8, Mn)
1979
+ ])
1980
+ ]))), 128))
1981
+ ])
1982
+ ])
1983
+ ]),
1984
+ _: 2
1985
+ }, 1032, ["label"])
1986
+ ])) : ee("", !0)
1987
+ ], 64))), 128));
1988
+ }
1989
+ }), Hn = /* @__PURE__ */ pe(Ln, [["__scopeId", "data-v-94a2215a"]]), Bn = { class: "date-time-controll" }, zn = {
1990
+ __name: "DateTimePicker",
1991
+ props: {
1992
+ value: {},
1993
+ time: {},
1994
+ format: {},
1995
+ onchange: { type: Function }
1996
+ },
1997
+ setup(l) {
1998
+ const t = l, e = R(() => {
1999
+ const { value: u, time: S, format: b, onchange: f, ...y } = t;
2000
+ return y;
2001
+ });
2002
+ function a(u) {
2003
+ const S = new Date(u.value);
2004
+ S.setHours(t.value.getHours()), S.setMinutes(t.value.getMinutes()), t.onchange?.({ value: S });
2005
+ }
2006
+ return (u, S) => (c(), m("div", Bn, [
2007
+ ge(w(fl), Dt(e.value, {
2008
+ value: l.value,
2009
+ onchange: a,
2010
+ format: l.format,
2011
+ buttons: ["today"],
2012
+ clear: !1
2013
+ }), null, 16, ["value", "format"]),
2014
+ l.time ? (c(), ve(w(vl), {
2015
+ key: 0,
2016
+ value: l.value,
2017
+ onchange: l.onchange,
2018
+ format: l.format
2019
+ }, null, 8, ["value", "onchange", "format"])) : ee("", !0)
2020
+ ]));
2021
+ }
2022
+ }, Wn = /* @__PURE__ */ pe(zn, [["__scopeId", "data-v-1f9dfea2"]]), En = /* @__PURE__ */ Object.assign({ name: "GanttEditor" }, {
2023
+ __name: "Editor",
2024
+ props: {
2025
+ api: { default: null },
2026
+ items: { default: () => [] },
2027
+ css: { default: "" },
2028
+ layout: { default: "default" },
2029
+ readonly: { type: Boolean, default: !1 },
2030
+ placement: { default: "sidebar" },
2031
+ bottomBar: { type: [Boolean, Object], default: !0 },
2032
+ topBar: { type: [Boolean, Object], default: !0 },
2033
+ autoSave: { type: Boolean, default: !0 },
2034
+ focus: { type: Boolean, default: !1 },
2035
+ hotkeys: { default: () => ({}) }
2036
+ },
2037
+ setup(l) {
2038
+ De("select", pl), De("date", Wn), De("twostate", ml), De("slider", hl), De("counter", gl), De("links", Hn), De("checkbox", xl);
2039
+ const t = l;
2040
+ let e = he("wx-i18n", null);
2041
+ e || (e = ft({ ...vt, ...$t }), Ge("wx-i18n", e));
2042
+ const a = e.getGroup("gantt"), u = e.getRaw(), S = u.gantt?.dateFormat || u.formats?.dateFormat, b = dt(S, u.calendar), f = ie(() => t.api?.getReactiveState()?._activeTask), y = ie(() => t.api?.getReactiveState()?.activeTask), T = ie(() => t.api?.getReactiveState()?.unscheduledTasks), A = ie(() => t.api?.getReactiveState()?.rollups), L = ie(() => t.api?.getReactiveState()?.summary), j = ie(() => t.api?.getReactiveState()?.links), d = ie(() => t.api?.getReactiveState()?.taskTypes), H = ie(() => t.api?.getReactiveState()?.undo), B = ie(() => t.api?.getReactiveState()?.segmentIndex), Z = ie(() => t.api?.getReactiveState()?.isSegment), K = R(() => {
2043
+ if (t.topBar === !0 && !t.readonly) {
2044
+ const v = [
2045
+ { comp: "icon", icon: "wxi-close", id: "close" },
2046
+ { comp: "spacer" },
2047
+ {
2048
+ comp: "button",
2049
+ type: "danger",
2050
+ text: a("Delete"),
2051
+ id: "delete"
2052
+ }
2053
+ ];
2054
+ return t.autoSave ? { items: v } : {
2055
+ items: [
2056
+ ...v,
2057
+ {
2058
+ comp: "button",
2059
+ type: "primary",
2060
+ text: a("Save"),
2061
+ id: "save"
2062
+ }
2063
+ ]
2064
+ };
2065
+ }
2066
+ return t.topBar;
2067
+ }), M = P(!1), I = R(() => M.value ? "wx-full-screen" : "");
2068
+ me((v) => {
2069
+ const O = Gt(h);
2070
+ O.observe(), v(() => {
2071
+ O.disconnect();
2072
+ });
2073
+ });
2074
+ function h(v) {
2075
+ M.value = v;
2076
+ }
2077
+ const _ = R(
2078
+ () => ol({
2079
+ unscheduledTasks: T().value,
2080
+ rollups: A().value,
2081
+ summary: L().value,
2082
+ taskTypes: d().value
2083
+ })
2084
+ ), o = P({}), C = P(null), U = P(void 0), Y = P(null), te = R(() => {
2085
+ const v = f().value;
2086
+ if (!v) return null;
2087
+ let O;
2088
+ if (Z().value && v.segments ? O = { ...v.segments[B().value] } : O = { ...v }, t.readonly) {
2089
+ let N = { parent: O.parent };
2090
+ return _.value.forEach(({ key: W, comp: de }) => {
2091
+ if (de !== "links") {
2092
+ const ne = O[W];
2093
+ de === "date" && ne instanceof Date ? N[W] = b(ne) : de === "slider" && W === "progress" ? N[W] = `${ne}%` : N[W] = ne;
2094
+ }
2095
+ }), N;
2096
+ }
2097
+ return O || null;
2098
+ });
2099
+ Fe(te, (v) => {
2100
+ U.value = v;
2101
+ }), Fe(y, () => {
2102
+ o.value = {}, Y.value = null, C.value = null;
2103
+ });
2104
+ const ue = R(() => {
2105
+ let v = t.items.length ? t.items : _.value;
2106
+ return v = ce(v, U.value), U.value ? v.filter(
2107
+ (O) => !O.isHidden || !O.isHidden(U.value, t.api.getState())
2108
+ ) : v;
2109
+ }), re = R(() => ue.value.map((v) => v.key));
2110
+ function ce(v, O) {
2111
+ return v.map((N) => {
2112
+ const W = { ...N };
2113
+ if (N.config && (W.config = { ...W.config }), W.comp === "links" && t.api && (W.api = t.api, W.autoSave = t.autoSave, W.onlinkschange = E), W.comp === "select" && W.key === "type") {
2114
+ const de = W.options ?? [];
2115
+ W.options = de.map((ne) => ({
2116
+ ...ne,
2117
+ label: a(ne.label)
2118
+ }));
2119
+ }
2120
+ return W.comp === "slider" && W.key === "progress" && (W.labelTemplate = (de) => `${a(W.label)} ${de}%`), W.label && (W.label = a(W.label)), W.config?.placeholder && (W.config.placeholder = a(W.config.placeholder)), O && (W.isDisabled && W.isDisabled(O, t.api.getState()) ? W.disabled = !0 : delete W.disabled), W;
2121
+ });
2122
+ }
2123
+ function E({ id: v, action: O, data: N }) {
2124
+ o.value[v] = { action: O, data: N };
2125
+ }
2126
+ function G() {
2127
+ for (let v in o.value)
2128
+ if (j().value.byId(v)) {
2129
+ const { action: O, data: N } = o.value[v];
2130
+ t.api.exec(O, N);
2131
+ }
2132
+ }
2133
+ function fe() {
2134
+ const v = y().value, O = f().value, N = B().value, W = v.id || v;
2135
+ if (Z().value) {
2136
+ if (O.segments) {
2137
+ const de = O.segments.filter(
2138
+ (ne, _e) => _e !== N
2139
+ );
2140
+ t.api.exec("update-task", {
2141
+ id: W,
2142
+ task: { segments: de }
2143
+ });
2144
+ }
2145
+ } else
2146
+ t.api.exec("delete-task", { id: W });
2147
+ }
2148
+ function xe() {
2149
+ t.api.exec("show-editor", { id: null });
2150
+ }
2151
+ function z(v) {
2152
+ const { item: O, changes: N } = v;
2153
+ if (O.id === "delete" && fe(), O.id === "save")
2154
+ if (!N.length) G();
2155
+ else return;
2156
+ O.comp && xe();
2157
+ }
2158
+ function X(v) {
2159
+ let { update: O, key: N, input: W } = v;
2160
+ if (W && (C.value = !0), v.update = D({ ...O }, N, W), !t.autoSave) U.value = v.update;
2161
+ else if (!Y.value && !W) {
2162
+ const de = ue.value.find((ze) => ze.key === N), ne = O[N];
2163
+ (!de.validation || de.validation(ne)) && (!de.required || ne) && V(v.update);
2164
+ }
2165
+ }
2166
+ function D(v, O, N) {
2167
+ return T().value && v.type === "summary" && (v.unscheduled = !1), Ot(v, t.api.getState(), O), N || (C.value = !1), v;
2168
+ }
2169
+ function k(v) {
2170
+ t.autoSave || V(v.values);
2171
+ }
2172
+ function F(v) {
2173
+ Y.value = v.errors;
2174
+ }
2175
+ function V(v) {
2176
+ const O = y().value;
2177
+ v = {
2178
+ ...v,
2179
+ unscheduled: T().value && v.unscheduled && v.type !== "summary"
2180
+ }, delete v.links, delete v.data, (re.value.indexOf("duration") === -1 || v.segments && !v.duration) && delete v.duration;
2181
+ const N = {
2182
+ id: O.id || O,
2183
+ task: v,
2184
+ ...Z().value && { segmentIndex: B().value }
2185
+ };
2186
+ t.autoSave && C.value && (N.inProgress = C.value), t.api.exec("update-task", N), t.autoSave || G();
2187
+ }
2188
+ const Te = R(
2189
+ () => H().value ? {
2190
+ "ctrl+z": (v) => {
2191
+ v.preventDefault(), t.api.exec("undo");
2192
+ },
2193
+ "ctrl+y": (v) => {
2194
+ v.preventDefault(), t.api.exec("redo");
2195
+ }
2196
+ } : {}
2197
+ );
2198
+ return (v, O) => te.value ? (c(), ve(w(yl), { key: 0 }, {
2199
+ default: Be(() => [
2200
+ ge(w(bl), {
2201
+ css: `wx-gantt-editor ${I.value} ${l.css}`,
2202
+ items: ue.value,
2203
+ values: te.value,
2204
+ topBar: K.value,
2205
+ bottomBar: l.bottomBar,
2206
+ placement: l.placement,
2207
+ layout: l.layout,
2208
+ readonly: l.readonly,
2209
+ autoSave: l.autoSave,
2210
+ focus: l.focus,
2211
+ onaction: z,
2212
+ onsave: k,
2213
+ onvalidation: F,
2214
+ onchange: X,
2215
+ hotkeys: l.hotkeys && { ...Te.value, ...l.hotkeys }
2216
+ }, null, 8, ["css", "items", "values", "topBar", "bottomBar", "placement", "layout", "readonly", "autoSave", "focus", "hotkeys"])
2217
+ ]),
2218
+ _: 1
2219
+ })) : ee("", !0);
2220
+ }
2221
+ }), na = /* @__PURE__ */ pe(En, [["__scopeId", "data-v-004073c2"]]), aa = {
2222
+ __name: "HeaderMenu",
2223
+ props: {
2224
+ columns: { default: null },
2225
+ api: {}
2226
+ },
2227
+ setup(l) {
2228
+ const t = l, e = R(() => t.api?.getTable());
2229
+ return (a, u) => (c(), ve(w(ul), {
2230
+ api: e.value,
2231
+ columns: l.columns
2232
+ }, {
2233
+ default: Be(() => [
2234
+ a.$slots.default ? Je(a.$slots, "default", { key: 0 }) : ee("", !0)
2235
+ ]),
2236
+ _: 3
2237
+ }, 8, ["api", "columns"]));
2238
+ }
2239
+ }, Dn = {
2240
+ key: 1,
2241
+ class: "wx-gantt-tooltip-text"
2242
+ }, On = 300, Pn = /* @__PURE__ */ Object.assign({ name: "GanttWidgetsTooltip" }, {
2243
+ __name: "Tooltip",
2244
+ props: {
2245
+ api: {},
2246
+ content: {}
2247
+ },
2248
+ setup(l) {
2249
+ const t = l, e = P(null), a = P({}), u = P({}), S = P(null), b = P({});
2250
+ function f(d) {
2251
+ const H = d;
2252
+ for (; d; ) {
2253
+ if (d.getAttribute) {
2254
+ const B = Me(d, "data-tooltip-id"), Z = Me(d, "data-tooltip-at"), K = d.getAttribute("data-tooltip");
2255
+ if (B || K) {
2256
+ const M = Re(H, "data-segment");
2257
+ return { id: B, tooltip: K, target: d, at: Z, segment: M };
2258
+ }
2259
+ }
2260
+ d = d.parentNode;
2261
+ }
2262
+ return {
2263
+ id: null,
2264
+ tooltip: null,
2265
+ target: null,
2266
+ at: null,
2267
+ segment: null
2268
+ };
2269
+ }
2270
+ me(() => {
2271
+ if (S.value) {
2272
+ const d = S.value.getBoundingClientRect();
2273
+ d.right >= a.value.right && (b.value.left = a.value.width - d.width - 5), d.bottom >= a.value.bottom && (b.value.top -= d.bottom - a.value.bottom + 2);
2274
+ }
2275
+ });
2276
+ let y;
2277
+ const T = (d) => {
2278
+ clearTimeout(y), y = setTimeout(() => {
2279
+ d();
2280
+ }, On);
2281
+ };
2282
+ function A(d) {
2283
+ let { id: H, tooltip: B, target: Z, at: K, segment: M } = f(d.target);
2284
+ if (b.value = null, u.value = {}, !B)
2285
+ if (H)
2286
+ B = j(H, M);
2287
+ else {
2288
+ clearTimeout(y);
2289
+ return;
2290
+ }
2291
+ T(() => {
2292
+ H && (u.value = { data: L(H) }, M != null && (u.value.segmentIndex = M));
2293
+ const I = Z.getBoundingClientRect();
2294
+ a.value = e.value.getBoundingClientRect();
2295
+ let h, _;
2296
+ K === "left" ? (h = I.top + 5 - a.value.top, _ = I.right + 5 - a.value.left) : (h = I.top + I.height - a.value.top, _ = d.clientX - a.value.left), b.value = { top: h, left: _, text: B };
2297
+ });
2298
+ }
2299
+ function L(d) {
2300
+ return t.api?.getTask(d) || null;
2301
+ }
2302
+ function j(d, H) {
2303
+ const B = L(d);
2304
+ return H !== null && B?.segments ? B.segments[H]?.text || "" : B?.text || "";
2305
+ }
2306
+ return (d, H) => (c(), m("div", {
2307
+ class: "wx-tooltip-area",
2308
+ ref_key: "area",
2309
+ ref: e,
2310
+ onMousemove: A
2311
+ }, [
2312
+ b.value && (b.value.text || l.content) ? (c(), m("div", {
2313
+ key: 0,
2314
+ class: "wx-gantt-tooltip",
2315
+ ref_key: "tooltipNode",
2316
+ ref: S,
2317
+ style: J(`top:${b.value.top}px;left:${b.value.left}px`)
2318
+ }, [
2319
+ l.content ? (c(), ve(ut(l.content), Yt(Dt({ key: 0 }, u.value)), null, 16)) : b.value.text ? (c(), m("div", Dn, $e(b.value.text), 1)) : ee("", !0)
2320
+ ], 4)) : ee("", !0),
2321
+ Je(d.$slots, "default", {}, void 0, !0)
2322
+ ], 544));
2323
+ }
2324
+ }), sa = /* @__PURE__ */ pe(Pn, [["__scopeId", "data-v-6476f951"]]), An = /* @__PURE__ */ Object.assign({ name: "GanttThemesWillow" }, {
2325
+ __name: "Willow",
2326
+ props: {
2327
+ fonts: { type: Boolean, default: !0 }
2328
+ },
2329
+ setup(l) {
2330
+ const t = l;
2331
+ return (e, a) => e.$slots.default ? (c(), ve(w(Rt), {
2332
+ key: 0,
2333
+ fonts: t.fonts
2334
+ }, {
2335
+ default: Be(() => [
2336
+ Je(e.$slots, "default", {}, void 0, !0)
2337
+ ]),
2338
+ _: 3
2339
+ }, 8, ["fonts"])) : (c(), ve(w(Rt), {
2340
+ key: 1,
2341
+ fonts: t.fonts
2342
+ }, null, 8, ["fonts"]));
2343
+ }
2344
+ }), oa = /* @__PURE__ */ pe(An, [["__scopeId", "data-v-0c03ac4a"]]), ia = {
2345
+ __name: "WillowDark",
2346
+ props: {
2347
+ fonts: { type: Boolean, default: !0 }
2348
+ },
2349
+ setup(l) {
2350
+ const t = l;
2351
+ return (e, a) => e.$slots.default ? (c(), ve(w(Mt), {
2352
+ key: 0,
2353
+ fonts: t.fonts
2354
+ }, {
2355
+ default: Be(() => [
2356
+ Je(e.$slots, "default")
2357
+ ]),
2358
+ _: 3
2359
+ }, 8, ["fonts"])) : (c(), ve(w(Mt), {
2360
+ key: 1,
2361
+ fonts: t.fonts
2362
+ }, null, 8, ["fonts"]));
2363
+ }
2364
+ }, ua = $l.version;
2365
+ export {
2366
+ la as ContextMenu,
2367
+ na as Editor,
2368
+ ea as Gantt,
2369
+ aa as HeaderMenu,
2370
+ ta as Toolbar,
2371
+ sa as Tooltip,
2372
+ oa as Willow,
2373
+ ia as WillowDark,
2374
+ da as defaultColumns,
2375
+ fa as defaultEditorItems,
2376
+ va as defaultMenuOptions,
2377
+ pa as defaultTaskTypes,
2378
+ ma as defaultToolbarButtons,
2379
+ ha as getEditorItems,
2380
+ ga as getMenuOptions,
2381
+ xa as getToolbarButtons,
2382
+ wa as registerEditorItem,
2383
+ ya as registerScaleUnit,
2384
+ ua as version
2385
+ };