@stonecrop/atable 0.2.38 → 0.2.40

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