magtool 1.4.3 → 1.5.1
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/README.1.md +3 -0
- package/dist/component.js +4301 -0
- package/dist/composition.js +63 -267
- package/dist/css/magtool.css +1 -1
- package/dist/index.js +10 -32
- package/dist/store.js +638 -15
- package/dist/vendor.js +42017 -0
- package/package.json +9 -2
package/dist/store.js
CHANGED
|
@@ -1,23 +1,646 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { getCurrentInstance as H, ref as d, unref as F, computed as le, watch as Q, toRefs as De, nextTick as fe } from "vue";
|
|
2
|
+
import { g as q, a as N, t as ne, b as ge, w as ke, c as oe, e as Be, f as Ue, h as Qe, j as qe, k as He, l as ye, o as We, u as Ge, m as Je, n as Xe } from "./vendor.js";
|
|
3
|
+
import { createPinia as Ze, defineStore as he } from "pinia";
|
|
4
|
+
function et(t) {
|
|
5
|
+
const e = H(), l = d(!1), o = d([]);
|
|
6
|
+
return {
|
|
7
|
+
updateExpandRows: () => {
|
|
8
|
+
const u = t.data.value || [], a = t.rowKey.value;
|
|
9
|
+
if (l.value)
|
|
10
|
+
o.value = u.slice();
|
|
11
|
+
else if (a) {
|
|
12
|
+
const i = q(o.value, a);
|
|
13
|
+
o.value = u.reduce((v, w) => {
|
|
14
|
+
const C = N(w, a);
|
|
15
|
+
return i[C] && v.push(w), v;
|
|
16
|
+
}, []);
|
|
17
|
+
} else
|
|
18
|
+
o.value = [];
|
|
19
|
+
},
|
|
20
|
+
toggleRowExpansion: (u, a) => {
|
|
21
|
+
ne(o.value, u, a, void 0, void 0, void 0, t.rowKey.value) && e.emit("expand-change", u, o.value.slice());
|
|
22
|
+
},
|
|
23
|
+
setExpandRowKeys: (u) => {
|
|
24
|
+
e.store.assertRowKey();
|
|
25
|
+
const a = t.data.value || [], i = t.rowKey.value, v = q(a, i);
|
|
26
|
+
o.value = u.reduce((w, C) => {
|
|
27
|
+
const I = v[C];
|
|
28
|
+
return I && w.push(I.row), w;
|
|
29
|
+
}, []);
|
|
30
|
+
},
|
|
31
|
+
isRowExpanded: (u) => {
|
|
32
|
+
const a = t.rowKey.value;
|
|
33
|
+
return a ? !!q(o.value, a)[N(u, a)] : o.value.includes(u);
|
|
34
|
+
},
|
|
35
|
+
states: {
|
|
36
|
+
expandRows: o,
|
|
37
|
+
defaultExpandAll: l
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function tt(t) {
|
|
42
|
+
const e = H(), l = d(null), o = d(null), y = (a) => {
|
|
43
|
+
e.store.assertRowKey(), l.value = a, s(a);
|
|
44
|
+
}, O = () => {
|
|
45
|
+
l.value = null;
|
|
46
|
+
}, s = (a) => {
|
|
47
|
+
var i;
|
|
48
|
+
const { data: v, rowKey: w } = t;
|
|
49
|
+
let C = null;
|
|
50
|
+
w.value && (C = (i = (F(v) || []).find((I) => N(I, w.value) === a)) != null ? i : null), o.value = C ?? null, e.emit("current-change", o.value, null);
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
setCurrentRowKey: y,
|
|
54
|
+
restoreCurrentRowKey: O,
|
|
55
|
+
setCurrentRowByKey: s,
|
|
56
|
+
updateCurrentRow: (a) => {
|
|
57
|
+
const i = o.value;
|
|
58
|
+
if (a && a !== i) {
|
|
59
|
+
o.value = a, e.emit("current-change", o.value, i);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
!a && i && (o.value = null, e.emit("current-change", null, i));
|
|
63
|
+
},
|
|
64
|
+
updateCurrentRowData: () => {
|
|
65
|
+
const a = t.rowKey.value, i = t.data.value || [], v = o.value;
|
|
66
|
+
if (v && !i.includes(v)) {
|
|
67
|
+
if (a) {
|
|
68
|
+
const w = N(v, a);
|
|
69
|
+
s(w);
|
|
70
|
+
} else
|
|
71
|
+
o.value = null;
|
|
72
|
+
ge(o.value) && e.emit("current-change", null, v);
|
|
73
|
+
} else l.value && (s(l.value), O());
|
|
74
|
+
},
|
|
75
|
+
states: {
|
|
76
|
+
_currentRowKey: l,
|
|
77
|
+
currentRow: o
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function lt(t) {
|
|
82
|
+
const e = d([]), l = d({}), o = d(16), y = d(!1), O = d({}), s = d("hasChildren"), r = d("children"), u = d(!1), a = H(), i = le(() => {
|
|
83
|
+
if (!t.rowKey.value)
|
|
84
|
+
return {};
|
|
85
|
+
const c = t.data.value || [];
|
|
86
|
+
return w(c);
|
|
87
|
+
}), v = le(() => {
|
|
88
|
+
const c = t.rowKey.value, g = Object.keys(O.value), K = {};
|
|
89
|
+
return g.length && g.forEach((m) => {
|
|
90
|
+
if (O.value[m].length) {
|
|
91
|
+
const S = { children: [] };
|
|
92
|
+
O.value[m].forEach((T) => {
|
|
93
|
+
const b = N(T, c);
|
|
94
|
+
S.children.push(b), T[s.value] && !K[b] && (K[b] = { children: [] });
|
|
95
|
+
}), K[m] = S;
|
|
96
|
+
}
|
|
97
|
+
}), K;
|
|
98
|
+
}), w = (c) => {
|
|
99
|
+
const g = t.rowKey.value, K = {};
|
|
100
|
+
return ke(c, (m, S, T) => {
|
|
101
|
+
const b = N(m, g);
|
|
102
|
+
oe(S) ? K[b] = {
|
|
103
|
+
children: S.map((L) => N(L, g)),
|
|
104
|
+
level: T
|
|
105
|
+
} : y.value && (K[b] = {
|
|
106
|
+
children: [],
|
|
107
|
+
lazy: !0,
|
|
108
|
+
level: T
|
|
109
|
+
});
|
|
110
|
+
}, r.value, s.value, y.value), K;
|
|
111
|
+
}, C = (c = !1, g) => {
|
|
112
|
+
var K, m;
|
|
113
|
+
g || (g = (K = a.store) == null ? void 0 : K.states.defaultExpandAll.value);
|
|
114
|
+
const S = i.value, T = v.value, b = Object.keys(S), L = {};
|
|
115
|
+
if (b.length) {
|
|
116
|
+
const D = F(l), B = [], V = (_, A) => {
|
|
117
|
+
if (c)
|
|
118
|
+
return e.value ? g || e.value.includes(A) : !!(g || _ != null && _.expanded);
|
|
119
|
+
{
|
|
120
|
+
const z = g || e.value && e.value.includes(A);
|
|
121
|
+
return !!(_ != null && _.expanded || z);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
b.forEach((_) => {
|
|
125
|
+
const A = D[_], z = { ...S[_] };
|
|
126
|
+
if (z.expanded = V(A, _), z.lazy) {
|
|
127
|
+
const { loaded: $ = !1, loading: U = !1 } = A || {};
|
|
128
|
+
z.loaded = !!$, z.loading = !!U, B.push(_);
|
|
129
|
+
}
|
|
130
|
+
L[_] = z;
|
|
131
|
+
});
|
|
132
|
+
const J = Object.keys(T);
|
|
133
|
+
y.value && J.length && B.length && J.forEach((_) => {
|
|
134
|
+
var A;
|
|
135
|
+
const z = D[_], $ = T[_].children;
|
|
136
|
+
if (B.includes(_)) {
|
|
137
|
+
if (((A = L[_].children) == null ? void 0 : A.length) !== 0)
|
|
138
|
+
throw new Error("[ElTable]children must be an empty array.");
|
|
139
|
+
L[_].children = $;
|
|
140
|
+
} else {
|
|
141
|
+
const { loaded: U = !1, loading: te = !1 } = z || {};
|
|
142
|
+
L[_] = {
|
|
143
|
+
lazy: !0,
|
|
144
|
+
loaded: !!U,
|
|
145
|
+
loading: !!te,
|
|
146
|
+
expanded: V(z, _),
|
|
147
|
+
children: $,
|
|
148
|
+
level: void 0
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
l.value = L, (m = a.store) == null || m.updateTableScrollY();
|
|
154
|
+
};
|
|
155
|
+
Q(() => e.value, () => {
|
|
156
|
+
C(!0);
|
|
157
|
+
}), Q(() => i.value, () => {
|
|
158
|
+
C();
|
|
159
|
+
}), Q(() => v.value, () => {
|
|
160
|
+
C();
|
|
161
|
+
});
|
|
162
|
+
const I = (c) => {
|
|
163
|
+
e.value = c, C();
|
|
164
|
+
}, W = (c) => y.value && c && "loaded" in c && !c.loaded, k = (c, g) => {
|
|
165
|
+
a.store.assertRowKey();
|
|
166
|
+
const K = t.rowKey.value, m = N(c, K), S = m && l.value[m];
|
|
167
|
+
if (m && S && "expanded" in S) {
|
|
168
|
+
const T = S.expanded;
|
|
169
|
+
g = Be(g) ? !S.expanded : g, l.value[m].expanded = g, T !== g && a.emit("expand-change", c, g), W(S) && Y(c, m, S), a.store.updateTableScrollY();
|
|
170
|
+
}
|
|
171
|
+
}, G = (c) => {
|
|
172
|
+
a.store.assertRowKey();
|
|
173
|
+
const g = t.rowKey.value, K = N(c, g), m = l.value[K];
|
|
174
|
+
W(m) ? Y(c, K, m) : k(c, void 0);
|
|
175
|
+
}, Y = (c, g, K) => {
|
|
176
|
+
const { load: m } = a.props;
|
|
177
|
+
m && !l.value[g].loaded && (l.value[g].loading = !0, m(c, K, (S) => {
|
|
178
|
+
if (!oe(S))
|
|
179
|
+
throw new TypeError("[ElTable] data must be an array");
|
|
180
|
+
l.value[g].loading = !1, l.value[g].loaded = !0, l.value[g].expanded = !0, S.length && (O.value[g] = S), a.emit("expand-change", c, !0);
|
|
181
|
+
}));
|
|
182
|
+
};
|
|
183
|
+
return {
|
|
184
|
+
loadData: Y,
|
|
185
|
+
loadOrToggle: G,
|
|
186
|
+
toggleTreeExpansion: k,
|
|
187
|
+
updateTreeExpandKeys: I,
|
|
188
|
+
updateTreeData: C,
|
|
189
|
+
updateKeyChildren: (c, g) => {
|
|
190
|
+
const { lazy: K, rowKey: m } = a.props;
|
|
191
|
+
if (K) {
|
|
192
|
+
if (!m)
|
|
193
|
+
throw new Error("[Table] rowKey is required in updateKeyChild");
|
|
194
|
+
O.value[c] && (O.value[c] = g);
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
normalize: w,
|
|
198
|
+
states: {
|
|
199
|
+
expandRowKeys: e,
|
|
200
|
+
treeData: l,
|
|
201
|
+
indent: o,
|
|
202
|
+
lazy: y,
|
|
203
|
+
lazyTreeNodeMap: O,
|
|
204
|
+
lazyColumnIdentifier: s,
|
|
205
|
+
childrenColumnName: r,
|
|
206
|
+
checkStrictly: u
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
const nt = (t, e) => {
|
|
211
|
+
const l = e.sortingColumn;
|
|
212
|
+
return !l || ye(l.sortable) ? t : We(t, e.sortProp, e.sortOrder, l.sortMethod, l.sortBy);
|
|
213
|
+
}, ee = (t) => {
|
|
214
|
+
const e = [];
|
|
215
|
+
return t.forEach((l) => {
|
|
216
|
+
l.children && l.children.length > 0 ? e.push.apply(e, ee(l.children)) : e.push(l);
|
|
217
|
+
}), e;
|
|
218
|
+
};
|
|
219
|
+
function ot() {
|
|
220
|
+
var t;
|
|
221
|
+
const e = H(), { size: l } = De((t = e.proxy) == null ? void 0 : t.$props), o = d(null), y = d([]), O = d([]), s = d(!1), r = d([]), u = d([]), a = d([]), i = d([]), v = d([]), w = d([]), C = d([]), I = d([]), W = [], k = d(0), G = d(0), Y = d(0), M = d(!1), c = d([]), g = d(!1), K = d(!1), m = d(null), S = d({}), T = d(null), b = d(null), L = d(null), D = d(null), B = d(null), V = le(() => o.value ? q(c.value, o.value) : void 0);
|
|
222
|
+
Q(y, () => {
|
|
223
|
+
var n;
|
|
224
|
+
e.state && (z(!1), e.props.tableLayout === "auto" && ((n = e.refs.tableHeaderRef) == null || n.updateFixedColumnStyle()));
|
|
225
|
+
}, {
|
|
226
|
+
deep: !0
|
|
227
|
+
});
|
|
228
|
+
const J = () => {
|
|
229
|
+
if (!o.value)
|
|
230
|
+
throw new Error("[ElTable] prop row-key is required");
|
|
231
|
+
}, _ = (n) => {
|
|
232
|
+
var f;
|
|
233
|
+
(f = n.children) == null || f.forEach((p) => {
|
|
234
|
+
p.fixed = n.fixed, _(p);
|
|
235
|
+
});
|
|
236
|
+
}, A = () => {
|
|
237
|
+
r.value.forEach((E) => {
|
|
238
|
+
_(E);
|
|
239
|
+
}), i.value = r.value.filter((E) => [!0, "left"].includes(E.fixed));
|
|
240
|
+
const n = r.value.find((E) => E.type === "selection");
|
|
241
|
+
let f;
|
|
242
|
+
n && n.fixed !== "right" && !i.value.includes(n) && r.value.indexOf(n) === 0 && i.value.length && (i.value.unshift(n), f = !0), v.value = r.value.filter((E) => E.fixed === "right");
|
|
243
|
+
const p = r.value.filter((E) => (f ? E.type !== "selection" : !0) && !E.fixed);
|
|
244
|
+
u.value = Array.from(i.value).concat(p).concat(v.value);
|
|
245
|
+
const h = ee(p), x = ee(i.value), R = ee(v.value);
|
|
246
|
+
k.value = h.length, G.value = x.length, Y.value = R.length, a.value = Array.from(x).concat(h).concat(R), s.value = i.value.length > 0 || v.value.length > 0;
|
|
247
|
+
}, z = (n, f = !1) => {
|
|
248
|
+
n && A(), f ? e.state.doLayout() : e.state.debouncedUpdateLayout();
|
|
249
|
+
}, $ = (n) => V.value ? !!V.value[N(n, o.value)] : c.value.includes(n), U = () => {
|
|
250
|
+
M.value = !1;
|
|
251
|
+
const n = c.value;
|
|
252
|
+
c.value = [], n.length && e.emit("selection-change", []);
|
|
253
|
+
}, te = () => {
|
|
254
|
+
var n, f;
|
|
255
|
+
let p;
|
|
256
|
+
if (o.value) {
|
|
257
|
+
p = [];
|
|
258
|
+
const h = (f = (n = e == null ? void 0 : e.store) == null ? void 0 : n.states) == null ? void 0 : f.childrenColumnName.value, x = q(y.value, o.value, !0, h);
|
|
259
|
+
for (const R in V.value)
|
|
260
|
+
He(V.value, R) && !x[R] && p.push(V.value[R].row);
|
|
261
|
+
} else
|
|
262
|
+
p = c.value.filter((h) => !y.value.includes(h));
|
|
263
|
+
if (p.length) {
|
|
264
|
+
const h = c.value.filter((x) => !p.includes(x));
|
|
265
|
+
c.value = h, e.emit("selection-change", h.slice());
|
|
266
|
+
}
|
|
267
|
+
}, Ce = () => (c.value || []).slice(), xe = (n, f, p = !0, h = !1) => {
|
|
268
|
+
var x, R, E, P;
|
|
269
|
+
const j = {
|
|
270
|
+
children: (R = (x = e == null ? void 0 : e.store) == null ? void 0 : x.states) == null ? void 0 : R.childrenColumnName.value,
|
|
271
|
+
checkStrictly: (P = (E = e == null ? void 0 : e.store) == null ? void 0 : E.states) == null ? void 0 : P.checkStrictly.value
|
|
272
|
+
};
|
|
273
|
+
if (ne(c.value, n, f, j, h ? void 0 : m.value, y.value.indexOf(n), o.value)) {
|
|
274
|
+
const Z = (c.value || []).slice();
|
|
275
|
+
p && e.emit("select", Z, n), e.emit("selection-change", Z);
|
|
276
|
+
}
|
|
277
|
+
}, Se = () => {
|
|
278
|
+
var n, f;
|
|
279
|
+
const p = K.value ? !M.value : !(M.value || c.value.length);
|
|
280
|
+
M.value = p;
|
|
281
|
+
let h = !1, x = 0;
|
|
282
|
+
const R = (f = (n = e == null ? void 0 : e.store) == null ? void 0 : n.states) == null ? void 0 : f.rowKey.value, { childrenColumnName: E } = e.store.states, P = {
|
|
283
|
+
children: E.value,
|
|
284
|
+
checkStrictly: !1
|
|
285
|
+
};
|
|
286
|
+
y.value.forEach((j, X) => {
|
|
287
|
+
const Z = X + x;
|
|
288
|
+
ne(c.value, j, p, P, m.value, Z, R) && (h = !0), x += ue(N(j, R));
|
|
289
|
+
}), h && e.emit("selection-change", c.value ? c.value.slice() : []), e.emit("select-all", (c.value || []).slice());
|
|
290
|
+
}, Re = () => {
|
|
291
|
+
var n;
|
|
292
|
+
if (((n = y.value) == null ? void 0 : n.length) === 0) {
|
|
293
|
+
M.value = !1;
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const { childrenColumnName: f } = e.store.states;
|
|
297
|
+
let p = 0, h = 0;
|
|
298
|
+
const x = (E) => {
|
|
299
|
+
var P;
|
|
300
|
+
for (const j of E) {
|
|
301
|
+
const X = m.value && m.value.call(null, j, p);
|
|
302
|
+
if ($(j))
|
|
303
|
+
h++;
|
|
304
|
+
else if (!m.value || X)
|
|
305
|
+
return !1;
|
|
306
|
+
if (p++, (P = j[f.value]) != null && P.length && !x(j[f.value]))
|
|
307
|
+
return !1;
|
|
308
|
+
}
|
|
309
|
+
return !0;
|
|
310
|
+
}, R = x(y.value || []);
|
|
311
|
+
M.value = h === 0 ? !1 : R;
|
|
312
|
+
}, ue = (n) => {
|
|
313
|
+
var f;
|
|
314
|
+
if (!e || !e.store)
|
|
315
|
+
return 0;
|
|
316
|
+
const { treeData: p } = e.store.states;
|
|
317
|
+
let h = 0;
|
|
318
|
+
const x = (f = p.value[n]) == null ? void 0 : f.children;
|
|
319
|
+
return x && (h += x.length, x.forEach((R) => {
|
|
320
|
+
h += ue(R);
|
|
321
|
+
})), h;
|
|
322
|
+
}, Ke = (n, f) => {
|
|
323
|
+
const p = {};
|
|
324
|
+
return qe(n).forEach((h) => {
|
|
325
|
+
S.value[h.id] = f, p[h.columnKey || h.id] = f;
|
|
326
|
+
}), p;
|
|
327
|
+
}, ce = (n, f, p) => {
|
|
328
|
+
b.value && b.value !== n && (b.value.order = null), b.value = n, L.value = f, D.value = p;
|
|
329
|
+
}, ie = () => {
|
|
330
|
+
let n = F(O);
|
|
331
|
+
Object.keys(S.value).forEach((f) => {
|
|
332
|
+
const p = S.value[f];
|
|
333
|
+
if (!p || p.length === 0)
|
|
334
|
+
return;
|
|
335
|
+
const h = Qe({
|
|
336
|
+
columns: a.value
|
|
337
|
+
}, f);
|
|
338
|
+
h && h.filterMethod && (n = n.filter((x) => p.some((R) => h.filterMethod.call(null, R, x, h))));
|
|
339
|
+
}), T.value = n;
|
|
340
|
+
}, de = () => {
|
|
341
|
+
var n;
|
|
342
|
+
y.value = nt((n = T.value) != null ? n : [], {
|
|
343
|
+
sortingColumn: b.value,
|
|
344
|
+
sortProp: L.value,
|
|
345
|
+
sortOrder: D.value
|
|
346
|
+
});
|
|
347
|
+
}, Ee = (n = void 0) => {
|
|
348
|
+
n != null && n.filter || ie(), de();
|
|
349
|
+
}, _e = (n) => {
|
|
350
|
+
const { tableHeaderRef: f } = e.refs;
|
|
351
|
+
if (!f)
|
|
352
|
+
return;
|
|
353
|
+
const p = Object.assign({}, f.filterPanels), h = Object.keys(p);
|
|
354
|
+
if (h.length)
|
|
355
|
+
if (ye(n) && (n = [n]), oe(n)) {
|
|
356
|
+
const x = n.map((R) => Ue({
|
|
357
|
+
columns: a.value
|
|
358
|
+
}, R));
|
|
359
|
+
h.forEach((R) => {
|
|
360
|
+
const E = x.find((P) => P.id === R);
|
|
361
|
+
E && (E.filteredValue = []);
|
|
362
|
+
}), e.store.commit("filterChange", {
|
|
363
|
+
column: x,
|
|
364
|
+
values: [],
|
|
365
|
+
silent: !0,
|
|
366
|
+
multi: !0
|
|
367
|
+
});
|
|
368
|
+
} else
|
|
369
|
+
h.forEach((x) => {
|
|
370
|
+
const R = a.value.find((E) => E.id === x);
|
|
371
|
+
R && (R.filteredValue = []);
|
|
372
|
+
}), S.value = {}, e.store.commit("filterChange", {
|
|
373
|
+
column: {},
|
|
374
|
+
values: [],
|
|
375
|
+
silent: !0
|
|
376
|
+
});
|
|
377
|
+
}, be = () => {
|
|
378
|
+
b.value && (ce(null, null, null), e.store.commit("changeSortCondition", {
|
|
379
|
+
silent: !0
|
|
380
|
+
}));
|
|
381
|
+
}, {
|
|
382
|
+
setExpandRowKeys: Oe,
|
|
383
|
+
toggleRowExpansion: ve,
|
|
384
|
+
updateExpandRows: Te,
|
|
385
|
+
states: ze,
|
|
386
|
+
isRowExpanded: Ie
|
|
387
|
+
} = et({
|
|
388
|
+
data: y,
|
|
389
|
+
rowKey: o
|
|
390
|
+
}), {
|
|
391
|
+
updateTreeExpandKeys: Le,
|
|
392
|
+
toggleTreeExpansion: Ae,
|
|
393
|
+
updateTreeData: Fe,
|
|
394
|
+
updateKeyChildren: Ne,
|
|
395
|
+
loadOrToggle: Pe,
|
|
396
|
+
states: je
|
|
397
|
+
} = lt({
|
|
398
|
+
data: y,
|
|
399
|
+
rowKey: o
|
|
400
|
+
}), {
|
|
401
|
+
updateCurrentRowData: Me,
|
|
402
|
+
updateCurrentRow: Ve,
|
|
403
|
+
setCurrentRowKey: $e,
|
|
404
|
+
states: Ye
|
|
405
|
+
} = tt({
|
|
406
|
+
data: y,
|
|
407
|
+
rowKey: o
|
|
408
|
+
});
|
|
409
|
+
return {
|
|
410
|
+
assertRowKey: J,
|
|
411
|
+
updateColumns: A,
|
|
412
|
+
scheduleLayout: z,
|
|
413
|
+
isSelected: $,
|
|
414
|
+
clearSelection: U,
|
|
415
|
+
cleanSelection: te,
|
|
416
|
+
getSelectionRows: Ce,
|
|
417
|
+
toggleRowSelection: xe,
|
|
418
|
+
_toggleAllSelection: Se,
|
|
419
|
+
toggleAllSelection: null,
|
|
420
|
+
updateAllSelected: Re,
|
|
421
|
+
updateFilters: Ke,
|
|
422
|
+
updateCurrentRow: Ve,
|
|
423
|
+
updateSort: ce,
|
|
424
|
+
execFilter: ie,
|
|
425
|
+
execSort: de,
|
|
426
|
+
execQuery: Ee,
|
|
427
|
+
clearFilter: _e,
|
|
428
|
+
clearSort: be,
|
|
429
|
+
toggleRowExpansion: ve,
|
|
430
|
+
setExpandRowKeysAdapter: (n) => {
|
|
431
|
+
Oe(n), Le(n);
|
|
432
|
+
},
|
|
433
|
+
setCurrentRowKey: $e,
|
|
434
|
+
toggleRowExpansionAdapter: (n, f) => {
|
|
435
|
+
a.value.some(({ type: h }) => h === "expand") ? ve(n, f) : Ae(n, f);
|
|
436
|
+
},
|
|
437
|
+
isRowExpanded: Ie,
|
|
438
|
+
updateExpandRows: Te,
|
|
439
|
+
updateCurrentRowData: Me,
|
|
440
|
+
loadOrToggle: Pe,
|
|
441
|
+
updateTreeData: Fe,
|
|
442
|
+
updateKeyChildren: Ne,
|
|
443
|
+
states: {
|
|
444
|
+
tableSize: l,
|
|
445
|
+
rowKey: o,
|
|
446
|
+
data: y,
|
|
447
|
+
_data: O,
|
|
448
|
+
isComplex: s,
|
|
449
|
+
_columns: r,
|
|
450
|
+
originColumns: u,
|
|
451
|
+
columns: a,
|
|
452
|
+
fixedColumns: i,
|
|
453
|
+
rightFixedColumns: v,
|
|
454
|
+
leafColumns: w,
|
|
455
|
+
fixedLeafColumns: C,
|
|
456
|
+
rightFixedLeafColumns: I,
|
|
457
|
+
updateOrderFns: W,
|
|
458
|
+
leafColumnsLength: k,
|
|
459
|
+
fixedLeafColumnsLength: G,
|
|
460
|
+
rightFixedLeafColumnsLength: Y,
|
|
461
|
+
isAllSelected: M,
|
|
462
|
+
selection: c,
|
|
463
|
+
reserveSelection: g,
|
|
464
|
+
selectOnIndeterminate: K,
|
|
465
|
+
selectable: m,
|
|
466
|
+
filters: S,
|
|
467
|
+
filteredData: T,
|
|
468
|
+
sortingColumn: b,
|
|
469
|
+
sortProp: L,
|
|
470
|
+
sortOrder: D,
|
|
471
|
+
hoverRow: B,
|
|
472
|
+
...ze,
|
|
473
|
+
...je,
|
|
474
|
+
...Ye
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
function ae(t, e) {
|
|
479
|
+
return t.map((l) => {
|
|
480
|
+
var o;
|
|
481
|
+
return l.id === e.id ? e : ((o = l.children) != null && o.length && (l.children = ae(l.children, e)), l);
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
function se(t) {
|
|
485
|
+
t.forEach((e) => {
|
|
486
|
+
var l, o;
|
|
487
|
+
e.no = (l = e.getColumnIndex) == null ? void 0 : l.call(e), (o = e.children) != null && o.length && se(e.children);
|
|
488
|
+
}), t.sort((e, l) => e.no - l.no);
|
|
489
|
+
}
|
|
490
|
+
function at() {
|
|
491
|
+
const t = H(), e = ot();
|
|
492
|
+
return {
|
|
493
|
+
ns: Ge("table"),
|
|
494
|
+
...e,
|
|
495
|
+
mutations: {
|
|
496
|
+
setData(s, r) {
|
|
497
|
+
const u = F(s._data) !== r;
|
|
498
|
+
s.data.value = r, s._data.value = r, t.store.execQuery(), t.store.updateCurrentRowData(), t.store.updateExpandRows(), t.store.updateTreeData(t.store.states.defaultExpandAll.value), F(s.reserveSelection) ? t.store.assertRowKey() : u ? t.store.clearSelection() : t.store.cleanSelection(), t.store.updateAllSelected(), t.$ready && t.store.scheduleLayout();
|
|
499
|
+
},
|
|
500
|
+
insertColumn(s, r, u, a) {
|
|
501
|
+
var i;
|
|
502
|
+
const v = F(s._columns);
|
|
503
|
+
let w = [];
|
|
504
|
+
u ? (u && !u.children && (u.children = []), (i = u.children) == null || i.push(r), w = ae(v, u)) : (v.push(r), w = v), se(w), s._columns.value = w, s.updateOrderFns.push(a), r.type === "selection" && (s.selectable.value = r.selectable, s.reserveSelection.value = r.reserveSelection), t.$ready && (t.store.updateColumns(), t.store.scheduleLayout());
|
|
505
|
+
},
|
|
506
|
+
updateColumnOrder(s, r) {
|
|
507
|
+
var u;
|
|
508
|
+
((u = r.getColumnIndex) == null ? void 0 : u.call(r)) !== r.no && (se(s._columns.value), t.$ready && t.store.updateColumns());
|
|
509
|
+
},
|
|
510
|
+
removeColumn(s, r, u, a) {
|
|
511
|
+
var i;
|
|
512
|
+
const v = F(s._columns) || [];
|
|
513
|
+
if (u)
|
|
514
|
+
(i = u.children) == null || i.splice(u.children.findIndex((C) => C.id === r.id), 1), fe(() => {
|
|
515
|
+
var C;
|
|
516
|
+
((C = u.children) == null ? void 0 : C.length) === 0 && delete u.children;
|
|
517
|
+
}), s._columns.value = ae(v, u);
|
|
518
|
+
else {
|
|
519
|
+
const C = v.indexOf(r);
|
|
520
|
+
C > -1 && (v.splice(C, 1), s._columns.value = v);
|
|
521
|
+
}
|
|
522
|
+
const w = s.updateOrderFns.indexOf(a);
|
|
523
|
+
w > -1 && s.updateOrderFns.splice(w, 1), t.$ready && (t.store.updateColumns(), t.store.scheduleLayout());
|
|
524
|
+
},
|
|
525
|
+
sort(s, r) {
|
|
526
|
+
const { prop: u, order: a, init: i } = r;
|
|
527
|
+
if (u) {
|
|
528
|
+
const v = F(s.columns).find((w) => w.property === u);
|
|
529
|
+
v && (v.order = a, t.store.updateSort(v, u, a), t.store.commit("changeSortCondition", { init: i }));
|
|
530
|
+
}
|
|
531
|
+
},
|
|
532
|
+
changeSortCondition(s, r) {
|
|
533
|
+
const { sortingColumn: u, sortProp: a, sortOrder: i } = s, v = F(u), w = F(a), C = F(i);
|
|
534
|
+
ge(C) && (s.sortingColumn.value = null, s.sortProp.value = null);
|
|
535
|
+
const I = { filter: !0 };
|
|
536
|
+
t.store.execQuery(I), (!r || !(r.silent || r.init)) && t.emit("sort-change", {
|
|
537
|
+
column: v,
|
|
538
|
+
prop: w,
|
|
539
|
+
order: C
|
|
540
|
+
}), t.store.updateTableScrollY();
|
|
541
|
+
},
|
|
542
|
+
filterChange(s, r) {
|
|
543
|
+
const { column: u, values: a, silent: i } = r, v = t.store.updateFilters(u, a);
|
|
544
|
+
t.store.execQuery(), i || t.emit("filter-change", v), t.store.updateTableScrollY();
|
|
545
|
+
},
|
|
546
|
+
toggleAllSelection() {
|
|
547
|
+
var s, r;
|
|
548
|
+
(r = (s = t.store).toggleAllSelection) == null || r.call(s);
|
|
549
|
+
},
|
|
550
|
+
rowSelectedChanged(s, r) {
|
|
551
|
+
t.store.toggleRowSelection(r), t.store.updateAllSelected();
|
|
552
|
+
},
|
|
553
|
+
setHoverRow(s, r) {
|
|
554
|
+
s.hoverRow.value = r;
|
|
555
|
+
},
|
|
556
|
+
setCurrentRow(s, r) {
|
|
557
|
+
t.store.updateCurrentRow(r);
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
commit: function(s, ...r) {
|
|
561
|
+
const u = t.store.mutations;
|
|
562
|
+
if (u[s])
|
|
563
|
+
u[s].apply(t, [
|
|
564
|
+
t.store.states,
|
|
565
|
+
...r
|
|
566
|
+
]);
|
|
567
|
+
else
|
|
568
|
+
throw new Error(`Action not found: ${s}`);
|
|
569
|
+
},
|
|
570
|
+
updateTableScrollY: function() {
|
|
571
|
+
fe(() => t.layout.updateScrollY.apply(t.layout));
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
const re = {
|
|
576
|
+
rowKey: "rowKey",
|
|
577
|
+
defaultExpandAll: "defaultExpandAll",
|
|
578
|
+
selectOnIndeterminate: "selectOnIndeterminate",
|
|
579
|
+
indent: "indent",
|
|
580
|
+
lazy: "lazy",
|
|
581
|
+
data: "data",
|
|
582
|
+
"treeProps.hasChildren": {
|
|
583
|
+
key: "lazyColumnIdentifier",
|
|
584
|
+
default: "hasChildren"
|
|
585
|
+
},
|
|
586
|
+
"treeProps.children": {
|
|
587
|
+
key: "childrenColumnName",
|
|
588
|
+
default: "children"
|
|
589
|
+
},
|
|
590
|
+
"treeProps.checkStrictly": {
|
|
591
|
+
key: "checkStrictly",
|
|
592
|
+
default: !1
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
function pt(t, e) {
|
|
596
|
+
if (!t)
|
|
597
|
+
throw new Error("Table is required.");
|
|
598
|
+
const l = at();
|
|
599
|
+
return l.toggleAllSelection = Je(l._toggleAllSelection, 10), Object.keys(re).forEach((o) => {
|
|
600
|
+
me(we(e, o), o, l);
|
|
601
|
+
}), st(l, e), l;
|
|
602
|
+
}
|
|
603
|
+
function st(t, e) {
|
|
604
|
+
Object.keys(re).forEach((l) => {
|
|
605
|
+
Q(() => we(e, l), (o) => {
|
|
606
|
+
me(o, l, t);
|
|
607
|
+
});
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
function me(t, e, l) {
|
|
611
|
+
let o = t, y = re[e];
|
|
612
|
+
Xe(y) && (o = o || y.default, y = y.key), l.states[y].value = o;
|
|
613
|
+
}
|
|
614
|
+
function we(t, e) {
|
|
615
|
+
if (e.includes(".")) {
|
|
616
|
+
const l = e.split(".");
|
|
617
|
+
let o = t;
|
|
618
|
+
return l.forEach((y) => {
|
|
619
|
+
o = o[y];
|
|
620
|
+
}), o;
|
|
621
|
+
} else
|
|
622
|
+
return t[e];
|
|
623
|
+
}
|
|
624
|
+
const rt = () => ({
|
|
3
625
|
lang: "en_us"
|
|
4
|
-
}),
|
|
626
|
+
}), ut = {
|
|
5
627
|
setLang(t) {
|
|
6
628
|
this.lang = t;
|
|
7
629
|
}
|
|
8
|
-
},
|
|
9
|
-
state:
|
|
10
|
-
actions:
|
|
11
|
-
},
|
|
12
|
-
const
|
|
13
|
-
return Object.keys(t).forEach((
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
}),
|
|
17
|
-
store:
|
|
18
|
-
pinia:
|
|
630
|
+
}, ct = {
|
|
631
|
+
state: rt,
|
|
632
|
+
actions: ut
|
|
633
|
+
}, pe = Ze(), gt = (t) => {
|
|
634
|
+
const e = {};
|
|
635
|
+
return Object.keys(t).forEach((l) => {
|
|
636
|
+
const o = l.match(/chip\/(\S*).js/)[1];
|
|
637
|
+
e[o] = he(o, t[l].default);
|
|
638
|
+
}), e.init = he("init", ct), window.$store = e, window.$pinia = pe, {
|
|
639
|
+
store: e,
|
|
640
|
+
pinia: pe
|
|
19
641
|
};
|
|
20
642
|
};
|
|
21
643
|
export {
|
|
22
|
-
|
|
644
|
+
pt as c,
|
|
645
|
+
gt as p
|
|
23
646
|
};
|