@stonecrop/atable 0.2.24 → 0.2.26

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