@stonecrop/atable 0.2.63 → 0.2.65

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,204 +1,202 @@
1
- import './assets/index.css';var Ue = Object.defineProperty;
2
- var qe = (e, t, n) => t in e ? Ue(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var T = (e, t, n) => qe(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { onMounted as G, ref as g, watch as C, onBeforeUnmount as Ye, computed as x, unref as m, getCurrentScope as ie, onScopeDispose as se, getCurrentInstance as re, nextTick as Te, defineComponent as M, inject as Q, useTemplateRef as Z, openBlock as y, createElementBlock as k, normalizeStyle as P, normalizeClass as N, createBlock as Y, resolveDynamicComponent as De, mergeProps as ae, toDisplayString as B, Fragment as J, createElementVNode as W, renderSlot as S, createCommentVNode as V, withDirectives as ne, vShow as Me, toRef as Xe, readonly as Je, customRef as Qe, reactive as R, renderList as oe, createTextVNode as Ze, provide as Ke, createVNode as ye, withCtx as be } from "vue";
5
- function Re(e) {
6
- return ie() ? (se(e), !0) : !1;
1
+ import { onMounted as q, ref as y, watch as $, onBeforeUnmount as Ye, computed as S, unref as w, getCurrentScope as le, onScopeDispose as re, getCurrentInstance as se, toRef as Xe, readonly as Je, customRef as Qe, nextTick as Re, defineComponent as D, useTemplateRef as K, withDirectives as ae, openBlock as x, createElementBlock as k, normalizeStyle as H, normalizeClass as B, createBlock as J, resolveDynamicComponent as Le, mergeProps as ie, toDisplayString as z, Fragment as Z, createElementVNode as N, renderSlot as T, createCommentVNode as F, vShow as De, renderList as ne, createTextVNode as Ze, createVNode as be, withCtx as xe } from "vue";
2
+ import { defineStore as Ke } from "pinia";
3
+ import './assets/index.css';function Pe(e) {
4
+ return le() ? (re(e), !0) : !1;
7
5
  }
8
6
  function ce(e) {
9
- return typeof e == "function" ? e() : m(e);
7
+ return typeof e == "function" ? e() : w(e);
10
8
  }
11
9
  const _e = typeof window < "u" && typeof document < "u";
12
10
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
13
11
  const et = (e) => e != null, tt = Object.prototype.toString, nt = (e) => tt.call(e) === "[object Object]", ot = () => {
14
- }, U = _e ? window : void 0;
15
- function z(e) {
12
+ }, Y = _e ? window : void 0;
13
+ function U(e) {
16
14
  var t;
17
15
  const n = ce(e);
18
16
  return (t = n == null ? void 0 : n.$el) != null ? t : n;
19
17
  }
20
- function F(...e) {
21
- let t, n, o, i;
22
- if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, o, i] = e, t = U) : [t, n, o, i] = e, !t)
18
+ function G(...e) {
19
+ let t, n, o, r;
20
+ if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, o, r] = e, t = Y) : [t, n, o, r] = e, !t)
23
21
  return ot;
24
22
  Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
25
- const s = [], l = () => {
26
- s.forEach((d) => d()), s.length = 0;
27
- }, a = (d, p, c, u) => (d.addEventListener(p, c, u), () => d.removeEventListener(p, c, u)), f = C(
28
- () => [z(t), ce(i)],
29
- ([d, p]) => {
23
+ const i = [], l = () => {
24
+ i.forEach((d) => d()), i.length = 0;
25
+ }, c = (d, m, a, f) => (d.addEventListener(m, a, f), () => d.removeEventListener(m, a, f)), s = $(
26
+ () => [U(t), ce(r)],
27
+ ([d, m]) => {
30
28
  if (l(), !d)
31
29
  return;
32
- const c = nt(p) ? { ...p } : p;
33
- s.push(
34
- ...n.flatMap((u) => o.map((v) => a(d, u, v, c)))
30
+ const a = nt(m) ? { ...m } : m;
31
+ i.push(
32
+ ...n.flatMap((f) => o.map((v) => c(d, f, v, a)))
35
33
  );
36
34
  },
37
35
  { immediate: !0, flush: "post" }
38
- ), r = () => {
39
- f(), l();
36
+ ), u = () => {
37
+ s(), l();
40
38
  };
41
- return Re(r), r;
39
+ return Pe(u), u;
42
40
  }
43
41
  function lt() {
44
- const e = g(!1), t = re();
45
- return t && G(() => {
42
+ const e = y(!1), t = se();
43
+ return t && q(() => {
46
44
  e.value = !0;
47
45
  }, t), e;
48
46
  }
49
- function it(e) {
47
+ function rt(e) {
50
48
  const t = lt();
51
- return x(() => (t.value, !!e()));
49
+ return S(() => (t.value, !!e()));
52
50
  }
53
51
  function st(e, t, n = {}) {
54
- const { window: o = U, ...i } = n;
55
- let s;
56
- const l = it(() => o && "MutationObserver" in o), a = () => {
57
- s && (s.disconnect(), s = void 0);
58
- }, f = x(() => {
59
- const c = ce(e), u = (Array.isArray(c) ? c : [c]).map(z).filter(et);
60
- return new Set(u);
61
- }), r = C(
62
- () => f.value,
63
- (c) => {
64
- a(), l.value && c.size && (s = new MutationObserver(t), c.forEach((u) => s.observe(u, i)));
52
+ const { window: o = Y, ...r } = n;
53
+ let i;
54
+ const l = rt(() => o && "MutationObserver" in o), c = () => {
55
+ i && (i.disconnect(), i = void 0);
56
+ }, s = S(() => {
57
+ const a = ce(e), f = (Array.isArray(a) ? a : [a]).map(U).filter(et);
58
+ return new Set(f);
59
+ }), u = $(
60
+ () => s.value,
61
+ (a) => {
62
+ c(), l.value && a.size && (i = new MutationObserver(t), a.forEach((f) => i.observe(f, r)));
65
63
  },
66
64
  { immediate: !0, flush: "post" }
67
- ), d = () => s == null ? void 0 : s.takeRecords(), p = () => {
68
- r(), a();
65
+ ), d = () => i == null ? void 0 : i.takeRecords(), m = () => {
66
+ u(), c();
69
67
  };
70
- return Re(p), {
68
+ return Pe(m), {
71
69
  isSupported: l,
72
- stop: p,
70
+ stop: m,
73
71
  takeRecords: d
74
72
  };
75
73
  }
76
- function rt(e = {}) {
74
+ function at(e = {}) {
77
75
  var t;
78
76
  const {
79
- window: n = U,
77
+ window: n = Y,
80
78
  deep: o = !0,
81
- triggerOnRemoval: i = !1
82
- } = e, s = (t = e.document) != null ? t : n == null ? void 0 : n.document, l = () => {
83
- var r;
84
- let d = s == null ? void 0 : s.activeElement;
79
+ triggerOnRemoval: r = !1
80
+ } = e, i = (t = e.document) != null ? t : n == null ? void 0 : n.document, l = () => {
81
+ var u;
82
+ let d = i == null ? void 0 : i.activeElement;
85
83
  if (o)
86
84
  for (; d != null && d.shadowRoot; )
87
- d = (r = d == null ? void 0 : d.shadowRoot) == null ? void 0 : r.activeElement;
85
+ d = (u = d == null ? void 0 : d.shadowRoot) == null ? void 0 : u.activeElement;
88
86
  return d;
89
- }, a = g(), f = () => {
90
- a.value = l();
87
+ }, c = y(), s = () => {
88
+ c.value = l();
91
89
  };
92
- return n && (F(n, "blur", (r) => {
93
- r.relatedTarget === null && f();
94
- }, !0), F(n, "focus", f, !0)), i && st(s, (r) => {
95
- r.filter((d) => d.removedNodes.length).map((d) => Array.from(d.removedNodes)).flat().forEach((d) => {
96
- d === a.value && f();
90
+ return n && (G(n, "blur", (u) => {
91
+ u.relatedTarget === null && s();
92
+ }, !0), G(n, "focus", s, !0)), r && st(i, (u) => {
93
+ u.filter((d) => d.removedNodes.length).map((d) => Array.from(d.removedNodes)).flat().forEach((d) => {
94
+ d === c.value && s();
97
95
  });
98
96
  }, {
99
97
  childList: !0,
100
98
  subtree: !0
101
- }), f(), a;
99
+ }), s(), c;
102
100
  }
103
- const at = "focusin", ct = "focusout";
104
- function dt(e, t = {}) {
105
- const { window: n = U } = t, o = x(() => z(e)), i = g(!1), s = x(() => i.value), l = rt(t);
106
- return !n || !l.value ? { focused: s } : (F(o, at, () => i.value = !0), F(o, ct, () => i.value = !1), { focused: s });
101
+ const it = "focusin", ct = "focusout";
102
+ function ut(e, t = {}) {
103
+ const { window: n = Y } = t, o = S(() => U(e)), r = y(!1), i = S(() => r.value), l = at(t);
104
+ return !n || !l.value ? { focused: i } : (G(o, it, () => r.value = !0), G(o, ct, () => r.value = !1), { focused: i });
107
105
  }
108
- function ut(e, { window: t = U, scrollTarget: n } = {}) {
109
- const o = g(!1), i = () => {
106
+ function dt(e, { window: t = Y, scrollTarget: n } = {}) {
107
+ const o = y(!1), r = () => {
110
108
  if (!t) return;
111
- const s = t.document, l = z(e);
109
+ const i = t.document, l = U(e);
112
110
  if (!l)
113
111
  o.value = !1;
114
112
  else {
115
- const a = l.getBoundingClientRect();
116
- o.value = a.top <= (t.innerHeight || s.documentElement.clientHeight) && a.left <= (t.innerWidth || s.documentElement.clientWidth) && a.bottom >= 0 && a.right >= 0;
113
+ const c = l.getBoundingClientRect();
114
+ o.value = c.top <= (t.innerHeight || i.documentElement.clientHeight) && c.left <= (t.innerWidth || i.documentElement.clientWidth) && c.bottom >= 0 && c.right >= 0;
117
115
  }
118
116
  };
119
- return C(
120
- () => z(e),
121
- () => i(),
117
+ return $(
118
+ () => U(e),
119
+ () => r(),
122
120
  { immediate: !0, flush: "post" }
123
- ), t && F(n || t, "scroll", i, {
121
+ ), t && G(n || t, "scroll", r, {
124
122
  capture: !1,
125
123
  passive: !0
126
124
  }), o;
127
125
  }
128
- const O = (e) => {
129
- let t = ut(e).value;
126
+ const M = (e) => {
127
+ let t = dt(e).value;
130
128
  return t = t && e.offsetHeight > 0, t;
131
- }, $ = (e) => e.tabIndex >= 0, ge = (e) => {
129
+ }, R = (e) => e.tabIndex >= 0, Ee = (e) => {
132
130
  const t = e.target;
133
- return de(t);
134
- }, de = (e) => {
131
+ return ue(t);
132
+ }, ue = (e) => {
135
133
  var t;
136
134
  let n;
137
135
  if (e instanceof HTMLTableCellElement) {
138
136
  const o = (t = e.parentElement) == null ? void 0 : t.previousElementSibling;
139
137
  if (o) {
140
- const i = Array.from(o.children)[e.cellIndex];
141
- i && (n = i);
138
+ const r = Array.from(o.children)[e.cellIndex];
139
+ r && (n = r);
142
140
  }
143
141
  } else if (e instanceof HTMLTableRowElement) {
144
142
  const o = e.previousElementSibling;
145
143
  o && (n = o);
146
144
  }
147
- return n && (!$(n) || !O(n)) ? de(n) : n;
145
+ return n && (!R(n) || !M(n)) ? ue(n) : n;
148
146
  }, ft = (e) => {
149
147
  var t;
150
148
  const n = e.target;
151
149
  let o;
152
150
  if (n instanceof HTMLTableCellElement) {
153
- const i = (t = n.parentElement) == null ? void 0 : t.parentElement;
154
- if (i) {
155
- const s = i.firstElementChild.children[n.cellIndex];
156
- s && (o = s);
151
+ const r = (t = n.parentElement) == null ? void 0 : t.parentElement;
152
+ if (r) {
153
+ const i = r.firstElementChild.children[n.cellIndex];
154
+ i && (o = i);
157
155
  }
158
156
  } else if (n instanceof HTMLTableRowElement) {
159
- const i = n.parentElement;
160
- if (i) {
161
- const s = i.firstElementChild;
162
- s && (o = s);
157
+ const r = n.parentElement;
158
+ if (r) {
159
+ const i = r.firstElementChild;
160
+ i && (o = i);
163
161
  }
164
162
  }
165
- return o && (!$(o) || !O(o)) ? ue(o) : o;
166
- }, xe = (e) => {
163
+ return o && (!R(o) || !M(o)) ? de(o) : o;
164
+ }, ke = (e) => {
167
165
  const t = e.target;
168
- return ue(t);
169
- }, ue = (e) => {
166
+ return de(t);
167
+ }, de = (e) => {
170
168
  var t;
171
169
  let n;
172
170
  if (e instanceof HTMLTableCellElement) {
173
171
  const o = (t = e.parentElement) == null ? void 0 : t.nextElementSibling;
174
172
  if (o) {
175
- const i = Array.from(o.children)[e.cellIndex];
176
- i && (n = i);
173
+ const r = Array.from(o.children)[e.cellIndex];
174
+ r && (n = r);
177
175
  }
178
176
  } else if (e instanceof HTMLTableRowElement) {
179
177
  const o = e.nextElementSibling;
180
178
  o && (n = o);
181
179
  }
182
- return n && (!$(n) || !O(n)) ? ue(n) : n;
183
- }, pt = (e) => {
180
+ return n && (!R(n) || !M(n)) ? de(n) : n;
181
+ }, mt = (e) => {
184
182
  var t;
185
183
  const n = e.target;
186
184
  let o;
187
185
  if (n instanceof HTMLTableCellElement) {
188
- const i = (t = n.parentElement) == null ? void 0 : t.parentElement;
189
- if (i) {
190
- const s = i.lastElementChild.children[n.cellIndex];
191
- s && (o = s);
186
+ const r = (t = n.parentElement) == null ? void 0 : t.parentElement;
187
+ if (r) {
188
+ const i = r.lastElementChild.children[n.cellIndex];
189
+ i && (o = i);
192
190
  }
193
191
  } else if (n instanceof HTMLTableRowElement) {
194
- const i = n.parentElement;
195
- if (i) {
196
- const s = i.lastElementChild;
197
- s && (o = s);
192
+ const r = n.parentElement;
193
+ if (r) {
194
+ const i = r.lastElementChild;
195
+ i && (o = i);
198
196
  }
199
197
  }
200
- return o && (!$(o) || !O(o)) ? de(o) : o;
201
- }, Ee = (e) => {
198
+ return o && (!R(o) || !M(o)) ? ue(o) : o;
199
+ }, Ce = (e) => {
202
200
  const t = e.target;
203
201
  return fe(t);
204
202
  }, fe = (e) => {
@@ -210,11 +208,11 @@ const O = (e) => {
210
208
  const o = (t = e.parentElement) == null ? void 0 : t.previousElementSibling;
211
209
  n = o == null ? void 0 : o.lastElementChild;
212
210
  }
213
- return n && (!$(n) || !O(n)) ? fe(n) : n;
214
- }, ke = (e) => {
211
+ return n && (!R(n) || !M(n)) ? fe(n) : n;
212
+ }, Ae = (e) => {
215
213
  const t = e.target;
216
- return pe(t);
217
- }, pe = (e) => {
214
+ return me(t);
215
+ }, me = (e) => {
218
216
  var t;
219
217
  let n;
220
218
  if (e.nextElementSibling)
@@ -223,33 +221,33 @@ const O = (e) => {
223
221
  const o = (t = e.parentElement) == null ? void 0 : t.nextElementSibling;
224
222
  n = o == null ? void 0 : o.firstElementChild;
225
223
  }
226
- return n && (!$(n) || !O(n)) ? pe(n) : n;
227
- }, Ce = (e) => {
228
- const t = e.target.parentElement.firstElementChild;
229
- return t && (!$(t) || !O(t)) ? pe(t) : t;
224
+ return n && (!R(n) || !M(n)) ? me(n) : n;
230
225
  }, Ie = (e) => {
226
+ const t = e.target.parentElement.firstElementChild;
227
+ return t && (!R(t) || !M(t)) ? me(t) : t;
228
+ }, Se = (e) => {
231
229
  const t = e.target.parentElement.lastElementChild;
232
- return t && (!$(t) || !O(t)) ? fe(t) : t;
233
- }, q = ["alt", "control", "shift", "meta"], mt = {
230
+ return t && (!R(t) || !M(t)) ? fe(t) : t;
231
+ }, X = ["alt", "control", "shift", "meta"], vt = {
234
232
  ArrowUp: "up",
235
233
  ArrowDown: "down",
236
234
  ArrowLeft: "left",
237
235
  ArrowRight: "right"
238
- }, me = {
236
+ }, ve = {
239
237
  "keydown.up": (e) => {
240
- const t = ge(e);
238
+ const t = Ee(e);
241
239
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
242
240
  },
243
241
  "keydown.down": (e) => {
244
- const t = xe(e);
242
+ const t = ke(e);
245
243
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
246
244
  },
247
245
  "keydown.left": (e) => {
248
- const t = Ee(e);
246
+ const t = Ce(e);
249
247
  e.preventDefault(), e.stopPropagation(), t && t.focus();
250
248
  },
251
249
  "keydown.right": (e) => {
252
- const t = ke(e);
250
+ const t = Ae(e);
253
251
  e.preventDefault(), e.stopPropagation(), t && t.focus();
254
252
  },
255
253
  "keydown.control.up": (e) => {
@@ -257,728 +255,734 @@ const O = (e) => {
257
255
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
258
256
  },
259
257
  "keydown.control.down": (e) => {
260
- const t = pt(e);
258
+ const t = mt(e);
261
259
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
262
260
  },
263
261
  "keydown.control.left": (e) => {
264
- const t = Ce(e);
262
+ const t = Ie(e);
265
263
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
266
264
  },
267
265
  "keydown.control.right": (e) => {
268
- const t = Ie(e);
266
+ const t = Se(e);
269
267
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
270
268
  },
271
269
  "keydown.end": (e) => {
272
- const t = Ie(e);
270
+ const t = Se(e);
273
271
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
274
272
  },
275
273
  "keydown.enter": (e) => {
276
274
  if (e.target instanceof HTMLTableCellElement) {
277
275
  e.preventDefault(), e.stopPropagation();
278
- const t = xe(e);
276
+ const t = ke(e);
279
277
  t && t.focus();
280
278
  }
281
279
  },
282
280
  "keydown.shift.enter": (e) => {
283
281
  if (e.target instanceof HTMLTableCellElement) {
284
282
  e.preventDefault(), e.stopPropagation();
285
- const t = ge(e);
283
+ const t = Ee(e);
286
284
  t && t.focus();
287
285
  }
288
286
  },
289
287
  "keydown.home": (e) => {
290
- const t = Ce(e);
288
+ const t = Ie(e);
291
289
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
292
290
  },
293
291
  "keydown.tab": (e) => {
294
- const t = ke(e);
292
+ const t = Ae(e);
295
293
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
296
294
  },
297
295
  "keydown.shift.tab": (e) => {
298
- const t = Ee(e);
296
+ const t = Ce(e);
299
297
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
300
298
  }
301
299
  };
302
- function ve(e) {
300
+ function pe(e) {
303
301
  const t = (l) => {
304
- let a = null;
305
- return l.parent && (typeof l.parent == "string" ? a = document.querySelector(l.parent) : l.parent instanceof HTMLElement ? a = l.parent : a = l.parent.value), a;
302
+ let c = null;
303
+ return l.parent && (typeof l.parent == "string" ? c = document.querySelector(l.parent) : l.parent instanceof HTMLElement ? c = l.parent : c = l.parent.value), c;
306
304
  }, n = (l) => {
307
- const a = t(l);
308
- let f = [];
305
+ const c = t(l);
306
+ let s = [];
309
307
  if (typeof l.selectors == "string")
310
- f = a ? Array.from(a.querySelectorAll(l.selectors)) : Array.from(document.querySelectorAll(l.selectors));
308
+ s = c ? Array.from(c.querySelectorAll(l.selectors)) : Array.from(document.querySelectorAll(l.selectors));
311
309
  else if (Array.isArray(l.selectors))
312
- for (const r of l.selectors)
313
- r instanceof HTMLElement ? f.push(r) : f.push(r.$el);
310
+ for (const u of l.selectors)
311
+ u instanceof HTMLElement ? s.push(u) : s.push(u.$el);
314
312
  else if (l.selectors instanceof HTMLElement)
315
- f.push(l.selectors);
313
+ s.push(l.selectors);
316
314
  else if (Array.isArray(l.selectors.value))
317
- for (const r of l.selectors.value)
318
- r instanceof HTMLElement ? f.push(r) : f.push(r.$el);
315
+ for (const u of l.selectors.value)
316
+ u instanceof HTMLElement ? s.push(u) : s.push(u.$el);
319
317
  else
320
- f.push(l.selectors.value);
321
- return f;
318
+ s.push(l.selectors.value);
319
+ return s;
322
320
  }, o = (l) => {
323
- const a = t(l);
324
- let f = [];
325
- return l.selectors ? f = n(l) : a && (f = Array.from(a.children).filter((r) => $(r) && O(r))), f;
326
- }, i = (l) => (a) => {
327
- const f = mt[a.key] || a.key.toLowerCase();
328
- if (q.includes(f)) return;
329
- const r = l.handlers || me;
330
- for (const d of Object.keys(r)) {
331
- const [p, ...c] = d.split(".");
332
- if (p === "keydown" && c.includes(f)) {
333
- const u = r[d], v = c.filter((w) => q.includes(w)), b = q.some((w) => {
334
- const E = w.charAt(0).toUpperCase() + w.slice(1);
335
- return a.getModifierState(E);
321
+ const c = t(l);
322
+ let s = [];
323
+ return l.selectors ? s = n(l) : c && (s = Array.from(c.children).filter((u) => R(u) && M(u))), s;
324
+ }, r = (l) => (c) => {
325
+ const s = vt[c.key] || c.key.toLowerCase();
326
+ if (X.includes(s)) return;
327
+ const u = l.handlers || ve;
328
+ for (const d of Object.keys(u)) {
329
+ const [m, ...a] = d.split(".");
330
+ if (m === "keydown" && a.includes(s)) {
331
+ const f = u[d], v = a.filter((b) => X.includes(b)), E = X.some((b) => {
332
+ const h = b.charAt(0).toUpperCase() + b.slice(1);
333
+ return c.getModifierState(h);
336
334
  });
337
335
  if (v.length > 0) {
338
- if (b) {
339
- for (const w of q)
340
- if (c.includes(w)) {
341
- const E = w.charAt(0).toUpperCase() + w.slice(1);
342
- a.getModifierState(E) && u(a);
336
+ if (E) {
337
+ for (const b of X)
338
+ if (a.includes(b)) {
339
+ const h = b.charAt(0).toUpperCase() + b.slice(1);
340
+ c.getModifierState(h) && f(c);
343
341
  }
344
342
  }
345
343
  } else
346
- b || u(a);
344
+ E || f(c);
347
345
  }
348
346
  }
349
- }, s = [];
350
- G(() => {
347
+ }, i = [];
348
+ q(() => {
351
349
  for (const l of e) {
352
- const a = t(l), f = o(l), r = i(l), d = a ? [a] : f;
353
- for (const p of d) {
354
- const { focused: c } = dt(g(p)), u = C(c, (v) => {
355
- v ? p.addEventListener("keydown", r) : p.removeEventListener("keydown", r);
350
+ const c = t(l), s = o(l), u = r(l), d = c ? [c] : s;
351
+ for (const m of d) {
352
+ const { focused: a } = ut(y(m)), f = $(a, (v) => {
353
+ v ? m.addEventListener("keydown", u) : m.removeEventListener("keydown", u);
356
354
  });
357
- s.push(u);
355
+ i.push(f);
358
356
  }
359
357
  }
360
358
  }), Ye(() => {
361
- for (const l of s)
359
+ for (const l of i)
362
360
  l();
363
361
  });
364
362
  }
363
+ function We(e) {
364
+ return le() ? (re(e), !0) : !1;
365
+ }
366
+ function j(e) {
367
+ return typeof e == "function" ? e() : w(e);
368
+ }
369
+ const He = typeof window < "u" && typeof document < "u";
370
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
371
+ const pt = Object.prototype.toString, wt = (e) => pt.call(e) === "[object Object]", V = () => {
372
+ }, oe = /* @__PURE__ */ ht();
373
+ function ht() {
374
+ var e, t;
375
+ return He && ((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
+ }
377
+ const $e = {
378
+ mounted: "mounted",
379
+ updated: "updated",
380
+ unmounted: "unmounted"
381
+ };
382
+ function gt(...e) {
383
+ if (e.length !== 1)
384
+ return Xe(...e);
385
+ const t = e[0];
386
+ return typeof t == "function" ? Je(Qe(() => ({ get: t, set: V }))) : y(t);
387
+ }
388
+ function W(e) {
389
+ var t;
390
+ const n = j(e);
391
+ return (t = n == null ? void 0 : n.$el) != null ? t : n;
392
+ }
393
+ const Ne = He ? window : void 0;
394
+ function Q(...e) {
395
+ let t, n, o, r;
396
+ if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, o, r] = e, t = Ne) : [t, n, o, r] = e, !t)
397
+ return V;
398
+ Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
399
+ const i = [], l = () => {
400
+ i.forEach((d) => d()), i.length = 0;
401
+ }, c = (d, m, a, f) => (d.addEventListener(m, a, f), () => d.removeEventListener(m, a, f)), s = $(
402
+ () => [W(t), j(r)],
403
+ ([d, m]) => {
404
+ if (l(), !d)
405
+ return;
406
+ const a = wt(m) ? { ...m } : m;
407
+ i.push(
408
+ ...n.flatMap((f) => o.map((v) => c(d, f, v, a)))
409
+ );
410
+ },
411
+ { immediate: !0, flush: "post" }
412
+ ), u = () => {
413
+ s(), l();
414
+ };
415
+ return We(u), u;
416
+ }
417
+ let Oe = !1;
418
+ function Te(e, t, n = {}) {
419
+ const { window: o = Ne, ignore: r = [], capture: i = !0, detectIframe: l = !1 } = n;
420
+ if (!o)
421
+ return V;
422
+ oe && !Oe && (Oe = !0, Array.from(o.document.body.children).forEach((a) => a.addEventListener("click", V)), o.document.documentElement.addEventListener("click", V));
423
+ let c = !0;
424
+ const s = (a) => r.some((f) => {
425
+ if (typeof f == "string")
426
+ return Array.from(o.document.querySelectorAll(f)).some((v) => v === a.target || a.composedPath().includes(v));
427
+ {
428
+ const v = W(f);
429
+ return v && (a.target === v || a.composedPath().includes(v));
430
+ }
431
+ }), d = [
432
+ Q(o, "click", (a) => {
433
+ const f = W(e);
434
+ if (!(!f || f === a.target || a.composedPath().includes(f))) {
435
+ if (a.detail === 0 && (c = !s(a)), !c) {
436
+ c = !0;
437
+ return;
438
+ }
439
+ t(a);
440
+ }
441
+ }, { passive: !0, capture: i }),
442
+ Q(o, "pointerdown", (a) => {
443
+ const f = W(e);
444
+ c = !s(a) && !!(f && !a.composedPath().includes(f));
445
+ }, { passive: !0 }),
446
+ l && Q(o, "blur", (a) => {
447
+ setTimeout(() => {
448
+ var f;
449
+ const v = W(e);
450
+ ((f = o.document.activeElement) == null ? void 0 : f.tagName) === "IFRAME" && !(v != null && v.contains(o.document.activeElement)) && t(a);
451
+ }, 0);
452
+ })
453
+ ].filter(Boolean);
454
+ return () => d.forEach((a) => a());
455
+ }
456
+ const yt = {
457
+ [$e.mounted](e, t) {
458
+ const n = !t.modifiers.bubble;
459
+ if (typeof t.value == "function")
460
+ e.__onClickOutside_stop = Te(e, t.value, { capture: n });
461
+ else {
462
+ const [o, r] = t.value;
463
+ e.__onClickOutside_stop = Te(e, o, Object.assign({ capture: n }, r));
464
+ }
465
+ },
466
+ [$e.unmounted](e) {
467
+ e.__onClickOutside_stop();
468
+ }
469
+ };
470
+ function ee(e) {
471
+ return typeof Window < "u" && e instanceof Window ? e.document.documentElement : typeof Document < "u" && e instanceof Document ? e.documentElement : e;
472
+ }
473
+ function je(e) {
474
+ const t = window.getComputedStyle(e);
475
+ if (t.overflowX === "scroll" || t.overflowY === "scroll" || t.overflowX === "auto" && e.clientWidth < e.scrollWidth || t.overflowY === "auto" && e.clientHeight < e.scrollHeight)
476
+ return !0;
477
+ {
478
+ const n = e.parentNode;
479
+ return !n || n.tagName === "BODY" ? !1 : je(n);
480
+ }
481
+ }
482
+ function bt(e) {
483
+ const t = e || window.event, n = t.target;
484
+ return je(n) ? !1 : t.touches.length > 1 ? !0 : (t.preventDefault && t.preventDefault(), !1);
485
+ }
486
+ const te = /* @__PURE__ */ new WeakMap();
487
+ function xt(e, t = !1) {
488
+ const n = y(t);
489
+ let o = null, r = "";
490
+ $(gt(e), (c) => {
491
+ const s = ee(j(c));
492
+ if (s) {
493
+ const u = s;
494
+ if (te.get(u) || te.set(u, u.style.overflow), u.style.overflow !== "hidden" && (r = u.style.overflow), u.style.overflow === "hidden")
495
+ return n.value = !0;
496
+ if (n.value)
497
+ return u.style.overflow = "hidden";
498
+ }
499
+ }, {
500
+ immediate: !0
501
+ });
502
+ const i = () => {
503
+ const c = ee(j(e));
504
+ !c || n.value || (oe && (o = Q(
505
+ c,
506
+ "touchmove",
507
+ (s) => {
508
+ bt(s);
509
+ },
510
+ { passive: !1 }
511
+ )), c.style.overflow = "hidden", n.value = !0);
512
+ }, l = () => {
513
+ const c = ee(j(e));
514
+ !c || !n.value || (oe && (o == null || o()), c.style.overflow = r, te.delete(c), n.value = !1);
515
+ };
516
+ return We(l), S({
517
+ get() {
518
+ return n.value;
519
+ },
520
+ set(c) {
521
+ c ? i() : l();
522
+ }
523
+ });
524
+ }
525
+ function Et() {
526
+ let e = !1;
527
+ const t = y(!1);
528
+ return (n, o) => {
529
+ if (t.value = o.value, e)
530
+ return;
531
+ e = !0;
532
+ const r = xt(n, o.value);
533
+ $(t, (i) => r.value = i);
534
+ };
535
+ }
536
+ Et();
365
537
  function we(e) {
366
- return ie() ? (se(e), !0) : !1;
538
+ return le() ? (re(e), !0) : !1;
367
539
  }
368
- function K(e) {
369
- return typeof e == "function" ? e() : m(e);
540
+ function _(e) {
541
+ return typeof e == "function" ? e() : w(e);
370
542
  }
371
- const vt = typeof window < "u" && typeof document < "u";
543
+ const kt = typeof window < "u" && typeof document < "u";
372
544
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
373
- const wt = (e) => e != null, ht = Object.prototype.toString, yt = (e) => ht.call(e) === "[object Object]", bt = () => {
545
+ const Ct = (e) => e != null, At = Object.prototype.toString, It = (e) => At.call(e) === "[object Object]", St = () => {
374
546
  };
375
- function gt(e) {
376
- return re();
547
+ function $t(e) {
548
+ return se();
377
549
  }
378
- function xt(e, t = !0, n) {
379
- gt() ? G(e, n) : t ? e() : Te(e);
550
+ function Ot(e, t = !0, n) {
551
+ $t() ? q(e, n) : t ? e() : Re(e);
380
552
  }
381
- const he = vt ? window : void 0;
382
- function D(e) {
553
+ const he = kt ? window : void 0;
554
+ function L(e) {
383
555
  var t;
384
- const n = K(e);
556
+ const n = _(e);
385
557
  return (t = n == null ? void 0 : n.$el) != null ? t : n;
386
558
  }
387
- function Ae(...e) {
388
- let t, n, o, i;
389
- if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, o, i] = e, t = he) : [t, n, o, i] = e, !t)
390
- return bt;
559
+ function Me(...e) {
560
+ let t, n, o, r;
561
+ if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, o, r] = e, t = he) : [t, n, o, r] = e, !t)
562
+ return St;
391
563
  Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
392
- const s = [], l = () => {
393
- s.forEach((d) => d()), s.length = 0;
394
- }, a = (d, p, c, u) => (d.addEventListener(p, c, u), () => d.removeEventListener(p, c, u)), f = C(
395
- () => [D(t), K(i)],
396
- ([d, p]) => {
564
+ const i = [], l = () => {
565
+ i.forEach((d) => d()), i.length = 0;
566
+ }, c = (d, m, a, f) => (d.addEventListener(m, a, f), () => d.removeEventListener(m, a, f)), s = $(
567
+ () => [L(t), _(r)],
568
+ ([d, m]) => {
397
569
  if (l(), !d)
398
570
  return;
399
- const c = yt(p) ? { ...p } : p;
400
- s.push(
401
- ...n.flatMap((u) => o.map((v) => a(d, u, v, c)))
571
+ const a = It(m) ? { ...m } : m;
572
+ i.push(
573
+ ...n.flatMap((f) => o.map((v) => c(d, f, v, a)))
402
574
  );
403
575
  },
404
576
  { immediate: !0, flush: "post" }
405
- ), r = () => {
406
- f(), l();
577
+ ), u = () => {
578
+ s(), l();
407
579
  };
408
- return we(r), r;
580
+ return we(u), u;
409
581
  }
410
- function Et() {
411
- const e = g(!1), t = re();
412
- return t && G(() => {
582
+ function Tt() {
583
+ const e = y(!1), t = se();
584
+ return t && q(() => {
413
585
  e.value = !0;
414
586
  }, t), e;
415
587
  }
416
- function Le(e) {
417
- const t = Et();
418
- return x(() => (t.value, !!e()));
588
+ function Ve(e) {
589
+ const t = Tt();
590
+ return S(() => (t.value, !!e()));
419
591
  }
420
- function Pe(e, t, n = {}) {
421
- const { window: o = he, ...i } = n;
422
- let s;
423
- const l = Le(() => o && "MutationObserver" in o), a = () => {
424
- s && (s.disconnect(), s = void 0);
425
- }, f = x(() => {
426
- const c = K(e), u = (Array.isArray(c) ? c : [c]).map(D).filter(wt);
427
- return new Set(u);
428
- }), r = C(
429
- () => f.value,
430
- (c) => {
431
- a(), l.value && c.size && (s = new MutationObserver(t), c.forEach((u) => s.observe(u, i)));
592
+ function Be(e, t, n = {}) {
593
+ const { window: o = he, ...r } = n;
594
+ let i;
595
+ const l = Ve(() => o && "MutationObserver" in o), c = () => {
596
+ i && (i.disconnect(), i = void 0);
597
+ }, s = S(() => {
598
+ const a = _(e), f = (Array.isArray(a) ? a : [a]).map(L).filter(Ct);
599
+ return new Set(f);
600
+ }), u = $(
601
+ () => s.value,
602
+ (a) => {
603
+ c(), l.value && a.size && (i = new MutationObserver(t), a.forEach((f) => i.observe(f, r)));
432
604
  },
433
605
  { immediate: !0, flush: "post" }
434
- ), d = () => s == null ? void 0 : s.takeRecords(), p = () => {
435
- r(), a();
606
+ ), d = () => i == null ? void 0 : i.takeRecords(), m = () => {
607
+ u(), c();
436
608
  };
437
- return we(p), {
609
+ return we(m), {
438
610
  isSupported: l,
439
- stop: p,
611
+ stop: m,
440
612
  takeRecords: d
441
613
  };
442
614
  }
443
- function kt(e, t, n = {}) {
444
- const { window: o = he, ...i } = n;
445
- let s;
446
- const l = Le(() => o && "ResizeObserver" in o), a = () => {
447
- s && (s.disconnect(), s = void 0);
448
- }, f = x(() => {
449
- const p = K(e);
450
- return Array.isArray(p) ? p.map((c) => D(c)) : [D(p)];
451
- }), r = C(
452
- f,
453
- (p) => {
454
- if (a(), l.value && o) {
455
- s = new ResizeObserver(t);
456
- for (const c of p)
457
- c && s.observe(c, i);
615
+ function Mt(e, t, n = {}) {
616
+ const { window: o = he, ...r } = n;
617
+ let i;
618
+ const l = Ve(() => o && "ResizeObserver" in o), c = () => {
619
+ i && (i.disconnect(), i = void 0);
620
+ }, s = S(() => {
621
+ const m = _(e);
622
+ return Array.isArray(m) ? m.map((a) => L(a)) : [L(m)];
623
+ }), u = $(
624
+ s,
625
+ (m) => {
626
+ if (c(), l.value && o) {
627
+ i = new ResizeObserver(t);
628
+ for (const a of m)
629
+ a && i.observe(a, r);
458
630
  }
459
631
  },
460
632
  { immediate: !0, flush: "post" }
461
633
  ), d = () => {
462
- a(), r();
634
+ c(), u();
463
635
  };
464
636
  return we(d), {
465
637
  isSupported: l,
466
638
  stop: d
467
639
  };
468
640
  }
469
- function Ct(e, t = {}) {
641
+ function Rt(e, t = {}) {
470
642
  const {
471
643
  reset: n = !0,
472
644
  windowResize: o = !0,
473
- windowScroll: i = !0,
474
- immediate: s = !0,
645
+ windowScroll: r = !0,
646
+ immediate: i = !0,
475
647
  updateTiming: l = "sync"
476
- } = t, a = g(0), f = g(0), r = g(0), d = g(0), p = g(0), c = g(0), u = g(0), v = g(0);
477
- function b() {
478
- const E = D(e);
479
- if (!E) {
480
- n && (a.value = 0, f.value = 0, r.value = 0, d.value = 0, p.value = 0, c.value = 0, u.value = 0, v.value = 0);
648
+ } = t, c = y(0), s = y(0), u = y(0), d = y(0), m = y(0), a = y(0), f = y(0), v = y(0);
649
+ function E() {
650
+ const h = L(e);
651
+ if (!h) {
652
+ n && (c.value = 0, s.value = 0, u.value = 0, d.value = 0, m.value = 0, a.value = 0, f.value = 0, v.value = 0);
481
653
  return;
482
654
  }
483
- const I = E.getBoundingClientRect();
484
- a.value = I.height, f.value = I.bottom, r.value = I.left, d.value = I.right, p.value = I.top, c.value = I.width, u.value = I.x, v.value = I.y;
655
+ const O = h.getBoundingClientRect();
656
+ c.value = O.height, s.value = O.bottom, u.value = O.left, d.value = O.right, m.value = O.top, a.value = O.width, f.value = O.x, v.value = O.y;
485
657
  }
486
- function w() {
487
- l === "sync" ? b() : l === "next-frame" && requestAnimationFrame(() => b());
658
+ function b() {
659
+ l === "sync" ? E() : l === "next-frame" && requestAnimationFrame(() => E());
488
660
  }
489
- return kt(e, w), C(() => D(e), (E) => !E && w()), Pe(e, w, {
661
+ return Mt(e, b), $(() => L(e), (h) => !h && b()), Be(e, b, {
490
662
  attributeFilter: ["style", "class"]
491
- }), i && Ae("scroll", w, { capture: !0, passive: !0 }), o && Ae("resize", w, { passive: !0 }), xt(() => {
492
- s && w();
663
+ }), r && Me("scroll", b, { capture: !0, passive: !0 }), o && Me("resize", b, { passive: !0 }), Ot(() => {
664
+ i && b();
493
665
  }), {
494
- height: a,
495
- bottom: f,
496
- left: r,
666
+ height: c,
667
+ bottom: s,
668
+ left: u,
497
669
  right: d,
498
- top: p,
499
- width: c,
500
- x: u,
670
+ top: m,
671
+ width: a,
672
+ x: f,
501
673
  y: v,
502
- update: w
674
+ update: b
503
675
  };
504
676
  }
505
- const It = (e) => {
677
+ const Lt = (e) => {
506
678
  const t = new DOMParser().parseFromString(e, "text/html");
507
679
  return Array.from(t.body.childNodes).some((n) => n.nodeType === 1);
508
- }, At = ["data-colindex", "data-rowindex", "data-editable", "contenteditable", "tabindex"], St = ["innerHTML"], Ot = { key: 2 }, We = /* @__PURE__ */ M({
680
+ }, Dt = ["data-colindex", "data-rowindex", "data-editable", "contenteditable", "tabindex"], Pt = ["innerHTML"], Wt = { key: 2 }, ze = /* @__PURE__ */ D({
509
681
  __name: "ACell",
510
682
  props: {
511
683
  colIndex: {},
512
684
  rowIndex: {},
513
- tableid: {},
685
+ store: {},
514
686
  addNavigation: { type: [Boolean, Object], default: !0 },
515
687
  tabIndex: { default: 0 },
516
688
  pinned: { type: Boolean }
517
689
  },
518
690
  setup(e) {
519
- const t = Q(e.tableid), n = Z("cell"), { bottom: o, left: i } = Ct(n), s = t.cellData(e.colIndex, e.rowIndex), l = g(""), a = g(!1), f = t.table, r = t.columns[e.colIndex], d = t.rows[e.rowIndex], p = r.align || "center", c = r.width || "40ch", u = x(() => typeof b.value == "string" ? It(b.value) : !1), v = x(() => {
691
+ const t = K("cell"), { bottom: n, left: o } = Rt(t), r = e.store.getCellData(e.colIndex, e.rowIndex), i = e.store.getCellDisplayValue(e.colIndex, e.rowIndex), l = y(""), c = y(!1), s = e.store.columns[e.colIndex], u = e.store.rows[e.rowIndex], d = s.align || "center", m = s.width || "40ch", a = S(() => typeof i == "string" ? Lt(i) : !1), f = S(() => {
520
692
  var h;
521
693
  return {
522
- textAlign: p,
523
- width: c,
524
- backgroundColor: a.value ? "var(--sc-cell-modified)" : "inherit",
525
- fontWeight: a.value ? "bold" : "inherit",
526
- paddingLeft: Ge(e.colIndex, (h = t.display[e.rowIndex]) == null ? void 0 : h.indent)
694
+ textAlign: d,
695
+ width: m,
696
+ backgroundColor: c.value ? "var(--sc-cell-modified)" : "inherit",
697
+ fontWeight: c.value ? "bold" : "inherit",
698
+ paddingLeft: e.store.getIndent(e.colIndex, (h = e.store.display[e.rowIndex]) == null ? void 0 : h.indent)
527
699
  };
528
- }), b = x(() => {
529
- const h = t.cellData(e.colIndex, e.rowIndex);
530
- return w(h);
531
- }), w = (h) => {
532
- const A = r.format;
533
- return A ? typeof A == "function" ? A(h, { table: f, row: d, column: r }) : typeof A == "string" ? Function(`"use strict";return (${A})`)()(h, { table: f, row: d, column: r }) : h : h;
534
- }, E = () => {
535
- r.mask, r.modalComponent && (t.modal.visible = !0, t.modal.colIndex = e.colIndex, t.modal.rowIndex = e.rowIndex, t.modal.parent = n.value, t.modal.top = o.value, t.modal.left = i.value, t.modal.width = c, typeof r.modalComponent == "function" ? t.modal.component = r.modalComponent({ table: f, row: d, column: r }) : t.modal.component = r.modalComponent, t.modal.componentProps = r.modalComponentExtraProps);
700
+ }), v = () => {
701
+ s.mask, s.modalComponent && e.store.$patch((h) => {
702
+ h.modal.visible = !0, h.modal.colIndex = e.colIndex, h.modal.rowIndex = e.rowIndex, h.modal.parent = t.value, h.modal.top = n.value, h.modal.left = o.value, h.modal.width = m, typeof s.modalComponent == "function" ? h.modal.component = s.modalComponent({ table: h.table, row: u, column: s }) : h.modal.component = s.modalComponent, h.modal.componentProps = s.modalComponentExtraProps;
703
+ });
536
704
  };
537
705
  if (e.addNavigation) {
538
706
  let h = {
539
- ...me,
540
- "keydown.f2": E,
541
- "keydown.alt.up": E,
542
- "keydown.alt.down": E,
543
- "keydown.alt.left": E,
544
- "keydown.alt.right": E
707
+ ...ve,
708
+ "keydown.f2": v,
709
+ "keydown.alt.up": v,
710
+ "keydown.alt.down": v,
711
+ "keydown.alt.left": v,
712
+ "keydown.alt.right": v
545
713
  };
546
714
  typeof e.addNavigation == "object" && (h = {
547
715
  ...h,
548
716
  ...e.addNavigation
549
- }), ve([
717
+ }), pe([
550
718
  {
551
- selectors: n,
719
+ selectors: t,
552
720
  handlers: h
553
721
  }
554
722
  ]);
555
723
  }
556
- const I = () => {
557
- n.value && (l.value = n.value.textContent);
558
- }, _ = () => {
559
- n.value && (r.format ? a.value = n.value.textContent !== w(s) : a.value = n.value.textContent !== s, n.value.textContent !== l.value && (l.value = n.value.textContent, n.value.dispatchEvent(new Event("change")), r.format || t.setCellData(e.rowIndex, e.colIndex, l.value)));
560
- }, Ge = (h, A) => A && h === 0 && A > 0 ? `${A}ch` : "inherit";
561
- return (h, A) => (y(), k("td", {
724
+ const E = () => {
725
+ t.value && (l.value = t.value.textContent);
726
+ }, b = () => {
727
+ t.value && (s.format ? c.value = t.value.textContent !== e.store.getFormattedValue(e.colIndex, e.rowIndex, r) : c.value = t.value.textContent !== r, t.value.textContent !== l.value && (l.value = t.value.textContent, t.value.dispatchEvent(new Event("change")), s.format || e.store.setCellData(e.colIndex, e.rowIndex, l.value)));
728
+ };
729
+ return (h, O) => ae((x(), k("td", {
562
730
  ref: "cell",
563
731
  "data-colindex": h.colIndex,
564
732
  "data-rowindex": h.rowIndex,
565
- "data-editable": m(r).edit,
566
- contenteditable: m(r).edit,
733
+ "data-editable": w(s).edit,
734
+ contenteditable: w(s).edit,
567
735
  tabindex: h.tabIndex,
568
736
  spellcheck: !1,
569
- style: P(v.value),
570
- onFocus: I,
571
- onPaste: _,
572
- onBlur: _,
573
- onInput: _,
574
- onClick: E,
575
- onMousedown: E,
576
- class: N(["atable-cell", h.pinned ? "sticky-column" : ""])
737
+ style: H(f.value),
738
+ onFocus: E,
739
+ onPaste: b,
740
+ onBlur: b,
741
+ onInput: b,
742
+ onClick: v,
743
+ class: B(["atable-cell", h.pinned ? "sticky-column" : ""])
577
744
  }, [
578
- m(r).cellComponent ? (y(), Y(De(m(r).cellComponent), ae({
745
+ w(s).cellComponent ? (x(), J(Le(w(s).cellComponent), ie({
579
746
  key: 0,
580
- value: b.value
581
- }, m(r).cellComponentProps), null, 16, ["value"])) : u.value ? (y(), k("span", {
747
+ value: w(i)
748
+ }, w(s).cellComponentProps), null, 16, ["value"])) : a.value ? (x(), k("span", {
582
749
  key: 1,
583
- innerHTML: b.value
584
- }, null, 8, St)) : (y(), k("span", Ot, B(b.value), 1))
585
- ], 46, At));
750
+ innerHTML: w(i)
751
+ }, null, 8, Pt)) : (x(), k("span", Wt, z(w(i)), 1))
752
+ ], 46, Dt)), [
753
+ [w(yt), h.store.closeModal]
754
+ ]);
586
755
  }
587
- }), $t = ["tabindex"], Tt = ["tabindex"], Dt = ["colspan"], Mt = /* @__PURE__ */ M({
756
+ }), Ht = ["tabindex"], Nt = ["tabindex"], jt = ["colspan"], Vt = /* @__PURE__ */ D({
588
757
  __name: "AExpansionRow",
589
758
  props: {
590
759
  rowIndex: {},
591
- tableid: {},
760
+ store: {},
592
761
  tabIndex: { default: () => -1 },
593
762
  addNavigation: { type: [Boolean, Object] }
594
763
  },
595
764
  setup(e) {
596
- const t = Q(e.tableid), n = Z("rowEl"), o = x(() => t.display[e.rowIndex].expanded ? "▼" : "►");
765
+ const t = K("rowEl"), n = S(() => e.store.display[e.rowIndex].expanded ? "▼" : "►");
597
766
  if (e.addNavigation) {
598
- const i = {
599
- "keydown.control.g": (s) => {
600
- s.stopPropagation(), s.preventDefault(), t.toggleRowExpand(e.rowIndex);
767
+ const o = {
768
+ "keydown.control.g": (r) => {
769
+ r.stopPropagation(), r.preventDefault(), e.store.toggleRowExpand(e.rowIndex);
601
770
  }
602
771
  };
603
- typeof e.addNavigation == "object" && Object.assign(i, e.addNavigation), ve([
772
+ typeof e.addNavigation == "object" && Object.assign(o, e.addNavigation), pe([
604
773
  {
605
- selectors: n,
606
- handlers: i
774
+ selectors: t,
775
+ handlers: o
607
776
  }
608
777
  ]);
609
778
  }
610
- return (i, s) => (y(), k(J, null, [
611
- W("tr", ae(i.$attrs, {
779
+ return (o, r) => (x(), k(Z, null, [
780
+ N("tr", ie(o.$attrs, {
612
781
  ref: "rowEl",
613
- tabindex: i.tabIndex,
782
+ tabindex: o.tabIndex,
614
783
  class: "expandable-row"
615
784
  }), [
616
- W("td", {
785
+ N("td", {
617
786
  tabIndex: -1,
618
- onClick: s[0] || (s[0] = (l) => m(t).toggleRowExpand(i.rowIndex)),
787
+ onClick: r[0] || (r[0] = (i) => o.store.toggleRowExpand(o.rowIndex)),
619
788
  class: "row-index"
620
- }, B(o.value), 1),
621
- S(i.$slots, "row")
622
- ], 16, $t),
623
- m(t).display[i.rowIndex].expanded ? (y(), k("tr", {
789
+ }, z(n.value), 1),
790
+ T(o.$slots, "row")
791
+ ], 16, Ht),
792
+ o.store.display[o.rowIndex].expanded ? (x(), k("tr", {
624
793
  key: 0,
625
794
  ref: "rowExpanded",
626
- tabindex: i.tabIndex,
795
+ tabindex: o.tabIndex,
627
796
  class: "expanded-row"
628
797
  }, [
629
- W("td", {
798
+ N("td", {
630
799
  tabIndex: -1,
631
- colspan: m(t).columns.length + 1,
800
+ colspan: o.store.columns.length + 1,
632
801
  class: "expanded-row-content"
633
802
  }, [
634
- S(i.$slots, "content")
635
- ], 8, Dt)
636
- ], 8, Tt)) : V("", !0)
803
+ T(o.$slots, "content")
804
+ ], 8, jt)
805
+ ], 8, Nt)) : F("", !0)
637
806
  ], 64));
638
807
  }
639
- }), Rt = ["tabindex"], He = /* @__PURE__ */ M({
808
+ }), Bt = ["tabindex"], Fe = /* @__PURE__ */ D({
640
809
  __name: "ARow",
641
810
  props: {
642
811
  rowIndex: {},
643
- tableid: {},
812
+ store: {},
644
813
  tabIndex: { default: () => -1 },
645
814
  addNavigation: { type: [Boolean, Object], default: !1 }
646
815
  },
647
816
  setup(e) {
648
- const t = Q(e.tableid), n = Z("rowEl"), o = x(() => t.columns.some((a) => a.pinned)), i = x(() => t.config.view !== "tree" || t.display[e.rowIndex].isRoot || t.display[e.rowIndex].open), s = x(() => t.config.view !== "tree" ? "" : t.display[e.rowIndex].isRoot || t.display[e.rowIndex].isParent ? t.display[e.rowIndex].childrenOpen ? "-" : "+" : ""), l = (a) => {
649
- t.toggleRowExpand(a);
650
- };
817
+ const t = K("rowEl"), n = e.store.isRowVisible(e.rowIndex), o = e.store.getRowExpandSymbol(e.rowIndex);
651
818
  if (e.addNavigation) {
652
- let a = me;
653
- typeof e.addNavigation == "object" && (a = {
654
- ...a,
819
+ let r = ve;
820
+ typeof e.addNavigation == "object" && (r = {
821
+ ...r,
655
822
  ...e.addNavigation
656
- }), ve([
823
+ }), pe([
657
824
  {
658
- selectors: n,
659
- handlers: a
825
+ selectors: t,
826
+ handlers: r
660
827
  }
661
828
  ]);
662
829
  }
663
- return (a, f) => ne((y(), k("tr", {
830
+ return (r, i) => ae((x(), k("tr", {
664
831
  ref: "rowEl",
665
- tabindex: a.tabIndex,
832
+ tabindex: r.tabIndex,
666
833
  class: "table-row"
667
834
  }, [
668
- m(t).config.view !== "uncounted" ? S(a.$slots, "index", { key: 0 }, () => [
669
- m(t).config.view === "list" ? (y(), k("td", {
835
+ r.store.config.view !== "uncounted" ? T(r.$slots, "index", { key: 0 }, () => [
836
+ r.store.config.view === "list" ? (x(), k("td", {
670
837
  key: 0,
671
838
  tabIndex: -1,
672
- class: N(["list-index", o.value ? "sticky-index" : ""])
673
- }, B(a.rowIndex + 1), 3)) : m(t).config.view === "tree" ? (y(), k("td", {
839
+ class: B(["list-index", r.store.hasPinnedColumns ? "sticky-index" : ""])
840
+ }, z(r.rowIndex + 1), 3)) : r.store.config.view === "tree" ? (x(), k("td", {
674
841
  key: 1,
675
842
  tabIndex: -1,
676
- class: N(["tree-index", o.value ? "sticky-index" : ""]),
677
- onClick: f[0] || (f[0] = (r) => l(a.rowIndex))
678
- }, B(s.value), 3)) : V("", !0)
679
- ]) : V("", !0),
680
- S(a.$slots, "default")
681
- ], 8, Rt)), [
682
- [Me, i.value]
843
+ class: B(["tree-index", r.store.hasPinnedColumns ? "sticky-index" : ""]),
844
+ onClick: i[0] || (i[0] = (l) => r.store.toggleRowExpand(r.rowIndex))
845
+ }, z(w(o)), 3)) : F("", !0)
846
+ ]) : F("", !0),
847
+ T(r.$slots, "default")
848
+ ], 8, Bt)), [
849
+ [De, w(n)]
683
850
  ]);
684
851
  }
685
- });
686
- function je(e) {
687
- return ie() ? (se(e), !0) : !1;
688
- }
689
- function H(e) {
690
- return typeof e == "function" ? e() : m(e);
691
- }
692
- const Ne = typeof window < "u" && typeof document < "u";
693
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
694
- const Lt = Object.prototype.toString, Pt = (e) => Lt.call(e) === "[object Object]", j = () => {
695
- }, le = /* @__PURE__ */ Wt();
696
- function Wt() {
697
- var e, t;
698
- return Ne && ((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));
699
- }
700
- const Se = {
701
- mounted: "mounted",
702
- updated: "updated",
703
- unmounted: "unmounted"
704
- };
705
- function Ht(...e) {
706
- if (e.length !== 1)
707
- return Xe(...e);
708
- const t = e[0];
709
- return typeof t == "function" ? Je(Qe(() => ({ get: t, set: j }))) : g(t);
710
- }
711
- function L(e) {
712
- var t;
713
- const n = H(e);
714
- return (t = n == null ? void 0 : n.$el) != null ? t : n;
715
- }
716
- const Be = Ne ? window : void 0;
717
- function X(...e) {
718
- let t, n, o, i;
719
- if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, o, i] = e, t = Be) : [t, n, o, i] = e, !t)
720
- return j;
721
- Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
722
- const s = [], l = () => {
723
- s.forEach((d) => d()), s.length = 0;
724
- }, a = (d, p, c, u) => (d.addEventListener(p, c, u), () => d.removeEventListener(p, c, u)), f = C(
725
- () => [L(t), H(i)],
726
- ([d, p]) => {
727
- if (l(), !d)
728
- return;
729
- const c = Pt(p) ? { ...p } : p;
730
- s.push(
731
- ...n.flatMap((u) => o.map((v) => a(d, u, v, c)))
732
- );
733
- },
734
- { immediate: !0, flush: "post" }
735
- ), r = () => {
736
- f(), l();
737
- };
738
- return je(r), r;
739
- }
740
- let Oe = !1;
741
- function $e(e, t, n = {}) {
742
- const { window: o = Be, ignore: i = [], capture: s = !0, detectIframe: l = !1 } = n;
743
- if (!o)
744
- return j;
745
- le && !Oe && (Oe = !0, Array.from(o.document.body.children).forEach((c) => c.addEventListener("click", j)), o.document.documentElement.addEventListener("click", j));
746
- let a = !0;
747
- const f = (c) => i.some((u) => {
748
- if (typeof u == "string")
749
- return Array.from(o.document.querySelectorAll(u)).some((v) => v === c.target || c.composedPath().includes(v));
750
- {
751
- const v = L(u);
752
- return v && (c.target === v || c.composedPath().includes(v));
753
- }
754
- }), d = [
755
- X(o, "click", (c) => {
756
- const u = L(e);
757
- if (!(!u || u === c.target || c.composedPath().includes(u))) {
758
- if (c.detail === 0 && (a = !f(c)), !a) {
759
- a = !0;
760
- return;
761
- }
762
- t(c);
763
- }
764
- }, { passive: !0, capture: s }),
765
- X(o, "pointerdown", (c) => {
766
- const u = L(e);
767
- a = !f(c) && !!(u && !c.composedPath().includes(u));
768
- }, { passive: !0 }),
769
- l && X(o, "blur", (c) => {
770
- setTimeout(() => {
771
- var u;
772
- const v = L(e);
773
- ((u = o.document.activeElement) == null ? void 0 : u.tagName) === "IFRAME" && !(v != null && v.contains(o.document.activeElement)) && t(c);
774
- }, 0);
775
- })
776
- ].filter(Boolean);
777
- return () => d.forEach((c) => c());
778
- }
779
- const jt = {
780
- [Se.mounted](e, t) {
781
- const n = !t.modifiers.bubble;
782
- if (typeof t.value == "function")
783
- e.__onClickOutside_stop = $e(e, t.value, { capture: n });
784
- else {
785
- const [o, i] = t.value;
786
- e.__onClickOutside_stop = $e(e, o, Object.assign({ capture: n }, i));
787
- }
788
- },
789
- [Se.unmounted](e) {
790
- e.__onClickOutside_stop();
791
- }
792
- };
793
- function ee(e) {
794
- return typeof Window < "u" && e instanceof Window ? e.document.documentElement : typeof Document < "u" && e instanceof Document ? e.documentElement : e;
795
- }
796
- function Ve(e) {
797
- const t = window.getComputedStyle(e);
798
- if (t.overflowX === "scroll" || t.overflowY === "scroll" || t.overflowX === "auto" && e.clientWidth < e.scrollWidth || t.overflowY === "auto" && e.clientHeight < e.scrollHeight)
799
- return !0;
800
- {
801
- const n = e.parentNode;
802
- return !n || n.tagName === "BODY" ? !1 : Ve(n);
803
- }
804
- }
805
- function Nt(e) {
806
- const t = e || window.event, n = t.target;
807
- return Ve(n) ? !1 : t.touches.length > 1 ? !0 : (t.preventDefault && t.preventDefault(), !1);
808
- }
809
- const te = /* @__PURE__ */ new WeakMap();
810
- function Bt(e, t = !1) {
811
- const n = g(t);
812
- let o = null, i = "";
813
- C(Ht(e), (a) => {
814
- const f = ee(H(a));
815
- if (f) {
816
- const r = f;
817
- if (te.get(r) || te.set(r, r.style.overflow), r.style.overflow !== "hidden" && (i = r.style.overflow), r.style.overflow === "hidden")
818
- return n.value = !0;
819
- if (n.value)
820
- return r.style.overflow = "hidden";
821
- }
822
- }, {
823
- immediate: !0
824
- });
825
- const s = () => {
826
- const a = ee(H(e));
827
- !a || n.value || (le && (o = X(
828
- a,
829
- "touchmove",
830
- (f) => {
831
- Nt(f);
832
- },
833
- { passive: !1 }
834
- )), a.style.overflow = "hidden", n.value = !0);
835
- }, l = () => {
836
- const a = ee(H(e));
837
- !a || !n.value || (le && (o == null || o()), a.style.overflow = i, te.delete(a), n.value = !1);
838
- };
839
- return je(l), x({
840
- get() {
841
- return n.value;
842
- },
843
- set(a) {
844
- a ? s() : l();
845
- }
846
- });
847
- }
848
- function Vt() {
849
- let e = !1;
850
- const t = g(!1);
851
- return (n, o) => {
852
- if (t.value = o.value, e)
853
- return;
854
- e = !0;
855
- const i = Bt(n, o.value);
856
- C(t, (s) => i.value = s);
857
- };
858
- }
859
- Vt();
860
- class zt {
861
- constructor(t, n, o, i, s, l) {
862
- T(this, "id");
863
- T(this, "rows");
864
- T(this, "columns");
865
- T(this, "config");
866
- T(this, "table");
867
- T(this, "display");
868
- T(this, "modal");
869
- this.id = t || crypto.randomUUID(), this.rows = o, this.columns = R(n), this.config = R(i), this.table = s || R(this.createTableObject()), this.display = this.createDisplayObject(l), this.modal = R({ visible: !1 });
870
- }
871
- createTableObject() {
872
- const t = {};
873
- for (const [n, o] of this.columns.entries())
874
- for (const [i, s] of this.rows.entries())
875
- t[`${n}:${i}`] = s[o.name];
876
- return t;
877
- }
878
- createDisplayObject(t) {
879
- const n = [Object.assign({}, { rowModified: !1 })];
880
- if (t && "0:0" in t)
881
- return t;
882
- const o = /* @__PURE__ */ new Set();
883
- for (let i = this.rows.length - 1; i >= 0; i--) {
884
- const s = this.rows[i];
885
- s.parent && o.add(s.parent), n[i] = {
886
- childrenOpen: !1,
887
- expanded: !1,
888
- indent: s.indent || null,
889
- isParent: o.has(i),
890
- isRoot: s.parent === null || s.parent === void 0,
891
- rowModified: !1,
892
- open: s.parent === null || s.parent === void 0,
893
- parent: s.parent
894
- };
895
- }
896
- return R(n);
897
- }
898
- get zeroColumn() {
899
- return ["list", "tree", "list-expansion"].includes(this.config.view);
900
- }
901
- get numberedRowWidth() {
902
- return x(() => String(Math.ceil(this.rows.length / 100) + 1) + "ch");
903
- }
904
- cellData(t, n) {
905
- return this.table[`${t}:${n}`];
906
- }
907
- setCellData(t, n, o) {
908
- const i = `${n}:${t}`, s = this.columns[n];
909
- return this.table[i] !== o && (this.display[t].rowModified = !0), this.table[i] = o, this.rows[t][s.name] = o, this.table[i];
910
- }
911
- toggleRowExpand(t) {
912
- if (this.config.view === "tree") {
913
- this.display[t].childrenOpen = !this.display[t].childrenOpen;
914
- for (let n = this.rows.length - 1; n >= 0; n--)
915
- this.display[n].parent === t && (this.display[n].open = !this.display[n].open, this.display[n].childrenOpen && this.toggleRowExpand(n));
916
- } else this.config.view === "list-expansion" && (this.display[t].expanded = !this.display[t].expanded);
917
- }
918
- }
919
- const Ft = {
852
+ }), zt = {
920
853
  key: 0,
921
854
  id: "resizable"
922
- }, Gt = {
855
+ }, Ft = {
923
856
  class: "atable-header-row",
924
857
  tabindex: "-1"
925
- }, ze = /* @__PURE__ */ M({
858
+ }, Ue = /* @__PURE__ */ D({
926
859
  __name: "ATableHeader",
927
860
  props: {
928
861
  columns: {},
929
- tableid: {}
862
+ store: {}
930
863
  },
931
864
  setup(e) {
932
- const t = Q(e.tableid), n = x(() => t.columns.some((i) => i.pinned)), o = (i) => ({
933
- minWidth: i.width || "40ch",
934
- textAlign: i.align || "center",
935
- width: t.config.fullWidth ? "auto" : null
936
- });
937
- return (i, s) => i.columns.length ? (y(), k("thead", Ft, [
938
- W("tr", Gt, [
939
- m(t).zeroColumn ? (y(), k("th", {
865
+ return (t, n) => t.columns.length ? (x(), k("thead", zt, [
866
+ N("tr", Ft, [
867
+ t.store.zeroColumn ? (x(), k("th", {
940
868
  key: 0,
941
869
  id: "header-index",
942
- class: N([[
943
- n.value ? "sticky-index" : "",
944
- m(t).config.view === "tree" ? "tree-index" : "",
945
- m(t).config.view === "list-expansion" ? "list-expansion-index" : ""
870
+ class: B([[
871
+ t.store.hasPinnedColumns ? "sticky-index" : "",
872
+ t.store.config.view === "tree" ? "tree-index" : "",
873
+ t.store.config.view === "list-expansion" ? "list-expansion-index" : ""
946
874
  ], "list-index"])
947
- }, null, 2)) : V("", !0),
948
- (y(!0), k(J, null, oe(i.columns, (l, a) => (y(), k("th", {
949
- key: l.name,
875
+ }, null, 2)) : F("", !0),
876
+ (x(!0), k(Z, null, ne(t.columns, (o, r) => (x(), k("th", {
877
+ key: o.name,
950
878
  tabindex: "-1",
951
- style: P(o(l)),
952
- class: N(l.pinned ? "sticky-column" : "")
879
+ style: H(t.store.getHeaderCellStyle(o)),
880
+ class: B(o.pinned ? "sticky-column" : "")
953
881
  }, [
954
- S(i.$slots, "default", {}, () => [
955
- Ze(B(l.label || String.fromCharCode(a + 97).toUpperCase()), 1)
882
+ T(t.$slots, "default", {}, () => [
883
+ Ze(z(o.label || String.fromCharCode(r + 97).toUpperCase()), 1)
956
884
  ])
957
885
  ], 6))), 128))
958
886
  ])
959
- ])) : V("", !0);
887
+ ])) : F("", !0);
960
888
  }
961
- }), Fe = /* @__PURE__ */ M({
889
+ }), Ge = /* @__PURE__ */ D({
962
890
  __name: "ATableModal",
963
891
  props: {
964
892
  colIndex: {},
965
893
  rowIndex: {},
966
- tableid: {}
894
+ store: {}
967
895
  },
968
896
  setup(e) {
969
897
  const t = (n) => {
970
898
  n.stopPropagation();
971
899
  };
972
- return (n, o) => (y(), k("div", {
900
+ return (n, o) => (x(), k("div", {
973
901
  class: "amodal",
974
902
  tabindex: "-1",
975
903
  onClick: t,
976
904
  onInput: t
977
905
  }, [
978
- S(n.$slots, "default")
906
+ T(n.$slots, "default")
979
907
  ], 32));
980
908
  }
981
- }), Ut = /* @__PURE__ */ M({
909
+ }), Ut = (e) => {
910
+ const t = e.id || crypto.randomUUID();
911
+ return Ke(`table-${t}`, () => {
912
+ const o = () => {
913
+ const p = {};
914
+ for (const [g, C] of i.value.entries())
915
+ for (const [I, A] of l.value.entries())
916
+ p[`${g}:${I}`] = A[C.name];
917
+ return p;
918
+ }, r = (p) => {
919
+ const g = [Object.assign({}, { rowModified: !1 })];
920
+ if (p && "0:0" in p)
921
+ return p;
922
+ const C = /* @__PURE__ */ new Set();
923
+ for (let I = l.value.length - 1; I >= 0; I--) {
924
+ const A = l.value[I];
925
+ A.parent && C.add(A.parent), g[I] = {
926
+ childrenOpen: !1,
927
+ expanded: !1,
928
+ indent: A.indent || null,
929
+ isParent: C.has(I),
930
+ isRoot: A.parent === null || A.parent === void 0,
931
+ rowModified: !1,
932
+ open: A.parent === null || A.parent === void 0,
933
+ parent: A.parent
934
+ };
935
+ }
936
+ return g;
937
+ }, i = y(e.columns), l = y(e.rows), c = y(e.config || {}), s = y(e.table || o()), u = y(r(e.display)), d = y(e.modal || { visible: !1 }), m = S(() => i.value.some((p) => p.pinned)), a = S(() => `${Math.ceil(l.value.length / 100 + 1)}ch`), f = S(() => ["list", "tree", "list-expansion"].includes(c.value.view)), v = (p, g) => s.value[`${p}:${g}`], E = (p, g, C) => {
938
+ const I = `${p}:${g}`, A = i.value[p];
939
+ s.value[I] !== C && (u.value[g].rowModified = !0), s.value[I] = C, l.value[g][A.name] = C;
940
+ }, b = (p) => ({
941
+ minWidth: p.width || "40ch",
942
+ textAlign: p.align || "center",
943
+ width: c.value.fullWidth ? "auto" : null
944
+ }), h = (p) => c.value.view !== "tree" || u.value[p].isRoot || u.value[p].open, O = (p) => c.value.view !== "tree" ? "" : u.value[p].isRoot || u.value[p].isParent ? u.value[p].childrenOpen ? "-" : "+" : "", ge = (p) => {
945
+ if (c.value.view === "tree") {
946
+ u.value[p].childrenOpen = !u.value[p].childrenOpen;
947
+ for (let g = l.value.length - 1; g >= 0; g--)
948
+ u.value[g].parent === p && (u.value[g].open = !u.value[g].open, u.value[g].childrenOpen && ge(g));
949
+ } else c.value.view === "list-expansion" && (u.value[p].expanded = !u.value[p].expanded);
950
+ }, qe = (p, g) => {
951
+ const C = v(p, g);
952
+ return ye(p, g, C);
953
+ }, ye = (p, g, C) => {
954
+ const I = i.value[p], A = l.value[g], P = I.format;
955
+ return P ? typeof P == "function" ? P(C, { table: s.value, row: A, column: I }) : typeof P == "string" ? Function(`"use strict";return (${P})`)()(C, { table: s.value, row: A, column: I }) : C : C;
956
+ };
957
+ return {
958
+ // state
959
+ columns: i,
960
+ rows: l,
961
+ config: c,
962
+ table: s,
963
+ display: u,
964
+ modal: d,
965
+ // getters
966
+ hasPinnedColumns: m,
967
+ numberedRowWidth: a,
968
+ zeroColumn: f,
969
+ // actions
970
+ closeModal: (p) => {
971
+ var g;
972
+ p.target instanceof Node && (g = d.value.parent) != null && g.contains(p.target) || d.value.visible && (d.value.visible = !1);
973
+ },
974
+ getCellData: v,
975
+ getCellDisplayValue: qe,
976
+ getFormattedValue: ye,
977
+ getHeaderCellStyle: b,
978
+ getIndent: (p, g) => g && p === 0 && g > 0 ? `${g}ch` : "inherit",
979
+ getRowExpandSymbol: O,
980
+ isRowVisible: h,
981
+ setCellData: E,
982
+ toggleRowExpand: ge
983
+ };
984
+ })();
985
+ }, Gt = /* @__PURE__ */ D({
982
986
  __name: "ATable",
983
987
  props: {
984
988
  id: {},
@@ -987,129 +991,129 @@ const Ft = {
987
991
  rows: { default: () => [] },
988
992
  config: { default: () => new Object() }
989
993
  },
990
- emits: ["update:modelValue"],
994
+ emits: ["update:modelValue", "cellUpdate"],
991
995
  setup(e, { expose: t, emit: n }) {
992
- const o = n, i = Z("table"), s = e.modelValue ? e.modelValue : e.rows, l = new zt(e.id, e.columns, s, e.config);
993
- Ke(l.id, l), C(
996
+ const o = n, r = K("table"), i = e.modelValue ? e.modelValue : e.rows, l = Ut({ columns: e.columns, rows: i, id: e.id, config: e.config });
997
+ l.$onAction(({ name: s, store: u, args: d }) => {
998
+ if (s === "setCellData") {
999
+ const [m, a, f] = d, v = u.getCellData(m, a);
1000
+ o("cellUpdate", [m, a, f, v]);
1001
+ }
1002
+ }), $(
994
1003
  () => l.rows,
995
- (r) => {
996
- o("update:modelValue", r);
1004
+ (s) => {
1005
+ o("update:modelValue", s);
997
1006
  },
998
1007
  { deep: !0 }
999
- ), G(() => {
1000
- e.columns.some((r) => r.pinned) && (a(), l.config.view === "tree" && Pe(i, a, { childList: !0, subtree: !0 }));
1008
+ ), q(() => {
1009
+ e.columns.some((s) => s.pinned) && (c(), l.config.view === "tree" && Be(r, c, { childList: !0, subtree: !0 }));
1001
1010
  });
1002
- const a = () => {
1003
- const r = i.value, d = r.rows[0], p = r.rows[1], c = d ? Array.from(d.cells) : [];
1004
- for (const [u, v] of c.entries()) {
1005
- const b = p.cells[u];
1006
- b && (v.style.width = `${b.offsetWidth}px`);
1011
+ const c = () => {
1012
+ const s = r.value, u = s.rows[0], d = s.rows[1], m = u ? Array.from(u.cells) : [];
1013
+ for (const [a, f] of m.entries()) {
1014
+ const v = d.cells[a];
1015
+ v && (f.style.width = `${v.offsetWidth}px`);
1007
1016
  }
1008
- for (const u of r.rows) {
1009
- let v = 0;
1010
- const b = [];
1011
- for (const w of u.cells)
1012
- (w.classList.contains("sticky-column") || w.classList.contains("sticky-index")) && (w.style.left = `${v}px`, v += w.offsetWidth, b.push(w));
1013
- b.length > 0 && b[b.length - 1].classList.add("sticky-column-edge");
1017
+ for (const a of s.rows) {
1018
+ let f = 0;
1019
+ const v = [];
1020
+ for (const E of a.cells)
1021
+ (E.classList.contains("sticky-column") || E.classList.contains("sticky-index")) && (E.style.left = `${f}px`, f += E.offsetWidth, v.push(E));
1022
+ v.length > 0 && v[v.length - 1].classList.add("sticky-column-edge");
1014
1023
  }
1015
- }, f = (r) => {
1016
- var d;
1017
- r.target instanceof Node && (d = l.modal.parent) != null && d.contains(r.target) || l.modal.visible && (l.modal.visible = !1);
1018
1024
  };
1019
- return window.addEventListener("keydown", (r) => {
1020
- if (r.key === "Escape" && l.modal.visible) {
1025
+ return window.addEventListener("keydown", (s) => {
1026
+ if (s.key === "Escape" && l.modal.visible) {
1021
1027
  l.modal.visible = !1;
1022
- const d = l.modal.parent;
1023
- d && Te().then(() => {
1024
- d.focus();
1028
+ const u = l.modal.parent;
1029
+ u && Re().then(() => {
1030
+ u.focus();
1025
1031
  });
1026
1032
  }
1027
- }), t({ tableData: l }), (r, d) => ne((y(), k("table", {
1033
+ }), t({ store: l }), (s, u) => (x(), k("table", {
1028
1034
  ref: "table",
1029
1035
  class: "atable",
1030
- style: P({ width: m(l).config.fullWidth ? "100%" : "auto" })
1036
+ style: H({ width: w(l).config.fullWidth ? "100%" : "auto" })
1031
1037
  }, [
1032
- S(r.$slots, "header", { data: m(l) }, () => [
1033
- ye(ze, {
1034
- columns: m(l).columns,
1035
- tableid: m(l).id
1036
- }, null, 8, ["columns", "tableid"])
1038
+ T(s.$slots, "header", { data: w(l) }, () => [
1039
+ be(Ue, {
1040
+ columns: w(l).columns,
1041
+ store: w(l)
1042
+ }, null, 8, ["columns", "store"])
1037
1043
  ], !0),
1038
- W("tbody", null, [
1039
- S(r.$slots, "body", { data: m(l) }, () => [
1040
- (y(!0), k(J, null, oe(m(l).rows, (p, c) => (y(), Y(He, {
1041
- key: p.id,
1042
- row: p,
1043
- rowIndex: c,
1044
- tableid: m(l).id
1044
+ N("tbody", null, [
1045
+ T(s.$slots, "body", { data: w(l) }, () => [
1046
+ (x(!0), k(Z, null, ne(w(l).rows, (d, m) => (x(), J(Fe, {
1047
+ key: d.id,
1048
+ row: d,
1049
+ rowIndex: m,
1050
+ store: w(l)
1045
1051
  }, {
1046
- default: be(() => [
1047
- (y(!0), k(J, null, oe(m(l).columns, (u, v) => (y(), Y(We, {
1048
- key: u.name,
1049
- tableid: m(l).id,
1050
- col: u,
1052
+ default: xe(() => [
1053
+ (x(!0), k(Z, null, ne(w(l).columns, (a, f) => (x(), J(ze, {
1054
+ key: a.name,
1055
+ store: w(l),
1056
+ col: a,
1051
1057
  spellcheck: "false",
1052
- pinned: u.pinned,
1053
- rowIndex: c,
1054
- colIndex: v,
1055
- component: u.cellComponent,
1056
- style: P({
1057
- textAlign: (u == null ? void 0 : u.align) || "center",
1058
- minWidth: (u == null ? void 0 : u.width) || "40ch",
1059
- width: m(l).config.fullWidth ? "auto" : null
1058
+ pinned: a.pinned,
1059
+ rowIndex: m,
1060
+ colIndex: f,
1061
+ component: a.cellComponent,
1062
+ style: H({
1063
+ textAlign: (a == null ? void 0 : a.align) || "center",
1064
+ minWidth: (a == null ? void 0 : a.width) || "40ch",
1065
+ width: w(l).config.fullWidth ? "auto" : null
1060
1066
  })
1061
- }, null, 8, ["tableid", "col", "pinned", "rowIndex", "colIndex", "component", "style"]))), 128))
1067
+ }, null, 8, ["store", "col", "pinned", "rowIndex", "colIndex", "component", "style"]))), 128))
1062
1068
  ]),
1063
1069
  _: 2
1064
- }, 1032, ["row", "rowIndex", "tableid"]))), 128))
1070
+ }, 1032, ["row", "rowIndex", "store"]))), 128))
1065
1071
  ], !0)
1066
1072
  ]),
1067
- S(r.$slots, "footer", { data: m(l) }, void 0, !0),
1068
- S(r.$slots, "modal", { data: m(l) }, () => [
1069
- ne(ye(Fe, {
1070
- colIndex: m(l).modal.colIndex,
1071
- rowIndex: m(l).modal.rowIndex,
1072
- tableid: m(l).id,
1073
- style: P({
1074
- left: m(l).modal.left + "px",
1075
- top: m(l).modal.top + "px",
1076
- maxWidth: m(l).modal.width + "px"
1073
+ T(s.$slots, "footer", { data: w(l) }, void 0, !0),
1074
+ T(s.$slots, "modal", { data: w(l) }, () => [
1075
+ ae(be(Ge, {
1076
+ colIndex: w(l).modal.colIndex,
1077
+ rowIndex: w(l).modal.rowIndex,
1078
+ store: w(l),
1079
+ style: H({
1080
+ left: w(l).modal.left + "px",
1081
+ top: w(l).modal.top + "px",
1082
+ maxWidth: w(l).modal.width + "px"
1077
1083
  })
1078
1084
  }, {
1079
- default: be(() => [
1080
- (y(), Y(De(m(l).modal.component), ae({
1081
- key: `${m(l).modal.rowIndex}:${m(l).modal.colIndex}`,
1082
- colIndex: m(l).modal.colIndex,
1083
- rowIndex: m(l).modal.rowIndex,
1084
- tableid: m(l).id
1085
- }, m(l).modal.componentProps), null, 16, ["colIndex", "rowIndex", "tableid"]))
1085
+ default: xe(() => [
1086
+ (x(), J(Le(w(l).modal.component), ie({
1087
+ key: `${w(l).modal.rowIndex}:${w(l).modal.colIndex}`,
1088
+ colIndex: w(l).modal.colIndex,
1089
+ rowIndex: w(l).modal.rowIndex,
1090
+ store: w(l)
1091
+ }, w(l).modal.componentProps), null, 16, ["colIndex", "rowIndex", "store"]))
1086
1092
  ]),
1087
1093
  _: 1
1088
- }, 8, ["colIndex", "rowIndex", "tableid", "style"]), [
1089
- [Me, m(l).modal.visible]
1094
+ }, 8, ["colIndex", "rowIndex", "store", "style"]), [
1095
+ [De, w(l).modal.visible]
1090
1096
  ])
1091
1097
  ], !0)
1092
- ], 4)), [
1093
- [m(jt), f]
1094
- ]);
1098
+ ], 4));
1095
1099
  }
1096
1100
  }), qt = (e, t) => {
1097
1101
  const n = e.__vccOpts || e;
1098
- for (const [o, i] of t)
1099
- n[o] = i;
1102
+ for (const [o, r] of t)
1103
+ n[o] = r;
1100
1104
  return n;
1101
- }, Yt = /* @__PURE__ */ qt(Ut, [["__scopeId", "data-v-183c4dd3"]]);
1102
- function Zt(e) {
1103
- e.component("ACell", We), e.component("AExpansionRow", Mt), e.component("ARow", He), e.component("ATable", Yt), e.component("ATableHeader", ze), e.component("ATableModal", Fe);
1105
+ }, Yt = /* @__PURE__ */ qt(Gt, [["__scopeId", "data-v-20244978"]]);
1106
+ function _t(e) {
1107
+ e.component("ACell", ze), e.component("AExpansionRow", Vt), e.component("ARow", Fe), e.component("ATable", Yt), e.component("ATableHeader", Ue), e.component("ATableModal", Ge);
1104
1108
  }
1105
1109
  export {
1106
- We as ACell,
1107
- Mt as AExpansionRow,
1108
- He as ARow,
1110
+ ze as ACell,
1111
+ Vt as AExpansionRow,
1112
+ Fe as ARow,
1109
1113
  Yt as ATable,
1110
- ze as ATableHeader,
1111
- Fe as ATableModal,
1112
- zt as TableDataStore,
1113
- Zt as install
1114
+ Ue as ATableHeader,
1115
+ Ge as ATableModal,
1116
+ Ut as createTableStore,
1117
+ _t as install
1114
1118
  };
1115
1119
  //# sourceMappingURL=atable.js.map