@stonecrop/atable 0.2.39 → 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;
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
3
  var S = (e, t, n) => He(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { onMounted as xe, ref as k, watch as D, onBeforeUnmount as je, computed as y, unref as f, getCurrentScope as Ee, onScopeDispose as Ie, getCurrentInstance as Ne, defineComponent as T, inject as Y, useTemplateRef as ee, openBlock as h, createElementBlock as b, createBlock as B, resolveDynamicComponent as ke, mergeProps as te, toDisplayString as P, Fragment as q, createElementVNode as O, renderSlot as I, createCommentVNode as G, withDirectives as Z, vShow as Ce, 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 Ae(e) {
6
- return Ee() ? (Ie(e), !0) : !1;
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) {
9
- return typeof e == "function" ? e() : f(e);
8
+ function le(e) {
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((d) => d()), i.length = 0;
27
- }, r = (d, p, c, m) => (d.addEventListener(p, c, m), () => d.removeEventListener(p, c, m)), u = D(
28
- () => [H(t), ne(l)],
29
- ([d, p]) => {
30
- if (a(), !d)
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(p) ? { ...p } : p;
33
- i.push(
34
- ...n.flatMap((m) => o.map((w) => r(d, m, w, 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
- ), s = () => {
39
- u(), a();
38
+ ), c = () => {
39
+ d(), i();
40
40
  };
41
- return Ae(s), s;
41
+ return Se(c), c;
42
42
  }
43
- function Qe() {
44
- const e = k(!1), t = Ne();
45
- return t && xe(() => {
43
+ function Ze() {
44
+ const e = I(!1), t = Ne();
45
+ return t && ne(() => {
46
46
  e.value = !0;
47
47
  }, t), e;
48
48
  }
49
- function Ze(e) {
50
- const t = Qe();
51
- return y(() => (t.value, !!e()));
49
+ function Ke(e) {
50
+ const t = Ze();
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 = y(() => {
59
- const c = ne(e), m = (Array.isArray(c) ? c : [c]).map(H).filter(Ge);
60
- return new Set(m);
61
- }), s = D(
62
- () => u.value,
63
- (c) => {
64
- r(), a.value && c.size && (i = new MutationObserver(t), c.forEach((m) => i.observe(m, 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
- ), d = () => i == null ? void 0 : i.takeRecords(), p = () => {
68
- s(), r();
67
+ ), u = () => l == null ? void 0 : l.takeRecords(), p = () => {
68
+ c(), s();
69
69
  };
70
- return Ae(p), {
71
- isSupported: a,
70
+ return Se(p), {
71
+ isSupported: i,
72
72
  stop: p,
73
- takeRecords: d
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 s;
84
- let d = 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 (; d != null && d.shadowRoot; )
87
- d = (s = d == null ? void 0 : d.shadowRoot) == null ? void 0 : s.activeElement;
88
- return d;
89
- }, r = k(), 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", (s) => {
93
- s.relatedTarget === null && u();
94
- }, !0), j(n, "focus", u, !0)), l && Ke(i, (s) => {
95
- s.filter((d) => d.removedNodes.length).map((d) => Array.from(d.removedNodes)).flat().forEach((d) => {
96
- d === 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 = y(() => H(e)), l = k(!1), i = y(() => 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 = k(!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
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
128
  const C = (e) => {
129
- let t = ot(e).value;
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) || !C(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) || !C(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) || !C(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) || !C(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 C = (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) || !C(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,427 +223,426 @@ const C = (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) || !C(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) || !C(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) || !C(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 s of a.selectors)
313
- s instanceof HTMLElement ? u.push(s) : u.push(s.$el);
314
- else if (a.selectors instanceof HTMLElement)
315
- u.push(a.selectors);
316
- else if (Array.isArray(a.selectors.value))
317
- for (const s of a.selectors.value)
318
- s instanceof HTMLElement ? u.push(s) : u.push(s.$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((s) => A(s) && C(s))), u;
326
- }, l = (a) => (r) => {
327
- const u = it[r.key] || r.key.toLowerCase();
328
- if (V.includes(u)) return;
329
- const s = a.handlers || re;
330
- for (const d of Object.keys(s)) {
331
- const [p, ...c] = d.split(".");
332
- if (p === "keydown" && c.includes(u)) {
333
- const m = s[d], w = c.filter((x) => V.includes(x)), W = V.some((x) => {
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
334
  const v = x.charAt(0).toUpperCase() + x.slice(1);
335
- return r.getModifierState(v);
335
+ return s.getModifierState(v);
336
336
  });
337
337
  if (w.length > 0) {
338
- if (W) {
339
- for (const x of V)
340
- if (c.includes(x)) {
338
+ if (V) {
339
+ for (const x of U)
340
+ if (r.includes(x)) {
341
341
  const v = x.charAt(0).toUpperCase() + x.slice(1);
342
- r.getModifierState(v) && m(r);
342
+ s.getModifierState(v) && f(s);
343
343
  }
344
344
  }
345
345
  } else
346
- W || m(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), s = l(a), d = r ? [r] : u;
353
- for (const p of d) {
354
- const { focused: c } = nt(k(p)), m = D(c, (w) => {
355
- w ? p.addEventListener("keydown", s) : p.removeEventListener("keydown", s);
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(m);
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
376
  var x;
376
- const t = Y(e.tableid), n = ee("cell"), o = k(""), l = k(!1), i = t.table, a = t.columns[e.colIndex], r = t.rows[e.rowIndex], u = y(() => {
377
- const v = t.cellData(e.colIndex, e.rowIndex), E = a.format;
378
- return E ? typeof E == "function" ? E(v, { table: i, row: r, column: a }) : typeof E == "string" ? Function(`"use strict";return (${E})`)()(v, { table: i, row: r, column: a }) : v : v;
379
- }), s = () => {
380
- if (a.mask, a.modalComponent) {
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) {
381
382
  const v = n.value.getBoundingClientRect();
382
- 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 a.modalComponent == "function" ? t.modal.component = a.modalComponent({ table: i, row: r, column: a }) : t.modal.component = a.modalComponent, t.modal.componentProps = a.modalComponentExtraProps;
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;
383
384
  }
384
385
  };
385
386
  if (e.addNavigation) {
386
387
  let v = {
387
- ...re,
388
- "keydown.f2": s,
389
- "keydown.alt.up": s,
390
- "keydown.alt.down": s,
391
- "keydown.alt.left": s,
392
- "keydown.alt.right": s
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
393
394
  };
394
395
  typeof e.addNavigation == "object" && (v = {
395
396
  ...v,
396
397
  ...e.addNavigation
397
- }), se([
398
+ }), ce([
398
399
  {
399
400
  selectors: n,
400
401
  handlers: v
401
402
  }
402
403
  ]);
403
404
  }
404
- const d = y(() => a.align || "center"), p = y(() => a.width || "40ch"), c = () => {
405
+ const u = b(() => i.align || "center"), p = b(() => i.width || "40ch"), r = () => {
405
406
  n.value && (o.value = n.value.textContent);
406
- }, m = () => {
407
- n.value && n.value.textContent !== o.value && (o.value = n.value.textContent, n.value.dispatchEvent(new Event("change")), l.value = !0, a.format || t.setCellData(e.rowIndex, e.colIndex, o.value));
408
- }, w = (v, E) => E && v === 0 && E > 0 ? `${E}ch` : "inherit", W = {
409
- textAlign: d.value,
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,
410
411
  width: p.value,
411
- backgroundColor: l.value ? "var(--cell-modified-color)" : "inherit",
412
- fontWeight: l.value ? "bold" : "inherit",
412
+ backgroundColor: a.value ? "var(--cell-modified-color)" : "inherit",
413
+ fontWeight: a.value ? "bold" : "inherit",
413
414
  paddingLeft: w(e.colIndex, (x = t.display[e.rowIndex]) == null ? void 0 : x.indent)
414
415
  };
415
- return (v, E) => (h(), b("td", {
416
+ return (v, E) => (h(), y("td", {
416
417
  ref: "cell",
417
418
  "data-colindex": v.colIndex,
418
419
  "data-rowindex": v.rowIndex,
419
- "data-editable": f(t).columns[v.colIndex].edit,
420
- contenteditable: f(t).columns[v.colIndex].edit,
420
+ "data-editable": m(i).edit,
421
+ contenteditable: m(i).edit,
421
422
  tabindex: v.tabIndex,
422
423
  spellcheck: !1,
423
- style: W,
424
- onFocus: c,
425
- onPaste: m,
426
- onBlur: m,
427
- onInput: m,
428
- onClick: s,
429
- onMousedown: s,
430
- 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" : ""])
431
432
  }, [
432
- f(t).columns[v.colIndex].cellComponent ? (h(), B(ke(f(t).columns[v.colIndex].cellComponent), te({
433
+ m(i).cellComponent ? (h(), z(Ce(m(i).cellComponent), oe({
433
434
  key: 0,
434
- value: u.value
435
- }, f(t).columns[v.colIndex].cellComponentProps), null, 16, ["value"])) : (h(), b("span", st, P(u.value), 1))
436
- ], 40, rt));
435
+ value: d.value
436
+ }, m(i).cellComponentProps), null, 16, ["value"])) : (h(), y("span", dt, W(d.value), 1))
437
+ ], 42, rt));
437
438
  }
438
- }), dt = ["tabindex"], ct = ["tabindex"], ut = ["colspan"], ft = /* @__PURE__ */ T({
439
+ }), ct = ["tabindex"], ut = ["tabindex"], ft = ["colspan"], mt = /* @__PURE__ */ T({
439
440
  __name: "AExpansionRow",
440
441
  props: {
441
- row: {},
442
442
  rowIndex: {},
443
443
  tableid: {},
444
444
  tabIndex: { default: () => -1 },
445
445
  addNavigation: { type: [Boolean, Object] }
446
446
  },
447
447
  setup(e) {
448
- const t = Y(e.tableid), n = ee("rowEl"), o = y(() => t.display[e.rowIndex].expanded ? "▼" : "►");
448
+ const t = X(e.tableid), n = J("rowEl"), o = b(() => t.display[e.rowIndex].expanded ? "▼" : "►");
449
449
  if (e.addNavigation) {
450
- const l = {
451
- "keydown.control.g": (i) => {
452
- 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);
453
453
  }
454
454
  };
455
- typeof e.addNavigation == "object" && Object.assign(l, e.addNavigation), se([
455
+ typeof e.addNavigation == "object" && Object.assign(a, e.addNavigation), ce([
456
456
  {
457
457
  selectors: n,
458
- handlers: l
458
+ handlers: a
459
459
  }
460
460
  ]);
461
461
  }
462
- return (l, i) => (h(), b(q, null, [
463
- O("tr", te(l.$attrs, {
462
+ return (a, l) => (h(), y(G, null, [
463
+ L("tr", oe(a.$attrs, {
464
464
  ref: "rowEl",
465
- tabindex: l.tabIndex,
465
+ tabindex: a.tabIndex,
466
466
  class: "expandable-row"
467
467
  }), [
468
- O("td", {
468
+ L("td", {
469
469
  tabIndex: -1,
470
- onClick: i[0] || (i[0] = (a) => f(t).toggleRowExpand(l.rowIndex)),
470
+ onClick: l[0] || (l[0] = (i) => m(t).toggleRowExpand(a.rowIndex)),
471
471
  class: "row-index"
472
- }, P(o.value), 1),
473
- I(l.$slots, "row")
474
- ], 16, dt),
475
- f(t).display[l.rowIndex].expanded ? (h(), b("tr", {
472
+ }, W(o.value), 1),
473
+ k(a.$slots, "row")
474
+ ], 16, ct),
475
+ m(t).display[a.rowIndex].expanded ? (h(), y("tr", {
476
476
  key: 0,
477
477
  ref: "rowExpanded",
478
- tabindex: l.tabIndex,
478
+ tabindex: a.tabIndex,
479
479
  class: "expanded-row"
480
480
  }, [
481
- O("td", {
481
+ L("td", {
482
482
  tabIndex: -1,
483
- colspan: f(t).columns.length + 1,
483
+ colspan: m(t).columns.length + 1,
484
484
  class: "expanded-row-content"
485
485
  }, [
486
- I(l.$slots, "content")
487
- ], 8, ut)
488
- ], 8, ct)) : G("", !0)
486
+ k(a.$slots, "content")
487
+ ], 8, ft)
488
+ ], 8, ut)) : Y("", !0)
489
489
  ], 64));
490
490
  }
491
- }), mt = ["tabindex"], pt = {
492
- key: 0,
493
- tabIndex: -1,
494
- class: "list-index"
495
- }, De = /* @__PURE__ */ T({
491
+ }), pt = ["tabindex"], Te = /* @__PURE__ */ T({
496
492
  __name: "ARow",
497
493
  props: {
498
- row: {},
499
494
  rowIndex: {},
500
495
  tableid: {},
501
496
  tabIndex: { default: () => -1 },
502
497
  addNavigation: { type: [Boolean, Object], default: !1 }
503
498
  },
504
499
  setup(e) {
505
- const t = Y(e.tableid), n = ee("rowEl"), o = y(() => t.config.view !== "tree" || t.display[e.rowIndex].isRoot || t.display[e.rowIndex].open), l = y(() => t.config.view !== "tree" ? "" : t.display[e.rowIndex].isRoot || t.display[e.rowIndex].isParent ? t.display[e.rowIndex].childrenOpen ? "-" : "+" : ""), i = (a) => {
506
- 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);
507
502
  };
508
503
  if (e.addNavigation) {
509
- let a = re;
510
- typeof e.addNavigation == "object" && (a = {
511
- ...a,
504
+ let s = de;
505
+ typeof e.addNavigation == "object" && (s = {
506
+ ...s,
512
507
  ...e.addNavigation
513
- }), se([
508
+ }), ce([
514
509
  {
515
510
  selectors: n,
516
- handlers: a
511
+ handlers: s
517
512
  }
518
513
  ]);
519
514
  }
520
- return (a, r) => Z((h(), b("tr", {
515
+ return (s, d) => _((h(), y("tr", {
521
516
  ref: "rowEl",
522
- tabindex: a.tabIndex,
517
+ tabindex: s.tabIndex,
523
518
  class: "table-row"
524
519
  }, [
525
- I(a.$slots, "index", {}, () => [
526
- f(t).config.view === "list" ? (h(), b("td", pt, P(a.rowIndex + 1), 1)) : f(t).config.view === "tree" ? (h(), b("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", {
527
526
  key: 1,
528
527
  tabIndex: -1,
529
- class: "tree-index",
530
- onClick: r[0] || (r[0] = (u) => i(a.rowIndex))
531
- }, 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)
532
531
  ]),
533
- I(a.$slots, "default")
534
- ], 8, mt)), [
535
- [Ce, o.value]
532
+ k(s.$slots, "default")
533
+ ], 8, pt)), [
534
+ [Ae, a.value]
536
535
  ]);
537
536
  }
538
537
  });
539
- function Te(e) {
540
- return Ee() ? (Ie(e), !0) : !1;
538
+ function $e(e) {
539
+ return ke() ? (Ie(e), !0) : !1;
541
540
  }
542
- function L(e) {
543
- return typeof e == "function" ? e() : f(e);
541
+ function O(e) {
542
+ return typeof e == "function" ? e() : m(e);
544
543
  }
545
- const $e = typeof window < "u" && typeof document < "u";
544
+ const Re = typeof window < "u" && typeof document < "u";
546
545
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
547
546
  const vt = Object.prototype.toString, wt = (e) => vt.call(e) === "[object Object]", M = () => {
548
- }, _ = /* @__PURE__ */ ht();
547
+ }, te = /* @__PURE__ */ ht();
549
548
  function ht() {
550
549
  var e, t;
551
- 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));
552
551
  }
553
- const he = {
552
+ const ye = {
554
553
  mounted: "mounted",
555
554
  updated: "updated",
556
555
  unmounted: "unmounted"
557
556
  };
558
557
  function gt(...e) {
559
558
  if (e.length !== 1)
560
- return We(...e);
559
+ return Ve(...e);
561
560
  const t = e[0];
562
- return typeof t == "function" ? Ve(Ue(() => ({ get: t, set: M }))) : k(t);
561
+ return typeof t == "function" ? Ue(Be(() => ({ get: t, set: M }))) : I(t);
563
562
  }
564
563
  function R(e) {
565
564
  var t;
566
- const n = L(e);
565
+ const n = O(e);
567
566
  return (t = n == null ? void 0 : n.$el) != null ? t : n;
568
567
  }
569
- const Re = $e ? window : void 0;
570
- function F(...e) {
571
- let t, n, o, l;
572
- 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)
573
572
  return M;
574
573
  Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
575
- const i = [], a = () => {
576
- i.forEach((d) => d()), i.length = 0;
577
- }, r = (d, p, c, m) => (d.addEventListener(p, c, m), () => d.removeEventListener(p, c, m)), u = D(
578
- () => [R(t), L(l)],
579
- ([d, p]) => {
580
- if (a(), !d)
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)
581
580
  return;
582
- const c = wt(p) ? { ...p } : p;
583
- i.push(
584
- ...n.flatMap((m) => o.map((w) => r(d, m, w, c)))
581
+ const r = wt(p) ? { ...p } : p;
582
+ l.push(
583
+ ...n.flatMap((f) => o.map((w) => s(u, f, w, r)))
585
584
  );
586
585
  },
587
586
  { immediate: !0, flush: "post" }
588
- ), s = () => {
589
- u(), a();
587
+ ), c = () => {
588
+ d(), i();
590
589
  };
591
- return Te(s), s;
590
+ return $e(c), c;
592
591
  }
593
- let ge = !1;
594
- function be(e, t, n = {}) {
595
- 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;
596
595
  if (!o)
597
596
  return M;
598
- _ && !ge && (ge = !0, Array.from(o.document.body.children).forEach((c) => c.addEventListener("click", M)), o.document.documentElement.addEventListener("click", M));
599
- let r = !0;
600
- const u = (c) => l.some((m) => {
601
- if (typeof m == "string")
602
- return Array.from(o.document.querySelectorAll(m)).some((w) => w === c.target || c.composedPath().includes(w));
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));
603
602
  {
604
- const w = R(m);
605
- return w && (c.target === w || c.composedPath().includes(w));
603
+ const w = R(f);
604
+ return w && (r.target === w || r.composedPath().includes(w));
606
605
  }
607
- }), d = [
608
- F(o, "click", (c) => {
609
- const m = R(e);
610
- if (!(!m || m === c.target || c.composedPath().includes(m))) {
611
- if (c.detail === 0 && (r = !u(c)), !r) {
612
- 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;
613
612
  return;
614
613
  }
615
- t(c);
614
+ t(r);
616
615
  }
617
- }, { passive: !0, capture: i }),
618
- F(o, "pointerdown", (c) => {
619
- const m = R(e);
620
- r = !u(c) && !!(m && !c.composedPath().includes(m));
616
+ }, { passive: !0, capture: l }),
617
+ q(o, "pointerdown", (r) => {
618
+ const f = R(e);
619
+ s = !d(r) && !!(f && !r.composedPath().includes(f));
621
620
  }, { passive: !0 }),
622
- a && F(o, "blur", (c) => {
621
+ i && q(o, "blur", (r) => {
623
622
  setTimeout(() => {
624
- var m;
623
+ var f;
625
624
  const w = R(e);
626
- ((m = o.document.activeElement) == null ? void 0 : m.tagName) === "IFRAME" && !(w != null && w.contains(o.document.activeElement)) && t(c);
625
+ ((f = o.document.activeElement) == null ? void 0 : f.tagName) === "IFRAME" && !(w != null && w.contains(o.document.activeElement)) && t(r);
627
626
  }, 0);
628
627
  })
629
628
  ].filter(Boolean);
630
- return () => d.forEach((c) => c());
629
+ return () => u.forEach((r) => r());
631
630
  }
632
- const bt = {
633
- [he.mounted](e, t) {
631
+ const yt = {
632
+ [ye.mounted](e, t) {
634
633
  const n = !t.modifiers.bubble;
635
634
  if (typeof t.value == "function")
636
- e.__onClickOutside_stop = be(e, t.value, { capture: n });
635
+ e.__onClickOutside_stop = xe(e, t.value, { capture: n });
637
636
  else {
638
- const [o, l] = t.value;
639
- 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));
640
639
  }
641
640
  },
642
- [he.unmounted](e) {
641
+ [ye.unmounted](e) {
643
642
  e.__onClickOutside_stop();
644
643
  }
645
644
  };
646
- function X(e) {
645
+ function Q(e) {
647
646
  return typeof Window < "u" && e instanceof Window ? e.document.documentElement : typeof Document < "u" && e instanceof Document ? e.documentElement : e;
648
647
  }
649
648
  function Oe(e) {
@@ -655,86 +654,86 @@ function Oe(e) {
655
654
  return !n || n.tagName === "BODY" ? !1 : Oe(n);
656
655
  }
657
656
  }
658
- function yt(e) {
657
+ function bt(e) {
659
658
  const t = e || window.event, n = t.target;
660
659
  return Oe(n) ? !1 : t.touches.length > 1 ? !0 : (t.preventDefault && t.preventDefault(), !1);
661
660
  }
662
- const J = /* @__PURE__ */ new WeakMap();
661
+ const Z = /* @__PURE__ */ new WeakMap();
663
662
  function xt(e, t = !1) {
664
- const n = k(t);
665
- let o = null, l = "";
666
- D(gt(e), (r) => {
667
- const u = X(L(r));
668
- if (u) {
669
- const s = u;
670
- if (J.get(s) || J.set(s, s.style.overflow), s.style.overflow !== "hidden" && (l = s.style.overflow), s.style.overflow === "hidden")
663
+ const n = I(t);
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")
671
670
  return n.value = !0;
672
671
  if (n.value)
673
- return s.style.overflow = "hidden";
672
+ return c.style.overflow = "hidden";
674
673
  }
675
674
  }, {
676
675
  immediate: !0
677
676
  });
678
- const i = () => {
679
- const r = X(L(e));
680
- !r || n.value || (_ && (o = F(
681
- r,
677
+ const l = () => {
678
+ const s = Q(O(e));
679
+ !s || n.value || (te && (o = q(
680
+ s,
682
681
  "touchmove",
683
- (u) => {
684
- yt(u);
682
+ (d) => {
683
+ bt(d);
685
684
  },
686
685
  { passive: !1 }
687
- )), r.style.overflow = "hidden", n.value = !0);
688
- }, a = () => {
689
- const r = X(L(e));
690
- !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);
691
690
  };
692
- return Te(a), y({
691
+ return $e(i), b({
693
692
  get() {
694
693
  return n.value;
695
694
  },
696
- set(r) {
697
- r ? i() : a();
695
+ set(s) {
696
+ s ? l() : i();
698
697
  }
699
698
  });
700
699
  }
701
700
  function Et() {
702
701
  let e = !1;
703
- const t = k(!1);
702
+ const t = I(!1);
704
703
  return (n, o) => {
705
704
  if (t.value = o.value, e)
706
705
  return;
707
706
  e = !0;
708
- const l = xt(n, o.value);
709
- D(t, (i) => l.value = i);
707
+ const a = xt(n, o.value);
708
+ D(t, (l) => a.value = l);
710
709
  };
711
710
  }
712
711
  Et();
713
712
  var g = [];
714
- for (var Q = 0; Q < 256; ++Q)
715
- g.push((Q + 256).toString(16).slice(1));
716
- function It(e, t = 0) {
713
+ for (var K = 0; K < 256; ++K)
714
+ g.push((K + 256).toString(16).slice(1));
715
+ function kt(e, t = 0) {
717
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();
718
717
  }
719
- var U, kt = new Uint8Array(16);
718
+ var B, It = new Uint8Array(16);
720
719
  function Ct() {
721
- if (!U && (U = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !U))
720
+ if (!B && (B = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !B))
722
721
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
723
- return U(kt);
722
+ return B(It);
724
723
  }
725
724
  var At = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
726
- const ye = {
725
+ const Ee = {
727
726
  randomUUID: At
728
727
  };
729
728
  function St(e, t, n) {
730
- if (ye.randomUUID && !t && !e)
731
- return ye.randomUUID();
729
+ if (Ee.randomUUID && !t && !e)
730
+ return Ee.randomUUID();
732
731
  e = e || {};
733
732
  var o = e.random || (e.rng || Ct)();
734
- return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, It(o);
733
+ return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, kt(o);
735
734
  }
736
735
  class Dt {
737
- constructor(t, n, o, l, i, a) {
736
+ constructor(t, n, o, a, l, i) {
738
737
  S(this, "id");
739
738
  S(this, "rows");
740
739
  S(this, "columns");
@@ -742,13 +741,13 @@ class Dt {
742
741
  S(this, "table");
743
742
  S(this, "display");
744
743
  S(this, "modal");
745
- 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 });
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 });
746
745
  }
747
746
  createTableObject() {
748
747
  const t = {};
749
748
  for (const [n, o] of this.columns.entries())
750
- for (const [l, i] of this.rows.entries())
751
- t[`${n}:${l}`] = i[o.name];
749
+ for (const [a, l] of this.rows.entries())
750
+ t[`${n}:${a}`] = l[o.name];
752
751
  return t;
753
752
  }
754
753
  createDisplayObject(t) {
@@ -756,17 +755,17 @@ class Dt {
756
755
  if (t && "0:0" in t)
757
756
  return t;
758
757
  const o = /* @__PURE__ */ new Set();
759
- for (let l = this.rows.length - 1; l >= 0; l--) {
760
- const i = this.rows[l];
761
- 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] = {
762
761
  childrenOpen: !1,
763
762
  expanded: !1,
764
- indent: i.indent || null,
765
- isParent: o.has(l),
766
- 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,
767
766
  modified: !1,
768
- open: i.parent === null || i.parent === void 0,
769
- parent: i.parent
767
+ open: l.parent === null || l.parent === void 0,
768
+ parent: l.parent
770
769
  };
771
770
  }
772
771
  return $(n);
@@ -775,15 +774,15 @@ class Dt {
775
774
  return ["list", "tree", "list-expansion"].includes(this.config.view);
776
775
  }
777
776
  get numberedRowWidth() {
778
- return y(() => String(Math.ceil(this.rows.length / 100) + 1) + "ch");
777
+ return b(() => String(Math.ceil(this.rows.length / 100) + 1) + "ch");
779
778
  }
780
779
  cellData(t, n) {
781
780
  return this.table[`${t}:${n}`];
782
781
  }
783
782
  setCellData(t, n, o) {
784
783
  this.table[`${n}:${t}`] !== o && (this.display[t].modified = !0), this.table[`${n}:${t}`] = o;
785
- const l = this.columns[n];
786
- 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}`];
787
786
  }
788
787
  toggleRowExpand(t) {
789
788
  if (this.config.view === "tree") {
@@ -799,37 +798,39 @@ const Tt = {
799
798
  }, $t = {
800
799
  class: "atable-header-row",
801
800
  tabindex: "-1"
802
- }, Rt = {
803
- key: 0,
804
- id: "header-index"
805
- }, Le = /* @__PURE__ */ T({
801
+ }, Me = /* @__PURE__ */ T({
806
802
  __name: "ATableHeader",
807
803
  props: {
808
804
  columns: {},
809
805
  tableid: {}
810
806
  },
811
807
  setup(e) {
812
- const t = Y(e.tableid), n = (o) => ({
813
- minWidth: o.width || "40ch",
814
- 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",
815
811
  width: t.config.fullWidth ? "auto" : null
816
812
  });
817
- return (o, l) => o.columns.length ? (h(), b("thead", Tt, [
818
- O("tr", $t, [
819
- f(t).zeroColumn ? (h(), b("th", Rt)) : G("", !0),
820
- (h(!0), b(q, null, K(o.columns, (i, a) => (h(), b("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", {
821
821
  key: i.name,
822
822
  tabindex: "-1",
823
- style: z(n(i))
823
+ style: F(o(i)),
824
+ class: P(i.pinned ? "sticky-column" : "")
824
825
  }, [
825
- I(o.$slots, "default", {}, () => [
826
- 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)
827
828
  ])
828
- ], 4))), 128))
829
+ ], 6))), 128))
829
830
  ])
830
- ])) : G("", !0);
831
+ ])) : Y("", !0);
831
832
  }
832
- }), Me = /* @__PURE__ */ T({
833
+ }), Pe = /* @__PURE__ */ T({
833
834
  __name: "ATableModal",
834
835
  props: {
835
836
  colIndex: {},
@@ -840,126 +841,142 @@ const Tt = {
840
841
  const t = (n) => {
841
842
  n.stopPropagation();
842
843
  };
843
- return (n, o) => (h(), b("div", {
844
+ return (n, o) => (h(), y("div", {
844
845
  class: "amodal",
845
846
  tabindex: "-1",
846
847
  onClick: t,
847
848
  onInput: t
848
849
  }, [
849
- I(n.$slots, "default")
850
+ k(n.$slots, "default")
850
851
  ], 32));
851
852
  }
852
- }), Ot = /* @__PURE__ */ T({
853
+ }), Rt = /* @__PURE__ */ T({
853
854
  __name: "ATable",
854
855
  props: {
855
856
  id: {},
856
857
  modelValue: {},
857
858
  columns: {},
858
859
  rows: { default: () => [] },
859
- config: { default: () => new Object() },
860
- tableid: {}
860
+ config: { default: () => new Object() }
861
861
  },
862
862
  emits: ["update:modelValue"],
863
863
  setup(e, { emit: t }) {
864
- const n = t, o = e.modelValue ? e.modelValue : e.rows, l = new Dt(e.id, e.columns, o, e.config);
865
- ze(l.id, l), D(
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(
866
866
  () => l.rows,
867
- (a) => {
868
- n("update:modelValue", a);
867
+ (d) => {
868
+ n("update:modelValue", d);
869
869
  },
870
870
  { deep: !0 }
871
- );
872
- const i = (a) => {
873
- var r;
874
- 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);
875
890
  };
876
- return window.addEventListener("keydown", (a) => {
877
- if (a.key === "Escape" && l.modal.visible) {
891
+ return window.addEventListener("keydown", (d) => {
892
+ if (d.key === "Escape" && l.modal.visible) {
878
893
  l.modal.visible = !1;
879
- const r = l.modal.parent;
880
- r && Fe().then(() => {
881
- r.focus();
894
+ const c = l.modal.parent;
895
+ c && qe().then(() => {
896
+ c.focus();
882
897
  });
883
898
  }
884
- }), (a, r) => Z((h(), b("table", {
899
+ }), (d, c) => _((h(), y("table", {
900
+ ref: "table",
885
901
  class: "atable",
886
- style: z({ width: f(l).config.fullWidth ? "100%" : "auto" })
902
+ style: F({ width: m(l).config.fullWidth ? "100%" : "auto" })
887
903
  }, [
888
- I(a.$slots, "header", { data: f(l) }, () => [
889
- de(Le, {
890
- columns: f(l).columns,
891
- tableid: f(l).id
904
+ k(d.$slots, "header", { data: m(l) }, () => [
905
+ ue(Me, {
906
+ columns: m(l).columns,
907
+ tableid: m(l).id
892
908
  }, null, 8, ["columns", "tableid"])
893
909
  ]),
894
- O("tbody", null, [
895
- I(a.$slots, "body", { data: f(l) }, () => [
896
- (h(!0), b(q, null, K(f(l).rows, (u, s) => (h(), 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, {
897
913
  key: u.id,
898
914
  row: u,
899
- rowIndex: s,
900
- tableid: f(l).id
915
+ rowIndex: p,
916
+ tableid: m(l).id
901
917
  }, {
902
- default: ce(() => [
903
- (h(!0), b(q, null, K(f(l).columns, (d, p) => (h(), B(Se, {
904
- key: d.name,
905
- tableid: f(l).id,
906
- col: d,
918
+ default: fe(() => [
919
+ (h(!0), y(G, null, ee(m(l).columns, (r, f) => (h(), z(De, {
920
+ key: r.name,
921
+ tableid: m(l).id,
922
+ col: r,
907
923
  spellcheck: "false",
908
- rowIndex: s,
909
- colIndex: p + (f(l).zeroColumn ? 0 : -1),
910
- component: d.cellComponent,
911
- style: z({
912
- textAlign: (d == null ? void 0 : d.align) || "center",
913
- minWidth: (d == null ? void 0 : d.width) || "40ch",
914
- width: f(l).config.fullWidth ? "auto" : null
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",
931
+ width: m(l).config.fullWidth ? "auto" : null
915
932
  })
916
- }, null, 8, ["tableid", "col", "rowIndex", "colIndex", "component", "style"]))), 128))
933
+ }, null, 8, ["tableid", "col", "pinned", "rowIndex", "colIndex", "component", "style"]))), 128))
917
934
  ]),
918
935
  _: 2
919
936
  }, 1032, ["row", "rowIndex", "tableid"]))), 128))
920
937
  ])
921
938
  ]),
922
- I(a.$slots, "footer", { data: f(l) }),
923
- I(a.$slots, "modal", { data: f(l) }, () => [
924
- Z(de(Me, {
925
- colIndex: f(l).modal.colIndex,
926
- rowIndex: f(l).modal.rowIndex,
927
- tableid: f(l).id,
928
- style: z({
929
- left: f(l).modal.left + "px",
930
- top: f(l).modal.top + "px",
931
- maxWidth: f(l).modal.width + "px"
939
+ k(d.$slots, "footer", { data: m(l) }),
940
+ k(d.$slots, "modal", { data: m(l) }, () => [
941
+ _(ue(Pe, {
942
+ colIndex: m(l).modal.colIndex,
943
+ rowIndex: m(l).modal.rowIndex,
944
+ tableid: m(l).id,
945
+ style: F({
946
+ left: m(l).modal.left + "px",
947
+ top: m(l).modal.top + "px",
948
+ maxWidth: m(l).modal.width + "px"
932
949
  })
933
950
  }, {
934
- default: ce(() => [
935
- (h(), B(ke(f(l).modal.component), te({
936
- key: `${f(l).modal.rowIndex}:${f(l).modal.colIndex}`,
937
- colIndex: f(l).modal.colIndex,
938
- rowIndex: f(l).modal.rowIndex,
939
- tableid: f(l).id
940
- }, f(l).modal.componentProps), null, 16, ["colIndex", "rowIndex", "tableid"]))
951
+ default: fe(() => [
952
+ (h(), z(Ce(m(l).modal.component), oe({
953
+ key: `${m(l).modal.rowIndex}:${m(l).modal.colIndex}`,
954
+ colIndex: m(l).modal.colIndex,
955
+ rowIndex: m(l).modal.rowIndex,
956
+ tableid: m(l).id
957
+ }, m(l).modal.componentProps), null, 16, ["colIndex", "rowIndex", "tableid"]))
941
958
  ]),
942
959
  _: 1
943
960
  }, 8, ["colIndex", "rowIndex", "tableid", "style"]), [
944
- [Ce, f(l).modal.visible]
961
+ [Ae, m(l).modal.visible]
945
962
  ])
946
963
  ])
947
964
  ], 4)), [
948
- [f(bt), i]
965
+ [m(yt), s]
949
966
  ]);
950
967
  }
951
968
  });
952
- function Ht(e) {
953
- 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);
954
971
  }
955
972
  export {
956
- Se as ACell,
957
- ft as AExpansionRow,
958
- De as ARow,
959
- Ot as ATable,
960
- Le as ATableHeader,
961
- 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,
962
979
  Dt as TableDataStore,
963
- Ht as install
980
+ Pt as install
964
981
  };
965
982
  //# sourceMappingURL=atable.js.map