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