@stonecrop/atable 0.2.55 → 0.2.57
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/assets/index.css +1 -1
- package/dist/atable.js +161 -157
- package/dist/atable.js.map +1 -1
- package/dist/atable.umd.cjs +2 -2
- package/dist/atable.umd.cjs.map +1 -1
- package/package.json +3 -3
- package/src/components/ACell.vue +38 -1
- package/src/components/AExpansionRow.vue +28 -0
- package/src/components/ARow.vue +30 -0
- package/src/components/ATable.vue +54 -0
- package/src/components/ATableHeader.vue +35 -1
- package/src/components/ATableModal.vue +6 -0
package/dist/atable.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import './assets/index.css';var Ue = Object.defineProperty;
|
|
2
2
|
var qe = (e, t, n) => t in e ? Ue(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var T = (e, t, n) => qe(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { onMounted as F, ref as b, watch as C, onBeforeUnmount as Ye, computed as x, unref as m, getCurrentScope as
|
|
4
|
+
import { onMounted as F, ref as b, watch as C, onBeforeUnmount as Ye, computed as x, unref as m, getCurrentScope as ie, onScopeDispose as se, getCurrentInstance as re, nextTick as Te, defineComponent as M, inject as Q, useTemplateRef as Z, openBlock as h, createElementBlock as k, normalizeStyle as P, normalizeClass as N, createBlock as q, resolveDynamicComponent as De, mergeProps as ae, toDisplayString as B, Fragment as X, createElementVNode as W, renderSlot as S, createCommentVNode as J, withDirectives as ne, vShow as Me, toRef as Xe, readonly as Je, customRef as Qe, reactive as R, renderList as oe, createTextVNode as Ze, provide as Ke, createVNode as ye, withCtx as be } from "vue";
|
|
5
5
|
function Re(e) {
|
|
6
|
-
return
|
|
6
|
+
return ie() ? (se(e), !0) : !1;
|
|
7
7
|
}
|
|
8
8
|
function ce(e) {
|
|
9
9
|
return typeof e == "function" ? e() : m(e);
|
|
@@ -18,20 +18,20 @@ function V(e) {
|
|
|
18
18
|
return (t = n == null ? void 0 : n.$el) != null ? t : n;
|
|
19
19
|
}
|
|
20
20
|
function z(...e) {
|
|
21
|
-
let t, n, l,
|
|
22
|
-
if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, l,
|
|
21
|
+
let t, n, l, i;
|
|
22
|
+
if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, l, i] = e, t = G) : [t, n, l, i] = e, !t)
|
|
23
23
|
return ot;
|
|
24
24
|
Array.isArray(n) || (n = [n]), Array.isArray(l) || (l = [l]);
|
|
25
25
|
const o = [], a = () => {
|
|
26
26
|
o.forEach((u) => u()), o.length = 0;
|
|
27
|
-
},
|
|
28
|
-
() => [V(t), ce(
|
|
27
|
+
}, s = (u, p, c, f) => (u.addEventListener(p, c, f), () => u.removeEventListener(p, c, f)), d = C(
|
|
28
|
+
() => [V(t), ce(i)],
|
|
29
29
|
([u, p]) => {
|
|
30
30
|
if (a(), !u)
|
|
31
31
|
return;
|
|
32
32
|
const c = nt(p) ? { ...p } : p;
|
|
33
33
|
o.push(
|
|
34
|
-
...n.flatMap((f) => l.map((v) =>
|
|
34
|
+
...n.flatMap((f) => l.map((v) => s(u, f, v, c)))
|
|
35
35
|
);
|
|
36
36
|
},
|
|
37
37
|
{ immediate: !0, flush: "post" }
|
|
@@ -46,14 +46,14 @@ function lt() {
|
|
|
46
46
|
e.value = !0;
|
|
47
47
|
}, t), e;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function it(e) {
|
|
50
50
|
const t = lt();
|
|
51
51
|
return x(() => (t.value, !!e()));
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
const { window: l = G, ...
|
|
53
|
+
function st(e, t, n = {}) {
|
|
54
|
+
const { window: l = G, ...i } = n;
|
|
55
55
|
let o;
|
|
56
|
-
const a =
|
|
56
|
+
const a = it(() => l && "MutationObserver" in l), s = () => {
|
|
57
57
|
o && (o.disconnect(), o = void 0);
|
|
58
58
|
}, d = x(() => {
|
|
59
59
|
const c = ce(e), f = (Array.isArray(c) ? c : [c]).map(V).filter(et);
|
|
@@ -61,11 +61,11 @@ function it(e, t, n = {}) {
|
|
|
61
61
|
}), r = C(
|
|
62
62
|
() => d.value,
|
|
63
63
|
(c) => {
|
|
64
|
-
|
|
64
|
+
s(), a.value && c.size && (o = new MutationObserver(t), c.forEach((f) => o.observe(f, i)));
|
|
65
65
|
},
|
|
66
66
|
{ immediate: !0, flush: "post" }
|
|
67
67
|
), u = () => o == null ? void 0 : o.takeRecords(), p = () => {
|
|
68
|
-
r(),
|
|
68
|
+
r(), s();
|
|
69
69
|
};
|
|
70
70
|
return Re(p), {
|
|
71
71
|
isSupported: a,
|
|
@@ -78,7 +78,7 @@ function rt(e = {}) {
|
|
|
78
78
|
const {
|
|
79
79
|
window: n = G,
|
|
80
80
|
deep: l = !0,
|
|
81
|
-
triggerOnRemoval:
|
|
81
|
+
triggerOnRemoval: i = !1
|
|
82
82
|
} = e, o = (t = e.document) != null ? t : n == null ? void 0 : n.document, a = () => {
|
|
83
83
|
var r;
|
|
84
84
|
let u = o == null ? void 0 : o.activeElement;
|
|
@@ -86,41 +86,41 @@ function rt(e = {}) {
|
|
|
86
86
|
for (; u != null && u.shadowRoot; )
|
|
87
87
|
u = (r = u == null ? void 0 : u.shadowRoot) == null ? void 0 : r.activeElement;
|
|
88
88
|
return u;
|
|
89
|
-
},
|
|
90
|
-
|
|
89
|
+
}, s = b(), d = () => {
|
|
90
|
+
s.value = a();
|
|
91
91
|
};
|
|
92
92
|
return n && (z(n, "blur", (r) => {
|
|
93
93
|
r.relatedTarget === null && d();
|
|
94
|
-
}, !0), z(n, "focus", d, !0)),
|
|
94
|
+
}, !0), z(n, "focus", d, !0)), i && st(o, (r) => {
|
|
95
95
|
r.filter((u) => u.removedNodes.length).map((u) => Array.from(u.removedNodes)).flat().forEach((u) => {
|
|
96
|
-
u ===
|
|
96
|
+
u === s.value && d();
|
|
97
97
|
});
|
|
98
98
|
}, {
|
|
99
99
|
childList: !0,
|
|
100
100
|
subtree: !0
|
|
101
|
-
}), d(),
|
|
101
|
+
}), d(), s;
|
|
102
102
|
}
|
|
103
103
|
const at = "focusin", ct = "focusout";
|
|
104
104
|
function dt(e, t = {}) {
|
|
105
|
-
const { window: n = G } = t, l = x(() => V(e)),
|
|
106
|
-
return !n || !a.value ? { focused: o } : (z(l, at, () =>
|
|
105
|
+
const { window: n = G } = t, l = x(() => V(e)), i = b(!1), o = x(() => i.value), a = rt(t);
|
|
106
|
+
return !n || !a.value ? { focused: o } : (z(l, at, () => i.value = !0), z(l, ct, () => i.value = !1), { focused: o });
|
|
107
107
|
}
|
|
108
108
|
function ut(e, { window: t = G, scrollTarget: n } = {}) {
|
|
109
|
-
const l = b(!1),
|
|
109
|
+
const l = b(!1), i = () => {
|
|
110
110
|
if (!t) return;
|
|
111
111
|
const o = t.document, a = V(e);
|
|
112
112
|
if (!a)
|
|
113
113
|
l.value = !1;
|
|
114
114
|
else {
|
|
115
|
-
const
|
|
116
|
-
l.value =
|
|
115
|
+
const s = a.getBoundingClientRect();
|
|
116
|
+
l.value = s.top <= (t.innerHeight || o.documentElement.clientHeight) && s.left <= (t.innerWidth || o.documentElement.clientWidth) && s.bottom >= 0 && s.right >= 0;
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
return C(
|
|
120
120
|
() => V(e),
|
|
121
|
-
() =>
|
|
121
|
+
() => i(),
|
|
122
122
|
{ immediate: !0, flush: "post" }
|
|
123
|
-
), t && z(n || t, "scroll",
|
|
123
|
+
), t && z(n || t, "scroll", i, {
|
|
124
124
|
capture: !1,
|
|
125
125
|
passive: !0
|
|
126
126
|
}), l;
|
|
@@ -137,8 +137,8 @@ const O = (e) => {
|
|
|
137
137
|
if (e instanceof HTMLTableCellElement) {
|
|
138
138
|
const l = (t = e.parentElement) == null ? void 0 : t.previousElementSibling;
|
|
139
139
|
if (l) {
|
|
140
|
-
const
|
|
141
|
-
|
|
140
|
+
const i = Array.from(l.children)[e.cellIndex];
|
|
141
|
+
i && (n = i);
|
|
142
142
|
}
|
|
143
143
|
} else if (e instanceof HTMLTableRowElement) {
|
|
144
144
|
const l = e.previousElementSibling;
|
|
@@ -150,15 +150,15 @@ const O = (e) => {
|
|
|
150
150
|
const n = e.target;
|
|
151
151
|
let l;
|
|
152
152
|
if (n instanceof HTMLTableCellElement) {
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
155
|
-
const o =
|
|
153
|
+
const i = (t = n.parentElement) == null ? void 0 : t.parentElement;
|
|
154
|
+
if (i) {
|
|
155
|
+
const o = i.firstElementChild.children[n.cellIndex];
|
|
156
156
|
o && (l = o);
|
|
157
157
|
}
|
|
158
158
|
} else if (n instanceof HTMLTableRowElement) {
|
|
159
|
-
const
|
|
160
|
-
if (
|
|
161
|
-
const o =
|
|
159
|
+
const i = n.parentElement;
|
|
160
|
+
if (i) {
|
|
161
|
+
const o = i.firstElementChild;
|
|
162
162
|
o && (l = o);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
@@ -172,8 +172,8 @@ const O = (e) => {
|
|
|
172
172
|
if (e instanceof HTMLTableCellElement) {
|
|
173
173
|
const l = (t = e.parentElement) == null ? void 0 : t.nextElementSibling;
|
|
174
174
|
if (l) {
|
|
175
|
-
const
|
|
176
|
-
|
|
175
|
+
const i = Array.from(l.children)[e.cellIndex];
|
|
176
|
+
i && (n = i);
|
|
177
177
|
}
|
|
178
178
|
} else if (e instanceof HTMLTableRowElement) {
|
|
179
179
|
const l = e.nextElementSibling;
|
|
@@ -185,15 +185,15 @@ const O = (e) => {
|
|
|
185
185
|
const n = e.target;
|
|
186
186
|
let l;
|
|
187
187
|
if (n instanceof HTMLTableCellElement) {
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
190
|
-
const o =
|
|
188
|
+
const i = (t = n.parentElement) == null ? void 0 : t.parentElement;
|
|
189
|
+
if (i) {
|
|
190
|
+
const o = i.lastElementChild.children[n.cellIndex];
|
|
191
191
|
o && (l = o);
|
|
192
192
|
}
|
|
193
193
|
} else if (n instanceof HTMLTableRowElement) {
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
196
|
-
const o =
|
|
194
|
+
const i = n.parentElement;
|
|
195
|
+
if (i) {
|
|
196
|
+
const o = i.lastElementChild;
|
|
197
197
|
o && (l = o);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
@@ -301,13 +301,13 @@ const O = (e) => {
|
|
|
301
301
|
};
|
|
302
302
|
function ve(e) {
|
|
303
303
|
const t = (a) => {
|
|
304
|
-
let
|
|
305
|
-
return a.parent && (typeof a.parent == "string" ?
|
|
304
|
+
let s = null;
|
|
305
|
+
return a.parent && (typeof a.parent == "string" ? s = document.querySelector(a.parent) : a.parent instanceof HTMLElement ? s = a.parent : s = a.parent.value), s;
|
|
306
306
|
}, n = (a) => {
|
|
307
|
-
const
|
|
307
|
+
const s = t(a);
|
|
308
308
|
let d = [];
|
|
309
309
|
if (typeof a.selectors == "string")
|
|
310
|
-
d =
|
|
310
|
+
d = s ? Array.from(s.querySelectorAll(a.selectors)) : Array.from(document.querySelectorAll(a.selectors));
|
|
311
311
|
else if (Array.isArray(a.selectors))
|
|
312
312
|
for (const r of a.selectors)
|
|
313
313
|
r instanceof HTMLElement ? d.push(r) : d.push(r.$el);
|
|
@@ -320,11 +320,11 @@ function ve(e) {
|
|
|
320
320
|
d.push(a.selectors.value);
|
|
321
321
|
return d;
|
|
322
322
|
}, l = (a) => {
|
|
323
|
-
const
|
|
323
|
+
const s = t(a);
|
|
324
324
|
let d = [];
|
|
325
|
-
return a.selectors ? d = n(a) :
|
|
326
|
-
},
|
|
327
|
-
const d = mt[
|
|
325
|
+
return a.selectors ? d = n(a) : s && (d = Array.from(s.children).filter((r) => $(r) && O(r))), d;
|
|
326
|
+
}, i = (a) => (s) => {
|
|
327
|
+
const d = mt[s.key] || s.key.toLowerCase();
|
|
328
328
|
if (U.includes(d)) return;
|
|
329
329
|
const r = a.handlers || me;
|
|
330
330
|
for (const u of Object.keys(r)) {
|
|
@@ -332,24 +332,24 @@ function ve(e) {
|
|
|
332
332
|
if (p === "keydown" && c.includes(d)) {
|
|
333
333
|
const f = r[u], v = c.filter((y) => U.includes(y)), g = U.some((y) => {
|
|
334
334
|
const E = y.charAt(0).toUpperCase() + y.slice(1);
|
|
335
|
-
return
|
|
335
|
+
return s.getModifierState(E);
|
|
336
336
|
});
|
|
337
337
|
if (v.length > 0) {
|
|
338
338
|
if (g) {
|
|
339
339
|
for (const y of U)
|
|
340
340
|
if (c.includes(y)) {
|
|
341
341
|
const E = y.charAt(0).toUpperCase() + y.slice(1);
|
|
342
|
-
|
|
342
|
+
s.getModifierState(E) && f(s);
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
} else
|
|
346
|
-
g || f(
|
|
346
|
+
g || f(s);
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
}, o = [];
|
|
350
350
|
F(() => {
|
|
351
351
|
for (const a of e) {
|
|
352
|
-
const
|
|
352
|
+
const s = t(a), d = l(a), r = i(a), u = s ? [s] : d;
|
|
353
353
|
for (const p of u) {
|
|
354
354
|
const { focused: c } = dt(b(p)), f = C(c, (v) => {
|
|
355
355
|
v ? p.addEventListener("keydown", r) : p.removeEventListener("keydown", r);
|
|
@@ -363,7 +363,7 @@ function ve(e) {
|
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
365
|
function we(e) {
|
|
366
|
-
return
|
|
366
|
+
return ie() ? (se(e), !0) : !1;
|
|
367
367
|
}
|
|
368
368
|
function K(e) {
|
|
369
369
|
return typeof e == "function" ? e() : m(e);
|
|
@@ -385,20 +385,20 @@ function D(e) {
|
|
|
385
385
|
return (t = n == null ? void 0 : n.$el) != null ? t : n;
|
|
386
386
|
}
|
|
387
387
|
function Ae(...e) {
|
|
388
|
-
let t, n, l,
|
|
389
|
-
if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, l,
|
|
388
|
+
let t, n, l, i;
|
|
389
|
+
if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, l, i] = e, t = he) : [t, n, l, i] = e, !t)
|
|
390
390
|
return bt;
|
|
391
391
|
Array.isArray(n) || (n = [n]), Array.isArray(l) || (l = [l]);
|
|
392
392
|
const o = [], a = () => {
|
|
393
393
|
o.forEach((u) => u()), o.length = 0;
|
|
394
|
-
},
|
|
395
|
-
() => [D(t), K(
|
|
394
|
+
}, s = (u, p, c, f) => (u.addEventListener(p, c, f), () => u.removeEventListener(p, c, f)), d = C(
|
|
395
|
+
() => [D(t), K(i)],
|
|
396
396
|
([u, p]) => {
|
|
397
397
|
if (a(), !u)
|
|
398
398
|
return;
|
|
399
399
|
const c = yt(p) ? { ...p } : p;
|
|
400
400
|
o.push(
|
|
401
|
-
...n.flatMap((f) => l.map((v) =>
|
|
401
|
+
...n.flatMap((f) => l.map((v) => s(u, f, v, c)))
|
|
402
402
|
);
|
|
403
403
|
},
|
|
404
404
|
{ immediate: !0, flush: "post" }
|
|
@@ -418,9 +418,9 @@ function Le(e) {
|
|
|
418
418
|
return x(() => (t.value, !!e()));
|
|
419
419
|
}
|
|
420
420
|
function Pe(e, t, n = {}) {
|
|
421
|
-
const { window: l = he, ...
|
|
421
|
+
const { window: l = he, ...i } = n;
|
|
422
422
|
let o;
|
|
423
|
-
const a = Le(() => l && "MutationObserver" in l),
|
|
423
|
+
const a = Le(() => l && "MutationObserver" in l), s = () => {
|
|
424
424
|
o && (o.disconnect(), o = void 0);
|
|
425
425
|
}, d = x(() => {
|
|
426
426
|
const c = K(e), f = (Array.isArray(c) ? c : [c]).map(D).filter(wt);
|
|
@@ -428,11 +428,11 @@ function Pe(e, t, n = {}) {
|
|
|
428
428
|
}), r = C(
|
|
429
429
|
() => d.value,
|
|
430
430
|
(c) => {
|
|
431
|
-
|
|
431
|
+
s(), a.value && c.size && (o = new MutationObserver(t), c.forEach((f) => o.observe(f, i)));
|
|
432
432
|
},
|
|
433
433
|
{ immediate: !0, flush: "post" }
|
|
434
434
|
), u = () => o == null ? void 0 : o.takeRecords(), p = () => {
|
|
435
|
-
r(),
|
|
435
|
+
r(), s();
|
|
436
436
|
};
|
|
437
437
|
return we(p), {
|
|
438
438
|
isSupported: a,
|
|
@@ -441,9 +441,9 @@ function Pe(e, t, n = {}) {
|
|
|
441
441
|
};
|
|
442
442
|
}
|
|
443
443
|
function kt(e, t, n = {}) {
|
|
444
|
-
const { window: l = he, ...
|
|
444
|
+
const { window: l = he, ...i } = n;
|
|
445
445
|
let o;
|
|
446
|
-
const a = Le(() => l && "ResizeObserver" in l),
|
|
446
|
+
const a = Le(() => l && "ResizeObserver" in l), s = () => {
|
|
447
447
|
o && (o.disconnect(), o = void 0);
|
|
448
448
|
}, d = x(() => {
|
|
449
449
|
const p = K(e);
|
|
@@ -451,15 +451,15 @@ function kt(e, t, n = {}) {
|
|
|
451
451
|
}), r = C(
|
|
452
452
|
d,
|
|
453
453
|
(p) => {
|
|
454
|
-
if (
|
|
454
|
+
if (s(), a.value && l) {
|
|
455
455
|
o = new ResizeObserver(t);
|
|
456
456
|
for (const c of p)
|
|
457
|
-
c && o.observe(c,
|
|
457
|
+
c && o.observe(c, i);
|
|
458
458
|
}
|
|
459
459
|
},
|
|
460
460
|
{ immediate: !0, flush: "post" }
|
|
461
461
|
), u = () => {
|
|
462
|
-
|
|
462
|
+
s(), r();
|
|
463
463
|
};
|
|
464
464
|
return we(u), {
|
|
465
465
|
isSupported: a,
|
|
@@ -470,28 +470,28 @@ function Ct(e, t = {}) {
|
|
|
470
470
|
const {
|
|
471
471
|
reset: n = !0,
|
|
472
472
|
windowResize: l = !0,
|
|
473
|
-
windowScroll:
|
|
473
|
+
windowScroll: i = !0,
|
|
474
474
|
immediate: o = !0,
|
|
475
475
|
updateTiming: a = "sync"
|
|
476
|
-
} = t,
|
|
476
|
+
} = t, s = b(0), d = b(0), r = b(0), u = b(0), p = b(0), c = b(0), f = b(0), v = b(0);
|
|
477
477
|
function g() {
|
|
478
478
|
const E = D(e);
|
|
479
479
|
if (!E) {
|
|
480
|
-
n && (
|
|
480
|
+
n && (s.value = 0, d.value = 0, r.value = 0, u.value = 0, p.value = 0, c.value = 0, f.value = 0, v.value = 0);
|
|
481
481
|
return;
|
|
482
482
|
}
|
|
483
483
|
const I = E.getBoundingClientRect();
|
|
484
|
-
|
|
484
|
+
s.value = I.height, d.value = I.bottom, r.value = I.left, u.value = I.right, p.value = I.top, c.value = I.width, f.value = I.x, v.value = I.y;
|
|
485
485
|
}
|
|
486
486
|
function y() {
|
|
487
487
|
a === "sync" ? g() : a === "next-frame" && requestAnimationFrame(() => g());
|
|
488
488
|
}
|
|
489
489
|
return kt(e, y), C(() => D(e), (E) => !E && y()), Pe(e, y, {
|
|
490
490
|
attributeFilter: ["style", "class"]
|
|
491
|
-
}),
|
|
491
|
+
}), i && Ae("scroll", y, { capture: !0, passive: !0 }), l && Ae("resize", y, { passive: !0 }), xt(() => {
|
|
492
492
|
o && y();
|
|
493
493
|
}), {
|
|
494
|
-
height:
|
|
494
|
+
height: s,
|
|
495
495
|
bottom: d,
|
|
496
496
|
left: r,
|
|
497
497
|
right: u,
|
|
@@ -516,13 +516,13 @@ const It = (e) => {
|
|
|
516
516
|
pinned: { type: Boolean }
|
|
517
517
|
},
|
|
518
518
|
setup(e) {
|
|
519
|
-
const t = Q(e.tableid), n = Z("cell"), { bottom: l, left:
|
|
519
|
+
const t = Q(e.tableid), n = Z("cell"), { bottom: l, left: i } = Ct(n), o = t.cellData(e.colIndex, e.rowIndex), a = b(""), s = b(!1), d = t.table, r = t.columns[e.colIndex], u = t.rows[e.rowIndex], p = r.align || "center", c = r.width || "40ch", f = x(() => typeof g.value == "string" ? It(g.value) : !1), v = x(() => {
|
|
520
520
|
var w;
|
|
521
521
|
return {
|
|
522
522
|
textAlign: p,
|
|
523
523
|
width: c,
|
|
524
|
-
backgroundColor:
|
|
525
|
-
fontWeight:
|
|
524
|
+
backgroundColor: s.value ? "var(--sc-cell-modified)" : "inherit",
|
|
525
|
+
fontWeight: s.value ? "bold" : "inherit",
|
|
526
526
|
paddingLeft: Ge(e.colIndex, (w = t.display[e.rowIndex]) == null ? void 0 : w.indent)
|
|
527
527
|
};
|
|
528
528
|
}), g = x(() => {
|
|
@@ -532,7 +532,7 @@ const It = (e) => {
|
|
|
532
532
|
const A = r.format;
|
|
533
533
|
return A ? typeof A == "function" ? A(w, { table: d, row: u, column: r }) : typeof A == "string" ? Function(`"use strict";return (${A})`)()(w, { table: d, row: u, column: r }) : w : w;
|
|
534
534
|
}, E = () => {
|
|
535
|
-
r.mask, r.modalComponent && (t.modal.visible = !0, t.modal.colIndex = e.colIndex, t.modal.rowIndex = e.rowIndex, t.modal.parent = n.value, t.modal.top = l.value, t.modal.left =
|
|
535
|
+
r.mask, r.modalComponent && (t.modal.visible = !0, t.modal.colIndex = e.colIndex, t.modal.rowIndex = e.rowIndex, t.modal.parent = n.value, t.modal.top = l.value, t.modal.left = i.value, t.modal.width = c, typeof r.modalComponent == "function" ? t.modal.component = r.modalComponent({ table: d, row: u, column: r }) : t.modal.component = r.modalComponent, t.modal.componentProps = r.modalComponentExtraProps);
|
|
536
536
|
};
|
|
537
537
|
if (e.addNavigation) {
|
|
538
538
|
let w = {
|
|
@@ -556,7 +556,7 @@ const It = (e) => {
|
|
|
556
556
|
const I = () => {
|
|
557
557
|
n.value && (a.value = n.value.textContent);
|
|
558
558
|
}, _ = () => {
|
|
559
|
-
n.value && (r.format ?
|
|
559
|
+
n.value && (r.format ? s.value = n.value.textContent !== y(o) : s.value = n.value.textContent !== o, n.value.textContent !== a.value && (a.value = n.value.textContent, n.value.dispatchEvent(new Event("change")), r.format || t.setCellData(e.rowIndex, e.colIndex, a.value)));
|
|
560
560
|
}, Ge = (w, A) => A && w === 0 && A > 0 ? `${A}ch` : "inherit";
|
|
561
561
|
return (w, A) => (h(), k("td", {
|
|
562
562
|
ref: "cell",
|
|
@@ -573,7 +573,7 @@ const It = (e) => {
|
|
|
573
573
|
onInput: _,
|
|
574
574
|
onClick: E,
|
|
575
575
|
onMousedown: E,
|
|
576
|
-
class: N(["
|
|
576
|
+
class: N(["atable-cell", w.pinned ? "sticky-column" : ""])
|
|
577
577
|
}, [
|
|
578
578
|
m(r).cellComponent ? (h(), q(De(m(r).cellComponent), ae({
|
|
579
579
|
key: 0,
|
|
@@ -595,35 +595,35 @@ const It = (e) => {
|
|
|
595
595
|
setup(e) {
|
|
596
596
|
const t = Q(e.tableid), n = Z("rowEl"), l = x(() => t.display[e.rowIndex].expanded ? "▼" : "►");
|
|
597
597
|
if (e.addNavigation) {
|
|
598
|
-
const
|
|
598
|
+
const i = {
|
|
599
599
|
"keydown.control.g": (o) => {
|
|
600
600
|
o.stopPropagation(), o.preventDefault(), t.toggleRowExpand(e.rowIndex);
|
|
601
601
|
}
|
|
602
602
|
};
|
|
603
|
-
typeof e.addNavigation == "object" && Object.assign(
|
|
603
|
+
typeof e.addNavigation == "object" && Object.assign(i, e.addNavigation), ve([
|
|
604
604
|
{
|
|
605
605
|
selectors: n,
|
|
606
|
-
handlers:
|
|
606
|
+
handlers: i
|
|
607
607
|
}
|
|
608
608
|
]);
|
|
609
609
|
}
|
|
610
|
-
return (
|
|
611
|
-
W("tr", ae(
|
|
610
|
+
return (i, o) => (h(), k(X, null, [
|
|
611
|
+
W("tr", ae(i.$attrs, {
|
|
612
612
|
ref: "rowEl",
|
|
613
|
-
tabindex:
|
|
613
|
+
tabindex: i.tabIndex,
|
|
614
614
|
class: "expandable-row"
|
|
615
615
|
}), [
|
|
616
616
|
W("td", {
|
|
617
617
|
tabIndex: -1,
|
|
618
|
-
onClick: o[0] || (o[0] = (a) => m(t).toggleRowExpand(
|
|
618
|
+
onClick: o[0] || (o[0] = (a) => m(t).toggleRowExpand(i.rowIndex)),
|
|
619
619
|
class: "row-index"
|
|
620
620
|
}, B(l.value), 1),
|
|
621
|
-
S(
|
|
621
|
+
S(i.$slots, "row")
|
|
622
622
|
], 16, $t),
|
|
623
|
-
m(t).display[
|
|
623
|
+
m(t).display[i.rowIndex].expanded ? (h(), k("tr", {
|
|
624
624
|
key: 0,
|
|
625
625
|
ref: "rowExpanded",
|
|
626
|
-
tabindex:
|
|
626
|
+
tabindex: i.tabIndex,
|
|
627
627
|
class: "expanded-row"
|
|
628
628
|
}, [
|
|
629
629
|
W("td", {
|
|
@@ -631,7 +631,7 @@ const It = (e) => {
|
|
|
631
631
|
colspan: m(t).columns.length + 1,
|
|
632
632
|
class: "expanded-row-content"
|
|
633
633
|
}, [
|
|
634
|
-
S(
|
|
634
|
+
S(i.$slots, "content")
|
|
635
635
|
], 8, Dt)
|
|
636
636
|
], 8, Tt)) : J("", !0)
|
|
637
637
|
], 64));
|
|
@@ -645,46 +645,46 @@ const It = (e) => {
|
|
|
645
645
|
addNavigation: { type: [Boolean, Object], default: !1 }
|
|
646
646
|
},
|
|
647
647
|
setup(e) {
|
|
648
|
-
const t = Q(e.tableid), n = Z("rowEl"), l = x(() => t.columns.some((
|
|
649
|
-
t.toggleRowExpand(
|
|
648
|
+
const t = Q(e.tableid), n = Z("rowEl"), l = x(() => t.columns.some((s) => s.pinned)), i = x(() => t.config.view !== "tree" || t.display[e.rowIndex].isRoot || t.display[e.rowIndex].open), o = x(() => t.config.view !== "tree" ? "" : t.display[e.rowIndex].isRoot || t.display[e.rowIndex].isParent ? t.display[e.rowIndex].childrenOpen ? "-" : "+" : ""), a = (s) => {
|
|
649
|
+
t.toggleRowExpand(s);
|
|
650
650
|
};
|
|
651
651
|
if (e.addNavigation) {
|
|
652
|
-
let
|
|
653
|
-
typeof e.addNavigation == "object" && (
|
|
654
|
-
...
|
|
652
|
+
let s = me;
|
|
653
|
+
typeof e.addNavigation == "object" && (s = {
|
|
654
|
+
...s,
|
|
655
655
|
...e.addNavigation
|
|
656
656
|
}), ve([
|
|
657
657
|
{
|
|
658
658
|
selectors: n,
|
|
659
|
-
handlers:
|
|
659
|
+
handlers: s
|
|
660
660
|
}
|
|
661
661
|
]);
|
|
662
662
|
}
|
|
663
|
-
return (
|
|
663
|
+
return (s, d) => ne((h(), k("tr", {
|
|
664
664
|
ref: "rowEl",
|
|
665
|
-
tabindex:
|
|
665
|
+
tabindex: s.tabIndex,
|
|
666
666
|
class: "table-row"
|
|
667
667
|
}, [
|
|
668
|
-
S(
|
|
668
|
+
S(s.$slots, "index", {}, () => [
|
|
669
669
|
m(t).config.view === "list" ? (h(), k("td", {
|
|
670
670
|
key: 0,
|
|
671
671
|
tabIndex: -1,
|
|
672
672
|
class: N(["list-index", l.value ? "sticky-index" : ""])
|
|
673
|
-
}, B(
|
|
673
|
+
}, B(s.rowIndex + 1), 3)) : m(t).config.view === "tree" ? (h(), k("td", {
|
|
674
674
|
key: 1,
|
|
675
675
|
tabIndex: -1,
|
|
676
676
|
class: N(["tree-index", l.value ? "sticky-index" : ""]),
|
|
677
|
-
onClick: d[0] || (d[0] = (r) => a(
|
|
677
|
+
onClick: d[0] || (d[0] = (r) => a(s.rowIndex))
|
|
678
678
|
}, B(o.value), 3)) : J("", !0)
|
|
679
679
|
]),
|
|
680
|
-
S(
|
|
680
|
+
S(s.$slots, "default")
|
|
681
681
|
], 8, Rt)), [
|
|
682
|
-
[Me,
|
|
682
|
+
[Me, i.value]
|
|
683
683
|
]);
|
|
684
684
|
}
|
|
685
685
|
});
|
|
686
686
|
function je(e) {
|
|
687
|
-
return
|
|
687
|
+
return ie() ? (se(e), !0) : !1;
|
|
688
688
|
}
|
|
689
689
|
function H(e) {
|
|
690
690
|
return typeof e == "function" ? e() : m(e);
|
|
@@ -715,20 +715,20 @@ function L(e) {
|
|
|
715
715
|
}
|
|
716
716
|
const Be = Ne ? window : void 0;
|
|
717
717
|
function Y(...e) {
|
|
718
|
-
let t, n, l,
|
|
719
|
-
if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, l,
|
|
718
|
+
let t, n, l, i;
|
|
719
|
+
if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, l, i] = e, t = Be) : [t, n, l, i] = e, !t)
|
|
720
720
|
return j;
|
|
721
721
|
Array.isArray(n) || (n = [n]), Array.isArray(l) || (l = [l]);
|
|
722
722
|
const o = [], a = () => {
|
|
723
723
|
o.forEach((u) => u()), o.length = 0;
|
|
724
|
-
},
|
|
725
|
-
() => [L(t), H(
|
|
724
|
+
}, s = (u, p, c, f) => (u.addEventListener(p, c, f), () => u.removeEventListener(p, c, f)), d = C(
|
|
725
|
+
() => [L(t), H(i)],
|
|
726
726
|
([u, p]) => {
|
|
727
727
|
if (a(), !u)
|
|
728
728
|
return;
|
|
729
729
|
const c = Pt(p) ? { ...p } : p;
|
|
730
730
|
o.push(
|
|
731
|
-
...n.flatMap((f) => l.map((v) =>
|
|
731
|
+
...n.flatMap((f) => l.map((v) => s(u, f, v, c)))
|
|
732
732
|
);
|
|
733
733
|
},
|
|
734
734
|
{ immediate: !0, flush: "post" }
|
|
@@ -739,12 +739,12 @@ function Y(...e) {
|
|
|
739
739
|
}
|
|
740
740
|
let Oe = !1;
|
|
741
741
|
function $e(e, t, n = {}) {
|
|
742
|
-
const { window: l = Be, ignore:
|
|
742
|
+
const { window: l = Be, ignore: i = [], capture: o = !0, detectIframe: a = !1 } = n;
|
|
743
743
|
if (!l)
|
|
744
744
|
return j;
|
|
745
745
|
le && !Oe && (Oe = !0, Array.from(l.document.body.children).forEach((c) => c.addEventListener("click", j)), l.document.documentElement.addEventListener("click", j));
|
|
746
|
-
let
|
|
747
|
-
const d = (c) =>
|
|
746
|
+
let s = !0;
|
|
747
|
+
const d = (c) => i.some((f) => {
|
|
748
748
|
if (typeof f == "string")
|
|
749
749
|
return Array.from(l.document.querySelectorAll(f)).some((v) => v === c.target || c.composedPath().includes(v));
|
|
750
750
|
{
|
|
@@ -755,8 +755,8 @@ function $e(e, t, n = {}) {
|
|
|
755
755
|
Y(l, "click", (c) => {
|
|
756
756
|
const f = L(e);
|
|
757
757
|
if (!(!f || f === c.target || c.composedPath().includes(f))) {
|
|
758
|
-
if (c.detail === 0 && (
|
|
759
|
-
|
|
758
|
+
if (c.detail === 0 && (s = !d(c)), !s) {
|
|
759
|
+
s = !0;
|
|
760
760
|
return;
|
|
761
761
|
}
|
|
762
762
|
t(c);
|
|
@@ -764,7 +764,7 @@ function $e(e, t, n = {}) {
|
|
|
764
764
|
}, { passive: !0, capture: o }),
|
|
765
765
|
Y(l, "pointerdown", (c) => {
|
|
766
766
|
const f = L(e);
|
|
767
|
-
|
|
767
|
+
s = !d(c) && !!(f && !c.composedPath().includes(f));
|
|
768
768
|
}, { passive: !0 }),
|
|
769
769
|
a && Y(l, "blur", (c) => {
|
|
770
770
|
setTimeout(() => {
|
|
@@ -782,8 +782,8 @@ const jt = {
|
|
|
782
782
|
if (typeof t.value == "function")
|
|
783
783
|
e.__onClickOutside_stop = $e(e, t.value, { capture: n });
|
|
784
784
|
else {
|
|
785
|
-
const [l,
|
|
786
|
-
e.__onClickOutside_stop = $e(e, l, Object.assign({ capture: n },
|
|
785
|
+
const [l, i] = t.value;
|
|
786
|
+
e.__onClickOutside_stop = $e(e, l, Object.assign({ capture: n }, i));
|
|
787
787
|
}
|
|
788
788
|
},
|
|
789
789
|
[Se.unmounted](e) {
|
|
@@ -809,12 +809,12 @@ function Nt(e) {
|
|
|
809
809
|
const te = /* @__PURE__ */ new WeakMap();
|
|
810
810
|
function Bt(e, t = !1) {
|
|
811
811
|
const n = b(t);
|
|
812
|
-
let l = null,
|
|
813
|
-
C(Ht(e), (
|
|
814
|
-
const d = ee(H(
|
|
812
|
+
let l = null, i = "";
|
|
813
|
+
C(Ht(e), (s) => {
|
|
814
|
+
const d = ee(H(s));
|
|
815
815
|
if (d) {
|
|
816
816
|
const r = d;
|
|
817
|
-
if (te.get(r) || te.set(r, r.style.overflow), r.style.overflow !== "hidden" && (
|
|
817
|
+
if (te.get(r) || te.set(r, r.style.overflow), r.style.overflow !== "hidden" && (i = r.style.overflow), r.style.overflow === "hidden")
|
|
818
818
|
return n.value = !0;
|
|
819
819
|
if (n.value)
|
|
820
820
|
return r.style.overflow = "hidden";
|
|
@@ -823,25 +823,25 @@ function Bt(e, t = !1) {
|
|
|
823
823
|
immediate: !0
|
|
824
824
|
});
|
|
825
825
|
const o = () => {
|
|
826
|
-
const
|
|
827
|
-
!
|
|
828
|
-
|
|
826
|
+
const s = ee(H(e));
|
|
827
|
+
!s || n.value || (le && (l = Y(
|
|
828
|
+
s,
|
|
829
829
|
"touchmove",
|
|
830
830
|
(d) => {
|
|
831
831
|
Nt(d);
|
|
832
832
|
},
|
|
833
833
|
{ passive: !1 }
|
|
834
|
-
)),
|
|
834
|
+
)), s.style.overflow = "hidden", n.value = !0);
|
|
835
835
|
}, a = () => {
|
|
836
|
-
const
|
|
837
|
-
!
|
|
836
|
+
const s = ee(H(e));
|
|
837
|
+
!s || !n.value || (le && (l == null || l()), s.style.overflow = i, te.delete(s), n.value = !1);
|
|
838
838
|
};
|
|
839
839
|
return je(a), x({
|
|
840
840
|
get() {
|
|
841
841
|
return n.value;
|
|
842
842
|
},
|
|
843
|
-
set(
|
|
844
|
-
|
|
843
|
+
set(s) {
|
|
844
|
+
s ? o() : a();
|
|
845
845
|
}
|
|
846
846
|
});
|
|
847
847
|
}
|
|
@@ -852,13 +852,13 @@ function Vt() {
|
|
|
852
852
|
if (t.value = l.value, e)
|
|
853
853
|
return;
|
|
854
854
|
e = !0;
|
|
855
|
-
const
|
|
856
|
-
C(t, (o) =>
|
|
855
|
+
const i = Bt(n, l.value);
|
|
856
|
+
C(t, (o) => i.value = o);
|
|
857
857
|
};
|
|
858
858
|
}
|
|
859
859
|
Vt();
|
|
860
860
|
class zt {
|
|
861
|
-
constructor(t, n, l,
|
|
861
|
+
constructor(t, n, l, i, o, a) {
|
|
862
862
|
T(this, "id");
|
|
863
863
|
T(this, "rows");
|
|
864
864
|
T(this, "columns");
|
|
@@ -866,13 +866,13 @@ class zt {
|
|
|
866
866
|
T(this, "table");
|
|
867
867
|
T(this, "display");
|
|
868
868
|
T(this, "modal");
|
|
869
|
-
this.id = t || crypto.randomUUID(), this.rows = l, this.columns = R(n), this.config = R(
|
|
869
|
+
this.id = t || crypto.randomUUID(), this.rows = l, this.columns = R(n), this.config = R(i), this.table = o || R(this.createTableObject()), this.display = this.createDisplayObject(a), this.modal = R({ visible: !1 });
|
|
870
870
|
}
|
|
871
871
|
createTableObject() {
|
|
872
872
|
const t = {};
|
|
873
873
|
for (const [n, l] of this.columns.entries())
|
|
874
|
-
for (const [
|
|
875
|
-
t[`${n}:${
|
|
874
|
+
for (const [i, o] of this.rows.entries())
|
|
875
|
+
t[`${n}:${i}`] = o[l.name];
|
|
876
876
|
return t;
|
|
877
877
|
}
|
|
878
878
|
createDisplayObject(t) {
|
|
@@ -880,13 +880,13 @@ class zt {
|
|
|
880
880
|
if (t && "0:0" in t)
|
|
881
881
|
return t;
|
|
882
882
|
const l = /* @__PURE__ */ new Set();
|
|
883
|
-
for (let
|
|
884
|
-
const o = this.rows[
|
|
885
|
-
o.parent && l.add(o.parent), n[
|
|
883
|
+
for (let i = this.rows.length - 1; i >= 0; i--) {
|
|
884
|
+
const o = this.rows[i];
|
|
885
|
+
o.parent && l.add(o.parent), n[i] = {
|
|
886
886
|
childrenOpen: !1,
|
|
887
887
|
expanded: !1,
|
|
888
888
|
indent: o.indent || null,
|
|
889
|
-
isParent: l.has(
|
|
889
|
+
isParent: l.has(i),
|
|
890
890
|
isRoot: o.parent === null || o.parent === void 0,
|
|
891
891
|
rowModified: !1,
|
|
892
892
|
open: o.parent === null || o.parent === void 0,
|
|
@@ -905,8 +905,8 @@ class zt {
|
|
|
905
905
|
return this.table[`${t}:${n}`];
|
|
906
906
|
}
|
|
907
907
|
setCellData(t, n, l) {
|
|
908
|
-
const
|
|
909
|
-
return this.table[
|
|
908
|
+
const i = `${n}:${t}`, o = this.columns[n];
|
|
909
|
+
return this.table[i] !== l && (this.display[t].rowModified = !0), this.table[i] = l, this.rows[t][o.name] = l, this.table[i];
|
|
910
910
|
}
|
|
911
911
|
toggleRowExpand(t) {
|
|
912
912
|
if (this.config.view === "tree") {
|
|
@@ -929,26 +929,30 @@ const Ft = {
|
|
|
929
929
|
tableid: {}
|
|
930
930
|
},
|
|
931
931
|
setup(e) {
|
|
932
|
-
const t = Q(e.tableid), n = x(() => t.columns.some((
|
|
933
|
-
minWidth:
|
|
934
|
-
textAlign:
|
|
932
|
+
const t = Q(e.tableid), n = x(() => t.columns.some((i) => i.pinned)), l = (i) => ({
|
|
933
|
+
minWidth: i.width || "40ch",
|
|
934
|
+
textAlign: i.align || "center",
|
|
935
935
|
width: t.config.fullWidth ? "auto" : null
|
|
936
936
|
});
|
|
937
|
-
return (
|
|
937
|
+
return (i, o) => i.columns.length ? (h(), k("thead", Ft, [
|
|
938
938
|
W("tr", Gt, [
|
|
939
939
|
m(t).zeroColumn ? (h(), k("th", {
|
|
940
940
|
key: 0,
|
|
941
941
|
id: "header-index",
|
|
942
|
-
class: N(
|
|
942
|
+
class: N([[
|
|
943
|
+
n.value ? "sticky-index" : "",
|
|
944
|
+
m(t).config.view === "tree" ? "tree-index" : "",
|
|
945
|
+
m(t).config.view === "list-expansion" ? "list-expansion-index" : ""
|
|
946
|
+
], "list-index"])
|
|
943
947
|
}, null, 2)) : J("", !0),
|
|
944
|
-
(h(!0), k(X, null, oe(
|
|
948
|
+
(h(!0), k(X, null, oe(i.columns, (a, s) => (h(), k("th", {
|
|
945
949
|
key: a.name,
|
|
946
950
|
tabindex: "-1",
|
|
947
951
|
style: P(l(a)),
|
|
948
952
|
class: N(a.pinned ? "sticky-column" : "")
|
|
949
953
|
}, [
|
|
950
|
-
S(
|
|
951
|
-
Ze(B(a.label || String.fromCharCode(
|
|
954
|
+
S(i.$slots, "default", {}, () => [
|
|
955
|
+
Ze(B(a.label || String.fromCharCode(s + 97).toUpperCase()), 1)
|
|
952
956
|
])
|
|
953
957
|
], 6))), 128))
|
|
954
958
|
])
|
|
@@ -985,7 +989,7 @@ const Ft = {
|
|
|
985
989
|
},
|
|
986
990
|
emits: ["update:modelValue"],
|
|
987
991
|
setup(e, { emit: t }) {
|
|
988
|
-
const n = t, l = Z("table"),
|
|
992
|
+
const n = t, l = Z("table"), i = e.modelValue ? e.modelValue : e.rows, o = new zt(e.id, e.columns, i, e.config);
|
|
989
993
|
Ke(o.id, o), C(
|
|
990
994
|
() => o.rows,
|
|
991
995
|
(d) => {
|
|
@@ -1008,7 +1012,7 @@ const Ft = {
|
|
|
1008
1012
|
(g.classList.contains("sticky-column") || g.classList.contains("sticky-index")) && (g.style.left = `${f}px`, f += g.offsetWidth, v.push(g));
|
|
1009
1013
|
v.length > 0 && v[v.length - 1].classList.add("sticky-column-edge");
|
|
1010
1014
|
}
|
|
1011
|
-
},
|
|
1015
|
+
}, s = (d) => {
|
|
1012
1016
|
var r;
|
|
1013
1017
|
d.target instanceof Node && (r = o.modal.parent) != null && r.contains(d.target) || o.modal.visible && (o.modal.visible = !1);
|
|
1014
1018
|
};
|
|
@@ -1086,15 +1090,15 @@ const Ft = {
|
|
|
1086
1090
|
])
|
|
1087
1091
|
], !0)
|
|
1088
1092
|
], 4)), [
|
|
1089
|
-
[m(jt),
|
|
1093
|
+
[m(jt), s]
|
|
1090
1094
|
]);
|
|
1091
1095
|
}
|
|
1092
1096
|
}), qt = (e, t) => {
|
|
1093
1097
|
const n = e.__vccOpts || e;
|
|
1094
|
-
for (const [l,
|
|
1095
|
-
n[l] =
|
|
1098
|
+
for (const [l, i] of t)
|
|
1099
|
+
n[l] = i;
|
|
1096
1100
|
return n;
|
|
1097
|
-
}, Yt = /* @__PURE__ */ qt(Ut, [["__scopeId", "data-v-
|
|
1101
|
+
}, Yt = /* @__PURE__ */ qt(Ut, [["__scopeId", "data-v-3b613fb3"]]);
|
|
1098
1102
|
function Zt(e) {
|
|
1099
1103
|
e.component("ACell", We), e.component("AExpansionRow", Mt), e.component("ARow", He), e.component("ATable", Yt), e.component("ATableHeader", ze), e.component("ATableModal", Fe);
|
|
1100
1104
|
}
|