@stonecrop/atable 0.2.17 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atable.js +942 -0
- package/dist/atable.js.map +1 -0
- package/dist/atable.umd.cjs +2 -0
- package/dist/atable.umd.cjs.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +6 -5
package/dist/atable.js
ADDED
|
@@ -0,0 +1,942 @@
|
|
|
1
|
+
import { onMounted as Re, ref as x, watch as C, onBeforeUnmount as Oe, computed as _, unref as d, getCurrentScope as we, onScopeDispose as ge, defineComponent as A, inject as P, openBlock as g, createElementBlock as y, createBlock as N, resolveDynamicComponent as be, mergeProps as Q, toDisplayString as L, Fragment as B, createElementVNode as $, renderSlot as E, createCommentVNode as F, useCssVars as ye, withDirectives as G, vShow as xe, toRef as Le, readonly as Pe, customRef as Me, reactive as D, renderList as Y, normalizeStyle as V, createTextVNode as We, provide as He, nextTick as je, createVNode as re, withCtx as se } from "vue";
|
|
2
|
+
function Ne(t) {
|
|
3
|
+
return we() ? (ge(t), !0) : !1;
|
|
4
|
+
}
|
|
5
|
+
function Ee(t) {
|
|
6
|
+
return typeof t == "function" ? t() : d(t);
|
|
7
|
+
}
|
|
8
|
+
const Ve = typeof window < "u" && typeof document < "u";
|
|
9
|
+
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
10
|
+
const Ue = Object.prototype.toString, Be = (t) => Ue.call(t) === "[object Object]", Fe = () => {
|
|
11
|
+
};
|
|
12
|
+
function z(t) {
|
|
13
|
+
var e;
|
|
14
|
+
const n = Ee(t);
|
|
15
|
+
return (e = n == null ? void 0 : n.$el) != null ? e : n;
|
|
16
|
+
}
|
|
17
|
+
const Z = Ve ? window : void 0;
|
|
18
|
+
function X(...t) {
|
|
19
|
+
let e, n, o, a;
|
|
20
|
+
if (typeof t[0] == "string" || Array.isArray(t[0]) ? ([n, o, a] = t, e = Z) : [e, n, o, a] = t, !e)
|
|
21
|
+
return Fe;
|
|
22
|
+
Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
|
|
23
|
+
const l = [], s = () => {
|
|
24
|
+
l.forEach((m) => m()), l.length = 0;
|
|
25
|
+
}, r = (m, f, c, p) => (m.addEventListener(f, c, p), () => m.removeEventListener(f, c, p)), i = C(
|
|
26
|
+
() => [z(e), Ee(a)],
|
|
27
|
+
([m, f]) => {
|
|
28
|
+
if (s(), !m)
|
|
29
|
+
return;
|
|
30
|
+
const c = Be(f) ? { ...f } : f;
|
|
31
|
+
l.push(
|
|
32
|
+
...n.flatMap((p) => o.map((w) => r(m, p, w, c)))
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
{ immediate: !0, flush: "post" }
|
|
36
|
+
), u = () => {
|
|
37
|
+
i(), s();
|
|
38
|
+
};
|
|
39
|
+
return Ne(u), u;
|
|
40
|
+
}
|
|
41
|
+
function ze(t = {}) {
|
|
42
|
+
var e;
|
|
43
|
+
const {
|
|
44
|
+
window: n = Z,
|
|
45
|
+
deep: o = !0
|
|
46
|
+
} = t, a = (e = t.document) != null ? e : n == null ? void 0 : n.document, l = () => {
|
|
47
|
+
var i;
|
|
48
|
+
let u = a == null ? void 0 : a.activeElement;
|
|
49
|
+
if (o)
|
|
50
|
+
for (; u != null && u.shadowRoot; )
|
|
51
|
+
u = (i = u == null ? void 0 : u.shadowRoot) == null ? void 0 : i.activeElement;
|
|
52
|
+
return u;
|
|
53
|
+
}, s = x(), r = () => {
|
|
54
|
+
s.value = l();
|
|
55
|
+
};
|
|
56
|
+
return n && (X(n, "blur", (i) => {
|
|
57
|
+
i.relatedTarget === null && r();
|
|
58
|
+
}, !0), X(n, "focus", r, !0)), r(), s;
|
|
59
|
+
}
|
|
60
|
+
function qe(t, e = {}) {
|
|
61
|
+
const n = ze(e), o = _(() => z(t));
|
|
62
|
+
return { focused: _(() => o.value && n.value ? o.value.contains(n.value) : !1) };
|
|
63
|
+
}
|
|
64
|
+
function Ge(t, { window: e = Z, scrollTarget: n } = {}) {
|
|
65
|
+
const o = x(!1), a = () => {
|
|
66
|
+
if (!e)
|
|
67
|
+
return;
|
|
68
|
+
const l = e.document, s = z(t);
|
|
69
|
+
if (!s)
|
|
70
|
+
o.value = !1;
|
|
71
|
+
else {
|
|
72
|
+
const r = s.getBoundingClientRect();
|
|
73
|
+
o.value = r.top <= (e.innerHeight || l.documentElement.clientHeight) && r.left <= (e.innerWidth || l.documentElement.clientWidth) && r.bottom >= 0 && r.right >= 0;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return C(
|
|
77
|
+
() => z(t),
|
|
78
|
+
() => a(),
|
|
79
|
+
{ immediate: !0, flush: "post" }
|
|
80
|
+
), e && X(n || e, "scroll", a, {
|
|
81
|
+
capture: !1,
|
|
82
|
+
passive: !0
|
|
83
|
+
}), o;
|
|
84
|
+
}
|
|
85
|
+
const I = (t) => {
|
|
86
|
+
let e = Ge(t).value;
|
|
87
|
+
return e = e && t.offsetHeight > 0, e;
|
|
88
|
+
}, k = (t) => t.tabIndex >= 0, ae = (t) => {
|
|
89
|
+
const e = t.target;
|
|
90
|
+
return K(e);
|
|
91
|
+
}, K = (t) => {
|
|
92
|
+
var e;
|
|
93
|
+
let n;
|
|
94
|
+
if (t instanceof HTMLTableCellElement) {
|
|
95
|
+
const o = (e = t.parentElement) == null ? void 0 : e.previousElementSibling;
|
|
96
|
+
if (o) {
|
|
97
|
+
const a = Array.from(o.children)[t.cellIndex];
|
|
98
|
+
a && (n = a);
|
|
99
|
+
}
|
|
100
|
+
} else if (t instanceof HTMLTableRowElement) {
|
|
101
|
+
const o = t.previousElementSibling;
|
|
102
|
+
o && (n = o);
|
|
103
|
+
}
|
|
104
|
+
return n && (!k(n) || !I(n)) ? K(n) : n;
|
|
105
|
+
}, Ye = (t) => {
|
|
106
|
+
var e;
|
|
107
|
+
const n = t.target;
|
|
108
|
+
let o;
|
|
109
|
+
if (n instanceof HTMLTableCellElement) {
|
|
110
|
+
const a = (e = n.parentElement) == null ? void 0 : e.parentElement;
|
|
111
|
+
if (a) {
|
|
112
|
+
const l = a.firstElementChild.children[n.cellIndex];
|
|
113
|
+
l && (o = l);
|
|
114
|
+
}
|
|
115
|
+
} else if (n instanceof HTMLTableRowElement) {
|
|
116
|
+
const a = n.parentElement;
|
|
117
|
+
if (a) {
|
|
118
|
+
const l = a.firstElementChild;
|
|
119
|
+
l && (o = l);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return o && (!k(o) || !I(o)) ? ee(o) : o;
|
|
123
|
+
}, ie = (t) => {
|
|
124
|
+
const e = t.target;
|
|
125
|
+
return ee(e);
|
|
126
|
+
}, ee = (t) => {
|
|
127
|
+
var e;
|
|
128
|
+
let n;
|
|
129
|
+
if (t instanceof HTMLTableCellElement) {
|
|
130
|
+
const o = (e = t.parentElement) == null ? void 0 : e.nextElementSibling;
|
|
131
|
+
if (o) {
|
|
132
|
+
const a = Array.from(o.children)[t.cellIndex];
|
|
133
|
+
a && (n = a);
|
|
134
|
+
}
|
|
135
|
+
} else if (t instanceof HTMLTableRowElement) {
|
|
136
|
+
const o = t.nextElementSibling;
|
|
137
|
+
o && (n = o);
|
|
138
|
+
}
|
|
139
|
+
return n && (!k(n) || !I(n)) ? ee(n) : n;
|
|
140
|
+
}, Xe = (t) => {
|
|
141
|
+
var e;
|
|
142
|
+
const n = t.target;
|
|
143
|
+
let o;
|
|
144
|
+
if (n instanceof HTMLTableCellElement) {
|
|
145
|
+
const a = (e = n.parentElement) == null ? void 0 : e.parentElement;
|
|
146
|
+
if (a) {
|
|
147
|
+
const l = a.lastElementChild.children[n.cellIndex];
|
|
148
|
+
l && (o = l);
|
|
149
|
+
}
|
|
150
|
+
} else if (n instanceof HTMLTableRowElement) {
|
|
151
|
+
const a = n.parentElement;
|
|
152
|
+
if (a) {
|
|
153
|
+
const l = a.lastElementChild;
|
|
154
|
+
l && (o = l);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return o && (!k(o) || !I(o)) ? K(o) : o;
|
|
158
|
+
}, de = (t) => {
|
|
159
|
+
const e = t.target;
|
|
160
|
+
return te(e);
|
|
161
|
+
}, te = (t) => {
|
|
162
|
+
var e;
|
|
163
|
+
let n;
|
|
164
|
+
if (t.previousElementSibling)
|
|
165
|
+
n = t.previousElementSibling;
|
|
166
|
+
else {
|
|
167
|
+
const o = (e = t.parentElement) == null ? void 0 : e.previousElementSibling;
|
|
168
|
+
n = o == null ? void 0 : o.lastElementChild;
|
|
169
|
+
}
|
|
170
|
+
return n && (!k(n) || !I(n)) ? te(n) : n;
|
|
171
|
+
}, ce = (t) => {
|
|
172
|
+
const e = t.target;
|
|
173
|
+
return ne(e);
|
|
174
|
+
}, ne = (t) => {
|
|
175
|
+
var e;
|
|
176
|
+
let n;
|
|
177
|
+
if (t.nextElementSibling)
|
|
178
|
+
n = t.nextElementSibling;
|
|
179
|
+
else {
|
|
180
|
+
const o = (e = t.parentElement) == null ? void 0 : e.nextElementSibling;
|
|
181
|
+
n = o == null ? void 0 : o.firstElementChild;
|
|
182
|
+
}
|
|
183
|
+
return n && (!k(n) || !I(n)) ? ne(n) : n;
|
|
184
|
+
}, ue = (t) => {
|
|
185
|
+
const e = t.target.parentElement.firstElementChild;
|
|
186
|
+
return e && (!k(e) || !I(e)) ? ne(e) : e;
|
|
187
|
+
}, fe = (t) => {
|
|
188
|
+
const e = t.target.parentElement.lastElementChild;
|
|
189
|
+
return e && (!k(e) || !I(e)) ? te(e) : e;
|
|
190
|
+
}, W = ["alt", "control", "shift", "meta"], Je = {
|
|
191
|
+
ArrowUp: "up",
|
|
192
|
+
ArrowDown: "down",
|
|
193
|
+
ArrowLeft: "left",
|
|
194
|
+
ArrowRight: "right"
|
|
195
|
+
}, oe = {
|
|
196
|
+
"keydown.up": (t) => {
|
|
197
|
+
const e = ae(t);
|
|
198
|
+
e && (t.preventDefault(), t.stopPropagation(), e.focus());
|
|
199
|
+
},
|
|
200
|
+
"keydown.down": (t) => {
|
|
201
|
+
const e = ie(t);
|
|
202
|
+
e && (t.preventDefault(), t.stopPropagation(), e.focus());
|
|
203
|
+
},
|
|
204
|
+
"keydown.left": (t) => {
|
|
205
|
+
const e = de(t);
|
|
206
|
+
t.preventDefault(), t.stopPropagation(), e && e.focus();
|
|
207
|
+
},
|
|
208
|
+
"keydown.right": (t) => {
|
|
209
|
+
const e = ce(t);
|
|
210
|
+
t.preventDefault(), t.stopPropagation(), e && e.focus();
|
|
211
|
+
},
|
|
212
|
+
"keydown.control.up": (t) => {
|
|
213
|
+
const e = Ye(t);
|
|
214
|
+
e && (t.preventDefault(), t.stopPropagation(), e.focus());
|
|
215
|
+
},
|
|
216
|
+
"keydown.control.down": (t) => {
|
|
217
|
+
const e = Xe(t);
|
|
218
|
+
e && (t.preventDefault(), t.stopPropagation(), e.focus());
|
|
219
|
+
},
|
|
220
|
+
"keydown.control.left": (t) => {
|
|
221
|
+
const e = ue(t);
|
|
222
|
+
e && (t.preventDefault(), t.stopPropagation(), e.focus());
|
|
223
|
+
},
|
|
224
|
+
"keydown.control.right": (t) => {
|
|
225
|
+
const e = fe(t);
|
|
226
|
+
e && (t.preventDefault(), t.stopPropagation(), e.focus());
|
|
227
|
+
},
|
|
228
|
+
"keydown.end": (t) => {
|
|
229
|
+
const e = fe(t);
|
|
230
|
+
e && (t.preventDefault(), t.stopPropagation(), e.focus());
|
|
231
|
+
},
|
|
232
|
+
"keydown.enter": (t) => {
|
|
233
|
+
if (t.target instanceof HTMLTableCellElement) {
|
|
234
|
+
t.preventDefault(), t.stopPropagation();
|
|
235
|
+
const e = ie(t);
|
|
236
|
+
e && e.focus();
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"keydown.shift.enter": (t) => {
|
|
240
|
+
if (t.target instanceof HTMLTableCellElement) {
|
|
241
|
+
t.preventDefault(), t.stopPropagation();
|
|
242
|
+
const e = ae(t);
|
|
243
|
+
e && e.focus();
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"keydown.home": (t) => {
|
|
247
|
+
const e = ue(t);
|
|
248
|
+
e && (t.preventDefault(), t.stopPropagation(), e.focus());
|
|
249
|
+
},
|
|
250
|
+
"keydown.tab": (t) => {
|
|
251
|
+
const e = ce(t);
|
|
252
|
+
e && (t.preventDefault(), t.stopPropagation(), e.focus());
|
|
253
|
+
},
|
|
254
|
+
"keydown.shift.tab": (t) => {
|
|
255
|
+
const e = de(t);
|
|
256
|
+
e && (t.preventDefault(), t.stopPropagation(), e.focus());
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
function le(t) {
|
|
260
|
+
const e = (s) => {
|
|
261
|
+
let r = null;
|
|
262
|
+
return s.parent && (typeof s.parent == "string" ? r = document.querySelector(s.parent) : s.parent instanceof HTMLElement ? r = s.parent : r = s.parent.value), r;
|
|
263
|
+
}, n = (s) => {
|
|
264
|
+
const r = e(s);
|
|
265
|
+
let i = [];
|
|
266
|
+
if (typeof s.selectors == "string")
|
|
267
|
+
i = r ? Array.from(r.querySelectorAll(s.selectors)) : Array.from(document.querySelectorAll(s.selectors));
|
|
268
|
+
else if (Array.isArray(s.selectors))
|
|
269
|
+
for (const u of s.selectors)
|
|
270
|
+
u instanceof HTMLElement ? i.push(u) : i.push(u.$el);
|
|
271
|
+
else if (s.selectors instanceof HTMLElement)
|
|
272
|
+
i.push(s.selectors);
|
|
273
|
+
else if (Array.isArray(s.selectors.value))
|
|
274
|
+
for (const u of s.selectors.value)
|
|
275
|
+
u instanceof HTMLElement ? i.push(u) : i.push(u.$el);
|
|
276
|
+
else
|
|
277
|
+
i.push(s.selectors.value);
|
|
278
|
+
return i;
|
|
279
|
+
}, o = (s) => {
|
|
280
|
+
const r = e(s);
|
|
281
|
+
let i = [];
|
|
282
|
+
return s.selectors ? i = n(s) : r && (i = Array.from(r.children).filter((u) => k(u) && I(u))), i;
|
|
283
|
+
}, a = (s) => (r) => {
|
|
284
|
+
const i = Je[r.key] || r.key.toLowerCase();
|
|
285
|
+
if (W.includes(i))
|
|
286
|
+
return;
|
|
287
|
+
const u = s.handlers || oe;
|
|
288
|
+
for (const m of Object.keys(u)) {
|
|
289
|
+
const [f, ...c] = m.split(".");
|
|
290
|
+
if (f === "keydown" && c.includes(i)) {
|
|
291
|
+
const p = u[m], w = c.filter((h) => W.includes(h)), v = W.some((h) => {
|
|
292
|
+
const M = h.charAt(0).toUpperCase() + h.slice(1);
|
|
293
|
+
return r.getModifierState(M);
|
|
294
|
+
});
|
|
295
|
+
if (w.length > 0) {
|
|
296
|
+
if (v) {
|
|
297
|
+
for (const h of W)
|
|
298
|
+
if (c.includes(h)) {
|
|
299
|
+
const M = h.charAt(0).toUpperCase() + h.slice(1);
|
|
300
|
+
r.getModifierState(M) && p(r);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
} else
|
|
304
|
+
v || p(r);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}, l = [];
|
|
308
|
+
Re(() => {
|
|
309
|
+
for (const s of t) {
|
|
310
|
+
const r = e(s), i = o(s), u = a(s), m = r ? [r] : i;
|
|
311
|
+
for (const f of m) {
|
|
312
|
+
const { focused: c } = qe(x(f)), p = C(c, (w) => {
|
|
313
|
+
w ? f.addEventListener("keydown", u) : f.removeEventListener("keydown", u);
|
|
314
|
+
});
|
|
315
|
+
l.push(p);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}), Oe(() => {
|
|
319
|
+
for (const s of l)
|
|
320
|
+
s();
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
const Qe = ["data-colindex", "data-rowindex", "data-editable", "contenteditable", "tabindex"], Ze = { key: 1 }, Ke = /* @__PURE__ */ A({
|
|
324
|
+
__name: "ACell",
|
|
325
|
+
props: {
|
|
326
|
+
colIndex: {},
|
|
327
|
+
rowIndex: {},
|
|
328
|
+
tableid: {},
|
|
329
|
+
addNavigation: { type: [Boolean, Object], default: !0 },
|
|
330
|
+
tabIndex: { default: 0 }
|
|
331
|
+
},
|
|
332
|
+
setup(t) {
|
|
333
|
+
var w;
|
|
334
|
+
const e = t, n = P(e.tableid), o = x(null), a = x(""), l = x(!1), s = _(() => {
|
|
335
|
+
const v = n.cellData(e.colIndex, e.rowIndex);
|
|
336
|
+
if (n.columns[e.colIndex].format) {
|
|
337
|
+
const h = n.columns[e.colIndex].format;
|
|
338
|
+
return typeof h == "function" ? h(v) : typeof h == "string" ? Function(`"use strict";return (${h})`)()(v) : v;
|
|
339
|
+
} else
|
|
340
|
+
return v;
|
|
341
|
+
}), r = (v) => {
|
|
342
|
+
if (n.columns[e.colIndex].mask, n.columns[e.colIndex].modalComponent) {
|
|
343
|
+
const h = o.value.getBoundingClientRect();
|
|
344
|
+
n.modal.visible = !0, n.modal.colIndex = e.colIndex, n.modal.rowIndex = e.rowIndex, n.modal.parent = o.value, n.modal.top = h.top + h.height, n.modal.left = h.left, n.modal.width = u.value, n.modal.component = n.columns[e.colIndex].modalComponent, n.modal.componentProps = n.columns[e.colIndex].modalComponentProps;
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
if (e.addNavigation) {
|
|
348
|
+
let v = {
|
|
349
|
+
...oe,
|
|
350
|
+
"keydown.f2": r,
|
|
351
|
+
"keydown.alt.up": r,
|
|
352
|
+
"keydown.alt.down": r,
|
|
353
|
+
"keydown.alt.left": r,
|
|
354
|
+
"keydown.alt.right": r
|
|
355
|
+
};
|
|
356
|
+
typeof e.addNavigation == "object" && (v = {
|
|
357
|
+
...v,
|
|
358
|
+
...e.addNavigation
|
|
359
|
+
}), le([
|
|
360
|
+
{
|
|
361
|
+
selectors: o,
|
|
362
|
+
handlers: v
|
|
363
|
+
}
|
|
364
|
+
]);
|
|
365
|
+
}
|
|
366
|
+
const i = _(() => n.columns[e.colIndex].align || "center"), u = _(() => n.columns[e.colIndex].width || "40ch"), m = () => {
|
|
367
|
+
o.value && (a.value = o.value.textContent);
|
|
368
|
+
}, f = () => {
|
|
369
|
+
o.value && o.value.textContent !== a.value && (a.value = o.value.textContent, o.value.dispatchEvent(new Event("change")), l.value = !0, n.columns[e.colIndex].format || n.setCellData(e.rowIndex, e.colIndex, a.value));
|
|
370
|
+
}, c = (v, h) => h && v === 0 && h > 0 ? `${h}ch` : "inherit", p = {
|
|
371
|
+
textAlign: i.value,
|
|
372
|
+
width: u.value,
|
|
373
|
+
backgroundColor: l.value ? "var(--cell-modified-color)" : "inherit",
|
|
374
|
+
fontWeight: l.value ? "bold" : "inherit",
|
|
375
|
+
paddingLeft: c(e.colIndex, (w = n.display[e.rowIndex]) == null ? void 0 : w.indent)
|
|
376
|
+
};
|
|
377
|
+
return (v, h) => (g(), y("td", {
|
|
378
|
+
ref_key: "cell",
|
|
379
|
+
ref: o,
|
|
380
|
+
"data-colindex": v.colIndex,
|
|
381
|
+
"data-rowindex": v.rowIndex,
|
|
382
|
+
"data-editable": d(n).columns[v.colIndex].edit,
|
|
383
|
+
contenteditable: d(n).columns[v.colIndex].edit,
|
|
384
|
+
tabindex: v.tabIndex,
|
|
385
|
+
spellcheck: !1,
|
|
386
|
+
style: p,
|
|
387
|
+
onFocus: m,
|
|
388
|
+
onPaste: f,
|
|
389
|
+
onBlur: f,
|
|
390
|
+
onInput: f,
|
|
391
|
+
onClick: r,
|
|
392
|
+
onMousedown: r
|
|
393
|
+
}, [
|
|
394
|
+
d(n).columns[v.colIndex].cellComponent ? (g(), N(be(d(n).columns[v.colIndex].cellComponent), Q({
|
|
395
|
+
key: 0,
|
|
396
|
+
value: s.value
|
|
397
|
+
}, d(n).columns[v.colIndex].cellComponentProps), null, 16, ["value"])) : (g(), y("span", Ze, L(s.value), 1))
|
|
398
|
+
], 40, Qe));
|
|
399
|
+
}
|
|
400
|
+
}), S = (t, e) => {
|
|
401
|
+
const n = t.__vccOpts || t;
|
|
402
|
+
for (const [o, a] of e)
|
|
403
|
+
n[o] = a;
|
|
404
|
+
return n;
|
|
405
|
+
}, Ie = /* @__PURE__ */ S(Ke, [["__scopeId", "data-v-f3597719"]]), et = ["tabindex"], tt = ["tabindex"], nt = ["colspan"], ot = /* @__PURE__ */ A({
|
|
406
|
+
__name: "AExpansionRow",
|
|
407
|
+
props: {
|
|
408
|
+
row: {},
|
|
409
|
+
rowIndex: {},
|
|
410
|
+
tableid: {},
|
|
411
|
+
tabIndex: { default: -1 },
|
|
412
|
+
addNavigation: { type: [Boolean, Object] }
|
|
413
|
+
},
|
|
414
|
+
setup(t) {
|
|
415
|
+
const e = t, n = P(e.tableid), o = x(null), a = x(null), l = () => n.display[e.rowIndex].expanded ? "▼" : "►";
|
|
416
|
+
if (e.addNavigation) {
|
|
417
|
+
const s = {
|
|
418
|
+
"keydown.control.g": (r) => {
|
|
419
|
+
r.stopPropagation(), r.preventDefault(), n.toggleRowExpand(e.rowIndex);
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
typeof e.addNavigation == "object" && Object.assign(s, e.addNavigation), le([
|
|
423
|
+
{
|
|
424
|
+
selectors: o,
|
|
425
|
+
handlers: s
|
|
426
|
+
}
|
|
427
|
+
]);
|
|
428
|
+
}
|
|
429
|
+
return (s, r) => (g(), y(B, null, [
|
|
430
|
+
$("tr", Q(s.$attrs, {
|
|
431
|
+
ref_key: "rowEl",
|
|
432
|
+
ref: o,
|
|
433
|
+
tabindex: s.tabIndex,
|
|
434
|
+
class: "expandable-row"
|
|
435
|
+
}), [
|
|
436
|
+
$("td", {
|
|
437
|
+
tabIndex: -1,
|
|
438
|
+
onClick: r[0] || (r[0] = (i) => d(n).toggleRowExpand(s.rowIndex)),
|
|
439
|
+
class: "row-index"
|
|
440
|
+
}, L(l()), 1),
|
|
441
|
+
E(s.$slots, "row", {}, void 0, !0)
|
|
442
|
+
], 16, et),
|
|
443
|
+
d(n).display[e.rowIndex].expanded ? (g(), y("tr", {
|
|
444
|
+
key: 0,
|
|
445
|
+
ref_key: "rowExpanded",
|
|
446
|
+
ref: a,
|
|
447
|
+
tabindex: s.tabIndex,
|
|
448
|
+
class: "expanded-row"
|
|
449
|
+
}, [
|
|
450
|
+
$("td", {
|
|
451
|
+
tabIndex: -1,
|
|
452
|
+
colspan: d(n).columns.length + 1,
|
|
453
|
+
class: "expanded-row-content"
|
|
454
|
+
}, [
|
|
455
|
+
E(s.$slots, "content", {}, void 0, !0)
|
|
456
|
+
], 8, nt)
|
|
457
|
+
], 8, tt)) : F("", !0)
|
|
458
|
+
], 64));
|
|
459
|
+
}
|
|
460
|
+
}), lt = /* @__PURE__ */ S(ot, [["__scopeId", "data-v-62bfcc94"]]), rt = ["tabindex"], st = {
|
|
461
|
+
key: 0,
|
|
462
|
+
tabIndex: -1,
|
|
463
|
+
class: "list-index"
|
|
464
|
+
}, at = /* @__PURE__ */ A({
|
|
465
|
+
__name: "ARow",
|
|
466
|
+
props: {
|
|
467
|
+
row: {},
|
|
468
|
+
rowIndex: {},
|
|
469
|
+
tableid: {},
|
|
470
|
+
tabIndex: { default: -1 },
|
|
471
|
+
addNavigation: { type: [Boolean, Object], default: !1 }
|
|
472
|
+
},
|
|
473
|
+
setup(t) {
|
|
474
|
+
ye((i) => ({
|
|
475
|
+
"30f057ab": d(a)
|
|
476
|
+
}));
|
|
477
|
+
const e = t, n = P(e.tableid), o = x(null), a = n.numberedRowWidth.value, l = () => n.config.view !== "tree" ? "" : n.display[e.rowIndex].isRoot || n.display[e.rowIndex].isParent ? n.display[e.rowIndex].childrenOpen ? "-" : "+" : "", s = _(() => n.config.view !== "tree" || n.display[e.rowIndex].isRoot || n.display[e.rowIndex].open), r = (i) => {
|
|
478
|
+
n.toggleRowExpand(i);
|
|
479
|
+
};
|
|
480
|
+
if (e.addNavigation) {
|
|
481
|
+
let i = oe;
|
|
482
|
+
typeof e.addNavigation == "object" && (i = {
|
|
483
|
+
...i,
|
|
484
|
+
...e.addNavigation
|
|
485
|
+
}), le([
|
|
486
|
+
{
|
|
487
|
+
selectors: o,
|
|
488
|
+
handlers: i
|
|
489
|
+
}
|
|
490
|
+
]);
|
|
491
|
+
}
|
|
492
|
+
return (i, u) => G((g(), y("tr", {
|
|
493
|
+
ref_key: "rowEl",
|
|
494
|
+
ref: o,
|
|
495
|
+
tabindex: i.tabIndex,
|
|
496
|
+
class: "table-row"
|
|
497
|
+
}, [
|
|
498
|
+
E(i.$slots, "index", {}, () => [
|
|
499
|
+
d(n).config.view === "list" ? (g(), y("td", st, L(i.rowIndex + 1), 1)) : d(n).config.view === "tree" ? (g(), y("td", {
|
|
500
|
+
key: 1,
|
|
501
|
+
tabIndex: -1,
|
|
502
|
+
class: "tree-index",
|
|
503
|
+
onClick: u[0] || (u[0] = (m) => r(i.rowIndex))
|
|
504
|
+
}, L(l()), 1)) : F("", !0)
|
|
505
|
+
], !0),
|
|
506
|
+
E(i.$slots, "default", {}, void 0, !0)
|
|
507
|
+
], 8, rt)), [
|
|
508
|
+
[xe, s.value]
|
|
509
|
+
]);
|
|
510
|
+
}
|
|
511
|
+
}), ke = /* @__PURE__ */ S(at, [["__scopeId", "data-v-762810eb"]]);
|
|
512
|
+
let H;
|
|
513
|
+
const it = new Uint8Array(16);
|
|
514
|
+
function dt() {
|
|
515
|
+
if (!H && (H = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !H))
|
|
516
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
517
|
+
return H(it);
|
|
518
|
+
}
|
|
519
|
+
const b = [];
|
|
520
|
+
for (let t = 0; t < 256; ++t)
|
|
521
|
+
b.push((t + 256).toString(16).slice(1));
|
|
522
|
+
function ct(t, e = 0) {
|
|
523
|
+
return b[t[e + 0]] + b[t[e + 1]] + b[t[e + 2]] + b[t[e + 3]] + "-" + b[t[e + 4]] + b[t[e + 5]] + "-" + b[t[e + 6]] + b[t[e + 7]] + "-" + b[t[e + 8]] + b[t[e + 9]] + "-" + b[t[e + 10]] + b[t[e + 11]] + b[t[e + 12]] + b[t[e + 13]] + b[t[e + 14]] + b[t[e + 15]];
|
|
524
|
+
}
|
|
525
|
+
const ut = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), pe = {
|
|
526
|
+
randomUUID: ut
|
|
527
|
+
};
|
|
528
|
+
function _e(t, e, n) {
|
|
529
|
+
if (pe.randomUUID && !e && !t)
|
|
530
|
+
return pe.randomUUID();
|
|
531
|
+
t = t || {};
|
|
532
|
+
const o = t.random || (t.rng || dt)();
|
|
533
|
+
if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, e) {
|
|
534
|
+
n = n || 0;
|
|
535
|
+
for (let a = 0; a < 16; ++a)
|
|
536
|
+
e[n + a] = o[a];
|
|
537
|
+
return e;
|
|
538
|
+
}
|
|
539
|
+
return ct(o);
|
|
540
|
+
}
|
|
541
|
+
function Ce(t) {
|
|
542
|
+
return we() ? (ge(t), !0) : !1;
|
|
543
|
+
}
|
|
544
|
+
function R(t) {
|
|
545
|
+
return typeof t == "function" ? t() : d(t);
|
|
546
|
+
}
|
|
547
|
+
const Ae = typeof window < "u" && typeof document < "u";
|
|
548
|
+
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
549
|
+
const ft = Object.prototype.toString, pt = (t) => ft.call(t) === "[object Object]", O = () => {
|
|
550
|
+
}, J = /* @__PURE__ */ mt();
|
|
551
|
+
function mt() {
|
|
552
|
+
var t, e;
|
|
553
|
+
return Ae && ((t = window == null ? void 0 : window.navigator) == null ? void 0 : t.userAgent) && (/iP(ad|hone|od)/.test(window.navigator.userAgent) || ((e = window == null ? void 0 : window.navigator) == null ? void 0 : e.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
|
|
554
|
+
}
|
|
555
|
+
const me = {
|
|
556
|
+
mounted: "mounted",
|
|
557
|
+
updated: "updated",
|
|
558
|
+
unmounted: "unmounted"
|
|
559
|
+
};
|
|
560
|
+
function vt(...t) {
|
|
561
|
+
if (t.length !== 1)
|
|
562
|
+
return Le(...t);
|
|
563
|
+
const e = t[0];
|
|
564
|
+
return typeof e == "function" ? Pe(Me(() => ({ get: e, set: O }))) : x(e);
|
|
565
|
+
}
|
|
566
|
+
function T(t) {
|
|
567
|
+
var e;
|
|
568
|
+
const n = R(t);
|
|
569
|
+
return (e = n == null ? void 0 : n.$el) != null ? e : n;
|
|
570
|
+
}
|
|
571
|
+
const Se = Ae ? window : void 0;
|
|
572
|
+
function U(...t) {
|
|
573
|
+
let e, n, o, a;
|
|
574
|
+
if (typeof t[0] == "string" || Array.isArray(t[0]) ? ([n, o, a] = t, e = Se) : [e, n, o, a] = t, !e)
|
|
575
|
+
return O;
|
|
576
|
+
Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
|
|
577
|
+
const l = [], s = () => {
|
|
578
|
+
l.forEach((m) => m()), l.length = 0;
|
|
579
|
+
}, r = (m, f, c, p) => (m.addEventListener(f, c, p), () => m.removeEventListener(f, c, p)), i = C(
|
|
580
|
+
() => [T(e), R(a)],
|
|
581
|
+
([m, f]) => {
|
|
582
|
+
if (s(), !m)
|
|
583
|
+
return;
|
|
584
|
+
const c = pt(f) ? { ...f } : f;
|
|
585
|
+
l.push(
|
|
586
|
+
...n.flatMap((p) => o.map((w) => r(m, p, w, c)))
|
|
587
|
+
);
|
|
588
|
+
},
|
|
589
|
+
{ immediate: !0, flush: "post" }
|
|
590
|
+
), u = () => {
|
|
591
|
+
i(), s();
|
|
592
|
+
};
|
|
593
|
+
return Ce(u), u;
|
|
594
|
+
}
|
|
595
|
+
let ve = !1;
|
|
596
|
+
function he(t, e, n = {}) {
|
|
597
|
+
const { window: o = Se, ignore: a = [], capture: l = !0, detectIframe: s = !1 } = n;
|
|
598
|
+
if (!o)
|
|
599
|
+
return O;
|
|
600
|
+
J && !ve && (ve = !0, Array.from(o.document.body.children).forEach((c) => c.addEventListener("click", O)), o.document.documentElement.addEventListener("click", O));
|
|
601
|
+
let r = !0;
|
|
602
|
+
const i = (c) => a.some((p) => {
|
|
603
|
+
if (typeof p == "string")
|
|
604
|
+
return Array.from(o.document.querySelectorAll(p)).some((w) => w === c.target || c.composedPath().includes(w));
|
|
605
|
+
{
|
|
606
|
+
const w = T(p);
|
|
607
|
+
return w && (c.target === w || c.composedPath().includes(w));
|
|
608
|
+
}
|
|
609
|
+
}), m = [
|
|
610
|
+
U(o, "click", (c) => {
|
|
611
|
+
const p = T(t);
|
|
612
|
+
if (!(!p || p === c.target || c.composedPath().includes(p))) {
|
|
613
|
+
if (c.detail === 0 && (r = !i(c)), !r) {
|
|
614
|
+
r = !0;
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
e(c);
|
|
618
|
+
}
|
|
619
|
+
}, { passive: !0, capture: l }),
|
|
620
|
+
U(o, "pointerdown", (c) => {
|
|
621
|
+
const p = T(t);
|
|
622
|
+
r = !i(c) && !!(p && !c.composedPath().includes(p));
|
|
623
|
+
}, { passive: !0 }),
|
|
624
|
+
s && U(o, "blur", (c) => {
|
|
625
|
+
setTimeout(() => {
|
|
626
|
+
var p;
|
|
627
|
+
const w = T(t);
|
|
628
|
+
((p = o.document.activeElement) == null ? void 0 : p.tagName) === "IFRAME" && !(w != null && w.contains(o.document.activeElement)) && e(c);
|
|
629
|
+
}, 0);
|
|
630
|
+
})
|
|
631
|
+
].filter(Boolean);
|
|
632
|
+
return () => m.forEach((c) => c());
|
|
633
|
+
}
|
|
634
|
+
const ht = {
|
|
635
|
+
[me.mounted](t, e) {
|
|
636
|
+
const n = !e.modifiers.bubble;
|
|
637
|
+
if (typeof e.value == "function")
|
|
638
|
+
t.__onClickOutside_stop = he(t, e.value, { capture: n });
|
|
639
|
+
else {
|
|
640
|
+
const [o, a] = e.value;
|
|
641
|
+
t.__onClickOutside_stop = he(t, o, Object.assign({ capture: n }, a));
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
[me.unmounted](t) {
|
|
645
|
+
t.__onClickOutside_stop();
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
function q(t) {
|
|
649
|
+
return typeof Window < "u" && t instanceof Window ? t.document.documentElement : typeof Document < "u" && t instanceof Document ? t.documentElement : t;
|
|
650
|
+
}
|
|
651
|
+
function De(t) {
|
|
652
|
+
const e = window.getComputedStyle(t);
|
|
653
|
+
if (e.overflowX === "scroll" || e.overflowY === "scroll" || e.overflowX === "auto" && t.clientWidth < t.scrollWidth || e.overflowY === "auto" && t.clientHeight < t.scrollHeight)
|
|
654
|
+
return !0;
|
|
655
|
+
{
|
|
656
|
+
const n = t.parentNode;
|
|
657
|
+
return !n || n.tagName === "BODY" ? !1 : De(n);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
function wt(t) {
|
|
661
|
+
const e = t || window.event, n = e.target;
|
|
662
|
+
return De(n) ? !1 : e.touches.length > 1 ? !0 : (e.preventDefault && e.preventDefault(), !1);
|
|
663
|
+
}
|
|
664
|
+
const j = /* @__PURE__ */ new WeakMap();
|
|
665
|
+
function gt(t, e = !1) {
|
|
666
|
+
const n = x(e);
|
|
667
|
+
let o = null;
|
|
668
|
+
C(vt(t), (s) => {
|
|
669
|
+
const r = q(R(s));
|
|
670
|
+
if (r) {
|
|
671
|
+
const i = r;
|
|
672
|
+
j.get(i) || j.set(i, i.style.overflow), n.value && (i.style.overflow = "hidden");
|
|
673
|
+
}
|
|
674
|
+
}, {
|
|
675
|
+
immediate: !0
|
|
676
|
+
});
|
|
677
|
+
const a = () => {
|
|
678
|
+
const s = q(R(t));
|
|
679
|
+
!s || n.value || (J && (o = U(
|
|
680
|
+
s,
|
|
681
|
+
"touchmove",
|
|
682
|
+
(r) => {
|
|
683
|
+
wt(r);
|
|
684
|
+
},
|
|
685
|
+
{ passive: !1 }
|
|
686
|
+
)), s.style.overflow = "hidden", n.value = !0);
|
|
687
|
+
}, l = () => {
|
|
688
|
+
var s;
|
|
689
|
+
const r = q(R(t));
|
|
690
|
+
!r || !n.value || (J && (o == null || o()), r.style.overflow = (s = j.get(r)) != null ? s : "", j.delete(r), n.value = !1);
|
|
691
|
+
};
|
|
692
|
+
return Ce(l), _({
|
|
693
|
+
get() {
|
|
694
|
+
return n.value;
|
|
695
|
+
},
|
|
696
|
+
set(s) {
|
|
697
|
+
s ? a() : l();
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
function bt() {
|
|
702
|
+
let t = !1;
|
|
703
|
+
const e = x(!1);
|
|
704
|
+
return (n, o) => {
|
|
705
|
+
if (e.value = o.value, t)
|
|
706
|
+
return;
|
|
707
|
+
t = !0;
|
|
708
|
+
const a = gt(n, o.value);
|
|
709
|
+
C(e, (l) => a.value = l);
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
bt();
|
|
713
|
+
class yt {
|
|
714
|
+
constructor(e, n, o, a, l, s) {
|
|
715
|
+
this.id = e || _e(), this.rows = o, this.columns = D(n), this.config = D(a), this.table = l || D(this.createTableObject()), this.display = this.createDisplayObject(s), this.modal = D({ visible: !1 });
|
|
716
|
+
}
|
|
717
|
+
createTableObject() {
|
|
718
|
+
const e = {};
|
|
719
|
+
for (const [n, o] of this.columns.entries())
|
|
720
|
+
for (const [a, l] of this.rows.entries())
|
|
721
|
+
e[`${n}:${a}`] = l[o.name];
|
|
722
|
+
return e;
|
|
723
|
+
}
|
|
724
|
+
createDisplayObject(e) {
|
|
725
|
+
const n = [Object.assign({}, { modified: !1 })];
|
|
726
|
+
if (e && "0:0" in e)
|
|
727
|
+
return e;
|
|
728
|
+
const o = /* @__PURE__ */ new Set();
|
|
729
|
+
for (let a = this.rows.length - 1; a >= 0; a--) {
|
|
730
|
+
const l = this.rows[a];
|
|
731
|
+
l.parent && o.add(l.parent), n[a] = {
|
|
732
|
+
childrenOpen: !1,
|
|
733
|
+
expanded: !1,
|
|
734
|
+
indent: l.indent || null,
|
|
735
|
+
isParent: o.has(a),
|
|
736
|
+
isRoot: l.parent === null || l.parent === void 0,
|
|
737
|
+
modified: !1,
|
|
738
|
+
open: l.parent === null || l.parent === void 0,
|
|
739
|
+
parent: l.parent
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
return D(n);
|
|
743
|
+
}
|
|
744
|
+
get zeroColumn() {
|
|
745
|
+
return ["list", "tree", "list-expansion"].includes(this.config.view);
|
|
746
|
+
}
|
|
747
|
+
get numberedRowWidth() {
|
|
748
|
+
return _(() => String(Math.ceil(this.rows.length / 100) + 1) + "ch");
|
|
749
|
+
}
|
|
750
|
+
cellData(e, n) {
|
|
751
|
+
return this.table[`${e}:${n}`];
|
|
752
|
+
}
|
|
753
|
+
setCellData(e, n, o) {
|
|
754
|
+
this.table[`${n}:${e}`] !== o && (this.display[e].modified = !0), this.table[`${n}:${e}`] = o;
|
|
755
|
+
const a = this.columns[n];
|
|
756
|
+
return this.rows[e][a.name] = o, this.table[`${n}:${e}`];
|
|
757
|
+
}
|
|
758
|
+
toggleRowExpand(e) {
|
|
759
|
+
if (this.config.view === "tree") {
|
|
760
|
+
this.display[e].childrenOpen = !this.display[e].childrenOpen;
|
|
761
|
+
for (let n = this.rows.length - 1; n >= 0; n--)
|
|
762
|
+
this.display[n].parent === e && (this.display[n].open = !this.display[n].open, this.display[n].childrenOpen && this.toggleRowExpand(n));
|
|
763
|
+
} else
|
|
764
|
+
this.config.view === "list-expansion" && (this.display[e].expanded = !this.display[e].expanded);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
const xt = {
|
|
768
|
+
key: 0,
|
|
769
|
+
id: "resizable"
|
|
770
|
+
}, Et = {
|
|
771
|
+
class: "atable-header-row",
|
|
772
|
+
tabindex: "-1"
|
|
773
|
+
}, It = {
|
|
774
|
+
key: 0,
|
|
775
|
+
id: "header-index"
|
|
776
|
+
}, kt = /* @__PURE__ */ A({
|
|
777
|
+
__name: "ATableHeader",
|
|
778
|
+
props: {
|
|
779
|
+
columns: {},
|
|
780
|
+
config: {},
|
|
781
|
+
tableid: {}
|
|
782
|
+
},
|
|
783
|
+
setup(t) {
|
|
784
|
+
ye((l) => ({
|
|
785
|
+
"0c61081d": d(o)
|
|
786
|
+
}));
|
|
787
|
+
const n = P(t.tableid), o = n.numberedRowWidth.value, a = (l) => ({
|
|
788
|
+
minWidth: l.width || "40ch",
|
|
789
|
+
textAlign: l.align || "center",
|
|
790
|
+
width: n.config.fullWidth ? "auto" : null
|
|
791
|
+
});
|
|
792
|
+
return (l, s) => l.columns.length ? (g(), y("thead", xt, [
|
|
793
|
+
$("tr", Et, [
|
|
794
|
+
d(n).zeroColumn ? (g(), y("th", It)) : F("", !0),
|
|
795
|
+
(g(!0), y(B, null, Y(l.columns, (r, i) => (g(), y("th", {
|
|
796
|
+
key: i,
|
|
797
|
+
tabindex: "-1",
|
|
798
|
+
style: V(a(r))
|
|
799
|
+
}, [
|
|
800
|
+
E(l.$slots, "default", {}, () => [
|
|
801
|
+
We(L(r.label || String.fromCharCode(i + 97).toUpperCase()), 1)
|
|
802
|
+
], !0)
|
|
803
|
+
], 4))), 128))
|
|
804
|
+
])
|
|
805
|
+
])) : F("", !0);
|
|
806
|
+
}
|
|
807
|
+
}), Te = /* @__PURE__ */ S(kt, [["__scopeId", "data-v-b0bfa37f"]]), _t = /* @__PURE__ */ A({
|
|
808
|
+
__name: "ATableModal",
|
|
809
|
+
props: {
|
|
810
|
+
colIndex: {},
|
|
811
|
+
rowIndex: {},
|
|
812
|
+
tableid: {}
|
|
813
|
+
},
|
|
814
|
+
setup(t) {
|
|
815
|
+
P(t.tableid);
|
|
816
|
+
const n = (o) => {
|
|
817
|
+
o.stopPropagation();
|
|
818
|
+
};
|
|
819
|
+
return (o, a) => (g(), y("div", {
|
|
820
|
+
ref: "amodal",
|
|
821
|
+
class: "amodal",
|
|
822
|
+
tabindex: "-1",
|
|
823
|
+
onClick: n,
|
|
824
|
+
onInput: n
|
|
825
|
+
}, [
|
|
826
|
+
E(o.$slots, "default", {}, void 0, !0)
|
|
827
|
+
], 544));
|
|
828
|
+
}
|
|
829
|
+
}), $e = /* @__PURE__ */ S(_t, [["__scopeId", "data-v-10a48b2a"]]), Ct = /* @__PURE__ */ A({
|
|
830
|
+
__name: "ATable",
|
|
831
|
+
props: {
|
|
832
|
+
id: {},
|
|
833
|
+
modelValue: {},
|
|
834
|
+
columns: {},
|
|
835
|
+
rows: { default: () => [] },
|
|
836
|
+
config: { default: () => new Object() },
|
|
837
|
+
tableid: {}
|
|
838
|
+
},
|
|
839
|
+
emits: ["update:modelValue"],
|
|
840
|
+
setup(t, { emit: e }) {
|
|
841
|
+
const n = t, o = e;
|
|
842
|
+
let a = n.modelValue ? n.modelValue : n.rows, l = new yt(n.id, n.columns, a, n.config);
|
|
843
|
+
He(l.id, l), C(
|
|
844
|
+
() => l.rows,
|
|
845
|
+
(r) => {
|
|
846
|
+
o("update:modelValue", r);
|
|
847
|
+
},
|
|
848
|
+
{ deep: !0 }
|
|
849
|
+
);
|
|
850
|
+
const s = (r) => {
|
|
851
|
+
var i;
|
|
852
|
+
r.target instanceof Node && (i = l.modal.parent) != null && i.contains(r.target) || l.modal.visible && (l.modal.visible = !1);
|
|
853
|
+
};
|
|
854
|
+
return window.addEventListener("keydown", async (r) => {
|
|
855
|
+
if (r.key === "Escape" && l.modal.visible) {
|
|
856
|
+
l.modal.visible = !1;
|
|
857
|
+
const i = l.modal.parent;
|
|
858
|
+
i && (await je(), i.focus());
|
|
859
|
+
}
|
|
860
|
+
}), (r, i) => G((g(), y("table", {
|
|
861
|
+
class: "atable",
|
|
862
|
+
style: V({ width: d(l).config.fullWidth ? "100%" : "auto" })
|
|
863
|
+
}, [
|
|
864
|
+
E(r.$slots, "header", { data: d(l) }, () => [
|
|
865
|
+
re(Te, {
|
|
866
|
+
columns: d(l).columns,
|
|
867
|
+
config: d(l).config,
|
|
868
|
+
tableid: d(l).id
|
|
869
|
+
}, null, 8, ["columns", "config", "tableid"])
|
|
870
|
+
], !0),
|
|
871
|
+
$("tbody", null, [
|
|
872
|
+
E(r.$slots, "body", { data: d(l) }, () => [
|
|
873
|
+
(g(!0), y(B, null, Y(d(l).rows, (u, m) => (g(), N(ke, {
|
|
874
|
+
key: u.id || d(_e)(),
|
|
875
|
+
row: u,
|
|
876
|
+
rowIndex: m,
|
|
877
|
+
tableid: d(l).id
|
|
878
|
+
}, {
|
|
879
|
+
default: se(() => [
|
|
880
|
+
(g(!0), y(B, null, Y(d(l).columns, (f, c) => (g(), N(Ie, {
|
|
881
|
+
key: `${c}:${m}`,
|
|
882
|
+
tableid: d(l).id,
|
|
883
|
+
col: f,
|
|
884
|
+
spellcheck: "false",
|
|
885
|
+
rowIndex: m,
|
|
886
|
+
colIndex: c + (d(l).zeroColumn ? 0 : -1),
|
|
887
|
+
component: f.cellComponent,
|
|
888
|
+
style: V({
|
|
889
|
+
textAlign: (f == null ? void 0 : f.align) || "center",
|
|
890
|
+
minWidth: (f == null ? void 0 : f.width) || "40ch",
|
|
891
|
+
width: d(l).config.fullWidth ? "auto" : null
|
|
892
|
+
})
|
|
893
|
+
}, null, 8, ["tableid", "col", "rowIndex", "colIndex", "component", "style"]))), 128))
|
|
894
|
+
]),
|
|
895
|
+
_: 2
|
|
896
|
+
}, 1032, ["row", "rowIndex", "tableid"]))), 128))
|
|
897
|
+
], !0)
|
|
898
|
+
]),
|
|
899
|
+
E(r.$slots, "footer", { data: d(l) }, void 0, !0),
|
|
900
|
+
E(r.$slots, "modal", { data: d(l) }, () => [
|
|
901
|
+
G(re($e, {
|
|
902
|
+
colIndex: d(l).modal.colIndex,
|
|
903
|
+
rowIndex: d(l).modal.rowIndex,
|
|
904
|
+
tableid: d(l).id,
|
|
905
|
+
style: V({
|
|
906
|
+
left: d(l).modal.left + "px",
|
|
907
|
+
top: d(l).modal.top + "px",
|
|
908
|
+
maxWidth: d(l).modal.width + "px"
|
|
909
|
+
})
|
|
910
|
+
}, {
|
|
911
|
+
default: se(() => [
|
|
912
|
+
(g(), N(be(d(l).modal.component), Q({
|
|
913
|
+
key: `${d(l).modal.rowIndex}:${d(l).modal.colIndex}`,
|
|
914
|
+
colIndex: d(l).modal.colIndex,
|
|
915
|
+
rowIndex: d(l).modal.rowIndex,
|
|
916
|
+
tableid: d(l).id
|
|
917
|
+
}, d(l).modal.componentProps), null, 16, ["colIndex", "rowIndex", "tableid"]))
|
|
918
|
+
]),
|
|
919
|
+
_: 1
|
|
920
|
+
}, 8, ["colIndex", "rowIndex", "tableid", "style"]), [
|
|
921
|
+
[xe, d(l).modal.visible]
|
|
922
|
+
])
|
|
923
|
+
], !0)
|
|
924
|
+
], 4)), [
|
|
925
|
+
[d(ht), s]
|
|
926
|
+
]);
|
|
927
|
+
}
|
|
928
|
+
}), At = /* @__PURE__ */ S(Ct, [["__scopeId", "data-v-f0f87ebf"]]);
|
|
929
|
+
function Dt(t) {
|
|
930
|
+
t.component("ACell", Ie), t.component("AExpansionRow", lt), t.component("ARow", ke), t.component("ATable", At), t.component("ATableHeader", Te), t.component("ATableModal", $e);
|
|
931
|
+
}
|
|
932
|
+
export {
|
|
933
|
+
Ie as ACell,
|
|
934
|
+
lt as AExpansionRow,
|
|
935
|
+
ke as ARow,
|
|
936
|
+
At as ATable,
|
|
937
|
+
Te as ATableHeader,
|
|
938
|
+
$e as ATableModal,
|
|
939
|
+
yt as TableDataStore,
|
|
940
|
+
Dt as install
|
|
941
|
+
};
|
|
942
|
+
//# sourceMappingURL=atable.js.map
|