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