vlite3 1.4.30 → 1.4.32

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.
Files changed (79) hide show
  1. package/components/Accordion/Accordion.vue.js +19 -16
  2. package/components/Accordion/AccordionContent.vue.js +2 -2
  3. package/components/Accordion/AccordionItem.vue.js +38 -36
  4. package/components/CategoryManager/CategoryManager.vue2.js +3 -2
  5. package/components/Chart/GanttChart.vue.d.ts +13 -1
  6. package/components/Chart/GanttChart.vue.js +2 -2
  7. package/components/Chart/GanttChart.vue2.js +1185 -607
  8. package/components/Chart/GanttChartDateUtils.d.ts +38 -0
  9. package/components/Chart/GanttChartDateUtils.js +79 -0
  10. package/components/Chart/GanttChartDependencyUtils.d.ts +92 -0
  11. package/components/Chart/GanttChartDependencyUtils.js +113 -0
  12. package/components/Chart/GanttChartResizePreviewUtils.d.ts +52 -0
  13. package/components/Chart/GanttChartResizePreviewUtils.js +53 -0
  14. package/components/Chart/GanttChartTooltipUtils.d.ts +41 -0
  15. package/components/Chart/GanttChartTooltipUtils.js +63 -0
  16. package/components/Chart/index.d.ts +3 -1
  17. package/components/Chart/types.d.ts +76 -1
  18. package/components/Chart/types.js +8 -0
  19. package/components/FilePicker/FilePickerDropzone.vue.js +1 -1
  20. package/components/FilePicker/index.vue.js +2 -4
  21. package/components/Form/AccordionView.vue2.js +5 -2
  22. package/components/Form/AccordionView.vue3.js +250 -0
  23. package/components/Form/Form.vue.d.ts +0 -2
  24. package/components/Form/Form.vue.js +1 -1
  25. package/components/Form/Form.vue2.js +415 -354
  26. package/components/Form/FormField.vue.js +175 -196
  27. package/components/Form/FormFields.vue.js +1 -1
  28. package/components/Form/FormFields.vue2.js +60 -60
  29. package/components/Form/FormSkeleton.vue.js +50 -35
  30. package/components/Form/TableView.vue.js +59 -43
  31. package/components/Form/composables/useForm.js +159 -148
  32. package/components/Form/index.vue2.js +8 -8
  33. package/components/Form/utils/form.utils.d.ts +2 -0
  34. package/components/Form/utils/form.utils.js +17 -13
  35. package/components/GoogleMap.vue.d.ts +1 -1
  36. package/components/PanZoomViewport/PanZoomViewport.vue.d.ts +189 -0
  37. package/components/PanZoomViewport/PanZoomViewport.vue.js +7 -0
  38. package/components/PanZoomViewport/PanZoomViewport.vue2.js +536 -0
  39. package/components/PanZoomViewport/index.d.ts +2 -0
  40. package/components/PanZoomViewport/types.d.ts +121 -0
  41. package/components/ScaleGenerator/ScaleGenerator.vue.d.ts +3 -0
  42. package/components/ScaleGenerator/ScaleGenerator.vue.js +5 -108
  43. package/components/ScaleGenerator/ScaleGenerator.vue2.js +143 -2
  44. package/components/ScaleGenerator/types.d.ts +2 -0
  45. package/components/Screen/ScreenFilter.vue.js +18 -17
  46. package/components/SeoProvider/SeoProvider.vue.d.ts +4 -1
  47. package/components/SeoProvider/SeoProvider.vue.js +39 -33
  48. package/components/SeoProvider/domAdapter.d.ts +1 -4
  49. package/components/SeoProvider/domAdapter.js +71 -58
  50. package/components/SeoProvider/index.d.ts +5 -2
  51. package/components/SeoProvider/normalizeSeo.d.ts +10 -49
  52. package/components/SeoProvider/normalizeSeo.js +246 -182
  53. package/components/SeoProvider/plainText.d.ts +8 -0
  54. package/components/SeoProvider/plainText.js +117 -0
  55. package/components/SeoProvider/seoUrl.d.ts +13 -0
  56. package/components/SeoProvider/seoUrl.js +25 -0
  57. package/components/SeoProvider/structuredData.d.ts +100 -0
  58. package/components/SeoProvider/structuredData.js +33 -0
  59. package/components/SeoProvider/types.d.ts +47 -109
  60. package/components/Tabes/Tabes.vue.d.ts +10 -1
  61. package/components/Tabes/Tabes.vue.js +1 -1
  62. package/components/Tabes/Tabes.vue2.js +271 -170
  63. package/components/Tabes/TabesMarkerGeometry.d.ts +34 -0
  64. package/components/Tabes/TabesMarkerGeometry.js +21 -0
  65. package/components/Tabes/tabes.utils.d.ts +14 -0
  66. package/components/Tabes/tabes.utils.js +26 -0
  67. package/components/Tabes/types.d.ts +32 -0
  68. package/components/ThemeProvider/ThemeProvider.vue.d.ts +2 -0
  69. package/components/ThemeProvider/ThemeProvider.vue.js +29 -23
  70. package/components/ThemeProvider/index.d.ts +1 -1
  71. package/components/ThemeProvider/themeVars.d.ts +9 -13
  72. package/components/ThemeProvider/themeVars.js +173 -125
  73. package/components/ThemeProvider/types.d.ts +10 -0
  74. package/components/index.d.ts +2 -1
  75. package/index.d.ts +1 -0
  76. package/index.js +415 -387
  77. package/package.json +3 -2
  78. package/style.css +1 -1
  79. package/components/Form/AccordionView.vue.js +0 -222
@@ -1,24 +1,42 @@
1
- import { defineComponent as et, ref as x, computed as p, onMounted as tt, watch as ze, onUnmounted as ot, openBlock as u, createElementBlock as d, createElementVNode as r, createStaticVNode as nt, createCommentVNode as h, normalizeStyle as D, Fragment as $, renderList as C, normalizeClass as me, toDisplayString as b, unref as z, withDirectives as lt, vShow as at, createBlock as st, Teleport as rt, createTextVNode as We, nextTick as ke } from "vue";
2
- import { CHART_COLORS as it, getColor as ut, animateProgress as dt } from "./utils.js";
3
- const ct = {
1
+ import { defineComponent as mn, ref as k, computed as $, watch as he, onMounted as xn, onUnmounted as wn, openBlock as v, createElementBlock as g, createElementVNode as u, createStaticVNode as bn, createCommentVNode as m, normalizeStyle as R, Fragment as C, renderList as z, normalizeClass as ke, toDisplayString as M, unref as N, withDirectives as Dn, vShow as $n, withKeys as It, withModifiers as Mt, createBlock as In, Teleport as Mn, createTextVNode as Lt, nextTick as Ye } from "vue";
2
+ import { CHART_COLORS as Ln, getColor as Sn, animateProgress as Cn } from "./utils.js";
3
+ import { resolveGanttScheduleDependencyEdges as St, ganttDependencyEdgeKey as Tn, getGanttDependencyEdgeMidpoint as En, ganttDependencyTypeLabel as Ct, getGanttDependencyEdgeScrollDelta as Tt, getGanttDependencyConnectorPosition as Wn, validateGanttDependencyLink as Qe, describeGanttDependencyLinkValidation as Je, findGanttDependencyBarAtPoint as Rn } from "./GanttChartDependencyUtils.js";
4
+ import { parseGanttDate as me, ganttAddDays as An, ganttStartOfWeek as Pn, ganttStartOfMonth as _n, ganttDateToX as Bn, ganttCalendarDaysBetween as Hn, ganttDaysToPx as zn, ganttPxToDays as Gn } from "./GanttChartDateUtils.js";
5
+ import { ganttPreviewBarGeometry as Fn, computeGanttInteractionPreview as Xn } from "./GanttChartResizePreviewUtils.js";
6
+ import { placeGanttTaskTooltip as qn, isGanttPointerNearConnector as On } from "./GanttChartTooltipUtils.js";
7
+ const Vn = {
4
8
  key: 0,
5
9
  class: "vlite-gantt-toolbar"
6
- }, vt = {
10
+ }, Kn = {
7
11
  key: 0,
8
12
  class: "vlite-gantt-zoom-controls"
9
- }, ft = ["disabled"], gt = ["disabled"], ht = { class: "vlite-gantt-wrapper" }, yt = ["onClick"], mt = { class: "text-xs font-bold text-foreground uppercase tracking-wide" }, kt = { class: "vlite-gantt-group-count" }, xt = ["onClick"], pt = { class: "truncate text-xs font-medium text-foreground" }, wt = {
13
+ }, Zn = ["disabled"], Nn = ["disabled"], jn = { class: "vlite-gantt-wrapper" }, Un = ["onClick"], Yn = { class: "text-xs font-bold text-foreground uppercase tracking-wide" }, Qn = { class: "vlite-gantt-group-count" }, Jn = ["onClick"], eo = { class: "truncate text-xs font-medium text-foreground" }, to = {
10
14
  key: 0,
11
15
  class: "vlite-gantt-progress-badge"
12
- }, bt = ["width", "height"], $t = ["x1", "x2", "y2"], Mt = ["x", "y"], Dt = ["x", "y"], St = ["width", "height"], Ct = ["id"], Lt = ["stop-color"], _t = ["stop-color"], Ht = ["id"], zt = ["stop-color"], Wt = ["stop-color"], Tt = ["x1", "x2", "y2"], Et = ["y1", "x2", "y2"], It = ["y", "width", "height"], Bt = ["d"], Rt = ["d"], At = ["d", "fill", "stroke", "opacity", "onMouseenter", "onMousemove", "onClick"], Pt = ["d", "fill"], Ft = ["d", "fill"], Zt = ["d", "fill"], Ot = ["x", "y", "width", "height", "onMouseenter", "onMousemove", "onMousedown", "onClick"], Gt = ["x", "y", "width", "height", "rx", "ry"], qt = ["x", "y", "height"], Xt = ["x", "y", "height"], jt = ["x", "y", "fill", "opacity"], Nt = { key: 1 }, Vt = ["x1", "x2", "y2", "stroke"], Ut = ["cx", "fill"], Kt = ["x", "fill"], Qt = { class: "font-semibold text-xs mb-1.5" }, Jt = { class: "flex items-center gap-1.5 text-[11px] text-muted-foreground mb-1" }, Yt = { class: "text-[10px] text-muted-foreground" }, eo = {
16
+ }, no = ["width", "height"], oo = ["x1", "x2", "y2"], ao = ["x", "y"], lo = ["x", "y"], ro = ["width", "height"], so = ["id"], io = ["stop-color"], uo = ["stop-color"], co = ["id"], vo = ["stop-color"], fo = ["stop-color"], go = ["x1", "x2", "y2"], yo = ["y1", "x2", "y2"], po = ["y", "width", "height"], ho = ["d", "onClick"], ko = ["d", "stroke", "stroke-width", "stroke-opacity"], mo = ["d", "fill", "fill-opacity"], xo = ["transform", "aria-label", "onKeydown"], wo = ["onMouseenter"], bo = ["d", "fill", "stroke", "opacity", "onMouseenter", "onMousemove", "onClick"], Do = ["d", "fill"], $o = ["d", "fill"], Io = ["d", "fill"], Mo = ["x", "y", "width", "height", "onMouseenter", "onMousemove", "onMousedown", "onClick"], Lo = ["x", "y", "width", "height", "rx", "ry"], So = ["x", "y", "height"], Co = ["x", "y", "height"], To = ["x", "y", "fill", "opacity"], Eo = ["transform", "aria-label", "onPointerdown", "onKeydown", "onFocus", "onMouseenter"], Wo = {
17
+ key: 3,
18
+ class: "pointer-events-none"
19
+ }, Ro = ["x", "y", "width", "height", "rx", "stroke", "stroke-dasharray"], Ao = ["x", "y", "fill"], Po = {
20
+ key: 2,
21
+ class: "vlite-gantt-link-preview pointer-events-none"
22
+ }, _o = ["x1", "y1", "x2", "y2", "stroke", "stroke-dasharray", "stroke-opacity"], Bo = ["cx", "cy", "fill", "fill-opacity"], Ho = { key: 3 }, zo = ["x1", "x2", "y2", "stroke"], Go = ["cx", "fill"], Fo = ["x", "fill"], Xo = {
23
+ class: "sr-only",
24
+ role: "status",
25
+ "aria-live": "polite",
26
+ "aria-atomic": "true"
27
+ }, qo = { class: "font-semibold text-xs mb-1.5" }, Oo = { class: "flex items-center gap-1.5 text-[11px] text-muted-foreground mb-1" }, Vo = { class: "text-[10px] text-muted-foreground" }, Ko = {
13
28
  key: 0,
14
29
  class: "mt-1.5 flex items-center gap-2"
15
- }, to = { class: "vlite-gantt-tooltip-progress-track" }, oo = { class: "text-[10px] font-semibold" }, no = {
30
+ }, Zo = { class: "vlite-gantt-tooltip-progress-track" }, No = { class: "text-[10px] font-semibold" }, jo = {
16
31
  key: 1,
17
32
  class: "text-[10px] text-muted-foreground mt-1 opacity-60"
18
- }, lo = {
33
+ }, Uo = {
19
34
  key: 2,
20
35
  class: "text-[9px] text-muted-foreground mt-1.5 opacity-40"
21
- }, ao = 16, Y = 5, so = 4, Te = 8, uo = /* @__PURE__ */ et({
36
+ }, Yo = {
37
+ key: 3,
38
+ class: "text-[9px] text-muted-foreground mt-1 opacity-40"
39
+ }, Qo = 16, Ae = 5, Jo = 4, et = "#eab308", Et = 8, ea = 7, sa = /* @__PURE__ */ mn({
22
40
  __name: "GanttChart",
23
41
  props: {
24
42
  tasks: {},
@@ -36,227 +54,283 @@ const ct = {
36
54
  showTodayLine: { type: Boolean, default: !0 },
37
55
  showHeader: { type: Boolean, default: !0 },
38
56
  animate: { type: Boolean, default: !0 },
39
- colors: { default: () => it },
57
+ colors: { default: () => Ln },
40
58
  todayColor: { default: "var(--color-danger)" },
41
59
  locale: { default: "en-US" },
42
60
  draggable: { type: Boolean, default: !0 },
61
+ editableDependencies: { type: Boolean, default: !1 },
43
62
  cascadeDependencies: { type: Boolean, default: !1 },
44
63
  zoom: { type: Boolean, default: !0 }
45
64
  },
46
- emits: ["task-click", "task-hover", "task-update"],
47
- setup(c, { emit: Ee }) {
48
- const s = c, A = Ee;
49
- function xe(t) {
50
- return t instanceof Date ? new Date(t.getTime()) : new Date(t);
51
- }
52
- function X(t, o) {
53
- const e = Date.UTC(t.getFullYear(), t.getMonth(), t.getDate(), t.getHours(), t.getMinutes(), t.getSeconds());
54
- return (Date.UTC(o.getFullYear(), o.getMonth(), o.getDate(), o.getHours(), o.getMinutes(), o.getSeconds()) - e) / 864e5;
55
- }
56
- function y(t, o) {
57
- const e = new Date(t);
58
- return e.setDate(e.getDate() + o), e;
59
- }
60
- function Ie(t) {
61
- const o = new Date(t), e = o.getDay();
62
- return o.setDate(o.getDate() - (e === 0 ? 6 : e - 1)), o.setHours(0, 0, 0, 0), o;
63
- }
64
- function Be(t) {
65
- return new Date(t.getFullYear(), t.getMonth(), 1);
66
- }
67
- const j = x(), L = x(), P = x(800);
68
- let ee = null;
69
- function Re() {
70
- j.value && (ee = new ResizeObserver((t) => {
71
- const o = Math.round(t[0].contentRect.width || 800);
72
- Math.abs(P.value - o) > 0.5 && (P.value = o);
73
- }), ee.observe(j.value), P.value = Math.round(j.value.clientWidth || 800));
74
- }
75
- const _ = p(
76
- () => s.tasks.map((t, o) => ({
77
- ...t,
78
- _start: xe(t.start),
79
- _end: xe(t.end),
80
- _color: t.color ?? ut(s.colors, o),
81
- _index: o
65
+ emits: ["task-click", "task-hover", "task-update", "dependency-create", "dependency-delete"],
66
+ setup(d, { emit: Wt }) {
67
+ const i = d, X = Wt;
68
+ function tt(e) {
69
+ return me(e);
70
+ }
71
+ function nt(e, n) {
72
+ return Hn(e, n);
73
+ }
74
+ function B(e, n) {
75
+ return An(e, n);
76
+ }
77
+ function Rt(e) {
78
+ return Pn(e);
79
+ }
80
+ function At(e) {
81
+ return _n(e);
82
+ }
83
+ const xe = k(), A = k(), le = k(800);
84
+ let Pe = null;
85
+ function Pt() {
86
+ xe.value && (Pe = new ResizeObserver((e) => {
87
+ const n = Math.round(e[0].contentRect.width || 800);
88
+ Math.abs(le.value - n) > 0.5 && (le.value = n);
89
+ }), Pe.observe(xe.value), le.value = Math.round(xe.value.clientWidth || 800));
90
+ }
91
+ const w = $(
92
+ () => i.tasks.map((e, n) => ({
93
+ ...e,
94
+ _start: tt(e.start),
95
+ _end: tt(e.end),
96
+ _color: e.color ?? Sn(i.colors, n),
97
+ _index: n
82
98
  }))
83
- ), N = x(/* @__PURE__ */ new Set());
84
- function Ae(t) {
85
- const o = new Set(N.value);
86
- o.has(t) ? o.delete(t) : o.add(t), N.value = o;
87
- }
88
- const te = p(() => {
89
- const t = /* @__PURE__ */ new Map(), o = [];
90
- for (const e of _.value)
91
- e.group ? (t.has(e.group) || t.set(e.group, []), t.get(e.group).push(e)) : o.push(e);
92
- return { grouped: t, ungrouped: o };
93
- }), F = p(() => {
94
- const t = [];
95
- for (const [o, e] of te.value.grouped)
96
- if (t.push({ type: "group-header", group: o }), !N.value.has(o)) for (const n of e) t.push({ type: "task", group: o, task: n });
97
- for (const o of te.value.ungrouped) t.push({ type: "task", task: o });
98
- return t;
99
- }), W = p(() => {
100
- if (!_.value.length) {
101
- const i = /* @__PURE__ */ new Date();
102
- return { start: y(i, -7), end: y(i, 30) };
99
+ ), we = k(/* @__PURE__ */ new Set());
100
+ function _t(e) {
101
+ const n = new Set(we.value);
102
+ n.has(e) ? n.delete(e) : n.add(e), we.value = n;
103
+ }
104
+ const _e = $(() => {
105
+ const e = /* @__PURE__ */ new Map(), n = [];
106
+ for (const t of w.value)
107
+ t.group ? (e.has(t.group) || e.set(t.group, []), e.get(t.group).push(t)) : n.push(t);
108
+ return { grouped: e, ungrouped: n };
109
+ }), re = $(() => {
110
+ const e = [];
111
+ for (const [n, t] of _e.value.grouped)
112
+ if (e.push({ type: "group-header", group: n }), !we.value.has(n)) for (const o of t) e.push({ type: "task", group: n, task: o });
113
+ for (const n of _e.value.ungrouped) e.push({ type: "task", task: n });
114
+ return e;
115
+ }), be = $(() => {
116
+ if (!w.value.length) {
117
+ const s = me(/* @__PURE__ */ new Date());
118
+ return { start: B(s, -7), end: B(s, 30) };
103
119
  }
104
- let t = _.value[0]._start, o = _.value[0]._end;
105
- for (const i of _.value)
106
- i._start < t && (t = i._start), i._end > o && (o = i._end);
107
- const e = s.viewMode === "day" ? 2 : s.viewMode === "week" ? 5 : 15;
108
- let n = y(t, -e), a = y(o, e);
109
- return s.viewMode === "week" ? n = Ie(n) : s.viewMode === "month" ? n = Be(n) : n.setHours(0, 0, 0, 0), { start: n, end: a };
110
- }), m = x(1);
111
- let T = null;
112
- function Pe(t) {
113
- if (s.zoom && (t.ctrlKey || t.metaKey)) {
114
- t.preventDefault();
115
- const o = L.value;
116
- if (!o) return;
117
- const e = o.getBoundingClientRect(), n = t.clientX - e.left, i = (T !== null ? T : o.scrollLeft) + n, f = m.value;
118
- let v = f * Math.exp(-t.deltaY * 5e-3);
119
- if (v = Math.max(0.2, Math.min(v, 5)), v === f) return;
120
- m.value = v;
121
- const k = v / f;
122
- T = i * k - n, ke(() => {
123
- L.value && T !== null && (L.value.scrollLeft = T, T = null);
120
+ let e = w.value[0]._start, n = w.value[0]._end;
121
+ for (const s of w.value)
122
+ s._start < e && (e = s._start), s._end > n && (n = s._end);
123
+ const t = i.viewMode === "day" ? 2 : i.viewMode === "week" ? 5 : 15;
124
+ let o = B(e, -t), a = B(n, t);
125
+ return i.viewMode === "week" ? o = Rt(o) : i.viewMode === "month" ? o = At(o) : o = me(o), { start: o, end: a };
126
+ }), D = k(1);
127
+ let j = null;
128
+ function Bt(e) {
129
+ if (i.zoom && (e.ctrlKey || e.metaKey)) {
130
+ e.preventDefault();
131
+ const n = A.value;
132
+ if (!n) return;
133
+ const t = n.getBoundingClientRect(), o = e.clientX - t.left, s = (j !== null ? j : n.scrollLeft) + o, c = D.value;
134
+ let f = c * Math.exp(-e.deltaY * 5e-3);
135
+ if (f = Math.max(0.2, Math.min(f, 5)), f === c) return;
136
+ D.value = f;
137
+ const y = f / c;
138
+ j = s * y - o, Ye(() => {
139
+ A.value && j !== null && (A.value.scrollLeft = j, j = null);
124
140
  });
125
141
  }
126
142
  }
127
- function Fe() {
128
- const t = L.value;
129
- if (!t) {
130
- m.value = Math.min(m.value + 0.2, 5);
143
+ function Ht() {
144
+ const e = A.value;
145
+ if (!e) {
146
+ D.value = Math.min(D.value + 0.2, 5);
131
147
  return;
132
148
  }
133
- const o = t.clientWidth / 2, e = t.scrollLeft + o, n = m.value;
134
- m.value = Math.min(n + 0.2, 5);
135
- const a = m.value / n;
136
- ke(() => t.scrollLeft = e * a - o);
149
+ const n = e.clientWidth / 2, t = e.scrollLeft + n, o = D.value;
150
+ D.value = Math.min(o + 0.2, 5);
151
+ const a = D.value / o;
152
+ Ye(() => e.scrollLeft = t * a - n);
137
153
  }
138
- function Ze() {
139
- const t = L.value;
140
- if (!t) {
141
- m.value = Math.max(m.value - 0.2, 0.2);
154
+ function zt() {
155
+ const e = A.value;
156
+ if (!e) {
157
+ D.value = Math.max(D.value - 0.2, 0.2);
142
158
  return;
143
159
  }
144
- const o = t.clientWidth / 2, e = t.scrollLeft + o, n = m.value;
145
- m.value = Math.max(n - 0.2, 0.2);
146
- const a = m.value / n;
147
- ke(() => t.scrollLeft = e * a - o);
148
- }
149
- const oe = p(() => {
150
- const t = [], { start: o, end: e } = W.value;
151
- let n = new Date(o);
152
- if (s.viewMode === "day")
153
- for (; n <= e; )
154
- t.push(n), n = y(n, 1);
155
- else if (s.viewMode === "week")
156
- for (; n <= e; )
157
- t.push(n), n = y(n, 7);
160
+ const n = e.clientWidth / 2, t = e.scrollLeft + n, o = D.value;
161
+ D.value = Math.max(o - 0.2, 0.2);
162
+ const a = D.value / o;
163
+ Ye(() => e.scrollLeft = t * a - n);
164
+ }
165
+ const Be = $(() => {
166
+ const e = [], { start: n, end: t } = be.value;
167
+ let o = new Date(n);
168
+ if (i.viewMode === "day")
169
+ for (; o <= t; )
170
+ e.push(o), o = B(o, 1);
171
+ else if (i.viewMode === "week")
172
+ for (; o <= t; )
173
+ e.push(o), o = B(o, 7);
158
174
  else
159
- for (; n <= e; )
160
- t.push(n), n = new Date(n.getFullYear(), n.getMonth() + 1, 1);
161
- return t;
162
- }), M = p(() => {
163
- let o = { day: 40, week: 120, month: 180 }[s.viewMode] * m.value;
164
- const e = Math.max(0, P.value - s.sidebarWidth), n = oe.value.length;
165
- return n > 0 && o * n < e && (o = e / n), o;
166
- }), pe = p(() => {
167
- const t = M.value;
168
- return oe.value.map((o, e) => {
169
- let n = "", a = "";
170
- return s.viewMode === "day" ? (n = o.toLocaleDateString(s.locale, { day: "numeric" }), a = o.toLocaleDateString(s.locale, { weekday: "short" })) : s.viewMode === "week" ? (n = o.toLocaleDateString(s.locale, { month: "short", day: "numeric" }), a = `W${Oe(o)}`) : (n = o.toLocaleDateString(s.locale, { month: "long" }), a = String(o.getFullYear())), { label: n, sublabel: a, x: e * t, width: t };
175
+ for (; o <= t; )
176
+ e.push(o), o = new Date(o.getFullYear(), o.getMonth() + 1, 1);
177
+ return e;
178
+ }), se = $(() => {
179
+ let n = { day: 40, week: 120, month: 180 }[i.viewMode] * D.value;
180
+ const t = Math.max(0, le.value - i.sidebarWidth), o = Be.value.length;
181
+ return o > 0 && n * o < t && (n = t / o), n;
182
+ }), ot = $(() => {
183
+ const e = se.value;
184
+ return Be.value.map((n, t) => {
185
+ let o = "", a = "";
186
+ return i.viewMode === "day" ? (o = n.toLocaleDateString(i.locale, { day: "numeric" }), a = n.toLocaleDateString(i.locale, { weekday: "short" })) : i.viewMode === "week" ? (o = n.toLocaleDateString(i.locale, { month: "short", day: "numeric" }), a = `W${Gt(n)}`) : (o = n.toLocaleDateString(i.locale, { month: "long" }), a = String(n.getFullYear())), { label: o, sublabel: a, x: t * e, width: e };
171
187
  });
172
188
  });
173
- function Oe(t) {
174
- const o = new Date(t.getTime());
175
- o.setHours(0, 0, 0, 0), o.setDate(o.getDate() + 3 - (o.getDay() + 6) % 7);
176
- const e = new Date(o.getFullYear(), 0, 4);
177
- return 1 + Math.round(((o.getTime() - e.getTime()) / 864e5 - 3 + (e.getDay() + 6) % 7) / 7);
178
- }
179
- const Z = p(() => oe.value.length * M.value), E = p(() => s.showHeader ? 56 : 0), O = p(() => {
180
- const t = F.value.length * s.rowHeight;
181
- return Math.max(s.height || t, t);
189
+ function Gt(e) {
190
+ const n = new Date(e.getTime());
191
+ n.setHours(0, 0, 0, 0), n.setDate(n.getDate() + 3 - (n.getDay() + 6) % 7);
192
+ const t = new Date(n.getFullYear(), 0, 4);
193
+ return 1 + Math.round(((n.getTime() - t.getTime()) / 864e5 - 3 + (t.getDay() + 6) % 7) / 7);
194
+ }
195
+ const ie = $(() => Be.value.length * se.value), U = $(() => i.showHeader ? 56 : 0), ue = $(() => {
196
+ const e = re.value.length * i.rowHeight;
197
+ return Math.max(i.height || e, e);
182
198
  });
183
- function ne(t) {
184
- if (s.viewMode === "day")
185
- return X(W.value.start, t) * M.value;
186
- if (s.viewMode === "week")
187
- return X(W.value.start, t) / 7 * M.value;
188
- {
189
- const o = W.value.start, e = (t.getFullYear() - o.getFullYear()) * 12 + (t.getMonth() - o.getMonth()), n = new Date(t.getFullYear(), t.getMonth() + 1, 0).getDate(), a = (t.getDate() - 1 + t.getHours() / 24 + t.getMinutes() / 1440) / n;
190
- return (e + a) * M.value;
191
- }
199
+ function De(e) {
200
+ return Bn(e, be.value.start, i.viewMode, se.value);
192
201
  }
193
- function le(t) {
194
- return s.viewMode === "day" ? t / M.value : s.viewMode === "week" ? t / M.value * 7 : t / M.value * 30.44;
202
+ function Ft(e) {
203
+ return Gn(e, i.viewMode, se.value);
195
204
  }
196
- function we(t) {
197
- return s.viewMode === "day" ? t * M.value : s.viewMode === "week" ? t / 7 * M.value : t / 30.44 * M.value;
205
+ function Xt(e) {
206
+ return zn(e, i.viewMode, se.value);
198
207
  }
199
- const w = p(() => {
200
- const t = Q.value;
201
- return F.value.reduce((o, e, n) => {
202
- if (e.type !== "task" || !e.task) return o;
203
- const a = e.task, i = ne(a._start), f = ne(a._end), v = Math.max(8, f - i), k = v * t, S = n * s.rowHeight + (s.rowHeight - s.barHeight) / 2, ge = a.progress != null ? v * Math.min(100, a.progress) / 100 * t : 0;
204
- return o.push({ task: a, x: i, y: S, fullW: v, w: k, progressW: ge, rowIndex: n }), o;
208
+ const b = $(() => {
209
+ const e = We.value;
210
+ return re.value.reduce((n, t, o) => {
211
+ if (t.type !== "task" || !t.task) return n;
212
+ const a = t.task, s = De(a._start), c = De(a._end), f = Math.max(8, c - s), y = f * e, x = o * i.rowHeight + (i.rowHeight - i.barHeight) / 2, W = a.progress != null ? f * Math.min(100, a.progress) / 100 * e : 0;
213
+ return n.push({ task: a, x: s, y: x, fullW: f, w: y, progressW: W, rowIndex: o }), n;
205
214
  }, []);
206
- }), Ge = p(() => {
207
- if (!s.showDependencies) return [];
208
- const t = /* @__PURE__ */ new Map();
209
- for (const e of w.value) t.set(e.task.id, e);
210
- const o = [];
211
- for (const e of w.value)
212
- if (e.task.dependencies?.length)
213
- for (const n of e.task.dependencies) {
214
- const a = t.get(n);
215
- if (!a) continue;
216
- const i = a.x + a.fullW, f = a.y + s.barHeight / 2, v = e.x, k = e.y + s.barHeight / 2;
217
- o.push({ d: qe(i, f, v, k), ad: Xe(v, k) });
218
- }
219
- return o;
215
+ }), He = $(() => {
216
+ if (!i.showDependencies) return [];
217
+ const e = /* @__PURE__ */ new Map();
218
+ for (const t of b.value) e.set(t.task.id, t);
219
+ const n = [];
220
+ for (const t of St(w.value)) {
221
+ const o = e.get(t.predecessorId), a = e.get(t.successorId);
222
+ if (!o || !a) continue;
223
+ const s = o.x + o.fullW, c = o.y + i.barHeight / 2, f = a.x, y = a.y + i.barHeight / 2, x = En(s, c, f, y);
224
+ n.push({
225
+ key: Tn(t.predecessorId, t.successorId),
226
+ predecessorId: t.predecessorId,
227
+ successorId: t.successorId,
228
+ d: Zt(s, c, f, y),
229
+ ad: Nt(f, y),
230
+ midX: x.x,
231
+ midY: x.y
232
+ });
233
+ }
234
+ return n;
235
+ }), S = k(null), ce = $(() => S.value ? He.value.find((e) => e.key === S.value) ?? null : null), qt = $(() => {
236
+ const e = ce.value;
237
+ if (!e) return "Delete dependency";
238
+ const n = w.value.find((o) => o.id === e.predecessorId)?.name ?? e.predecessorId, t = w.value.find((o) => o.id === e.successorId)?.name ?? e.successorId;
239
+ return `Delete dependency from ${n} to ${t}`;
240
+ });
241
+ function Y(e) {
242
+ return S.value === e;
243
+ }
244
+ function de(e = !1) {
245
+ S.value && (S.value = null, e && E("Dependency deselected"));
246
+ }
247
+ function Ot(e, n) {
248
+ if (!i.editableDependencies || l.active || r.active) return;
249
+ e.preventDefault(), e.stopPropagation(), S.value = n.key;
250
+ const t = w.value.find((a) => a.id === n.predecessorId), o = w.value.find((a) => a.id === n.successorId);
251
+ E(
252
+ `Dependency selected from ${t?.name ?? n.predecessorId} to ${o?.name ?? n.successorId}. Press Delete to remove, or Escape to deselect.`
253
+ );
254
+ }
255
+ function Vt(e) {
256
+ e.preventDefault(), e.stopPropagation(), $e();
257
+ }
258
+ function $e() {
259
+ const e = ce.value;
260
+ if (!e || !i.editableDependencies) return;
261
+ const n = w.value.find((a) => a.id === e.predecessorId), t = w.value.find((a) => a.id === e.successorId);
262
+ if (!n || !t) {
263
+ de();
264
+ return;
265
+ }
266
+ const o = {
267
+ predecessorId: e.predecessorId,
268
+ successorId: e.successorId,
269
+ predecessor: Te(n),
270
+ successor: Te(t),
271
+ type: "waiting-on",
272
+ typeLabel: Ct("waiting-on")
273
+ };
274
+ S.value = null, E(`Dependency removed from ${n.name} to ${t.name}`), X("dependency-delete", o);
275
+ }
276
+ function Kt(e) {
277
+ !S.value || e.target?.closest?.(".vlite-gantt-dep-group, .vlite-gantt-dep-delete, .vlite-gantt-dep-connector") || de();
278
+ }
279
+ function ze(e) {
280
+ if (!(!S.value || l.active || h.value)) {
281
+ if (e.key === "Escape") {
282
+ e.preventDefault(), de(!0);
283
+ return;
284
+ }
285
+ if (e.key === "Delete" || e.key === "Backspace") {
286
+ const n = e.target?.tagName;
287
+ if (n === "INPUT" || n === "TEXTAREA" || e.target?.isContentEditable) return;
288
+ e.preventDefault(), $e();
289
+ }
290
+ }
291
+ }
292
+ he(S, (e, n) => {
293
+ e && !n && document.addEventListener("keydown", ze), !e && n && document.removeEventListener("keydown", ze);
220
294
  });
221
- function qe(t, o, e, n) {
222
- const a = ao, i = so;
223
- if (e > t + a * 2) {
224
- if (Math.abs(o - n) < 2) return `M ${t} ${o} L ${e} ${n}`;
225
- const v = t + (e - t) / 2;
226
- return ae([[t, o], [v, o], [v, n], [e, n]], i);
295
+ function Zt(e, n, t, o) {
296
+ const a = Qo, s = Jo;
297
+ if (t > e + a * 2) {
298
+ if (Math.abs(n - o) < 2) return `M ${e} ${n} L ${t} ${o}`;
299
+ const f = e + (t - e) / 2;
300
+ return Ge([[e, n], [f, n], [f, o], [t, o]], s);
227
301
  }
228
- const f = t + a;
229
- if (Math.abs(o - n) < s.rowHeight * 0.5) {
230
- const v = Math.max(o, n) + s.barHeight / 2 + a;
231
- return ae([[t, o], [f, o], [f, v], [e - a, v], [e - a, n], [e, n]], i);
302
+ const c = e + a;
303
+ if (Math.abs(n - o) < i.rowHeight * 0.5) {
304
+ const f = Math.max(n, o) + i.barHeight / 2 + a;
305
+ return Ge([[e, n], [c, n], [c, f], [t - a, f], [t - a, o], [t, o]], s);
232
306
  }
233
- return ae([[t, o], [f, o], [f, n], [e, n]], i);
234
- }
235
- function ae(t, o) {
236
- if (t.length < 2) return "";
237
- if (t.length === 2) return `M ${t[0][0]} ${t[0][1]} L ${t[1][0]} ${t[1][1]}`;
238
- const e = [`M ${t[0][0]} ${t[0][1]}`];
239
- for (let a = 1; a < t.length - 1; a++) {
240
- const [i, f] = t[a - 1], [v, k] = t[a], [S, ge] = t[a + 1], Ce = v - i, Le = k - f, _e = S - v, He = ge - k, he = Math.hypot(Ce, Le), ye = Math.hypot(_e, He), J = Math.min(o, he / 2, ye / 2);
241
- e.push(`L ${v - Ce / he * J} ${k - Le / he * J}`), e.push(`Q ${v} ${k} ${v + _e / ye * J} ${k + He / ye * J}`);
307
+ return Ge([[e, n], [c, n], [c, o], [t, o]], s);
308
+ }
309
+ function Ge(e, n) {
310
+ if (e.length < 2) return "";
311
+ if (e.length === 2) return `M ${e[0][0]} ${e[0][1]} L ${e[1][0]} ${e[1][1]}`;
312
+ const t = [`M ${e[0][0]} ${e[0][1]}`];
313
+ for (let a = 1; a < e.length - 1; a++) {
314
+ const [s, c] = e[a - 1], [f, y] = e[a], [x, W] = e[a + 1], te = f - s, ne = y - c, oe = x - f, ae = W - y, Z = Math.hypot(te, ne), Ue = Math.hypot(oe, ae), Re = Math.min(n, Z / 2, Ue / 2);
315
+ t.push(`L ${f - te / Z * Re} ${y - ne / Z * Re}`), t.push(`Q ${f} ${y} ${f + oe / Ue * Re} ${y + ae / Ue * Re}`);
242
316
  }
243
- const n = t[t.length - 1];
244
- return e.push(`L ${n[0]} ${n[1]}`), e.join(" ");
245
- }
246
- function Xe(t, o) {
247
- return `M ${t} ${o} L ${t - Y} ${o - Y * 0.6} L ${t - Y} ${o + Y * 0.6} Z`;
248
- }
249
- const G = p(() => {
250
- const t = /* @__PURE__ */ new Date();
251
- return t.setHours(12, 0, 0, 0), ne(t);
252
- }), V = p(() => {
253
- const t = /* @__PURE__ */ new Date();
254
- return t >= W.value.start && t <= W.value.end;
317
+ const o = e[e.length - 1];
318
+ return t.push(`L ${o[0]} ${o[1]}`), t.join(" ");
319
+ }
320
+ function Nt(e, n) {
321
+ return `M ${e} ${n} L ${e - Ae} ${n - Ae * 0.6} L ${e - Ae} ${n + Ae * 0.6} Z`;
322
+ }
323
+ const ve = $(() => {
324
+ const e = me(/* @__PURE__ */ new Date());
325
+ return De(e);
326
+ }), Ie = $(() => {
327
+ const e = me(/* @__PURE__ */ new Date());
328
+ return e >= be.value.start && e <= be.value.end;
255
329
  });
256
- function je() {
257
- !L.value || !V.value || L.value.scrollTo({ left: Math.max(0, G.value - (P.value - s.sidebarWidth) / 2), behavior: "smooth" });
330
+ function jt() {
331
+ !A.value || !Ie.value || A.value.scrollTo({ left: Math.max(0, ve.value - (le.value - i.sidebarWidth) / 2), behavior: "smooth" });
258
332
  }
259
- let l = {
333
+ let r = {
260
334
  active: !1,
261
335
  barIndex: -1,
262
336
  taskId: "",
@@ -268,175 +342,536 @@ const ct = {
268
342
  affectedIds: /* @__PURE__ */ new Set(),
269
343
  // cascade set
270
344
  rafId: 0
345
+ }, l = {
346
+ active: !1,
347
+ sourceId: "",
348
+ sourceIndex: -1,
349
+ pointerX: 0,
350
+ pointerY: 0,
351
+ targetId: null,
352
+ targetValid: !1,
353
+ rafId: 0,
354
+ scrollRafId: 0,
355
+ keyboard: !1,
356
+ keyboardTargetIndex: -1
271
357
  };
272
- const I = x(!1), q = x(""), se = x(null), U = x("default"), K = x([]), H = x(null);
273
- function Ne(t, o) {
274
- K.value[o] = t;
275
- }
276
- function Ve(t) {
277
- const o = /* @__PURE__ */ new Set();
278
- if (!s.cascadeDependencies) return o;
279
- const e = [t];
280
- for (; e.length; ) {
281
- const n = e.shift();
282
- for (const a of _.value)
283
- a.dependencies?.includes(n) && !o.has(a.id) && (o.add(a.id), e.push(a.id));
358
+ const P = k(!1), q = k(""), G = k(null), Me = k(null), fe = k("default"), h = k(!1), Q = k(""), ge = k(null), L = k("none"), T = k(null), Fe = k(""), Le = k(null), I = k(!1), O = k([]), H = k(null);
359
+ function Ut(e, n) {
360
+ O.value[n] = e;
361
+ }
362
+ function Yt(e) {
363
+ const n = /* @__PURE__ */ new Set();
364
+ if (!i.cascadeDependencies) return n;
365
+ const t = St(w.value), o = [e];
366
+ for (; o.length; ) {
367
+ const a = o.shift();
368
+ for (const s of t)
369
+ s.predecessorId === a && !n.has(s.successorId) && (n.add(s.successorId), o.push(s.successorId));
284
370
  }
285
- return o;
286
- }
287
- function be(t, o) {
288
- if (!s.draggable || o.task.milestone) return "move";
289
- const e = t.currentTarget.closest("svg");
290
- if (!e) return "move";
291
- const n = t.clientX - e.getBoundingClientRect().left;
292
- return n < o.x + Te ? "resize-left" : n > o.x + o.fullW - Te ? "resize-right" : "move";
293
- }
294
- function Ue(t, o) {
295
- if (!s.draggable) return;
296
- const e = w.value[o];
297
- if (!e || e.task.milestone) return;
298
- t.preventDefault(), t.stopPropagation();
299
- const n = be(t, e);
300
- l.active = !0, l.barIndex = o, l.taskId = e.task.id, l.mode = n, l.startMouseX = t.clientX, l.pxDelta = 0, l.origStart = new Date(e.task._start), l.origEnd = new Date(e.task._end), l.affectedIds = n === "move" ? Ve(e.task.id) : /* @__PURE__ */ new Set(), I.value = !0, q.value = e.task.id, g.value = null, B.value = o, document.addEventListener("mousemove", re), document.addEventListener("mouseup", ie), document.body.style.cursor = n === "move" ? "grabbing" : "ew-resize", document.body.style.userSelect = "none";
301
- }
302
- function re(t) {
303
- if (l.active) {
304
- if (l.pxDelta = t.clientX - l.startMouseX, l.mode !== "move" && l.origStart && l.origEnd) {
305
- const o = X(l.origStart, l.origEnd), e = le(l.pxDelta);
306
- l.mode === "resize-left" && e >= o - 0.5 && (l.pxDelta = we(o - 0.5)), l.mode === "resize-right" && -e >= o - 0.5 && (l.pxDelta = -we(o - 0.5));
371
+ return n;
372
+ }
373
+ function at(e, n) {
374
+ if (!i.draggable || n.task.milestone) return "move";
375
+ const t = e.currentTarget.closest("svg");
376
+ if (!t) return "move";
377
+ const o = e.clientX - t.getBoundingClientRect().left;
378
+ return o < n.x + Et ? "resize-left" : o > n.x + n.fullW - Et ? "resize-right" : "move";
379
+ }
380
+ function Qt(e, n) {
381
+ if (!i.draggable || l.active || h.value) return;
382
+ const t = b.value[n];
383
+ if (!t || t.task.milestone) return;
384
+ e.preventDefault(), e.stopPropagation();
385
+ const o = at(e, t);
386
+ r.active = !0, r.barIndex = n, r.taskId = t.task.id, r.mode = o, r.startMouseX = e.clientX, r.pxDelta = 0, r.origStart = new Date(t.task._start), r.origEnd = new Date(t.task._end), r.affectedIds = o === "move" ? Yt(t.task.id) : /* @__PURE__ */ new Set(), P.value = !0, q.value = t.task.id, p.value = null, I.value = !1, _.value = n, ye = "", document.addEventListener("mousemove", rt), document.addEventListener("mouseup", yt), document.addEventListener("pointercancel", it), document.addEventListener("keydown", st), document.body.style.cursor = o === "move" ? "grabbing" : "ew-resize", document.body.style.userSelect = "none", E(
387
+ o === "move" ? `Moving ${t.task.name}` : `Resizing ${t.task.name}. Preview dates update as you drag.`
388
+ );
389
+ }
390
+ function lt() {
391
+ if (!r.origStart || !r.origEnd) return null;
392
+ const e = nt(r.origStart, r.origEnd);
393
+ return Xn({
394
+ mode: r.mode,
395
+ pxDelta: r.pxDelta,
396
+ origStart: r.origStart,
397
+ origEnd: r.origEnd,
398
+ origDurationDays: e,
399
+ pxToDays: Ft,
400
+ daysToPx: Xt,
401
+ addDays: B
402
+ });
403
+ }
404
+ function rt(e) {
405
+ if (!r.active) return;
406
+ r.pxDelta = e.clientX - r.startMouseX;
407
+ const n = A.value;
408
+ if (n) {
409
+ const t = n.getBoundingClientRect(), { dx: o, dy: a } = Tt(e.clientX, e.clientY, {
410
+ left: t.left,
411
+ top: t.top,
412
+ right: t.right,
413
+ bottom: t.bottom
414
+ });
415
+ (o || a) && (n.scrollLeft += o, n.scrollTop += a, K.value && (K.value.scrollTop = n.scrollTop));
416
+ }
417
+ cancelAnimationFrame(r.rafId), r.rafId = requestAnimationFrame(Jt);
418
+ }
419
+ function st(e) {
420
+ r.active && e.key === "Escape" && (e.preventDefault(), Ce(r.mode === "move" ? "Move cancelled" : "Resize cancelled"));
421
+ }
422
+ function it() {
423
+ Ce(r.mode === "move" ? "Move cancelled" : "Resize cancelled");
424
+ }
425
+ function ut(e, n) {
426
+ const { x: t, y: o, fullW: a, progressW: s } = n, c = i.barHeight, f = i.barRadius, y = e.querySelector('[data-gantt-part="bg"]');
427
+ y && y.setAttribute("d", J(t, o, a, c, f));
428
+ const x = e.querySelector('[data-gantt-part="progress"]');
429
+ x && (s > 0 ? (x.setAttribute("d", J(t, o, Math.min(s, a), c, f)), x.style.display = "") : x.style.display = "none");
430
+ const W = e.querySelector('[data-gantt-part="fill"]');
431
+ W && W.setAttribute("d", J(t, o, a, c, f));
432
+ const te = e.querySelector('[data-gantt-part="hitbox"]');
433
+ te && (te.setAttribute("x", String(t)), te.setAttribute("width", String(a)));
434
+ const ne = e.querySelector('[data-gantt-part="highlight"]');
435
+ ne && (ne.setAttribute("x", String(t)), ne.setAttribute("width", String(a)));
436
+ const oe = e.querySelector('[data-gantt-part="handle-left"]');
437
+ oe && (oe.setAttribute("x", String(t)), oe.style.display = "");
438
+ const ae = e.querySelector('[data-gantt-part="handle-right"]');
439
+ ae && (ae.setAttribute("x", String(t + a - 4)), ae.style.display = "");
440
+ const Z = e.querySelector('[data-gantt-part="label"]');
441
+ Z && (Z.setAttribute("x", String(t + 12)), Z.style.display = a > 60 ? "" : "none");
442
+ }
443
+ function ct(e) {
444
+ const n = b.value[e], t = O.value[e];
445
+ if (!n || !t || n.task.milestone) return;
446
+ t.style.transform = "", t.removeAttribute("data-resize-px");
447
+ const o = n.task.progress != null ? n.fullW * Math.min(100, n.task.progress) / 100 : 0;
448
+ ut(t, {
449
+ x: n.x,
450
+ y: n.y,
451
+ fullW: n.fullW,
452
+ progressW: o
453
+ });
454
+ }
455
+ const dt = { month: "short", day: "numeric", year: "numeric" };
456
+ function Se(e, n) {
457
+ return `${e.toLocaleDateString(i.locale, dt)} — ${n.toLocaleDateString(i.locale, dt)}`;
458
+ }
459
+ function vt(e, n, t, o, a) {
460
+ if (!H.value) return;
461
+ const s = Se(e, n), c = t + a / 2, f = o - 22, y = Math.max(148, s.length * 6.2);
462
+ H.value.style.display = "";
463
+ const x = H.value.querySelector("rect"), W = H.value.querySelector("text");
464
+ x && (x.setAttribute("x", String(c - y / 2)), x.setAttribute("y", String(f - 8)), x.setAttribute("width", String(y))), W && (W.setAttribute("x", String(c)), W.setAttribute("y", String(f + 2)), W.textContent = s);
465
+ }
466
+ let ye = "";
467
+ function ft(e) {
468
+ e !== ye && (ye = e, E(e));
469
+ }
470
+ function Jt() {
471
+ const e = b.value[r.barIndex], n = O.value[r.barIndex];
472
+ if (!e || !n || !r.origStart || !r.origEnd) return;
473
+ const t = lt();
474
+ if (!t) return;
475
+ if (r.mode === "move") {
476
+ const s = t.clampedPxDelta;
477
+ if (n.style.transform = `translateX(${s}px)`, r.affectedIds.size > 0) {
478
+ for (let c = 0; c < b.value.length; c++)
479
+ if (r.affectedIds.has(b.value[c].task.id)) {
480
+ const f = O.value[c];
481
+ f && (f.style.transform = `translateX(${s}px)`);
482
+ }
307
483
  }
308
- cancelAnimationFrame(l.rafId), l.rafId = requestAnimationFrame(Ke);
484
+ vt(
485
+ t.start,
486
+ t.end,
487
+ e.x + s,
488
+ e.y,
489
+ e.fullW
490
+ ), ft(`${e.task.name}: ${Se(t.start, t.end)}`);
491
+ return;
309
492
  }
493
+ n.style.transform = "";
494
+ const o = Fn({
495
+ start: t.start,
496
+ end: t.end,
497
+ dateToX: De
498
+ }), a = e.fullW > 0 ? e.progressW / e.fullW : 0;
499
+ ut(n, {
500
+ x: o.x,
501
+ y: e.y,
502
+ fullW: o.fullW,
503
+ progressW: o.fullW * a
504
+ }), vt(t.start, t.end, o.x, e.y, o.fullW), ft(`${e.task.name}: ${Se(t.start, t.end)}`);
310
505
  }
311
- function Ke() {
312
- const t = l.pxDelta, o = K.value[l.barIndex];
313
- if (o) {
314
- if (l.mode === "move") {
315
- if (o.style.transform = `translateX(${t}px)`, l.affectedIds.size > 0) {
316
- for (let e = 0; e < w.value.length; e++)
317
- if (l.affectedIds.has(w.value[e].task.id)) {
318
- const n = K.value[e];
319
- n && (n.style.transform = `translateX(${t}px)`);
320
- }
321
- }
322
- } else l.mode === "resize-right" ? (o.style.transform = "translateX(0px)", w.value[l.barIndex] && o.setAttribute("data-resize-px", String(t))) : l.mode === "resize-left" && (o.style.transform = `translateX(${t}px)`, w.value[l.barIndex] && o.setAttribute("data-resize-px", String(-t)));
323
- if (H.value && l.origStart && l.origEnd) {
324
- const e = le(t), n = { month: "short", day: "numeric" };
325
- let a, i;
326
- l.mode === "move" ? (a = y(l.origStart, e), i = y(l.origEnd, e)) : l.mode === "resize-left" ? (a = y(l.origStart, e), i = l.origEnd) : (a = l.origStart, i = y(l.origEnd, e));
327
- const f = w.value[l.barIndex];
328
- if (f) {
329
- const v = l.mode === "move" ? f.x + f.fullW / 2 + t : f.x + f.fullW / 2;
330
- H.value.style.display = "";
331
- const k = H.value.querySelector("rect"), S = H.value.querySelector("text");
332
- k && (k.setAttribute("x", String(v - 62)), k.setAttribute("y", String(f.y - 20))), S && (S.setAttribute("x", String(v)), S.setAttribute("y", String(f.y - 10)), S.textContent = `${a.toLocaleDateString(s.locale, n)} — ${i.toLocaleDateString(s.locale, n)}`);
506
+ function gt() {
507
+ document.removeEventListener("mousemove", rt), document.removeEventListener("mouseup", yt), document.removeEventListener("pointercancel", it), document.removeEventListener("keydown", st), document.body.style.cursor = "", document.body.style.userSelect = "", cancelAnimationFrame(r.rafId);
508
+ }
509
+ function Ce(e) {
510
+ if (!r.active) return;
511
+ gt();
512
+ const n = r.barIndex;
513
+ if (r.mode === "move")
514
+ for (const t of O.value)
515
+ t && (t.style.transform = "", t.removeAttribute("data-resize-px"));
516
+ else n >= 0 && ct(n);
517
+ H.value && (H.value.style.display = "none"), r.active = !1, r.barIndex = -1, r.taskId = "", r.pxDelta = 0, r.origStart = null, r.origEnd = null, r.affectedIds.clear(), P.value = !1, q.value = "", _.value = null, ye = "", e && E(e);
518
+ }
519
+ function yt() {
520
+ if (!r.active) return;
521
+ const e = lt(), n = r.mode, t = r.taskId, o = new Set(r.affectedIds), a = r.barIndex;
522
+ if (gt(), !!e && Math.abs(e.snappedDays) > 0.1 && e) {
523
+ const c = w.value.find((f) => f.id === t);
524
+ if (c && (X("task-update", c, { start: e.start, end: e.end }), E(`Updated ${c.name} to ${Se(e.start, e.end)}`), n === "move" && o.size > 0))
525
+ for (const f of o) {
526
+ const y = w.value.find((x) => x.id === f);
527
+ y && X("task-update", y, {
528
+ start: B(y._start, e.snappedDays),
529
+ end: B(y._end, e.snappedDays)
530
+ });
333
531
  }
334
- }
532
+ if (n === "move")
533
+ for (const f of O.value)
534
+ f && (f.style.transform = "", f.removeAttribute("data-resize-px"));
535
+ } else if (n === "move")
536
+ for (const c of O.value)
537
+ c && (c.style.transform = "", c.removeAttribute("data-resize-px"));
538
+ else a >= 0 && ct(a);
539
+ H.value && (H.value.style.display = "none"), r.active = !1, r.barIndex = -1, r.taskId = "", r.pxDelta = 0, r.origStart = null, r.origEnd = null, r.affectedIds.clear(), P.value = !1, q.value = "", _.value = null, ye = "";
540
+ }
541
+ function Xe(e, n) {
542
+ if (l.active || h.value) {
543
+ fe.value = "crosshair";
544
+ return;
545
+ }
546
+ if (r.active || !i.draggable || n.task.milestone) {
547
+ fe.value = r.active ? "grabbing" : "pointer";
548
+ return;
549
+ }
550
+ fe.value = at(e, n) === "move" ? "grab" : "ew-resize";
551
+ }
552
+ function Te(e) {
553
+ const { _start: n, _end: t, _color: o, _index: a, ...s } = e;
554
+ return s;
555
+ }
556
+ function qe(e, n) {
557
+ const t = Le.value;
558
+ if (!t) return { x: 0, y: 0 };
559
+ const o = t.getBoundingClientRect();
560
+ return { x: e - o.left, y: n - o.top };
561
+ }
562
+ function F(e) {
563
+ return Wn(
564
+ { id: e.task.id, x: e.x, y: e.y, fullW: e.fullW, milestone: e.task.milestone },
565
+ i.barHeight
566
+ );
567
+ }
568
+ function en(e) {
569
+ return !i.editableDependencies || r.active || P.value ? !1 : h.value && Q.value === b.value[e]?.task.id ? !0 : G.value === e || Me.value === e;
570
+ }
571
+ function tn() {
572
+ return b.value.map((e) => ({
573
+ id: e.task.id,
574
+ x: e.x,
575
+ y: e.y,
576
+ fullW: e.fullW,
577
+ milestone: e.task.milestone
578
+ }));
579
+ }
580
+ function E(e) {
581
+ Fe.value = "", requestAnimationFrame(() => {
582
+ Fe.value = e;
583
+ });
584
+ }
585
+ function pe() {
586
+ const e = b.value.find((t) => t.task.id === l.sourceId);
587
+ if (!e) {
588
+ T.value = null;
589
+ return;
590
+ }
591
+ const n = F(e);
592
+ T.value = {
593
+ x1: n.cx,
594
+ y1: n.cy,
595
+ x2: l.pointerX,
596
+ y2: l.pointerY
597
+ };
598
+ }
599
+ function Ee(e) {
600
+ if (l.targetId = e, ge.value = e, !e || e === l.sourceId) {
601
+ l.targetValid = !1, L.value = e ? "invalid" : "none";
602
+ return;
603
+ }
604
+ const n = Qe(w.value, l.sourceId, e);
605
+ l.targetValid = n.valid, L.value = n.valid ? "valid" : "invalid";
606
+ }
607
+ function Oe(e, n) {
608
+ const t = qe(e, n);
609
+ l.pointerX = t.x, l.pointerY = t.y;
610
+ const o = Rn(tn(), t.x, t.y, i.barHeight), a = o && o.id !== l.sourceId ? o.id : o?.id === l.sourceId ? l.sourceId : null;
611
+ Ee(a), pe();
612
+ const s = A.value;
613
+ if (s) {
614
+ const c = s.getBoundingClientRect(), { dx: f, dy: y } = Tt(e, n, {
615
+ left: c.left,
616
+ top: c.top,
617
+ right: c.right,
618
+ bottom: c.bottom
619
+ });
620
+ (f || y) && (cancelAnimationFrame(l.scrollRafId), l.scrollRafId = requestAnimationFrame(() => {
621
+ s.scrollLeft += f, s.scrollTop += y, K.value && (K.value.scrollTop = s.scrollTop);
622
+ const x = qe(e, n);
623
+ l.pointerX = x.x, l.pointerY = x.y, pe();
624
+ }));
335
625
  }
336
626
  }
337
- function ie() {
627
+ function pt() {
628
+ document.removeEventListener("pointermove", mt), document.removeEventListener("pointerup", xt), document.removeEventListener("pointercancel", wt), document.removeEventListener("keydown", bt);
629
+ }
630
+ function V(e) {
631
+ !l.active && !h.value || (pt(), cancelAnimationFrame(l.rafId), cancelAnimationFrame(l.scrollRafId), document.body.style.cursor = "", document.body.style.userSelect = "", l.active = !1, l.sourceId = "", l.sourceIndex = -1, l.targetId = null, l.targetValid = !1, l.keyboard = !1, l.keyboardTargetIndex = -1, h.value = !1, Q.value = "", ge.value = null, L.value = "none", T.value = null, I.value = !1, e && E(e));
632
+ }
633
+ function ht() {
338
634
  if (!l.active) return;
339
- document.removeEventListener("mousemove", re), document.removeEventListener("mouseup", ie), document.body.style.cursor = "", document.body.style.userSelect = "", cancelAnimationFrame(l.rafId);
340
- const t = le(l.pxDelta), o = Math.round(t * 2) / 2;
341
- if (Math.abs(o) > 0.1 && l.origStart && l.origEnd) {
342
- const e = _.value.find((n) => n.id === l.taskId);
343
- if (e) {
344
- let n, a;
345
- if (l.mode === "move" ? (n = y(l.origStart, o), a = y(l.origEnd, o)) : l.mode === "resize-left" ? (n = y(l.origStart, o), a = new Date(l.origEnd)) : (n = new Date(l.origStart), a = y(l.origEnd, o)), A("task-update", e, { start: n, end: a }), l.mode === "move" && l.affectedIds.size > 0)
346
- for (const i of l.affectedIds) {
347
- const f = _.value.find((v) => v.id === i);
348
- f && A("task-update", f, {
349
- start: y(f._start, o),
350
- end: y(f._end, o)
351
- });
352
- }
353
- }
635
+ const e = l.sourceId, n = l.targetId;
636
+ if (!(l.targetValid && !!n) || !n) {
637
+ V(
638
+ n ? Je(
639
+ Qe(w.value, e, n),
640
+ w.value.find((c) => c.id === e)?.name ?? e,
641
+ w.value.find((c) => c.id === n)?.name ?? n
642
+ ) : "Dependency linking cancelled"
643
+ );
644
+ return;
645
+ }
646
+ const o = w.value.find((c) => c.id === e), a = w.value.find((c) => c.id === n);
647
+ if (!o || !a) {
648
+ V("Dependency linking cancelled");
649
+ return;
354
650
  }
355
- for (const e of K.value)
356
- e && (e.style.transform = "", e.removeAttribute("data-resize-px"));
357
- H.value && (H.value.style.display = "none"), l.active = !1, l.barIndex = -1, l.taskId = "", l.pxDelta = 0, l.origStart = null, l.origEnd = null, l.affectedIds.clear(), I.value = !1, q.value = "", B.value = null;
651
+ const s = {
652
+ predecessorId: e,
653
+ successorId: n,
654
+ predecessor: Te(o),
655
+ successor: Te(a),
656
+ type: "waiting-on",
657
+ typeLabel: Ct("waiting-on")
658
+ };
659
+ E(
660
+ Je(
661
+ { valid: !0 },
662
+ o.name,
663
+ a.name
664
+ )
665
+ ), pt(), cancelAnimationFrame(l.rafId), cancelAnimationFrame(l.scrollRafId), document.body.style.cursor = "", document.body.style.userSelect = "", l.active = !1, l.sourceId = "", l.sourceIndex = -1, l.targetId = null, l.targetValid = !1, l.keyboard = !1, l.keyboardTargetIndex = -1, h.value = !1, Q.value = "", ge.value = null, L.value = "none", T.value = null, I.value = !1, X("dependency-create", s);
666
+ }
667
+ function kt(e, n, t, o = !1) {
668
+ if (!i.editableDependencies || r.active || P.value) return;
669
+ const a = b.value[e];
670
+ if (!a) return;
671
+ de(), l.active = !0, l.sourceId = a.task.id, l.sourceIndex = e, l.keyboard = o, l.keyboardTargetIndex = -1, h.value = !0, Q.value = a.task.id, p.value = null, I.value = !0, _.value = e;
672
+ const s = F(a);
673
+ o ? (l.pointerX = s.cx + 40, l.pointerY = s.cy, Ee(null)) : Oe(n, t), pe(), E(`Linking from ${a.task.name}. Drop on a target task, or press Escape to cancel.`), document.addEventListener("pointermove", mt), document.addEventListener("pointerup", xt), document.addEventListener("pointercancel", wt), document.addEventListener("keydown", bt), document.body.style.cursor = "crosshair", document.body.style.userSelect = "none";
674
+ }
675
+ function mt(e) {
676
+ !l.active || l.keyboard || (cancelAnimationFrame(l.rafId), l.rafId = requestAnimationFrame(() => Oe(e.clientX, e.clientY)));
358
677
  }
359
- function $e(t, o) {
360
- if (l.active || !s.draggable || o.task.milestone) {
361
- U.value = l.active ? "grabbing" : "pointer";
678
+ function xt(e) {
679
+ !l.active || l.keyboard || (Oe(e.clientX, e.clientY), ht());
680
+ }
681
+ function wt() {
682
+ V("Dependency linking cancelled");
683
+ }
684
+ function Ve(e) {
685
+ const n = b.value;
686
+ if (!n.length) return;
687
+ const t = n.map((y, x) => ({ b: y, i: x })).filter(({ b: y }) => y.task.id !== l.sourceId);
688
+ if (!t.length) {
689
+ Ee(null), pe();
362
690
  return;
363
691
  }
364
- U.value = be(t, o) === "move" ? "grab" : "ew-resize";
365
- }
366
- const Q = x(s.animate ? 0 : 1);
367
- let ue = null;
368
- function de() {
369
- ue?.(), Q.value = 0, ue = dt(900, (t) => Q.value = t);
370
- }
371
- tt(() => {
372
- Re(), s.animate && de();
373
- }), ze(() => s.viewMode, () => {
374
- m.value = 1, s.animate && de();
375
- }), ze(() => s.tasks.length, () => {
376
- s.animate && de();
377
- }), ot(() => {
378
- ue?.(), ee?.disconnect(), document.removeEventListener("mousemove", re), document.removeEventListener("mouseup", ie), cancelAnimationFrame(l.rafId);
692
+ let o = t.findIndex(({ b: y }) => y.task.id === l.targetId);
693
+ o < 0 && (o = e === 1 ? -1 : 0), o = (o + e + t.length) % t.length;
694
+ const a = t[o];
695
+ l.keyboardTargetIndex = a.i;
696
+ const s = F(a.b);
697
+ l.pointerX = a.b.task.milestone ? a.b.x + a.b.fullW / 2 : a.b.x, l.pointerY = s.cy, Ee(a.b.task.id), pe();
698
+ const c = Qe(w.value, l.sourceId, a.b.task.id), f = w.value.find((y) => y.id === l.sourceId)?.name ?? l.sourceId;
699
+ E(
700
+ c.valid ? `Target ${a.b.task.name}. Press Enter to create dependency.` : Je(c, f, a.b.task.name)
701
+ );
702
+ }
703
+ function bt(e) {
704
+ if (l.active) {
705
+ if (e.key === "Escape") {
706
+ e.preventDefault(), V("Dependency linking cancelled");
707
+ return;
708
+ }
709
+ l.keyboard && (e.key === "ArrowDown" || e.key === "ArrowRight" ? (e.preventDefault(), Ve(1)) : e.key === "ArrowUp" || e.key === "ArrowLeft" ? (e.preventDefault(), Ve(-1)) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), ht()));
710
+ }
711
+ }
712
+ function nn(e, n) {
713
+ !i.editableDependencies || r.active || (e.preventDefault(), e.stopPropagation(), p.value = null, I.value = !0, kt(n, e.clientX, e.clientY, !1));
714
+ }
715
+ function on(e, n) {
716
+ if (!(!i.editableDependencies || r.active || h.value) && (e.key === "Enter" || e.key === " ")) {
717
+ e.preventDefault(), e.stopPropagation();
718
+ const t = b.value[n];
719
+ if (!t) return;
720
+ p.value = null;
721
+ const o = F(t), s = Le.value?.getBoundingClientRect(), c = (s?.left ?? 0) + o.cx, f = (s?.top ?? 0) + o.cy;
722
+ kt(n, c, f, !0), Ve(1);
723
+ }
724
+ }
725
+ function an(e) {
726
+ Me.value = e, G.value = e, p.value = null;
727
+ }
728
+ function ln() {
729
+ Me.value = null, I.value = !1, h.value || (G.value = null);
730
+ }
731
+ function rn(e) {
732
+ return !h.value || Q.value === e ? "" : ge.value !== e ? "vlite-gantt-link-candidate" : L.value === "valid" ? "vlite-gantt-link-target-valid" : "vlite-gantt-link-target-invalid";
733
+ }
734
+ const We = k(i.animate ? 0 : 1);
735
+ let Ke = null;
736
+ function Ze() {
737
+ Ke?.(), We.value = 0, Ke = Cn(900, (e) => We.value = e);
738
+ }
739
+ xn(() => {
740
+ Pt(), i.animate && Ze();
741
+ }), he(() => i.viewMode, () => {
742
+ D.value = 1, i.animate && Ze();
743
+ }), he(() => i.tasks.length, () => {
744
+ i.animate && Ze();
745
+ }), he(() => i.tasks, () => {
746
+ r.active && (i.tasks.some((n) => n.id === r.taskId) || Ce(r.mode === "move" ? "Move cancelled because task was removed" : "Resize cancelled because task was removed")), (l.active || h.value) && V("Dependency linking cancelled because tasks changed"), S.value && !He.value.some((e) => e.key === S.value) && (S.value = null);
747
+ }), he(() => i.editableDependencies, (e) => {
748
+ e || ((l.active || h.value) && V("Dependency linking cancelled"), de());
749
+ }), wn(() => {
750
+ Ke?.(), Pe?.disconnect(), Ce(), document.removeEventListener("keydown", ze), V();
379
751
  });
380
- function ce(t, o, e, n, a) {
381
- const i = Math.min(a, e / 2, n / 2);
382
- return i <= 0 || e <= 0 ? `M${t},${o}h${e}v${n}h${-e}Z` : `M${t + i},${o}h${e - 2 * i}q${i},0 ${i},${i}v${n - 2 * i}q0,${i} ${-i},${i}h${-(e - 2 * i)}q${-i},0 ${-i},${-i}v${-(n - 2 * i)}q0,${-i} ${i},${-i}Z`;
383
- }
384
- function Qe(t, o, e) {
385
- return `M${t},${o - e}L${t + e},${o}L${t},${o + e}L${t - e},${o}Z`;
386
- }
387
- const g = x(null), B = x(null);
388
- function Me(t, o) {
389
- if (!s.showTooltip || l.active) return;
390
- se.value = o, B.value = o;
391
- const e = w.value[o];
392
- if (!e) return;
393
- A("task-hover", e.task);
394
- const n = e.task;
395
- g.value = {
396
- x: t.clientX,
397
- y: t.clientY,
398
- task: n,
399
- startStr: n._start.toLocaleDateString(s.locale, { month: "short", day: "numeric", year: "numeric" }),
400
- endStr: n._end.toLocaleDateString(s.locale, { month: "short", day: "numeric", year: "numeric" })
401
- }, $e(t, e);
402
- }
403
- function De(t, o) {
404
- if (l.active) return;
405
- g.value && (g.value = { ...g.value, x: t.clientX, y: t.clientY });
406
- const e = w.value[o];
407
- e && $e(t, e);
408
- }
409
- function Se() {
410
- l.active || (g.value = null, B.value = null, se.value = null, U.value = "default", A("task-hover", null));
411
- }
412
- function ve(t) {
413
- l.active || A("task-click", t);
414
- }
415
- const fe = x();
416
- function Je(t) {
417
- fe.value && (fe.value.scrollTop = t.target.scrollTop);
418
- }
419
- const R = Math.random().toString(36).slice(2, 7);
420
- function Ye(t, o) {
421
- const e = Math.ceil(X(t, o));
422
- if (e <= 1) return "1 day";
423
- if (e < 7) return `${e} days`;
424
- const n = Math.floor(e / 7), a = e % 7;
425
- return a === 0 ? `${n} week${n > 1 ? "s" : ""}` : `${n}w ${a}d`;
426
- }
427
- return (t, o) => (u(), d("div", {
752
+ function J(e, n, t, o, a) {
753
+ const s = Math.min(a, t / 2, o / 2);
754
+ return s <= 0 || t <= 0 ? `M${e},${n}h${t}v${o}h${-t}Z` : `M${e + s},${n}h${t - 2 * s}q${s},0 ${s},${s}v${o - 2 * s}q0,${s} ${-s},${s}h${-(t - 2 * s)}q${-s},0 ${-s},${-s}v${-(o - 2 * s)}q0,${-s} ${s},${-s}Z`;
755
+ }
756
+ function sn(e, n, t) {
757
+ return `M${e},${n - t}L${e + t},${n}L${e},${n + t}L${e - t},${n}Z`;
758
+ }
759
+ const p = k(null), _ = k(null);
760
+ function un(e) {
761
+ const n = e;
762
+ return !n || typeof n.closest != "function" ? !1 : !!n.closest(".vlite-gantt-bar-group");
763
+ }
764
+ function cn(e) {
765
+ if (!i.editableDependencies) return null;
766
+ const n = Le.value;
767
+ if (!n) return null;
768
+ const t = n.getBoundingClientRect(), o = F(e), a = 14;
769
+ return {
770
+ left: t.left + o.cx - a,
771
+ top: t.top + o.cy - a,
772
+ right: t.left + o.cx + a,
773
+ bottom: t.top + o.cy + a
774
+ };
775
+ }
776
+ function dn(e, n, t) {
777
+ if (!i.editableDependencies) return !1;
778
+ if (I.value) return !0;
779
+ const o = qe(e, n), a = F(t);
780
+ return On(o.x, o.y, a.cx, a.cy);
781
+ }
782
+ function Ne(e, n) {
783
+ if (!i.showTooltip || r.active || l.active || h.value) {
784
+ p.value = null;
785
+ return;
786
+ }
787
+ const t = b.value[n];
788
+ if (!t) return;
789
+ if (dn(e.clientX, e.clientY, t)) {
790
+ p.value = null;
791
+ return;
792
+ }
793
+ const o = t.task, a = qn({
794
+ pointerX: e.clientX,
795
+ pointerY: e.clientY,
796
+ viewportWidth: window.innerWidth,
797
+ viewportHeight: window.innerHeight,
798
+ avoid: cn(t)
799
+ });
800
+ p.value = {
801
+ left: a.left,
802
+ top: a.top,
803
+ task: o,
804
+ startStr: o._start.toLocaleDateString(i.locale, { month: "short", day: "numeric", year: "numeric" }),
805
+ endStr: o._end.toLocaleDateString(i.locale, { month: "short", day: "numeric", year: "numeric" })
806
+ };
807
+ }
808
+ function vn(e = !0) {
809
+ p.value = null, _.value = null, I.value = !1, Me.value == null && (G.value = null), fe.value = "default", e && X("task-hover", null);
810
+ }
811
+ function fn(e, n) {
812
+ if (r.active || l.active || h.value) return;
813
+ G.value = n, _.value = n;
814
+ const t = b.value[n];
815
+ if (!t) return;
816
+ X("task-hover", t.task), Xe(e, t);
817
+ const o = !!e.target?.closest?.(".vlite-gantt-dep-connector");
818
+ I.value = o, o ? p.value = null : Ne(e, n);
819
+ }
820
+ function gn() {
821
+ r.active || l.active || h.value || vn(!0);
822
+ }
823
+ function Dt(e, n) {
824
+ if (r.active || l.active || h.value) return;
825
+ I.value = !1, G.value = n, _.value = n;
826
+ const t = b.value[n];
827
+ t && (Xe(e, t), Ne(e, n));
828
+ }
829
+ function $t(e, n) {
830
+ if (r.active || l.active || h.value) return;
831
+ I.value = !1;
832
+ const t = b.value[n];
833
+ t && Xe(e, t), Ne(e, n);
834
+ }
835
+ function yn(e) {
836
+ r.active || l.active || h.value || (I.value = !0, G.value = e, _.value = e, p.value = null);
837
+ }
838
+ function pn(e) {
839
+ if (!(r.active || l.active || h.value)) {
840
+ if (un(e.relatedTarget) && !e.relatedTarget?.closest?.(".vlite-gantt-dep-connector")) {
841
+ I.value = !1;
842
+ return;
843
+ }
844
+ I.value = !1, p.value = null;
845
+ }
846
+ }
847
+ function je(e) {
848
+ !r.active && !l.active && X("task-click", e);
849
+ }
850
+ const K = k();
851
+ function hn(e) {
852
+ K.value && (K.value.scrollTop = e.target.scrollTop);
853
+ }
854
+ const ee = Math.random().toString(36).slice(2, 7);
855
+ function kn(e, n) {
856
+ const t = Math.ceil(nt(e, n));
857
+ if (t <= 1) return "1 day";
858
+ if (t < 7) return `${t} days`;
859
+ const o = Math.floor(t / 7), a = t % 7;
860
+ return a === 0 ? `${o} week${o > 1 ? "s" : ""}` : `${o}w ${a}d`;
861
+ }
862
+ return (e, n) => (v(), g("div", {
428
863
  ref_key: "containerRef",
429
- ref: j,
864
+ ref: xe,
430
865
  class: "vlite-gantt-chart w-full select-none"
431
866
  }, [
432
- c.showTodayLine && V.value || c.zoom ? (u(), d("div", ct, [
433
- c.zoom ? (u(), d("div", vt, [
434
- r("button", {
867
+ d.showTodayLine && Ie.value || d.zoom ? (v(), g("div", Vn, [
868
+ d.zoom ? (v(), g("div", Kn, [
869
+ u("button", {
435
870
  class: "vlite-gantt-btn",
436
- onClick: Ze,
437
- disabled: m.value <= 0.4
438
- }, [...o[0] || (o[0] = [
439
- r("svg", {
871
+ onClick: zt,
872
+ disabled: D.value <= 0.4
873
+ }, [...n[1] || (n[1] = [
874
+ u("svg", {
440
875
  width: "12",
441
876
  height: "12",
442
877
  viewBox: "0 0 24 24",
@@ -446,40 +881,40 @@ const ct = {
446
881
  "stroke-linecap": "round",
447
882
  "stroke-linejoin": "round"
448
883
  }, [
449
- r("circle", {
884
+ u("circle", {
450
885
  cx: "11",
451
886
  cy: "11",
452
887
  r: "8"
453
888
  }),
454
- r("line", {
889
+ u("line", {
455
890
  x1: "21",
456
891
  y1: "21",
457
892
  x2: "16.65",
458
893
  y2: "16.65"
459
894
  }),
460
- r("line", {
895
+ u("line", {
461
896
  x1: "8",
462
897
  y1: "11",
463
898
  x2: "14",
464
899
  y2: "11"
465
900
  })
466
901
  ], -1),
467
- r("span", null, "Zoom Out", -1)
468
- ])], 8, ft),
469
- r("button", {
902
+ u("span", null, "Zoom Out", -1)
903
+ ])], 8, Zn),
904
+ u("button", {
470
905
  class: "vlite-gantt-btn",
471
- onClick: Fe,
472
- disabled: m.value >= 3
473
- }, [...o[1] || (o[1] = [
474
- nt('<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" data-v-ebb84e3d><circle cx="11" cy="11" r="8" data-v-ebb84e3d></circle><line x1="21" y1="21" x2="16.65" y2="16.65" data-v-ebb84e3d></line><line x1="11" y1="8" x2="11" y2="14" data-v-ebb84e3d></line><line x1="8" y1="11" x2="14" y2="11" data-v-ebb84e3d></line></svg><span data-v-ebb84e3d>Zoom In</span>', 2)
475
- ])], 8, gt)
476
- ])) : h("", !0),
477
- c.showTodayLine && V.value ? (u(), d("button", {
906
+ onClick: Ht,
907
+ disabled: D.value >= 3
908
+ }, [...n[2] || (n[2] = [
909
+ bn('<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" data-v-d83427d6><circle cx="11" cy="11" r="8" data-v-d83427d6></circle><line x1="21" y1="21" x2="16.65" y2="16.65" data-v-d83427d6></line><line x1="11" y1="8" x2="11" y2="14" data-v-d83427d6></line><line x1="8" y1="11" x2="14" y2="11" data-v-d83427d6></line></svg><span data-v-d83427d6>Zoom In</span>', 2)
910
+ ])], 8, Nn)
911
+ ])) : m("", !0),
912
+ d.showTodayLine && Ie.value ? (v(), g("button", {
478
913
  key: 1,
479
914
  class: "vlite-gantt-btn",
480
- onClick: je
481
- }, [...o[2] || (o[2] = [
482
- r("svg", {
915
+ onClick: jt
916
+ }, [...n[3] || (n[3] = [
917
+ u("svg", {
483
918
  width: "12",
484
919
  height: "12",
485
920
  viewBox: "0 0 24 24",
@@ -489,57 +924,57 @@ const ct = {
489
924
  "stroke-linecap": "round",
490
925
  "stroke-linejoin": "round"
491
926
  }, [
492
- r("circle", {
927
+ u("circle", {
493
928
  cx: "12",
494
929
  cy: "12",
495
930
  r: "10"
496
931
  }),
497
- r("line", {
932
+ u("line", {
498
933
  x1: "12",
499
934
  y1: "8",
500
935
  x2: "12",
501
936
  y2: "12"
502
937
  }),
503
- r("line", {
938
+ u("line", {
504
939
  x1: "12",
505
940
  y1: "16",
506
941
  x2: "12.01",
507
942
  y2: "16"
508
943
  })
509
944
  ], -1),
510
- r("span", null, "Today", -1)
511
- ])])) : h("", !0)
512
- ])) : h("", !0),
513
- r("div", ht, [
514
- r("div", {
945
+ u("span", null, "Today", -1)
946
+ ])])) : m("", !0)
947
+ ])) : m("", !0),
948
+ u("div", jn, [
949
+ u("div", {
515
950
  class: "vlite-gantt-sidebar",
516
- style: D({ width: `${c.sidebarWidth}px`, minWidth: `${c.sidebarWidth}px` })
951
+ style: R({ width: `${d.sidebarWidth}px`, minWidth: `${d.sidebarWidth}px` })
517
952
  }, [
518
- c.showHeader ? (u(), d("div", {
953
+ d.showHeader ? (v(), g("div", {
519
954
  key: 0,
520
955
  class: "vlite-gantt-sidebar-header",
521
- style: D({ height: `${E.value}px` })
522
- }, [...o[3] || (o[3] = [
523
- r("span", { class: "text-xs font-semibold text-muted-foreground uppercase tracking-wider" }, "Tasks", -1)
524
- ])], 4)) : h("", !0),
525
- r("div", {
956
+ style: R({ height: `${U.value}px` })
957
+ }, [...n[4] || (n[4] = [
958
+ u("span", { class: "text-xs font-semibold text-muted-foreground uppercase tracking-wider" }, "Tasks", -1)
959
+ ])], 4)) : m("", !0),
960
+ u("div", {
526
961
  ref_key: "sidebarRef",
527
- ref: fe,
962
+ ref: K,
528
963
  class: "vlite-gantt-sidebar-body",
529
- style: D({ height: `${O.value}px` })
964
+ style: R({ height: `${ue.value}px` })
530
965
  }, [
531
- (u(!0), d($, null, C(F.value, (e, n) => (u(), d("div", {
532
- key: `s-${n}`,
966
+ (v(!0), g(C, null, z(re.value, (t, o) => (v(), g("div", {
967
+ key: `s-${o}`,
533
968
  class: "vlite-gantt-sidebar-row",
534
- style: D({ height: `${c.rowHeight}px` })
969
+ style: R({ height: `${d.rowHeight}px` })
535
970
  }, [
536
- e.type === "group-header" ? (u(), d("button", {
971
+ t.type === "group-header" ? (v(), g("button", {
537
972
  key: 0,
538
973
  class: "vlite-gantt-group-toggle",
539
- onClick: (a) => Ae(e.group)
974
+ onClick: (a) => _t(t.group)
540
975
  }, [
541
- (u(), d("svg", {
542
- class: me(["vlite-gantt-chevron", { "vlite-gantt-chevron-collapsed": N.value.has(e.group) }]),
976
+ (v(), g("svg", {
977
+ class: ke(["vlite-gantt-chevron", { "vlite-gantt-chevron-collapsed": we.value.has(t.group) }]),
543
978
  width: "14",
544
979
  height: "14",
545
980
  viewBox: "0 0 24 24",
@@ -548,287 +983,428 @@ const ct = {
548
983
  "stroke-width": "2.5",
549
984
  "stroke-linecap": "round",
550
985
  "stroke-linejoin": "round"
551
- }, [...o[4] || (o[4] = [
552
- r("polyline", { points: "6 9 12 15 18 9" }, null, -1)
986
+ }, [...n[5] || (n[5] = [
987
+ u("polyline", { points: "6 9 12 15 18 9" }, null, -1)
553
988
  ])], 2)),
554
- r("span", mt, b(e.group), 1),
555
- r("span", kt, b(te.value.grouped.get(e.group)?.length ?? 0), 1)
556
- ], 8, yt)) : (u(), d("div", {
989
+ u("span", Yn, M(t.group), 1),
990
+ u("span", Qn, M(_e.value.grouped.get(t.group)?.length ?? 0), 1)
991
+ ], 8, Un)) : (v(), g("div", {
557
992
  key: 1,
558
- class: me(["vlite-gantt-task-name", {
559
- "vlite-gantt-task-name-grouped": !!e.group,
560
- "vlite-gantt-task-name-dragging": I.value && q.value === e.task?.id
993
+ class: ke(["vlite-gantt-task-name", {
994
+ "vlite-gantt-task-name-grouped": !!t.group,
995
+ "vlite-gantt-task-name-dragging": P.value && q.value === t.task?.id
561
996
  }]),
562
- onClick: (a) => e.task && ve(e.task)
997
+ onClick: (a) => t.task && je(t.task)
563
998
  }, [
564
- r("span", {
999
+ u("span", {
565
1000
  class: "vlite-gantt-task-dot",
566
- style: D({ backgroundColor: e.task?._color })
1001
+ style: R({ backgroundColor: t.task?._color })
567
1002
  }, null, 4),
568
- r("span", pt, b(e.task?.name), 1),
569
- c.showProgress && e.task?.progress != null ? (u(), d("span", wt, b(e.task.progress) + "%", 1)) : h("", !0)
570
- ], 10, xt))
1003
+ u("span", eo, M(t.task?.name), 1),
1004
+ d.showProgress && t.task?.progress != null ? (v(), g("span", to, M(t.task.progress) + "%", 1)) : m("", !0)
1005
+ ], 10, Jn))
571
1006
  ], 4))), 128))
572
1007
  ], 4)
573
1008
  ], 4),
574
- r("div", {
1009
+ u("div", {
575
1010
  ref_key: "timelineRef",
576
- ref: L,
1011
+ ref: A,
577
1012
  class: "vlite-gantt-timeline",
578
- onScroll: Je,
579
- onWheel: Pe
1013
+ onScroll: hn,
1014
+ onWheel: Bt
580
1015
  }, [
581
- c.showHeader ? (u(), d("div", {
1016
+ d.showHeader ? (v(), g("div", {
582
1017
  key: 0,
583
1018
  class: "vlite-gantt-timeline-header",
584
- style: D({ height: `${E.value}px`, width: `${Z.value}px` })
1019
+ style: R({ height: `${U.value}px`, width: `${ie.value}px` })
585
1020
  }, [
586
- (u(), d("svg", {
587
- width: Z.value,
588
- height: E.value,
1021
+ (v(), g("svg", {
1022
+ width: ie.value,
1023
+ height: U.value,
589
1024
  class: "overflow-visible"
590
1025
  }, [
591
- (u(!0), d($, null, C(pe.value, (e, n) => (u(), d("g", { key: n }, [
592
- r("line", {
593
- x1: e.x,
1026
+ (v(!0), g(C, null, z(ot.value, (t, o) => (v(), g("g", { key: o }, [
1027
+ u("line", {
1028
+ x1: t.x,
594
1029
  y1: 0,
595
- x2: e.x,
596
- y2: E.value,
1030
+ x2: t.x,
1031
+ y2: U.value,
597
1032
  stroke: "currentColor",
598
1033
  "stroke-opacity": "0.06"
599
- }, null, 8, $t),
600
- r("text", {
601
- x: e.x + e.width / 2,
602
- y: E.value / 2 - 5,
1034
+ }, null, 8, oo),
1035
+ u("text", {
1036
+ x: t.x + t.width / 2,
1037
+ y: U.value / 2 - 5,
603
1038
  "text-anchor": "middle",
604
1039
  "dominant-baseline": "middle",
605
1040
  "font-size": "11",
606
1041
  "font-weight": "600",
607
1042
  class: "fill-foreground"
608
- }, b(e.label), 9, Mt),
609
- e.sublabel ? (u(), d("text", {
1043
+ }, M(t.label), 9, ao),
1044
+ t.sublabel ? (v(), g("text", {
610
1045
  key: 0,
611
- x: e.x + e.width / 2,
612
- y: E.value / 2 + 11,
1046
+ x: t.x + t.width / 2,
1047
+ y: U.value / 2 + 11,
613
1048
  "text-anchor": "middle",
614
1049
  "dominant-baseline": "middle",
615
1050
  "font-size": "10",
616
1051
  class: "fill-muted-foreground"
617
- }, b(e.sublabel), 9, Dt)) : h("", !0)
1052
+ }, M(t.sublabel), 9, lo)) : m("", !0)
618
1053
  ]))), 128))
619
- ], 8, bt))
620
- ], 4)) : h("", !0),
621
- r("div", {
1054
+ ], 8, no))
1055
+ ], 4)) : m("", !0),
1056
+ u("div", {
622
1057
  class: "vlite-gantt-timeline-body",
623
- style: D({ height: `${O.value}px` })
1058
+ style: R({ height: `${ue.value}px` })
624
1059
  }, [
625
- (u(), d("svg", {
626
- width: Z.value,
627
- height: O.value,
1060
+ (v(), g("svg", {
1061
+ ref_key: "timelineSvgRef",
1062
+ ref: Le,
1063
+ width: ie.value,
1064
+ height: ue.value,
628
1065
  role: "img",
629
1066
  "aria-label": "Gantt chart",
630
- class: "overflow-visible"
1067
+ class: ke(["overflow-visible", { "vlite-gantt-linking": h.value }]),
1068
+ onPointerdown: Kt
631
1069
  }, [
632
- r("defs", null, [
633
- (u(!0), d($, null, C(w.value, (e, n) => (u(), d("linearGradient", {
634
- key: `g${n}`,
635
- id: `gg-${z(R)}-${n}`,
1070
+ u("defs", null, [
1071
+ (v(!0), g(C, null, z(b.value, (t, o) => (v(), g("linearGradient", {
1072
+ key: `g${o}`,
1073
+ id: `gg-${N(ee)}-${o}`,
636
1074
  x1: "0",
637
1075
  y1: "0",
638
1076
  x2: "1",
639
1077
  y2: "0"
640
1078
  }, [
641
- r("stop", {
1079
+ u("stop", {
642
1080
  offset: "0%",
643
- "stop-color": e.task._color,
1081
+ "stop-color": t.task._color,
644
1082
  "stop-opacity": "1"
645
- }, null, 8, Lt),
646
- r("stop", {
1083
+ }, null, 8, io),
1084
+ u("stop", {
647
1085
  offset: "100%",
648
- "stop-color": e.task._color,
1086
+ "stop-color": t.task._color,
649
1087
  "stop-opacity": "0.75"
650
- }, null, 8, _t)
651
- ], 8, Ct))), 128)),
652
- (u(!0), d($, null, C(w.value, (e, n) => (u(), d("linearGradient", {
653
- key: `p${n}`,
654
- id: `gp-${z(R)}-${n}`,
1088
+ }, null, 8, uo)
1089
+ ], 8, so))), 128)),
1090
+ (v(!0), g(C, null, z(b.value, (t, o) => (v(), g("linearGradient", {
1091
+ key: `p${o}`,
1092
+ id: `gp-${N(ee)}-${o}`,
655
1093
  x1: "0",
656
1094
  y1: "0",
657
1095
  x2: "1",
658
1096
  y2: "0"
659
1097
  }, [
660
- r("stop", {
1098
+ u("stop", {
661
1099
  offset: "0%",
662
- "stop-color": e.task._color,
1100
+ "stop-color": t.task._color,
663
1101
  "stop-opacity": "0.35"
664
- }, null, 8, zt),
665
- r("stop", {
1102
+ }, null, 8, vo),
1103
+ u("stop", {
666
1104
  offset: "100%",
667
- "stop-color": e.task._color,
1105
+ "stop-color": t.task._color,
668
1106
  "stop-opacity": "0.15"
669
- }, null, 8, Wt)
670
- ], 8, Ht))), 128))
1107
+ }, null, 8, fo)
1108
+ ], 8, co))), 128))
671
1109
  ]),
672
- c.showGrid ? (u(!0), d($, { key: 0 }, C(pe.value, (e, n) => (u(), d("line", {
673
- key: n,
674
- x1: e.x,
1110
+ d.showGrid ? (v(!0), g(C, { key: 0 }, z(ot.value, (t, o) => (v(), g("line", {
1111
+ key: o,
1112
+ x1: t.x,
675
1113
  y1: 0,
676
- x2: e.x,
677
- y2: O.value,
1114
+ x2: t.x,
1115
+ y2: ue.value,
678
1116
  stroke: "currentColor",
679
1117
  "stroke-opacity": "0.06",
680
1118
  "stroke-dasharray": "4 4"
681
- }, null, 8, Tt))), 128)) : h("", !0),
682
- (u(!0), d($, null, C(F.value, (e, n) => (u(), d("line", {
683
- key: n,
1119
+ }, null, 8, go))), 128)) : m("", !0),
1120
+ (v(!0), g(C, null, z(re.value, (t, o) => (v(), g("line", {
1121
+ key: o,
684
1122
  x1: 0,
685
- y1: (n + 1) * c.rowHeight,
686
- x2: Z.value,
687
- y2: (n + 1) * c.rowHeight,
1123
+ y1: (o + 1) * d.rowHeight,
1124
+ x2: ie.value,
1125
+ y2: (o + 1) * d.rowHeight,
688
1126
  stroke: "currentColor",
689
1127
  "stroke-opacity": "0.04"
690
- }, null, 8, Et))), 128)),
691
- (u(!0), d($, null, C(F.value, (e, n) => lt((u(), d("rect", {
692
- key: `bg${n}`,
1128
+ }, null, 8, yo))), 128)),
1129
+ (v(!0), g(C, null, z(re.value, (t, o) => Dn((v(), g("rect", {
1130
+ key: `bg${o}`,
693
1131
  x: 0,
694
- y: n * c.rowHeight,
695
- width: Z.value,
696
- height: c.rowHeight,
1132
+ y: o * d.rowHeight,
1133
+ width: ie.value,
1134
+ height: d.rowHeight,
697
1135
  fill: "currentColor",
698
1136
  "fill-opacity": "0.02"
699
- }, null, 8, It)), [
700
- [at, e.type === "group-header"]
1137
+ }, null, 8, po)), [
1138
+ [$n, t.type === "group-header"]
701
1139
  ])), 128)),
702
- (u(!0), d($, null, C(Ge.value, (e, n) => (u(), d("g", {
703
- key: n,
704
- class: "vlite-gantt-dep-group"
1140
+ (v(!0), g(C, null, z(He.value, (t) => (v(), g("g", {
1141
+ key: t.key,
1142
+ class: ke(["vlite-gantt-dep-group", {
1143
+ "vlite-gantt-dep-selectable": d.editableDependencies,
1144
+ "vlite-gantt-dep-active": Y(t.key)
1145
+ }])
705
1146
  }, [
706
- r("path", {
707
- d: e.d,
708
- stroke: "var(--color-muted-foreground)",
709
- "stroke-width": "1.5",
710
- "stroke-opacity": "0.35",
1147
+ d.editableDependencies ? (v(), g("path", {
1148
+ key: 0,
1149
+ d: t.d,
1150
+ stroke: "transparent",
1151
+ "stroke-width": "14",
711
1152
  fill: "none",
712
- "stroke-linejoin": "round"
713
- }, null, 8, Bt),
714
- r("path", {
715
- d: e.ad,
716
- fill: "var(--color-muted-foreground)",
717
- "fill-opacity": "0.5"
718
- }, null, 8, Rt)
719
- ]))), 128)),
720
- (u(!0), d($, null, C(w.value, (e, n) => (u(), d("g", {
721
- key: e.task.id,
1153
+ "stroke-linejoin": "round",
1154
+ "stroke-linecap": "round",
1155
+ class: "vlite-gantt-dep-hit",
1156
+ onClick: (o) => Ot(o, t)
1157
+ }, null, 8, ho)) : m("", !0),
1158
+ u("path", {
1159
+ d: t.d,
1160
+ stroke: Y(t.key) ? et : "var(--color-muted-foreground)",
1161
+ "stroke-width": Y(t.key) ? 2.5 : 1.5,
1162
+ "stroke-opacity": Y(t.key) ? 1 : 0.35,
1163
+ fill: "none",
1164
+ "stroke-linejoin": "round",
1165
+ class: "pointer-events-none"
1166
+ }, null, 8, ko),
1167
+ u("path", {
1168
+ d: t.ad,
1169
+ fill: Y(t.key) ? et : "var(--color-muted-foreground)",
1170
+ "fill-opacity": Y(t.key) ? 1 : 0.5,
1171
+ class: "pointer-events-none"
1172
+ }, null, 8, mo)
1173
+ ], 2))), 128)),
1174
+ d.editableDependencies && ce.value ? (v(), g("g", {
1175
+ key: 1,
1176
+ class: "vlite-gantt-dep-delete",
1177
+ transform: `translate(${ce.value.midX}, ${ce.value.midY})`,
1178
+ role: "button",
1179
+ tabindex: "0",
1180
+ focusable: "true",
1181
+ "aria-label": qt.value,
1182
+ onClick: Vt,
1183
+ onKeydown: [
1184
+ It(Mt($e, ["prevent"]), ["enter"]),
1185
+ It(Mt($e, ["prevent"]), ["space"])
1186
+ ]
1187
+ }, [
1188
+ n[6] || (n[6] = u("circle", {
1189
+ r: "11",
1190
+ fill: "transparent"
1191
+ }, null, -1)),
1192
+ u("circle", {
1193
+ r: "8",
1194
+ fill: et,
1195
+ stroke: "var(--color-background)",
1196
+ "stroke-width": "1.5"
1197
+ }),
1198
+ n[7] || (n[7] = u("path", {
1199
+ d: "M -3 -3 L 3 3 M 3 -3 L -3 3",
1200
+ stroke: "var(--color-background)",
1201
+ "stroke-width": "1.75",
1202
+ "stroke-linecap": "round",
1203
+ class: "pointer-events-none"
1204
+ }, null, -1))
1205
+ ], 40, xo)) : m("", !0),
1206
+ (v(!0), g(C, null, z(b.value, (t, o) => (v(), g("g", {
1207
+ key: t.task.id,
722
1208
  ref_for: !0,
723
- ref: (a) => Ne(a, n),
724
- class: me({ "vlite-gantt-bar-dragging": I.value && (q.value === e.task.id || z(l).affectedIds.has(e.task.id)) })
1209
+ ref: (a) => Ut(a, o),
1210
+ class: ke(["vlite-gantt-bar-group", [
1211
+ { "vlite-gantt-bar-dragging": P.value && (q.value === t.task.id || N(r).affectedIds.has(t.task.id)) },
1212
+ rn(t.task.id),
1213
+ { "vlite-gantt-link-source": h.value && Q.value === t.task.id }
1214
+ ]]),
1215
+ onMouseenter: (a) => fn(a, o),
1216
+ onMouseleave: gn
725
1217
  }, [
726
- e.task.milestone ? (u(), d("path", {
1218
+ t.task.milestone ? (v(), g("path", {
727
1219
  key: 0,
728
- d: Qe(e.x + e.fullW / 2, e.y + c.barHeight / 2, c.barHeight * 0.4),
729
- fill: `url(#gg-${z(R)}-${n})`,
730
- stroke: e.task._color,
1220
+ d: sn(t.x + t.fullW / 2, t.y + d.barHeight / 2, d.barHeight * 0.4),
1221
+ fill: `url(#gg-${N(ee)}-${o})`,
1222
+ stroke: t.task._color,
731
1223
  "stroke-width": "1.5",
732
1224
  "stroke-opacity": "0.6",
733
1225
  class: "cursor-pointer",
734
- opacity: B.value === n ? 0.9 : 1,
735
- onMouseenter: (a) => Me(a, n),
736
- onMousemove: (a) => De(a, n),
737
- onMouseleave: Se,
738
- onClick: (a) => ve(e.task)
739
- }, null, 40, At)) : (u(), d($, { key: 1 }, [
740
- r("path", {
741
- d: ce(e.x, e.y, e.fullW, c.barHeight, c.barRadius),
742
- fill: `url(#gp-${z(R)}-${n})`,
1226
+ opacity: _.value === o ? 0.9 : 1,
1227
+ onMouseenter: (a) => Dt(a, o),
1228
+ onMousemove: (a) => $t(a, o),
1229
+ onClick: (a) => je(t.task)
1230
+ }, null, 40, bo)) : (v(), g(C, { key: 1 }, [
1231
+ u("path", {
1232
+ "data-gantt-part": "bg",
1233
+ d: J(t.x, t.y, t.fullW, d.barHeight, d.barRadius),
1234
+ fill: `url(#gp-${N(ee)}-${o})`,
743
1235
  class: "pointer-events-none"
744
- }, null, 8, Pt),
745
- c.showProgress && e.progressW > 0 ? (u(), d("path", {
1236
+ }, null, 8, Do),
1237
+ d.showProgress && t.progressW > 0 ? (v(), g("path", {
746
1238
  key: 0,
747
- d: ce(e.x, e.y, Math.min(e.progressW, e.fullW), c.barHeight, c.barRadius),
748
- fill: `url(#gg-${z(R)}-${n})`,
1239
+ "data-gantt-part": "progress",
1240
+ d: J(t.x, t.y, Math.min(t.progressW, t.fullW), d.barHeight, d.barRadius),
1241
+ fill: `url(#gg-${N(ee)}-${o})`,
749
1242
  class: "pointer-events-none"
750
- }, null, 8, Ft)) : h("", !0),
751
- c.showProgress ? h("", !0) : (u(), d("path", {
1243
+ }, null, 8, $o)) : m("", !0),
1244
+ d.showProgress ? m("", !0) : (v(), g("path", {
752
1245
  key: 1,
753
- d: ce(e.x, e.y, e.w, c.barHeight, c.barRadius),
754
- fill: `url(#gg-${z(R)}-${n})`,
1246
+ "data-gantt-part": "fill",
1247
+ d: J(t.x, t.y, t.w, d.barHeight, d.barRadius),
1248
+ fill: `url(#gg-${N(ee)}-${o})`,
755
1249
  class: "pointer-events-none"
756
- }, null, 8, Zt)),
757
- r("rect", {
758
- x: e.x,
759
- y: e.y,
760
- width: e.fullW,
761
- height: c.barHeight,
1250
+ }, null, 8, Io)),
1251
+ u("rect", {
1252
+ "data-gantt-part": "hitbox",
1253
+ x: t.x,
1254
+ y: t.y,
1255
+ width: t.fullW,
1256
+ height: d.barHeight,
762
1257
  fill: "transparent",
763
- style: D({ cursor: U.value }),
764
- onMouseenter: (a) => Me(a, n),
765
- onMousemove: (a) => De(a, n),
766
- onMouseleave: Se,
767
- onMousedown: (a) => Ue(a, n),
768
- onClick: (a) => ve(e.task)
769
- }, null, 44, Ot),
770
- B.value === n ? (u(), d("rect", {
1258
+ style: R({ cursor: fe.value }),
1259
+ onMouseenter: (a) => Dt(a, o),
1260
+ onMousemove: (a) => $t(a, o),
1261
+ onMousedown: (a) => Qt(a, o),
1262
+ onClick: (a) => je(t.task)
1263
+ }, null, 44, Mo),
1264
+ _.value === o || P.value && q.value === t.task.id ? (v(), g("rect", {
771
1265
  key: 2,
772
- x: e.x,
773
- y: e.y,
774
- width: e.fullW,
775
- height: c.barHeight,
776
- rx: c.barRadius,
777
- ry: c.barRadius,
1266
+ "data-gantt-part": "highlight",
1267
+ x: t.x,
1268
+ y: t.y,
1269
+ width: t.fullW,
1270
+ height: d.barHeight,
1271
+ rx: d.barRadius,
1272
+ ry: d.barRadius,
778
1273
  fill: "currentColor",
779
1274
  "fill-opacity": "0.06",
780
1275
  class: "pointer-events-none"
781
- }, null, 8, Gt)) : h("", !0),
782
- c.draggable && !e.task.milestone && (se.value === n || I.value && q.value === e.task.id) ? (u(), d($, { key: 3 }, [
783
- r("rect", {
784
- x: e.x,
785
- y: e.y + 4,
1276
+ }, null, 8, Lo)) : m("", !0),
1277
+ d.draggable && !t.task.milestone && (G.value === o || P.value && q.value === t.task.id) ? (v(), g(C, { key: 3 }, [
1278
+ u("rect", {
1279
+ "data-gantt-part": "handle-left",
1280
+ x: t.x,
1281
+ y: t.y + 4,
786
1282
  width: "4",
787
- height: c.barHeight - 8,
1283
+ height: d.barHeight - 8,
788
1284
  rx: "2",
789
1285
  fill: "currentColor",
790
1286
  "fill-opacity": "0.4",
791
1287
  class: "pointer-events-none"
792
- }, null, 8, qt),
793
- r("rect", {
794
- x: e.x + e.fullW - 4,
795
- y: e.y + 4,
1288
+ }, null, 8, So),
1289
+ u("rect", {
1290
+ "data-gantt-part": "handle-right",
1291
+ x: t.x + t.fullW - 4,
1292
+ y: t.y + 4,
796
1293
  width: "4",
797
- height: c.barHeight - 8,
1294
+ height: d.barHeight - 8,
798
1295
  rx: "2",
799
1296
  fill: "currentColor",
800
1297
  "fill-opacity": "0.4",
801
1298
  class: "pointer-events-none"
802
- }, null, 8, Xt)
803
- ], 64)) : h("", !0),
804
- c.showLabels && e.fullW > 60 ? (u(), d("text", {
1299
+ }, null, 8, Co)
1300
+ ], 64)) : m("", !0),
1301
+ d.showLabels && t.fullW > 60 ? (v(), g("text", {
805
1302
  key: 4,
806
- x: e.x + 12,
807
- y: e.y + c.barHeight / 2,
1303
+ "data-gantt-part": "label",
1304
+ x: t.x + 12,
1305
+ y: t.y + d.barHeight / 2,
808
1306
  "dominant-baseline": "middle",
809
1307
  "font-size": "11",
810
1308
  "font-weight": "600",
811
- fill: c.showProgress ? "currentColor" : "white",
812
- opacity: Q.value > 0.3 ? 0.85 : 0,
1309
+ fill: d.showProgress ? "currentColor" : "white",
1310
+ opacity: We.value > 0.3 ? 0.85 : 0,
813
1311
  class: "pointer-events-none"
814
- }, b(e.task.name), 9, jt)) : h("", !0)
815
- ], 64))
816
- ], 2))), 128)),
817
- r("g", {
1312
+ }, M(t.task.name), 9, To)) : m("", !0)
1313
+ ], 64)),
1314
+ d.editableDependencies && en(o) ? (v(), g("g", {
1315
+ key: 2,
1316
+ class: "vlite-gantt-dep-connector",
1317
+ transform: `translate(${F(t).cx}, ${F(t).cy})`,
1318
+ role: "button",
1319
+ tabindex: "0",
1320
+ focusable: "true",
1321
+ "aria-label": `Create dependency from ${t.task.name}`,
1322
+ onPointerdown: (a) => nn(a, o),
1323
+ onKeydown: (a) => on(a, o),
1324
+ onFocus: (a) => an(o),
1325
+ onBlur: ln,
1326
+ onMouseenter: (a) => yn(o),
1327
+ onMouseleave: n[0] || (n[0] = (a) => pn(a))
1328
+ }, [
1329
+ n[8] || (n[8] = u("circle", {
1330
+ r: "11",
1331
+ fill: "transparent",
1332
+ class: "vlite-gantt-dep-connector-hit"
1333
+ }, null, -1)),
1334
+ u("circle", {
1335
+ r: ea,
1336
+ class: "vlite-gantt-dep-connector-disc",
1337
+ fill: "var(--color-background)",
1338
+ stroke: "var(--color-foreground)",
1339
+ "stroke-width": "1.5"
1340
+ }),
1341
+ n[9] || (n[9] = u("path", {
1342
+ d: "M -3.5 0 H 3.5 M 0 -3.5 V 3.5",
1343
+ stroke: "var(--color-foreground)",
1344
+ "stroke-width": "1.5",
1345
+ "stroke-linecap": "round",
1346
+ class: "pointer-events-none"
1347
+ }, null, -1))
1348
+ ], 40, Eo)) : m("", !0),
1349
+ h.value && ge.value === t.task.id ? (v(), g("g", Wo, [
1350
+ u("rect", {
1351
+ x: t.x - 3,
1352
+ y: t.y - 3,
1353
+ width: t.fullW + 6,
1354
+ height: d.barHeight + 6,
1355
+ rx: d.barRadius + 2,
1356
+ fill: "none",
1357
+ stroke: L.value === "valid" ? "var(--color-success)" : "var(--color-danger)",
1358
+ "stroke-width": "2",
1359
+ "stroke-dasharray": L.value === "valid" ? "0" : "5 3"
1360
+ }, null, 8, Ro),
1361
+ u("text", {
1362
+ x: t.x + t.fullW + 10,
1363
+ y: t.y + d.barHeight / 2,
1364
+ "dominant-baseline": "middle",
1365
+ "font-size": "11",
1366
+ "font-weight": "700",
1367
+ fill: L.value === "valid" ? "var(--color-success)" : "var(--color-danger)"
1368
+ }, M(L.value === "valid" ? "✓" : "✕"), 9, Ao)
1369
+ ])) : m("", !0)
1370
+ ], 42, wo))), 128)),
1371
+ h.value && T.value ? (v(), g("g", Po, [
1372
+ u("line", {
1373
+ x1: T.value.x1,
1374
+ y1: T.value.y1,
1375
+ x2: T.value.x2,
1376
+ y2: T.value.y2,
1377
+ stroke: L.value === "invalid" ? "var(--color-danger)" : "var(--color-primary)",
1378
+ "stroke-width": "2",
1379
+ "stroke-dasharray": L.value === "invalid" ? "2 4" : "6 4",
1380
+ "stroke-linecap": "round",
1381
+ "stroke-opacity": L.value === "none" ? 0.55 : 0.9
1382
+ }, null, 8, _o),
1383
+ u("circle", {
1384
+ cx: T.value.x2,
1385
+ cy: T.value.y2,
1386
+ r: "4",
1387
+ fill: L.value === "invalid" ? "var(--color-danger)" : "var(--color-primary)",
1388
+ "fill-opacity": L.value === "none" ? 0.55 : 0.9
1389
+ }, null, 8, Bo)
1390
+ ])) : m("", !0),
1391
+ u("g", {
818
1392
  ref_key: "dragLabelRef",
819
1393
  ref: H,
820
- style: { display: "none" }
821
- }, [...o[5] || (o[5] = [
822
- r("rect", {
1394
+ style: { display: "none" },
1395
+ "pointer-events": "none",
1396
+ "aria-hidden": "true"
1397
+ }, [...n[10] || (n[10] = [
1398
+ u("rect", {
823
1399
  x: "0",
824
1400
  y: "0",
825
- width: "124",
1401
+ width: "148",
826
1402
  height: "18",
827
1403
  rx: "4",
828
1404
  fill: "var(--color-foreground)",
829
1405
  "fill-opacity": "0.85"
830
1406
  }, null, -1),
831
- r("text", {
1407
+ u("text", {
832
1408
  x: "0",
833
1409
  y: "0",
834
1410
  "text-anchor": "middle",
@@ -838,77 +1414,79 @@ const ct = {
838
1414
  fill: "var(--color-background)"
839
1415
  }, null, -1)
840
1416
  ])], 512),
841
- c.showTodayLine && V.value ? (u(), d("g", Nt, [
842
- r("line", {
843
- x1: G.value,
1417
+ d.showTodayLine && Ie.value ? (v(), g("g", Ho, [
1418
+ u("line", {
1419
+ x1: ve.value,
844
1420
  y1: 0,
845
- x2: G.value,
846
- y2: O.value,
847
- stroke: c.todayColor,
1421
+ x2: ve.value,
1422
+ y2: ue.value,
1423
+ stroke: d.todayColor,
848
1424
  "stroke-width": "2",
849
1425
  "stroke-opacity": "0.7",
850
1426
  "stroke-dasharray": "6 3"
851
- }, null, 8, Vt),
852
- r("circle", {
853
- cx: G.value,
1427
+ }, null, 8, zo),
1428
+ u("circle", {
1429
+ cx: ve.value,
854
1430
  cy: 0,
855
1431
  r: "4",
856
- fill: c.todayColor,
1432
+ fill: d.todayColor,
857
1433
  "fill-opacity": "0.9"
858
- }, null, 8, Ut),
859
- r("text", {
860
- x: G.value,
1434
+ }, null, 8, Go),
1435
+ u("text", {
1436
+ x: ve.value,
861
1437
  y: -8,
862
1438
  "text-anchor": "middle",
863
1439
  "font-size": "9",
864
1440
  "font-weight": "700",
865
- fill: c.todayColor,
1441
+ fill: d.todayColor,
866
1442
  "fill-opacity": "0.9"
867
- }, "TODAY", 8, Kt)
868
- ])) : h("", !0)
869
- ], 8, St))
1443
+ }, "TODAY", 8, Fo)
1444
+ ])) : m("", !0)
1445
+ ], 42, ro))
870
1446
  ], 4)
871
1447
  ], 544)
872
1448
  ]),
873
- (u(), st(rt, { to: "body" }, [
874
- g.value && !I.value ? (u(), d("div", {
1449
+ u("div", Xo, M(Fe.value), 1),
1450
+ (v(), In(Mn, { to: "body" }, [
1451
+ p.value && !P.value && !h.value && !I.value ? (v(), g("div", {
875
1452
  key: 0,
876
1453
  class: "vlite-chart-tooltip",
877
- style: D({ left: `${g.value.x + 14}px`, top: `${g.value.y - 12}px` })
1454
+ style: R({ left: `${p.value.left}px`, top: `${p.value.top}px` })
878
1455
  }, [
879
- r("div", Qt, b(g.value.task.name), 1),
880
- r("div", Jt, [
881
- r("span", {
1456
+ u("div", qo, M(p.value.task.name), 1),
1457
+ u("div", Oo, [
1458
+ u("span", {
882
1459
  class: "w-2 h-2 rounded-sm shrink-0",
883
- style: D({ backgroundColor: g.value.task._color ?? g.value.task.color })
1460
+ style: R({ backgroundColor: p.value.task._color ?? p.value.task.color })
884
1461
  }, null, 4),
885
- r("span", null, b(g.value.startStr) + " — " + b(g.value.endStr), 1)
1462
+ u("span", null, M(p.value.startStr) + " — " + M(p.value.endStr), 1)
886
1463
  ]),
887
- r("div", Yt, b(Ye(g.value.task._start, g.value.task._end)), 1),
888
- c.showProgress && g.value.task.progress != null ? (u(), d("div", eo, [
889
- r("div", to, [
890
- r("div", {
1464
+ u("div", Vo, M(kn(p.value.task._start, p.value.task._end)), 1),
1465
+ d.showProgress && p.value.task.progress != null ? (v(), g("div", Ko, [
1466
+ u("div", Zo, [
1467
+ u("div", {
891
1468
  class: "vlite-gantt-tooltip-progress-fill",
892
- style: D({
893
- width: `${g.value.task.progress}%`,
894
- backgroundColor: g.value.task._color ?? g.value.task.color
1469
+ style: R({
1470
+ width: `${p.value.task.progress}%`,
1471
+ backgroundColor: p.value.task._color ?? p.value.task.color
895
1472
  })
896
1473
  }, null, 4)
897
1474
  ]),
898
- r("span", oo, b(g.value.task.progress) + "%", 1)
899
- ])) : h("", !0),
900
- g.value.task.group ? (u(), d("div", no, b(g.value.task.group), 1)) : h("", !0),
901
- c.draggable && !g.value.task.milestone ? (u(), d("div", lo, [
902
- o[6] || (o[6] = We(" Drag to move · Edges to resize ", -1)),
903
- c.cascadeDependencies ? (u(), d($, { key: 0 }, [
904
- We(" · Dependents follow")
905
- ], 64)) : h("", !0)
906
- ])) : h("", !0)
907
- ], 4)) : h("", !0)
1475
+ u("span", No, M(p.value.task.progress) + "%", 1)
1476
+ ])) : m("", !0),
1477
+ p.value.task.group ? (v(), g("div", jo, M(p.value.task.group), 1)) : m("", !0),
1478
+ d.draggable && !p.value.task.milestone ? (v(), g("div", Uo, [
1479
+ n[11] || (n[11] = Lt(" Drag to move · Edges to resize ", -1)),
1480
+ d.cascadeDependencies ? (v(), g(C, { key: 0 }, [
1481
+ Lt(" · Dependents follow")
1482
+ ], 64)) : m("", !0)
1483
+ ])) : m("", !0),
1484
+ d.editableDependencies ? (v(), g("div", Yo, " Drag the + connector to link a dependency ")) : m("", !0)
1485
+ ], 4)) : m("", !0)
908
1486
  ]))
909
1487
  ], 512));
910
1488
  }
911
1489
  });
912
1490
  export {
913
- uo as default
1491
+ sa as default
914
1492
  };