@stonecrop/atable 0.2.38 → 0.2.39
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.d.ts +2 -2
- package/dist/atable.js +213 -217
- package/dist/atable.js.map +1 -1
- package/dist/atable.umd.cjs +1 -1
- package/dist/atable.umd.cjs.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +4 -4
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/src/components/ACell.vue +36 -29
- package/src/index.ts +1 -1
- package/src/types/index.ts +4 -4
package/dist/atable.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var Pe = Object.defineProperty;
|
|
2
2
|
var He = (e, t, n) => t in e ? Pe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var
|
|
4
|
-
import { onMounted as xe, ref as
|
|
5
|
-
function
|
|
3
|
+
var S = (e, t, n) => He(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { onMounted as xe, ref as k, watch as D, onBeforeUnmount as je, computed as y, unref as f, getCurrentScope as Ee, onScopeDispose as Ie, getCurrentInstance as Ne, defineComponent as T, inject as Y, useTemplateRef as ee, openBlock as h, createElementBlock as b, createBlock as B, resolveDynamicComponent as ke, mergeProps as te, toDisplayString as P, Fragment as q, createElementVNode as O, renderSlot as I, createCommentVNode as G, withDirectives as Z, vShow as Ce, toRef as We, readonly as Ve, customRef as Ue, reactive as $, renderList as K, normalizeStyle as z, createTextVNode as Be, provide as ze, nextTick as Fe, createVNode as de, withCtx as ce } from "vue";
|
|
5
|
+
function Ae(e) {
|
|
6
6
|
return Ee() ? (Ie(e), !0) : !1;
|
|
7
7
|
}
|
|
8
8
|
function ne(e) {
|
|
9
|
-
return typeof e == "function" ? e() :
|
|
9
|
+
return typeof e == "function" ? e() : f(e);
|
|
10
10
|
}
|
|
11
11
|
const qe = typeof window < "u" && typeof document < "u";
|
|
12
12
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
@@ -23,54 +23,54 @@ function j(...e) {
|
|
|
23
23
|
return Je;
|
|
24
24
|
Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
|
|
25
25
|
const i = [], a = () => {
|
|
26
|
-
i.forEach((
|
|
27
|
-
}, r = (
|
|
26
|
+
i.forEach((d) => d()), i.length = 0;
|
|
27
|
+
}, r = (d, p, c, m) => (d.addEventListener(p, c, m), () => d.removeEventListener(p, c, m)), u = D(
|
|
28
28
|
() => [H(t), ne(l)],
|
|
29
|
-
([
|
|
30
|
-
if (a(), !
|
|
29
|
+
([d, p]) => {
|
|
30
|
+
if (a(), !d)
|
|
31
31
|
return;
|
|
32
|
-
const c = Xe(
|
|
32
|
+
const c = Xe(p) ? { ...p } : p;
|
|
33
33
|
i.push(
|
|
34
|
-
...n.flatMap((
|
|
34
|
+
...n.flatMap((m) => o.map((w) => r(d, m, w, c)))
|
|
35
35
|
);
|
|
36
36
|
},
|
|
37
37
|
{ immediate: !0, flush: "post" }
|
|
38
|
-
),
|
|
38
|
+
), s = () => {
|
|
39
39
|
u(), a();
|
|
40
40
|
};
|
|
41
|
-
return
|
|
41
|
+
return Ae(s), s;
|
|
42
42
|
}
|
|
43
43
|
function Qe() {
|
|
44
|
-
const e =
|
|
44
|
+
const e = k(!1), t = Ne();
|
|
45
45
|
return t && xe(() => {
|
|
46
46
|
e.value = !0;
|
|
47
47
|
}, t), e;
|
|
48
48
|
}
|
|
49
49
|
function Ze(e) {
|
|
50
50
|
const t = Qe();
|
|
51
|
-
return
|
|
51
|
+
return y(() => (t.value, !!e()));
|
|
52
52
|
}
|
|
53
53
|
function Ke(e, t, n = {}) {
|
|
54
54
|
const { window: o = N, ...l } = n;
|
|
55
55
|
let i;
|
|
56
56
|
const a = Ze(() => o && "MutationObserver" in o), r = () => {
|
|
57
57
|
i && (i.disconnect(), i = void 0);
|
|
58
|
-
}, u =
|
|
59
|
-
const c = ne(e),
|
|
60
|
-
return new Set(
|
|
61
|
-
}),
|
|
58
|
+
}, u = y(() => {
|
|
59
|
+
const c = ne(e), m = (Array.isArray(c) ? c : [c]).map(H).filter(Ge);
|
|
60
|
+
return new Set(m);
|
|
61
|
+
}), s = D(
|
|
62
62
|
() => u.value,
|
|
63
63
|
(c) => {
|
|
64
|
-
r(), a.value && c.size && (i = new MutationObserver(t), c.forEach((
|
|
64
|
+
r(), a.value && c.size && (i = new MutationObserver(t), c.forEach((m) => i.observe(m, l)));
|
|
65
65
|
},
|
|
66
66
|
{ immediate: !0, flush: "post" }
|
|
67
|
-
),
|
|
68
|
-
|
|
67
|
+
), d = () => i == null ? void 0 : i.takeRecords(), p = () => {
|
|
68
|
+
s(), r();
|
|
69
69
|
};
|
|
70
|
-
return
|
|
70
|
+
return Ae(p), {
|
|
71
71
|
isSupported: a,
|
|
72
|
-
stop:
|
|
73
|
-
takeRecords:
|
|
72
|
+
stop: p,
|
|
73
|
+
takeRecords: d
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
function _e(e = {}) {
|
|
@@ -80,20 +80,20 @@ function _e(e = {}) {
|
|
|
80
80
|
deep: o = !0,
|
|
81
81
|
triggerOnRemoval: l = !1
|
|
82
82
|
} = e, i = (t = e.document) != null ? t : n == null ? void 0 : n.document, a = () => {
|
|
83
|
-
var
|
|
84
|
-
let
|
|
83
|
+
var s;
|
|
84
|
+
let d = i == null ? void 0 : i.activeElement;
|
|
85
85
|
if (o)
|
|
86
|
-
for (;
|
|
87
|
-
|
|
88
|
-
return
|
|
89
|
-
}, r =
|
|
86
|
+
for (; d != null && d.shadowRoot; )
|
|
87
|
+
d = (s = d == null ? void 0 : d.shadowRoot) == null ? void 0 : s.activeElement;
|
|
88
|
+
return d;
|
|
89
|
+
}, r = k(), u = () => {
|
|
90
90
|
r.value = a();
|
|
91
91
|
};
|
|
92
|
-
return n && (j(n, "blur", (
|
|
93
|
-
|
|
94
|
-
}, !0), j(n, "focus", u, !0)), l && Ke(i, (
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
return n && (j(n, "blur", (s) => {
|
|
93
|
+
s.relatedTarget === null && u();
|
|
94
|
+
}, !0), j(n, "focus", u, !0)), l && Ke(i, (s) => {
|
|
95
|
+
s.filter((d) => d.removedNodes.length).map((d) => Array.from(d.removedNodes)).flat().forEach((d) => {
|
|
96
|
+
d === r.value && u();
|
|
97
97
|
});
|
|
98
98
|
}, {
|
|
99
99
|
childList: !0,
|
|
@@ -102,11 +102,11 @@ function _e(e = {}) {
|
|
|
102
102
|
}
|
|
103
103
|
const et = "focusin", tt = "focusout";
|
|
104
104
|
function nt(e, t = {}) {
|
|
105
|
-
const { window: n = N } = t, o =
|
|
105
|
+
const { window: n = N } = t, o = y(() => H(e)), l = k(!1), i = y(() => l.value), a = _e(t);
|
|
106
106
|
return !n || !a.value ? { focused: i } : (j(o, et, () => l.value = !0), j(o, tt, () => l.value = !1), { focused: i });
|
|
107
107
|
}
|
|
108
108
|
function ot(e, { window: t = N, scrollTarget: n } = {}) {
|
|
109
|
-
const o =
|
|
109
|
+
const o = k(!1), l = () => {
|
|
110
110
|
if (!t) return;
|
|
111
111
|
const i = t.document, a = H(e);
|
|
112
112
|
if (!a)
|
|
@@ -116,7 +116,7 @@ function ot(e, { window: t = N, scrollTarget: n } = {}) {
|
|
|
116
116
|
o.value = r.top <= (t.innerHeight || i.documentElement.clientHeight) && r.left <= (t.innerWidth || i.documentElement.clientWidth) && r.bottom >= 0 && r.right >= 0;
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
|
-
return
|
|
119
|
+
return D(
|
|
120
120
|
() => H(e),
|
|
121
121
|
() => l(),
|
|
122
122
|
{ immediate: !0, flush: "post" }
|
|
@@ -125,7 +125,7 @@ function ot(e, { window: t = N, scrollTarget: n } = {}) {
|
|
|
125
125
|
passive: !0
|
|
126
126
|
}), o;
|
|
127
127
|
}
|
|
128
|
-
const
|
|
128
|
+
const C = (e) => {
|
|
129
129
|
let t = ot(e).value;
|
|
130
130
|
return t = t && e.offsetHeight > 0, t;
|
|
131
131
|
}, A = (e) => e.tabIndex >= 0, ue = (e) => {
|
|
@@ -144,7 +144,7 @@ const k = (e) => {
|
|
|
144
144
|
const o = e.previousElementSibling;
|
|
145
145
|
o && (n = o);
|
|
146
146
|
}
|
|
147
|
-
return n && (!A(n) || !
|
|
147
|
+
return n && (!A(n) || !C(n)) ? oe(n) : n;
|
|
148
148
|
}, lt = (e) => {
|
|
149
149
|
var t;
|
|
150
150
|
const n = e.target;
|
|
@@ -162,7 +162,7 @@ const k = (e) => {
|
|
|
162
162
|
i && (o = i);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
return o && (!A(o) || !
|
|
165
|
+
return o && (!A(o) || !C(o)) ? le(o) : o;
|
|
166
166
|
}, fe = (e) => {
|
|
167
167
|
const t = e.target;
|
|
168
168
|
return le(t);
|
|
@@ -179,7 +179,7 @@ const k = (e) => {
|
|
|
179
179
|
const o = e.nextElementSibling;
|
|
180
180
|
o && (n = o);
|
|
181
181
|
}
|
|
182
|
-
return n && (!A(n) || !
|
|
182
|
+
return n && (!A(n) || !C(n)) ? le(n) : n;
|
|
183
183
|
}, at = (e) => {
|
|
184
184
|
var t;
|
|
185
185
|
const n = e.target;
|
|
@@ -197,7 +197,7 @@ const k = (e) => {
|
|
|
197
197
|
i && (o = i);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
return o && (!A(o) || !
|
|
200
|
+
return o && (!A(o) || !C(o)) ? oe(o) : o;
|
|
201
201
|
}, me = (e) => {
|
|
202
202
|
const t = e.target;
|
|
203
203
|
return ae(t);
|
|
@@ -210,7 +210,7 @@ const k = (e) => {
|
|
|
210
210
|
const o = (t = e.parentElement) == null ? void 0 : t.previousElementSibling;
|
|
211
211
|
n = o == null ? void 0 : o.lastElementChild;
|
|
212
212
|
}
|
|
213
|
-
return n && (!A(n) || !
|
|
213
|
+
return n && (!A(n) || !C(n)) ? ae(n) : n;
|
|
214
214
|
}, pe = (e) => {
|
|
215
215
|
const t = e.target;
|
|
216
216
|
return ie(t);
|
|
@@ -223,13 +223,13 @@ const k = (e) => {
|
|
|
223
223
|
const o = (t = e.parentElement) == null ? void 0 : t.nextElementSibling;
|
|
224
224
|
n = o == null ? void 0 : o.firstElementChild;
|
|
225
225
|
}
|
|
226
|
-
return n && (!A(n) || !
|
|
226
|
+
return n && (!A(n) || !C(n)) ? ie(n) : n;
|
|
227
227
|
}, ve = (e) => {
|
|
228
228
|
const t = e.target.parentElement.firstElementChild;
|
|
229
|
-
return t && (!A(t) || !
|
|
229
|
+
return t && (!A(t) || !C(t)) ? ie(t) : t;
|
|
230
230
|
}, we = (e) => {
|
|
231
231
|
const t = e.target.parentElement.lastElementChild;
|
|
232
|
-
return t && (!A(t) || !
|
|
232
|
+
return t && (!A(t) || !C(t)) ? ae(t) : t;
|
|
233
233
|
}, V = ["alt", "control", "shift", "meta"], it = {
|
|
234
234
|
ArrowUp: "up",
|
|
235
235
|
ArrowDown: "down",
|
|
@@ -309,52 +309,52 @@ function se(e) {
|
|
|
309
309
|
if (typeof a.selectors == "string")
|
|
310
310
|
u = r ? Array.from(r.querySelectorAll(a.selectors)) : Array.from(document.querySelectorAll(a.selectors));
|
|
311
311
|
else if (Array.isArray(a.selectors))
|
|
312
|
-
for (const
|
|
313
|
-
|
|
312
|
+
for (const s of a.selectors)
|
|
313
|
+
s instanceof HTMLElement ? u.push(s) : u.push(s.$el);
|
|
314
314
|
else if (a.selectors instanceof HTMLElement)
|
|
315
315
|
u.push(a.selectors);
|
|
316
316
|
else if (Array.isArray(a.selectors.value))
|
|
317
|
-
for (const
|
|
318
|
-
|
|
317
|
+
for (const s of a.selectors.value)
|
|
318
|
+
s instanceof HTMLElement ? u.push(s) : u.push(s.$el);
|
|
319
319
|
else
|
|
320
320
|
u.push(a.selectors.value);
|
|
321
321
|
return u;
|
|
322
322
|
}, o = (a) => {
|
|
323
323
|
const r = t(a);
|
|
324
324
|
let u = [];
|
|
325
|
-
return a.selectors ? u = n(a) : r && (u = Array.from(r.children).filter((
|
|
325
|
+
return a.selectors ? u = n(a) : r && (u = Array.from(r.children).filter((s) => A(s) && C(s))), u;
|
|
326
326
|
}, l = (a) => (r) => {
|
|
327
327
|
const u = it[r.key] || r.key.toLowerCase();
|
|
328
328
|
if (V.includes(u)) return;
|
|
329
|
-
const
|
|
330
|
-
for (const
|
|
331
|
-
const [
|
|
332
|
-
if (
|
|
333
|
-
const
|
|
334
|
-
const
|
|
335
|
-
return r.getModifierState(
|
|
329
|
+
const s = a.handlers || re;
|
|
330
|
+
for (const d of Object.keys(s)) {
|
|
331
|
+
const [p, ...c] = d.split(".");
|
|
332
|
+
if (p === "keydown" && c.includes(u)) {
|
|
333
|
+
const m = s[d], w = c.filter((x) => V.includes(x)), W = V.some((x) => {
|
|
334
|
+
const v = x.charAt(0).toUpperCase() + x.slice(1);
|
|
335
|
+
return r.getModifierState(v);
|
|
336
336
|
});
|
|
337
|
-
if (
|
|
338
|
-
if (
|
|
339
|
-
for (const
|
|
340
|
-
if (c.includes(
|
|
341
|
-
const
|
|
342
|
-
r.getModifierState(
|
|
337
|
+
if (w.length > 0) {
|
|
338
|
+
if (W) {
|
|
339
|
+
for (const x of V)
|
|
340
|
+
if (c.includes(x)) {
|
|
341
|
+
const v = x.charAt(0).toUpperCase() + x.slice(1);
|
|
342
|
+
r.getModifierState(v) && m(r);
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
} else
|
|
346
|
-
|
|
346
|
+
W || m(r);
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
}, i = [];
|
|
350
350
|
xe(() => {
|
|
351
351
|
for (const a of e) {
|
|
352
|
-
const r = t(a), u = o(a),
|
|
353
|
-
for (const
|
|
354
|
-
const { focused: c } = nt(
|
|
355
|
-
|
|
352
|
+
const r = t(a), u = o(a), s = l(a), d = r ? [r] : u;
|
|
353
|
+
for (const p of d) {
|
|
354
|
+
const { focused: c } = nt(k(p)), m = D(c, (w) => {
|
|
355
|
+
w ? p.addEventListener("keydown", s) : p.removeEventListener("keydown", s);
|
|
356
356
|
});
|
|
357
|
-
i.push(
|
|
357
|
+
i.push(m);
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
}), je(() => {
|
|
@@ -372,71 +372,67 @@ const rt = ["data-colindex", "data-rowindex", "data-editable", "contenteditable"
|
|
|
372
372
|
tabIndex: { default: 0 }
|
|
373
373
|
},
|
|
374
374
|
setup(e) {
|
|
375
|
-
var
|
|
376
|
-
const t = Y(e.tableid), n = ee("cell"), o =
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}), a = () => {
|
|
384
|
-
if (t.columns[e.colIndex].mask, t.columns[e.colIndex].modalComponent) {
|
|
385
|
-
const f = n.value.getBoundingClientRect();
|
|
386
|
-
t.modal.visible = !0, t.modal.colIndex = e.colIndex, t.modal.rowIndex = e.rowIndex, t.modal.parent = n.value, t.modal.top = f.top + f.height, t.modal.left = f.left, t.modal.width = u.value, t.modal.component = t.columns[e.colIndex].modalComponent, t.modal.componentProps = t.columns[e.colIndex].modalComponentProps;
|
|
375
|
+
var x;
|
|
376
|
+
const t = Y(e.tableid), n = ee("cell"), o = k(""), l = k(!1), i = t.table, a = t.columns[e.colIndex], r = t.rows[e.rowIndex], u = y(() => {
|
|
377
|
+
const v = t.cellData(e.colIndex, e.rowIndex), E = a.format;
|
|
378
|
+
return E ? typeof E == "function" ? E(v, { table: i, row: r, column: a }) : typeof E == "string" ? Function(`"use strict";return (${E})`)()(v, { table: i, row: r, column: a }) : v : v;
|
|
379
|
+
}), s = () => {
|
|
380
|
+
if (a.mask, a.modalComponent) {
|
|
381
|
+
const v = n.value.getBoundingClientRect();
|
|
382
|
+
t.modal.visible = !0, t.modal.colIndex = e.colIndex, t.modal.rowIndex = e.rowIndex, t.modal.parent = n.value, t.modal.top = v.top + v.height, t.modal.left = v.left, t.modal.width = p.value, typeof a.modalComponent == "function" ? t.modal.component = a.modalComponent({ table: i, row: r, column: a }) : t.modal.component = a.modalComponent, t.modal.componentProps = a.modalComponentExtraProps;
|
|
387
383
|
}
|
|
388
384
|
};
|
|
389
385
|
if (e.addNavigation) {
|
|
390
|
-
let
|
|
386
|
+
let v = {
|
|
391
387
|
...re,
|
|
392
|
-
"keydown.f2":
|
|
393
|
-
"keydown.alt.up":
|
|
394
|
-
"keydown.alt.down":
|
|
395
|
-
"keydown.alt.left":
|
|
396
|
-
"keydown.alt.right":
|
|
388
|
+
"keydown.f2": s,
|
|
389
|
+
"keydown.alt.up": s,
|
|
390
|
+
"keydown.alt.down": s,
|
|
391
|
+
"keydown.alt.left": s,
|
|
392
|
+
"keydown.alt.right": s
|
|
397
393
|
};
|
|
398
|
-
typeof e.addNavigation == "object" && (
|
|
399
|
-
...
|
|
394
|
+
typeof e.addNavigation == "object" && (v = {
|
|
395
|
+
...v,
|
|
400
396
|
...e.addNavigation
|
|
401
397
|
}), se([
|
|
402
398
|
{
|
|
403
399
|
selectors: n,
|
|
404
|
-
handlers:
|
|
400
|
+
handlers: v
|
|
405
401
|
}
|
|
406
402
|
]);
|
|
407
403
|
}
|
|
408
|
-
const
|
|
404
|
+
const d = y(() => a.align || "center"), p = y(() => a.width || "40ch"), c = () => {
|
|
409
405
|
n.value && (o.value = n.value.textContent);
|
|
410
|
-
},
|
|
411
|
-
n.value && n.value.textContent !== o.value && (o.value = n.value.textContent, n.value.dispatchEvent(new Event("change")), l.value = !0,
|
|
412
|
-
},
|
|
413
|
-
textAlign:
|
|
414
|
-
width:
|
|
406
|
+
}, m = () => {
|
|
407
|
+
n.value && n.value.textContent !== o.value && (o.value = n.value.textContent, n.value.dispatchEvent(new Event("change")), l.value = !0, a.format || t.setCellData(e.rowIndex, e.colIndex, o.value));
|
|
408
|
+
}, w = (v, E) => E && v === 0 && E > 0 ? `${E}ch` : "inherit", W = {
|
|
409
|
+
textAlign: d.value,
|
|
410
|
+
width: p.value,
|
|
415
411
|
backgroundColor: l.value ? "var(--cell-modified-color)" : "inherit",
|
|
416
412
|
fontWeight: l.value ? "bold" : "inherit",
|
|
417
|
-
paddingLeft:
|
|
413
|
+
paddingLeft: w(e.colIndex, (x = t.display[e.rowIndex]) == null ? void 0 : x.indent)
|
|
418
414
|
};
|
|
419
|
-
return (
|
|
415
|
+
return (v, E) => (h(), b("td", {
|
|
420
416
|
ref: "cell",
|
|
421
|
-
"data-colindex":
|
|
422
|
-
"data-rowindex":
|
|
423
|
-
"data-editable":
|
|
424
|
-
contenteditable:
|
|
425
|
-
tabindex:
|
|
417
|
+
"data-colindex": v.colIndex,
|
|
418
|
+
"data-rowindex": v.rowIndex,
|
|
419
|
+
"data-editable": f(t).columns[v.colIndex].edit,
|
|
420
|
+
contenteditable: f(t).columns[v.colIndex].edit,
|
|
421
|
+
tabindex: v.tabIndex,
|
|
426
422
|
spellcheck: !1,
|
|
427
|
-
style:
|
|
428
|
-
onFocus:
|
|
429
|
-
onPaste:
|
|
430
|
-
onBlur:
|
|
431
|
-
onInput:
|
|
432
|
-
onClick:
|
|
433
|
-
onMousedown:
|
|
423
|
+
style: W,
|
|
424
|
+
onFocus: c,
|
|
425
|
+
onPaste: m,
|
|
426
|
+
onBlur: m,
|
|
427
|
+
onInput: m,
|
|
428
|
+
onClick: s,
|
|
429
|
+
onMousedown: s,
|
|
434
430
|
class: "atable__cell"
|
|
435
431
|
}, [
|
|
436
|
-
|
|
432
|
+
f(t).columns[v.colIndex].cellComponent ? (h(), B(ke(f(t).columns[v.colIndex].cellComponent), te({
|
|
437
433
|
key: 0,
|
|
438
|
-
value:
|
|
439
|
-
},
|
|
434
|
+
value: u.value
|
|
435
|
+
}, f(t).columns[v.colIndex].cellComponentProps), null, 16, ["value"])) : (h(), b("span", st, P(u.value), 1))
|
|
440
436
|
], 40, rt));
|
|
441
437
|
}
|
|
442
438
|
}), dt = ["tabindex"], ct = ["tabindex"], ut = ["colspan"], ft = /* @__PURE__ */ T({
|
|
@@ -449,7 +445,7 @@ const rt = ["data-colindex", "data-rowindex", "data-editable", "contenteditable"
|
|
|
449
445
|
addNavigation: { type: [Boolean, Object] }
|
|
450
446
|
},
|
|
451
447
|
setup(e) {
|
|
452
|
-
const t = Y(e.tableid), n = ee("rowEl"), o =
|
|
448
|
+
const t = Y(e.tableid), n = ee("rowEl"), o = y(() => t.display[e.rowIndex].expanded ? "▼" : "►");
|
|
453
449
|
if (e.addNavigation) {
|
|
454
450
|
const l = {
|
|
455
451
|
"keydown.control.g": (i) => {
|
|
@@ -463,7 +459,7 @@ const rt = ["data-colindex", "data-rowindex", "data-editable", "contenteditable"
|
|
|
463
459
|
}
|
|
464
460
|
]);
|
|
465
461
|
}
|
|
466
|
-
return (l, i) => (
|
|
462
|
+
return (l, i) => (h(), b(q, null, [
|
|
467
463
|
O("tr", te(l.$attrs, {
|
|
468
464
|
ref: "rowEl",
|
|
469
465
|
tabindex: l.tabIndex,
|
|
@@ -471,12 +467,12 @@ const rt = ["data-colindex", "data-rowindex", "data-editable", "contenteditable"
|
|
|
471
467
|
}), [
|
|
472
468
|
O("td", {
|
|
473
469
|
tabIndex: -1,
|
|
474
|
-
onClick: i[0] || (i[0] = (a) =>
|
|
470
|
+
onClick: i[0] || (i[0] = (a) => f(t).toggleRowExpand(l.rowIndex)),
|
|
475
471
|
class: "row-index"
|
|
476
472
|
}, P(o.value), 1),
|
|
477
|
-
|
|
473
|
+
I(l.$slots, "row")
|
|
478
474
|
], 16, dt),
|
|
479
|
-
|
|
475
|
+
f(t).display[l.rowIndex].expanded ? (h(), b("tr", {
|
|
480
476
|
key: 0,
|
|
481
477
|
ref: "rowExpanded",
|
|
482
478
|
tabindex: l.tabIndex,
|
|
@@ -484,10 +480,10 @@ const rt = ["data-colindex", "data-rowindex", "data-editable", "contenteditable"
|
|
|
484
480
|
}, [
|
|
485
481
|
O("td", {
|
|
486
482
|
tabIndex: -1,
|
|
487
|
-
colspan:
|
|
483
|
+
colspan: f(t).columns.length + 1,
|
|
488
484
|
class: "expanded-row-content"
|
|
489
485
|
}, [
|
|
490
|
-
|
|
486
|
+
I(l.$slots, "content")
|
|
491
487
|
], 8, ut)
|
|
492
488
|
], 8, ct)) : G("", !0)
|
|
493
489
|
], 64));
|
|
@@ -506,7 +502,7 @@ const rt = ["data-colindex", "data-rowindex", "data-editable", "contenteditable"
|
|
|
506
502
|
addNavigation: { type: [Boolean, Object], default: !1 }
|
|
507
503
|
},
|
|
508
504
|
setup(e) {
|
|
509
|
-
const t = Y(e.tableid), n = ee("rowEl"), o =
|
|
505
|
+
const t = Y(e.tableid), n = ee("rowEl"), o = y(() => t.config.view !== "tree" || t.display[e.rowIndex].isRoot || t.display[e.rowIndex].open), l = y(() => t.config.view !== "tree" ? "" : t.display[e.rowIndex].isRoot || t.display[e.rowIndex].isParent ? t.display[e.rowIndex].childrenOpen ? "-" : "+" : ""), i = (a) => {
|
|
510
506
|
t.toggleRowExpand(a);
|
|
511
507
|
};
|
|
512
508
|
if (e.addNavigation) {
|
|
@@ -521,22 +517,22 @@ const rt = ["data-colindex", "data-rowindex", "data-editable", "contenteditable"
|
|
|
521
517
|
}
|
|
522
518
|
]);
|
|
523
519
|
}
|
|
524
|
-
return (a, r) => Z((
|
|
520
|
+
return (a, r) => Z((h(), b("tr", {
|
|
525
521
|
ref: "rowEl",
|
|
526
522
|
tabindex: a.tabIndex,
|
|
527
523
|
class: "table-row"
|
|
528
524
|
}, [
|
|
529
|
-
|
|
530
|
-
|
|
525
|
+
I(a.$slots, "index", {}, () => [
|
|
526
|
+
f(t).config.view === "list" ? (h(), b("td", pt, P(a.rowIndex + 1), 1)) : f(t).config.view === "tree" ? (h(), b("td", {
|
|
531
527
|
key: 1,
|
|
532
528
|
tabIndex: -1,
|
|
533
529
|
class: "tree-index",
|
|
534
530
|
onClick: r[0] || (r[0] = (u) => i(a.rowIndex))
|
|
535
531
|
}, P(l.value), 1)) : G("", !0)
|
|
536
532
|
]),
|
|
537
|
-
|
|
533
|
+
I(a.$slots, "default")
|
|
538
534
|
], 8, mt)), [
|
|
539
|
-
[
|
|
535
|
+
[Ce, o.value]
|
|
540
536
|
]);
|
|
541
537
|
}
|
|
542
538
|
});
|
|
@@ -544,7 +540,7 @@ function Te(e) {
|
|
|
544
540
|
return Ee() ? (Ie(e), !0) : !1;
|
|
545
541
|
}
|
|
546
542
|
function L(e) {
|
|
547
|
-
return typeof e == "function" ? e() :
|
|
543
|
+
return typeof e == "function" ? e() : f(e);
|
|
548
544
|
}
|
|
549
545
|
const $e = typeof window < "u" && typeof document < "u";
|
|
550
546
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
@@ -563,7 +559,7 @@ function gt(...e) {
|
|
|
563
559
|
if (e.length !== 1)
|
|
564
560
|
return We(...e);
|
|
565
561
|
const t = e[0];
|
|
566
|
-
return typeof t == "function" ? Ve(Ue(() => ({ get: t, set: M }))) :
|
|
562
|
+
return typeof t == "function" ? Ve(Ue(() => ({ get: t, set: M }))) : k(t);
|
|
567
563
|
}
|
|
568
564
|
function R(e) {
|
|
569
565
|
var t;
|
|
@@ -577,22 +573,22 @@ function F(...e) {
|
|
|
577
573
|
return M;
|
|
578
574
|
Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
|
|
579
575
|
const i = [], a = () => {
|
|
580
|
-
i.forEach((
|
|
581
|
-
}, r = (
|
|
576
|
+
i.forEach((d) => d()), i.length = 0;
|
|
577
|
+
}, r = (d, p, c, m) => (d.addEventListener(p, c, m), () => d.removeEventListener(p, c, m)), u = D(
|
|
582
578
|
() => [R(t), L(l)],
|
|
583
|
-
([
|
|
584
|
-
if (a(), !
|
|
579
|
+
([d, p]) => {
|
|
580
|
+
if (a(), !d)
|
|
585
581
|
return;
|
|
586
|
-
const c = wt(
|
|
582
|
+
const c = wt(p) ? { ...p } : p;
|
|
587
583
|
i.push(
|
|
588
|
-
...n.flatMap((
|
|
584
|
+
...n.flatMap((m) => o.map((w) => r(d, m, w, c)))
|
|
589
585
|
);
|
|
590
586
|
},
|
|
591
587
|
{ immediate: !0, flush: "post" }
|
|
592
|
-
),
|
|
588
|
+
), s = () => {
|
|
593
589
|
u(), a();
|
|
594
590
|
};
|
|
595
|
-
return Te(
|
|
591
|
+
return Te(s), s;
|
|
596
592
|
}
|
|
597
593
|
let ge = !1;
|
|
598
594
|
function be(e, t, n = {}) {
|
|
@@ -601,17 +597,17 @@ function be(e, t, n = {}) {
|
|
|
601
597
|
return M;
|
|
602
598
|
_ && !ge && (ge = !0, Array.from(o.document.body.children).forEach((c) => c.addEventListener("click", M)), o.document.documentElement.addEventListener("click", M));
|
|
603
599
|
let r = !0;
|
|
604
|
-
const u = (c) => l.some((
|
|
605
|
-
if (typeof
|
|
606
|
-
return Array.from(o.document.querySelectorAll(
|
|
600
|
+
const u = (c) => l.some((m) => {
|
|
601
|
+
if (typeof m == "string")
|
|
602
|
+
return Array.from(o.document.querySelectorAll(m)).some((w) => w === c.target || c.composedPath().includes(w));
|
|
607
603
|
{
|
|
608
|
-
const
|
|
609
|
-
return
|
|
604
|
+
const w = R(m);
|
|
605
|
+
return w && (c.target === w || c.composedPath().includes(w));
|
|
610
606
|
}
|
|
611
|
-
}),
|
|
607
|
+
}), d = [
|
|
612
608
|
F(o, "click", (c) => {
|
|
613
|
-
const
|
|
614
|
-
if (!(!
|
|
609
|
+
const m = R(e);
|
|
610
|
+
if (!(!m || m === c.target || c.composedPath().includes(m))) {
|
|
615
611
|
if (c.detail === 0 && (r = !u(c)), !r) {
|
|
616
612
|
r = !0;
|
|
617
613
|
return;
|
|
@@ -620,18 +616,18 @@ function be(e, t, n = {}) {
|
|
|
620
616
|
}
|
|
621
617
|
}, { passive: !0, capture: i }),
|
|
622
618
|
F(o, "pointerdown", (c) => {
|
|
623
|
-
const
|
|
624
|
-
r = !u(c) && !!(
|
|
619
|
+
const m = R(e);
|
|
620
|
+
r = !u(c) && !!(m && !c.composedPath().includes(m));
|
|
625
621
|
}, { passive: !0 }),
|
|
626
622
|
a && F(o, "blur", (c) => {
|
|
627
623
|
setTimeout(() => {
|
|
628
|
-
var
|
|
629
|
-
const
|
|
630
|
-
((
|
|
624
|
+
var m;
|
|
625
|
+
const w = R(e);
|
|
626
|
+
((m = o.document.activeElement) == null ? void 0 : m.tagName) === "IFRAME" && !(w != null && w.contains(o.document.activeElement)) && t(c);
|
|
631
627
|
}, 0);
|
|
632
628
|
})
|
|
633
629
|
].filter(Boolean);
|
|
634
|
-
return () =>
|
|
630
|
+
return () => d.forEach((c) => c());
|
|
635
631
|
}
|
|
636
632
|
const bt = {
|
|
637
633
|
[he.mounted](e, t) {
|
|
@@ -665,16 +661,16 @@ function yt(e) {
|
|
|
665
661
|
}
|
|
666
662
|
const J = /* @__PURE__ */ new WeakMap();
|
|
667
663
|
function xt(e, t = !1) {
|
|
668
|
-
const n =
|
|
664
|
+
const n = k(t);
|
|
669
665
|
let o = null, l = "";
|
|
670
|
-
|
|
666
|
+
D(gt(e), (r) => {
|
|
671
667
|
const u = X(L(r));
|
|
672
668
|
if (u) {
|
|
673
|
-
const
|
|
674
|
-
if (J.get(
|
|
669
|
+
const s = u;
|
|
670
|
+
if (J.get(s) || J.set(s, s.style.overflow), s.style.overflow !== "hidden" && (l = s.style.overflow), s.style.overflow === "hidden")
|
|
675
671
|
return n.value = !0;
|
|
676
672
|
if (n.value)
|
|
677
|
-
return
|
|
673
|
+
return s.style.overflow = "hidden";
|
|
678
674
|
}
|
|
679
675
|
}, {
|
|
680
676
|
immediate: !0
|
|
@@ -693,7 +689,7 @@ function xt(e, t = !1) {
|
|
|
693
689
|
const r = X(L(e));
|
|
694
690
|
!r || !n.value || (_ && (o == null || o()), r.style.overflow = l, J.delete(r), n.value = !1);
|
|
695
691
|
};
|
|
696
|
-
return Te(a),
|
|
692
|
+
return Te(a), y({
|
|
697
693
|
get() {
|
|
698
694
|
return n.value;
|
|
699
695
|
},
|
|
@@ -704,48 +700,48 @@ function xt(e, t = !1) {
|
|
|
704
700
|
}
|
|
705
701
|
function Et() {
|
|
706
702
|
let e = !1;
|
|
707
|
-
const t =
|
|
703
|
+
const t = k(!1);
|
|
708
704
|
return (n, o) => {
|
|
709
705
|
if (t.value = o.value, e)
|
|
710
706
|
return;
|
|
711
707
|
e = !0;
|
|
712
708
|
const l = xt(n, o.value);
|
|
713
|
-
|
|
709
|
+
D(t, (i) => l.value = i);
|
|
714
710
|
};
|
|
715
711
|
}
|
|
716
712
|
Et();
|
|
717
|
-
var
|
|
713
|
+
var g = [];
|
|
718
714
|
for (var Q = 0; Q < 256; ++Q)
|
|
719
|
-
|
|
715
|
+
g.push((Q + 256).toString(16).slice(1));
|
|
720
716
|
function It(e, t = 0) {
|
|
721
|
-
return (
|
|
717
|
+
return (g[e[t + 0]] + g[e[t + 1]] + g[e[t + 2]] + g[e[t + 3]] + "-" + g[e[t + 4]] + g[e[t + 5]] + "-" + g[e[t + 6]] + g[e[t + 7]] + "-" + g[e[t + 8]] + g[e[t + 9]] + "-" + g[e[t + 10]] + g[e[t + 11]] + g[e[t + 12]] + g[e[t + 13]] + g[e[t + 14]] + g[e[t + 15]]).toLowerCase();
|
|
722
718
|
}
|
|
723
719
|
var U, kt = new Uint8Array(16);
|
|
724
|
-
function
|
|
720
|
+
function Ct() {
|
|
725
721
|
if (!U && (U = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !U))
|
|
726
722
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
727
723
|
return U(kt);
|
|
728
724
|
}
|
|
729
|
-
var
|
|
725
|
+
var At = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
730
726
|
const ye = {
|
|
731
|
-
randomUUID:
|
|
727
|
+
randomUUID: At
|
|
732
728
|
};
|
|
733
729
|
function St(e, t, n) {
|
|
734
730
|
if (ye.randomUUID && !t && !e)
|
|
735
731
|
return ye.randomUUID();
|
|
736
732
|
e = e || {};
|
|
737
|
-
var o = e.random || (e.rng ||
|
|
733
|
+
var o = e.random || (e.rng || Ct)();
|
|
738
734
|
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, It(o);
|
|
739
735
|
}
|
|
740
736
|
class Dt {
|
|
741
737
|
constructor(t, n, o, l, i, a) {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
738
|
+
S(this, "id");
|
|
739
|
+
S(this, "rows");
|
|
740
|
+
S(this, "columns");
|
|
741
|
+
S(this, "config");
|
|
742
|
+
S(this, "table");
|
|
743
|
+
S(this, "display");
|
|
744
|
+
S(this, "modal");
|
|
749
745
|
this.id = t || St(), this.rows = o, this.columns = $(n), this.config = $(l), this.table = i || $(this.createTableObject()), this.display = this.createDisplayObject(a), this.modal = $({ visible: !1 });
|
|
750
746
|
}
|
|
751
747
|
createTableObject() {
|
|
@@ -779,7 +775,7 @@ class Dt {
|
|
|
779
775
|
return ["list", "tree", "list-expansion"].includes(this.config.view);
|
|
780
776
|
}
|
|
781
777
|
get numberedRowWidth() {
|
|
782
|
-
return
|
|
778
|
+
return y(() => String(Math.ceil(this.rows.length / 100) + 1) + "ch");
|
|
783
779
|
}
|
|
784
780
|
cellData(t, n) {
|
|
785
781
|
return this.table[`${t}:${n}`];
|
|
@@ -818,15 +814,15 @@ const Tt = {
|
|
|
818
814
|
textAlign: o.align || "center",
|
|
819
815
|
width: t.config.fullWidth ? "auto" : null
|
|
820
816
|
});
|
|
821
|
-
return (o, l) => o.columns.length ? (
|
|
817
|
+
return (o, l) => o.columns.length ? (h(), b("thead", Tt, [
|
|
822
818
|
O("tr", $t, [
|
|
823
|
-
|
|
824
|
-
(
|
|
819
|
+
f(t).zeroColumn ? (h(), b("th", Rt)) : G("", !0),
|
|
820
|
+
(h(!0), b(q, null, K(o.columns, (i, a) => (h(), b("th", {
|
|
825
821
|
key: i.name,
|
|
826
822
|
tabindex: "-1",
|
|
827
823
|
style: z(n(i))
|
|
828
824
|
}, [
|
|
829
|
-
|
|
825
|
+
I(o.$slots, "default", {}, () => [
|
|
830
826
|
Be(P(i.label || String.fromCharCode(a + 97).toUpperCase()), 1)
|
|
831
827
|
])
|
|
832
828
|
], 4))), 128))
|
|
@@ -844,13 +840,13 @@ const Tt = {
|
|
|
844
840
|
const t = (n) => {
|
|
845
841
|
n.stopPropagation();
|
|
846
842
|
};
|
|
847
|
-
return (n, o) => (
|
|
843
|
+
return (n, o) => (h(), b("div", {
|
|
848
844
|
class: "amodal",
|
|
849
845
|
tabindex: "-1",
|
|
850
846
|
onClick: t,
|
|
851
847
|
onInput: t
|
|
852
848
|
}, [
|
|
853
|
-
|
|
849
|
+
I(n.$slots, "default")
|
|
854
850
|
], 32));
|
|
855
851
|
}
|
|
856
852
|
}), Ot = /* @__PURE__ */ T({
|
|
@@ -866,7 +862,7 @@ const Tt = {
|
|
|
866
862
|
emits: ["update:modelValue"],
|
|
867
863
|
setup(e, { emit: t }) {
|
|
868
864
|
const n = t, o = e.modelValue ? e.modelValue : e.rows, l = new Dt(e.id, e.columns, o, e.config);
|
|
869
|
-
ze(l.id, l),
|
|
865
|
+
ze(l.id, l), D(
|
|
870
866
|
() => l.rows,
|
|
871
867
|
(a) => {
|
|
872
868
|
n("update:modelValue", a);
|
|
@@ -885,37 +881,37 @@ const Tt = {
|
|
|
885
881
|
r.focus();
|
|
886
882
|
});
|
|
887
883
|
}
|
|
888
|
-
}), (a, r) => Z((
|
|
884
|
+
}), (a, r) => Z((h(), b("table", {
|
|
889
885
|
class: "atable",
|
|
890
|
-
style: z({ width:
|
|
886
|
+
style: z({ width: f(l).config.fullWidth ? "100%" : "auto" })
|
|
891
887
|
}, [
|
|
892
|
-
|
|
888
|
+
I(a.$slots, "header", { data: f(l) }, () => [
|
|
893
889
|
de(Le, {
|
|
894
|
-
columns:
|
|
895
|
-
tableid:
|
|
890
|
+
columns: f(l).columns,
|
|
891
|
+
tableid: f(l).id
|
|
896
892
|
}, null, 8, ["columns", "tableid"])
|
|
897
893
|
]),
|
|
898
894
|
O("tbody", null, [
|
|
899
|
-
|
|
900
|
-
(
|
|
895
|
+
I(a.$slots, "body", { data: f(l) }, () => [
|
|
896
|
+
(h(!0), b(q, null, K(f(l).rows, (u, s) => (h(), B(De, {
|
|
901
897
|
key: u.id,
|
|
902
898
|
row: u,
|
|
903
|
-
rowIndex:
|
|
904
|
-
tableid:
|
|
899
|
+
rowIndex: s,
|
|
900
|
+
tableid: f(l).id
|
|
905
901
|
}, {
|
|
906
902
|
default: ce(() => [
|
|
907
|
-
(
|
|
908
|
-
key:
|
|
909
|
-
tableid:
|
|
910
|
-
col:
|
|
903
|
+
(h(!0), b(q, null, K(f(l).columns, (d, p) => (h(), B(Se, {
|
|
904
|
+
key: d.name,
|
|
905
|
+
tableid: f(l).id,
|
|
906
|
+
col: d,
|
|
911
907
|
spellcheck: "false",
|
|
912
|
-
rowIndex:
|
|
913
|
-
colIndex:
|
|
914
|
-
component:
|
|
908
|
+
rowIndex: s,
|
|
909
|
+
colIndex: p + (f(l).zeroColumn ? 0 : -1),
|
|
910
|
+
component: d.cellComponent,
|
|
915
911
|
style: z({
|
|
916
|
-
textAlign: (
|
|
917
|
-
minWidth: (
|
|
918
|
-
width:
|
|
912
|
+
textAlign: (d == null ? void 0 : d.align) || "center",
|
|
913
|
+
minWidth: (d == null ? void 0 : d.width) || "40ch",
|
|
914
|
+
width: f(l).config.fullWidth ? "auto" : null
|
|
919
915
|
})
|
|
920
916
|
}, null, 8, ["tableid", "col", "rowIndex", "colIndex", "component", "style"]))), 128))
|
|
921
917
|
]),
|
|
@@ -923,33 +919,33 @@ const Tt = {
|
|
|
923
919
|
}, 1032, ["row", "rowIndex", "tableid"]))), 128))
|
|
924
920
|
])
|
|
925
921
|
]),
|
|
926
|
-
|
|
927
|
-
|
|
922
|
+
I(a.$slots, "footer", { data: f(l) }),
|
|
923
|
+
I(a.$slots, "modal", { data: f(l) }, () => [
|
|
928
924
|
Z(de(Me, {
|
|
929
|
-
colIndex:
|
|
930
|
-
rowIndex:
|
|
931
|
-
tableid:
|
|
925
|
+
colIndex: f(l).modal.colIndex,
|
|
926
|
+
rowIndex: f(l).modal.rowIndex,
|
|
927
|
+
tableid: f(l).id,
|
|
932
928
|
style: z({
|
|
933
|
-
left:
|
|
934
|
-
top:
|
|
935
|
-
maxWidth:
|
|
929
|
+
left: f(l).modal.left + "px",
|
|
930
|
+
top: f(l).modal.top + "px",
|
|
931
|
+
maxWidth: f(l).modal.width + "px"
|
|
936
932
|
})
|
|
937
933
|
}, {
|
|
938
934
|
default: ce(() => [
|
|
939
|
-
(
|
|
940
|
-
key: `${
|
|
941
|
-
colIndex:
|
|
942
|
-
rowIndex:
|
|
943
|
-
tableid:
|
|
944
|
-
},
|
|
935
|
+
(h(), B(ke(f(l).modal.component), te({
|
|
936
|
+
key: `${f(l).modal.rowIndex}:${f(l).modal.colIndex}`,
|
|
937
|
+
colIndex: f(l).modal.colIndex,
|
|
938
|
+
rowIndex: f(l).modal.rowIndex,
|
|
939
|
+
tableid: f(l).id
|
|
940
|
+
}, f(l).modal.componentProps), null, 16, ["colIndex", "rowIndex", "tableid"]))
|
|
945
941
|
]),
|
|
946
942
|
_: 1
|
|
947
943
|
}, 8, ["colIndex", "rowIndex", "tableid", "style"]), [
|
|
948
|
-
[
|
|
944
|
+
[Ce, f(l).modal.visible]
|
|
949
945
|
])
|
|
950
946
|
])
|
|
951
947
|
], 4)), [
|
|
952
|
-
[
|
|
948
|
+
[f(bt), i]
|
|
953
949
|
]);
|
|
954
950
|
}
|
|
955
951
|
});
|