@stonecrop/atable 0.30.0 → 0.32.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.
Files changed (79) hide show
  1. package/dist/assets/index.css +804 -1
  2. package/dist/atable.js +2809 -1944
  3. package/dist/atable.js.map +1 -1
  4. package/dist/src/components/ACell.vue.d.ts +17 -0
  5. package/dist/src/components/ACell.vue.d.ts.map +1 -0
  6. package/dist/src/components/AGanttCell.vue.d.ts +34 -0
  7. package/dist/src/components/AGanttCell.vue.d.ts.map +1 -0
  8. package/dist/src/components/AGanttConnection.vue.d.ts +13 -0
  9. package/dist/src/components/AGanttConnection.vue.d.ts.map +1 -0
  10. package/dist/src/components/ARow.vue.d.ts +2693 -0
  11. package/dist/src/components/ARow.vue.d.ts.map +1 -0
  12. package/dist/src/components/ARowActions.vue.d.ts +16 -0
  13. package/dist/src/components/ARowActions.vue.d.ts.map +1 -0
  14. package/dist/src/components/ATable.vue.d.ts +13358 -0
  15. package/dist/src/components/ATable.vue.d.ts.map +1 -0
  16. package/dist/src/components/ATableColumnFilter.vue.d.ts +11 -0
  17. package/dist/src/components/ATableColumnFilter.vue.d.ts.map +1 -0
  18. package/dist/src/components/ATableHeader.vue.d.ts +20 -0
  19. package/dist/src/components/ATableHeader.vue.d.ts.map +1 -0
  20. package/dist/src/components/ATableLoading.vue.d.ts +14 -0
  21. package/dist/src/components/ATableLoading.vue.d.ts.map +1 -0
  22. package/dist/src/components/ATableLoadingBar.vue.d.ts +14 -0
  23. package/dist/src/components/ATableLoadingBar.vue.d.ts.map +1 -0
  24. package/dist/src/components/ATableModal.vue.d.ts +18 -0
  25. package/dist/src/components/ATableModal.vue.d.ts.map +1 -0
  26. package/dist/src/components/ATablePaginationFooter.vue.d.ts +17 -0
  27. package/dist/src/components/ATablePaginationFooter.vue.d.ts.map +1 -0
  28. package/dist/src/icons/index.d.ts +14 -7
  29. package/dist/src/icons/index.d.ts.map +1 -1
  30. package/dist/{tsdoc-metadata.json → src/tsdoc-metadata.json} +1 -1
  31. package/dist/src/types/index.d.ts.map +1 -1
  32. package/package.json +35 -29
  33. package/dist/atable.d.ts +0 -3560
  34. package/dist/atable.tsbuildinfo +0 -1
  35. package/dist/icons/stonecrop-ui-icon-add.svg +0 -5
  36. package/dist/icons/stonecrop-ui-icon-delete.svg +0 -5
  37. package/dist/icons/stonecrop-ui-icon-duplicate.svg +0 -5
  38. package/dist/icons/stonecrop-ui-icon-insert-above.svg +0 -15
  39. package/dist/icons/stonecrop-ui-icon-insert-below.svg +0 -15
  40. package/dist/icons/stonecrop-ui-icon-move.svg +0 -4
  41. package/dist/icons/stonecrop-ui-icon-open.svg +0 -5
  42. package/dist/src/composables/table-pagination.js +0 -108
  43. package/dist/src/icons/index.js +0 -32
  44. package/dist/src/index.js +0 -33
  45. package/dist/src/linkSearchableText.js +0 -44
  46. package/dist/src/resolveFilterType.js +0 -27
  47. package/dist/src/schemaToColumns.js +0 -59
  48. package/dist/src/stores/table.js +0 -833
  49. package/dist/src/types/index.js +0 -0
  50. package/dist/src/utils.js +0 -39
  51. package/src/components/ACell.vue +0 -410
  52. package/src/components/AGanttCell.vue +0 -638
  53. package/src/components/AGanttConnection.vue +0 -164
  54. package/src/components/ARow.vue +0 -251
  55. package/src/components/ARowActions.vue +0 -407
  56. package/src/components/ATable.vue +0 -538
  57. package/src/components/ATableColumnFilter.vue +0 -216
  58. package/src/components/ATableHeader.vue +0 -141
  59. package/src/components/ATableLoading.vue +0 -86
  60. package/src/components/ATableLoadingBar.vue +0 -81
  61. package/src/components/ATableModal.vue +0 -52
  62. package/src/components/ATablePaginationFooter.vue +0 -100
  63. package/src/composables/table-pagination.ts +0 -172
  64. package/src/icons/index.ts +0 -38
  65. package/src/icons/stonecrop-ui-icon-add.svg +0 -5
  66. package/src/icons/stonecrop-ui-icon-delete.svg +0 -5
  67. package/src/icons/stonecrop-ui-icon-duplicate.svg +0 -5
  68. package/src/icons/stonecrop-ui-icon-insert-above.svg +0 -15
  69. package/src/icons/stonecrop-ui-icon-insert-below.svg +0 -15
  70. package/src/icons/stonecrop-ui-icon-move.svg +0 -4
  71. package/src/icons/stonecrop-ui-icon-open.svg +0 -5
  72. package/src/index.ts +0 -62
  73. package/src/linkSearchableText.ts +0 -42
  74. package/src/resolveFilterType.ts +0 -32
  75. package/src/schemaToColumns.ts +0 -67
  76. package/src/shims-vue.d.ts +0 -10
  77. package/src/stores/table.ts +0 -978
  78. package/src/types/index.ts +0 -794
  79. package/src/utils.ts +0 -40
package/dist/atable.js CHANGED
@@ -1,1958 +1,2823 @@
1
- import { ref as F, computed as y, defineComponent as ge, useTemplateRef as re, onMounted as ze, openBlock as v, createElementBlock as w, unref as $, normalizeClass as te, normalizeStyle as he, createBlock as ae, resolveDynamicComponent as ye, normalizeProps as qe, mergeProps as ke, toDisplayString as ue, nextTick as Xe, useCssVars as ct, onUnmounted as dt, createElementVNode as T, withModifiers as Ce, createCommentVNode as U, withDirectives as ie, Fragment as ve, renderList as me, vShow as Ge, renderSlot as de, reactive as ut, vModelText as pe, vModelCheckbox as vt, vModelSelect as ft, createTextVNode as ht, toValue as Ze, watch as Be, useModel as Je, inject as gt, createVNode as Fe, withCtx as Ke, mergeModels as Qe } from "vue";
2
- import { defaultKeypressHandlers as Ve, useKeyboardNav as tt } from "@stonecrop/utilities";
3
- import { componentCategory as He, isBadgeDescriptor as _e, hasBadgeOptions as et } from "@stonecrop/schema";
4
- import { useDebounceFn as mt, useElementBounding as be, useDraggable as Le, useResizeObserver as wt, onClickOutside as xt, useMutationObserver as bt } from "@vueuse/core";
5
- import { defineStore as yt } from "pinia";
6
- import { vResizeObserver as Ct, vOnClickOutside as pt } from "@vueuse/components";
7
- import './assets/index.css';function Oe(e) {
8
- if (!(e == null || typeof e == "object")) {
9
- if (typeof e == "string") return e === "" ? void 0 : e;
10
- if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint")
11
- return String(e);
12
- }
1
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onMounted, onUnmounted, openBlock, reactive, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, toValue, unref, useCssVars, useModel, useTemplateRef, vModelCheckbox, vModelSelect, vModelText, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
2
+ import { defaultKeypressHandlers, useKeyboardNav } from "@stonecrop/utilities";
3
+ import { componentCategory, hasBadgeOptions, isBadgeDescriptor } from "@stonecrop/schema";
4
+ import { onClickOutside, useDebounceFn, useDraggable, useElementBounding, useMutationObserver, useResizeObserver } from "@vueuse/core";
5
+ import { defineStore } from "pinia";
6
+ import { vOnClickOutside, vResizeObserver } from "@vueuse/components";
7
+ import './assets/index.css';//#region src/linkSearchableText.ts
8
+ /**
9
+ * Normalize a scalar cell value to a non-empty string, or nothing.
10
+ *
11
+ * Rejecting objects is what the haystack wants: a nested value has no single textual form, and
12
+ * `String()` on one contributes `[object Object]`, which matches a search for "object" and nothing
13
+ * a user would actually type.
14
+ */
15
+ function scalarText(value) {
16
+ if (value == null || typeof value === "object") return void 0;
17
+ if (typeof value === "string") return value === "" ? void 0 : value;
18
+ if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
13
19
  }
14
- function kt(e) {
15
- if (e == null || e === "") return "";
16
- if (typeof e == "object") {
17
- const a = [];
18
- if ("id" in e) {
19
- const i = Oe(e.id);
20
- i !== void 0 && a.push(i);
21
- }
22
- if ("displayText" in e) {
23
- const i = Oe(e.displayText);
24
- i !== void 0 && a.push(i);
25
- }
26
- return a.join(" ");
27
- }
28
- return Oe(e) ?? "";
20
+ /**
21
+ * Build the substring-search haystack for a link column cell.
22
+ * Server middleware enriches inline FKs to `{ id, displayText }`; search both.
23
+ * @public
24
+ */
25
+ function linkSearchableText(cellValue) {
26
+ if (cellValue == null || cellValue === "") return "";
27
+ if (typeof cellValue === "object") {
28
+ const parts = [];
29
+ if ("id" in cellValue) {
30
+ const id = scalarText(cellValue.id);
31
+ if (id !== void 0) parts.push(id);
32
+ }
33
+ if ("displayText" in cellValue) {
34
+ const displayText = scalarText(cellValue.displayText);
35
+ if (displayText !== void 0) parts.push(displayText);
36
+ }
37
+ return parts.join(" ");
38
+ }
39
+ return scalarText(cellValue) ?? "";
29
40
  }
30
- const Mt = {
31
- text: "text",
32
- number: "number",
33
- boolean: "checkbox",
34
- date: "date",
35
- datetime: "dateRange",
36
- select: "select",
37
- code: "text",
38
- link: "text",
39
- attach: "text",
40
- quantity: "number",
41
- currency: "number"
41
+ //#endregion
42
+ //#region src/resolveFilterType.ts
43
+ var CATEGORY_FILTER = {
44
+ text: "text",
45
+ number: "number",
46
+ boolean: "checkbox",
47
+ date: "date",
48
+ datetime: "dateRange",
49
+ select: "select",
50
+ code: "text",
51
+ link: "text",
52
+ attach: "text",
53
+ quantity: "number",
54
+ currency: "number"
42
55
  };
43
- function je(e) {
44
- if (e.filterType) return e.filterType;
45
- const a = He(e.component);
46
- return a ? Mt[a] : "text";
56
+ /**
57
+ * Resolve the filter widget and filter logic type for a column.
58
+ * Explicit `filterType` wins; otherwise derive from the component category.
59
+ * @public
60
+ */
61
+ function resolveFilterType(column) {
62
+ if (column.filterType) return column.filterType;
63
+ const category = componentCategory(column.component);
64
+ if (category) return CATEGORY_FILTER[category];
65
+ return "text";
47
66
  }
48
- const Rt = (e) => {
49
- const a = new DOMParser().parseFromString(e, "text/html");
50
- return Array.from(a.body.childNodes).some((i) => i.nodeType === 1);
51
- }, $t = (e = 8) => Array.from({ length: e }, () => Math.floor(Math.random() * 16).toString(16)).join(""), nt = (e) => {
52
- if (e == null) return "";
53
- if (typeof e == "object") {
54
- const a = e.qty ?? "", i = e.uom ?? "";
55
- return i ? `${a} ${i}`.trim() : String(a);
56
- }
57
- return String(e);
58
- }, ot = (e) => {
59
- if (e == null) return "";
60
- if (typeof e == "object") {
61
- const a = e.amount ?? "", i = e.currency?.displayText ?? e.currency?.id ?? "";
62
- return i ? `${a} ${i}`.trim() : String(a);
63
- }
64
- return String(e);
67
+ //#endregion
68
+ //#region src/utils.ts
69
+ var isHtmlString = (htmlString) => {
70
+ const $document = new DOMParser().parseFromString(htmlString, "text/html");
71
+ return Array.from($document.body.childNodes).some((node) => node.nodeType === 1);
65
72
  };
66
- function Pe(e) {
67
- if (e !== null && typeof e == "object") {
68
- if ("qty" in e) return Number(e.qty);
69
- if ("baseAmount" in e && e.baseAmount != null)
70
- return Number(e.baseAmount);
71
- if ("amount" in e) return Number(e.amount);
72
- }
73
- return Number(e);
73
+ var generateHash = (length = 8) => {
74
+ return Array.from({ length }, () => Math.floor(Math.random() * 16).toString(16)).join("");
75
+ };
76
+ /**
77
+ * Render a composite quantity value (`{ qty, uom }`, see `QuantityValue` in `@stonecrop/aform`)
78
+ * as `"<qty> <uom>"`. Shared by the two paths a quantity column can reach formatting through:
79
+ * the `format` that `schemaToColumns` attaches, and the table store's category-based default.
80
+ */
81
+ var formatQuantity = (value) => {
82
+ if (value === null || value === void 0) return "";
83
+ if (typeof value === "object") {
84
+ const qty = value.qty ?? "";
85
+ const uom = value.uom ?? "";
86
+ return uom ? `${qty} ${uom}`.trim() : String(qty);
87
+ }
88
+ return String(value);
89
+ };
90
+ /**
91
+ * Render a composite currency value (`{ amount, currency }`, see `CurrencyValue` in
92
+ * `@stonecrop/aform`) as `"<amount> <currency>"`. `currency` is an AFormLinkValue FK reference —
93
+ * its `displayText` is preferred, falling back to `id`. Shared by the two paths a currency column
94
+ * can reach formatting through: the `format` that `schemaToColumns` attaches, and the table
95
+ * store's category-based default.
96
+ */
97
+ var formatCurrency = (value) => {
98
+ if (value === null || value === void 0) return "";
99
+ if (typeof value === "object") {
100
+ const amount = value.amount ?? "";
101
+ const currency = value.currency?.displayText ?? value.currency?.id ?? "";
102
+ return currency ? `${amount} ${currency}`.trim() : String(amount);
103
+ }
104
+ return String(value);
105
+ };
106
+ //#endregion
107
+ //#region src/stores/table.ts
108
+ function toComparableNumber(cellValue) {
109
+ if (cellValue !== null && typeof cellValue === "object") {
110
+ if ("qty" in cellValue) return Number(cellValue.qty);
111
+ if ("baseAmount" in cellValue && cellValue.baseAmount != null) return Number(cellValue.baseAmount);
112
+ if ("amount" in cellValue) return Number(cellValue.amount);
113
+ }
114
+ return Number(cellValue);
74
115
  }
75
- function lt(e, a) {
76
- const i = a[e];
77
- if (i.isRoot || i.parent === null || i.parent === void 0)
78
- return !0;
79
- const g = i.parent;
80
- return g < 0 || g >= a.length ? !1 : (a[g].childrenOpen || !1) && lt(g, a);
116
+ function isNodeOpen(rowIndex, treeDisplay) {
117
+ const row = treeDisplay[rowIndex];
118
+ if (row.isRoot) return true;
119
+ if (row.parent === null || row.parent === void 0) return true;
120
+ const parentIndex = row.parent;
121
+ if (parentIndex < 0 || parentIndex >= treeDisplay.length) return false;
122
+ return (treeDisplay[parentIndex].childrenOpen || false) && isNodeOpen(parentIndex, treeDisplay);
81
123
  }
82
- function It(e, a, i) {
83
- const g = je(i), x = a.value;
84
- if (!x && g !== "dateRange" && g !== "checkbox") return !0;
85
- switch (g) {
86
- case "text":
87
- return (i.linkDoctype ? kt(e) : typeof e == "object" && e !== null ? Object.values(e).join(" ") : String(e || "")).toLowerCase().includes(String(x).toLowerCase());
88
- case "number": {
89
- const s = Pe(e), l = Number(x);
90
- return !isNaN(s) && !isNaN(l) && s === l;
91
- }
92
- case "select":
93
- return e === x;
94
- case "checkbox":
95
- return x === !0 ? !!e : !0;
96
- case "date": {
97
- let s;
98
- if (typeof e == "number") {
99
- const r = new Date(e), f = (/* @__PURE__ */ new Date()).getFullYear();
100
- s = new Date(f, r.getMonth(), r.getDate());
101
- } else
102
- s = new Date(String(e));
103
- const l = new Date(String(x));
104
- return s.toDateString() === l.toDateString();
105
- }
106
- case "dateRange": {
107
- const s = a.startValue, l = a.endValue;
108
- if (!s && !l) return !0;
109
- let r;
110
- if (typeof e == "number") {
111
- const f = new Date(e), n = (/* @__PURE__ */ new Date()).getFullYear();
112
- r = new Date(n, f.getMonth(), f.getDate());
113
- } else
114
- r = new Date(String(e));
115
- return !(s && r < new Date(String(s)) || l && r > new Date(String(l)));
116
- }
117
- default:
118
- return !0;
119
- }
124
+ function applyFilter(cellValue, filter, column) {
125
+ const filterType = resolveFilterType(column);
126
+ const value = filter.value;
127
+ if (!value && filterType !== "dateRange" && filterType !== "checkbox") return true;
128
+ switch (filterType) {
129
+ case "text": return (column.linkDoctype ? linkSearchableText(cellValue) : typeof cellValue === "object" && cellValue !== null ? Object.values(cellValue).join(" ") : String(cellValue || "")).toLowerCase().includes(String(value).toLowerCase());
130
+ case "number": {
131
+ const numValue = toComparableNumber(cellValue);
132
+ const filterNum = Number(value);
133
+ return !isNaN(numValue) && !isNaN(filterNum) && numValue === filterNum;
134
+ }
135
+ case "select": return cellValue === value;
136
+ case "checkbox":
137
+ if (value === true) return !!cellValue;
138
+ return true;
139
+ case "date": {
140
+ let cellDate;
141
+ if (typeof cellValue === "number") {
142
+ const originalDate = new Date(cellValue);
143
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
144
+ cellDate = new Date(currentYear, originalDate.getMonth(), originalDate.getDate());
145
+ } else cellDate = new Date(String(cellValue));
146
+ const filterDate = new Date(String(value));
147
+ return cellDate.toDateString() === filterDate.toDateString();
148
+ }
149
+ case "dateRange": {
150
+ const startValue = filter.startValue;
151
+ const endValue = filter.endValue;
152
+ if (!startValue && !endValue) return true;
153
+ let cellDateRange;
154
+ if (typeof cellValue === "number") {
155
+ const originalDate = new Date(cellValue);
156
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
157
+ cellDateRange = new Date(currentYear, originalDate.getMonth(), originalDate.getDate());
158
+ } else cellDateRange = new Date(String(cellValue));
159
+ if (startValue && cellDateRange < new Date(String(startValue))) return false;
160
+ if (endValue && cellDateRange > new Date(String(endValue))) return false;
161
+ return true;
162
+ }
163
+ default: return true;
164
+ }
120
165
  }
121
- function St(e, a) {
122
- return a && e === 0 && a > 0 ? `${a}ch` : "inherit";
166
+ /**
167
+ * Compute the CSS indentation for a tree-table cell. Pure helper (captures no store state);
168
+ * imported directly by cell components rather than exposed on the store's public return.
169
+ * @internal
170
+ */
171
+ function getIndent(colIndex, indentLevel) {
172
+ if (indentLevel && colIndex === 0 && indentLevel > 0) return `${indentLevel}ch`;
173
+ else return "inherit";
123
174
  }
124
- const Dt = (e) => {
125
- const a = e.id || $t(), i = e.linkResolver ?? null;
126
- return yt(`table-${a}`, () => {
127
- const x = () => {
128
- const t = [Object.assign({}, { rowModified: !1 })], o = /* @__PURE__ */ new Set();
129
- for (let A = 0; A < l.value.length; A++) {
130
- const p = l.value[A];
131
- p.parent !== null && p.parent !== void 0 && o.add(p.parent);
132
- }
133
- const c = (A) => l.value[A]?.gantt !== void 0, S = (A) => {
134
- for (let p = 0; p < l.value.length; p++)
135
- if (l.value[p].parent === A && (c(p) || S(p)))
136
- return !0;
137
- return !1;
138
- }, G = (A) => {
139
- const p = r.value, P = p.view === "tree" || p.view === "tree-gantt" ? p.defaultTreeExpansion : void 0;
140
- if (!P) return !0;
141
- switch (P) {
142
- case "root":
143
- return !1;
144
- // Only root nodes are visible, all children start collapsed
145
- case "branch":
146
- return S(A);
147
- case "leaf":
148
- return !0;
149
- // All nodes should be expanded
150
- default:
151
- return !0;
152
- }
153
- };
154
- for (let A = 0; A < l.value.length; A++) {
155
- const p = l.value[A], P = p.parent === null || p.parent === void 0, oe = o.has(A);
156
- t[A] = {
157
- childrenOpen: G(A),
158
- expanded: !1,
159
- indent: p.indent || 0,
160
- isParent: oe,
161
- isRoot: P,
162
- rowModified: !1,
163
- open: P,
164
- // This will be recalculated later for non-root nodes
165
- parent: p.parent
166
- };
167
- }
168
- return t;
169
- }, s = F(e.columns), l = F(e.rows), r = F(e.config || {}), f = F({}), n = F({}), d = y(() => {
170
- const t = {};
171
- for (const [o, c] of s.value.entries())
172
- for (const [S, G] of l.value.entries())
173
- t[`${o}:${S}`] = G[c.name];
174
- return t;
175
- }), u = y({
176
- get: () => {
177
- const t = x();
178
- for (let o = 0; o < t.length; o++)
179
- f.value[o] && (t[o].rowModified = f.value[o]), n.value[o] && (n.value[o].childrenOpen !== void 0 && (t[o].childrenOpen = n.value[o].childrenOpen), n.value[o].expanded !== void 0 && (t[o].expanded = n.value[o].expanded));
180
- if (V.value)
181
- for (let o = 0; o < t.length; o++)
182
- t[o].isRoot || (t[o].open = lt(o, t));
183
- return t;
184
- },
185
- set: (t) => {
186
- JSON.stringify(t) !== JSON.stringify(u.value) && (u.value = t);
187
- }
188
- }), B = F(e.modal || { visible: !1 }), K = F({}), j = F([]), b = F([]), C = F([]), M = F({
189
- column: null,
190
- direction: null
191
- }), L = F({}), E = y(() => s.value.some((t) => t.pinned)), O = y(() => r.value.view === "gantt" || r.value.view === "tree-gantt"), V = y(() => r.value.view === "tree" || r.value.view === "tree-gantt"), W = y(() => {
192
- const t = r.value;
193
- return t.view === "gantt" || t.view === "tree-gantt" ? t.dependencyGraph !== !1 : !0;
194
- }), H = y(() => `${Math.ceil(l.value.length / 100 + 1)}ch`), z = y(
195
- () => r.value.view ? ["list", "tree", "tree-gantt", "list-expansion"].includes(r.value.view) : !1
196
- ), ce = y(() => {
197
- let t = l.value.map((o, c) => ({
198
- ...o,
199
- originalIndex: c
200
- }));
201
- if (Object.entries(L.value).forEach(([o, c]) => {
202
- const S = parseInt(o), G = s.value[S];
203
- !G || !(c.value || c.startValue || c.endValue || je(G) === "checkbox" && c.value !== void 0) || (t = t.filter((p) => {
204
- const P = p[G.name];
205
- return It(P, c, G);
206
- }));
207
- }), M.value.column !== null && M.value.direction) {
208
- const o = s.value[M.value.column], c = M.value.direction;
209
- t.sort((S, G) => {
210
- let A = S[o.name], p = G[o.name];
211
- A == null && (A = ""), p == null && (p = "");
212
- const P = Pe(A), oe = Pe(p);
213
- if (!isNaN(P) && !isNaN(oe) && A !== "" && p !== "")
214
- return c === "asc" ? P - oe : oe - P;
215
- {
216
- const Ue = String(A).toLowerCase(), Ye = String(p).toLowerCase();
217
- return c === "asc" ? Ue.localeCompare(Ye) : Ye.localeCompare(Ue);
218
- }
219
- });
220
- }
221
- return t;
222
- }), we = (t, o) => d.value[`${t}:${o}`], Q = (t, o, c) => {
223
- const S = `${t}:${o}`, G = s.value[t];
224
- d.value[S] !== c && (f.value[o] = !0), d.value[S] = c, l.value[o] = {
225
- ...l.value[o],
226
- [G.name]: c
227
- };
228
- }, fe = (t) => {
229
- l.value = t;
230
- }, D = (t, o, c) => {
231
- const S = `${t}:${o}`;
232
- d.value[S] !== c && (f.value[o] = !0, K.value[S] = c);
233
- }, h = (t) => {
234
- const o = s.value.indexOf(t) === s.value.length - 1, c = r.value.fullWidth ? t.resizable && !o : t.resizable;
235
- return {
236
- width: t.width || "40ch",
237
- textAlign: t.align || "center",
238
- ...c && {
239
- resize: "horizontal",
240
- overflow: "hidden",
241
- whiteSpace: "nowrap"
242
- }
243
- };
244
- }, m = (t, o) => {
245
- if (t < 0 || t >= s.value.length) return;
246
- const S = Math.max(o, 40);
247
- s.value[t] = {
248
- ...s.value[t],
249
- width: `${S}px`
250
- };
251
- }, Z = (t) => {
252
- const o = l.value[t];
253
- return O.value && o.gantt !== void 0;
254
- }, R = (t) => !V.value || u.value[t].isRoot || u.value[t].open, k = (t) => !V.value && r.value.view !== "list-expansion" ? "" : V.value && (u.value[t].isRoot || u.value[t].isParent) ? u.value[t].childrenOpen ? "▼" : "►" : r.value.view === "list-expansion" ? u.value[t].expanded ? "▼" : "►" : "", q = (t) => {
255
- if (V.value) {
256
- const o = n.value[t] || {}, S = !(o.childrenOpen ?? u.value[t].childrenOpen);
257
- n.value[t] = {
258
- ...o,
259
- childrenOpen: S
260
- }, S || _(t);
261
- } else if (r.value.view === "list-expansion") {
262
- const o = n.value[t] || {}, c = o.expanded ?? u.value[t].expanded;
263
- n.value[t] = {
264
- ...o,
265
- expanded: !c
266
- };
267
- }
268
- }, _ = (t) => {
269
- for (let o = 0; o < l.value.length; o++)
270
- if (u.value[o].parent === t) {
271
- const c = n.value[o] || {};
272
- n.value[o] = {
273
- ...c,
274
- childrenOpen: !1
275
- }, _(o);
276
- }
277
- }, se = (t, o) => {
278
- const c = we(t, o);
279
- return Me(t, o, c);
280
- }, Me = (t, o, c) => {
281
- const S = s.value[t], G = l.value[o], A = S.format;
282
- if (!A) {
283
- const p = He(S.component);
284
- return p === "boolean" ? c ? "✓" : "✗" : p === "date" ? c != null ? new Date(String(c)).toLocaleDateString() : c : p === "datetime" ? c != null ? new Date(String(c)).toLocaleString() : c : p === "quantity" ? nt(c) : p === "currency" ? ot(c) : c;
285
- }
286
- return typeof A == "function" ? A(c, { table: d.value, row: G, column: S }) : typeof A == "string" ? Function(`"use strict";return (${A})`)()(c, { table: d.value, row: G, column: S }) : c;
287
- }, Te = (t) => {
288
- t.target instanceof Node && B.value.parent?.contains(t.target) || B.value.visible && (B.value.visible = !1);
289
- }, Ee = (t) => {
290
- const o = l.value[t.rowIndex]?.gantt;
291
- o && (t.type === "resize" ? t.edge === "start" ? (o.startIndex = t.newStart, o.endIndex = t.end, o.colspan = o.endIndex - o.startIndex) : t.edge === "end" && (o.startIndex = t.start, o.endIndex = t.newEnd, o.colspan = o.endIndex - o.startIndex) : t.type === "bar" && (o.startIndex = t.newStart, o.endIndex = t.newEnd, o.colspan = o.endIndex - o.startIndex));
292
- }, Re = (t) => {
293
- const o = j.value.findIndex((c) => c.id === t.id);
294
- o >= 0 ? j.value[o] = t : j.value.push(t);
295
- }, $e = (t) => {
296
- const o = j.value.findIndex((c) => c.id === t);
297
- o >= 0 && j.value.splice(o, 1);
298
- }, Ie = (t) => {
299
- const o = b.value.findIndex((c) => c.id === t.id);
300
- o >= 0 ? b.value[o] = t : b.value.push(t);
301
- }, Se = (t) => {
302
- const o = b.value.findIndex((c) => c.id === t);
303
- o >= 0 && b.value.splice(o, 1);
304
- }, I = (t, o, c) => {
305
- const S = b.value.find((p) => p.id === t), G = b.value.find((p) => p.id === o);
306
- if (!S || !G)
307
- return console.warn("Cannot create connection: handle not found"), null;
308
- const A = {
309
- id: `connection-${t}-${o}`,
310
- from: {
311
- barId: S.barId,
312
- side: S.side
313
- },
314
- to: {
315
- barId: G.barId,
316
- side: G.side
317
- },
318
- style: c?.style,
319
- label: c?.label
320
- };
321
- return C.value.push(A), A;
322
- }, N = (t) => {
323
- const o = C.value.findIndex((c) => c.id === t);
324
- return o >= 0 ? (C.value.splice(o, 1), !0) : !1;
325
- }, Y = (t) => C.value.filter((o) => o.from.barId === t || o.to.barId === t), X = (t) => b.value.filter((o) => o.barId === t), J = (t) => {
326
- if (s.value[t].sortable === !1) return;
327
- let c;
328
- M.value.column === t && M.value.direction === "asc" ? c = "desc" : c = "asc", M.value.column = t, M.value.direction = c;
329
- }, ee = (t, o) => {
330
- !o.value && !o.startValue && !o.endValue ? delete L.value[t] : L.value[t] = o;
331
- }, le = (t) => {
332
- delete L.value[t];
333
- }, ne = (t, o = "end") => {
334
- const c = {};
335
- for (const G of s.value)
336
- c[G.name] = "";
337
- t && Object.assign(c, t);
338
- let S;
339
- return o === "start" ? (S = 0, l.value.unshift(c)) : o === "end" ? (S = l.value.length, l.value.push(c)) : (S = Math.max(0, Math.min(o, l.value.length)), l.value.splice(S, 0, c)), S;
340
- };
341
- return {
342
- // state
343
- columns: s,
344
- config: r,
345
- connectionHandles: b,
346
- connectionPaths: C,
347
- display: u,
348
- filterState: L,
349
- ganttBars: j,
350
- modal: B,
351
- rows: l,
352
- sortState: M,
353
- table: d,
354
- updates: K,
355
- // getters
356
- filteredRows: ce,
357
- hasPinnedColumns: E,
358
- isGanttView: O,
359
- isTreeView: V,
360
- isDependencyGraphEnabled: W,
361
- numberedRowWidth: H,
362
- zeroColumn: z,
363
- // resolver
364
- linkResolver: i,
365
- // actions
366
- addRow: ne,
367
- clearFilter: le,
368
- closeModal: Te,
369
- createConnection: I,
370
- deleteConnection: N,
371
- deleteRow: (t) => {
372
- if (t < 0 || t >= l.value.length)
373
- return null;
374
- const [o] = l.value.splice(t, 1);
375
- delete f.value[t], delete n.value[t];
376
- const c = {}, S = {};
377
- for (const [G, A] of Object.entries(f.value)) {
378
- const p = parseInt(G);
379
- p > t ? c[p - 1] = A : c[p] = A;
380
- }
381
- for (const [G, A] of Object.entries(n.value)) {
382
- const p = parseInt(G);
383
- p > t ? S[p - 1] = A : S[p] = A;
384
- }
385
- return f.value = c, n.value = S, o;
386
- },
387
- duplicateRow: (t) => {
388
- if (t < 0 || t >= l.value.length)
389
- return -1;
390
- const o = l.value[t], c = JSON.parse(JSON.stringify(o)), S = t + 1;
391
- return l.value.splice(S, 0, c), S;
392
- },
393
- getCellData: we,
394
- getCellDisplayValue: se,
395
- getConnectionsForBar: Y,
396
- getFormattedValue: Me,
397
- getHandlesForBar: X,
398
- getHeaderCellStyle: h,
399
- getRowExpandSymbol: k,
400
- insertRowAbove: (t, o) => {
401
- const c = Math.max(0, t);
402
- return ne(o, c);
403
- },
404
- insertRowBelow: (t, o) => {
405
- const c = Math.min(t + 1, l.value.length);
406
- return ne(o, c);
407
- },
408
- isRowGantt: Z,
409
- isRowVisible: R,
410
- moveRow: (t, o) => {
411
- if (t < 0 || t >= l.value.length || o < 0 || o >= l.value.length || t === o)
412
- return !1;
413
- const [c] = l.value.splice(t, 1);
414
- l.value.splice(o, 0, c);
415
- const S = {}, G = {};
416
- for (const [A, p] of Object.entries(f.value)) {
417
- const P = parseInt(A);
418
- let oe = P;
419
- P === t ? oe = o : t < o ? P > t && P <= o && (oe = P - 1) : P >= o && P < t && (oe = P + 1), S[oe] = p;
420
- }
421
- for (const [A, p] of Object.entries(n.value)) {
422
- const P = parseInt(A);
423
- let oe = P;
424
- P === t ? oe = o : t < o ? P > t && P <= o && (oe = P - 1) : P >= o && P < t && (oe = P + 1), G[oe] = p;
425
- }
426
- return f.value = S, n.value = G, !0;
427
- },
428
- registerConnectionHandle: Ie,
429
- registerGanttBar: Re,
430
- resizeColumn: m,
431
- setCellData: Q,
432
- setCellText: D,
433
- setFilter: ee,
434
- sortByColumn: J,
435
- toggleRowExpand: q,
436
- unregisterConnectionHandle: Se,
437
- unregisterGanttBar: $e,
438
- updateGanttBar: Ee,
439
- updateRows: fe
440
- };
441
- })();
442
- }, At = ["data-colindex", "data-rowindex", "data-editable", "contenteditable", "tabindex"], Bt = ["innerHTML"], Ht = { key: 4 }, Tt = /* @__PURE__ */ ge({
443
- __name: "ACell",
444
- props: {
445
- colIndex: {},
446
- rowIndex: {},
447
- store: {},
448
- addNavigation: { type: [Boolean, Object], default: !0 },
449
- tabIndex: { default: 0 },
450
- pinned: { type: Boolean, default: !1 },
451
- debounce: { default: 300 }
452
- },
453
- setup(e, { expose: a }) {
454
- const i = re("cell"), g = e.store.getCellData(e.colIndex, e.rowIndex), x = F(""), s = F(!1), l = e.store.columns[e.colIndex], r = e.store.rows[e.rowIndex], f = l.align || "center", n = l.width || "40ch", d = y(() => e.store.getCellDisplayValue(e.colIndex, e.rowIndex)), u = F(null);
455
- ze(() => {
456
- if (!l.linkDoctype) return;
457
- const D = e.store.getCellData(e.colIndex, e.rowIndex);
458
- if (D != null && typeof D == "object") {
459
- const m = D, Z = m.displayText ?? m.id;
460
- (typeof Z == "string" || typeof Z == "number") && (u.value = String(Z));
461
- return;
462
- }
463
- const h = e.store.linkResolver;
464
- !h || typeof D != "string" || D === "" || h(l.linkDoctype, D).then((m) => (m != null && (u.value = m), m));
465
- });
466
- const B = y(() => u.value ?? d.value), K = y(() => {
467
- if (l.cellComponent) return;
468
- const D = B.value;
469
- return _e(D) ? D : void 0;
470
- }), j = y(() => {
471
- if (!(l.cellComponent || K.value) && et(l.options))
472
- return {
473
- value: e.store.getCellData(e.colIndex, e.rowIndex),
474
- options: l.options,
475
- presentation: "cell-fill"
476
- };
477
- }), b = y(
478
- () => !!l.cellComponent || K.value !== void 0 || et(l.options)
479
- ), C = y(() => l.edit && !b.value), M = y(() => {
480
- const D = { ...l.cellComponentProps };
481
- return l.cellComponent !== "ABadge" ? { ...D, value: B.value } : _e(B.value) ? { presentation: "cell-fill", ...D, ...B.value } : {
482
- presentation: "cell-fill",
483
- options: l.options,
484
- ...D,
485
- value: e.store.getCellData(e.colIndex, e.rowIndex)
486
- };
487
- }), L = y(() => typeof B.value == "string" ? Rt(B.value) : !1), E = y(() => ({
488
- textAlign: f,
489
- width: n,
490
- fontWeight: s.value ? "bold" : "inherit",
491
- paddingLeft: St(e.colIndex, e.store.display[e.rowIndex]?.indent)
492
- })), O = y(() => ({
493
- "sticky-column": e.pinned,
494
- "cell-modified": s.value,
495
- "atable-cell--badge-fill": b.value
496
- })), V = () => {
497
- H(), W();
498
- }, W = () => {
499
- const { left: D, bottom: h, width: m, height: Z } = be(i);
500
- l.mask, l.modalComponent && e.store.$patch((R) => {
501
- R.modal.visible = !0, R.modal.colIndex = e.colIndex, R.modal.rowIndex = e.rowIndex, R.modal.left = D.value, R.modal.bottom = h.value, R.modal.width = m.value, R.modal.height = Z.value, R.modal.cell = i.value, typeof l.modalComponent == "function" ? R.modal.component = l.modalComponent({ table: e.store.table, row: r, column: l }) : R.modal.component = l.modalComponent, R.modal.componentProps = l.modalComponentExtraProps;
502
- });
503
- };
504
- if (e.addNavigation) {
505
- let D = {
506
- ...Ve,
507
- "keydown.f2": W,
508
- "keydown.alt.up": W,
509
- "keydown.alt.down": W,
510
- "keydown.alt.left": W,
511
- "keydown.alt.right": W
512
- };
513
- typeof e.addNavigation == "object" && (D = {
514
- ...D,
515
- ...e.addNavigation
516
- }), tt([
517
- {
518
- selectors: i,
519
- handlers: D
520
- }
521
- ]);
522
- }
523
- const H = () => {
524
- if (i.value && l.edit) {
525
- const D = window.getSelection();
526
- if (D)
527
- try {
528
- const h = document.createRange();
529
- h.selectNodeContents && (h.selectNodeContents(i.value), D.removeAllRanges(), D.addRange(h));
530
- } catch {
531
- }
532
- }
533
- }, z = () => {
534
- i.value && (x.value = i.value.textContent, H());
535
- }, ce = () => {
536
- try {
537
- const D = window.getSelection();
538
- if (D && D.rangeCount > 0 && i.value) {
539
- const h = D.getRangeAt(0), m = h.cloneRange();
540
- if (m.selectNodeContents && m.setEnd)
541
- return m.selectNodeContents(i.value), m.setEnd(h.endContainer, h.endOffset), m.toString().length;
542
- }
543
- } catch {
544
- }
545
- return 0;
546
- }, we = (D) => {
547
- if (i.value)
548
- try {
549
- const h = window.getSelection();
550
- if (!h) return;
551
- let m = 0;
552
- const Z = document.createTreeWalker ? document.createTreeWalker(i.value, NodeFilter.SHOW_TEXT, null) : null;
553
- if (!Z) return;
554
- let R, k = null;
555
- for (; R = Z.nextNode(); ) {
556
- const q = R, _ = m + q.textContent.length;
557
- if (D <= _ && (k = document.createRange(), k.setStart && k.setEnd)) {
558
- k.setStart(q, D - m), k.setEnd(q, D - m);
559
- break;
560
- }
561
- m = _;
562
- }
563
- k && h.removeAllRanges && h.addRange && (h.removeAllRanges(), h.addRange(k));
564
- } catch {
565
- }
566
- }, Q = (D) => {
567
- if (!l.edit) return;
568
- const h = D.target;
569
- if (h.textContent === x.value)
570
- return;
571
- const m = ce();
572
- x.value = h.textContent, l.format ? (s.value = h.textContent !== e.store.getFormattedValue(e.colIndex, e.rowIndex, g), e.store.setCellText(e.colIndex, e.rowIndex, h.textContent)) : (s.value = h.textContent !== g, e.store.setCellData(e.colIndex, e.rowIndex, h.textContent)), Xe().then(() => we(m));
573
- }, fe = mt(Q, e.debounce);
574
- return a({
575
- currentData: x
576
- }), (D, h) => (v(), w("td", {
577
- ref: "cell",
578
- "data-colindex": e.colIndex,
579
- "data-rowindex": e.rowIndex,
580
- "data-editable": $(l).edit,
581
- contenteditable: C.value,
582
- tabindex: e.tabIndex,
583
- spellcheck: !1,
584
- style: he(E.value),
585
- class: te(["atable-cell", O.value]),
586
- onFocus: z,
587
- onPaste: Q,
588
- onInput: h[0] || (h[0] = //@ts-ignore
589
- (...m) => $(fe) && $(fe)(...m)),
590
- onClick: V
591
- }, [
592
- $(l).cellComponent ? (v(), ae(ye($(l).cellComponent), qe(ke({ key: 0 }, M.value)), null, 16)) : K.value ? (v(), ae(ye("ABadge"), ke({ key: 1 }, K.value, { presentation: "cell-fill" }), null, 16)) : j.value ? (v(), ae(ye("ABadge"), qe(ke({ key: 2 }, j.value)), null, 16)) : L.value ? (v(), w("span", {
593
- key: 3,
594
- innerHTML: B.value
595
- }, null, 8, Bt)) : (v(), w("span", Ht, ue(B.value), 1))
596
- ], 46, At));
597
- }
598
- }), Et = ["colspan"], Nt = {
599
- ref: "container",
600
- class: "gantt-container"
601
- }, Zt = ["data-rowindex", "data-colindex"], Ft = {
602
- key: 2,
603
- class: "gantt-label"
604
- }, Lt = ["x1", "y1", "x2", "y2"], Ot = /* @__PURE__ */ ge({
605
- __name: "AGanttCell",
606
- props: {
607
- store: {},
608
- columnsCount: {},
609
- rowIndex: {},
610
- colIndex: {},
611
- start: { default: 0 },
612
- end: { default: 0 },
613
- colspan: { default: 1 },
614
- label: { default: "" },
615
- color: { default: "#cccccc" }
616
- },
617
- emits: ["connection:create"],
618
- setup(e, { expose: a, emit: i }) {
619
- ct((I) => ({
620
- v564d6da1: x.value,
621
- v4f540c19: I.colspan
622
- }));
623
- const g = i, x = F(e.color.length >= 6 ? e.color : "#cccccc"), s = `gantt-bar-row-${e.rowIndex}-col-${e.colIndex}`, l = re("container"), r = re("bar"), f = re("leftResizeHandle"), n = re("rightResizeHandle"), d = re("leftConnectionHandle"), u = re("rightConnectionHandle"), { width: B } = be(l), { left: K, right: j } = be(r), b = F(e.start), C = F(e.end || b.value + e.colspan), M = F(!1), L = F(!1), E = F(!1), O = F(!1), V = F(!1), W = F({ startX: 0, startY: 0, endX: 0, endY: 0 }), H = y(() => h.value || fe.value || D.value), z = y(() => e.colspan > 0 ? B.value / e.colspan : 0), ce = y(() => {
624
- const I = b.value / e.colspan * 100, N = C.value / e.colspan * 100;
625
- return {
626
- left: `${I}%`,
627
- width: `${N - I}%`,
628
- backgroundColor: x.value
629
- };
630
- }), we = y(() => ({
631
- position: "fixed",
632
- top: 0,
633
- left: 0,
634
- width: "100vw",
635
- height: "100vh",
636
- pointerEvents: "none",
637
- zIndex: 1e3
638
- })), Q = F({ startX: 0, startPos: 0 }), { isDragging: fe } = Le(f, {
639
- axis: "x",
640
- onStart: () => m(K.value, b.value),
641
- onMove: ({ x: I }) => Z(I),
642
- onEnd: ({ x: I }) => R(I)
643
- }), { isDragging: D } = Le(n, {
644
- axis: "x",
645
- onStart: () => m(j.value, C.value),
646
- onMove: ({ x: I }) => k(I),
647
- onEnd: ({ x: I }) => q(I)
648
- }), { isDragging: h } = Le(r, {
649
- exact: !0,
650
- axis: "x",
651
- onStart: () => m(K.value, b.value),
652
- onMove: ({ x: I }) => _(I),
653
- onEnd: ({ x: I }) => se(I)
654
- });
655
- ze(() => {
656
- Me();
657
- }), dt(() => {
658
- Te();
659
- });
660
- function m(I, N) {
661
- r.value && (r.value.style.transition = "none"), Q.value = { startX: I, startPos: N };
662
- }
663
- function Z(I) {
664
- if (!fe.value || !r.value) return;
665
- const Y = (I - Q.value.startX) / z.value, X = Math.max(0, Math.min(C.value - 1, Q.value.startPos + Y));
666
- r.value.style.left = `${X / e.colspan * 100}%`, r.value.style.width = `${(C.value - X) / e.colspan * 100}%`;
667
- }
668
- function R(I) {
669
- if (!r.value) return;
670
- const N = I - Q.value.startX, Y = Math.round(N / z.value), X = b.value, J = Math.max(0, Math.min(C.value - 1, Q.value.startPos + Y));
671
- b.value = J, e.store.updateGanttBar({
672
- rowIndex: e.rowIndex,
673
- colIndex: e.colIndex,
674
- type: "resize",
675
- edge: "start",
676
- oldStart: X,
677
- newStart: J,
678
- end: C.value,
679
- delta: Y,
680
- oldColspan: C.value - X,
681
- newColspan: C.value - J
682
- });
683
- }
684
- function k(I) {
685
- if (!D.value || !r.value) return;
686
- const Y = (I - Q.value.startX) / z.value, X = Math.max(b.value + 1, Math.min(e.columnsCount, Q.value.startPos + Y));
687
- r.value.style.width = `${(X - b.value) / e.colspan * 100}%`;
688
- }
689
- function q(I) {
690
- if (!r.value) return;
691
- const N = I - Q.value.startX, Y = Math.round(N / z.value), X = C.value, J = Math.max(b.value + 1, Math.min(e.columnsCount, Q.value.startPos + Y));
692
- C.value = J, e.store.updateGanttBar({
693
- rowIndex: e.rowIndex,
694
- colIndex: e.colIndex,
695
- type: "resize",
696
- edge: "end",
697
- oldEnd: X,
698
- newEnd: J,
699
- start: b.value,
700
- delta: Y,
701
- oldColspan: X - b.value,
702
- newColspan: J - b.value
703
- });
704
- }
705
- function _(I) {
706
- if (!h.value || !r.value) return;
707
- const Y = (I - Q.value.startX) / z.value, X = C.value - b.value, J = Math.max(0, Math.min(Q.value.startPos + Y, e.columnsCount - X));
708
- r.value.style.left = `${J / e.colspan * 100}%`;
709
- }
710
- function se(I) {
711
- if (!r.value) return;
712
- const N = I - Q.value.startX, Y = Math.round(N / z.value), X = C.value - b.value, J = b.value, ee = C.value;
713
- let le = Q.value.startPos + Y, ne = le + X;
714
- le < 0 ? (le = 0, ne = X) : ne > e.columnsCount && (ne = e.columnsCount, le = ne - X), b.value = le, C.value = ne, e.store.updateGanttBar({
715
- rowIndex: e.rowIndex,
716
- colIndex: e.colIndex,
717
- type: "bar",
718
- oldStart: J,
719
- oldEnd: ee,
720
- newStart: le,
721
- newEnd: ne,
722
- delta: Y,
723
- colspan: ne - le
724
- });
725
- }
726
- function Me() {
727
- const { x: I, y: N } = be(r), { x: Y, y: X } = be(d), { x: J, y: ee } = be(u);
728
- e.store.registerGanttBar({
729
- id: s,
730
- rowIndex: e.rowIndex,
731
- colIndex: e.colIndex,
732
- startIndex: b,
733
- endIndex: C,
734
- color: x,
735
- label: e.label,
736
- position: { x: I, y: N }
737
- }), e.store.isDependencyGraphEnabled && (e.store.registerConnectionHandle({
738
- id: `${s}-connection-left`,
739
- rowIndex: e.rowIndex,
740
- colIndex: e.colIndex,
741
- side: "left",
742
- position: { x: Y, y: X },
743
- visible: M,
744
- barId: s
745
- }), e.store.registerConnectionHandle({
746
- id: `${s}-connection-right`,
747
- rowIndex: e.rowIndex,
748
- colIndex: e.colIndex,
749
- side: "right",
750
- position: { x: J, y: ee },
751
- visible: L,
752
- barId: s
753
- }));
754
- }
755
- function Te() {
756
- e.store.unregisterGanttBar(s), e.store.isDependencyGraphEnabled && (e.store.unregisterConnectionHandle(`${s}-connection-left`), e.store.unregisterConnectionHandle(`${s}-connection-right`));
757
- }
758
- function Ee() {
759
- e.store.isDependencyGraphEnabled && (M.value = !0, L.value = !0);
760
- }
761
- function Re() {
762
- !E.value && !O.value && (M.value = !1, L.value = !1);
763
- }
764
- function $e(I, N) {
765
- N.preventDefault(), N.stopPropagation(), V.value = !0, I === "left" ? E.value = !0 : O.value = !0;
766
- const Y = I === "left" ? d.value : u.value;
767
- if (Y) {
768
- const ee = Y.getBoundingClientRect(), le = ee.left + ee.width / 2, ne = ee.top + ee.height / 2;
769
- W.value = { startX: le, startY: ne, endX: le, endY: ne };
770
- }
771
- const X = (ee) => {
772
- W.value.endX = ee.clientX, W.value.endY = ee.clientY;
773
- }, J = (ee) => {
774
- Ie(ee, I), Se(X, J);
775
- };
776
- document.addEventListener("mousemove", X), document.addEventListener("mouseup", J);
777
- }
778
- function Ie(I, N) {
779
- const X = document.elementFromPoint(I.clientX, I.clientY)?.closest(".connection-handle");
780
- if (X && X !== (N === "left" ? d.value : u.value)) {
781
- const J = X.closest(".gantt-bar");
782
- if (J) {
783
- const ee = parseInt(J.getAttribute("data-rowindex") || "0"), le = parseInt(J.getAttribute("data-colindex") || "0"), ne = X.classList.contains("left-connection-handle") ? "left" : "right", We = `gantt-bar-row-${ee}-col-${le}`, Ne = e.store.createConnection(
784
- `${s}-connection-${N}`,
785
- `${We}-connection-${ne}`
786
- );
787
- Ne && g("connection:create", Ne);
788
- }
789
- }
790
- }
791
- function Se(I, N) {
792
- V.value = !1, E.value = !1, O.value = !1, document.removeEventListener("mousemove", I), document.removeEventListener("mouseup", N), r.value?.matches(":hover") || Re();
793
- }
794
- return a({
795
- barStyle: ce,
796
- cleanupConnectionDrag: Se,
797
- currentEnd: C,
798
- handleConnectionDrop: Ie,
799
- isLeftConnectionDragging: E,
800
- isLeftConnectionVisible: M,
801
- isRightConnectionDragging: O,
802
- isRightConnectionVisible: L,
803
- showDragPreview: V
804
- }), (I, N) => (v(), w("td", {
805
- class: "aganttcell",
806
- colspan: e.colspan
807
- }, [
808
- T("div", Nt, [
809
- T("div", {
810
- ref: "bar",
811
- "data-rowindex": e.rowIndex,
812
- "data-colindex": e.colIndex,
813
- class: te(["gantt-bar", { "is-dragging": H.value }]),
814
- style: he(ce.value),
815
- onMouseenter: Ee,
816
- onMouseleave: Re
817
- }, [
818
- e.store.isDependencyGraphEnabled ? (v(), w("div", {
819
- key: 0,
820
- ref: "leftConnectionHandle",
821
- class: te(["connection-handle left-connection-handle", { visible: M.value, "is-dragging": E.value }]),
822
- onMousedown: N[0] || (N[0] = Ce((Y) => $e("left", Y), ["stop"]))
823
- }, [...N[2] || (N[2] = [
824
- T("div", { class: "connection-dot" }, null, -1)
825
- ])], 34)) : U("", !0),
826
- e.store.isDependencyGraphEnabled ? (v(), w("div", {
827
- key: 1,
828
- ref: "rightConnectionHandle",
829
- class: te(["connection-handle right-connection-handle", { visible: L.value, "is-dragging": O.value }]),
830
- onMousedown: N[1] || (N[1] = Ce((Y) => $e("right", Y), ["stop"]))
831
- }, [...N[3] || (N[3] = [
832
- T("div", { class: "connection-dot" }, null, -1)
833
- ])], 34)) : U("", !0),
834
- T("div", {
835
- ref: "leftResizeHandle",
836
- class: te(["resize-handle left-resize-handle", { "is-dragging": $(fe) }])
837
- }, [...N[4] || (N[4] = [
838
- T("div", { class: "handle-grip" }, null, -1),
839
- T("div", { class: "vertical-indicator left-indicator" }, null, -1)
840
- ])], 2),
841
- e.label ? (v(), w("label", Ft, ue(e.label), 1)) : U("", !0),
842
- T("div", {
843
- ref: "rightResizeHandle",
844
- class: te(["resize-handle right-resize-handle", { "is-dragging": $(D) }])
845
- }, [...N[5] || (N[5] = [
846
- T("div", { class: "handle-grip" }, null, -1),
847
- T("div", { class: "vertical-indicator right-indicator" }, null, -1)
848
- ])], 2)
849
- ], 46, Zt)
850
- ], 512),
851
- e.store.isDependencyGraphEnabled && V.value ? (v(), w("svg", {
852
- key: 0,
853
- style: he(we.value)
854
- }, [
855
- T("line", {
856
- x1: W.value.startX,
857
- y1: W.value.startY,
858
- x2: W.value.endX,
859
- y2: W.value.endY,
860
- stroke: "#2196f3",
861
- "stroke-width": "2",
862
- "stroke-dasharray": "5,5"
863
- }, null, 8, Lt)
864
- ], 4)) : U("", !0)
865
- ], 8, Et));
866
- }
867
- }), xe = (e, a) => {
868
- const i = e.__vccOpts || e;
869
- for (const [g, x] of a)
870
- i[g] = x;
871
- return i;
872
- }, Vt = /* @__PURE__ */ xe(Ot, [["__scopeId", "data-v-032ef6d9"]]), Pt = `<?xml version="1.0" encoding="UTF-8"?>
873
- <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
874
- <path d="M32,64C14.35,64,0,49.65,0,32S14.35,0,32,0s32,14.35,32,32-14.35,32-32,32ZM32,4c-15.44,0-28,12.56-28,28s12.56,28,28,28,28-12.56,28-28S47.44,4,32,4Z" style="fill: #000; stroke-width: 0px;"/>
875
- <polygon points="34 18 30 18 30 30 18 30 18 34 30 34 30 46 34 46 34 34 46 34 46 30 34 30 34 18" style="fill: #000; stroke-width: 0px;"/>
876
- </svg>
877
- `, zt = `<?xml version="1.0" encoding="UTF-8"?>
878
- <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
879
- <path d="M32,64C14.35,64,0,49.65,0,32S14.35,0,32,0s32,14.35,32,32-14.35,32-32,32ZM32,4c-15.44,0-28,12.56-28,28s12.56,28,28,28,28-12.56,28-28S47.44,4,32,4Z" style="fill: #000; stroke-width: 0px;"/>
880
- <polygon points="46.84 19.99 44.01 17.16 32 29.17 19.99 17.16 17.16 19.99 29.17 32 17.16 44.01 19.99 46.84 32 34.83 44.01 46.84 46.84 44.01 34.83 32 46.84 19.99" style="fill: #000; stroke-width: 0px;"/>
881
- </svg>`, Xt = `<?xml version="1.0" encoding="UTF-8"?>
882
- <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 70.67 70.67">
883
- <path d="M68.67,16.67h-14.67V2c0-1.1-.9-2-2-2H2C.9,0,0,.9,0,2v50c0,1.1.9,2,2,2h14.67v14.67c0,1.1.9,2,2,2h50c1.1,0,2-.9,2-2V18.67c0-1.1-.9-2-2-2ZM4,4h46v46H4V4ZM66.67,66.67H20.67v-12.67h31.33c1.1,0,2-.9,2-2v-31.33h12.67v46Z" style="fill: #000; stroke-width: 0px;"/>
884
- <polygon points="41 25 29 25 29 13 25 13 25 25 13 25 13 29 25 29 25 41 29 41 29 29 41 29 41 25" style="fill: #000; stroke-width: 0px;"/>
885
- </svg>`, Gt = `<?xml version="1.0" encoding="UTF-8"?>
886
- <svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 70.6 61.5">
887
- <path d="M68.6,45.8v13.7H2v-13.7h66.6M70.6,43.8H0v17.7h70.6v-17.7h0Z"/>
888
- <path d="M68.6,24.2v13.7H2v-13.7h66.6M70.6,22.2H0v17.7h70.6v-17.7h0Z"/>
889
- <g>
890
- <polygon points="70.6 2.5 68.6 2.5 68.6 2 68.1 2 68.1 0 70.6 0 70.6 2.5"/>
891
- <path d="M65.3,2h-2.9V0h2.9v2ZM59.6,2h-2.9V0h2.9v2ZM53.9,2h-2.9V0h2.9v2ZM48.2,2h-2.9V0h2.9v2ZM42.4,2h-2.9V0h2.9v2ZM36.7,2h-2.9V0h2.9v2ZM31,2h-2.9V0h2.9v2ZM25.3,2h-2.9V0h2.9v2ZM19.6,2h-2.9V0h2.9v2ZM13.9,2h-2.9V0h2.9v2ZM8.2,2h-2.9V0h2.9v2Z"/>
892
- <polygon points="2 2.5 0 2.5 0 0 2.5 0 2.5 2 2 2 2 2.5"/>
893
- <path d="M2,13.4H0v-2.7h2v2.7ZM2,8H0v-2.7h2v2.7Z"/>
894
- <polygon points="2.5 18.7 0 18.7 0 16.2 2 16.2 2 16.7 2.5 16.7 2.5 18.7"/>
895
- <path d="M65.3,18.7h-2.9v-2h2.9v2ZM59.6,18.7h-2.9v-2h2.9v2ZM53.9,18.7h-2.9v-2h2.9v2ZM48.2,18.7h-2.9v-2h2.9v2ZM42.4,18.7h-2.9v-2h2.9v2ZM36.7,18.7h-2.9v-2h2.9v2ZM31,18.7h-2.9v-2h2.9v2ZM25.3,18.7h-2.9v-2h2.9v2ZM19.6,18.7h-2.9v-2h2.9v2ZM13.9,18.7h-2.9v-2h2.9v2ZM8.2,18.7h-2.9v-2h2.9v2Z"/>
896
- <polygon points="70.6 18.7 68.1 18.7 68.1 16.7 68.6 16.7 68.6 16.2 70.6 16.2 70.6 18.7"/>
897
- <path d="M70.6,13.4h-2v-2.7h2v2.7ZM70.6,8h-2v-2.7h2v2.7Z"/>
898
- </g>
899
- </svg>`, jt = `<?xml version="1.0" encoding="UTF-8"?>
900
- <svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 70.6 61.5">
901
- <g>
902
- <polygon points="70.6 45.3 68.6 45.3 68.6 44.8 68.1 44.8 68.1 42.8 70.6 42.8 70.6 45.3"/>
903
- <path d="M65.3,44.8h-2.9v-2h2.9v2ZM59.6,44.8h-2.9v-2h2.9v2ZM53.9,44.8h-2.9v-2h2.9v2ZM48.2,44.8h-2.9v-2h2.9v2ZM42.4,44.8h-2.9v-2h2.9v2ZM36.7,44.8h-2.9v-2h2.9v2ZM31,44.8h-2.9v-2h2.9v2ZM25.3,44.8h-2.9v-2h2.9v2ZM19.6,44.8h-2.9v-2h2.9v2ZM13.9,44.8h-2.9v-2h2.9v2ZM8.2,44.8h-2.9v-2h2.9v2Z"/>
904
- <polygon points="2 45.3 0 45.3 0 42.8 2.5 42.8 2.5 44.8 2 44.8 2 45.3"/>
905
- <path d="M2,56.3H0v-2.7h2v2.7ZM2,50.8H0v-2.7h2v2.7Z"/>
906
- <polygon points="2.5 61.5 0 61.5 0 59 2 59 2 59.5 2.5 59.5 2.5 61.5"/>
907
- <path d="M65.3,61.5h-2.9v-2h2.9v2ZM59.6,61.5h-2.9v-2h2.9v2ZM53.9,61.5h-2.9v-2h2.9v2ZM48.2,61.5h-2.9v-2h2.9v2ZM42.4,61.5h-2.9v-2h2.9v2ZM36.7,61.5h-2.9v-2h2.9v2ZM31,61.5h-2.9v-2h2.9v2ZM25.3,61.5h-2.9v-2h2.9v2ZM19.6,61.5h-2.9v-2h2.9v2ZM13.9,61.5h-2.9v-2h2.9v2ZM8.2,61.5h-2.9v-2h2.9v2Z"/>
908
- <polygon points="70.6 61.5 68.1 61.5 68.1 59.5 68.6 59.5 68.6 59 70.6 59 70.6 61.5"/>
909
- <path d="M70.6,56.3h-2v-2.7h2v2.7ZM70.6,50.8h-2v-2.7h2v2.7Z"/>
910
- </g>
911
- <path d="M68.6,23.7v13.7H2v-13.7h66.6M70.6,21.7H0v17.7h70.6v-17.7h0Z"/>
912
- <path d="M68.6,2v13.7H2V2h66.6M70.6,0H0v17.7h70.6V0h0Z"/>
913
- </svg>`, Wt = `<?xml version="1.0" encoding="UTF-8"?>
914
- <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 70.67 70.64">
915
- <path d="M70.08,33.9l-9.75-9.75-2.83,2.83,6.33,6.33h-26.51V6.81l6.33,6.33,2.83-2.83L36.75.56c-.75-.75-2.08-.75-2.83,0l-9.75,9.75,2.83,2.83,6.33-6.33v26.5H6.83l6.33-6.33-2.83-2.83L.59,33.9c-.38.38-.59.88-.59,1.41s.21,1.04.59,1.41l9.75,9.75,2.83-2.83-6.33-6.33h26.5v26.51l-6.33-6.33-2.83,2.83,9.75,9.75c.38.38.88.59,1.41.59s1.04-.21,1.41-.59l9.75-9.75-2.83-2.83-6.33,6.33v-26.51h26.51l-6.33,6.33,2.83,2.83,9.75-9.75c.38-.38.59-.88.59-1.41s-.21-1.04-.59-1.41Z" style="fill: #000; stroke-width: 0px;"/>
916
- </svg>`, Ut = `<?xml version="1.0" encoding="UTF-8"?>
917
- <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
918
- <path d="M32,64C14.35,64,0,49.65,0,32S14.35,0,32,0s32,14.35,32,32-14.35,32-32,32ZM32,4c-15.44,0-28,12.56-28,28s12.56,28,28,28,28-12.56,28-28S47.44,4,32,4Z" style="fill: #000; stroke-width: 0px;"/>
919
- <polygon points="18,20 18,44 46,32" style="fill: #000; stroke-width: 0px;"/>
920
- </svg>
921
- `, Yt = '<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M8 13V3.5M4.5 7 8 3.5 11.5 7" stroke-linecap="round" stroke-linejoin="round"/></svg>', qt = '<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M8 3v9.5M4.5 9 8 12.5 11.5 9" stroke-linecap="round" stroke-linejoin="round"/></svg>', Jt = {
922
- add: Pt,
923
- delete: zt,
924
- duplicate: Xt,
925
- insertAbove: Gt,
926
- insertBelow: jt,
927
- move: Wt,
928
- moveUp: Yt,
929
- moveDown: qt,
930
- open: Ut
931
- }, Kt = {
932
- key: 0,
933
- class: "row-actions-dropdown"
934
- }, Qt = ["aria-expanded"], _t = ["disabled", "onClick"], en = ["innerHTML"], tn = { class: "action-label" }, nn = {
935
- key: 1,
936
- class: "row-actions-icons"
937
- }, on = ["title", "aria-label", "disabled", "onClick"], ln = ["innerHTML"], Ae = /* @__PURE__ */ ge({
938
- __name: "ARowActions",
939
- props: {
940
- rowIndex: {},
941
- store: {},
942
- config: {},
943
- position: {}
944
- },
945
- emits: ["action"],
946
- setup(e, { emit: a }) {
947
- const i = e, g = a, x = re("actionsCell"), s = re("toggleButton"), l = F(0), r = F(!1), f = F(!1), n = F({ top: 0, left: 0 }), d = {
948
- add: "Add Record",
949
- delete: "Delete Record",
950
- duplicate: "Duplicate Record",
951
- insertAbove: "Insert Above",
952
- insertBelow: "Insert Below",
953
- move: "Move Record",
954
- moveUp: "Move Up",
955
- moveDown: "Move Down",
956
- open: "Open Record"
957
- }, u = y(() => {
958
- const M = [], L = i.config.actions || {}, E = [
959
- "open",
960
- "moveUp",
961
- "moveDown",
962
- "duplicate",
963
- "insertAbove",
964
- "insertBelow",
965
- "add",
966
- "delete",
967
- "move"
968
- ];
969
- for (const O of E) {
970
- const V = L[O];
971
- if (V === !1 || V === void 0) continue;
972
- let W = !0, H = d[O], z = Jt[O], ce = !1;
973
- typeof V == "object" && (W = V.enabled !== !1, H = V.label || H, z = V.icon || z, V.disabled && (ce = V.disabled(i.rowIndex, i.store))), W && M.push({ type: O, label: H, icon: z, disabled: ce });
974
- }
975
- return M;
976
- }), B = y(() => {
977
- if (i.config.forceDropdown) return !0;
978
- const M = i.config.dropdownThreshold ?? 150;
979
- return M === 0 ? !1 : l.value > 0 && l.value < M;
980
- }), K = y(() => r.value ? f.value ? {
981
- position: "fixed",
982
- bottom: `${window.innerHeight - n.value.top}px`,
983
- left: `${n.value.left}px`,
984
- top: "auto"
985
- } : {
986
- position: "fixed",
987
- top: `${n.value.top}px`,
988
- left: `${n.value.left}px`
989
- } : {});
990
- wt(x, (M) => {
991
- const L = M[0];
992
- L && (l.value = L.contentRect.width);
993
- });
994
- const j = () => {
995
- r.value || b(), r.value = !r.value;
996
- }, b = () => {
997
- if (!s.value) return;
998
- const M = s.value.getBoundingClientRect(), L = window.innerHeight, E = window.innerWidth, O = u.value.length * 40 + 16, V = 160, W = L - M.bottom, H = M.top;
999
- f.value = W < O && H > O;
1000
- let z = M.left;
1001
- z + V > E && (z = Math.max(0, M.right - V)), n.value = {
1002
- top: f.value ? M.top : M.bottom,
1003
- left: z
1004
- };
1005
- };
1006
- xt(x, () => {
1007
- r.value = !1;
1008
- });
1009
- const C = (M, L) => {
1010
- r.value = !1;
1011
- const E = i.config.actions?.[M];
1012
- typeof E == "object" && E.handler && E.handler(i.rowIndex, i.store) === !1 || g("action", M, i.rowIndex, L);
1013
- };
1014
- return (M, L) => (v(), w("td", {
1015
- ref: "actionsCell",
1016
- class: te(["atable-row-actions", { "sticky-column": e.position === "before-index", "dropdown-active": r.value }])
1017
- }, [
1018
- B.value ? (v(), w("div", Kt, [
1019
- T("button", {
1020
- ref: "toggleButton",
1021
- type: "button",
1022
- class: "row-actions-toggle",
1023
- "aria-expanded": r.value,
1024
- "aria-haspopup": "true",
1025
- onClick: Ce(j, ["stop"])
1026
- }, [...L[0] || (L[0] = [
1027
- T("span", { class: "dropdown-icon" }, "⋮", -1)
1028
- ])], 8, Qt),
1029
- ie(T("div", {
1030
- class: te(["row-actions-menu", { "menu-flipped": f.value }]),
1031
- style: he(K.value),
1032
- role: "menu"
1033
- }, [
1034
- (v(!0), w(ve, null, me(u.value, (E) => (v(), w("button", {
1035
- key: E.type,
1036
- type: "button",
1037
- class: "row-action-menu-item",
1038
- role: "menuitem",
1039
- disabled: E.disabled,
1040
- onClick: Ce((O) => C(E.type, O), ["stop"])
1041
- }, [
1042
- T("span", {
1043
- class: "action-icon",
1044
- innerHTML: E.icon
1045
- }, null, 8, en),
1046
- T("span", tn, ue(E.label), 1)
1047
- ], 8, _t))), 128))
1048
- ], 6), [
1049
- [Ge, r.value]
1050
- ])
1051
- ])) : (v(), w("div", nn, [
1052
- (v(!0), w(ve, null, me(u.value, (E) => (v(), w("button", {
1053
- key: E.type,
1054
- type: "button",
1055
- class: "row-action-btn",
1056
- title: E.label,
1057
- "aria-label": E.label,
1058
- disabled: E.disabled,
1059
- onClick: Ce((O) => C(E.type, O), ["stop"])
1060
- }, [
1061
- T("span", {
1062
- class: "action-icon",
1063
- innerHTML: E.icon
1064
- }, null, 8, ln)
1065
- ], 8, on))), 128))
1066
- ]))
1067
- ], 2));
1068
- }
1069
- }), an = ["tabindex"], sn = ["tabindex"], rn = ["colspan"], cn = /* @__PURE__ */ ge({
1070
- __name: "ARow",
1071
- props: {
1072
- rowIndex: {},
1073
- store: {},
1074
- tabIndex: { default: () => -1 },
1075
- addNavigation: { type: [Boolean, Object], default: !1 }
1076
- },
1077
- emits: ["row:action", "row:click"],
1078
- setup(e, { emit: a }) {
1079
- const i = a, g = re("rowEl"), x = y(() => e.store.isRowVisible(e.rowIndex)), s = y(() => e.store.getRowExpandSymbol(e.rowIndex)), l = y(() => e.store.config.clickable ?? !1), r = y(() => e.store.config.rowActions || { enabled: !1 }), f = y(() => r.value.enabled), n = y(() => r.value.position || "before-index"), d = y(() => e.store.config.view === "list-expansion" && !!e.store.display[e.rowIndex]?.expanded), u = y(() => {
1080
- const b = e.store.config.view === "uncounted" ? 0 : 1, C = f.value ? 1 : 0;
1081
- return e.store.columns.length + b + C;
1082
- }), B = (b, C, M) => {
1083
- i("row:action", b, C, M);
1084
- }, K = (b) => {
1085
- const C = b.target;
1086
- C.closest(".atable-row-actions") || C.closest(".tree-index") || C.closest(".expansion-index") || i("row:click", e.rowIndex, b);
1087
- }, j = e.store.config.view === "list-expansion";
1088
- if (e.addNavigation || j) {
1089
- let b = {};
1090
- e.addNavigation === !0 ? b = { ...Ve } : typeof e.addNavigation == "object" && (b = { ...Ve, ...e.addNavigation }), j && !b["keydown.control.g"] && (b["keydown.control.g"] = (C) => {
1091
- C.stopPropagation(), C.preventDefault(), e.store.toggleRowExpand(e.rowIndex);
1092
- }), tt([
1093
- {
1094
- selectors: g,
1095
- handlers: b
1096
- }
1097
- ]);
1098
- }
1099
- return (b, C) => (v(), w(ve, null, [
1100
- ie(T("tr", ke(b.$attrs, {
1101
- ref: "rowEl",
1102
- tabindex: e.tabIndex,
1103
- class: ["atable-row", { "atable-row-clickable": l.value }],
1104
- onClick: K
1105
- }), [
1106
- f.value && n.value === "before-index" ? (v(), ae(Ae, {
1107
- key: 0,
1108
- "row-index": e.rowIndex,
1109
- store: e.store,
1110
- config: r.value,
1111
- position: n.value,
1112
- onAction: B
1113
- }, null, 8, ["row-index", "store", "config", "position"])) : U("", !0),
1114
- e.store.config.view !== "uncounted" ? de(b.$slots, "index", {}, () => [
1115
- e.store.config.view === "list" ? (v(), w("td", {
1116
- key: 0,
1117
- tabIndex: -1,
1118
- class: te(["list-index", e.store.hasPinnedColumns ? "sticky-index" : ""])
1119
- }, ue(e.rowIndex + 1), 3)) : e.store.isTreeView ? (v(), w("td", {
1120
- key: 1,
1121
- tabIndex: -1,
1122
- class: te(["tree-index", e.store.hasPinnedColumns ? "sticky-index" : ""]),
1123
- onClick: C[0] || (C[0] = (M) => e.store.toggleRowExpand(e.rowIndex))
1124
- }, ue(s.value), 3)) : e.store.config.view === "list-expansion" ? (v(), w("td", {
1125
- key: 2,
1126
- tabIndex: -1,
1127
- class: te(["expansion-index", e.store.hasPinnedColumns ? "sticky-index" : ""]),
1128
- onClick: C[1] || (C[1] = (M) => e.store.toggleRowExpand(e.rowIndex))
1129
- }, ue(s.value), 3)) : U("", !0)
1130
- ], !0, 1) : U("", !0),
1131
- f.value && n.value === "after-index" ? (v(), ae(Ae, {
1132
- key: 2,
1133
- "row-index": e.rowIndex,
1134
- store: e.store,
1135
- config: r.value,
1136
- position: n.value,
1137
- onAction: B
1138
- }, null, 8, ["row-index", "store", "config", "position"])) : U("", !0),
1139
- de(b.$slots, "default", {}, void 0, !0),
1140
- f.value && n.value === "end" ? (v(), ae(Ae, {
1141
- key: 3,
1142
- "row-index": e.rowIndex,
1143
- store: e.store,
1144
- config: r.value,
1145
- position: n.value,
1146
- onAction: B
1147
- }, null, 8, ["row-index", "store", "config", "position"])) : U("", !0)
1148
- ], 16, an), [
1149
- [Ge, x.value]
1150
- ]),
1151
- d.value ? (v(), w("tr", {
1152
- key: 0,
1153
- tabindex: e.tabIndex,
1154
- class: "atable-expanded-row"
1155
- }, [
1156
- T("td", {
1157
- tabIndex: -1,
1158
- colspan: u.value,
1159
- class: "atable-expanded-content"
1160
- }, [
1161
- de(b.$slots, "content", {
1162
- row: e.store.rows[e.rowIndex],
1163
- rowIndex: e.rowIndex,
1164
- store: e.store
1165
- }, void 0, !0)
1166
- ], 8, rn)
1167
- ], 8, sn)) : U("", !0)
1168
- ], 64));
1169
- }
1170
- }), at = /* @__PURE__ */ xe(cn, [["__scopeId", "data-v-f159cfbe"]]), dn = { class: "gantt-connection-overlay" }, un = {
1171
- class: "connection-svg",
1172
- style: {
1173
- position: "absolute",
1174
- top: 0,
1175
- left: 0,
1176
- width: "100%",
1177
- height: "100%",
1178
- pointerEvents: "none",
1179
- zIndex: 1
1180
- }
1181
- }, vn = ["d", "stroke-width", "onDblclick"], fn = ["id", "d", "stroke", "stroke-width", "onDblclick"], hn = 0.25, De = 16, gn = /* @__PURE__ */ ge({
1182
- __name: "AGanttConnection",
1183
- props: {
1184
- store: {}
1185
- },
1186
- emits: ["connection:delete"],
1187
- setup(e, { emit: a }) {
1188
- const i = a, g = y(() => e.store.connectionPaths.filter((l) => {
1189
- const r = e.store.ganttBars.find((n) => n.id === l.from.barId), f = e.store.ganttBars.find((n) => n.id === l.to.barId);
1190
- return r && f;
1191
- })), x = (l) => {
1192
- const r = e.store.connectionHandles.find(
1193
- (H) => H.barId === l.from.barId && H.side === l.from.side
1194
- ), f = e.store.connectionHandles.find(
1195
- (H) => H.barId === l.to.barId && H.side === l.to.side
1196
- );
1197
- if (!r || !f) return "";
1198
- const n = r.position.x + De / 2, d = r.position.y + De / 2, u = f.position.x + De / 2, B = f.position.y + De / 2, K = Math.abs(u - n), j = Math.max(K * hn, 50), b = n + (l.from.side === "left" ? -j : j), C = u + (l.to.side === "left" ? -j : j), M = { x: 0.5 * n + 0.5 * b, y: 0.5 * d + 0.5 * d }, L = { x: 0.5 * b + 0.5 * C, y: 0.5 * d + 0.5 * B }, E = { x: 0.5 * C + 0.5 * u, y: 0.5 * B + 0.5 * B }, O = { x: 0.5 * M.x + 0.5 * L.x, y: 0.5 * M.y + 0.5 * L.y }, V = { x: 0.5 * L.x + 0.5 * E.x, y: 0.5 * L.y + 0.5 * E.y }, W = { x: 0.5 * O.x + 0.5 * V.x, y: 0.5 * O.y + 0.5 * V.y };
1199
- return `M ${n} ${d} Q ${b} ${d}, ${W.x} ${W.y} Q ${C} ${B}, ${u} ${B}`;
1200
- }, s = (l) => {
1201
- e.store.deleteConnection(l.id) && i("connection:delete", l);
1202
- };
1203
- return (l, r) => (v(), w("div", dn, [
1204
- (v(), w("svg", un, [
1205
- r[0] || (r[0] = T("defs", null, [
1206
- T("path", {
1207
- id: "arrowhead",
1208
- d: "M 0 -7 L 20 0 L 0 7Z",
1209
- stroke: "black",
1210
- "stroke-width": "1",
1211
- fill: "currentColor"
1212
- }),
1213
- T("marker", {
1214
- id: "arrowhead-marker",
1215
- markerWidth: "10",
1216
- markerHeight: "7",
1217
- refX: "5",
1218
- refY: "3.5",
1219
- orient: "auto",
1220
- markerUnits: "strokeWidth"
1221
- }, [
1222
- T("polygon", {
1223
- points: "0 0, 10 3.5, 0 7",
1224
- fill: "currentColor"
1225
- })
1226
- ])
1227
- ], -1)),
1228
- (v(!0), w(ve, null, me(g.value, (f) => (v(), w("path", {
1229
- key: `${f.id}-hitbox`,
1230
- d: x(f),
1231
- stroke: "transparent",
1232
- "stroke-width": (f.style?.width || 2) + 10,
1233
- fill: "none",
1234
- class: "connection-hitbox",
1235
- onDblclick: (n) => s(f)
1236
- }, null, 40, vn))), 128)),
1237
- (v(!0), w(ve, null, me(g.value, (f) => (v(), w("path", {
1238
- id: f.id,
1239
- key: f.id,
1240
- d: x(f),
1241
- stroke: f.style?.color || "#666",
1242
- "stroke-width": f.style?.width || 2,
1243
- fill: "none",
1244
- "marker-mid": "url(#arrowhead-marker)",
1245
- class: "connection-path animated-path",
1246
- onDblclick: (n) => s(f)
1247
- }, null, 40, fn))), 128))
1248
- ]))
1249
- ]));
1250
- }
1251
- }), mn = /* @__PURE__ */ xe(gn, [["__scopeId", "data-v-d5929c98"]]), wn = { class: "column-filter" }, xn = {
1252
- key: 2,
1253
- class: "checkbox-filter"
1254
- }, bn = ["value"], yn = {
1255
- key: 5,
1256
- class: "date-range-filter"
1257
- }, Cn = /* @__PURE__ */ ge({
1258
- __name: "ATableColumnFilter",
1259
- props: {
1260
- column: {},
1261
- colIndex: {},
1262
- store: {}
1263
- },
1264
- setup(e) {
1265
- const a = F(""), i = ut({
1266
- startValue: "",
1267
- endValue: ""
1268
- }), g = y(() => je(e.column)), x = (n) => {
1269
- if (n.filterOptions) return n.filterOptions;
1270
- const d = /* @__PURE__ */ new Set();
1271
- return e.store.rows.forEach((u) => {
1272
- const B = u[n.name];
1273
- B != null && B !== "" && d.add(B);
1274
- }), Array.from(d).map((u) => ({
1275
- value: u,
1276
- label: String(u)
1277
- }));
1278
- }, s = y(() => !!(a.value || i.startValue || i.endValue)), l = (n) => {
1279
- !n && g.value !== "checkbox" ? (e.store.clearFilter(e.colIndex), a.value = "") : (a.value = n, e.store.setFilter(e.colIndex, { value: n }));
1280
- }, r = (n, d) => {
1281
- n === "start" ? i.startValue = d : i.endValue = d, !i.startValue && !i.endValue ? e.store.clearFilter(e.colIndex) : e.store.setFilter(e.colIndex, {
1282
- value: null,
1283
- startValue: i.startValue,
1284
- endValue: i.endValue
1285
- });
1286
- }, f = () => {
1287
- a.value = "", i.startValue = "", i.endValue = "", e.store.clearFilter(e.colIndex);
1288
- };
1289
- return (n, d) => (v(), w("div", wn, [
1290
- g.value === "text" ? ie((v(), w("input", {
1291
- key: 0,
1292
- "onUpdate:modelValue": d[0] || (d[0] = (u) => a.value = u),
1293
- type: "text",
1294
- class: "filter-input",
1295
- onInput: d[1] || (d[1] = (u) => l(a.value))
1296
- }, null, 544)), [
1297
- [pe, a.value]
1298
- ]) : g.value === "number" ? ie((v(), w("input", {
1299
- key: 1,
1300
- "onUpdate:modelValue": d[2] || (d[2] = (u) => a.value = u),
1301
- type: "number",
1302
- class: "filter-input",
1303
- onInput: d[3] || (d[3] = (u) => l(a.value))
1304
- }, null, 544)), [
1305
- [pe, a.value]
1306
- ]) : g.value === "checkbox" ? (v(), w("label", xn, [
1307
- ie(T("input", {
1308
- "onUpdate:modelValue": d[4] || (d[4] = (u) => a.value = u),
1309
- type: "checkbox",
1310
- class: "filter-checkbox",
1311
- onChange: d[5] || (d[5] = (u) => l(a.value))
1312
- }, null, 544), [
1313
- [vt, a.value]
1314
- ]),
1315
- T("span", null, ue(e.column.label), 1)
1316
- ])) : g.value === "select" ? ie((v(), w("select", {
1317
- key: 3,
1318
- "onUpdate:modelValue": d[6] || (d[6] = (u) => a.value = u),
1319
- class: "filter-select",
1320
- onChange: d[7] || (d[7] = (u) => l(a.value))
1321
- }, [
1322
- d[15] || (d[15] = T("option", { value: "" }, "All", -1)),
1323
- (v(!0), w(ve, null, me(x(e.column), (u) => (v(), w("option", {
1324
- key: u.value || u,
1325
- value: u.value || u
1326
- }, ue(u.label || u), 9, bn))), 128))
1327
- ], 544)), [
1328
- [ft, a.value]
1329
- ]) : g.value === "date" ? ie((v(), w("input", {
1330
- key: 4,
1331
- "onUpdate:modelValue": d[8] || (d[8] = (u) => a.value = u),
1332
- type: "date",
1333
- class: "filter-input",
1334
- onChange: d[9] || (d[9] = (u) => l(a.value))
1335
- }, null, 544)), [
1336
- [pe, a.value]
1337
- ]) : g.value === "dateRange" ? (v(), w("div", yn, [
1338
- ie(T("input", {
1339
- "onUpdate:modelValue": d[10] || (d[10] = (u) => i.startValue = u),
1340
- type: "date",
1341
- class: "filter-input",
1342
- onChange: d[11] || (d[11] = (u) => r("start", i.startValue))
1343
- }, null, 544), [
1344
- [pe, i.startValue]
1345
- ]),
1346
- d[16] || (d[16] = T("span", { class: "date-separator" }, "-", -1)),
1347
- ie(T("input", {
1348
- "onUpdate:modelValue": d[12] || (d[12] = (u) => i.endValue = u),
1349
- type: "date",
1350
- class: "filter-input",
1351
- onChange: d[13] || (d[13] = (u) => r("end", i.endValue))
1352
- }, null, 544), [
1353
- [pe, i.endValue]
1354
- ])
1355
- ])) : g.value === "component" && e.column.filterComponent ? (v(), ae(ye(e.column.filterComponent), {
1356
- key: 6,
1357
- value: a.value,
1358
- column: e.column,
1359
- "col-index": e.colIndex,
1360
- store: e.store,
1361
- "onUpdate:value": d[14] || (d[14] = (u) => l(u))
1362
- }, null, 40, ["value", "column", "col-index", "store"])) : U("", !0),
1363
- s.value ? (v(), w("button", {
1364
- key: 7,
1365
- class: "clear-btn",
1366
- title: "Clear",
1367
- onClick: f
1368
- }, "×")) : U("", !0)
1369
- ]));
1370
- }
1371
- }), pn = /* @__PURE__ */ xe(Cn, [["__scopeId", "data-v-f9c23db9"]]), kn = { key: 0 }, Mn = {
1372
- class: "atable-header-row",
1373
- tabindex: "-1"
1374
- }, Rn = {
1375
- key: 2,
1376
- class: "row-actions-header"
1377
- }, $n = ["data-colindex", "onClick"], In = {
1378
- key: 3,
1379
- class: "row-actions-header"
1380
- }, Sn = {
1381
- key: 0,
1382
- class: "atable-filters-row"
1383
- }, Dn = {
1384
- key: 2,
1385
- class: "row-actions-header"
1386
- }, An = {
1387
- key: 3,
1388
- class: "row-actions-header"
1389
- }, st = /* @__PURE__ */ ge({
1390
- __name: "ATableHeader",
1391
- props: {
1392
- columns: {},
1393
- store: {}
1394
- },
1395
- setup(e) {
1396
- const a = y(() => e.columns.filter((l) => l.filterable)), i = y(() => e.store.config.rowActions?.enabled ?? !1), g = y(() => e.store.config.rowActions?.position ?? "before-index"), x = (l) => e.store.sortByColumn(l), s = (l) => {
1397
- for (const r of l) {
1398
- if (r.borderBoxSize.length === 0) continue;
1399
- const n = r.borderBoxSize[0].inlineSize, d = Number(r.target.dataset.colindex), u = e.store.columns[d]?.width;
1400
- typeof u == "number" && u !== n && e.store.resizeColumn(d, n);
1401
- }
1402
- };
1403
- return (l, r) => e.columns.length ? (v(), w("thead", kn, [
1404
- T("tr", Mn, [
1405
- i.value && g.value === "before-index" ? (v(), w("th", {
1406
- key: 0,
1407
- class: te(["row-actions-header", { "sticky-column": g.value === "before-index" }])
1408
- }, null, 2)) : U("", !0),
1409
- e.store.zeroColumn ? (v(), w("th", {
1410
- key: 1,
1411
- id: "header-index",
1412
- class: te([[
1413
- e.store.hasPinnedColumns ? "sticky-index" : "",
1414
- e.store.isTreeView ? "tree-index" : "",
1415
- e.store.config.view === "list-expansion" ? "list-expansion-index" : ""
1416
- ], "list-index"])
1417
- }, null, 2)) : U("", !0),
1418
- i.value && g.value === "after-index" ? (v(), w("th", Rn)) : U("", !0),
1419
- (v(!0), w(ve, null, me(e.columns, (f, n) => ie((v(), w("th", {
1420
- key: f.name,
1421
- "data-colindex": n,
1422
- tabindex: "-1",
1423
- style: he(e.store.getHeaderCellStyle(f)),
1424
- class: te(`${f.pinned ? "sticky-column" : ""} ${f.sortable === !1 ? "" : "cursor-pointer"}`),
1425
- onClick: (d) => f.sortable !== !1 ? x(n) : void 0
1426
- }, [
1427
- de(l.$slots, "default", {}, () => [
1428
- ht(ue(f.label || String.fromCharCode(n + 97).toUpperCase()), 1)
1429
- ])
1430
- ], 14, $n)), [
1431
- [$(Ct), s]
1432
- ])), 128)),
1433
- i.value && g.value === "end" ? (v(), w("th", In)) : U("", !0)
1434
- ]),
1435
- a.value.length > 0 ? (v(), w("tr", Sn, [
1436
- i.value && g.value === "before-index" ? (v(), w("th", {
1437
- key: 0,
1438
- class: te(["row-actions-header", { "sticky-column": g.value === "before-index" }])
1439
- }, null, 2)) : U("", !0),
1440
- e.store.zeroColumn ? (v(), w("th", {
1441
- key: 1,
1442
- class: te([[
1443
- e.store.hasPinnedColumns ? "sticky-index" : "",
1444
- e.store.isTreeView ? "tree-index" : "",
1445
- e.store.config.view === "list-expansion" ? "list-expansion-index" : ""
1446
- ], "list-index"])
1447
- }, null, 2)) : U("", !0),
1448
- i.value && g.value === "after-index" ? (v(), w("th", Dn)) : U("", !0),
1449
- (v(!0), w(ve, null, me(e.columns, (f, n) => (v(), w("th", {
1450
- key: `filter-${f.name}`,
1451
- class: te(`${f.pinned ? "sticky-column" : ""}`),
1452
- style: he(e.store.getHeaderCellStyle(f))
1453
- }, [
1454
- f.filterable ? (v(), ae(pn, {
1455
- key: 0,
1456
- column: f,
1457
- "col-index": n,
1458
- store: e.store
1459
- }, null, 8, ["column", "col-index", "store"])) : U("", !0)
1460
- ], 6))), 128)),
1461
- i.value && g.value === "end" ? (v(), w("th", An)) : U("", !0)
1462
- ])) : U("", !0)
1463
- ])) : U("", !0);
1464
- }
1465
- }), it = /* @__PURE__ */ ge({
1466
- __name: "ATableModal",
1467
- props: {
1468
- store: {}
1469
- },
1470
- setup(e) {
1471
- const a = re("amodal"), { width: i, height: g } = be(a), x = y(() => {
1472
- if (!(e.store.modal.height && e.store.modal.width && e.store.modal.left && e.store.modal.bottom)) return {};
1473
- const s = e.store.modal.cell?.closest("table");
1474
- if (!s) return {};
1475
- const l = s.offsetHeight || 0, r = s.offsetWidth || 0;
1476
- let f = e.store.modal.cell?.offsetTop || 0;
1477
- const n = s.querySelector("thead")?.offsetHeight || 0;
1478
- f += n, f = f + g.value < l ? f : f - (g.value + e.store.modal.height);
1479
- let d = e.store.modal.cell?.offsetLeft || 0;
1480
- return d = d + i.value <= r ? d : d - (i.value - e.store.modal.width), {
1481
- left: `${d}px`,
1482
- top: `${f}px`
1483
- };
1484
- });
1485
- return (s, l) => (v(), w("div", {
1486
- ref: "amodal",
1487
- class: "amodal",
1488
- tabindex: "-1",
1489
- style: he(x.value),
1490
- onClick: l[0] || (l[0] = Ce(() => {
1491
- }, ["stop"])),
1492
- onInput: l[1] || (l[1] = Ce(() => {
1493
- }, ["stop"]))
1494
- }, [
1495
- de(s.$slots, "default")
1496
- ], 36));
1497
- }
1498
- }), Bn = {
1499
- key: 0,
1500
- class: "atable-pagination"
1501
- }, Hn = ["colspan"], Tn = {
1502
- key: 0,
1503
- class: "truncation-note"
1504
- }, En = {
1505
- key: 1,
1506
- class: "completion-note"
1507
- }, Nn = {
1508
- key: 2,
1509
- class: "atable-pagination-controls"
1510
- }, Zn = ["disabled"], Fn = ["disabled"], Ln = /* @__PURE__ */ ge({
1511
- __name: "ATablePaginationFooter",
1512
- props: {
1513
- columnCount: {},
1514
- showFooter: { type: Boolean },
1515
- hasMore: { type: Boolean },
1516
- hasPrev: { type: Boolean },
1517
- hasNext: { type: Boolean },
1518
- hasLocalNext: { type: Boolean },
1519
- hasEverHadMore: { type: Boolean },
1520
- loadedCount: {},
1521
- loading: { type: Boolean },
1522
- next: { type: Function },
1523
- prev: { type: Function }
1524
- },
1525
- setup(e) {
1526
- const a = e, i = y(() => !a.hasMore && a.hasEverHadMore), g = y(() => a.hasMore || a.hasPrev), x = () => {
1527
- a.next();
1528
- };
1529
- return (s, l) => e.showFooter ? (v(), w("tfoot", Bn, [
1530
- T("tr", null, [
1531
- T("td", { colspan: e.columnCount }, [
1532
- e.hasMore ? (v(), w("p", Tn, "This is a partial list — more records exist on the server.")) : i.value ? (v(), w("p", En, "All " + ue(e.loadedCount) + " records loaded.", 1)) : U("", !0),
1533
- g.value ? (v(), w("div", Nn, [
1534
- T("button", {
1535
- type: "button",
1536
- class: "atable-pagination-btn",
1537
- disabled: !e.hasPrev || e.loading,
1538
- onClick: l[0] || (l[0] = //@ts-ignore
1539
- (...r) => e.prev && e.prev(...r))
1540
- }, " Previous ", 8, Zn),
1541
- T("button", {
1542
- type: "button",
1543
- class: "atable-pagination-btn",
1544
- disabled: !e.hasNext || e.loading,
1545
- onClick: x
1546
- }, ue(e.hasMore && !e.hasLocalNext ? "Load more" : "Next"), 9, Fn)
1547
- ])) : U("", !0)
1548
- ], 8, Hn)
1549
- ])
1550
- ])) : U("", !0);
1551
- }
1552
- }), rt = /* @__PURE__ */ xe(Ln, [["__scopeId", "data-v-e0e73858"]]);
1553
- function On(e) {
1554
- const a = y(() => Ze(e.rows)), i = y(() => Ze(e.pageSize)), g = y(() => Ze(e.sourceKey)), x = F(0), s = F(!1), l = F(!1), r = F(!1), f = F(0), n = F(0), d = y(() => a.value.length), u = y(() => {
1555
- const H = i.value;
1556
- if (H != null && H > 0)
1557
- return H;
1558
- const z = a.value.length;
1559
- return z > 0 ? z : 1;
1560
- }), B = y(() => Math.max(1, Math.ceil(a.value.length / u.value))), K = y(() => {
1561
- const H = x.value * u.value;
1562
- return a.value.slice(H, H + u.value);
1563
- }), j = y(() => x.value < B.value - 1), b = y(() => x.value > 0), C = y(() => j.value || !!e.getRecords && l.value), M = y(() => l.value), L = y(() => {
1564
- if (e.getRecords)
1565
- return l.value || b.value || s.value || r.value && !l.value;
1566
- const H = i.value;
1567
- return H != null && H > 0 && a.value.length > H;
1568
- }), E = () => {
1569
- x.value = 0, r.value = !1;
1570
- }, O = async (H) => {
1571
- if (e.getRecords) {
1572
- s.value = !0;
1573
- try {
1574
- const z = await e.getRecords(H);
1575
- l.value = z.hasMore, z.hasMore && (r.value = !0), f.value = H?.offset ?? 0, n.value = z.data.length;
1576
- } finally {
1577
- s.value = !1;
1578
- }
1579
- }
1580
- };
1581
- return Be(
1582
- () => g.value,
1583
- () => {
1584
- E(), e.getRecords && O();
1585
- },
1586
- { immediate: !0 }
1587
- ), Be(a, () => {
1588
- x.value >= B.value && (x.value = Math.max(0, B.value - 1));
1589
- }), {
1590
- visibleRows: K,
1591
- hasPrev: b,
1592
- hasNext: C,
1593
- hasMore: M,
1594
- loading: s,
1595
- next: async () => {
1596
- if (j.value) {
1597
- x.value += 1;
1598
- return;
1599
- }
1600
- e.getRecords && l.value && (await O({ offset: f.value + n.value }), await Xe(), x.value = Math.max(0, B.value - 1));
1601
- },
1602
- prev: () => {
1603
- x.value > 0 && (x.value -= 1);
1604
- },
1605
- showFooter: L,
1606
- hasLocalNext: j,
1607
- loadedCount: d,
1608
- hasEverHadMore: r
1609
- };
175
+ /**
176
+ * Create a table store
177
+ * @param initData - Initial data for the table store
178
+ * @returns table store instance
179
+ * @public
180
+ */
181
+ var createTableStore = (initData) => {
182
+ const id = initData.id || generateHash();
183
+ const linkResolver = initData.linkResolver ?? null;
184
+ return defineStore(`table-${id}`, () => {
185
+ const createDisplayObject = () => {
186
+ const defaultDisplay = [Object.assign({}, { rowModified: false })];
187
+ const parents = /* @__PURE__ */ new Set();
188
+ for (let rowIndex = 0; rowIndex < rows.value.length; rowIndex++) {
189
+ const row = rows.value[rowIndex];
190
+ if (row.parent !== null && row.parent !== void 0) parents.add(row.parent);
191
+ }
192
+ const hasGanttData = (rowIndex) => {
193
+ return rows.value[rowIndex]?.gantt !== void 0;
194
+ };
195
+ const hasGanttDescendant = (rowIndex) => {
196
+ for (let i = 0; i < rows.value.length; i++) if (rows.value[i].parent === rowIndex) {
197
+ if (hasGanttData(i) || hasGanttDescendant(i)) return true;
198
+ }
199
+ return false;
200
+ };
201
+ const shouldChildrenBeOpen = (rowIndex) => {
202
+ const currentConfig = config.value;
203
+ const expansionMode = currentConfig.view === "tree" || currentConfig.view === "tree-gantt" ? currentConfig.defaultTreeExpansion : void 0;
204
+ if (!expansionMode) return true;
205
+ switch (expansionMode) {
206
+ case "root": return false;
207
+ case "branch": return hasGanttDescendant(rowIndex);
208
+ case "leaf": return true;
209
+ default: return true;
210
+ }
211
+ };
212
+ for (let rowIndex = 0; rowIndex < rows.value.length; rowIndex++) {
213
+ const row = rows.value[rowIndex];
214
+ const isRootNode = row.parent === null || row.parent === void 0;
215
+ const isParentNode = parents.has(rowIndex);
216
+ defaultDisplay[rowIndex] = {
217
+ childrenOpen: shouldChildrenBeOpen(rowIndex),
218
+ expanded: false,
219
+ indent: row.indent || 0,
220
+ isParent: isParentNode,
221
+ isRoot: isRootNode,
222
+ rowModified: false,
223
+ open: isRootNode,
224
+ parent: row.parent
225
+ };
226
+ }
227
+ return defaultDisplay;
228
+ };
229
+ const columns = ref(initData.columns);
230
+ const rows = ref(initData.rows);
231
+ const config = ref(initData.config || {});
232
+ const rowModifications = ref({});
233
+ const rowExpandStates = ref({});
234
+ const table = computed(() => {
235
+ const tableData = {};
236
+ for (const [colIndex, column] of columns.value.entries()) for (const [rowIndex, row] of rows.value.entries()) tableData[`${colIndex}:${rowIndex}`] = row[column.name];
237
+ return tableData;
238
+ });
239
+ const display = computed({
240
+ get: () => {
241
+ const baseDisplay = createDisplayObject();
242
+ for (let i = 0; i < baseDisplay.length; i++) {
243
+ if (rowModifications.value[i]) baseDisplay[i].rowModified = rowModifications.value[i];
244
+ if (rowExpandStates.value[i]) {
245
+ if (rowExpandStates.value[i].childrenOpen !== void 0) baseDisplay[i].childrenOpen = rowExpandStates.value[i].childrenOpen;
246
+ if (rowExpandStates.value[i].expanded !== void 0) baseDisplay[i].expanded = rowExpandStates.value[i].expanded;
247
+ }
248
+ }
249
+ if (isTreeView.value) {
250
+ for (let i = 0; i < baseDisplay.length; i++) if (!baseDisplay[i].isRoot) baseDisplay[i].open = isNodeOpen(i, baseDisplay);
251
+ }
252
+ return baseDisplay;
253
+ },
254
+ set: (newDisplay) => {
255
+ if (JSON.stringify(newDisplay) !== JSON.stringify(display.value)) display.value = newDisplay;
256
+ }
257
+ });
258
+ const modal = ref(initData.modal || { visible: false });
259
+ const updates = ref({});
260
+ const ganttBars = ref([]);
261
+ const connectionHandles = ref([]);
262
+ const connectionPaths = ref([]);
263
+ const sortState = ref({
264
+ column: null,
265
+ direction: null
266
+ });
267
+ const filterState = ref({});
268
+ const hasPinnedColumns = computed(() => columns.value.some((col) => col.pinned));
269
+ const isGanttView = computed(() => config.value.view === "gantt" || config.value.view === "tree-gantt");
270
+ const isTreeView = computed(() => config.value.view === "tree" || config.value.view === "tree-gantt");
271
+ const isDependencyGraphEnabled = computed(() => {
272
+ const currentConfig = config.value;
273
+ return currentConfig.view === "gantt" || currentConfig.view === "tree-gantt" ? currentConfig.dependencyGraph !== false : true;
274
+ });
275
+ const numberedRowWidth = computed(() => {
276
+ return `${Math.ceil(rows.value.length / 100 + 1)}ch`;
277
+ });
278
+ const zeroColumn = computed(() => config.value.view ? [
279
+ "list",
280
+ "tree",
281
+ "tree-gantt",
282
+ "list-expansion"
283
+ ].includes(config.value.view) : false);
284
+ const filteredRows = computed(() => {
285
+ let filtered = rows.value.map((row, originalIndex) => ({
286
+ ...row,
287
+ originalIndex
288
+ }));
289
+ Object.entries(filterState.value).forEach(([colIndexStr, filter]) => {
290
+ const colIndex = parseInt(colIndexStr);
291
+ const column = columns.value[colIndex];
292
+ if (!column) return;
293
+ if (!(filter.value || filter.startValue || filter.endValue || resolveFilterType(column) === "checkbox" && filter.value !== void 0)) return;
294
+ filtered = filtered.filter((row) => {
295
+ const cellValue = row[column.name];
296
+ return applyFilter(cellValue, filter, column);
297
+ });
298
+ });
299
+ if (sortState.value.column !== null && sortState.value.direction) {
300
+ const column = columns.value[sortState.value.column];
301
+ const direction = sortState.value.direction;
302
+ filtered.sort((a, b) => {
303
+ let aVal = a[column.name];
304
+ let bVal = b[column.name];
305
+ if (aVal === null || aVal === void 0) aVal = "";
306
+ if (bVal === null || bVal === void 0) bVal = "";
307
+ const aNum = toComparableNumber(aVal);
308
+ const bNum = toComparableNumber(bVal);
309
+ if (!isNaN(aNum) && !isNaN(bNum) && aVal !== "" && bVal !== "") return direction === "asc" ? aNum - bNum : bNum - aNum;
310
+ else {
311
+ const aStr = String(aVal).toLowerCase();
312
+ const bStr = String(bVal).toLowerCase();
313
+ return direction === "asc" ? aStr.localeCompare(bStr) : bStr.localeCompare(aStr);
314
+ }
315
+ });
316
+ }
317
+ return filtered;
318
+ });
319
+ const getCellData = (colIndex, rowIndex) => table.value[`${colIndex}:${rowIndex}`];
320
+ const setCellData = (colIndex, rowIndex, value) => {
321
+ const index = `${colIndex}:${rowIndex}`;
322
+ const col = columns.value[colIndex];
323
+ if (table.value[index] !== value) rowModifications.value[rowIndex] = true;
324
+ table.value[index] = value;
325
+ rows.value[rowIndex] = {
326
+ ...rows.value[rowIndex],
327
+ [col.name]: value
328
+ };
329
+ };
330
+ const updateRows = (newRows) => {
331
+ rows.value = newRows;
332
+ };
333
+ const setCellText = (colIndex, rowIndex, value) => {
334
+ const index = `${colIndex}:${rowIndex}`;
335
+ if (table.value[index] !== value) {
336
+ rowModifications.value[rowIndex] = true;
337
+ updates.value[index] = value;
338
+ }
339
+ };
340
+ const getHeaderCellStyle = (column) => {
341
+ const isLastCol = columns.value.indexOf(column) === columns.value.length - 1;
342
+ const isResizable = config.value.fullWidth ? column.resizable && !isLastCol : column.resizable;
343
+ return {
344
+ width: column.width || "40ch",
345
+ textAlign: column.align || "center",
346
+ ...isResizable && {
347
+ resize: "horizontal",
348
+ overflow: "hidden",
349
+ whiteSpace: "nowrap"
350
+ }
351
+ };
352
+ };
353
+ const resizeColumn = (colIndex, newWidth) => {
354
+ if (colIndex < 0 || colIndex >= columns.value.length) return;
355
+ const finalWidth = Math.max(newWidth, 40);
356
+ columns.value[colIndex] = {
357
+ ...columns.value[colIndex],
358
+ width: `${finalWidth}px`
359
+ };
360
+ };
361
+ const isRowGantt = (rowIndex) => {
362
+ const row = rows.value[rowIndex];
363
+ return isGanttView.value && row.gantt !== void 0;
364
+ };
365
+ const isRowVisible = (rowIndex) => {
366
+ return !isTreeView.value || display.value[rowIndex].isRoot || display.value[rowIndex].open;
367
+ };
368
+ const getRowExpandSymbol = (rowIndex) => {
369
+ if (!isTreeView.value && config.value.view !== "list-expansion") return "";
370
+ if (isTreeView.value && (display.value[rowIndex].isRoot || display.value[rowIndex].isParent)) return display.value[rowIndex].childrenOpen ? "▼" : "►";
371
+ if (config.value.view === "list-expansion") return display.value[rowIndex].expanded ? "▼" : "►";
372
+ return "";
373
+ };
374
+ const toggleRowExpand = (rowIndex) => {
375
+ if (isTreeView.value) {
376
+ const currentState = rowExpandStates.value[rowIndex] || {};
377
+ const newChildrenOpen = !(currentState.childrenOpen ?? display.value[rowIndex].childrenOpen);
378
+ rowExpandStates.value[rowIndex] = {
379
+ ...currentState,
380
+ childrenOpen: newChildrenOpen
381
+ };
382
+ if (!newChildrenOpen) closeDescendants(rowIndex);
383
+ } else if (config.value.view === "list-expansion") {
384
+ const currentState = rowExpandStates.value[rowIndex] || {};
385
+ const currentExpanded = currentState.expanded ?? display.value[rowIndex].expanded;
386
+ rowExpandStates.value[rowIndex] = {
387
+ ...currentState,
388
+ expanded: !currentExpanded
389
+ };
390
+ }
391
+ };
392
+ const closeDescendants = (parentRowIndex) => {
393
+ for (let index = 0; index < rows.value.length; index++) if (display.value[index].parent === parentRowIndex) {
394
+ const childState = rowExpandStates.value[index] || {};
395
+ rowExpandStates.value[index] = {
396
+ ...childState,
397
+ childrenOpen: false
398
+ };
399
+ closeDescendants(index);
400
+ }
401
+ };
402
+ const getCellDisplayValue = (colIndex, rowIndex) => {
403
+ const cellData = getCellData(colIndex, rowIndex);
404
+ return getFormattedValue(colIndex, rowIndex, cellData);
405
+ };
406
+ const getFormattedValue = (colIndex, rowIndex, value) => {
407
+ const column = columns.value[colIndex];
408
+ const row = rows.value[rowIndex];
409
+ const format = column.format;
410
+ if (!format) {
411
+ const category = componentCategory(column.component);
412
+ if (category === "boolean") return value ? "✓" : "✗";
413
+ if (category === "date") return value != null ? new Date(String(value)).toLocaleDateString() : value;
414
+ if (category === "datetime") return value != null ? new Date(String(value)).toLocaleString() : value;
415
+ if (category === "quantity") return formatQuantity(value);
416
+ if (category === "currency") return formatCurrency(value);
417
+ return value;
418
+ }
419
+ if (typeof format === "function") return format(value, {
420
+ table: table.value,
421
+ row,
422
+ column
423
+ });
424
+ else if (typeof format === "string") return Function(`"use strict";return (${format})`)()(value, {
425
+ table: table.value,
426
+ row,
427
+ column
428
+ });
429
+ return value;
430
+ };
431
+ const closeModal = (event) => {
432
+ if (!(event.target instanceof Node)) {
433
+ if (modal.value.visible) modal.value.visible = false;
434
+ } else if (!modal.value.parent?.contains(event.target)) {
435
+ if (modal.value.visible) modal.value.visible = false;
436
+ }
437
+ };
438
+ const updateGanttBar = (event) => {
439
+ const ganttBar = rows.value[event.rowIndex]?.gantt;
440
+ if (ganttBar) {
441
+ if (event.type === "resize") {
442
+ if (event.edge === "start") {
443
+ ganttBar.startIndex = event.newStart;
444
+ ganttBar.endIndex = event.end;
445
+ ganttBar.colspan = ganttBar.endIndex - ganttBar.startIndex;
446
+ } else if (event.edge === "end") {
447
+ ganttBar.startIndex = event.start;
448
+ ganttBar.endIndex = event.newEnd;
449
+ ganttBar.colspan = ganttBar.endIndex - ganttBar.startIndex;
450
+ }
451
+ } else if (event.type === "bar") {
452
+ ganttBar.startIndex = event.newStart;
453
+ ganttBar.endIndex = event.newEnd;
454
+ ganttBar.colspan = ganttBar.endIndex - ganttBar.startIndex;
455
+ }
456
+ }
457
+ };
458
+ const registerGanttBar = (barInfo) => {
459
+ const existingIndex = ganttBars.value.findIndex((bar) => bar.id === barInfo.id);
460
+ if (existingIndex >= 0) ganttBars.value[existingIndex] = barInfo;
461
+ else ganttBars.value.push(barInfo);
462
+ };
463
+ const unregisterGanttBar = (barId) => {
464
+ const index = ganttBars.value.findIndex((bar) => bar.id === barId);
465
+ if (index >= 0) ganttBars.value.splice(index, 1);
466
+ };
467
+ const registerConnectionHandle = (handleInfo) => {
468
+ const existingIndex = connectionHandles.value.findIndex((handle) => handle.id === handleInfo.id);
469
+ if (existingIndex >= 0) connectionHandles.value[existingIndex] = handleInfo;
470
+ else connectionHandles.value.push(handleInfo);
471
+ };
472
+ const unregisterConnectionHandle = (handleId) => {
473
+ const index = connectionHandles.value.findIndex((handle) => handle.id === handleId);
474
+ if (index >= 0) connectionHandles.value.splice(index, 1);
475
+ };
476
+ const createConnection = (fromHandleId, toHandleId, options) => {
477
+ const fromHandle = connectionHandles.value.find((h) => h.id === fromHandleId);
478
+ const toHandle = connectionHandles.value.find((h) => h.id === toHandleId);
479
+ if (!fromHandle || !toHandle) {
480
+ console.warn("Cannot create connection: handle not found");
481
+ return null;
482
+ }
483
+ const connection = {
484
+ id: `connection-${fromHandleId}-${toHandleId}`,
485
+ from: {
486
+ barId: fromHandle.barId,
487
+ side: fromHandle.side
488
+ },
489
+ to: {
490
+ barId: toHandle.barId,
491
+ side: toHandle.side
492
+ },
493
+ style: options?.style,
494
+ label: options?.label
495
+ };
496
+ connectionPaths.value.push(connection);
497
+ return connection;
498
+ };
499
+ const deleteConnection = (connectionId) => {
500
+ const index = connectionPaths.value.findIndex((conn) => conn.id === connectionId);
501
+ if (index >= 0) {
502
+ connectionPaths.value.splice(index, 1);
503
+ return true;
504
+ }
505
+ return false;
506
+ };
507
+ const getConnectionsForBar = (barId) => {
508
+ return connectionPaths.value.filter((conn) => conn.from.barId === barId || conn.to.barId === barId);
509
+ };
510
+ const getHandlesForBar = (barId) => {
511
+ return connectionHandles.value.filter((handle) => handle.barId === barId);
512
+ };
513
+ const sortByColumn = (colIndex) => {
514
+ if (columns.value[colIndex].sortable === false) return;
515
+ let newDirection;
516
+ if (sortState.value.column === colIndex) {
517
+ if (sortState.value.direction === "asc") newDirection = "desc";
518
+ else newDirection = "asc";
519
+ } else newDirection = "asc";
520
+ sortState.value.column = colIndex;
521
+ sortState.value.direction = newDirection;
522
+ };
523
+ const setFilter = (colIndex, filter) => {
524
+ if (!filter.value && !filter.startValue && !filter.endValue) delete filterState.value[colIndex];
525
+ else filterState.value[colIndex] = filter;
526
+ };
527
+ const clearFilter = (colIndex) => {
528
+ delete filterState.value[colIndex];
529
+ };
530
+ /**
531
+ * Add a new row to the table.
532
+ * @param rowData - Optional partial row data to initialize the new row with
533
+ * @param position - Where to insert the row: 'start', 'end', or a specific index
534
+ * @returns The index of the newly added row
535
+ */
536
+ const addRow = (rowData, position = "end") => {
537
+ const newRow = {};
538
+ for (const column of columns.value) newRow[column.name] = "";
539
+ if (rowData) Object.assign(newRow, rowData);
540
+ let insertIndex;
541
+ if (position === "start") {
542
+ insertIndex = 0;
543
+ rows.value.unshift(newRow);
544
+ } else if (position === "end") {
545
+ insertIndex = rows.value.length;
546
+ rows.value.push(newRow);
547
+ } else {
548
+ insertIndex = Math.max(0, Math.min(position, rows.value.length));
549
+ rows.value.splice(insertIndex, 0, newRow);
550
+ }
551
+ return insertIndex;
552
+ };
553
+ /**
554
+ * Delete a row from the table.
555
+ * @param rowIndex - The index of the row to delete
556
+ * @returns The deleted row, or null if the index was invalid
557
+ */
558
+ const deleteRow = (rowIndex) => {
559
+ if (rowIndex < 0 || rowIndex >= rows.value.length) return null;
560
+ const [deletedRow] = rows.value.splice(rowIndex, 1);
561
+ delete rowModifications.value[rowIndex];
562
+ delete rowExpandStates.value[rowIndex];
563
+ const newModifications = {};
564
+ const newExpandStates = {};
565
+ for (const [key, value] of Object.entries(rowModifications.value)) {
566
+ const idx = parseInt(key);
567
+ if (idx > rowIndex) newModifications[idx - 1] = value;
568
+ else newModifications[idx] = value;
569
+ }
570
+ for (const [key, value] of Object.entries(rowExpandStates.value)) {
571
+ const idx = parseInt(key);
572
+ if (idx > rowIndex) newExpandStates[idx - 1] = value;
573
+ else newExpandStates[idx] = value;
574
+ }
575
+ rowModifications.value = newModifications;
576
+ rowExpandStates.value = newExpandStates;
577
+ return deletedRow;
578
+ };
579
+ /**
580
+ * Duplicate a row in the table.
581
+ * @param rowIndex - The index of the row to duplicate
582
+ * @returns The index of the new duplicated row, or -1 if the index was invalid
583
+ */
584
+ const duplicateRow = (rowIndex) => {
585
+ if (rowIndex < 0 || rowIndex >= rows.value.length) return -1;
586
+ const originalRow = rows.value[rowIndex];
587
+ const duplicatedRow = JSON.parse(JSON.stringify(originalRow));
588
+ const newIndex = rowIndex + 1;
589
+ rows.value.splice(newIndex, 0, duplicatedRow);
590
+ return newIndex;
591
+ };
592
+ /**
593
+ * Insert a new row above the specified row.
594
+ * @param rowIndex - The index of the row to insert above
595
+ * @param rowData - Optional partial row data to initialize the new row with
596
+ * @returns The index of the newly inserted row
597
+ */
598
+ const insertRowAbove = (rowIndex, rowData) => {
599
+ return addRow(rowData, Math.max(0, rowIndex));
600
+ };
601
+ /**
602
+ * Insert a new row below the specified row.
603
+ * @param rowIndex - The index of the row to insert below
604
+ * @param rowData - Optional partial row data to initialize the new row with
605
+ * @returns The index of the newly inserted row
606
+ */
607
+ const insertRowBelow = (rowIndex, rowData) => {
608
+ const insertIndex = Math.min(rowIndex + 1, rows.value.length);
609
+ return addRow(rowData, insertIndex);
610
+ };
611
+ /**
612
+ * Move a row from one position to another.
613
+ * @param fromIndex - The current index of the row to move
614
+ * @param toIndex - The target index to move the row to
615
+ * @returns true if the move was successful, false otherwise
616
+ */
617
+ const moveRow = (fromIndex, toIndex) => {
618
+ if (fromIndex < 0 || fromIndex >= rows.value.length || toIndex < 0 || toIndex >= rows.value.length || fromIndex === toIndex) return false;
619
+ const [movedRow] = rows.value.splice(fromIndex, 1);
620
+ rows.value.splice(toIndex, 0, movedRow);
621
+ const newModifications = {};
622
+ const newExpandStates = {};
623
+ for (const [key, value] of Object.entries(rowModifications.value)) {
624
+ const idx = parseInt(key);
625
+ let newIdx = idx;
626
+ if (idx === fromIndex) newIdx = toIndex;
627
+ else if (fromIndex < toIndex) {
628
+ if (idx > fromIndex && idx <= toIndex) newIdx = idx - 1;
629
+ } else if (idx >= toIndex && idx < fromIndex) newIdx = idx + 1;
630
+ newModifications[newIdx] = value;
631
+ }
632
+ for (const [key, value] of Object.entries(rowExpandStates.value)) {
633
+ const idx = parseInt(key);
634
+ let newIdx = idx;
635
+ if (idx === fromIndex) newIdx = toIndex;
636
+ else if (fromIndex < toIndex) {
637
+ if (idx > fromIndex && idx <= toIndex) newIdx = idx - 1;
638
+ } else if (idx >= toIndex && idx < fromIndex) newIdx = idx + 1;
639
+ newExpandStates[newIdx] = value;
640
+ }
641
+ rowModifications.value = newModifications;
642
+ rowExpandStates.value = newExpandStates;
643
+ return true;
644
+ };
645
+ return {
646
+ columns,
647
+ config,
648
+ connectionHandles,
649
+ connectionPaths,
650
+ display,
651
+ filterState,
652
+ ganttBars,
653
+ modal,
654
+ rows,
655
+ sortState,
656
+ table,
657
+ updates,
658
+ filteredRows,
659
+ hasPinnedColumns,
660
+ isGanttView,
661
+ isTreeView,
662
+ isDependencyGraphEnabled,
663
+ numberedRowWidth,
664
+ zeroColumn,
665
+ linkResolver,
666
+ addRow,
667
+ clearFilter,
668
+ closeModal,
669
+ createConnection,
670
+ deleteConnection,
671
+ deleteRow,
672
+ duplicateRow,
673
+ getCellData,
674
+ getCellDisplayValue,
675
+ getConnectionsForBar,
676
+ getFormattedValue,
677
+ getHandlesForBar,
678
+ getHeaderCellStyle,
679
+ getRowExpandSymbol,
680
+ insertRowAbove,
681
+ insertRowBelow,
682
+ isRowGantt,
683
+ isRowVisible,
684
+ moveRow,
685
+ registerConnectionHandle,
686
+ registerGanttBar,
687
+ resizeColumn,
688
+ setCellData,
689
+ setCellText,
690
+ setFilter,
691
+ sortByColumn,
692
+ toggleRowExpand,
693
+ unregisterConnectionHandle,
694
+ unregisterGanttBar,
695
+ updateGanttBar,
696
+ updateRows
697
+ };
698
+ })();
699
+ };
700
+ //#endregion
701
+ //#region src/components/ACell.vue?vue&type=script&setup=true&lang.ts
702
+ var _hoisted_1$10 = [
703
+ "data-colindex",
704
+ "data-rowindex",
705
+ "data-editable",
706
+ "contenteditable",
707
+ "tabindex"
708
+ ];
709
+ var _hoisted_2$9 = ["innerHTML"];
710
+ var _hoisted_3$7 = { key: 4 };
711
+ //#endregion
712
+ //#region src/components/ACell.vue
713
+ var ACell_default = /* @__PURE__ */ defineComponent({
714
+ __name: "ACell",
715
+ props: {
716
+ colIndex: {},
717
+ rowIndex: {},
718
+ store: {},
719
+ addNavigation: {
720
+ type: [Boolean, Object],
721
+ default: true
722
+ },
723
+ tabIndex: { default: 0 },
724
+ pinned: {
725
+ type: Boolean,
726
+ default: false
727
+ },
728
+ debounce: { default: 300 }
729
+ },
730
+ setup(__props, { expose: __expose }) {
731
+ const cellRef = useTemplateRef("cell");
732
+ const originalData = __props.store.getCellData(__props.colIndex, __props.rowIndex);
733
+ const currentData = ref("");
734
+ const cellModified = ref(false);
735
+ const column = __props.store.columns[__props.colIndex];
736
+ const row = __props.store.rows[__props.rowIndex];
737
+ const textAlign = column.align || "center";
738
+ const cellWidth = column.width || "40ch";
739
+ const displayValue = computed(() => __props.store.getCellDisplayValue(__props.colIndex, __props.rowIndex));
740
+ const resolvedText = ref(null);
741
+ onMounted(() => {
742
+ if (!column.linkDoctype) return;
743
+ const raw = __props.store.getCellData(__props.colIndex, __props.rowIndex);
744
+ if (raw !== null && raw !== void 0 && typeof raw === "object") {
745
+ const obj = raw;
746
+ const display = obj.displayText ?? obj.id;
747
+ if (typeof display === "string" || typeof display === "number") resolvedText.value = String(display);
748
+ return;
749
+ }
750
+ const resolver = __props.store.linkResolver;
751
+ if (!resolver || typeof raw !== "string" || raw === "") return;
752
+ resolver(column.linkDoctype, raw).then((text) => {
753
+ if (text != null) resolvedText.value = text;
754
+ return text;
755
+ });
756
+ });
757
+ const renderedValue = computed(() => resolvedText.value ?? displayValue.value);
758
+ const badgeFromFormat = computed(() => {
759
+ if (column.cellComponent) return void 0;
760
+ const value = renderedValue.value;
761
+ return isBadgeDescriptor(value) ? value : void 0;
762
+ });
763
+ const badgeFromOptions = computed(() => {
764
+ if (column.cellComponent || badgeFromFormat.value) return void 0;
765
+ if (!hasBadgeOptions(column.options)) return void 0;
766
+ return {
767
+ value: __props.store.getCellData(__props.colIndex, __props.rowIndex),
768
+ options: column.options,
769
+ presentation: "cell-fill"
770
+ };
771
+ });
772
+ const usesBadgeDisplay = computed(() => !!column.cellComponent || badgeFromFormat.value !== void 0 || hasBadgeOptions(column.options));
773
+ const isContentEditable = computed(() => column.edit && !usesBadgeDisplay.value);
774
+ const cellComponentBindings = computed(() => {
775
+ const props = { ...column.cellComponentProps };
776
+ if (column.cellComponent !== "ABadge") return {
777
+ ...props,
778
+ value: renderedValue.value
779
+ };
780
+ if (isBadgeDescriptor(renderedValue.value)) return {
781
+ presentation: "cell-fill",
782
+ ...props,
783
+ ...renderedValue.value
784
+ };
785
+ return {
786
+ presentation: "cell-fill",
787
+ options: column.options,
788
+ ...props,
789
+ value: __props.store.getCellData(__props.colIndex, __props.rowIndex)
790
+ };
791
+ });
792
+ const isHtmlValue = computed(() => {
793
+ return typeof renderedValue.value === "string" ? isHtmlString(renderedValue.value) : false;
794
+ });
795
+ const cellStyle = computed(() => {
796
+ return {
797
+ textAlign,
798
+ width: cellWidth,
799
+ fontWeight: !cellModified.value ? "inherit" : "bold",
800
+ paddingLeft: getIndent(__props.colIndex, __props.store.display[__props.rowIndex]?.indent)
801
+ };
802
+ });
803
+ const cellClasses = computed(() => {
804
+ return {
805
+ "sticky-column": __props.pinned,
806
+ "cell-modified": cellModified.value,
807
+ "atable-cell--badge-fill": usesBadgeDisplay.value
808
+ };
809
+ });
810
+ const onCellClick = () => {
811
+ selectAllText();
812
+ showModal();
813
+ };
814
+ const showModal = () => {
815
+ const { left, bottom, width, height } = useElementBounding(cellRef);
816
+ if (column.mask) {}
817
+ if (column.modalComponent) __props.store.$patch((state) => {
818
+ state.modal.visible = true;
819
+ state.modal.colIndex = __props.colIndex;
820
+ state.modal.rowIndex = __props.rowIndex;
821
+ state.modal.left = left.value;
822
+ state.modal.bottom = bottom.value;
823
+ state.modal.width = width.value;
824
+ state.modal.height = height.value;
825
+ state.modal.cell = cellRef.value;
826
+ if (typeof column.modalComponent === "function") state.modal.component = column.modalComponent({
827
+ table: __props.store.table,
828
+ row,
829
+ column
830
+ });
831
+ else state.modal.component = column.modalComponent;
832
+ state.modal.componentProps = column.modalComponentExtraProps;
833
+ });
834
+ };
835
+ if (__props.addNavigation) {
836
+ let handlers = {
837
+ ...defaultKeypressHandlers,
838
+ "keydown.f2": showModal,
839
+ "keydown.alt.up": showModal,
840
+ "keydown.alt.down": showModal,
841
+ "keydown.alt.left": showModal,
842
+ "keydown.alt.right": showModal
843
+ };
844
+ if (typeof __props.addNavigation === "object") handlers = {
845
+ ...handlers,
846
+ ...__props.addNavigation
847
+ };
848
+ useKeyboardNav([{
849
+ selectors: cellRef,
850
+ handlers
851
+ }]);
852
+ }
853
+ const selectAllText = () => {
854
+ if (cellRef.value && column.edit) {
855
+ const selection = window.getSelection();
856
+ if (selection) try {
857
+ const range = document.createRange();
858
+ if (range.selectNodeContents) {
859
+ range.selectNodeContents(cellRef.value);
860
+ selection.removeAllRanges();
861
+ selection.addRange(range);
862
+ }
863
+ } catch {}
864
+ }
865
+ };
866
+ const onFocus = () => {
867
+ if (cellRef.value) {
868
+ currentData.value = cellRef.value.textContent;
869
+ selectAllText();
870
+ }
871
+ };
872
+ const saveCursorPosition = () => {
873
+ try {
874
+ const selection = window.getSelection();
875
+ if (selection && selection.rangeCount > 0 && cellRef.value) {
876
+ const range = selection.getRangeAt(0);
877
+ const preCaretRange = range.cloneRange();
878
+ if (preCaretRange.selectNodeContents && preCaretRange.setEnd) {
879
+ preCaretRange.selectNodeContents(cellRef.value);
880
+ preCaretRange.setEnd(range.endContainer, range.endOffset);
881
+ return preCaretRange.toString().length;
882
+ }
883
+ }
884
+ } catch {}
885
+ return 0;
886
+ };
887
+ const restoreCursorPosition = (position) => {
888
+ if (!cellRef.value) return;
889
+ try {
890
+ const selection = window.getSelection();
891
+ if (!selection) return;
892
+ let charIndex = 0;
893
+ const walker = document.createTreeWalker ? document.createTreeWalker(cellRef.value, NodeFilter.SHOW_TEXT, null) : null;
894
+ if (!walker) return;
895
+ let node;
896
+ let range = null;
897
+ while (node = walker.nextNode()) {
898
+ const textNode = node;
899
+ const nextCharIndex = charIndex + textNode.textContent.length;
900
+ if (position <= nextCharIndex) {
901
+ range = document.createRange();
902
+ if (range.setStart && range.setEnd) {
903
+ range.setStart(textNode, position - charIndex);
904
+ range.setEnd(textNode, position - charIndex);
905
+ break;
906
+ }
907
+ }
908
+ charIndex = nextCharIndex;
909
+ }
910
+ if (range && selection.removeAllRanges && selection.addRange) {
911
+ selection.removeAllRanges();
912
+ selection.addRange(range);
913
+ }
914
+ } catch {}
915
+ };
916
+ const updateCellData = (payload) => {
917
+ if (!column.edit) return;
918
+ const target = payload.target;
919
+ if (target.textContent === currentData.value) return;
920
+ const cursorPosition = saveCursorPosition();
921
+ currentData.value = target.textContent;
922
+ if (column.format) {
923
+ cellModified.value = target.textContent !== __props.store.getFormattedValue(__props.colIndex, __props.rowIndex, originalData);
924
+ __props.store.setCellText(__props.colIndex, __props.rowIndex, target.textContent);
925
+ } else {
926
+ cellModified.value = target.textContent !== originalData;
927
+ __props.store.setCellData(__props.colIndex, __props.rowIndex, target.textContent);
928
+ }
929
+ nextTick().then(() => {
930
+ return restoreCursorPosition(cursorPosition);
931
+ });
932
+ };
933
+ const debouncedUpdateCellData = useDebounceFn(updateCellData, __props.debounce);
934
+ __expose({ currentData });
935
+ return (_ctx, _cache) => {
936
+ return openBlock(), createElementBlock("td", {
937
+ ref: "cell",
938
+ "data-colindex": __props.colIndex,
939
+ "data-rowindex": __props.rowIndex,
940
+ "data-editable": unref(column).edit,
941
+ contenteditable: isContentEditable.value,
942
+ tabindex: __props.tabIndex,
943
+ spellcheck: false,
944
+ style: normalizeStyle(cellStyle.value),
945
+ class: normalizeClass(["atable-cell", cellClasses.value]),
946
+ onFocus,
947
+ onPaste: updateCellData,
948
+ onInput: _cache[0] || (_cache[0] = (...args) => unref(debouncedUpdateCellData) && unref(debouncedUpdateCellData)(...args)),
949
+ onClick: onCellClick
950
+ }, [unref(column).cellComponent ? (openBlock(), createBlock(resolveDynamicComponent(unref(column).cellComponent), normalizeProps(mergeProps({ key: 0 }, cellComponentBindings.value)), null, 16)) : badgeFromFormat.value ? (openBlock(), createBlock(resolveDynamicComponent("ABadge"), mergeProps({ key: 1 }, badgeFromFormat.value, { presentation: "cell-fill" }), null, 16)) : badgeFromOptions.value ? (openBlock(), createBlock(resolveDynamicComponent("ABadge"), normalizeProps(mergeProps({ key: 2 }, badgeFromOptions.value)), null, 16)) : isHtmlValue.value ? (openBlock(), createElementBlock("span", {
951
+ key: 3,
952
+ innerHTML: renderedValue.value
953
+ }, null, 8, _hoisted_2$9)) : (openBlock(), createElementBlock("span", _hoisted_3$7, toDisplayString(renderedValue.value), 1))], 46, _hoisted_1$10);
954
+ };
955
+ }
956
+ });
957
+ //#endregion
958
+ //#region src/components/AGanttCell.vue?vue&type=script&setup=true&lang.ts
959
+ var _hoisted_1$9 = ["colspan"];
960
+ var _hoisted_2$8 = {
961
+ ref: "container",
962
+ class: "gantt-container"
963
+ };
964
+ var _hoisted_3$6 = ["data-rowindex", "data-colindex"];
965
+ var _hoisted_4$5 = {
966
+ key: 2,
967
+ class: "gantt-label"
968
+ };
969
+ var _hoisted_5$3 = [
970
+ "x1",
971
+ "y1",
972
+ "x2",
973
+ "y2"
974
+ ];
975
+ var AGanttCell_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
976
+ __name: "AGanttCell",
977
+ props: {
978
+ store: {},
979
+ columnsCount: {},
980
+ rowIndex: {},
981
+ colIndex: {},
982
+ start: { default: 0 },
983
+ end: { default: 0 },
984
+ colspan: { default: 1 },
985
+ label: { default: "" },
986
+ color: { default: "#cccccc" }
987
+ },
988
+ emits: ["connection:create"],
989
+ setup(__props, { expose: __expose, emit: __emit }) {
990
+ useCssVars((_ctx) => ({
991
+ "v564d6da1": barColor.value,
992
+ "v4f540c19": _ctx.colspan
993
+ }));
994
+ const emit = __emit;
995
+ const barColor = ref(__props.color.length >= 6 ? __props.color : "#cccccc");
996
+ const barId = `gantt-bar-row-${__props.rowIndex}-col-${__props.colIndex}`;
997
+ const containerRef = useTemplateRef("container");
998
+ const barRef = useTemplateRef("bar");
999
+ const leftResizeHandleRef = useTemplateRef("leftResizeHandle");
1000
+ const rightResizeHandleRef = useTemplateRef("rightResizeHandle");
1001
+ const leftConnectionHandleRef = useTemplateRef("leftConnectionHandle");
1002
+ const rightConnectionHandleRef = useTemplateRef("rightConnectionHandle");
1003
+ const { width: totalBarWidth } = useElementBounding(containerRef);
1004
+ const { left: barLeft, right: barRight } = useElementBounding(barRef);
1005
+ const currentStart = ref(__props.start);
1006
+ const currentEnd = ref(__props.end || currentStart.value + __props.colspan);
1007
+ const isLeftConnectionVisible = ref(false);
1008
+ const isRightConnectionVisible = ref(false);
1009
+ const isLeftConnectionDragging = ref(false);
1010
+ const isRightConnectionDragging = ref(false);
1011
+ const showDragPreview = ref(false);
1012
+ const dragPreview = ref({
1013
+ startX: 0,
1014
+ startY: 0,
1015
+ endX: 0,
1016
+ endY: 0
1017
+ });
1018
+ const isAnyDragging = computed(() => isBarDragging.value || isLeftResizing.value || isRightResizing.value);
1019
+ const pixelsPerColumn = computed(() => __props.colspan > 0 ? totalBarWidth.value / __props.colspan : 0);
1020
+ const barStyle = computed(() => {
1021
+ const startPercent = currentStart.value / __props.colspan * 100;
1022
+ const endPercent = currentEnd.value / __props.colspan * 100;
1023
+ return {
1024
+ left: `${startPercent}%`,
1025
+ width: `${endPercent - startPercent}%`,
1026
+ backgroundColor: barColor.value
1027
+ };
1028
+ });
1029
+ const connectionDragStyle = computed(() => ({
1030
+ position: "fixed",
1031
+ top: 0,
1032
+ left: 0,
1033
+ width: "100vw",
1034
+ height: "100vh",
1035
+ pointerEvents: "none",
1036
+ zIndex: 1e3
1037
+ }));
1038
+ const dragStartData = ref({
1039
+ startX: 0,
1040
+ startPos: 0
1041
+ });
1042
+ const { isDragging: isLeftResizing } = useDraggable(leftResizeHandleRef, {
1043
+ axis: "x",
1044
+ onStart: () => setupDragStart(barLeft.value, currentStart.value),
1045
+ onMove: ({ x }) => handleLeftResize(x),
1046
+ onEnd: ({ x }) => finishLeftResize(x)
1047
+ });
1048
+ const { isDragging: isRightResizing } = useDraggable(rightResizeHandleRef, {
1049
+ axis: "x",
1050
+ onStart: () => setupDragStart(barRight.value, currentEnd.value),
1051
+ onMove: ({ x }) => handleRightResize(x),
1052
+ onEnd: ({ x }) => finishRightResize(x)
1053
+ });
1054
+ const { isDragging: isBarDragging } = useDraggable(barRef, {
1055
+ exact: true,
1056
+ axis: "x",
1057
+ onStart: () => setupDragStart(barLeft.value, currentStart.value),
1058
+ onMove: ({ x }) => handleBarMove(x),
1059
+ onEnd: ({ x }) => finishBarMove(x)
1060
+ });
1061
+ onMounted(() => {
1062
+ registerGanttComponents();
1063
+ });
1064
+ onUnmounted(() => {
1065
+ unregisterGanttComponents();
1066
+ });
1067
+ function setupDragStart(startX, startPos) {
1068
+ if (barRef.value) barRef.value.style.transition = "none";
1069
+ dragStartData.value = {
1070
+ startX,
1071
+ startPos
1072
+ };
1073
+ }
1074
+ function handleLeftResize(x) {
1075
+ if (!isLeftResizing.value || !barRef.value) return;
1076
+ const deltaColumns = (x - dragStartData.value.startX) / pixelsPerColumn.value;
1077
+ const newStart = Math.max(0, Math.min(currentEnd.value - 1, dragStartData.value.startPos + deltaColumns));
1078
+ barRef.value.style.left = `${newStart / __props.colspan * 100}%`;
1079
+ barRef.value.style.width = `${(currentEnd.value - newStart) / __props.colspan * 100}%`;
1080
+ }
1081
+ function finishLeftResize(x) {
1082
+ if (!barRef.value) return;
1083
+ const deltaX = x - dragStartData.value.startX;
1084
+ const deltaColumns = Math.round(deltaX / pixelsPerColumn.value);
1085
+ const oldStart = currentStart.value;
1086
+ const newStart = Math.max(0, Math.min(currentEnd.value - 1, dragStartData.value.startPos + deltaColumns));
1087
+ currentStart.value = newStart;
1088
+ __props.store.updateGanttBar({
1089
+ rowIndex: __props.rowIndex,
1090
+ colIndex: __props.colIndex,
1091
+ type: "resize",
1092
+ edge: "start",
1093
+ oldStart,
1094
+ newStart,
1095
+ end: currentEnd.value,
1096
+ delta: deltaColumns,
1097
+ oldColspan: currentEnd.value - oldStart,
1098
+ newColspan: currentEnd.value - newStart
1099
+ });
1100
+ }
1101
+ function handleRightResize(x) {
1102
+ if (!isRightResizing.value || !barRef.value) return;
1103
+ const deltaColumns = (x - dragStartData.value.startX) / pixelsPerColumn.value;
1104
+ const newEnd = Math.max(currentStart.value + 1, Math.min(__props.columnsCount, dragStartData.value.startPos + deltaColumns));
1105
+ barRef.value.style.width = `${(newEnd - currentStart.value) / __props.colspan * 100}%`;
1106
+ }
1107
+ function finishRightResize(x) {
1108
+ if (!barRef.value) return;
1109
+ const deltaX = x - dragStartData.value.startX;
1110
+ const deltaColumns = Math.round(deltaX / pixelsPerColumn.value);
1111
+ const oldEnd = currentEnd.value;
1112
+ const newEnd = Math.max(currentStart.value + 1, Math.min(__props.columnsCount, dragStartData.value.startPos + deltaColumns));
1113
+ currentEnd.value = newEnd;
1114
+ __props.store.updateGanttBar({
1115
+ rowIndex: __props.rowIndex,
1116
+ colIndex: __props.colIndex,
1117
+ type: "resize",
1118
+ edge: "end",
1119
+ oldEnd,
1120
+ newEnd,
1121
+ start: currentStart.value,
1122
+ delta: deltaColumns,
1123
+ oldColspan: oldEnd - currentStart.value,
1124
+ newColspan: newEnd - currentStart.value
1125
+ });
1126
+ }
1127
+ function handleBarMove(x) {
1128
+ if (!isBarDragging.value || !barRef.value) return;
1129
+ const deltaColumns = (x - dragStartData.value.startX) / pixelsPerColumn.value;
1130
+ const barWidth = currentEnd.value - currentStart.value;
1131
+ const newStart = Math.max(0, Math.min(dragStartData.value.startPos + deltaColumns, __props.columnsCount - barWidth));
1132
+ barRef.value.style.left = `${newStart / __props.colspan * 100}%`;
1133
+ }
1134
+ function finishBarMove(x) {
1135
+ if (!barRef.value) return;
1136
+ const deltaX = x - dragStartData.value.startX;
1137
+ const deltaColumns = Math.round(deltaX / pixelsPerColumn.value);
1138
+ const barWidth = currentEnd.value - currentStart.value;
1139
+ const oldStart = currentStart.value;
1140
+ const oldEnd = currentEnd.value;
1141
+ let newStart = dragStartData.value.startPos + deltaColumns;
1142
+ let newEnd = newStart + barWidth;
1143
+ if (newStart < 0) {
1144
+ newStart = 0;
1145
+ newEnd = barWidth;
1146
+ } else if (newEnd > __props.columnsCount) {
1147
+ newEnd = __props.columnsCount;
1148
+ newStart = newEnd - barWidth;
1149
+ }
1150
+ currentStart.value = newStart;
1151
+ currentEnd.value = newEnd;
1152
+ __props.store.updateGanttBar({
1153
+ rowIndex: __props.rowIndex,
1154
+ colIndex: __props.colIndex,
1155
+ type: "bar",
1156
+ oldStart,
1157
+ oldEnd,
1158
+ newStart,
1159
+ newEnd,
1160
+ delta: deltaColumns,
1161
+ colspan: newEnd - newStart
1162
+ });
1163
+ }
1164
+ function registerGanttComponents() {
1165
+ const { x: barX, y: barY } = useElementBounding(barRef);
1166
+ const { x: leftX, y: leftY } = useElementBounding(leftConnectionHandleRef);
1167
+ const { x: rightX, y: rightY } = useElementBounding(rightConnectionHandleRef);
1168
+ __props.store.registerGanttBar({
1169
+ id: barId,
1170
+ rowIndex: __props.rowIndex,
1171
+ colIndex: __props.colIndex,
1172
+ startIndex: currentStart,
1173
+ endIndex: currentEnd,
1174
+ color: barColor,
1175
+ label: __props.label,
1176
+ position: {
1177
+ x: barX,
1178
+ y: barY
1179
+ }
1180
+ });
1181
+ if (__props.store.isDependencyGraphEnabled) {
1182
+ __props.store.registerConnectionHandle({
1183
+ id: `${barId}-connection-left`,
1184
+ rowIndex: __props.rowIndex,
1185
+ colIndex: __props.colIndex,
1186
+ side: "left",
1187
+ position: {
1188
+ x: leftX,
1189
+ y: leftY
1190
+ },
1191
+ visible: isLeftConnectionVisible,
1192
+ barId
1193
+ });
1194
+ __props.store.registerConnectionHandle({
1195
+ id: `${barId}-connection-right`,
1196
+ rowIndex: __props.rowIndex,
1197
+ colIndex: __props.colIndex,
1198
+ side: "right",
1199
+ position: {
1200
+ x: rightX,
1201
+ y: rightY
1202
+ },
1203
+ visible: isRightConnectionVisible,
1204
+ barId
1205
+ });
1206
+ }
1207
+ }
1208
+ function unregisterGanttComponents() {
1209
+ __props.store.unregisterGanttBar(barId);
1210
+ if (__props.store.isDependencyGraphEnabled) {
1211
+ __props.store.unregisterConnectionHandle(`${barId}-connection-left`);
1212
+ __props.store.unregisterConnectionHandle(`${barId}-connection-right`);
1213
+ }
1214
+ }
1215
+ function showConnectionHandles() {
1216
+ if (__props.store.isDependencyGraphEnabled) {
1217
+ isLeftConnectionVisible.value = true;
1218
+ isRightConnectionVisible.value = true;
1219
+ }
1220
+ }
1221
+ function hideConnectionHandles() {
1222
+ if (!isLeftConnectionDragging.value && !isRightConnectionDragging.value) {
1223
+ isLeftConnectionVisible.value = false;
1224
+ isRightConnectionVisible.value = false;
1225
+ }
1226
+ }
1227
+ function startConnectionDrag(side, event) {
1228
+ event.preventDefault();
1229
+ event.stopPropagation();
1230
+ showDragPreview.value = true;
1231
+ if (side === "left") isLeftConnectionDragging.value = true;
1232
+ else isRightConnectionDragging.value = true;
1233
+ const handle = side === "left" ? leftConnectionHandleRef.value : rightConnectionHandleRef.value;
1234
+ if (handle) {
1235
+ const handleRect = handle.getBoundingClientRect();
1236
+ const centerX = handleRect.left + handleRect.width / 2;
1237
+ const centerY = handleRect.top + handleRect.height / 2;
1238
+ dragPreview.value = {
1239
+ startX: centerX,
1240
+ startY: centerY,
1241
+ endX: centerX,
1242
+ endY: centerY
1243
+ };
1244
+ }
1245
+ const handleMouseMove = (moveEvent) => {
1246
+ dragPreview.value.endX = moveEvent.clientX;
1247
+ dragPreview.value.endY = moveEvent.clientY;
1248
+ };
1249
+ const handleMouseUp = (upEvent) => {
1250
+ handleConnectionDrop(upEvent, side);
1251
+ cleanupConnectionDrag(handleMouseMove, handleMouseUp);
1252
+ };
1253
+ document.addEventListener("mousemove", handleMouseMove);
1254
+ document.addEventListener("mouseup", handleMouseUp);
1255
+ }
1256
+ function handleConnectionDrop(upEvent, sourceSide) {
1257
+ const targetHandle = document.elementFromPoint(upEvent.clientX, upEvent.clientY)?.closest(".connection-handle");
1258
+ if (targetHandle && targetHandle !== (sourceSide === "left" ? leftConnectionHandleRef.value : rightConnectionHandleRef.value)) {
1259
+ const targetBar = targetHandle.closest(".gantt-bar");
1260
+ if (targetBar) {
1261
+ const targetRowIndex = parseInt(targetBar.getAttribute("data-rowindex") || "0");
1262
+ const targetColIndex = parseInt(targetBar.getAttribute("data-colindex") || "0");
1263
+ const targetSide = targetHandle.classList.contains("left-connection-handle") ? "left" : "right";
1264
+ const targetBarId = `gantt-bar-row-${targetRowIndex}-col-${targetColIndex}`;
1265
+ const connection = __props.store.createConnection(`${barId}-connection-${sourceSide}`, `${targetBarId}-connection-${targetSide}`);
1266
+ if (connection) emit("connection:create", connection);
1267
+ }
1268
+ }
1269
+ }
1270
+ function cleanupConnectionDrag(handleMouseMove, handleMouseUp) {
1271
+ showDragPreview.value = false;
1272
+ isLeftConnectionDragging.value = false;
1273
+ isRightConnectionDragging.value = false;
1274
+ document.removeEventListener("mousemove", handleMouseMove);
1275
+ document.removeEventListener("mouseup", handleMouseUp);
1276
+ if (!barRef.value?.matches(":hover")) hideConnectionHandles();
1277
+ }
1278
+ __expose({
1279
+ barStyle,
1280
+ cleanupConnectionDrag,
1281
+ currentEnd,
1282
+ handleConnectionDrop,
1283
+ isLeftConnectionDragging,
1284
+ isLeftConnectionVisible,
1285
+ isRightConnectionDragging,
1286
+ isRightConnectionVisible,
1287
+ showDragPreview
1288
+ });
1289
+ return (_ctx, _cache) => {
1290
+ return openBlock(), createElementBlock("td", {
1291
+ class: "aganttcell",
1292
+ colspan: __props.colspan
1293
+ }, [createElementVNode("div", _hoisted_2$8, [createElementVNode("div", {
1294
+ ref: "bar",
1295
+ "data-rowindex": __props.rowIndex,
1296
+ "data-colindex": __props.colIndex,
1297
+ class: normalizeClass(["gantt-bar", { "is-dragging": isAnyDragging.value }]),
1298
+ style: normalizeStyle(barStyle.value),
1299
+ onMouseenter: showConnectionHandles,
1300
+ onMouseleave: hideConnectionHandles
1301
+ }, [
1302
+ __props.store.isDependencyGraphEnabled ? (openBlock(), createElementBlock("div", {
1303
+ key: 0,
1304
+ ref: "leftConnectionHandle",
1305
+ class: normalizeClass(["connection-handle left-connection-handle", {
1306
+ visible: isLeftConnectionVisible.value,
1307
+ "is-dragging": isLeftConnectionDragging.value
1308
+ }]),
1309
+ onMousedown: _cache[0] || (_cache[0] = withModifiers(($event) => startConnectionDrag("left", $event), ["stop"]))
1310
+ }, [..._cache[2] || (_cache[2] = [createElementVNode("div", { class: "connection-dot" }, null, -1)])], 34)) : createCommentVNode("", true),
1311
+ __props.store.isDependencyGraphEnabled ? (openBlock(), createElementBlock("div", {
1312
+ key: 1,
1313
+ ref: "rightConnectionHandle",
1314
+ class: normalizeClass(["connection-handle right-connection-handle", {
1315
+ visible: isRightConnectionVisible.value,
1316
+ "is-dragging": isRightConnectionDragging.value
1317
+ }]),
1318
+ onMousedown: _cache[1] || (_cache[1] = withModifiers(($event) => startConnectionDrag("right", $event), ["stop"]))
1319
+ }, [..._cache[3] || (_cache[3] = [createElementVNode("div", { class: "connection-dot" }, null, -1)])], 34)) : createCommentVNode("", true),
1320
+ createElementVNode("div", {
1321
+ ref: "leftResizeHandle",
1322
+ class: normalizeClass(["resize-handle left-resize-handle", { "is-dragging": unref(isLeftResizing) }])
1323
+ }, [..._cache[4] || (_cache[4] = [createElementVNode("div", { class: "handle-grip" }, null, -1), createElementVNode("div", { class: "vertical-indicator left-indicator" }, null, -1)])], 2),
1324
+ __props.label ? (openBlock(), createElementBlock("label", _hoisted_4$5, toDisplayString(__props.label), 1)) : createCommentVNode("", true),
1325
+ createElementVNode("div", {
1326
+ ref: "rightResizeHandle",
1327
+ class: normalizeClass(["resize-handle right-resize-handle", { "is-dragging": unref(isRightResizing) }])
1328
+ }, [..._cache[5] || (_cache[5] = [createElementVNode("div", { class: "handle-grip" }, null, -1), createElementVNode("div", { class: "vertical-indicator right-indicator" }, null, -1)])], 2)
1329
+ ], 46, _hoisted_3$6)], 512), __props.store.isDependencyGraphEnabled && showDragPreview.value ? (openBlock(), createElementBlock("svg", {
1330
+ key: 0,
1331
+ style: normalizeStyle(connectionDragStyle.value)
1332
+ }, [createElementVNode("line", {
1333
+ x1: dragPreview.value.startX,
1334
+ y1: dragPreview.value.startY,
1335
+ x2: dragPreview.value.endX,
1336
+ y2: dragPreview.value.endY,
1337
+ stroke: "#2196f3",
1338
+ "stroke-width": "2",
1339
+ "stroke-dasharray": "5,5"
1340
+ }, null, 8, _hoisted_5$3)], 4)) : createCommentVNode("", true)], 8, _hoisted_1$9);
1341
+ };
1342
+ }
1343
+ });
1344
+ //#endregion
1345
+ //#region \0plugin-vue:export-helper
1346
+ var _plugin_vue_export_helper_default = (sfc, props) => {
1347
+ const target = sfc.__vccOpts || sfc;
1348
+ for (const [key, val] of props) target[key] = val;
1349
+ return target;
1350
+ };
1351
+ //#endregion
1352
+ //#region src/components/AGanttCell.vue
1353
+ var AGanttCell_default = /*#__PURE__*/ _plugin_vue_export_helper_default(AGanttCell_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-032ef6d9"]]);
1354
+ //#endregion
1355
+ //#region src/icons/stonecrop-ui-icon-add.svg?raw
1356
+ var stonecrop_ui_icon_add_default = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg id=\"Layer_1\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\">\n <path d=\"M32,64C14.35,64,0,49.65,0,32S14.35,0,32,0s32,14.35,32,32-14.35,32-32,32ZM32,4c-15.44,0-28,12.56-28,28s12.56,28,28,28,28-12.56,28-28S47.44,4,32,4Z\" style=\"fill: #000; stroke-width: 0px;\"/>\n <polygon points=\"34 18 30 18 30 30 18 30 18 34 30 34 30 46 34 46 34 34 46 34 46 30 34 30 34 18\" style=\"fill: #000; stroke-width: 0px;\"/>\n</svg>\n";
1357
+ //#endregion
1358
+ //#region src/icons/stonecrop-ui-icon-delete.svg?raw
1359
+ var stonecrop_ui_icon_delete_default = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg id=\"Layer_1\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\">\n <path d=\"M32,64C14.35,64,0,49.65,0,32S14.35,0,32,0s32,14.35,32,32-14.35,32-32,32ZM32,4c-15.44,0-28,12.56-28,28s12.56,28,28,28,28-12.56,28-28S47.44,4,32,4Z\" style=\"fill: #000; stroke-width: 0px;\"/>\n <polygon points=\"46.84 19.99 44.01 17.16 32 29.17 19.99 17.16 17.16 19.99 29.17 32 17.16 44.01 19.99 46.84 32 34.83 44.01 46.84 46.84 44.01 34.83 32 46.84 19.99\" style=\"fill: #000; stroke-width: 0px;\"/>\n</svg>";
1360
+ //#endregion
1361
+ //#region src/icons/stonecrop-ui-icon-duplicate.svg?raw
1362
+ var stonecrop_ui_icon_duplicate_default = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg id=\"Layer_1\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 70.67 70.67\">\n <path d=\"M68.67,16.67h-14.67V2c0-1.1-.9-2-2-2H2C.9,0,0,.9,0,2v50c0,1.1.9,2,2,2h14.67v14.67c0,1.1.9,2,2,2h50c1.1,0,2-.9,2-2V18.67c0-1.1-.9-2-2-2ZM4,4h46v46H4V4ZM66.67,66.67H20.67v-12.67h31.33c1.1,0,2-.9,2-2v-31.33h12.67v46Z\" style=\"fill: #000; stroke-width: 0px;\"/>\n <polygon points=\"41 25 29 25 29 13 25 13 25 25 13 25 13 29 25 29 25 41 29 41 29 29 41 29 41 25\" style=\"fill: #000; stroke-width: 0px;\"/>\n</svg>";
1363
+ //#endregion
1364
+ //#region src/icons/stonecrop-ui-icon-insert-above.svg?raw
1365
+ var stonecrop_ui_icon_insert_above_default = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 70.6 61.5\">\n <path d=\"M68.6,45.8v13.7H2v-13.7h66.6M70.6,43.8H0v17.7h70.6v-17.7h0Z\"/>\n <path d=\"M68.6,24.2v13.7H2v-13.7h66.6M70.6,22.2H0v17.7h70.6v-17.7h0Z\"/>\n <g>\n <polygon points=\"70.6 2.5 68.6 2.5 68.6 2 68.1 2 68.1 0 70.6 0 70.6 2.5\"/>\n <path d=\"M65.3,2h-2.9V0h2.9v2ZM59.6,2h-2.9V0h2.9v2ZM53.9,2h-2.9V0h2.9v2ZM48.2,2h-2.9V0h2.9v2ZM42.4,2h-2.9V0h2.9v2ZM36.7,2h-2.9V0h2.9v2ZM31,2h-2.9V0h2.9v2ZM25.3,2h-2.9V0h2.9v2ZM19.6,2h-2.9V0h2.9v2ZM13.9,2h-2.9V0h2.9v2ZM8.2,2h-2.9V0h2.9v2Z\"/>\n <polygon points=\"2 2.5 0 2.5 0 0 2.5 0 2.5 2 2 2 2 2.5\"/>\n <path d=\"M2,13.4H0v-2.7h2v2.7ZM2,8H0v-2.7h2v2.7Z\"/>\n <polygon points=\"2.5 18.7 0 18.7 0 16.2 2 16.2 2 16.7 2.5 16.7 2.5 18.7\"/>\n <path d=\"M65.3,18.7h-2.9v-2h2.9v2ZM59.6,18.7h-2.9v-2h2.9v2ZM53.9,18.7h-2.9v-2h2.9v2ZM48.2,18.7h-2.9v-2h2.9v2ZM42.4,18.7h-2.9v-2h2.9v2ZM36.7,18.7h-2.9v-2h2.9v2ZM31,18.7h-2.9v-2h2.9v2ZM25.3,18.7h-2.9v-2h2.9v2ZM19.6,18.7h-2.9v-2h2.9v2ZM13.9,18.7h-2.9v-2h2.9v2ZM8.2,18.7h-2.9v-2h2.9v2Z\"/>\n <polygon points=\"70.6 18.7 68.1 18.7 68.1 16.7 68.6 16.7 68.6 16.2 70.6 16.2 70.6 18.7\"/>\n <path d=\"M70.6,13.4h-2v-2.7h2v2.7ZM70.6,8h-2v-2.7h2v2.7Z\"/>\n </g>\n</svg>";
1366
+ //#endregion
1367
+ //#region src/icons/stonecrop-ui-icon-insert-below.svg?raw
1368
+ var stonecrop_ui_icon_insert_below_default = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 70.6 61.5\">\n <g>\n <polygon points=\"70.6 45.3 68.6 45.3 68.6 44.8 68.1 44.8 68.1 42.8 70.6 42.8 70.6 45.3\"/>\n <path d=\"M65.3,44.8h-2.9v-2h2.9v2ZM59.6,44.8h-2.9v-2h2.9v2ZM53.9,44.8h-2.9v-2h2.9v2ZM48.2,44.8h-2.9v-2h2.9v2ZM42.4,44.8h-2.9v-2h2.9v2ZM36.7,44.8h-2.9v-2h2.9v2ZM31,44.8h-2.9v-2h2.9v2ZM25.3,44.8h-2.9v-2h2.9v2ZM19.6,44.8h-2.9v-2h2.9v2ZM13.9,44.8h-2.9v-2h2.9v2ZM8.2,44.8h-2.9v-2h2.9v2Z\"/>\n <polygon points=\"2 45.3 0 45.3 0 42.8 2.5 42.8 2.5 44.8 2 44.8 2 45.3\"/>\n <path d=\"M2,56.3H0v-2.7h2v2.7ZM2,50.8H0v-2.7h2v2.7Z\"/>\n <polygon points=\"2.5 61.5 0 61.5 0 59 2 59 2 59.5 2.5 59.5 2.5 61.5\"/>\n <path d=\"M65.3,61.5h-2.9v-2h2.9v2ZM59.6,61.5h-2.9v-2h2.9v2ZM53.9,61.5h-2.9v-2h2.9v2ZM48.2,61.5h-2.9v-2h2.9v2ZM42.4,61.5h-2.9v-2h2.9v2ZM36.7,61.5h-2.9v-2h2.9v2ZM31,61.5h-2.9v-2h2.9v2ZM25.3,61.5h-2.9v-2h2.9v2ZM19.6,61.5h-2.9v-2h2.9v2ZM13.9,61.5h-2.9v-2h2.9v2ZM8.2,61.5h-2.9v-2h2.9v2Z\"/>\n <polygon points=\"70.6 61.5 68.1 61.5 68.1 59.5 68.6 59.5 68.6 59 70.6 59 70.6 61.5\"/>\n <path d=\"M70.6,56.3h-2v-2.7h2v2.7ZM70.6,50.8h-2v-2.7h2v2.7Z\"/>\n </g>\n <path d=\"M68.6,23.7v13.7H2v-13.7h66.6M70.6,21.7H0v17.7h70.6v-17.7h0Z\"/>\n <path d=\"M68.6,2v13.7H2V2h66.6M70.6,0H0v17.7h70.6V0h0Z\"/>\n</svg>";
1369
+ //#endregion
1370
+ //#region src/icons/stonecrop-ui-icon-move.svg?raw
1371
+ var stonecrop_ui_icon_move_default = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg id=\"Layer_1\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 70.67 70.64\">\n <path d=\"M70.08,33.9l-9.75-9.75-2.83,2.83,6.33,6.33h-26.51V6.81l6.33,6.33,2.83-2.83L36.75.56c-.75-.75-2.08-.75-2.83,0l-9.75,9.75,2.83,2.83,6.33-6.33v26.5H6.83l6.33-6.33-2.83-2.83L.59,33.9c-.38.38-.59.88-.59,1.41s.21,1.04.59,1.41l9.75,9.75,2.83-2.83-6.33-6.33h26.5v26.51l-6.33-6.33-2.83,2.83,9.75,9.75c.38.38.88.59,1.41.59s1.04-.21,1.41-.59l9.75-9.75-2.83-2.83-6.33,6.33v-26.51h26.51l-6.33,6.33,2.83,2.83,9.75-9.75c.38-.38.59-.88.59-1.41s-.21-1.04-.59-1.41Z\" style=\"fill: #000; stroke-width: 0px;\"/>\n</svg>";
1372
+ //#endregion
1373
+ //#region src/icons/stonecrop-ui-icon-open.svg?raw
1374
+ var stonecrop_ui_icon_open_default = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg id=\"Layer_1\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\">\n <path d=\"M32,64C14.35,64,0,49.65,0,32S14.35,0,32,0s32,14.35,32,32-14.35,32-32,32ZM32,4c-15.44,0-28,12.56-28,28s12.56,28,28,28,28-12.56,28-28S47.44,4,32,4Z\" style=\"fill: #000; stroke-width: 0px;\"/>\n <polygon points=\"18,20 18,44 46,32\" style=\"fill: #000; stroke-width: 0px;\"/>\n</svg>\n";
1375
+ //#endregion
1376
+ //#region src/icons/index.ts
1377
+ /**
1378
+ * Icon exports for ATable row actions.
1379
+ * Icons are exported as raw SVG strings for flexibility in rendering.
1380
+ * @packageDocumentation
1381
+ */
1382
+ /** Raw SVG for the add-row action. @public */
1383
+ var AddIcon = stonecrop_ui_icon_add_default;
1384
+ /** Raw SVG for the delete-row action. @public */
1385
+ var DeleteIcon = stonecrop_ui_icon_delete_default;
1386
+ /** Raw SVG for the duplicate-row action. @public */
1387
+ var DuplicateIcon = stonecrop_ui_icon_duplicate_default;
1388
+ /** Raw SVG for the insert-above action. @public */
1389
+ var InsertAboveIcon = stonecrop_ui_icon_insert_above_default;
1390
+ /** Raw SVG for the insert-below action. @public */
1391
+ var InsertBelowIcon = stonecrop_ui_icon_insert_below_default;
1392
+ /** Raw SVG for the move action. @public */
1393
+ var MoveIcon = stonecrop_ui_icon_move_default;
1394
+ /** Raw SVG for the open-record action. @public */
1395
+ var OpenIcon = stonecrop_ui_icon_open_default;
1396
+ /**
1397
+ * Map of action types to their default icons.
1398
+ *
1399
+ * @public
1400
+ */
1401
+ var actionIcons = {
1402
+ add: AddIcon,
1403
+ delete: DeleteIcon,
1404
+ duplicate: DuplicateIcon,
1405
+ insertAbove: InsertAboveIcon,
1406
+ insertBelow: InsertBelowIcon,
1407
+ move: MoveIcon,
1408
+ moveUp: "<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"><path d=\"M8 13V3.5M4.5 7 8 3.5 11.5 7\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>",
1409
+ moveDown: "<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"><path d=\"M8 3v9.5M4.5 9 8 12.5 11.5 9\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>",
1410
+ open: OpenIcon
1411
+ };
1412
+ //#endregion
1413
+ //#region src/components/ARowActions.vue?vue&type=script&setup=true&lang.ts
1414
+ var _hoisted_1$8 = {
1415
+ key: 0,
1416
+ class: "row-actions-dropdown"
1417
+ };
1418
+ var _hoisted_2$7 = ["aria-expanded"];
1419
+ var _hoisted_3$5 = ["disabled", "onClick"];
1420
+ var _hoisted_4$4 = ["innerHTML"];
1421
+ var _hoisted_5$2 = { class: "action-label" };
1422
+ var _hoisted_6$2 = {
1423
+ key: 1,
1424
+ class: "row-actions-icons"
1425
+ };
1426
+ var _hoisted_7$2 = [
1427
+ "title",
1428
+ "aria-label",
1429
+ "disabled",
1430
+ "onClick"
1431
+ ];
1432
+ var _hoisted_8$1 = ["innerHTML"];
1433
+ //#endregion
1434
+ //#region src/components/ARowActions.vue
1435
+ var ARowActions_default = /* @__PURE__ */ defineComponent({
1436
+ __name: "ARowActions",
1437
+ props: {
1438
+ rowIndex: {},
1439
+ store: {},
1440
+ config: {},
1441
+ position: {}
1442
+ },
1443
+ emits: ["action"],
1444
+ setup(__props, { emit: __emit }) {
1445
+ const props = __props;
1446
+ const emit = __emit;
1447
+ const actionsCellRef = useTemplateRef("actionsCell");
1448
+ const toggleButtonRef = useTemplateRef("toggleButton");
1449
+ const cellWidth = ref(0);
1450
+ const dropdownOpen = ref(false);
1451
+ const dropdownFlipped = ref(false);
1452
+ const menuPosition = ref({
1453
+ top: 0,
1454
+ left: 0
1455
+ });
1456
+ const defaultLabels = {
1457
+ add: "Add Record",
1458
+ delete: "Delete Record",
1459
+ duplicate: "Duplicate Record",
1460
+ insertAbove: "Insert Above",
1461
+ insertBelow: "Insert Below",
1462
+ move: "Move Record",
1463
+ moveUp: "Move Up",
1464
+ moveDown: "Move Down",
1465
+ open: "Open Record"
1466
+ };
1467
+ const enabledActions = computed(() => {
1468
+ const actions = [];
1469
+ const configActions = props.config.actions || {};
1470
+ for (const type of [
1471
+ "open",
1472
+ "moveUp",
1473
+ "moveDown",
1474
+ "duplicate",
1475
+ "insertAbove",
1476
+ "insertBelow",
1477
+ "add",
1478
+ "delete",
1479
+ "move"
1480
+ ]) {
1481
+ const actionConfig = configActions[type];
1482
+ if (actionConfig === false) continue;
1483
+ if (actionConfig === void 0) continue;
1484
+ let enabled = true;
1485
+ let label = defaultLabels[type];
1486
+ let icon = actionIcons[type];
1487
+ let disabled = false;
1488
+ if (typeof actionConfig === "object") {
1489
+ enabled = actionConfig.enabled !== false;
1490
+ label = actionConfig.label || label;
1491
+ icon = actionConfig.icon || icon;
1492
+ if (actionConfig.disabled) disabled = actionConfig.disabled(props.rowIndex, props.store);
1493
+ }
1494
+ if (enabled) actions.push({
1495
+ type,
1496
+ label,
1497
+ icon,
1498
+ disabled
1499
+ });
1500
+ }
1501
+ return actions;
1502
+ });
1503
+ const showDropdown = computed(() => {
1504
+ if (props.config.forceDropdown) return true;
1505
+ const threshold = props.config.dropdownThreshold ?? 150;
1506
+ if (threshold === 0) return false;
1507
+ return cellWidth.value > 0 && cellWidth.value < threshold;
1508
+ });
1509
+ const menuStyle = computed(() => {
1510
+ if (!dropdownOpen.value) return {};
1511
+ if (dropdownFlipped.value) return {
1512
+ position: "fixed",
1513
+ bottom: `${window.innerHeight - menuPosition.value.top}px`,
1514
+ left: `${menuPosition.value.left}px`,
1515
+ top: "auto"
1516
+ };
1517
+ return {
1518
+ position: "fixed",
1519
+ top: `${menuPosition.value.top}px`,
1520
+ left: `${menuPosition.value.left}px`
1521
+ };
1522
+ });
1523
+ useResizeObserver(actionsCellRef, (entries) => {
1524
+ const entry = entries[0];
1525
+ if (entry) cellWidth.value = entry.contentRect.width;
1526
+ });
1527
+ const toggleDropdown = () => {
1528
+ if (!dropdownOpen.value) checkDropdownPosition();
1529
+ dropdownOpen.value = !dropdownOpen.value;
1530
+ };
1531
+ const checkDropdownPosition = () => {
1532
+ if (!toggleButtonRef.value) return;
1533
+ const buttonRect = toggleButtonRef.value.getBoundingClientRect();
1534
+ const viewportHeight = window.innerHeight;
1535
+ const viewportWidth = window.innerWidth;
1536
+ const estimatedMenuHeight = enabledActions.value.length * 40 + 16;
1537
+ const estimatedMenuWidth = 160;
1538
+ const spaceBelow = viewportHeight - buttonRect.bottom;
1539
+ const spaceAbove = buttonRect.top;
1540
+ dropdownFlipped.value = spaceBelow < estimatedMenuHeight && spaceAbove > estimatedMenuHeight;
1541
+ let left = buttonRect.left;
1542
+ if (left + estimatedMenuWidth > viewportWidth) left = Math.max(0, buttonRect.right - estimatedMenuWidth);
1543
+ menuPosition.value = {
1544
+ top: dropdownFlipped.value ? buttonRect.top : buttonRect.bottom,
1545
+ left
1546
+ };
1547
+ };
1548
+ onClickOutside(actionsCellRef, () => {
1549
+ dropdownOpen.value = false;
1550
+ });
1551
+ const executeAction = (actionType, event) => {
1552
+ dropdownOpen.value = false;
1553
+ const actionConfig = props.config.actions?.[actionType];
1554
+ if (typeof actionConfig === "object" && actionConfig.handler) {
1555
+ if (actionConfig.handler(props.rowIndex, props.store) === false) return;
1556
+ }
1557
+ emit("action", actionType, props.rowIndex, event);
1558
+ };
1559
+ return (_ctx, _cache) => {
1560
+ return openBlock(), createElementBlock("td", {
1561
+ ref: "actionsCell",
1562
+ class: normalizeClass(["atable-row-actions", {
1563
+ "sticky-column": __props.position === "before-index",
1564
+ "dropdown-active": dropdownOpen.value
1565
+ }])
1566
+ }, [showDropdown.value ? (openBlock(), createElementBlock("div", _hoisted_1$8, [createElementVNode("button", {
1567
+ ref: "toggleButton",
1568
+ type: "button",
1569
+ class: "row-actions-toggle",
1570
+ "aria-expanded": dropdownOpen.value,
1571
+ "aria-haspopup": "true",
1572
+ onClick: withModifiers(toggleDropdown, ["stop"])
1573
+ }, [..._cache[0] || (_cache[0] = [createElementVNode("span", { class: "dropdown-icon" }, "⋮", -1)])], 8, _hoisted_2$7), withDirectives(createElementVNode("div", {
1574
+ class: normalizeClass(["row-actions-menu", { "menu-flipped": dropdownFlipped.value }]),
1575
+ style: normalizeStyle(menuStyle.value),
1576
+ role: "menu"
1577
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(enabledActions.value, (action) => {
1578
+ return openBlock(), createElementBlock("button", {
1579
+ key: action.type,
1580
+ type: "button",
1581
+ class: "row-action-menu-item",
1582
+ role: "menuitem",
1583
+ disabled: action.disabled,
1584
+ onClick: withModifiers(($event) => executeAction(action.type, $event), ["stop"])
1585
+ }, [createElementVNode("span", {
1586
+ class: "action-icon",
1587
+ innerHTML: action.icon
1588
+ }, null, 8, _hoisted_4$4), createElementVNode("span", _hoisted_5$2, toDisplayString(action.label), 1)], 8, _hoisted_3$5);
1589
+ }), 128))], 6), [[vShow, dropdownOpen.value]])])) : (openBlock(), createElementBlock("div", _hoisted_6$2, [(openBlock(true), createElementBlock(Fragment, null, renderList(enabledActions.value, (action) => {
1590
+ return openBlock(), createElementBlock("button", {
1591
+ key: action.type,
1592
+ type: "button",
1593
+ class: "row-action-btn",
1594
+ title: action.label,
1595
+ "aria-label": action.label,
1596
+ disabled: action.disabled,
1597
+ onClick: withModifiers(($event) => executeAction(action.type, $event), ["stop"])
1598
+ }, [createElementVNode("span", {
1599
+ class: "action-icon",
1600
+ innerHTML: action.icon
1601
+ }, null, 8, _hoisted_8$1)], 8, _hoisted_7$2);
1602
+ }), 128))]))], 2);
1603
+ };
1604
+ }
1605
+ });
1606
+ //#endregion
1607
+ //#region src/components/ARow.vue?vue&type=script&setup=true&lang.ts
1608
+ var _hoisted_1$7 = ["tabindex"];
1609
+ var _hoisted_2$6 = ["tabindex"];
1610
+ var _hoisted_3$4 = ["colspan"];
1611
+ //#endregion
1612
+ //#region src/components/ARow.vue
1613
+ var ARow_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
1614
+ __name: "ARow",
1615
+ props: {
1616
+ rowIndex: {},
1617
+ store: {},
1618
+ tabIndex: { default: () => -1 },
1619
+ addNavigation: {
1620
+ type: [Boolean, Object],
1621
+ default: false
1622
+ }
1623
+ },
1624
+ emits: ["row:action", "row:click"],
1625
+ setup(__props, { emit: __emit }) {
1626
+ const emit = __emit;
1627
+ const rowRef = useTemplateRef("rowEl");
1628
+ const isRowVisible = computed(() => __props.store.isRowVisible(__props.rowIndex));
1629
+ const rowExpandSymbol = computed(() => __props.store.getRowExpandSymbol(__props.rowIndex));
1630
+ const isClickable = computed(() => __props.store.config.clickable ?? false);
1631
+ const rowActionsConfig = computed(() => {
1632
+ return __props.store.config.rowActions || { enabled: false };
1633
+ });
1634
+ const showRowActions = computed(() => {
1635
+ return rowActionsConfig.value.enabled;
1636
+ });
1637
+ const actionsPosition = computed(() => {
1638
+ return rowActionsConfig.value.position || "before-index";
1639
+ });
1640
+ const isExpanded = computed(() => __props.store.config.view === "list-expansion" && Boolean(__props.store.display[__props.rowIndex]?.expanded));
1641
+ const expandedColspan = computed(() => {
1642
+ const indexCol = __props.store.config.view === "uncounted" ? 0 : 1;
1643
+ const actionsCol = showRowActions.value ? 1 : 0;
1644
+ return __props.store.columns.length + indexCol + actionsCol;
1645
+ });
1646
+ const onRowAction = (actionType, index, event) => {
1647
+ emit("row:action", actionType, index, event);
1648
+ };
1649
+ const onRowClick = (event) => {
1650
+ const target = event.target;
1651
+ if (target.closest(".atable-row-actions") || target.closest(".tree-index") || target.closest(".expansion-index")) return;
1652
+ emit("row:click", __props.rowIndex, event);
1653
+ };
1654
+ const isListExpansion = __props.store.config.view === "list-expansion";
1655
+ if (__props.addNavigation || isListExpansion) {
1656
+ let handlers = {};
1657
+ if (__props.addNavigation === true) handlers = { ...defaultKeypressHandlers };
1658
+ else if (typeof __props.addNavigation === "object") handlers = {
1659
+ ...defaultKeypressHandlers,
1660
+ ...__props.addNavigation
1661
+ };
1662
+ if (isListExpansion && !handlers["keydown.control.g"]) handlers["keydown.control.g"] = (event) => {
1663
+ event.stopPropagation();
1664
+ event.preventDefault();
1665
+ __props.store.toggleRowExpand(__props.rowIndex);
1666
+ };
1667
+ useKeyboardNav([{
1668
+ selectors: rowRef,
1669
+ handlers
1670
+ }]);
1671
+ }
1672
+ return (_ctx, _cache) => {
1673
+ return openBlock(), createElementBlock(Fragment, null, [withDirectives(createElementVNode("tr", mergeProps(_ctx.$attrs, {
1674
+ ref: "rowEl",
1675
+ tabindex: __props.tabIndex,
1676
+ class: ["atable-row", { "atable-row-clickable": isClickable.value }],
1677
+ onClick: onRowClick
1678
+ }), [
1679
+ showRowActions.value && actionsPosition.value === "before-index" ? (openBlock(), createBlock(ARowActions_default, {
1680
+ key: 0,
1681
+ "row-index": __props.rowIndex,
1682
+ store: __props.store,
1683
+ config: rowActionsConfig.value,
1684
+ position: actionsPosition.value,
1685
+ onAction: onRowAction
1686
+ }, null, 8, [
1687
+ "row-index",
1688
+ "store",
1689
+ "config",
1690
+ "position"
1691
+ ])) : createCommentVNode("", true),
1692
+ __props.store.config.view !== "uncounted" ? renderSlot(_ctx.$slots, "index", {}, () => [__props.store.config.view === "list" ? (openBlock(), createElementBlock("td", {
1693
+ key: 0,
1694
+ tabIndex: -1,
1695
+ class: normalizeClass(["list-index", __props.store.hasPinnedColumns ? "sticky-index" : ""])
1696
+ }, toDisplayString(__props.rowIndex + 1), 3)) : __props.store.isTreeView ? (openBlock(), createElementBlock("td", {
1697
+ key: 1,
1698
+ tabIndex: -1,
1699
+ class: normalizeClass(["tree-index", __props.store.hasPinnedColumns ? "sticky-index" : ""]),
1700
+ onClick: _cache[0] || (_cache[0] = ($event) => __props.store.toggleRowExpand(__props.rowIndex))
1701
+ }, toDisplayString(rowExpandSymbol.value), 3)) : __props.store.config.view === "list-expansion" ? (openBlock(), createElementBlock("td", {
1702
+ key: 2,
1703
+ tabIndex: -1,
1704
+ class: normalizeClass(["expansion-index", __props.store.hasPinnedColumns ? "sticky-index" : ""]),
1705
+ onClick: _cache[1] || (_cache[1] = ($event) => __props.store.toggleRowExpand(__props.rowIndex))
1706
+ }, toDisplayString(rowExpandSymbol.value), 3)) : createCommentVNode("", true)], true, 1) : createCommentVNode("", true),
1707
+ showRowActions.value && actionsPosition.value === "after-index" ? (openBlock(), createBlock(ARowActions_default, {
1708
+ key: 2,
1709
+ "row-index": __props.rowIndex,
1710
+ store: __props.store,
1711
+ config: rowActionsConfig.value,
1712
+ position: actionsPosition.value,
1713
+ onAction: onRowAction
1714
+ }, null, 8, [
1715
+ "row-index",
1716
+ "store",
1717
+ "config",
1718
+ "position"
1719
+ ])) : createCommentVNode("", true),
1720
+ renderSlot(_ctx.$slots, "default", {}, void 0, true),
1721
+ showRowActions.value && actionsPosition.value === "end" ? (openBlock(), createBlock(ARowActions_default, {
1722
+ key: 3,
1723
+ "row-index": __props.rowIndex,
1724
+ store: __props.store,
1725
+ config: rowActionsConfig.value,
1726
+ position: actionsPosition.value,
1727
+ onAction: onRowAction
1728
+ }, null, 8, [
1729
+ "row-index",
1730
+ "store",
1731
+ "config",
1732
+ "position"
1733
+ ])) : createCommentVNode("", true)
1734
+ ], 16, _hoisted_1$7), [[vShow, isRowVisible.value]]), isExpanded.value ? (openBlock(), createElementBlock("tr", {
1735
+ key: 0,
1736
+ tabindex: __props.tabIndex,
1737
+ class: "atable-expanded-row"
1738
+ }, [createElementVNode("td", {
1739
+ tabIndex: -1,
1740
+ colspan: expandedColspan.value,
1741
+ class: "atable-expanded-content"
1742
+ }, [renderSlot(_ctx.$slots, "content", {
1743
+ row: __props.store.rows[__props.rowIndex],
1744
+ rowIndex: __props.rowIndex,
1745
+ store: __props.store
1746
+ }, void 0, true)], 8, _hoisted_3$4)], 8, _hoisted_2$6)) : createCommentVNode("", true)], 64);
1747
+ };
1748
+ }
1749
+ }), [["__scopeId", "data-v-f159cfbe"]]);
1750
+ //#endregion
1751
+ //#region src/components/AGanttConnection.vue?vue&type=script&setup=true&lang.ts
1752
+ var _hoisted_1$6 = { class: "gantt-connection-overlay" };
1753
+ var _hoisted_2$5 = {
1754
+ class: "connection-svg",
1755
+ style: {
1756
+ position: "absolute",
1757
+ top: 0,
1758
+ left: 0,
1759
+ width: "100%",
1760
+ height: "100%",
1761
+ pointerEvents: "none",
1762
+ zIndex: 1
1763
+ }
1764
+ };
1765
+ var _hoisted_3$3 = [
1766
+ "d",
1767
+ "stroke-width",
1768
+ "onDblclick"
1769
+ ];
1770
+ var _hoisted_4$3 = [
1771
+ "id",
1772
+ "d",
1773
+ "stroke",
1774
+ "stroke-width",
1775
+ "onDblclick"
1776
+ ];
1777
+ var BEZIER_CURVE_FACTOR = .25;
1778
+ var CONNECTION_HANDLE_SIZE = 16;
1779
+ //#endregion
1780
+ //#region src/components/AGanttConnection.vue
1781
+ var AGanttConnection_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
1782
+ __name: "AGanttConnection",
1783
+ props: { store: {} },
1784
+ emits: ["connection:delete"],
1785
+ setup(__props, { emit: __emit }) {
1786
+ const emit = __emit;
1787
+ const visibleConnections = computed(() => {
1788
+ return __props.store.connectionPaths.filter((connection) => {
1789
+ const fromBar = __props.store.ganttBars.find((bar) => bar.id === connection.from.barId);
1790
+ const toBar = __props.store.ganttBars.find((bar) => bar.id === connection.to.barId);
1791
+ return fromBar && toBar;
1792
+ });
1793
+ });
1794
+ const getPathData = (connection) => {
1795
+ const fromHandle = __props.store.connectionHandles.find((handle) => handle.barId === connection.from.barId && handle.side === connection.from.side);
1796
+ const toHandle = __props.store.connectionHandles.find((handle) => handle.barId === connection.to.barId && handle.side === connection.to.side);
1797
+ if (!fromHandle || !toHandle) return "";
1798
+ const fromX = fromHandle.position.x + CONNECTION_HANDLE_SIZE / 2;
1799
+ const fromY = fromHandle.position.y + CONNECTION_HANDLE_SIZE / 2;
1800
+ const toX = toHandle.position.x + CONNECTION_HANDLE_SIZE / 2;
1801
+ const toY = toHandle.position.y + CONNECTION_HANDLE_SIZE / 2;
1802
+ const deltaX = Math.abs(toX - fromX);
1803
+ const controlPointOffset = Math.max(deltaX * BEZIER_CURVE_FACTOR, 50);
1804
+ const cp1X = fromX + (connection.from.side === "left" ? -controlPointOffset : controlPointOffset);
1805
+ const cp2X = toX + (connection.to.side === "left" ? -controlPointOffset : controlPointOffset);
1806
+ const m0 = {
1807
+ x: .5 * fromX + .5 * cp1X,
1808
+ y: .5 * fromY + .5 * fromY
1809
+ };
1810
+ const m1 = {
1811
+ x: .5 * cp1X + .5 * cp2X,
1812
+ y: .5 * fromY + .5 * toY
1813
+ };
1814
+ const m2 = {
1815
+ x: .5 * cp2X + .5 * toX,
1816
+ y: .5 * toY + .5 * toY
1817
+ };
1818
+ const m3 = {
1819
+ x: .5 * m0.x + .5 * m1.x,
1820
+ y: .5 * m0.y + .5 * m1.y
1821
+ };
1822
+ const m4 = {
1823
+ x: .5 * m1.x + .5 * m2.x,
1824
+ y: .5 * m1.y + .5 * m2.y
1825
+ };
1826
+ const midpoint = {
1827
+ x: .5 * m3.x + .5 * m4.x,
1828
+ y: .5 * m3.y + .5 * m4.y
1829
+ };
1830
+ return `M ${fromX} ${fromY} Q ${cp1X} ${fromY}, ${midpoint.x} ${midpoint.y} Q ${cp2X} ${toY}, ${toX} ${toY}`;
1831
+ };
1832
+ const handleConnectionDelete = (connection) => {
1833
+ if (__props.store.deleteConnection(connection.id)) emit("connection:delete", connection);
1834
+ };
1835
+ return (_ctx, _cache) => {
1836
+ return openBlock(), createElementBlock("div", _hoisted_1$6, [(openBlock(), createElementBlock("svg", _hoisted_2$5, [
1837
+ _cache[0] || (_cache[0] = createElementVNode("defs", null, [createElementVNode("path", {
1838
+ id: "arrowhead",
1839
+ d: "M 0 -7 L 20 0 L 0 7Z",
1840
+ stroke: "black",
1841
+ "stroke-width": "1",
1842
+ fill: "currentColor"
1843
+ }), createElementVNode("marker", {
1844
+ id: "arrowhead-marker",
1845
+ markerWidth: "10",
1846
+ markerHeight: "7",
1847
+ refX: "5",
1848
+ refY: "3.5",
1849
+ orient: "auto",
1850
+ markerUnits: "strokeWidth"
1851
+ }, [createElementVNode("polygon", {
1852
+ points: "0 0, 10 3.5, 0 7",
1853
+ fill: "currentColor"
1854
+ })])], -1)),
1855
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleConnections.value, (connection) => {
1856
+ return openBlock(), createElementBlock("path", {
1857
+ key: `${connection.id}-hitbox`,
1858
+ d: getPathData(connection),
1859
+ stroke: "transparent",
1860
+ "stroke-width": (connection.style?.width || 2) + 10,
1861
+ fill: "none",
1862
+ class: "connection-hitbox",
1863
+ onDblclick: ($event) => handleConnectionDelete(connection)
1864
+ }, null, 40, _hoisted_3$3);
1865
+ }), 128)),
1866
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleConnections.value, (connection) => {
1867
+ return openBlock(), createElementBlock("path", {
1868
+ id: connection.id,
1869
+ key: connection.id,
1870
+ d: getPathData(connection),
1871
+ stroke: connection.style?.color || "#666",
1872
+ "stroke-width": connection.style?.width || 2,
1873
+ fill: "none",
1874
+ "marker-mid": "url(#arrowhead-marker)",
1875
+ class: "connection-path animated-path",
1876
+ onDblclick: ($event) => handleConnectionDelete(connection)
1877
+ }, null, 40, _hoisted_4$3);
1878
+ }), 128))
1879
+ ]))]);
1880
+ };
1881
+ }
1882
+ }), [["__scopeId", "data-v-d5929c98"]]);
1883
+ //#endregion
1884
+ //#region src/components/ATableColumnFilter.vue?vue&type=script&setup=true&lang.ts
1885
+ var _hoisted_1$5 = { class: "column-filter" };
1886
+ var _hoisted_2$4 = {
1887
+ key: 2,
1888
+ class: "checkbox-filter"
1889
+ };
1890
+ var _hoisted_3$2 = ["value"];
1891
+ var _hoisted_4$2 = {
1892
+ key: 5,
1893
+ class: "date-range-filter"
1894
+ };
1895
+ //#endregion
1896
+ //#region src/components/ATableColumnFilter.vue
1897
+ var ATableColumnFilter_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
1898
+ __name: "ATableColumnFilter",
1899
+ props: {
1900
+ column: {},
1901
+ colIndex: {},
1902
+ store: {}
1903
+ },
1904
+ setup(__props) {
1905
+ const filterValue = ref("");
1906
+ const dateFilter = reactive({
1907
+ startValue: "",
1908
+ endValue: ""
1909
+ });
1910
+ const resolvedFilterType = computed(() => resolveFilterType(__props.column));
1911
+ const getSelectOptions = (col) => {
1912
+ if (col.filterOptions) return col.filterOptions;
1913
+ const uniqueValues = /* @__PURE__ */ new Set();
1914
+ __props.store.rows.forEach((row) => {
1915
+ const value = row[col.name];
1916
+ if (value !== null && value !== void 0 && value !== "") uniqueValues.add(value);
1917
+ });
1918
+ return Array.from(uniqueValues).map((value) => ({
1919
+ value,
1920
+ label: String(value)
1921
+ }));
1922
+ };
1923
+ const hasActiveFilter = computed(() => {
1924
+ return !!(filterValue.value || dateFilter.startValue || dateFilter.endValue);
1925
+ });
1926
+ const updateFilter = (value) => {
1927
+ if (!value && resolvedFilterType.value !== "checkbox") {
1928
+ __props.store.clearFilter(__props.colIndex);
1929
+ filterValue.value = "";
1930
+ } else {
1931
+ filterValue.value = value;
1932
+ __props.store.setFilter(__props.colIndex, { value });
1933
+ }
1934
+ };
1935
+ const updateDateRangeFilter = (rangeType, value) => {
1936
+ if (rangeType === "start") dateFilter.startValue = value;
1937
+ else dateFilter.endValue = value;
1938
+ if (!dateFilter.startValue && !dateFilter.endValue) __props.store.clearFilter(__props.colIndex);
1939
+ else __props.store.setFilter(__props.colIndex, {
1940
+ value: null,
1941
+ startValue: dateFilter.startValue,
1942
+ endValue: dateFilter.endValue
1943
+ });
1944
+ };
1945
+ const clearFilter = () => {
1946
+ filterValue.value = "";
1947
+ dateFilter.startValue = "";
1948
+ dateFilter.endValue = "";
1949
+ __props.store.clearFilter(__props.colIndex);
1950
+ };
1951
+ return (_ctx, _cache) => {
1952
+ return openBlock(), createElementBlock("div", _hoisted_1$5, [resolvedFilterType.value === "text" ? withDirectives((openBlock(), createElementBlock("input", {
1953
+ key: 0,
1954
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterValue.value = $event),
1955
+ type: "text",
1956
+ class: "filter-input",
1957
+ onInput: _cache[1] || (_cache[1] = ($event) => updateFilter(filterValue.value))
1958
+ }, null, 544)), [[vModelText, filterValue.value]]) : resolvedFilterType.value === "number" ? withDirectives((openBlock(), createElementBlock("input", {
1959
+ key: 1,
1960
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => filterValue.value = $event),
1961
+ type: "number",
1962
+ class: "filter-input",
1963
+ onInput: _cache[3] || (_cache[3] = ($event) => updateFilter(filterValue.value))
1964
+ }, null, 544)), [[vModelText, filterValue.value]]) : resolvedFilterType.value === "checkbox" ? (openBlock(), createElementBlock("label", _hoisted_2$4, [withDirectives(createElementVNode("input", {
1965
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => filterValue.value = $event),
1966
+ type: "checkbox",
1967
+ class: "filter-checkbox",
1968
+ onChange: _cache[5] || (_cache[5] = ($event) => updateFilter(filterValue.value))
1969
+ }, null, 544), [[vModelCheckbox, filterValue.value]]), createElementVNode("span", null, toDisplayString(__props.column.label), 1)])) : resolvedFilterType.value === "select" ? withDirectives((openBlock(), createElementBlock("select", {
1970
+ key: 3,
1971
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => filterValue.value = $event),
1972
+ class: "filter-select",
1973
+ onChange: _cache[7] || (_cache[7] = ($event) => updateFilter(filterValue.value))
1974
+ }, [_cache[15] || (_cache[15] = createElementVNode("option", { value: "" }, "All", -1)), (openBlock(true), createElementBlock(Fragment, null, renderList(getSelectOptions(__props.column), (option) => {
1975
+ return openBlock(), createElementBlock("option", {
1976
+ key: option.value || option,
1977
+ value: option.value || option
1978
+ }, toDisplayString(option.label || option), 9, _hoisted_3$2);
1979
+ }), 128))], 544)), [[vModelSelect, filterValue.value]]) : resolvedFilterType.value === "date" ? withDirectives((openBlock(), createElementBlock("input", {
1980
+ key: 4,
1981
+ "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => filterValue.value = $event),
1982
+ type: "date",
1983
+ class: "filter-input",
1984
+ onChange: _cache[9] || (_cache[9] = ($event) => updateFilter(filterValue.value))
1985
+ }, null, 544)), [[vModelText, filterValue.value]]) : resolvedFilterType.value === "dateRange" ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
1986
+ withDirectives(createElementVNode("input", {
1987
+ "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => dateFilter.startValue = $event),
1988
+ type: "date",
1989
+ class: "filter-input",
1990
+ onChange: _cache[11] || (_cache[11] = ($event) => updateDateRangeFilter("start", dateFilter.startValue))
1991
+ }, null, 544), [[vModelText, dateFilter.startValue]]),
1992
+ _cache[16] || (_cache[16] = createElementVNode("span", { class: "date-separator" }, "-", -1)),
1993
+ withDirectives(createElementVNode("input", {
1994
+ "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => dateFilter.endValue = $event),
1995
+ type: "date",
1996
+ class: "filter-input",
1997
+ onChange: _cache[13] || (_cache[13] = ($event) => updateDateRangeFilter("end", dateFilter.endValue))
1998
+ }, null, 544), [[vModelText, dateFilter.endValue]])
1999
+ ])) : resolvedFilterType.value === "component" && __props.column.filterComponent ? (openBlock(), createBlock(resolveDynamicComponent(__props.column.filterComponent), {
2000
+ key: 6,
2001
+ value: filterValue.value,
2002
+ column: __props.column,
2003
+ "col-index": __props.colIndex,
2004
+ store: __props.store,
2005
+ "onUpdate:value": _cache[14] || (_cache[14] = ($event) => updateFilter($event))
2006
+ }, null, 40, [
2007
+ "value",
2008
+ "column",
2009
+ "col-index",
2010
+ "store"
2011
+ ])) : createCommentVNode("", true), hasActiveFilter.value ? (openBlock(), createElementBlock("button", {
2012
+ key: 7,
2013
+ class: "clear-btn",
2014
+ title: "Clear",
2015
+ onClick: clearFilter
2016
+ }, "×")) : createCommentVNode("", true)]);
2017
+ };
2018
+ }
2019
+ }), [["__scopeId", "data-v-f9c23db9"]]);
2020
+ //#endregion
2021
+ //#region src/components/ATableHeader.vue?vue&type=script&setup=true&lang.ts
2022
+ var _hoisted_1$4 = { key: 0 };
2023
+ var _hoisted_2$3 = {
2024
+ class: "atable-header-row",
2025
+ tabindex: "-1"
2026
+ };
2027
+ var _hoisted_3$1 = {
2028
+ key: 2,
2029
+ class: "row-actions-header"
2030
+ };
2031
+ var _hoisted_4$1 = ["data-colindex", "onClick"];
2032
+ var _hoisted_5$1 = {
2033
+ key: 3,
2034
+ class: "row-actions-header"
2035
+ };
2036
+ var _hoisted_6$1 = {
2037
+ key: 0,
2038
+ class: "atable-filters-row"
2039
+ };
2040
+ var _hoisted_7$1 = {
2041
+ key: 2,
2042
+ class: "row-actions-header"
2043
+ };
2044
+ var _hoisted_8 = {
2045
+ key: 3,
2046
+ class: "row-actions-header"
2047
+ };
2048
+ //#endregion
2049
+ //#region src/components/ATableHeader.vue
2050
+ var ATableHeader_default = /* @__PURE__ */ defineComponent({
2051
+ __name: "ATableHeader",
2052
+ props: {
2053
+ columns: {},
2054
+ store: {}
2055
+ },
2056
+ setup(__props) {
2057
+ const filterableColumns = computed(() => __props.columns.filter((column) => column.filterable));
2058
+ const showRowActionsHeader = computed(() => __props.store.config.rowActions?.enabled ?? false);
2059
+ const rowActionsPosition = computed(() => __props.store.config.rowActions?.position ?? "before-index");
2060
+ const handleSort = (colIndex) => __props.store.sortByColumn(colIndex);
2061
+ const onResize = (entries) => {
2062
+ for (const entry of entries) {
2063
+ if (entry.borderBoxSize.length === 0) continue;
2064
+ const observedWidth = entry.borderBoxSize[0].inlineSize;
2065
+ const colIndex = Number(entry.target.dataset.colindex);
2066
+ const currentWidth = __props.store.columns[colIndex]?.width;
2067
+ if (typeof currentWidth === "number" && currentWidth !== observedWidth) __props.store.resizeColumn(colIndex, observedWidth);
2068
+ }
2069
+ };
2070
+ return (_ctx, _cache) => {
2071
+ return __props.columns.length ? (openBlock(), createElementBlock("thead", _hoisted_1$4, [createElementVNode("tr", _hoisted_2$3, [
2072
+ showRowActionsHeader.value && rowActionsPosition.value === "before-index" ? (openBlock(), createElementBlock("th", {
2073
+ key: 0,
2074
+ class: normalizeClass(["row-actions-header", { "sticky-column": rowActionsPosition.value === "before-index" }])
2075
+ }, null, 2)) : createCommentVNode("", true),
2076
+ __props.store.zeroColumn ? (openBlock(), createElementBlock("th", {
2077
+ key: 1,
2078
+ id: "header-index",
2079
+ class: normalizeClass([[
2080
+ __props.store.hasPinnedColumns ? "sticky-index" : "",
2081
+ __props.store.isTreeView ? "tree-index" : "",
2082
+ __props.store.config.view === "list-expansion" ? "list-expansion-index" : ""
2083
+ ], "list-index"])
2084
+ }, null, 2)) : createCommentVNode("", true),
2085
+ showRowActionsHeader.value && rowActionsPosition.value === "after-index" ? (openBlock(), createElementBlock("th", _hoisted_3$1)) : createCommentVNode("", true),
2086
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column, colKey) => {
2087
+ return withDirectives((openBlock(), createElementBlock("th", {
2088
+ key: column.name,
2089
+ "data-colindex": colKey,
2090
+ tabindex: "-1",
2091
+ style: normalizeStyle(__props.store.getHeaderCellStyle(column)),
2092
+ class: normalizeClass(`${column.pinned ? "sticky-column" : ""} ${column.sortable === false ? "" : "cursor-pointer"}`),
2093
+ onClick: ($event) => column.sortable !== false ? handleSort(colKey) : void 0
2094
+ }, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(column.label || String.fromCharCode(colKey + 97).toUpperCase()), 1)])], 14, _hoisted_4$1)), [[unref(vResizeObserver), onResize]]);
2095
+ }), 128)),
2096
+ showRowActionsHeader.value && rowActionsPosition.value === "end" ? (openBlock(), createElementBlock("th", _hoisted_5$1)) : createCommentVNode("", true)
2097
+ ]), filterableColumns.value.length > 0 ? (openBlock(), createElementBlock("tr", _hoisted_6$1, [
2098
+ showRowActionsHeader.value && rowActionsPosition.value === "before-index" ? (openBlock(), createElementBlock("th", {
2099
+ key: 0,
2100
+ class: normalizeClass(["row-actions-header", { "sticky-column": rowActionsPosition.value === "before-index" }])
2101
+ }, null, 2)) : createCommentVNode("", true),
2102
+ __props.store.zeroColumn ? (openBlock(), createElementBlock("th", {
2103
+ key: 1,
2104
+ class: normalizeClass([[
2105
+ __props.store.hasPinnedColumns ? "sticky-index" : "",
2106
+ __props.store.isTreeView ? "tree-index" : "",
2107
+ __props.store.config.view === "list-expansion" ? "list-expansion-index" : ""
2108
+ ], "list-index"])
2109
+ }, null, 2)) : createCommentVNode("", true),
2110
+ showRowActionsHeader.value && rowActionsPosition.value === "after-index" ? (openBlock(), createElementBlock("th", _hoisted_7$1)) : createCommentVNode("", true),
2111
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column, colKey) => {
2112
+ return openBlock(), createElementBlock("th", {
2113
+ key: `filter-${column.name}`,
2114
+ class: normalizeClass(`${column.pinned ? "sticky-column" : ""}`),
2115
+ style: normalizeStyle(__props.store.getHeaderCellStyle(column))
2116
+ }, [column.filterable ? (openBlock(), createBlock(ATableColumnFilter_default, {
2117
+ key: 0,
2118
+ column,
2119
+ "col-index": colKey,
2120
+ store: __props.store
2121
+ }, null, 8, [
2122
+ "column",
2123
+ "col-index",
2124
+ "store"
2125
+ ])) : createCommentVNode("", true)], 6);
2126
+ }), 128)),
2127
+ showRowActionsHeader.value && rowActionsPosition.value === "end" ? (openBlock(), createElementBlock("th", _hoisted_8)) : createCommentVNode("", true)
2128
+ ])) : createCommentVNode("", true)])) : createCommentVNode("", true);
2129
+ };
2130
+ }
2131
+ });
2132
+ //#endregion
2133
+ //#region src/components/ATableModal.vue
2134
+ var ATableModal_default = /* @__PURE__ */ defineComponent({
2135
+ __name: "ATableModal",
2136
+ props: { store: {} },
2137
+ setup(__props) {
2138
+ const amodalRef = useTemplateRef("amodal");
2139
+ const { width: modalWidth, height: modalHeight } = useElementBounding(amodalRef);
2140
+ const amodalStyles = computed(() => {
2141
+ if (!(__props.store.modal.height && __props.store.modal.width && __props.store.modal.left && __props.store.modal.bottom)) return {};
2142
+ const table = __props.store.modal.cell?.closest("table");
2143
+ if (!table) return {};
2144
+ const maxHeight = table.offsetHeight || 0;
2145
+ const maxWidth = table.offsetWidth || 0;
2146
+ let modalY = __props.store.modal.cell?.offsetTop || 0;
2147
+ const headerHeight = table.querySelector("thead")?.offsetHeight || 0;
2148
+ modalY += headerHeight;
2149
+ modalY = modalY + modalHeight.value < maxHeight ? modalY : modalY - (modalHeight.value + __props.store.modal.height);
2150
+ let modalX = __props.store.modal.cell?.offsetLeft || 0;
2151
+ modalX = modalX + modalWidth.value <= maxWidth ? modalX : modalX - (modalWidth.value - __props.store.modal.width);
2152
+ return {
2153
+ left: `${modalX}px`,
2154
+ top: `${modalY}px`
2155
+ };
2156
+ });
2157
+ return (_ctx, _cache) => {
2158
+ return openBlock(), createElementBlock("div", {
2159
+ ref: "amodal",
2160
+ class: "amodal",
2161
+ tabindex: "-1",
2162
+ style: normalizeStyle(amodalStyles.value),
2163
+ onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"])),
2164
+ onInput: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
2165
+ }, [renderSlot(_ctx.$slots, "default")], 36);
2166
+ };
2167
+ }
2168
+ });
2169
+ //#endregion
2170
+ //#region src/components/ATablePaginationFooter.vue?vue&type=script&setup=true&lang.ts
2171
+ var _hoisted_1$3 = {
2172
+ key: 0,
2173
+ class: "atable-pagination"
2174
+ };
2175
+ var _hoisted_2$2 = ["colspan"];
2176
+ var _hoisted_3 = {
2177
+ key: 0,
2178
+ class: "truncation-note"
2179
+ };
2180
+ var _hoisted_4 = {
2181
+ key: 1,
2182
+ class: "completion-note"
2183
+ };
2184
+ var _hoisted_5 = {
2185
+ key: 2,
2186
+ class: "atable-pagination-controls"
2187
+ };
2188
+ var _hoisted_6 = ["disabled"];
2189
+ var _hoisted_7 = ["disabled"];
2190
+ //#endregion
2191
+ //#region src/components/ATablePaginationFooter.vue
2192
+ var ATablePaginationFooter_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
2193
+ __name: "ATablePaginationFooter",
2194
+ props: {
2195
+ columnCount: {},
2196
+ showFooter: { type: Boolean },
2197
+ hasMore: { type: Boolean },
2198
+ hasPrev: { type: Boolean },
2199
+ hasNext: { type: Boolean },
2200
+ hasLocalNext: { type: Boolean },
2201
+ hasEverHadMore: { type: Boolean },
2202
+ loadedCount: {},
2203
+ loading: { type: Boolean },
2204
+ next: { type: Function },
2205
+ prev: { type: Function }
2206
+ },
2207
+ setup(__props) {
2208
+ const props = __props;
2209
+ const showCompleteNote = computed(() => !props.hasMore && props.hasEverHadMore);
2210
+ const showControls = computed(() => props.hasMore || props.hasPrev);
2211
+ const onNext = () => {
2212
+ props.next();
2213
+ };
2214
+ return (_ctx, _cache) => {
2215
+ return __props.showFooter ? (openBlock(), createElementBlock("tfoot", _hoisted_1$3, [createElementVNode("tr", null, [createElementVNode("td", { colspan: __props.columnCount }, [__props.hasMore ? (openBlock(), createElementBlock("p", _hoisted_3, "This is a partial list — more records exist on the server.")) : showCompleteNote.value ? (openBlock(), createElementBlock("p", _hoisted_4, "All " + toDisplayString(__props.loadedCount) + " records loaded.", 1)) : createCommentVNode("", true), showControls.value ? (openBlock(), createElementBlock("div", _hoisted_5, [createElementVNode("button", {
2216
+ type: "button",
2217
+ class: "atable-pagination-btn",
2218
+ disabled: !__props.hasPrev || __props.loading,
2219
+ onClick: _cache[0] || (_cache[0] = (...args) => __props.prev && __props.prev(...args))
2220
+ }, " Previous ", 8, _hoisted_6), createElementVNode("button", {
2221
+ type: "button",
2222
+ class: "atable-pagination-btn",
2223
+ disabled: !__props.hasNext || __props.loading,
2224
+ onClick: onNext
2225
+ }, toDisplayString(__props.hasMore && !__props.hasLocalNext ? "Load more" : "Next"), 9, _hoisted_7)])) : createCommentVNode("", true)], 8, _hoisted_2$2)])])) : createCommentVNode("", true);
2226
+ };
2227
+ }
2228
+ }), [["__scopeId", "data-v-e0e73858"]]);
2229
+ //#endregion
2230
+ //#region src/composables/table-pagination.ts
2231
+ /**
2232
+ * Window rows after filter/sort, and optionally walk {@link @stonecrop/schema#GetRecordsOptions} for the next page.
2233
+ * Pagination is not a filter — pass already-filtered rows.
2234
+ * @public
2235
+ */
2236
+ function useTablePagination(options) {
2237
+ const heldRows = computed(() => toValue(options.rows));
2238
+ const pageSize = computed(() => toValue(options.pageSize));
2239
+ const sourceKey = computed(() => toValue(options.sourceKey));
2240
+ const windowIndex = ref(0);
2241
+ const loading = ref(false);
2242
+ const serverHasMore = ref(false);
2243
+ const hasEverHadMore = ref(false);
2244
+ const lastFetchOffset = ref(0);
2245
+ const lastPageLength = ref(0);
2246
+ const loadedCount = computed(() => heldRows.value.length);
2247
+ const effectivePageSize = computed(() => {
2248
+ const size = pageSize.value;
2249
+ if (size != null && size > 0) return size;
2250
+ const count = heldRows.value.length;
2251
+ return count > 0 ? count : 1;
2252
+ });
2253
+ const windowCount = computed(() => Math.max(1, Math.ceil(heldRows.value.length / effectivePageSize.value)));
2254
+ const visibleRows = computed(() => {
2255
+ const start = windowIndex.value * effectivePageSize.value;
2256
+ return heldRows.value.slice(start, start + effectivePageSize.value);
2257
+ });
2258
+ const hasLocalNext = computed(() => windowIndex.value < windowCount.value - 1);
2259
+ const hasPrev = computed(() => windowIndex.value > 0);
2260
+ const hasNext = computed(() => hasLocalNext.value || Boolean(options.getRecords) && serverHasMore.value);
2261
+ const hasMore = computed(() => serverHasMore.value);
2262
+ const showFooter = computed(() => {
2263
+ if (options.getRecords) return serverHasMore.value || hasPrev.value || loading.value || hasEverHadMore.value && !serverHasMore.value;
2264
+ const size = pageSize.value;
2265
+ return size != null && size > 0 && heldRows.value.length > size;
2266
+ });
2267
+ const resetWindow = () => {
2268
+ windowIndex.value = 0;
2269
+ hasEverHadMore.value = false;
2270
+ };
2271
+ const fetchFromServer = async (fetchOptions) => {
2272
+ if (!options.getRecords) return;
2273
+ loading.value = true;
2274
+ try {
2275
+ const result = await options.getRecords(fetchOptions);
2276
+ serverHasMore.value = result.hasMore;
2277
+ if (result.hasMore) hasEverHadMore.value = true;
2278
+ lastFetchOffset.value = fetchOptions?.offset ?? 0;
2279
+ lastPageLength.value = result.data.length;
2280
+ } finally {
2281
+ loading.value = false;
2282
+ }
2283
+ };
2284
+ watch(() => sourceKey.value, () => {
2285
+ resetWindow();
2286
+ if (options.getRecords) fetchFromServer();
2287
+ }, { immediate: true });
2288
+ watch(heldRows, () => {
2289
+ if (windowIndex.value >= windowCount.value) windowIndex.value = Math.max(0, windowCount.value - 1);
2290
+ });
2291
+ const next = async () => {
2292
+ if (hasLocalNext.value) {
2293
+ windowIndex.value += 1;
2294
+ return;
2295
+ }
2296
+ if (options.getRecords && serverHasMore.value) {
2297
+ await fetchFromServer({ offset: lastFetchOffset.value + lastPageLength.value });
2298
+ await nextTick();
2299
+ windowIndex.value = Math.max(0, windowCount.value - 1);
2300
+ }
2301
+ };
2302
+ const prev = () => {
2303
+ if (windowIndex.value > 0) windowIndex.value -= 1;
2304
+ };
2305
+ return {
2306
+ visibleRows,
2307
+ hasPrev,
2308
+ hasNext,
2309
+ hasMore,
2310
+ loading,
2311
+ next,
2312
+ prev,
2313
+ showFooter,
2314
+ hasLocalNext,
2315
+ loadedCount,
2316
+ hasEverHadMore
2317
+ };
1610
2318
  }
1611
- function Vn(e) {
1612
- return e.filter((a) => !a.hidden && a.component).map(({ fieldname: a, hidden: i, ...g }) => {
1613
- const x = Object.assign({ name: a }, g);
1614
- return g.doctype && !g.cellComponent && (x.linkDoctype = g.doctype, g.format || (x.format = (s) => {
1615
- if (s == null) return "";
1616
- if (typeof s == "object") {
1617
- const l = s.displayText ?? s.id ?? "";
1618
- return typeof l == "string" || typeof l == "number" ? String(l) : "";
1619
- }
1620
- return String(s);
1621
- })), He(g.component) === "quantity" && !g.format && (x.format = nt), He(g.component) === "currency" && !g.format && (x.format = ot), x;
1622
- });
2319
+ //#endregion
2320
+ //#region src/schemaToColumns.ts
2321
+ /**
2322
+ * Convert an array of doctype field descriptors into ATable column definitions.
2323
+ *
2324
+ * Fields are excluded when:
2325
+ * - `hidden: true` — field should not be visible in any view
2326
+ * - no `component` — non-scalar entry (nested table or fieldset), no column equivalent
2327
+ *
2328
+ * `fieldname` is renamed to `name`; `hidden` is stripped. All other `ColumnSchema` properties
2329
+ * spread through automatically.
2330
+ *
2331
+ * For link fields (those carrying `doctype`) without an explicit `cellComponent`:
2332
+ * - `linkDoctype` is set from the field's `doctype` property (used by ACell's async resolver).
2333
+ * - A synchronous `format` function is added (unless the field already has one) that handles
2334
+ * both bare ID strings and pre-resolved `{ id, displayText }` objects.
2335
+ *
2336
+ * For quantity fields — those whose `component` carries the `'quantity'` category — without an
2337
+ * explicit `format`, a synchronous `format` is added that renders the `{ qty, uom }` value (see
2338
+ * `QuantityValue` in `@stonecrop/aform`) as `"<qty> <uom>"`.
2339
+ *
2340
+ * For currency fields — those whose `component` carries the `'currency'` category — without an
2341
+ * explicit `format`, a synchronous `format` is added that renders the `{ amount, currency }` value
2342
+ * (see `CurrencyValue` in `@stonecrop/aform`) as `"<amount> <currency>"`.
2343
+ *
2344
+ * @public
2345
+ */
2346
+ function schemaToColumns(schema) {
2347
+ return schema.filter((f) => !f.hidden && f.component).map(({ fieldname, hidden: _hidden, ...rest }) => {
2348
+ const col = Object.assign({ name: fieldname }, rest);
2349
+ if (rest.doctype && !rest.cellComponent) {
2350
+ col.linkDoctype = rest.doctype;
2351
+ if (!rest.format) col.format = (v) => {
2352
+ if (v === null || v === void 0) return "";
2353
+ if (typeof v === "object") {
2354
+ const display = v.displayText ?? v.id ?? "";
2355
+ return typeof display === "string" || typeof display === "number" ? String(display) : "";
2356
+ }
2357
+ return String(v);
2358
+ };
2359
+ }
2360
+ if (componentCategory(rest.component) === "quantity" && !rest.format) col.format = formatQuantity;
2361
+ if (componentCategory(rest.component) === "currency" && !rest.format) col.format = formatCurrency;
2362
+ return col;
2363
+ });
1623
2364
  }
1624
- const Pn = {
1625
- class: "atable-container",
1626
- style: { position: "relative" }
1627
- }, zn = /* @__PURE__ */ ge({
1628
- __name: "ATable",
1629
- props: /* @__PURE__ */ Qe({
1630
- id: { default: "" },
1631
- config: { default: () => new Object() },
1632
- schema: { default: () => [] },
1633
- linkResolver: { type: Function, default: void 0 },
1634
- getRecords: { type: Function, default: void 0 },
1635
- sourceKey: { default: () => {
1636
- } }
1637
- }, {
1638
- rows: { required: !0 },
1639
- rowsModifiers: {},
1640
- columns: {},
1641
- columnsModifiers: {}
1642
- }),
1643
- emits: /* @__PURE__ */ Qe(["cellUpdate", "gantt:drag", "connection:event", "columns:update", "row:add", "row:click", "row:delete", "row:duplicate", "row:insert-above", "row:insert-below", "row:move", "row:open"], ["update:rows", "update:columns"]),
1644
- setup(e, { expose: a, emit: i }) {
1645
- const g = Je(e, "rows"), x = Je(e, "columns"), s = i, l = re("table"), r = x.value?.length ? x.value : Vn(e.schema ?? []), f = gt("aformLinkResolver", null), n = Dt({
1646
- columns: r,
1647
- rows: g.value,
1648
- id: e.id,
1649
- config: e.config,
1650
- linkResolver: e.linkResolver ?? f
1651
- }), d = On({
1652
- rows: () => n.filteredRows,
1653
- pageSize: () => n.config.pageSize,
1654
- getRecords: e.getRecords,
1655
- sourceKey: () => e.sourceKey
1656
- }), {
1657
- visibleRows: u,
1658
- showFooter: B,
1659
- hasMore: K,
1660
- hasPrev: j,
1661
- hasNext: b,
1662
- hasLocalNext: C,
1663
- hasEverHadMore: M,
1664
- loadedCount: L,
1665
- loading: E,
1666
- next: O,
1667
- prev: V
1668
- } = d, W = y(() => n.columns.length + (n.zeroColumn ? 1 : 0));
1669
- n.$onAction(({ name: h, store: m, args: Z, after: R }) => {
1670
- if (h === "setCellData" || h === "setCellText") {
1671
- const [k, q, _] = Z, se = m.getCellData(k, q);
1672
- R(() => {
1673
- g.value = [...n.rows], s("cellUpdate", { colIndex: k, rowIndex: q, newValue: _, oldValue: se });
1674
- });
1675
- } else if (h === "updateGanttBar") {
1676
- const [k] = Z;
1677
- let q = !1;
1678
- k.type === "resize" ? q = k.oldColspan !== k.newColspan : k.type === "bar" && (q = k.oldStart !== k.newStart || k.oldEnd !== k.newEnd), q && R(() => {
1679
- s("gantt:drag", k);
1680
- });
1681
- } else h === "resizeColumn" && R(() => {
1682
- x.value = [...n.columns], s("columns:update", [...n.columns]);
1683
- });
1684
- }), Be(
1685
- () => g.value,
1686
- (h) => {
1687
- JSON.stringify(h) !== JSON.stringify(n.rows) && (n.rows = [...h]);
1688
- },
1689
- { deep: !0 }
1690
- ), Be(
1691
- x,
1692
- (h) => {
1693
- h && JSON.stringify(h) !== JSON.stringify(n.columns) && (n.columns = [...h], s("columns:update", [...h]));
1694
- },
1695
- { deep: !0 }
1696
- ), ze(() => {
1697
- x.value?.some((h) => h.pinned) && (z(), n.isTreeView && bt(l, z, { childList: !0, subtree: !0 }));
1698
- });
1699
- const H = y(() => n.columns.filter((h) => h.pinned).length), z = () => {
1700
- const h = l.value, m = h?.rows[0], Z = h?.rows[1], R = m ? Array.from(m.cells) : [];
1701
- for (const [k, q] of R.entries()) {
1702
- const _ = Z?.cells[k];
1703
- _ && (q.style.width = `${_.offsetWidth}px`);
1704
- }
1705
- for (const k of h?.rows || []) {
1706
- let q = 0;
1707
- const _ = [];
1708
- for (const se of k.cells)
1709
- (se.classList.contains("sticky-column") || se.classList.contains("sticky-index")) && (se.style.left = `${q}px`, q += se.offsetWidth, _.push(se));
1710
- _.length > 0 && _[_.length - 1].classList.add("sticky-column-edge");
1711
- }
1712
- };
1713
- window.addEventListener("keydown", (h) => {
1714
- if (h.key === "Escape" && n.modal.visible) {
1715
- n.modal.visible = !1;
1716
- const m = n.modal.parent;
1717
- m && Xe().then(() => m.focus());
1718
- }
1719
- });
1720
- const ce = (h) => {
1721
- if (!h.gantt || H.value === 0)
1722
- return n.columns;
1723
- const m = [];
1724
- for (let Z = 0; Z < H.value; Z++) {
1725
- const R = { ...n.columns[Z] };
1726
- R.originalIndex = Z, m.push(R);
1727
- }
1728
- return m.push({
1729
- ...n.columns[H.value],
1730
- isGantt: !0,
1731
- colspan: h.gantt?.colspan || n.columns.length - H.value,
1732
- originalIndex: H.value,
1733
- width: "auto"
1734
- // TODO: refactor to API that can detect when data exists in a cell. Might have be custom and not generalizable
1735
- }), m;
1736
- }, we = (h) => {
1737
- s("connection:event", { type: "create", connection: h });
1738
- }, Q = (h) => {
1739
- s("connection:event", { type: "delete", connection: h });
1740
- }, fe = (h, m) => {
1741
- const Z = n.rows[h];
1742
- s("row:click", { row: Z, rowIndex: h, event: m });
1743
- }, D = (h, m, Z) => {
1744
- switch (h) {
1745
- case "add": {
1746
- const R = n.addRow({}, m + 1), k = n.rows[R];
1747
- g.value = [...n.rows], s("row:add", { rowIndex: R, row: k });
1748
- break;
1749
- }
1750
- case "delete": {
1751
- const R = n.deleteRow(m);
1752
- R && (g.value = [...n.rows], s("row:delete", { rowIndex: m, row: R }));
1753
- break;
1754
- }
1755
- case "duplicate": {
1756
- const R = n.duplicateRow(m);
1757
- if (R >= 0) {
1758
- const k = n.rows[R];
1759
- g.value = [...n.rows], s("row:duplicate", { sourceIndex: m, newIndex: R, row: k });
1760
- }
1761
- break;
1762
- }
1763
- case "insertAbove": {
1764
- const R = n.insertRowAbove(m), k = n.rows[R];
1765
- g.value = [...n.rows], s("row:insert-above", { targetIndex: m, newIndex: R, row: k });
1766
- break;
1767
- }
1768
- case "insertBelow": {
1769
- const R = n.insertRowBelow(m), k = n.rows[R];
1770
- g.value = [...n.rows], s("row:insert-below", { targetIndex: m, newIndex: R, row: k });
1771
- break;
1772
- }
1773
- case "move": {
1774
- s("row:move", { fromIndex: m, toIndex: -1 });
1775
- break;
1776
- }
1777
- case "moveUp": {
1778
- m > 0 && n.moveRow(m, m - 1) && (g.value = [...n.rows], s("row:move", { fromIndex: m, toIndex: m - 1 }));
1779
- break;
1780
- }
1781
- case "moveDown": {
1782
- m < n.rows.length - 1 && n.moveRow(m, m + 1) && (g.value = [...n.rows], s("row:move", { fromIndex: m, toIndex: m + 1 }));
1783
- break;
1784
- }
1785
- case "open": {
1786
- const R = n.rows[m];
1787
- s("row:open", { row: R, rowIndex: m, event: Z });
1788
- break;
1789
- }
1790
- }
1791
- };
1792
- return a({
1793
- store: n,
1794
- pagination: d,
1795
- createConnection: n.createConnection,
1796
- deleteConnection: n.deleteConnection,
1797
- getConnectionsForBar: n.getConnectionsForBar,
1798
- getHandlesForBar: n.getHandlesForBar,
1799
- // Row action methods
1800
- addRow: n.addRow,
1801
- deleteRow: n.deleteRow,
1802
- duplicateRow: n.duplicateRow,
1803
- insertRowAbove: n.insertRowAbove,
1804
- insertRowBelow: n.insertRowBelow,
1805
- moveRow: n.moveRow
1806
- }), (h, m) => (v(), w("div", Pn, [
1807
- ie((v(), w("table", {
1808
- ref: "table",
1809
- class: "atable",
1810
- style: he({
1811
- width: $(n).config.fullWidth ? "100%" : "auto"
1812
- })
1813
- }, [
1814
- de(h.$slots, "header", { data: $(n) }, () => [
1815
- Fe(st, {
1816
- columns: $(n).columns,
1817
- store: $(n)
1818
- }, null, 8, ["columns", "store"])
1819
- ], !0),
1820
- T("tbody", null, [
1821
- de(h.$slots, "body", { data: $(n) }, () => [
1822
- (v(!0), w(ve, null, me($(u), (Z, R) => (v(), ae(at, {
1823
- key: `${Z.originalIndex}-${R}`,
1824
- row: Z,
1825
- "row-index": Z.originalIndex,
1826
- store: $(n),
1827
- "onRow:action": D,
1828
- "onRow:click": fe
1829
- }, {
1830
- default: Ke(() => [
1831
- (v(!0), w(ve, null, me(ce(Z), (k, q) => (v(), w(ve, {
1832
- key: k.name
1833
- }, [
1834
- k.isGantt ? (v(), ae(ye(k.ganttComponent || "AGanttCell"), {
1835
- key: 0,
1836
- store: $(n),
1837
- "columns-count": $(n).columns.length - H.value,
1838
- color: Z.gantt?.color,
1839
- start: Z.gantt?.startIndex,
1840
- end: Z.gantt?.endIndex,
1841
- colspan: k.colspan,
1842
- pinned: k.pinned,
1843
- "row-index": Z.originalIndex,
1844
- "col-index": k.originalIndex ?? q,
1845
- style: he({
1846
- textAlign: k?.align || "center",
1847
- minWidth: k?.width || "40ch",
1848
- width: $(n).config.fullWidth ? "auto" : null
1849
- }),
1850
- "onConnection:create": we
1851
- }, null, 40, ["store", "columns-count", "color", "start", "end", "colspan", "pinned", "row-index", "col-index", "style"])) : (v(), ae(ye(k.cellComponent || "ACell"), {
1852
- key: 1,
1853
- store: $(n),
1854
- pinned: k.pinned,
1855
- "row-index": Z.originalIndex,
1856
- "col-index": q,
1857
- style: he({
1858
- textAlign: k?.align || "center",
1859
- width: $(n).config.fullWidth ? "auto" : null
1860
- }),
1861
- spellcheck: "false"
1862
- }, null, 8, ["store", "pinned", "row-index", "col-index", "style"]))
1863
- ], 64))), 128))
1864
- ]),
1865
- _: 2
1866
- }, 1032, ["row", "row-index", "store"]))), 128))
1867
- ], !0)
1868
- ]),
1869
- de(h.$slots, "footer", {
1870
- data: $(n),
1871
- page: $(d)
1872
- }, () => [
1873
- Fe(rt, {
1874
- "column-count": W.value,
1875
- "show-footer": $(B),
1876
- "has-more": $(K),
1877
- "has-prev": $(j),
1878
- "has-next": $(b),
1879
- "has-local-next": $(C),
1880
- "has-ever-had-more": $(M),
1881
- "loaded-count": $(L),
1882
- loading: $(E),
1883
- next: $(O),
1884
- prev: $(V)
1885
- }, null, 8, ["column-count", "show-footer", "has-more", "has-prev", "has-next", "has-local-next", "has-ever-had-more", "loaded-count", "loading", "next", "prev"])
1886
- ], !0),
1887
- de(h.$slots, "modal", { data: $(n) }, () => [
1888
- ie(Fe(it, { store: $(n) }, {
1889
- default: Ke(() => [
1890
- (v(), ae(ye($(n).modal.component), ke({
1891
- key: `${$(n).modal.rowIndex}:${$(n).modal.colIndex}`,
1892
- "col-index": $(n).modal.colIndex,
1893
- "row-index": $(n).modal.rowIndex,
1894
- store: $(n)
1895
- }, $(n).modal.componentProps), null, 16, ["col-index", "row-index", "store"]))
1896
- ]),
1897
- _: 1
1898
- }, 8, ["store"]), [
1899
- [Ge, $(n).modal.visible]
1900
- ])
1901
- ], !0)
1902
- ], 4)), [
1903
- [$(pt), $(n).closeModal]
1904
- ]),
1905
- $(n).isGanttView && $(n).isDependencyGraphEnabled ? (v(), ae(mn, {
1906
- key: 0,
1907
- store: $(n),
1908
- "onConnection:delete": Q
1909
- }, null, 8, ["store"])) : U("", !0)
1910
- ]));
1911
- }
1912
- }), Xn = /* @__PURE__ */ xe(zn, [["__scopeId", "data-v-004f5f0f"]]), Gn = {}, jn = { class: "aloading" }, Wn = { class: "aloading-header" };
1913
- function Un(e, a) {
1914
- return v(), w("div", jn, [
1915
- T("h2", Wn, [
1916
- de(e.$slots, "default", {}, void 0, !0)
1917
- ]),
1918
- a[0] || (a[0] = T("div", { class: "aloading-bar" }, null, -1))
1919
- ]);
2365
+ //#endregion
2366
+ //#region src/components/ATable.vue?vue&type=script&setup=true&lang.ts
2367
+ var _hoisted_1$2 = {
2368
+ class: "atable-container",
2369
+ style: { "position": "relative" }
2370
+ };
2371
+ //#endregion
2372
+ //#region src/components/ATable.vue
2373
+ var ATable_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
2374
+ __name: "ATable",
2375
+ props: /*@__PURE__*/ mergeModels({
2376
+ id: { default: "" },
2377
+ config: { default: () => /* @__PURE__ */ new Object() },
2378
+ schema: { default: () => [] },
2379
+ linkResolver: {
2380
+ type: Function,
2381
+ default: void 0
2382
+ },
2383
+ getRecords: {
2384
+ type: Function,
2385
+ default: void 0
2386
+ },
2387
+ sourceKey: { default: () => void 0 }
2388
+ }, {
2389
+ "rows": { required: true },
2390
+ "rowsModifiers": {},
2391
+ "columns": {},
2392
+ "columnsModifiers": {}
2393
+ }),
2394
+ emits: /*@__PURE__*/ mergeModels([
2395
+ "cellUpdate",
2396
+ "gantt:drag",
2397
+ "connection:event",
2398
+ "columns:update",
2399
+ "row:add",
2400
+ "row:click",
2401
+ "row:delete",
2402
+ "row:duplicate",
2403
+ "row:insert-above",
2404
+ "row:insert-below",
2405
+ "row:move",
2406
+ "row:open"
2407
+ ], ["update:rows", "update:columns"]),
2408
+ setup(__props, { expose: __expose, emit: __emit }) {
2409
+ const rows = useModel(__props, "rows");
2410
+ const columns = useModel(__props, "columns");
2411
+ const emit = __emit;
2412
+ const tableRef = useTemplateRef("table");
2413
+ const resolvedColumns = columns.value?.length ? columns.value : schemaToColumns(__props.schema ?? []);
2414
+ const injectedLinkResolver = inject("aformLinkResolver", null);
2415
+ const store = createTableStore({
2416
+ columns: resolvedColumns,
2417
+ rows: rows.value,
2418
+ id: __props.id,
2419
+ config: __props.config,
2420
+ linkResolver: __props.linkResolver ?? injectedLinkResolver
2421
+ });
2422
+ const pagination = useTablePagination({
2423
+ rows: () => store.filteredRows,
2424
+ pageSize: () => store.config.pageSize,
2425
+ getRecords: __props.getRecords,
2426
+ sourceKey: () => __props.sourceKey
2427
+ });
2428
+ const { visibleRows, showFooter, hasMore, hasPrev, hasNext, hasLocalNext, hasEverHadMore, loadedCount, loading: paginationLoading, next: paginationNext, prev: paginationPrev } = pagination;
2429
+ const footerColumnCount = computed(() => store.columns.length + (store.zeroColumn ? 1 : 0));
2430
+ store.$onAction(({ name, store: storeInstance, args, after }) => {
2431
+ if (name === "setCellData" || name === "setCellText") {
2432
+ const [colIndex, rowIndex, newValue] = args;
2433
+ const oldValue = storeInstance.getCellData(colIndex, rowIndex);
2434
+ after(() => {
2435
+ rows.value = [...store.rows];
2436
+ emit("cellUpdate", {
2437
+ colIndex,
2438
+ rowIndex,
2439
+ newValue,
2440
+ oldValue
2441
+ });
2442
+ });
2443
+ } else if (name === "updateGanttBar") {
2444
+ const [event] = args;
2445
+ let shouldEmit = false;
2446
+ if (event.type === "resize") shouldEmit = event.oldColspan !== event.newColspan;
2447
+ else if (event.type === "bar") shouldEmit = event.oldStart !== event.newStart || event.oldEnd !== event.newEnd;
2448
+ if (shouldEmit) after(() => {
2449
+ emit("gantt:drag", event);
2450
+ });
2451
+ } else if (name === "resizeColumn") after(() => {
2452
+ columns.value = [...store.columns];
2453
+ emit("columns:update", [...store.columns]);
2454
+ });
2455
+ });
2456
+ watch(() => rows.value, (newRows) => {
2457
+ if (JSON.stringify(newRows) !== JSON.stringify(store.rows)) store.rows = [...newRows];
2458
+ }, { deep: true });
2459
+ watch(columns, (newColumns) => {
2460
+ if (!newColumns) return;
2461
+ if (JSON.stringify(newColumns) !== JSON.stringify(store.columns)) {
2462
+ store.columns = [...newColumns];
2463
+ emit("columns:update", [...newColumns]);
2464
+ }
2465
+ }, { deep: true });
2466
+ onMounted(() => {
2467
+ if (columns.value?.some((column) => column.pinned)) {
2468
+ assignStickyCellWidths();
2469
+ if (store.isTreeView) useMutationObserver(tableRef, assignStickyCellWidths, {
2470
+ childList: true,
2471
+ subtree: true
2472
+ });
2473
+ }
2474
+ });
2475
+ const pinnedColumnCount = computed(() => {
2476
+ return store.columns.filter((column) => column.pinned).length;
2477
+ });
2478
+ const assignStickyCellWidths = () => {
2479
+ const table = tableRef.value;
2480
+ const headerRow = table?.rows[0];
2481
+ const firstDataRow = table?.rows[1];
2482
+ const headerCells = headerRow ? Array.from(headerRow.cells) : [];
2483
+ for (const [index, headerCell] of headerCells.entries()) {
2484
+ const rowCell = firstDataRow?.cells[index];
2485
+ if (rowCell) headerCell.style.width = `${rowCell.offsetWidth}px`;
2486
+ }
2487
+ for (const row of table?.rows || []) {
2488
+ let totalWidth = 0;
2489
+ const pinnedCells = [];
2490
+ for (const column of row.cells) if (column.classList.contains("sticky-column") || column.classList.contains("sticky-index")) {
2491
+ column.style.left = `${totalWidth}px`;
2492
+ totalWidth += column.offsetWidth;
2493
+ pinnedCells.push(column);
2494
+ }
2495
+ if (pinnedCells.length > 0) pinnedCells[pinnedCells.length - 1].classList.add("sticky-column-edge");
2496
+ }
2497
+ };
2498
+ window.addEventListener("keydown", (event) => {
2499
+ if (event.key === "Escape") {
2500
+ if (store.modal.visible) {
2501
+ store.modal.visible = false;
2502
+ const $parent = store.modal.parent;
2503
+ if ($parent) nextTick().then(() => {
2504
+ return $parent.focus();
2505
+ });
2506
+ }
2507
+ }
2508
+ });
2509
+ const getProcessedColumnsForRow = (row) => {
2510
+ if (!row.gantt || pinnedColumnCount.value === 0) return store.columns;
2511
+ const result = [];
2512
+ for (let i = 0; i < pinnedColumnCount.value; i++) {
2513
+ const column = { ...store.columns[i] };
2514
+ column.originalIndex = i;
2515
+ result.push(column);
2516
+ }
2517
+ result.push({
2518
+ ...store.columns[pinnedColumnCount.value],
2519
+ isGantt: true,
2520
+ colspan: row.gantt?.colspan || store.columns.length - pinnedColumnCount.value,
2521
+ originalIndex: pinnedColumnCount.value,
2522
+ width: "auto"
2523
+ });
2524
+ return result;
2525
+ };
2526
+ const handleConnectionCreate = (connection) => {
2527
+ emit("connection:event", {
2528
+ type: "create",
2529
+ connection
2530
+ });
2531
+ };
2532
+ const handleConnectionDelete = (connection) => {
2533
+ emit("connection:event", {
2534
+ type: "delete",
2535
+ connection
2536
+ });
2537
+ };
2538
+ /**
2539
+ * Handle row click events from ARow components.
2540
+ */
2541
+ const handleRowClick = (rowIndex, event) => {
2542
+ const row = store.rows[rowIndex];
2543
+ emit("row:click", {
2544
+ row,
2545
+ rowIndex,
2546
+ event
2547
+ });
2548
+ };
2549
+ /**
2550
+ * Handle row action events from ARow components.
2551
+ * Performs the default action and emits the appropriate event.
2552
+ */
2553
+ const handleRowAction = (actionType, rowIndex, event) => {
2554
+ switch (actionType) {
2555
+ case "add": {
2556
+ const newIndex = store.addRow({}, rowIndex + 1);
2557
+ const newRow = store.rows[newIndex];
2558
+ rows.value = [...store.rows];
2559
+ emit("row:add", {
2560
+ rowIndex: newIndex,
2561
+ row: newRow
2562
+ });
2563
+ break;
2564
+ }
2565
+ case "delete": {
2566
+ const deletedRow = store.deleteRow(rowIndex);
2567
+ if (deletedRow) {
2568
+ rows.value = [...store.rows];
2569
+ emit("row:delete", {
2570
+ rowIndex,
2571
+ row: deletedRow
2572
+ });
2573
+ }
2574
+ break;
2575
+ }
2576
+ case "duplicate": {
2577
+ const newIndex = store.duplicateRow(rowIndex);
2578
+ if (newIndex >= 0) {
2579
+ const newRow = store.rows[newIndex];
2580
+ rows.value = [...store.rows];
2581
+ emit("row:duplicate", {
2582
+ sourceIndex: rowIndex,
2583
+ newIndex,
2584
+ row: newRow
2585
+ });
2586
+ }
2587
+ break;
2588
+ }
2589
+ case "insertAbove": {
2590
+ const newIndex = store.insertRowAbove(rowIndex);
2591
+ const newRow = store.rows[newIndex];
2592
+ rows.value = [...store.rows];
2593
+ emit("row:insert-above", {
2594
+ targetIndex: rowIndex,
2595
+ newIndex,
2596
+ row: newRow
2597
+ });
2598
+ break;
2599
+ }
2600
+ case "insertBelow": {
2601
+ const newIndex = store.insertRowBelow(rowIndex);
2602
+ const newRow = store.rows[newIndex];
2603
+ rows.value = [...store.rows];
2604
+ emit("row:insert-below", {
2605
+ targetIndex: rowIndex,
2606
+ newIndex,
2607
+ row: newRow
2608
+ });
2609
+ break;
2610
+ }
2611
+ case "move":
2612
+ emit("row:move", {
2613
+ fromIndex: rowIndex,
2614
+ toIndex: -1
2615
+ });
2616
+ break;
2617
+ case "moveUp":
2618
+ if (rowIndex > 0 && store.moveRow(rowIndex, rowIndex - 1)) {
2619
+ rows.value = [...store.rows];
2620
+ emit("row:move", {
2621
+ fromIndex: rowIndex,
2622
+ toIndex: rowIndex - 1
2623
+ });
2624
+ }
2625
+ break;
2626
+ case "moveDown":
2627
+ if (rowIndex < store.rows.length - 1 && store.moveRow(rowIndex, rowIndex + 1)) {
2628
+ rows.value = [...store.rows];
2629
+ emit("row:move", {
2630
+ fromIndex: rowIndex,
2631
+ toIndex: rowIndex + 1
2632
+ });
2633
+ }
2634
+ break;
2635
+ case "open": {
2636
+ const row = store.rows[rowIndex];
2637
+ emit("row:open", {
2638
+ row,
2639
+ rowIndex,
2640
+ event
2641
+ });
2642
+ break;
2643
+ }
2644
+ }
2645
+ };
2646
+ __expose({
2647
+ store,
2648
+ pagination,
2649
+ createConnection: store.createConnection,
2650
+ deleteConnection: store.deleteConnection,
2651
+ getConnectionsForBar: store.getConnectionsForBar,
2652
+ getHandlesForBar: store.getHandlesForBar,
2653
+ addRow: store.addRow,
2654
+ deleteRow: store.deleteRow,
2655
+ duplicateRow: store.duplicateRow,
2656
+ insertRowAbove: store.insertRowAbove,
2657
+ insertRowBelow: store.insertRowBelow,
2658
+ moveRow: store.moveRow
2659
+ });
2660
+ return (_ctx, _cache) => {
2661
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [withDirectives((openBlock(), createElementBlock("table", {
2662
+ ref: "table",
2663
+ class: "atable",
2664
+ style: normalizeStyle({ width: unref(store).config.fullWidth ? "100%" : "auto" })
2665
+ }, [
2666
+ renderSlot(_ctx.$slots, "header", { data: unref(store) }, () => [createVNode(ATableHeader_default, {
2667
+ columns: unref(store).columns,
2668
+ store: unref(store)
2669
+ }, null, 8, ["columns", "store"])], true),
2670
+ createElementVNode("tbody", null, [renderSlot(_ctx.$slots, "body", { data: unref(store) }, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(visibleRows), (row, filteredIndex) => {
2671
+ return openBlock(), createBlock(ARow_default, {
2672
+ key: `${row.originalIndex}-${filteredIndex}`,
2673
+ row,
2674
+ "row-index": row.originalIndex,
2675
+ store: unref(store),
2676
+ "onRow:action": handleRowAction,
2677
+ "onRow:click": handleRowClick
2678
+ }, {
2679
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(getProcessedColumnsForRow(row), (column, colIndex) => {
2680
+ return openBlock(), createElementBlock(Fragment, { key: column.name }, [column.isGantt ? (openBlock(), createBlock(resolveDynamicComponent(column.ganttComponent || "AGanttCell"), {
2681
+ key: 0,
2682
+ store: unref(store),
2683
+ "columns-count": unref(store).columns.length - pinnedColumnCount.value,
2684
+ color: row.gantt?.color,
2685
+ start: row.gantt?.startIndex,
2686
+ end: row.gantt?.endIndex,
2687
+ colspan: column.colspan,
2688
+ pinned: column.pinned,
2689
+ "row-index": row.originalIndex,
2690
+ "col-index": column.originalIndex ?? colIndex,
2691
+ style: normalizeStyle({
2692
+ textAlign: column?.align || "center",
2693
+ minWidth: column?.width || "40ch",
2694
+ width: unref(store).config.fullWidth ? "auto" : null
2695
+ }),
2696
+ "onConnection:create": handleConnectionCreate
2697
+ }, null, 40, [
2698
+ "store",
2699
+ "columns-count",
2700
+ "color",
2701
+ "start",
2702
+ "end",
2703
+ "colspan",
2704
+ "pinned",
2705
+ "row-index",
2706
+ "col-index",
2707
+ "style"
2708
+ ])) : (openBlock(), createBlock(resolveDynamicComponent(column.cellComponent || "ACell"), {
2709
+ key: 1,
2710
+ store: unref(store),
2711
+ pinned: column.pinned,
2712
+ "row-index": row.originalIndex,
2713
+ "col-index": colIndex,
2714
+ style: normalizeStyle({
2715
+ textAlign: column?.align || "center",
2716
+ width: unref(store).config.fullWidth ? "auto" : null
2717
+ }),
2718
+ spellcheck: "false"
2719
+ }, null, 8, [
2720
+ "store",
2721
+ "pinned",
2722
+ "row-index",
2723
+ "col-index",
2724
+ "style"
2725
+ ]))], 64);
2726
+ }), 128))]),
2727
+ _: 2
2728
+ }, 1032, [
2729
+ "row",
2730
+ "row-index",
2731
+ "store"
2732
+ ]);
2733
+ }), 128))], true)]),
2734
+ renderSlot(_ctx.$slots, "footer", {
2735
+ data: unref(store),
2736
+ page: unref(pagination)
2737
+ }, () => [createVNode(ATablePaginationFooter_default, {
2738
+ "column-count": footerColumnCount.value,
2739
+ "show-footer": unref(showFooter),
2740
+ "has-more": unref(hasMore),
2741
+ "has-prev": unref(hasPrev),
2742
+ "has-next": unref(hasNext),
2743
+ "has-local-next": unref(hasLocalNext),
2744
+ "has-ever-had-more": unref(hasEverHadMore),
2745
+ "loaded-count": unref(loadedCount),
2746
+ loading: unref(paginationLoading),
2747
+ next: unref(paginationNext),
2748
+ prev: unref(paginationPrev)
2749
+ }, null, 8, [
2750
+ "column-count",
2751
+ "show-footer",
2752
+ "has-more",
2753
+ "has-prev",
2754
+ "has-next",
2755
+ "has-local-next",
2756
+ "has-ever-had-more",
2757
+ "loaded-count",
2758
+ "loading",
2759
+ "next",
2760
+ "prev"
2761
+ ])], true),
2762
+ renderSlot(_ctx.$slots, "modal", { data: unref(store) }, () => [withDirectives(createVNode(ATableModal_default, { store: unref(store) }, {
2763
+ default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(unref(store).modal.component), mergeProps({
2764
+ key: `${unref(store).modal.rowIndex}:${unref(store).modal.colIndex}`,
2765
+ "col-index": unref(store).modal.colIndex,
2766
+ "row-index": unref(store).modal.rowIndex,
2767
+ store: unref(store)
2768
+ }, unref(store).modal.componentProps), null, 16, [
2769
+ "col-index",
2770
+ "row-index",
2771
+ "store"
2772
+ ]))]),
2773
+ _: 1
2774
+ }, 8, ["store"]), [[vShow, unref(store).modal.visible]])], true)
2775
+ ], 4)), [[unref(vOnClickOutside), unref(store).closeModal]]), unref(store).isGanttView && unref(store).isDependencyGraphEnabled ? (openBlock(), createBlock(AGanttConnection_default, {
2776
+ key: 0,
2777
+ store: unref(store),
2778
+ "onConnection:delete": handleConnectionDelete
2779
+ }, null, 8, ["store"])) : createCommentVNode("", true)]);
2780
+ };
2781
+ }
2782
+ }), [["__scopeId", "data-v-53c8fbad"]]);
2783
+ //#endregion
2784
+ //#region src/components/ATableLoading.vue
2785
+ var _sfc_main$1 = {};
2786
+ var _hoisted_1$1 = { class: "aloading" };
2787
+ var _hoisted_2$1 = { class: "aloading-header" };
2788
+ function _sfc_render$1(_ctx, _cache) {
2789
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [createElementVNode("h2", _hoisted_2$1, [renderSlot(_ctx.$slots, "default", {}, void 0, true)]), _cache[0] || (_cache[0] = createElementVNode("div", { class: "aloading-bar" }, null, -1))]);
1920
2790
  }
1921
- const Yn = /* @__PURE__ */ xe(Gn, [["render", Un], ["__scopeId", "data-v-a930a25b"]]), qn = {}, Jn = { class: "aloading" }, Kn = { class: "aloading-header" };
1922
- function Qn(e, a) {
1923
- return v(), w("div", Jn, [
1924
- T("h2", Kn, [
1925
- de(e.$slots, "default", {}, void 0, !0)
1926
- ]),
1927
- a[0] || (a[0] = T("div", { class: "aloading-bar" }, null, -1))
1928
- ]);
2791
+ var ATableLoading_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-a930a25b"]]);
2792
+ //#endregion
2793
+ //#region src/components/ATableLoadingBar.vue
2794
+ var _sfc_main = {};
2795
+ var _hoisted_1 = { class: "aloading" };
2796
+ var _hoisted_2 = { class: "aloading-header" };
2797
+ function _sfc_render(_ctx, _cache) {
2798
+ return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("h2", _hoisted_2, [renderSlot(_ctx.$slots, "default", {}, void 0, true)]), _cache[0] || (_cache[0] = createElementVNode("div", { class: "aloading-bar" }, null, -1))]);
1929
2799
  }
1930
- const _n = /* @__PURE__ */ xe(qn, [["render", Qn], ["__scopeId", "data-v-e1165876"]]);
1931
- function uo(e) {
1932
- e.component("ACell", Tt), e.component("AGanttCell", Vt), e.component("ARow", at), e.component("ARowActions", Ae), e.component("ATable", Xn), e.component("ATableHeader", st), e.component("ATableLoading", Yn), e.component("ATableLoadingBar", _n), e.component("ATableModal", it), e.component("ATablePaginationFooter", rt);
2800
+ var ATableLoadingBar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-e1165876"]]);
2801
+ //#endregion
2802
+ //#region src/index.ts
2803
+ /**
2804
+ * Install all ATable components
2805
+ * @param app - Vue app instance
2806
+ * @public
2807
+ */
2808
+ function install(app) {
2809
+ app.component("ACell", ACell_default);
2810
+ app.component("AGanttCell", AGanttCell_default);
2811
+ app.component("ARow", ARow_default);
2812
+ app.component("ARowActions", ARowActions_default);
2813
+ app.component("ATable", ATable_default);
2814
+ app.component("ATableHeader", ATableHeader_default);
2815
+ app.component("ATableLoading", ATableLoading_default);
2816
+ app.component("ATableLoadingBar", ATableLoadingBar_default);
2817
+ app.component("ATableModal", ATableModal_default);
2818
+ app.component("ATablePaginationFooter", ATablePaginationFooter_default);
1933
2819
  }
1934
- export {
1935
- Tt as ACell,
1936
- Vt as AGanttCell,
1937
- at as ARow,
1938
- Ae as ARowActions,
1939
- Xn as ATable,
1940
- st as ATableHeader,
1941
- Yn as ATableLoading,
1942
- _n as ATableLoadingBar,
1943
- it as ATableModal,
1944
- rt as ATablePaginationFooter,
1945
- Pt as AddIcon,
1946
- zt as DeleteIcon,
1947
- Xt as DuplicateIcon,
1948
- Gt as InsertAboveIcon,
1949
- jt as InsertBelowIcon,
1950
- Wt as MoveIcon,
1951
- Ut as OpenIcon,
1952
- Jt as actionIcons,
1953
- Dt as createTableStore,
1954
- uo as install,
1955
- Vn as schemaToColumns,
1956
- On as useTablePagination
1957
- };
1958
- //# sourceMappingURL=atable.js.map
2820
+ //#endregion
2821
+ export { ACell_default as ACell, AGanttCell_default as AGanttCell, ARow_default as ARow, ARowActions_default as ARowActions, ATable_default as ATable, ATableHeader_default as ATableHeader, ATableLoading_default as ATableLoading, ATableLoadingBar_default as ATableLoadingBar, ATableModal_default as ATableModal, ATablePaginationFooter_default as ATablePaginationFooter, AddIcon, DeleteIcon, DuplicateIcon, InsertAboveIcon, InsertBelowIcon, MoveIcon, OpenIcon, actionIcons, createTableStore, install, schemaToColumns, useTablePagination };
2822
+
2823
+ //# sourceMappingURL=atable.js.map