@stonecrop/atable 0.3.10 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atable.d.ts +18 -18
- package/dist/atable.js +123 -123
- package/dist/atable.js.map +1 -1
- package/dist/atable.tsbuildinfo +1 -1
- package/dist/atable.umd.cjs +1 -1
- package/dist/atable.umd.cjs.map +1 -1
- package/dist/src/stores/table.d.ts +18 -18
- package/dist/src/stores/table.d.ts.map +1 -1
- package/dist/src/utils.d.ts +1 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/stores/table.js +2 -1
- package/dist/utils.js +3 -0
- package/package.json +4 -4
- package/src/stores/table.ts +2 -1
- package/src/utils.ts +4 -0
package/dist/atable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { onMounted as G, ref as x, watch as R, onBeforeUnmount as Ge, computed as k, unref as b, getCurrentScope as Re, onScopeDispose as Oe, getCurrentInstance as ue, nextTick as Le, toRef as Je, readonly as Qe, customRef as Ze, defineComponent as N, useTemplateRef as J, openBlock as C, createElementBlock as S, normalizeStyle as z, normalizeClass as F, createBlock as _, resolveDynamicComponent as Pe, mergeProps as de, toDisplayString as
|
|
1
|
+
import { onMounted as G, ref as x, watch as R, onBeforeUnmount as Ge, computed as k, unref as b, getCurrentScope as Re, onScopeDispose as Oe, getCurrentInstance as ue, nextTick as Le, toRef as Je, readonly as Qe, customRef as Ze, defineComponent as N, useTemplateRef as J, openBlock as C, createElementBlock as S, normalizeStyle as z, normalizeClass as F, createBlock as _, resolveDynamicComponent as Pe, mergeProps as de, toDisplayString as Y, Fragment as te, createElementVNode as B, renderSlot as O, createCommentVNode as U, withDirectives as se, vShow as We, renderList as ae, createTextVNode as Ke, createVNode as xe, withCtx as Ee } from "vue";
|
|
2
2
|
import { defineStore as _e } from "pinia";
|
|
3
|
-
import './assets/index.css';function
|
|
3
|
+
import './assets/index.css';function De(e) {
|
|
4
4
|
return Re() ? (Oe(e), !0) : !1;
|
|
5
5
|
}
|
|
6
6
|
function fe(e) {
|
|
@@ -36,7 +36,7 @@ function q(...e) {
|
|
|
36
36
|
), s = () => {
|
|
37
37
|
d(), l();
|
|
38
38
|
};
|
|
39
|
-
return
|
|
39
|
+
return De(s), s;
|
|
40
40
|
}
|
|
41
41
|
function rt() {
|
|
42
42
|
const e = x(!1), t = ue();
|
|
@@ -65,7 +65,7 @@ function at(e, t, n = {}) {
|
|
|
65
65
|
), c = () => i == null ? void 0 : i.takeRecords(), u = () => {
|
|
66
66
|
s(), r();
|
|
67
67
|
};
|
|
68
|
-
return
|
|
68
|
+
return De(u), {
|
|
69
69
|
isSupported: l,
|
|
70
70
|
stop: u,
|
|
71
71
|
takeRecords: c
|
|
@@ -211,8 +211,8 @@ const L = (e) => {
|
|
|
211
211
|
return n && (!P(n) || !L(n)) ? pe(n) : n;
|
|
212
212
|
}, Ie = (e) => {
|
|
213
213
|
const t = e.target;
|
|
214
|
-
return
|
|
215
|
-
},
|
|
214
|
+
return he(t);
|
|
215
|
+
}, he = (e) => {
|
|
216
216
|
var t;
|
|
217
217
|
let n;
|
|
218
218
|
if (e.nextElementSibling)
|
|
@@ -221,10 +221,10 @@ const L = (e) => {
|
|
|
221
221
|
const o = (t = e.parentElement) == null ? void 0 : t.nextElementSibling;
|
|
222
222
|
n = o == null ? void 0 : o.firstElementChild;
|
|
223
223
|
}
|
|
224
|
-
return n && (!P(n) || !L(n)) ?
|
|
224
|
+
return n && (!P(n) || !L(n)) ? he(n) : n;
|
|
225
225
|
}, Se = (e) => {
|
|
226
226
|
const t = e.target.parentElement, n = t == null ? void 0 : t.firstElementChild;
|
|
227
|
-
return n && (!P(n) || !L(n)) ?
|
|
227
|
+
return n && (!P(n) || !L(n)) ? he(n) : n;
|
|
228
228
|
}, Te = (e) => {
|
|
229
229
|
const t = e.target.parentElement, n = t == null ? void 0 : t.lastElementChild;
|
|
230
230
|
return n && (!P(n) || !L(n)) ? pe(n) : n;
|
|
@@ -233,7 +233,7 @@ const L = (e) => {
|
|
|
233
233
|
ArrowDown: "down",
|
|
234
234
|
ArrowLeft: "left",
|
|
235
235
|
ArrowRight: "right"
|
|
236
|
-
},
|
|
236
|
+
}, we = {
|
|
237
237
|
"keydown.up": (e) => {
|
|
238
238
|
const t = Ce(e);
|
|
239
239
|
t && (e.preventDefault(), e.stopPropagation(), t.focus());
|
|
@@ -326,20 +326,20 @@ function ge(e) {
|
|
|
326
326
|
}, a = (l) => (r) => {
|
|
327
327
|
const d = pt[r.key] || r.key.toLowerCase();
|
|
328
328
|
if (K.includes(d)) return;
|
|
329
|
-
const s = l.handlers ||
|
|
329
|
+
const s = l.handlers || we;
|
|
330
330
|
for (const c of Object.keys(s)) {
|
|
331
331
|
const [u, ...f] = c.split(".");
|
|
332
332
|
if (u === "keydown" && f.includes(d)) {
|
|
333
333
|
const m = s[c], g = f.filter((v) => K.includes(v)), p = K.some((v) => {
|
|
334
|
-
const
|
|
335
|
-
return r.getModifierState(
|
|
334
|
+
const w = v.charAt(0).toUpperCase() + v.slice(1);
|
|
335
|
+
return r.getModifierState(w);
|
|
336
336
|
});
|
|
337
337
|
if (g.length > 0) {
|
|
338
338
|
if (p) {
|
|
339
339
|
for (const v of K)
|
|
340
340
|
if (f.includes(v)) {
|
|
341
|
-
const
|
|
342
|
-
r.getModifierState(
|
|
341
|
+
const w = v.charAt(0).toUpperCase() + v.slice(1);
|
|
342
|
+
r.getModifierState(w) && m(r);
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
} else
|
|
@@ -370,7 +370,7 @@ function M(e) {
|
|
|
370
370
|
}
|
|
371
371
|
const ye = typeof window < "u" && typeof document < "u";
|
|
372
372
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
373
|
-
const
|
|
373
|
+
const ht = (e) => e != null, wt = Object.prototype.toString, He = (e) => wt.call(e) === "[object Object]", D = () => {
|
|
374
374
|
}, ie = /* @__PURE__ */ gt();
|
|
375
375
|
function gt() {
|
|
376
376
|
var e, t;
|
|
@@ -383,7 +383,7 @@ function bt(...e) {
|
|
|
383
383
|
if (e.length !== 1)
|
|
384
384
|
return Je(...e);
|
|
385
385
|
const t = e[0];
|
|
386
|
-
return typeof t == "function" ? Qe(Ze(() => ({ get: t, set:
|
|
386
|
+
return typeof t == "function" ? Qe(Ze(() => ({ get: t, set: D }))) : x(t);
|
|
387
387
|
}
|
|
388
388
|
function xt(e, t = !0, n) {
|
|
389
389
|
yt() ? G(e, n) : t ? e() : Le(e);
|
|
@@ -397,7 +397,7 @@ function H(e) {
|
|
|
397
397
|
function ce(...e) {
|
|
398
398
|
let t, n, o, a;
|
|
399
399
|
if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, o, a] = e, t = ne) : [t, n, o, a] = e, !t)
|
|
400
|
-
return
|
|
400
|
+
return D;
|
|
401
401
|
Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
|
|
402
402
|
const i = [], l = () => {
|
|
403
403
|
i.forEach((c) => c()), i.length = 0;
|
|
@@ -433,7 +433,7 @@ function Ve(e, t, n = {}) {
|
|
|
433
433
|
const l = Ne(() => o && "MutationObserver" in o), r = () => {
|
|
434
434
|
i && (i.disconnect(), i = void 0);
|
|
435
435
|
}, d = k(() => {
|
|
436
|
-
const f = M(e), m = (Array.isArray(f) ? f : [f]).map(H).filter(
|
|
436
|
+
const f = M(e), m = (Array.isArray(f) ? f : [f]).map(H).filter(ht);
|
|
437
437
|
return new Set(m);
|
|
438
438
|
}), s = R(
|
|
439
439
|
() => d.value,
|
|
@@ -485,18 +485,18 @@ function je(e, t = {}) {
|
|
|
485
485
|
updateTiming: l = "sync"
|
|
486
486
|
} = t, r = x(0), d = x(0), s = x(0), c = x(0), u = x(0), f = x(0), m = x(0), g = x(0);
|
|
487
487
|
function p() {
|
|
488
|
-
const
|
|
489
|
-
if (!
|
|
488
|
+
const w = H(e);
|
|
489
|
+
if (!w) {
|
|
490
490
|
n && (r.value = 0, d.value = 0, s.value = 0, c.value = 0, u.value = 0, f.value = 0, m.value = 0, g.value = 0);
|
|
491
491
|
return;
|
|
492
492
|
}
|
|
493
|
-
const E =
|
|
493
|
+
const E = w.getBoundingClientRect();
|
|
494
494
|
r.value = E.height, d.value = E.bottom, s.value = E.left, c.value = E.right, u.value = E.top, f.value = E.width, m.value = E.x, g.value = E.y;
|
|
495
495
|
}
|
|
496
496
|
function v() {
|
|
497
497
|
l === "sync" ? p() : l === "next-frame" && requestAnimationFrame(() => p());
|
|
498
498
|
}
|
|
499
|
-
return Ct(e, v), R(() => H(e), (
|
|
499
|
+
return Ct(e, v), R(() => H(e), (w) => !w && v()), Ve(e, v, {
|
|
500
500
|
attributeFilter: ["style", "class"]
|
|
501
501
|
}), a && ce("scroll", v, { capture: !0, passive: !0 }), o && ce("resize", v, { passive: !0 }), xt(() => {
|
|
502
502
|
i && v();
|
|
@@ -549,7 +549,7 @@ function kt(e = {}) {
|
|
|
549
549
|
const At = (e) => {
|
|
550
550
|
const t = new DOMParser().parseFromString(e, "text/html");
|
|
551
551
|
return Array.from(t.body.childNodes).some((n) => n.nodeType === 1);
|
|
552
|
-
}, It = ["data-colindex", "data-rowindex", "data-editable", "contenteditable", "tabindex"],
|
|
552
|
+
}, It = (e = 8) => Array.from({ length: e }, () => Math.floor(Math.random() * 16).toString(16)).join(""), St = ["data-colindex", "data-rowindex", "data-editable", "contenteditable", "tabindex"], Tt = ["innerHTML"], $t = { key: 2 }, Be = /* @__PURE__ */ N({
|
|
553
553
|
__name: "ACell",
|
|
554
554
|
props: {
|
|
555
555
|
colIndex: {},
|
|
@@ -562,59 +562,59 @@ const At = (e) => {
|
|
|
562
562
|
emits: ["cellInput"],
|
|
563
563
|
setup(e, { emit: t }) {
|
|
564
564
|
const n = t, o = J("cell"), a = e.store.getCellData(e.colIndex, e.rowIndex), i = x(""), l = x(!1), r = e.store.columns[e.colIndex], d = e.store.rows[e.rowIndex], s = r.align || "center", c = r.width || "40ch", u = k(() => e.store.getCellDisplayValue(e.colIndex, e.rowIndex)), f = k(() => typeof u.value == "string" ? At(u.value) : !1), m = k(() => {
|
|
565
|
-
var
|
|
565
|
+
var w;
|
|
566
566
|
return {
|
|
567
567
|
textAlign: s,
|
|
568
568
|
width: c,
|
|
569
569
|
backgroundColor: l.value ? "var(--sc-cell-changed-color)" : "inherit",
|
|
570
570
|
fontWeight: l.value ? "bold" : "inherit",
|
|
571
|
-
paddingLeft: e.store.getIndent(e.colIndex, (
|
|
571
|
+
paddingLeft: e.store.getIndent(e.colIndex, (w = e.store.display[e.rowIndex]) == null ? void 0 : w.indent)
|
|
572
572
|
};
|
|
573
573
|
}), g = () => {
|
|
574
|
-
const { left:
|
|
574
|
+
const { left: w, bottom: E, width: W, height: oe } = je(o);
|
|
575
575
|
r.mask, r.modalComponent && e.store.$patch(($) => {
|
|
576
|
-
$.modal.visible = !0, $.modal.colIndex = e.colIndex, $.modal.rowIndex = e.rowIndex, $.modal.left =
|
|
576
|
+
$.modal.visible = !0, $.modal.colIndex = e.colIndex, $.modal.rowIndex = e.rowIndex, $.modal.left = w, $.modal.bottom = E, $.modal.width = W, $.modal.height = oe, typeof r.modalComponent == "function" ? $.modal.component = r.modalComponent({ table: $.table, row: d, column: r }) : $.modal.component = r.modalComponent, $.modal.componentProps = r.modalComponentExtraProps;
|
|
577
577
|
});
|
|
578
578
|
};
|
|
579
579
|
if (e.addNavigation) {
|
|
580
|
-
let
|
|
581
|
-
...
|
|
580
|
+
let w = {
|
|
581
|
+
...we,
|
|
582
582
|
"keydown.f2": g,
|
|
583
583
|
"keydown.alt.up": g,
|
|
584
584
|
"keydown.alt.down": g,
|
|
585
585
|
"keydown.alt.left": g,
|
|
586
586
|
"keydown.alt.right": g
|
|
587
587
|
};
|
|
588
|
-
typeof e.addNavigation == "object" && (
|
|
589
|
-
...
|
|
588
|
+
typeof e.addNavigation == "object" && (w = {
|
|
589
|
+
...w,
|
|
590
590
|
...e.addNavigation
|
|
591
591
|
}), ge([
|
|
592
592
|
{
|
|
593
593
|
selectors: o,
|
|
594
|
-
handlers:
|
|
594
|
+
handlers: w
|
|
595
595
|
}
|
|
596
596
|
]);
|
|
597
597
|
}
|
|
598
598
|
const p = () => {
|
|
599
599
|
o.value && (i.value = o.value.textContent);
|
|
600
|
-
}, v = (
|
|
601
|
-
const E =
|
|
600
|
+
}, v = (w) => {
|
|
601
|
+
const E = w.target;
|
|
602
602
|
E.textContent !== i.value && (n("cellInput", e.colIndex, e.rowIndex, E.textContent, i.value), i.value = E.textContent, r.format ? (l.value = E.textContent !== e.store.getFormattedValue(e.colIndex, e.rowIndex, a), e.store.setCellText(e.colIndex, e.rowIndex, E.textContent)) : (l.value = E.textContent !== a, e.store.setCellData(e.colIndex, e.rowIndex, E.textContent)));
|
|
603
603
|
};
|
|
604
|
-
return (
|
|
604
|
+
return (w, E) => (C(), S("td", {
|
|
605
605
|
ref: "cell",
|
|
606
|
-
"data-colindex":
|
|
607
|
-
"data-rowindex":
|
|
606
|
+
"data-colindex": w.colIndex,
|
|
607
|
+
"data-rowindex": w.rowIndex,
|
|
608
608
|
"data-editable": b(r).edit,
|
|
609
609
|
contenteditable: b(r).edit,
|
|
610
|
-
tabindex:
|
|
610
|
+
tabindex: w.tabIndex,
|
|
611
611
|
spellcheck: !1,
|
|
612
612
|
style: z(m.value),
|
|
613
613
|
onFocus: p,
|
|
614
614
|
onPaste: v,
|
|
615
615
|
onInput: v,
|
|
616
616
|
onClick: g,
|
|
617
|
-
class: F(["atable-cell",
|
|
617
|
+
class: F(["atable-cell", w.pinned ? "sticky-column" : ""])
|
|
618
618
|
}, [
|
|
619
619
|
b(r).cellComponent ? (C(), _(Pe(b(r).cellComponent), de({
|
|
620
620
|
key: 0,
|
|
@@ -622,10 +622,10 @@ const At = (e) => {
|
|
|
622
622
|
}, b(r).cellComponentProps), null, 16, ["value"])) : f.value ? (C(), S("span", {
|
|
623
623
|
key: 1,
|
|
624
624
|
innerHTML: u.value
|
|
625
|
-
}, null, 8,
|
|
626
|
-
], 46,
|
|
625
|
+
}, null, 8, Tt)) : (C(), S("span", $t, Y(u.value), 1))
|
|
626
|
+
], 46, St));
|
|
627
627
|
}
|
|
628
|
-
}),
|
|
628
|
+
}), Mt = ["tabindex"], Rt = ["tabindex"], Ot = ["colspan"], Lt = /* @__PURE__ */ N({
|
|
629
629
|
__name: "AExpansionRow",
|
|
630
630
|
props: {
|
|
631
631
|
rowIndex: {},
|
|
@@ -658,9 +658,9 @@ const At = (e) => {
|
|
|
658
658
|
tabIndex: -1,
|
|
659
659
|
onClick: a[0] || (a[0] = (i) => o.store.toggleRowExpand(o.rowIndex)),
|
|
660
660
|
class: "row-index"
|
|
661
|
-
},
|
|
661
|
+
}, Y(n.value), 1),
|
|
662
662
|
O(o.$slots, "row")
|
|
663
|
-
], 16,
|
|
663
|
+
], 16, Mt),
|
|
664
664
|
o.store.display[o.rowIndex].expanded ? (C(), S("tr", {
|
|
665
665
|
key: 0,
|
|
666
666
|
ref: "rowExpanded",
|
|
@@ -673,11 +673,11 @@ const At = (e) => {
|
|
|
673
673
|
class: "expanded-row-content"
|
|
674
674
|
}, [
|
|
675
675
|
O(o.$slots, "content")
|
|
676
|
-
], 8,
|
|
677
|
-
], 8,
|
|
676
|
+
], 8, Ot)
|
|
677
|
+
], 8, Rt)) : U("", !0)
|
|
678
678
|
], 64));
|
|
679
679
|
}
|
|
680
|
-
}),
|
|
680
|
+
}), Pt = ["tabindex"], ze = /* @__PURE__ */ N({
|
|
681
681
|
__name: "ARow",
|
|
682
682
|
props: {
|
|
683
683
|
rowIndex: {},
|
|
@@ -688,7 +688,7 @@ const At = (e) => {
|
|
|
688
688
|
setup(e) {
|
|
689
689
|
const t = J("rowEl"), n = k(() => e.store.isRowVisible(e.rowIndex)), o = k(() => e.store.getRowExpandSymbol(e.rowIndex));
|
|
690
690
|
if (e.addNavigation) {
|
|
691
|
-
let a =
|
|
691
|
+
let a = we;
|
|
692
692
|
typeof e.addNavigation == "object" && (a = {
|
|
693
693
|
...a,
|
|
694
694
|
...e.addNavigation
|
|
@@ -709,16 +709,16 @@ const At = (e) => {
|
|
|
709
709
|
key: 0,
|
|
710
710
|
tabIndex: -1,
|
|
711
711
|
class: F(["list-index", a.store.hasPinnedColumns ? "sticky-index" : ""])
|
|
712
|
-
},
|
|
712
|
+
}, Y(a.rowIndex + 1), 3)) : a.store.config.view === "tree" ? (C(), S("td", {
|
|
713
713
|
key: 1,
|
|
714
714
|
tabIndex: -1,
|
|
715
715
|
class: F(["tree-index", a.store.hasPinnedColumns ? "sticky-index" : ""]),
|
|
716
716
|
onClick: i[0] || (i[0] = (l) => a.store.toggleRowExpand(a.rowIndex))
|
|
717
|
-
},
|
|
718
|
-
]) :
|
|
717
|
+
}, Y(o.value), 3)) : U("", !0)
|
|
718
|
+
]) : U("", !0),
|
|
719
719
|
O(a.$slots, "default")
|
|
720
|
-
], 8,
|
|
721
|
-
[
|
|
720
|
+
], 8, Pt)), [
|
|
721
|
+
[We, n.value]
|
|
722
722
|
]);
|
|
723
723
|
}
|
|
724
724
|
}), Fe = ye ? window : void 0;
|
|
@@ -730,7 +730,7 @@ function j(e) {
|
|
|
730
730
|
function ee(...e) {
|
|
731
731
|
let t, n, o, a;
|
|
732
732
|
if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, o, a] = e, t = Fe) : [t, n, o, a] = e, !t)
|
|
733
|
-
return
|
|
733
|
+
return D;
|
|
734
734
|
Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
|
|
735
735
|
const i = [], l = () => {
|
|
736
736
|
i.forEach((c) => c()), i.length = 0;
|
|
@@ -754,15 +754,15 @@ let $e = !1;
|
|
|
754
754
|
function Me(e, t, n = {}) {
|
|
755
755
|
const { window: o = Fe, ignore: a = [], capture: i = !0, detectIframe: l = !1 } = n;
|
|
756
756
|
if (!o)
|
|
757
|
-
return
|
|
758
|
-
ie && !$e && ($e = !0, Array.from(o.document.body.children).forEach((p) => p.addEventListener("click",
|
|
757
|
+
return D;
|
|
758
|
+
ie && !$e && ($e = !0, Array.from(o.document.body.children).forEach((p) => p.addEventListener("click", D)), o.document.documentElement.addEventListener("click", D));
|
|
759
759
|
let r = !0;
|
|
760
760
|
const d = (p) => M(a).some((v) => {
|
|
761
761
|
if (typeof v == "string")
|
|
762
|
-
return Array.from(o.document.querySelectorAll(v)).some((
|
|
762
|
+
return Array.from(o.document.querySelectorAll(v)).some((w) => w === p.target || p.composedPath().includes(w));
|
|
763
763
|
{
|
|
764
|
-
const
|
|
765
|
-
return
|
|
764
|
+
const w = j(v);
|
|
765
|
+
return w && (p.target === w || p.composedPath().includes(w));
|
|
766
766
|
}
|
|
767
767
|
});
|
|
768
768
|
function s(p) {
|
|
@@ -770,8 +770,8 @@ function Me(e, t, n = {}) {
|
|
|
770
770
|
return v && v.$.subTree.shapeFlag === 16;
|
|
771
771
|
}
|
|
772
772
|
function c(p, v) {
|
|
773
|
-
const
|
|
774
|
-
return E == null || !Array.isArray(E) ? !1 : E.some((
|
|
773
|
+
const w = M(p), E = w.$.subTree && w.$.subTree.children;
|
|
774
|
+
return E == null || !Array.isArray(E) ? !1 : E.some((W) => W.el === v.target || v.composedPath().includes(W.el));
|
|
775
775
|
}
|
|
776
776
|
const u = (p) => {
|
|
777
777
|
const v = j(e);
|
|
@@ -797,14 +797,14 @@ function Me(e, t, n = {}) {
|
|
|
797
797
|
l && ee(o, "blur", (p) => {
|
|
798
798
|
setTimeout(() => {
|
|
799
799
|
var v;
|
|
800
|
-
const
|
|
801
|
-
((v = o.document.activeElement) == null ? void 0 : v.tagName) === "IFRAME" && !(
|
|
800
|
+
const w = j(e);
|
|
801
|
+
((v = o.document.activeElement) == null ? void 0 : v.tagName) === "IFRAME" && !(w != null && w.contains(o.document.activeElement)) && t(p);
|
|
802
802
|
}, 0);
|
|
803
803
|
})
|
|
804
804
|
].filter(Boolean);
|
|
805
805
|
return () => m.forEach((p) => p());
|
|
806
806
|
}
|
|
807
|
-
const
|
|
807
|
+
const Wt = {
|
|
808
808
|
mounted(e, t) {
|
|
809
809
|
const n = !t.modifiers.bubble;
|
|
810
810
|
if (typeof t.value == "function")
|
|
@@ -821,21 +821,21 @@ const Pt = {
|
|
|
821
821
|
function le(e) {
|
|
822
822
|
return typeof Window < "u" && e instanceof Window ? e.document.documentElement : typeof Document < "u" && e instanceof Document ? e.documentElement : e;
|
|
823
823
|
}
|
|
824
|
-
function
|
|
824
|
+
function Ye(e) {
|
|
825
825
|
const t = window.getComputedStyle(e);
|
|
826
826
|
if (t.overflowX === "scroll" || t.overflowY === "scroll" || t.overflowX === "auto" && e.clientWidth < e.scrollWidth || t.overflowY === "auto" && e.clientHeight < e.scrollHeight)
|
|
827
827
|
return !0;
|
|
828
828
|
{
|
|
829
829
|
const n = e.parentNode;
|
|
830
|
-
return !n || n.tagName === "BODY" ? !1 :
|
|
830
|
+
return !n || n.tagName === "BODY" ? !1 : Ye(n);
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
833
|
function Dt(e) {
|
|
834
834
|
const t = e || window.event, n = t.target;
|
|
835
|
-
return
|
|
835
|
+
return Ye(n) ? !1 : t.touches.length > 1 ? !0 : (t.preventDefault && t.preventDefault(), !1);
|
|
836
836
|
}
|
|
837
837
|
const re = /* @__PURE__ */ new WeakMap();
|
|
838
|
-
function
|
|
838
|
+
function Ht(e, t = !1) {
|
|
839
839
|
const n = x(t);
|
|
840
840
|
let o = null, a = "";
|
|
841
841
|
R(bt(e), (r) => {
|
|
@@ -873,33 +873,33 @@ function Wt(e, t = !1) {
|
|
|
873
873
|
}
|
|
874
874
|
});
|
|
875
875
|
}
|
|
876
|
-
function
|
|
876
|
+
function Nt() {
|
|
877
877
|
let e = !1;
|
|
878
878
|
const t = x(!1);
|
|
879
879
|
return (n, o) => {
|
|
880
880
|
if (t.value = o.value, e)
|
|
881
881
|
return;
|
|
882
882
|
e = !0;
|
|
883
|
-
const a =
|
|
883
|
+
const a = Ht(n, o.value);
|
|
884
884
|
R(t, (i) => a.value = i);
|
|
885
885
|
};
|
|
886
886
|
}
|
|
887
|
-
|
|
888
|
-
const
|
|
887
|
+
Nt();
|
|
888
|
+
const Vt = {
|
|
889
889
|
key: 0,
|
|
890
890
|
id: "resizable"
|
|
891
|
-
},
|
|
891
|
+
}, jt = {
|
|
892
892
|
class: "atable-header-row",
|
|
893
893
|
tabindex: "-1"
|
|
894
|
-
},
|
|
894
|
+
}, Ue = /* @__PURE__ */ N({
|
|
895
895
|
__name: "ATableHeader",
|
|
896
896
|
props: {
|
|
897
897
|
columns: {},
|
|
898
898
|
store: {}
|
|
899
899
|
},
|
|
900
900
|
setup(e) {
|
|
901
|
-
return (t, n) => t.columns.length ? (C(), S("thead",
|
|
902
|
-
B("tr",
|
|
901
|
+
return (t, n) => t.columns.length ? (C(), S("thead", Vt, [
|
|
902
|
+
B("tr", jt, [
|
|
903
903
|
t.store.zeroColumn ? (C(), S("th", {
|
|
904
904
|
key: 0,
|
|
905
905
|
id: "header-index",
|
|
@@ -908,7 +908,7 @@ const Nt = {
|
|
|
908
908
|
t.store.config.view === "tree" ? "tree-index" : "",
|
|
909
909
|
t.store.config.view === "list-expansion" ? "list-expansion-index" : ""
|
|
910
910
|
], "list-index"])
|
|
911
|
-
}, null, 2)) :
|
|
911
|
+
}, null, 2)) : U("", !0),
|
|
912
912
|
(C(!0), S(te, null, ae(t.columns, (o, a) => (C(), S("th", {
|
|
913
913
|
key: o.name,
|
|
914
914
|
tabindex: "-1",
|
|
@@ -916,11 +916,11 @@ const Nt = {
|
|
|
916
916
|
class: F(o.pinned ? "sticky-column" : "")
|
|
917
917
|
}, [
|
|
918
918
|
O(t.$slots, "default", {}, () => [
|
|
919
|
-
Ke(
|
|
919
|
+
Ke(Y(o.label || String.fromCharCode(a + 97).toUpperCase()), 1)
|
|
920
920
|
])
|
|
921
921
|
], 6))), 128))
|
|
922
922
|
])
|
|
923
|
-
])) :
|
|
923
|
+
])) : U("", !0);
|
|
924
924
|
}
|
|
925
925
|
}), Xe = /* @__PURE__ */ N({
|
|
926
926
|
__name: "ATableModal",
|
|
@@ -955,19 +955,19 @@ const Nt = {
|
|
|
955
955
|
O(r.$slots, "default")
|
|
956
956
|
], 36));
|
|
957
957
|
}
|
|
958
|
-
}),
|
|
959
|
-
const t = e.id ||
|
|
958
|
+
}), Bt = (e) => {
|
|
959
|
+
const t = e.id || It();
|
|
960
960
|
return _e(`table-${t}`, () => {
|
|
961
961
|
const o = () => {
|
|
962
|
-
const
|
|
962
|
+
const h = {};
|
|
963
963
|
for (const [y, A] of i.value.entries())
|
|
964
964
|
for (const [I, T] of l.value.entries())
|
|
965
|
-
|
|
966
|
-
return
|
|
967
|
-
}, a = (
|
|
965
|
+
h[`${y}:${I}`] = T[A.name];
|
|
966
|
+
return h;
|
|
967
|
+
}, a = (h) => {
|
|
968
968
|
const y = [Object.assign({}, { rowModified: !1 })];
|
|
969
|
-
if (
|
|
970
|
-
return
|
|
969
|
+
if (h && "0:0" in h)
|
|
970
|
+
return h;
|
|
971
971
|
const A = /* @__PURE__ */ new Set();
|
|
972
972
|
for (let I = l.value.length - 1; I >= 0; I--) {
|
|
973
973
|
const T = l.value[I];
|
|
@@ -983,29 +983,29 @@ const Nt = {
|
|
|
983
983
|
};
|
|
984
984
|
}
|
|
985
985
|
return y;
|
|
986
|
-
}, i = x(e.columns), l = x(e.rows), r = x(e.config || {}), d = x(e.table || o()), s = x(a(e.display)), c = x(e.modal || { visible: !1 }), u = x({}), f = k(() => i.value.some((
|
|
986
|
+
}, i = x(e.columns), l = x(e.rows), r = x(e.config || {}), d = x(e.table || o()), s = x(a(e.display)), c = x(e.modal || { visible: !1 }), u = x({}), f = k(() => i.value.some((h) => h.pinned)), m = k(() => `${Math.ceil(l.value.length / 100 + 1)}ch`), g = k(
|
|
987
987
|
() => r.value.view ? ["list", "tree", "list-expansion"].includes(r.value.view) : !1
|
|
988
|
-
), p = (
|
|
989
|
-
const I = `${
|
|
988
|
+
), p = (h, y) => d.value[`${h}:${y}`], v = (h, y, A) => {
|
|
989
|
+
const I = `${h}:${y}`, T = i.value[h];
|
|
990
990
|
d.value[I] !== A && (s.value[y].rowModified = !0), d.value[I] = A, l.value[y][T.name] = A;
|
|
991
|
-
},
|
|
992
|
-
const I = `${
|
|
991
|
+
}, w = (h, y, A) => {
|
|
992
|
+
const I = `${h}:${y}`;
|
|
993
993
|
d.value[I] !== A && (s.value[y].rowModified = !0, u.value[I] = A);
|
|
994
|
-
}, E = (
|
|
995
|
-
minWidth:
|
|
996
|
-
textAlign:
|
|
994
|
+
}, E = (h) => ({
|
|
995
|
+
minWidth: h.width || "40ch",
|
|
996
|
+
textAlign: h.align || "center",
|
|
997
997
|
width: r.value.fullWidth ? "auto" : void 0
|
|
998
|
-
}),
|
|
998
|
+
}), W = (h) => r.value.view !== "tree" || s.value[h].isRoot || s.value[h].open, oe = (h) => r.value.view !== "tree" ? "" : s.value[h].isRoot || s.value[h].isParent ? s.value[h].childrenOpen ? "-" : "+" : "", $ = (h) => {
|
|
999
999
|
if (r.value.view === "tree") {
|
|
1000
|
-
s.value[
|
|
1000
|
+
s.value[h].childrenOpen = !s.value[h].childrenOpen;
|
|
1001
1001
|
for (let y = l.value.length - 1; y >= 0; y--)
|
|
1002
|
-
s.value[y].parent ===
|
|
1003
|
-
} else r.value.view === "list-expansion" && (s.value[
|
|
1004
|
-
}, qe = (
|
|
1005
|
-
const A = p(
|
|
1006
|
-
return be(
|
|
1007
|
-
}, be = (
|
|
1008
|
-
const I = i.value[
|
|
1002
|
+
s.value[y].parent === h && (s.value[y].open = !s.value[y].open, s.value[y].childrenOpen && $(y));
|
|
1003
|
+
} else r.value.view === "list-expansion" && (s.value[h].expanded = !s.value[h].expanded);
|
|
1004
|
+
}, qe = (h, y) => {
|
|
1005
|
+
const A = p(h, y);
|
|
1006
|
+
return be(h, y, A);
|
|
1007
|
+
}, be = (h, y, A) => {
|
|
1008
|
+
const I = i.value[h], T = l.value[y], V = I.format;
|
|
1009
1009
|
return V ? typeof V == "function" ? V(A, { table: d.value, row: T, column: I }) : typeof V == "string" ? Function(`"use strict";return (${V})`)()(A, { table: d.value, row: T, column: I }) : A : A;
|
|
1010
1010
|
};
|
|
1011
1011
|
return {
|
|
@@ -1022,23 +1022,23 @@ const Nt = {
|
|
|
1022
1022
|
numberedRowWidth: m,
|
|
1023
1023
|
zeroColumn: g,
|
|
1024
1024
|
// actions
|
|
1025
|
-
closeModal: (
|
|
1025
|
+
closeModal: (h) => {
|
|
1026
1026
|
var y;
|
|
1027
|
-
|
|
1027
|
+
h.target instanceof Node && (y = c.value.parent) != null && y.contains(h.target) || c.value.visible && (c.value.visible = !1);
|
|
1028
1028
|
},
|
|
1029
1029
|
getCellData: p,
|
|
1030
1030
|
getCellDisplayValue: qe,
|
|
1031
1031
|
getFormattedValue: be,
|
|
1032
1032
|
getHeaderCellStyle: E,
|
|
1033
|
-
getIndent: (
|
|
1033
|
+
getIndent: (h, y) => y && h === 0 && y > 0 ? `${y}ch` : "inherit",
|
|
1034
1034
|
getRowExpandSymbol: oe,
|
|
1035
|
-
isRowVisible:
|
|
1035
|
+
isRowVisible: W,
|
|
1036
1036
|
setCellData: v,
|
|
1037
|
-
setCellText:
|
|
1037
|
+
setCellText: w,
|
|
1038
1038
|
toggleRowExpand: $
|
|
1039
1039
|
};
|
|
1040
1040
|
})();
|
|
1041
|
-
},
|
|
1041
|
+
}, zt = /* @__PURE__ */ N({
|
|
1042
1042
|
__name: "ATable",
|
|
1043
1043
|
props: {
|
|
1044
1044
|
id: {},
|
|
@@ -1049,7 +1049,7 @@ const Nt = {
|
|
|
1049
1049
|
},
|
|
1050
1050
|
emits: ["update:modelValue", "cellUpdate"],
|
|
1051
1051
|
setup(e, { expose: t, emit: n }) {
|
|
1052
|
-
const o = n, a = J("table"), i = e.modelValue ? e.modelValue : e.rows, l =
|
|
1052
|
+
const o = n, a = J("table"), i = e.modelValue ? e.modelValue : e.rows, l = Bt({ columns: e.columns, rows: i, id: e.id, config: e.config });
|
|
1053
1053
|
l.$onAction(({ name: s, store: c, args: u, after: f }) => {
|
|
1054
1054
|
if (s === "setCellData") {
|
|
1055
1055
|
const [m, g, p] = u, v = c.getCellData(m, g);
|
|
@@ -1096,7 +1096,7 @@ const Nt = {
|
|
|
1096
1096
|
style: z({ width: b(l).config.fullWidth ? "100%" : "auto" })
|
|
1097
1097
|
}, [
|
|
1098
1098
|
O(s.$slots, "header", { data: b(l) }, () => [
|
|
1099
|
-
xe(
|
|
1099
|
+
xe(Ue, {
|
|
1100
1100
|
columns: b(l).columns,
|
|
1101
1101
|
store: b(l)
|
|
1102
1102
|
}, null, 8, ["columns", "store"])
|
|
@@ -1144,30 +1144,30 @@ const Nt = {
|
|
|
1144
1144
|
]),
|
|
1145
1145
|
_: 1
|
|
1146
1146
|
}, 8, ["store"]), [
|
|
1147
|
-
[
|
|
1147
|
+
[We, b(l).modal.visible]
|
|
1148
1148
|
])
|
|
1149
1149
|
], !0)
|
|
1150
1150
|
], 4)), [
|
|
1151
|
-
[b(
|
|
1151
|
+
[b(Wt), b(l).closeModal]
|
|
1152
1152
|
]);
|
|
1153
1153
|
}
|
|
1154
|
-
}),
|
|
1154
|
+
}), Ft = (e, t) => {
|
|
1155
1155
|
const n = e.__vccOpts || e;
|
|
1156
1156
|
for (const [o, a] of t)
|
|
1157
1157
|
n[o] = a;
|
|
1158
1158
|
return n;
|
|
1159
|
-
},
|
|
1160
|
-
function
|
|
1161
|
-
e.component("ACell", Be), e.component("AExpansionRow",
|
|
1159
|
+
}, Yt = /* @__PURE__ */ Ft(zt, [["__scopeId", "data-v-bd5101d3"]]);
|
|
1160
|
+
function Qt(e) {
|
|
1161
|
+
e.component("ACell", Be), e.component("AExpansionRow", Lt), e.component("ARow", ze), e.component("ATable", Yt), e.component("ATableHeader", Ue), e.component("ATableModal", Xe);
|
|
1162
1162
|
}
|
|
1163
1163
|
export {
|
|
1164
1164
|
Be as ACell,
|
|
1165
|
-
|
|
1165
|
+
Lt as AExpansionRow,
|
|
1166
1166
|
ze as ARow,
|
|
1167
|
-
|
|
1168
|
-
|
|
1167
|
+
Yt as ATable,
|
|
1168
|
+
Ue as ATableHeader,
|
|
1169
1169
|
Xe as ATableModal,
|
|
1170
|
-
|
|
1171
|
-
|
|
1170
|
+
Bt as createTableStore,
|
|
1171
|
+
Qt as install
|
|
1172
1172
|
};
|
|
1173
1173
|
//# sourceMappingURL=atable.js.map
|