@stonecrop/atable 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/atable.js CHANGED
@@ -1,15 +1,15 @@
1
- import { onMounted as Y, ref as x, watch as T, onBeforeUnmount as qe, computed as $, unref as g, getCurrentScope as Te, onScopeDispose as Me, getCurrentInstance as se, nextTick as Re, toRef as Ge, readonly as Ye, customRef as Xe, defineComponent as W, useTemplateRef as ee, openBlock as E, createElementBlock as k, normalizeStyle as j, normalizeClass as z, createBlock as Z, resolveDynamicComponent as Oe, mergeProps as ae, toDisplayString as F, Fragment as _, createElementVNode as B, renderSlot as R, createCommentVNode as U, withDirectives as oe, vShow as Le, renderList as le, createTextVNode as Je, createVNode as ge, withCtx as ye } from "vue";
2
- import { defineStore as Qe } from "pinia";
1
+ import { onMounted as Y, ref as x, watch as T, onBeforeUnmount as Ge, computed as S, unref as g, getCurrentScope as Te, onScopeDispose as Me, getCurrentInstance as se, nextTick as Re, toRef as Ye, readonly as Xe, customRef as Je, defineComponent as H, useTemplateRef as X, openBlock as E, createElementBlock as k, normalizeStyle as B, normalizeClass as z, createBlock as K, resolveDynamicComponent as Oe, mergeProps as ae, toDisplayString as F, Fragment as ee, createElementVNode as j, renderSlot as R, createCommentVNode as U, withDirectives as oe, vShow as Le, renderList as le, createTextVNode as Qe, createVNode as ge, withCtx as ye } from "vue";
2
+ import { defineStore as Ze } from "pinia";
3
3
  import './assets/index.css';function Pe(e) {
4
4
  return Te() ? (Me(e), !0) : !1;
5
5
  }
6
6
  function ie(e) {
7
7
  return typeof e == "function" ? e() : g(e);
8
8
  }
9
- const Ze = typeof window < "u" && typeof document < "u";
9
+ const Ke = typeof window < "u" && typeof document < "u";
10
10
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
11
- const Ke = (e) => e != null, _e = Object.prototype.toString, et = (e) => _e.call(e) === "[object Object]", tt = () => {
12
- }, X = Ze ? window : void 0;
11
+ const _e = (e) => e != null, et = Object.prototype.toString, tt = (e) => et.call(e) === "[object Object]", nt = () => {
12
+ }, J = Ke ? window : void 0;
13
13
  function q(e) {
14
14
  var t;
15
15
  const n = ie(e);
@@ -17,8 +17,8 @@ function q(e) {
17
17
  }
18
18
  function G(...e) {
19
19
  let t, n, o, r;
20
- if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, o, r] = e, t = X) : [t, n, o, r] = e, !t)
21
- return tt;
20
+ if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, o, r] = e, t = J) : [t, n, o, r] = e, !t)
21
+ return nt;
22
22
  Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
23
23
  const a = [], l = () => {
24
24
  a.forEach((u) => u()), a.length = 0;
@@ -27,7 +27,7 @@ function G(...e) {
27
27
  ([u, f]) => {
28
28
  if (l(), !u)
29
29
  return;
30
- const d = et(f) ? { ...f } : f;
30
+ const d = tt(f) ? { ...f } : f;
31
31
  a.push(
32
32
  ...n.flatMap((v) => o.map((y) => i(u, v, y, d)))
33
33
  );
@@ -38,23 +38,23 @@ function G(...e) {
38
38
  };
39
39
  return Pe(c), c;
40
40
  }
41
- function nt() {
41
+ function ot() {
42
42
  const e = x(!1), t = se();
43
43
  return t && Y(() => {
44
44
  e.value = !0;
45
45
  }, t), e;
46
46
  }
47
- function ot(e) {
48
- const t = nt();
49
- return $(() => (t.value, !!e()));
47
+ function lt(e) {
48
+ const t = ot();
49
+ return S(() => (t.value, !!e()));
50
50
  }
51
- function lt(e, t, n = {}) {
52
- const { window: o = X, ...r } = n;
51
+ function rt(e, t, n = {}) {
52
+ const { window: o = J, ...r } = n;
53
53
  let a;
54
- const l = ot(() => o && "MutationObserver" in o), i = () => {
54
+ const l = lt(() => o && "MutationObserver" in o), i = () => {
55
55
  a && (a.disconnect(), a = void 0);
56
- }, s = $(() => {
57
- const d = ie(e), v = (Array.isArray(d) ? d : [d]).map(q).filter(Ke);
56
+ }, s = S(() => {
57
+ const d = ie(e), v = (Array.isArray(d) ? d : [d]).map(q).filter(_e);
58
58
  return new Set(v);
59
59
  }), c = T(
60
60
  () => s.value,
@@ -71,10 +71,10 @@ function lt(e, t, n = {}) {
71
71
  takeRecords: u
72
72
  };
73
73
  }
74
- function rt(e = {}) {
74
+ function st(e = {}) {
75
75
  var t;
76
76
  const {
77
- window: n = X,
77
+ window: n = J,
78
78
  deep: o = !0,
79
79
  triggerOnRemoval: r = !1
80
80
  } = e, a = (t = e.document) != null ? t : n == null ? void 0 : n.document, l = () => {
@@ -89,7 +89,7 @@ function rt(e = {}) {
89
89
  };
90
90
  return n && (G(n, "blur", (c) => {
91
91
  c.relatedTarget === null && s();
92
- }, !0), G(n, "focus", s, !0)), r && lt(a, (c) => {
92
+ }, !0), G(n, "focus", s, !0)), r && rt(a, (c) => {
93
93
  c.filter((u) => u.removedNodes.length).map((u) => Array.from(u.removedNodes)).flat().forEach((u) => {
94
94
  u === i.value && s();
95
95
  });
@@ -98,12 +98,12 @@ function rt(e = {}) {
98
98
  subtree: !0
99
99
  }), s(), i;
100
100
  }
101
- const st = "focusin", at = "focusout";
102
- function it(e, t = {}) {
103
- const { window: n = X } = t, o = $(() => q(e)), r = x(!1), a = $(() => r.value), l = rt(t);
104
- return !n || !l.value ? { focused: a } : (G(o, st, () => r.value = !0), G(o, at, () => r.value = !1), { focused: a });
101
+ const at = "focusin", it = "focusout";
102
+ function ct(e, t = {}) {
103
+ const { window: n = J } = t, o = S(() => q(e)), r = x(!1), a = S(() => r.value), l = st(t);
104
+ return !n || !l.value ? { focused: a } : (G(o, at, () => r.value = !0), G(o, it, () => r.value = !1), { focused: a });
105
105
  }
106
- function ct(e, { window: t = X, scrollTarget: n } = {}) {
106
+ function ut(e, { window: t = J, scrollTarget: n } = {}) {
107
107
  const o = x(!1), r = () => {
108
108
  if (!t) return;
109
109
  const a = t.document, l = q(e);
@@ -124,7 +124,7 @@ function ct(e, { window: t = X, scrollTarget: n } = {}) {
124
124
  }), o;
125
125
  }
126
126
  const O = (e) => {
127
- let t = ct(e).value;
127
+ let t = ut(e).value;
128
128
  return t = t && e.offsetHeight > 0, t;
129
129
  }, L = (e) => e.tabIndex >= 0, be = (e) => {
130
130
  const t = e.target;
@@ -143,7 +143,7 @@ const O = (e) => {
143
143
  o && (n = o);
144
144
  }
145
145
  return n && (!L(n) || !O(n)) ? ce(n) : n;
146
- }, ut = (e) => {
146
+ }, dt = (e) => {
147
147
  var t;
148
148
  const n = e.target;
149
149
  let o;
@@ -178,7 +178,7 @@ const O = (e) => {
178
178
  o && (n = o);
179
179
  }
180
180
  return n && (!L(n) || !O(n)) ? ue(n) : n;
181
- }, dt = (e) => {
181
+ }, ft = (e) => {
182
182
  var t;
183
183
  const n = e.target;
184
184
  let o;
@@ -228,7 +228,7 @@ const O = (e) => {
228
228
  }, Ie = (e) => {
229
229
  const t = e.target.parentElement.lastElementChild;
230
230
  return t && (!L(t) || !O(t)) ? de(t) : t;
231
- }, Q = ["alt", "control", "shift", "meta"], ft = {
231
+ }, Z = ["alt", "control", "shift", "meta"], mt = {
232
232
  ArrowUp: "up",
233
233
  ArrowDown: "down",
234
234
  ArrowLeft: "left",
@@ -251,11 +251,11 @@ const O = (e) => {
251
251
  e.preventDefault(), e.stopPropagation(), t && t.focus();
252
252
  },
253
253
  "keydown.control.up": (e) => {
254
- const t = ut(e);
254
+ const t = dt(e);
255
255
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
256
256
  },
257
257
  "keydown.control.down": (e) => {
258
- const t = dt(e);
258
+ const t = ft(e);
259
259
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
260
260
  },
261
261
  "keydown.control.left": (e) => {
@@ -322,19 +322,19 @@ function ve(e) {
322
322
  let s = [];
323
323
  return l.selectors ? s = n(l) : i && (s = Array.from(i.children).filter((c) => L(c) && O(c))), s;
324
324
  }, r = (l) => (i) => {
325
- const s = ft[i.key] || i.key.toLowerCase();
326
- if (Q.includes(s)) return;
325
+ const s = mt[i.key] || i.key.toLowerCase();
326
+ if (Z.includes(s)) return;
327
327
  const c = l.handlers || me;
328
328
  for (const u of Object.keys(c)) {
329
329
  const [f, ...d] = u.split(".");
330
330
  if (f === "keydown" && d.includes(s)) {
331
- const v = c[u], y = d.filter((w) => Q.includes(w)), p = Q.some((w) => {
331
+ const v = c[u], y = d.filter((w) => Z.includes(w)), p = Z.some((w) => {
332
332
  const m = w.charAt(0).toUpperCase() + w.slice(1);
333
333
  return i.getModifierState(m);
334
334
  });
335
335
  if (y.length > 0) {
336
336
  if (p) {
337
- for (const w of Q)
337
+ for (const w of Z)
338
338
  if (d.includes(w)) {
339
339
  const m = w.charAt(0).toUpperCase() + w.slice(1);
340
340
  i.getModifierState(m) && v(i);
@@ -349,18 +349,18 @@ function ve(e) {
349
349
  for (const l of e) {
350
350
  const i = t(l), s = o(l), c = r(l), u = i ? [i] : s;
351
351
  for (const f of u) {
352
- const { focused: d } = it(x(f)), v = T(d, (y) => {
352
+ const { focused: d } = ct(x(f)), v = T(d, (y) => {
353
353
  y ? f.addEventListener("keydown", c) : f.removeEventListener("keydown", c);
354
354
  });
355
355
  a.push(v);
356
356
  }
357
357
  }
358
- }), qe(() => {
358
+ }), Ge(() => {
359
359
  for (const l of a)
360
360
  l();
361
361
  });
362
362
  }
363
- function J(e) {
363
+ function Q(e) {
364
364
  return Te() ? (Me(e), !0) : !1;
365
365
  }
366
366
  function M(e) {
@@ -368,23 +368,23 @@ function M(e) {
368
368
  }
369
369
  const pe = typeof window < "u" && typeof document < "u";
370
370
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
371
- const mt = (e) => e != null, vt = Object.prototype.toString, De = (e) => vt.call(e) === "[object Object]", P = () => {
372
- }, re = /* @__PURE__ */ pt();
373
- function pt() {
371
+ const vt = (e) => e != null, pt = Object.prototype.toString, De = (e) => pt.call(e) === "[object Object]", P = () => {
372
+ }, re = /* @__PURE__ */ wt();
373
+ function wt() {
374
374
  var e, t;
375
375
  return pe && ((e = window == null ? void 0 : window.navigator) == null ? void 0 : e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window == null ? void 0 : window.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
376
376
  }
377
- function wt(e) {
377
+ function ht(e) {
378
378
  return se();
379
379
  }
380
- function ht(...e) {
380
+ function gt(...e) {
381
381
  if (e.length !== 1)
382
- return Ge(...e);
382
+ return Ye(...e);
383
383
  const t = e[0];
384
- return typeof t == "function" ? Ye(Xe(() => ({ get: t, set: P }))) : x(t);
384
+ return typeof t == "function" ? Xe(Je(() => ({ get: t, set: P }))) : x(t);
385
385
  }
386
- function gt(e, t = !0, n) {
387
- wt() ? Y(e, n) : t ? e() : Re(e);
386
+ function yt(e, t = !0, n) {
387
+ ht() ? Y(e, n) : t ? e() : Re(e);
388
388
  }
389
389
  const we = pe ? window : void 0;
390
390
  function D(e) {
@@ -413,25 +413,25 @@ function Ae(...e) {
413
413
  ), c = () => {
414
414
  s(), l();
415
415
  };
416
- return J(c), c;
416
+ return Q(c), c;
417
417
  }
418
- function yt() {
418
+ function bt() {
419
419
  const e = x(!1), t = se();
420
420
  return t && Y(() => {
421
421
  e.value = !0;
422
422
  }, t), e;
423
423
  }
424
- function We(e) {
425
- const t = yt();
426
- return $(() => (t.value, !!e()));
424
+ function He(e) {
425
+ const t = bt();
426
+ return S(() => (t.value, !!e()));
427
427
  }
428
- function He(e, t, n = {}) {
428
+ function We(e, t, n = {}) {
429
429
  const { window: o = we, ...r } = n;
430
430
  let a;
431
- const l = We(() => o && "MutationObserver" in o), i = () => {
431
+ const l = He(() => o && "MutationObserver" in o), i = () => {
432
432
  a && (a.disconnect(), a = void 0);
433
- }, s = $(() => {
434
- const d = M(e), v = (Array.isArray(d) ? d : [d]).map(D).filter(mt);
433
+ }, s = S(() => {
434
+ const d = M(e), v = (Array.isArray(d) ? d : [d]).map(D).filter(vt);
435
435
  return new Set(v);
436
436
  }), c = T(
437
437
  () => s.value,
@@ -442,18 +442,18 @@ function He(e, t, n = {}) {
442
442
  ), u = () => a == null ? void 0 : a.takeRecords(), f = () => {
443
443
  c(), i();
444
444
  };
445
- return J(f), {
445
+ return Q(f), {
446
446
  isSupported: l,
447
447
  stop: f,
448
448
  takeRecords: u
449
449
  };
450
450
  }
451
- function bt(e, t, n = {}) {
451
+ function xt(e, t, n = {}) {
452
452
  const { window: o = we, ...r } = n;
453
453
  let a;
454
- const l = We(() => o && "ResizeObserver" in o), i = () => {
454
+ const l = He(() => o && "ResizeObserver" in o), i = () => {
455
455
  a && (a.disconnect(), a = void 0);
456
- }, s = $(() => {
456
+ }, s = S(() => {
457
457
  const f = M(e);
458
458
  return Array.isArray(f) ? f.map((d) => D(d)) : [D(f)];
459
459
  }), c = T(
@@ -469,12 +469,12 @@ function bt(e, t, n = {}) {
469
469
  ), u = () => {
470
470
  i(), c();
471
471
  };
472
- return J(u), {
472
+ return Q(u), {
473
473
  isSupported: l,
474
474
  stop: u
475
475
  };
476
476
  }
477
- function xt(e, t = {}) {
477
+ function Ne(e, t = {}) {
478
478
  const {
479
479
  reset: n = !0,
480
480
  windowResize: o = !0,
@@ -494,9 +494,9 @@ function xt(e, t = {}) {
494
494
  function w() {
495
495
  l === "sync" ? p() : l === "next-frame" && requestAnimationFrame(() => p());
496
496
  }
497
- return bt(e, w), T(() => D(e), (m) => !m && w()), He(e, w, {
497
+ return xt(e, w), T(() => D(e), (m) => !m && w()), We(e, w, {
498
498
  attributeFilter: ["style", "class"]
499
- }), r && Ae("scroll", w, { capture: !0, passive: !0 }), o && Ae("resize", w, { passive: !0 }), gt(() => {
499
+ }), r && Ae("scroll", w, { capture: !0, passive: !0 }), o && Ae("resize", w, { passive: !0 }), yt(() => {
500
500
  a && w();
501
501
  }), {
502
502
  height: i,
@@ -513,7 +513,7 @@ function xt(e, t = {}) {
513
513
  const Et = (e) => {
514
514
  const t = new DOMParser().parseFromString(e, "text/html");
515
515
  return Array.from(t.body.childNodes).some((n) => n.nodeType === 1);
516
- }, kt = ["data-colindex", "data-rowindex", "data-editable", "contenteditable", "tabindex"], Ct = ["innerHTML"], It = { key: 2 }, Ne = /* @__PURE__ */ W({
516
+ }, kt = ["data-colindex", "data-rowindex", "data-editable", "contenteditable", "tabindex"], Ct = ["innerHTML"], It = { key: 2 }, Ve = /* @__PURE__ */ H({
517
517
  __name: "ACell",
518
518
  props: {
519
519
  colIndex: {},
@@ -524,14 +524,14 @@ const Et = (e) => {
524
524
  pinned: { type: Boolean }
525
525
  },
526
526
  setup(e) {
527
- const t = ee("cell"), { bottom: n, left: o } = xt(t), r = e.store.getCellData(e.colIndex, e.rowIndex), a = x(e.store.getCellDisplayValue(e.colIndex, e.rowIndex)), l = x(""), i = x(!1), s = e.store.columns[e.colIndex], c = e.store.rows[e.rowIndex], u = s.align || "center", f = s.width || "40ch";
527
+ const t = X("cell"), { width: n, height: o } = Ne(t), r = e.store.getCellData(e.colIndex, e.rowIndex), a = x(e.store.getCellDisplayValue(e.colIndex, e.rowIndex)), l = x(""), i = x(!1), s = e.store.columns[e.colIndex], c = e.store.rows[e.rowIndex], u = s.align || "center", f = s.width || "40ch";
528
528
  T(
529
529
  () => e.store.getCellData(e.colIndex, e.rowIndex),
530
530
  (m) => {
531
531
  a.value = e.store.getFormattedValue(e.colIndex, e.rowIndex, m);
532
532
  }
533
533
  );
534
- const d = $(() => typeof a.value == "string" ? Et(a.value) : !1), v = $(() => {
534
+ const d = S(() => typeof a.value == "string" ? Et(a.value) : !1), v = S(() => {
535
535
  var m;
536
536
  return {
537
537
  textAlign: u,
@@ -542,7 +542,7 @@ const Et = (e) => {
542
542
  };
543
543
  }), y = () => {
544
544
  s.mask, s.modalComponent && e.store.$patch((m) => {
545
- m.modal.visible = !0, m.modal.colIndex = e.colIndex, m.modal.rowIndex = e.rowIndex, m.modal.parent = t.value, m.modal.top = n.value, m.modal.left = o.value, m.modal.width = f, typeof s.modalComponent == "function" ? m.modal.component = s.modalComponent({ table: m.table, row: c, column: s }) : m.modal.component = s.modalComponent, m.modal.componentProps = s.modalComponentExtraProps;
545
+ m.modal.visible = !0, m.modal.colIndex = e.colIndex, m.modal.rowIndex = e.rowIndex, m.modal.parent = t.value, m.modal.top = t.value.offsetTop + t.value.offsetHeight, m.modal.left = t.value.offsetLeft, m.modal.width = n.value, m.modal.height = o.value, typeof s.modalComponent == "function" ? m.modal.component = s.modalComponent({ table: m.table, row: c, column: s }) : m.modal.component = s.modalComponent, m.modal.componentProps = s.modalComponentExtraProps;
546
546
  });
547
547
  };
548
548
  if (e.addNavigation) {
@@ -577,7 +577,7 @@ const Et = (e) => {
577
577
  contenteditable: g(s).edit,
578
578
  tabindex: m.tabIndex,
579
579
  spellcheck: !1,
580
- style: j(v.value),
580
+ style: B(v.value),
581
581
  onFocus: p,
582
582
  onPaste: w,
583
583
  onBlur: w,
@@ -585,7 +585,7 @@ const Et = (e) => {
585
585
  onClick: y,
586
586
  class: z(["atable-cell", m.pinned ? "sticky-column" : ""])
587
587
  }, [
588
- g(s).cellComponent ? (E(), Z(Oe(g(s).cellComponent), ae({
588
+ g(s).cellComponent ? (E(), K(Oe(g(s).cellComponent), ae({
589
589
  key: 0,
590
590
  value: a.value
591
591
  }, g(s).cellComponentProps), null, 16, ["value"])) : d.value ? (E(), k("span", {
@@ -594,7 +594,7 @@ const Et = (e) => {
594
594
  }, null, 8, Ct)) : (E(), k("span", It, F(a.value), 1))
595
595
  ], 46, kt));
596
596
  }
597
- }), At = ["tabindex"], St = ["tabindex"], $t = ["colspan"], Tt = /* @__PURE__ */ W({
597
+ }), At = ["tabindex"], St = ["tabindex"], $t = ["colspan"], Tt = /* @__PURE__ */ H({
598
598
  __name: "AExpansionRow",
599
599
  props: {
600
600
  rowIndex: {},
@@ -603,7 +603,7 @@ const Et = (e) => {
603
603
  addNavigation: { type: [Boolean, Object] }
604
604
  },
605
605
  setup(e) {
606
- const t = ee("rowEl"), n = $(() => e.store.display[e.rowIndex].expanded ? "▼" : "►");
606
+ const t = X("rowEl"), n = S(() => e.store.display[e.rowIndex].expanded ? "▼" : "►");
607
607
  if (e.addNavigation) {
608
608
  const o = {
609
609
  "keydown.control.g": (r) => {
@@ -617,13 +617,13 @@ const Et = (e) => {
617
617
  }
618
618
  ]);
619
619
  }
620
- return (o, r) => (E(), k(_, null, [
621
- B("tr", ae(o.$attrs, {
620
+ return (o, r) => (E(), k(ee, null, [
621
+ j("tr", ae(o.$attrs, {
622
622
  ref: "rowEl",
623
623
  tabindex: o.tabIndex,
624
624
  class: "expandable-row"
625
625
  }), [
626
- B("td", {
626
+ j("td", {
627
627
  tabIndex: -1,
628
628
  onClick: r[0] || (r[0] = (a) => o.store.toggleRowExpand(o.rowIndex)),
629
629
  class: "row-index"
@@ -636,7 +636,7 @@ const Et = (e) => {
636
636
  tabindex: o.tabIndex,
637
637
  class: "expanded-row"
638
638
  }, [
639
- B("td", {
639
+ j("td", {
640
640
  tabIndex: -1,
641
641
  colspan: o.store.columns.length + 1,
642
642
  class: "expanded-row-content"
@@ -646,7 +646,7 @@ const Et = (e) => {
646
646
  ], 8, St)) : U("", !0)
647
647
  ], 64));
648
648
  }
649
- }), Mt = ["tabindex"], Ve = /* @__PURE__ */ W({
649
+ }), Mt = ["tabindex"], je = /* @__PURE__ */ H({
650
650
  __name: "ARow",
651
651
  props: {
652
652
  rowIndex: {},
@@ -655,7 +655,7 @@ const Et = (e) => {
655
655
  addNavigation: { type: [Boolean, Object], default: !1 }
656
656
  },
657
657
  setup(e) {
658
- const t = ee("rowEl"), n = e.store.isRowVisible(e.rowIndex), o = e.store.getRowExpandSymbol(e.rowIndex);
658
+ const t = X("rowEl"), n = e.store.isRowVisible(e.rowIndex), o = e.store.getRowExpandSymbol(e.rowIndex);
659
659
  if (e.addNavigation) {
660
660
  let r = me;
661
661
  typeof e.addNavigation == "object" && (r = {
@@ -690,15 +690,15 @@ const Et = (e) => {
690
690
  [Le, g(n)]
691
691
  ]);
692
692
  }
693
- }), je = pe ? window : void 0;
693
+ }), Be = pe ? window : void 0;
694
694
  function V(e) {
695
695
  var t;
696
696
  const n = M(e);
697
697
  return (t = n == null ? void 0 : n.$el) != null ? t : n;
698
698
  }
699
- function K(...e) {
699
+ function _(...e) {
700
700
  let t, n, o, r;
701
- if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, o, r] = e, t = je) : [t, n, o, r] = e, !t)
701
+ if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, o, r] = e, t = Be) : [t, n, o, r] = e, !t)
702
702
  return P;
703
703
  Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
704
704
  const a = [], l = () => {
@@ -717,11 +717,11 @@ function K(...e) {
717
717
  ), c = () => {
718
718
  s(), l();
719
719
  };
720
- return J(c), c;
720
+ return Q(c), c;
721
721
  }
722
722
  let Se = !1;
723
723
  function $e(e, t, n = {}) {
724
- const { window: o = je, ignore: r = [], capture: a = !0, detectIframe: l = !1 } = n;
724
+ const { window: o = Be, ignore: r = [], capture: a = !0, detectIframe: l = !1 } = n;
725
725
  if (!o)
726
726
  return P;
727
727
  re && !Se && (Se = !0, Array.from(o.document.body.children).forEach((p) => p.addEventListener("click", P)), o.document.documentElement.addEventListener("click", P));
@@ -740,7 +740,7 @@ function $e(e, t, n = {}) {
740
740
  }
741
741
  function u(p, w) {
742
742
  const m = M(p), C = m.$.subTree && m.$.subTree.children;
743
- return C == null || !Array.isArray(C) ? !1 : C.some((H) => H.el === w.target || w.composedPath().includes(H.el));
743
+ return C == null || !Array.isArray(C) ? !1 : C.some((W) => W.el === w.target || w.composedPath().includes(W.el));
744
744
  }
745
745
  const f = (p) => {
746
746
  const w = V(e);
@@ -754,16 +754,16 @@ function $e(e, t, n = {}) {
754
754
  };
755
755
  let d = !1;
756
756
  const v = [
757
- K(o, "click", (p) => {
757
+ _(o, "click", (p) => {
758
758
  d || (d = !0, setTimeout(() => {
759
759
  d = !1;
760
760
  }, 0), f(p));
761
761
  }, { passive: !0, capture: a }),
762
- K(o, "pointerdown", (p) => {
762
+ _(o, "pointerdown", (p) => {
763
763
  const w = V(e);
764
764
  i = !s(p) && !!(w && !p.composedPath().includes(w));
765
765
  }, { passive: !0 }),
766
- l && K(o, "blur", (p) => {
766
+ l && _(o, "blur", (p) => {
767
767
  setTimeout(() => {
768
768
  var w;
769
769
  const m = V(e);
@@ -790,24 +790,24 @@ const Rt = {
790
790
  function te(e) {
791
791
  return typeof Window < "u" && e instanceof Window ? e.document.documentElement : typeof Document < "u" && e instanceof Document ? e.documentElement : e;
792
792
  }
793
- function Be(e) {
793
+ function ze(e) {
794
794
  const t = window.getComputedStyle(e);
795
795
  if (t.overflowX === "scroll" || t.overflowY === "scroll" || t.overflowX === "auto" && e.clientWidth < e.scrollWidth || t.overflowY === "auto" && e.clientHeight < e.scrollHeight)
796
796
  return !0;
797
797
  {
798
798
  const n = e.parentNode;
799
- return !n || n.tagName === "BODY" ? !1 : Be(n);
799
+ return !n || n.tagName === "BODY" ? !1 : ze(n);
800
800
  }
801
801
  }
802
802
  function Ot(e) {
803
803
  const t = e || window.event, n = t.target;
804
- return Be(n) ? !1 : t.touches.length > 1 ? !0 : (t.preventDefault && t.preventDefault(), !1);
804
+ return ze(n) ? !1 : t.touches.length > 1 ? !0 : (t.preventDefault && t.preventDefault(), !1);
805
805
  }
806
806
  const ne = /* @__PURE__ */ new WeakMap();
807
807
  function Lt(e, t = !1) {
808
808
  const n = x(t);
809
809
  let o = null, r = "";
810
- T(ht(e), (i) => {
810
+ T(gt(e), (i) => {
811
811
  const s = te(M(i));
812
812
  if (s) {
813
813
  const c = s;
@@ -821,7 +821,7 @@ function Lt(e, t = !1) {
821
821
  });
822
822
  const a = () => {
823
823
  const i = te(M(e));
824
- !i || n.value || (re && (o = K(
824
+ !i || n.value || (re && (o = _(
825
825
  i,
826
826
  "touchmove",
827
827
  (s) => {
@@ -833,7 +833,7 @@ function Lt(e, t = !1) {
833
833
  const i = te(M(e));
834
834
  !i || !n.value || (re && (o == null || o()), i.style.overflow = r, ne.delete(i), n.value = !1);
835
835
  };
836
- return J(l), $({
836
+ return Q(l), S({
837
837
  get() {
838
838
  return n.value;
839
839
  },
@@ -857,10 +857,10 @@ Pt();
857
857
  const Dt = {
858
858
  key: 0,
859
859
  id: "resizable"
860
- }, Wt = {
860
+ }, Ht = {
861
861
  class: "atable-header-row",
862
862
  tabindex: "-1"
863
- }, ze = /* @__PURE__ */ W({
863
+ }, Fe = /* @__PURE__ */ H({
864
864
  __name: "ATableHeader",
865
865
  props: {
866
866
  columns: {},
@@ -868,7 +868,7 @@ const Dt = {
868
868
  },
869
869
  setup(e) {
870
870
  return (t, n) => t.columns.length ? (E(), k("thead", Dt, [
871
- B("tr", Wt, [
871
+ j("tr", Ht, [
872
872
  t.store.zeroColumn ? (E(), k("th", {
873
873
  key: 0,
874
874
  id: "header-index",
@@ -878,60 +878,70 @@ const Dt = {
878
878
  t.store.config.view === "list-expansion" ? "list-expansion-index" : ""
879
879
  ], "list-index"])
880
880
  }, null, 2)) : U("", !0),
881
- (E(!0), k(_, null, le(t.columns, (o, r) => (E(), k("th", {
881
+ (E(!0), k(ee, null, le(t.columns, (o, r) => (E(), k("th", {
882
882
  key: o.name,
883
883
  tabindex: "-1",
884
- style: j(t.store.getHeaderCellStyle(o)),
884
+ style: B(t.store.getHeaderCellStyle(o)),
885
885
  class: z(o.pinned ? "sticky-column" : "")
886
886
  }, [
887
887
  R(t.$slots, "default", {}, () => [
888
- Je(F(o.label || String.fromCharCode(r + 97).toUpperCase()), 1)
888
+ Qe(F(o.label || String.fromCharCode(r + 97).toUpperCase()), 1)
889
889
  ])
890
890
  ], 6))), 128))
891
891
  ])
892
892
  ])) : U("", !0);
893
893
  }
894
- }), Fe = /* @__PURE__ */ W({
894
+ }), Ue = /* @__PURE__ */ H({
895
895
  __name: "ATableModal",
896
896
  props: {
897
897
  colIndex: {},
898
898
  rowIndex: {},
899
- store: {}
899
+ store: {},
900
+ container: {}
900
901
  },
901
902
  setup(e) {
902
- const t = (n) => {
903
- n.stopPropagation();
903
+ const t = X("amodal"), { width: n, height: o } = Ne(t), r = S(() => {
904
+ var u, f;
905
+ const l = ((u = e.container) == null ? void 0 : u.offsetWidth) || 0, i = ((f = e.container) == null ? void 0 : f.offsetHeight) || 0, s = e.store.modal.left + n.value > l ? e.store.modal.left - (n.value - e.store.modal.width) : e.store.modal.left, c = e.store.modal.top + o.value > i ? e.store.modal.top - o.value - e.store.modal.height : e.store.modal.top;
906
+ return {
907
+ left: `${s}px`,
908
+ top: `${c}px`
909
+ };
910
+ }), a = (l) => {
911
+ l.stopPropagation();
904
912
  };
905
- return (n, o) => (E(), k("div", {
913
+ return (l, i) => (E(), k("div", {
906
914
  class: "amodal",
915
+ ref: "amodal",
907
916
  tabindex: "-1",
908
- onClick: t,
909
- onInput: t
917
+ onClick: a,
918
+ onInput: a,
919
+ style: B(r.value)
910
920
  }, [
911
- R(n.$slots, "default")
912
- ], 32));
921
+ R(l.$slots, "default")
922
+ ], 36));
913
923
  }
914
- }), Ht = (e) => {
924
+ }), Wt = (e) => {
915
925
  const t = e.id || crypto.randomUUID();
916
- return Qe(`table-${t}`, () => {
926
+ return Ze(`table-${t}`, () => {
917
927
  const o = () => {
918
928
  const h = {};
919
929
  for (const [b, I] of a.value.entries())
920
- for (const [S, A] of l.value.entries())
921
- h[`${b}:${S}`] = A[I.name];
930
+ for (const [$, A] of l.value.entries())
931
+ h[`${b}:${$}`] = A[I.name];
922
932
  return h;
923
933
  }, r = (h) => {
924
934
  const b = [Object.assign({}, { rowModified: !1 })];
925
935
  if (h && "0:0" in h)
926
936
  return h;
927
937
  const I = /* @__PURE__ */ new Set();
928
- for (let S = l.value.length - 1; S >= 0; S--) {
929
- const A = l.value[S];
930
- A.parent && I.add(A.parent), b[S] = {
938
+ for (let $ = l.value.length - 1; $ >= 0; $--) {
939
+ const A = l.value[$];
940
+ A.parent && I.add(A.parent), b[$] = {
931
941
  childrenOpen: !1,
932
942
  expanded: !1,
933
943
  indent: A.indent || null,
934
- isParent: I.has(S),
944
+ isParent: I.has($),
935
945
  isRoot: A.parent === null || A.parent === void 0,
936
946
  rowModified: !1,
937
947
  open: A.parent === null || A.parent === void 0,
@@ -939,25 +949,25 @@ const Dt = {
939
949
  };
940
950
  }
941
951
  return b;
942
- }, a = x(e.columns), l = x(e.rows), i = x(e.config || {}), s = x(e.table || o()), c = x(r(e.display)), u = x(e.modal || { visible: !1 }), f = $(() => a.value.some((h) => h.pinned)), d = $(() => `${Math.ceil(l.value.length / 100 + 1)}ch`), v = $(() => ["list", "tree", "list-expansion"].includes(i.value.view)), y = (h, b) => s.value[`${h}:${b}`], p = (h, b, I) => {
943
- const S = `${h}:${b}`, A = a.value[h];
944
- s.value[S] !== I && (c.value[b].rowModified = !0), s.value[S] = I, l.value[b][A.name] = I;
952
+ }, a = x(e.columns), l = x(e.rows), i = x(e.config || {}), s = x(e.table || o()), c = x(r(e.display)), u = x(e.modal || { visible: !1 }), f = S(() => a.value.some((h) => h.pinned)), d = S(() => `${Math.ceil(l.value.length / 100 + 1)}ch`), v = S(() => ["list", "tree", "list-expansion"].includes(i.value.view)), y = (h, b) => s.value[`${h}:${b}`], p = (h, b, I) => {
953
+ const $ = `${h}:${b}`, A = a.value[h];
954
+ s.value[$] !== I && (c.value[b].rowModified = !0), s.value[$] = I, l.value[b][A.name] = I;
945
955
  }, w = (h) => ({
946
956
  minWidth: h.width || "40ch",
947
957
  textAlign: h.align || "center",
948
958
  width: i.value.fullWidth ? "auto" : null
949
- }), m = (h) => i.value.view !== "tree" || c.value[h].isRoot || c.value[h].open, C = (h) => i.value.view !== "tree" ? "" : c.value[h].isRoot || c.value[h].isParent ? c.value[h].childrenOpen ? "-" : "+" : "", H = (h) => {
959
+ }), m = (h) => i.value.view !== "tree" || c.value[h].isRoot || c.value[h].open, C = (h) => i.value.view !== "tree" ? "" : c.value[h].isRoot || c.value[h].isParent ? c.value[h].childrenOpen ? "-" : "+" : "", W = (h) => {
950
960
  if (i.value.view === "tree") {
951
961
  c.value[h].childrenOpen = !c.value[h].childrenOpen;
952
962
  for (let b = l.value.length - 1; b >= 0; b--)
953
- c.value[b].parent === h && (c.value[b].open = !c.value[b].open, c.value[b].childrenOpen && H(b));
963
+ c.value[b].parent === h && (c.value[b].open = !c.value[b].open, c.value[b].childrenOpen && W(b));
954
964
  } else i.value.view === "list-expansion" && (c.value[h].expanded = !c.value[h].expanded);
955
- }, Ue = (h, b) => {
965
+ }, qe = (h, b) => {
956
966
  const I = y(h, b);
957
967
  return he(h, b, I);
958
968
  }, he = (h, b, I) => {
959
- const S = a.value[h], A = l.value[b], N = S.format;
960
- return N ? typeof N == "function" ? N(I, { table: s.value, row: A, column: S }) : typeof N == "string" ? Function(`"use strict";return (${N})`)()(I, { table: s.value, row: A, column: S }) : I : I;
969
+ const $ = a.value[h], A = l.value[b], N = $.format;
970
+ return N ? typeof N == "function" ? N(I, { table: s.value, row: A, column: $ }) : typeof N == "string" ? Function(`"use strict";return (${N})`)()(I, { table: s.value, row: A, column: $ }) : I : I;
961
971
  };
962
972
  return {
963
973
  // state
@@ -977,17 +987,17 @@ const Dt = {
977
987
  h.target instanceof Node && (b = u.value.parent) != null && b.contains(h.target) || u.value.visible && (u.value.visible = !1);
978
988
  },
979
989
  getCellData: y,
980
- getCellDisplayValue: Ue,
990
+ getCellDisplayValue: qe,
981
991
  getFormattedValue: he,
982
992
  getHeaderCellStyle: w,
983
993
  getIndent: (h, b) => b && h === 0 && b > 0 ? `${b}ch` : "inherit",
984
994
  getRowExpandSymbol: C,
985
995
  isRowVisible: m,
986
996
  setCellData: p,
987
- toggleRowExpand: H
997
+ toggleRowExpand: W
988
998
  };
989
999
  })();
990
- }, Nt = /* @__PURE__ */ W({
1000
+ }, Nt = /* @__PURE__ */ H({
991
1001
  __name: "ATable",
992
1002
  props: {
993
1003
  id: {},
@@ -998,7 +1008,7 @@ const Dt = {
998
1008
  },
999
1009
  emits: ["update:modelValue", "cellUpdate"],
1000
1010
  setup(e, { expose: t, emit: n }) {
1001
- const o = n, r = ee("table"), a = e.modelValue ? e.modelValue : e.rows, l = Ht({ columns: e.columns, rows: a, id: e.id, config: e.config });
1011
+ const o = n, r = X("table"), a = e.modelValue ? e.modelValue : e.rows, l = Wt({ columns: e.columns, rows: a, id: e.id, config: e.config });
1002
1012
  l.$onAction(({ name: s, store: c, args: u }) => {
1003
1013
  if (s === "setCellData") {
1004
1014
  const [f, d, v] = u, y = c.getCellData(f, d);
@@ -1011,7 +1021,7 @@ const Dt = {
1011
1021
  },
1012
1022
  { deep: !0 }
1013
1023
  ), Y(() => {
1014
- e.columns.some((s) => s.pinned) && (i(), l.config.view === "tree" && He(r, i, { childList: !0, subtree: !0 }));
1024
+ e.columns.some((s) => s.pinned) && (i(), l.config.view === "tree" && We(r, i, { childList: !0, subtree: !0 }));
1015
1025
  });
1016
1026
  const i = () => {
1017
1027
  const s = r.value, c = s.rows[0], u = s.rows[1], f = c ? Array.from(c.cells) : [];
@@ -1038,24 +1048,24 @@ const Dt = {
1038
1048
  }), t({ store: l }), (s, c) => oe((E(), k("table", {
1039
1049
  ref: "table",
1040
1050
  class: "atable",
1041
- style: j({ width: g(l).config.fullWidth ? "100%" : "auto" })
1051
+ style: B({ width: g(l).config.fullWidth ? "100%" : "auto" })
1042
1052
  }, [
1043
1053
  R(s.$slots, "header", { data: g(l) }, () => [
1044
- ge(ze, {
1054
+ ge(Fe, {
1045
1055
  columns: g(l).columns,
1046
1056
  store: g(l)
1047
1057
  }, null, 8, ["columns", "store"])
1048
1058
  ], !0),
1049
- B("tbody", null, [
1059
+ j("tbody", null, [
1050
1060
  R(s.$slots, "body", { data: g(l) }, () => [
1051
- (E(!0), k(_, null, le(g(l).rows, (u, f) => (E(), Z(Ve, {
1061
+ (E(!0), k(ee, null, le(g(l).rows, (u, f) => (E(), K(je, {
1052
1062
  key: u.id,
1053
1063
  row: u,
1054
1064
  rowIndex: f,
1055
1065
  store: g(l)
1056
1066
  }, {
1057
1067
  default: ye(() => [
1058
- (E(!0), k(_, null, le(g(l).columns, (d, v) => (E(), Z(Ne, {
1068
+ (E(!0), k(ee, null, le(g(l).columns, (d, v) => (E(), K(Ve, {
1059
1069
  key: d.name,
1060
1070
  store: g(l),
1061
1071
  col: d,
@@ -1064,7 +1074,7 @@ const Dt = {
1064
1074
  rowIndex: f,
1065
1075
  colIndex: v,
1066
1076
  component: d.cellComponent,
1067
- style: j({
1077
+ style: B({
1068
1078
  textAlign: (d == null ? void 0 : d.align) || "center",
1069
1079
  minWidth: (d == null ? void 0 : d.width) || "40ch",
1070
1080
  width: g(l).config.fullWidth ? "auto" : null
@@ -1077,18 +1087,14 @@ const Dt = {
1077
1087
  ]),
1078
1088
  R(s.$slots, "footer", { data: g(l) }, void 0, !0),
1079
1089
  R(s.$slots, "modal", { data: g(l) }, () => [
1080
- oe(ge(Fe, {
1090
+ oe(ge(Ue, {
1081
1091
  colIndex: g(l).modal.colIndex,
1082
1092
  rowIndex: g(l).modal.rowIndex,
1083
1093
  store: g(l),
1084
- style: j({
1085
- left: g(l).modal.left + "px",
1086
- top: g(l).modal.top + "px",
1087
- maxWidth: g(l).modal.width + "px"
1088
- })
1094
+ container: g(r)
1089
1095
  }, {
1090
1096
  default: ye(() => [
1091
- (E(), Z(Oe(g(l).modal.component), ae({
1097
+ (E(), K(Oe(g(l).modal.component), ae({
1092
1098
  key: `${g(l).modal.rowIndex}:${g(l).modal.colIndex}`,
1093
1099
  colIndex: g(l).modal.colIndex,
1094
1100
  rowIndex: g(l).modal.rowIndex,
@@ -1096,7 +1102,7 @@ const Dt = {
1096
1102
  }, g(l).modal.componentProps), null, 16, ["colIndex", "rowIndex", "store"]))
1097
1103
  ]),
1098
1104
  _: 1
1099
- }, 8, ["colIndex", "rowIndex", "store", "style"]), [
1105
+ }, 8, ["colIndex", "rowIndex", "store", "container"]), [
1100
1106
  [Le, g(l).modal.visible]
1101
1107
  ])
1102
1108
  ], !0)
@@ -1109,18 +1115,18 @@ const Dt = {
1109
1115
  for (const [o, r] of t)
1110
1116
  n[o] = r;
1111
1117
  return n;
1112
- }, jt = /* @__PURE__ */ Vt(Nt, [["__scopeId", "data-v-a7848db7"]]);
1118
+ }, jt = /* @__PURE__ */ Vt(Nt, [["__scopeId", "data-v-7a1c014a"]]);
1113
1119
  function Gt(e) {
1114
- e.component("ACell", Ne), e.component("AExpansionRow", Tt), e.component("ARow", Ve), e.component("ATable", jt), e.component("ATableHeader", ze), e.component("ATableModal", Fe);
1120
+ e.component("ACell", Ve), e.component("AExpansionRow", Tt), e.component("ARow", je), e.component("ATable", jt), e.component("ATableHeader", Fe), e.component("ATableModal", Ue);
1115
1121
  }
1116
1122
  export {
1117
- Ne as ACell,
1123
+ Ve as ACell,
1118
1124
  Tt as AExpansionRow,
1119
- Ve as ARow,
1125
+ je as ARow,
1120
1126
  jt as ATable,
1121
- ze as ATableHeader,
1122
- Fe as ATableModal,
1123
- Ht as createTableStore,
1127
+ Fe as ATableHeader,
1128
+ Ue as ATableModal,
1129
+ Wt as createTableStore,
1124
1130
  Gt as install
1125
1131
  };
1126
1132
  //# sourceMappingURL=atable.js.map