jmash-core 0.0.40 → 0.0.41

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.
Files changed (70) hide show
  1. package/dist/{401-CEl3xZ9U.mjs → 401-CJFCHgSZ.mjs} +2 -2
  2. package/dist/{404-BJI4jQGp.mjs → 404-CIMxkP9D.mjs} +1 -1
  3. package/dist/{BarChart-DdL2YjH9.mjs → BarChart-DU09mkLm.mjs} +2 -2
  4. package/dist/{PieChart-DpRLzU_D.mjs → PieChart-CoqFm60I.mjs} +1 -1
  5. package/dist/{PieChart.vue_vue_type_script_setup_true_lang-Db-lqTD8.mjs → PieChart.vue_vue_type_script_setup_true_lang-sfYOFNKO.mjs} +2 -2
  6. package/dist/{RadarChart-2a1QGb0r.mjs → RadarChart-0WISsxpt.mjs} +1 -1
  7. package/dist/{RadarChart.vue_vue_type_script_setup_true_lang-CwF9slnO.mjs → RadarChart.vue_vue_type_script_setup_true_lang-BIOHXswr.mjs} +2 -2
  8. package/dist/{el-card-FMIPeWk6.mjs → el-card-DTXS4SWb.mjs} +1 -1
  9. package/dist/{el-col-8K1Xv7aq.mjs → el-col-C1oER81S.mjs} +1 -1
  10. package/dist/{el-form-item-J_27GFln.mjs → el-form-item-CJcAbcqr.mjs} +76 -76
  11. package/dist/{index-BB9i38wB.mjs → index-BAk-5oG9.mjs} +1 -1
  12. package/dist/{index--oHFkGGF.mjs → index-BwIx8FCt.mjs} +32 -32
  13. package/dist/{index-C_arFWKZ.mjs → index-C195Pa7c.mjs} +9759 -11332
  14. package/dist/{index-Ca93omwQ.mjs → index-DB4OW-7Q.mjs} +980 -944
  15. package/dist/{index-BUndPokw.mjs → index-ORr19rEl.mjs} +42 -42
  16. package/dist/index.mjs +36 -36
  17. package/dist/index.vue_vue_type_script_setup_true_lang-fPrQh0lj.mjs +720 -0
  18. package/dist/{picture-BQKPWIIU.mjs → picture-Cpgh-vo-.mjs} +106 -106
  19. package/dist/{position-DZbY0x3r.mjs → position-M0AZIV5D.mjs} +1 -1
  20. package/dist/profile-DBegP-cF.mjs +4904 -0
  21. package/dist/{runAs-DSfasz8M.mjs → runAs-xhA9mf-i.mjs} +1 -1
  22. package/dist/runAs.vue_vue_type_script_setup_true_lang-DLfQ0lsg.mjs +610 -0
  23. package/dist/style.css +1 -1
  24. package/dist/{types-BHZ78WKD.mjs → types-FkPgztcJ.mjs} +4 -3
  25. package/dist/{updatePwd-D2U2rq9Q.mjs → updatePwd-D1EnTbTY.mjs} +1 -1
  26. package/dist/{updatePwd.vue_vue_type_script_setup_true_lang-HlhGZun3.mjs → updatePwd.vue_vue_type_script_setup_true_lang-DkH3J5K0.mjs} +20 -20
  27. package/dts/src/api/auth/index.d.ts +27 -2
  28. package/dts/src/api/auth/types.d.ts +42 -34
  29. package/dts/src/index.d.ts +2 -3
  30. package/dts/src/lang/package/zh-cn.d.ts +2 -0
  31. package/dts/src/utils/request.d.ts +2 -0
  32. package/package.json +1 -1
  33. package/dist/edit-BEz2CGVA.mjs +0 -4
  34. package/dist/edit-BfCUuHU7.mjs +0 -823
  35. package/dist/edit-BjIGOyRY.mjs +0 -4
  36. package/dist/edit-ByyeESA7.mjs +0 -4
  37. package/dist/edit-DCqdRa7R.mjs +0 -4
  38. package/dist/edit-DaPZ7RSc.mjs +0 -4
  39. package/dist/edit-Mg7mOWDc.mjs +0 -4
  40. package/dist/edit-voW3EO87.mjs +0 -459
  41. package/dist/edit.vue_vue_type_script_setup_true_lang-BCgNC4mY.mjs +0 -136
  42. package/dist/edit.vue_vue_type_script_setup_true_lang-BMYBrnHy.mjs +0 -280
  43. package/dist/edit.vue_vue_type_script_setup_true_lang-C-WS99W7.mjs +0 -157
  44. package/dist/edit.vue_vue_type_script_setup_true_lang-CylQxP9Z.mjs +0 -226
  45. package/dist/edit.vue_vue_type_script_setup_true_lang-DDCQNqdc.mjs +0 -593
  46. package/dist/edit.vue_vue_type_script_setup_true_lang-DyO-f1Lc.mjs +0 -216
  47. package/dist/el-checkbox-group-l0sNRNKZ.mjs +0 -1
  48. package/dist/el-date-picker-CHigi6WN.mjs +0 -3345
  49. package/dist/el-divider-Cg4Mgsu-.mjs +0 -45
  50. package/dist/el-dropdown-item-DHcRJ-Fg.mjs +0 -671
  51. package/dist/el-tree-select-C4cU2Ot7.mjs +0 -1313
  52. package/dist/index-9e59vbzb.mjs +0 -949
  53. package/dist/index-B5IfrzOt.mjs +0 -63
  54. package/dist/index-BcxeqvFF.mjs +0 -505
  55. package/dist/index-BoT8a4D9.mjs +0 -480
  56. package/dist/index-BzsE8aZb.mjs +0 -280
  57. package/dist/index-CKu3Vm7Y.mjs +0 -246
  58. package/dist/index-CPi9CcGt.mjs +0 -134
  59. package/dist/index-CdarTP7Q.mjs +0 -471
  60. package/dist/index-D3kdKwxs.mjs +0 -292
  61. package/dist/index-D7uxePGV.mjs +0 -501
  62. package/dist/index-DSwTLzp1.mjs +0 -74
  63. package/dist/index-Dd9wDjLG.mjs +0 -280
  64. package/dist/index-DdnQhmYX.mjs +0 -502
  65. package/dist/index-DsmvLyNJ.mjs +0 -93
  66. package/dist/index-VD2Oa87u.mjs +0 -280
  67. package/dist/index.vue_vue_type_script_setup_true_lang-BUTwLlja.mjs +0 -55
  68. package/dist/moment-CMYwqyVT.mjs +0 -2579
  69. package/dist/profile-Blgfj6Pw.mjs +0 -262
  70. package/dist/runAs.vue_vue_type_script_setup_true_lang-xOMc-WaC.mjs +0 -114
@@ -1,1313 +0,0 @@
1
- import { reactive as _, defineComponent as H, inject as V, h as G, renderSlot as Se, provide as Q, ref as w, getCurrentInstance as me, watch as S, nextTick as R, resolveComponent as I, withDirectives as he, openBlock as A, createElementBlock as j, normalizeClass as T, withModifiers as L, createElementVNode as ue, normalizeStyle as Pe, createBlock as P, withCtx as ie, resolveDynamicComponent as je, createCommentVNode as J, createVNode as le, Fragment as xe, renderList as Ae, vShow as fe, shallowRef as Ee, onMounted as Oe, onUpdated as Fe, computed as B, toDisplayString as Ve, toRefs as Te } from "vue";
2
- import { j as ye, V as Re, u as U, _ as se, K as ce, J as He, b1 as Ue, E as We, ck as Ye, z as Je, cl as Ge, ag as Le, g as Qe, aD as Xe, A as M, i as Ze, k as _e, c3 as et, cm as re, at as pe, U as ee, as as De, ca as tt, cn as nt, co as ot } from "./index-C_arFWKZ.mjs";
3
- import { _ as dt } from "./index-BB9i38wB.mjs";
4
- const F = "$treeNodeId", we = function(e, t) {
5
- !t || t[F] || Object.defineProperty(t, F, {
6
- value: e.id,
7
- enumerable: !1,
8
- configurable: !1,
9
- writable: !1
10
- });
11
- }, be = function(e, t) {
12
- return e ? t[e] : t[F];
13
- }, ge = (e, t, o) => {
14
- const d = e.value.currentNode;
15
- o();
16
- const n = e.value.currentNode;
17
- d !== n && t("current-change", n ? n.data : null, n);
18
- }, Ne = (e) => {
19
- let t = !0, o = !0, d = !0;
20
- for (let n = 0, r = e.length; n < r; n++) {
21
- const l = e[n];
22
- (l.checked !== !0 || l.indeterminate) && (t = !1, l.disabled || (d = !1)), (l.checked !== !1 || l.indeterminate) && (o = !1);
23
- }
24
- return { all: t, none: o, allWithoutDisable: d, half: !t && !o };
25
- }, te = function(e) {
26
- if (e.childNodes.length === 0 || e.loading)
27
- return;
28
- const { all: t, none: o, half: d } = Ne(e.childNodes);
29
- t ? (e.checked = !0, e.indeterminate = !1) : d ? (e.checked = !1, e.indeterminate = !0) : o && (e.checked = !1, e.indeterminate = !1);
30
- const n = e.parent;
31
- !n || n.level === 0 || e.store.checkStrictly || te(n);
32
- }, Z = function(e, t) {
33
- const o = e.store.props, d = e.data || {}, n = o[t];
34
- if (typeof n == "function")
35
- return n(d, e);
36
- if (typeof n == "string")
37
- return d[n];
38
- if (typeof n > "u") {
39
- const r = d[t];
40
- return r === void 0 ? "" : r;
41
- }
42
- };
43
- let rt = 0;
44
- class $ {
45
- constructor(t) {
46
- this.id = rt++, this.text = null, this.checked = !1, this.indeterminate = !1, this.data = null, this.expanded = !1, this.parent = null, this.visible = !0, this.isCurrent = !1, this.canFocus = !1;
47
- for (const o in t)
48
- ye(t, o) && (this[o] = t[o]);
49
- this.level = 0, this.loaded = !1, this.childNodes = [], this.loading = !1, this.parent && (this.level = this.parent.level + 1);
50
- }
51
- initialize() {
52
- const t = this.store;
53
- if (!t)
54
- throw new Error("[Node]store is required!");
55
- t.registerNode(this);
56
- const o = t.props;
57
- if (o && typeof o.isLeaf < "u") {
58
- const r = Z(this, "isLeaf");
59
- typeof r == "boolean" && (this.isLeafByUser = r);
60
- }
61
- if (t.lazy !== !0 && this.data ? (this.setData(this.data), t.defaultExpandAll && (this.expanded = !0, this.canFocus = !0)) : this.level > 0 && t.lazy && t.defaultExpandAll && this.expand(), Array.isArray(this.data) || we(this, this.data), !this.data)
62
- return;
63
- const d = t.defaultExpandedKeys, n = t.key;
64
- n && d && d.includes(this.key) && this.expand(null, t.autoExpandParent), n && t.currentNodeKey !== void 0 && this.key === t.currentNodeKey && (t.currentNode = this, t.currentNode.isCurrent = !0), t.lazy && t._initDefaultCheckedNode(this), this.updateLeafState(), this.parent && (this.level === 1 || this.parent.expanded === !0) && (this.canFocus = !0);
65
- }
66
- setData(t) {
67
- Array.isArray(t) || we(this, t), this.data = t, this.childNodes = [];
68
- let o;
69
- this.level === 0 && Array.isArray(this.data) ? o = this.data : o = Z(this, "children") || [];
70
- for (let d = 0, n = o.length; d < n; d++)
71
- this.insertChild({ data: o[d] });
72
- }
73
- get label() {
74
- return Z(this, "label");
75
- }
76
- get key() {
77
- const t = this.store.key;
78
- return this.data ? this.data[t] : null;
79
- }
80
- get disabled() {
81
- return Z(this, "disabled");
82
- }
83
- get nextSibling() {
84
- const t = this.parent;
85
- if (t) {
86
- const o = t.childNodes.indexOf(this);
87
- if (o > -1)
88
- return t.childNodes[o + 1];
89
- }
90
- return null;
91
- }
92
- get previousSibling() {
93
- const t = this.parent;
94
- if (t) {
95
- const o = t.childNodes.indexOf(this);
96
- if (o > -1)
97
- return o > 0 ? t.childNodes[o - 1] : null;
98
- }
99
- return null;
100
- }
101
- contains(t, o = !0) {
102
- return (this.childNodes || []).some((d) => d === t || o && d.contains(t));
103
- }
104
- remove() {
105
- const t = this.parent;
106
- t && t.removeChild(this);
107
- }
108
- insertChild(t, o, d) {
109
- if (!t)
110
- throw new Error("InsertChild error: child is required.");
111
- if (!(t instanceof $)) {
112
- if (!d) {
113
- const n = this.getChildren(!0);
114
- n.includes(t.data) || (typeof o > "u" || o < 0 ? n.push(t.data) : n.splice(o, 0, t.data));
115
- }
116
- Object.assign(t, {
117
- parent: this,
118
- store: this.store
119
- }), t = _(new $(t)), t instanceof $ && t.initialize();
120
- }
121
- t.level = this.level + 1, typeof o > "u" || o < 0 ? this.childNodes.push(t) : this.childNodes.splice(o, 0, t), this.updateLeafState();
122
- }
123
- insertBefore(t, o) {
124
- let d;
125
- o && (d = this.childNodes.indexOf(o)), this.insertChild(t, d);
126
- }
127
- insertAfter(t, o) {
128
- let d;
129
- o && (d = this.childNodes.indexOf(o), d !== -1 && (d += 1)), this.insertChild(t, d);
130
- }
131
- removeChild(t) {
132
- const o = this.getChildren() || [], d = o.indexOf(t.data);
133
- d > -1 && o.splice(d, 1);
134
- const n = this.childNodes.indexOf(t);
135
- n > -1 && (this.store && this.store.deregisterNode(t), t.parent = null, this.childNodes.splice(n, 1)), this.updateLeafState();
136
- }
137
- removeChildByData(t) {
138
- let o = null;
139
- for (let d = 0; d < this.childNodes.length; d++)
140
- if (this.childNodes[d].data === t) {
141
- o = this.childNodes[d];
142
- break;
143
- }
144
- o && this.removeChild(o);
145
- }
146
- expand(t, o) {
147
- const d = () => {
148
- if (o) {
149
- let n = this.parent;
150
- for (; n.level > 0; )
151
- n.expanded = !0, n = n.parent;
152
- }
153
- this.expanded = !0, t && t(), this.childNodes.forEach((n) => {
154
- n.canFocus = !0;
155
- });
156
- };
157
- this.shouldLoadData() ? this.loadData((n) => {
158
- Array.isArray(n) && (this.checked ? this.setChecked(!0, !0) : this.store.checkStrictly || te(this), d());
159
- }) : d();
160
- }
161
- doCreateChildren(t, o = {}) {
162
- t.forEach((d) => {
163
- this.insertChild(Object.assign({ data: d }, o), void 0, !0);
164
- });
165
- }
166
- collapse() {
167
- this.expanded = !1, this.childNodes.forEach((t) => {
168
- t.canFocus = !1;
169
- });
170
- }
171
- shouldLoadData() {
172
- return this.store.lazy === !0 && this.store.load && !this.loaded;
173
- }
174
- updateLeafState() {
175
- if (this.store.lazy === !0 && this.loaded !== !0 && typeof this.isLeafByUser < "u") {
176
- this.isLeaf = this.isLeafByUser;
177
- return;
178
- }
179
- const t = this.childNodes;
180
- if (!this.store.lazy || this.store.lazy === !0 && this.loaded === !0) {
181
- this.isLeaf = !t || t.length === 0;
182
- return;
183
- }
184
- this.isLeaf = !1;
185
- }
186
- setChecked(t, o, d, n) {
187
- if (this.indeterminate = t === "half", this.checked = t === !0, this.store.checkStrictly)
188
- return;
189
- if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
190
- const { all: l, allWithoutDisable: c } = Ne(this.childNodes);
191
- !this.isLeaf && !l && c && (this.checked = !1, t = !1);
192
- const i = () => {
193
- if (o) {
194
- const g = this.childNodes;
195
- for (let s = 0, f = g.length; s < f; s++) {
196
- const y = g[s];
197
- n = n || t !== !1;
198
- const C = y.disabled ? y.checked : n;
199
- y.setChecked(C, o, !0, n);
200
- }
201
- const { half: u, all: a } = Ne(g);
202
- a || (this.checked = a, this.indeterminate = u);
203
- }
204
- };
205
- if (this.shouldLoadData()) {
206
- this.loadData(() => {
207
- i(), te(this);
208
- }, {
209
- checked: t !== !1
210
- });
211
- return;
212
- } else
213
- i();
214
- }
215
- const r = this.parent;
216
- !r || r.level === 0 || d || te(r);
217
- }
218
- getChildren(t = !1) {
219
- if (this.level === 0)
220
- return this.data;
221
- const o = this.data;
222
- if (!o)
223
- return null;
224
- const d = this.store.props;
225
- let n = "children";
226
- return d && (n = d.children || "children"), o[n] === void 0 && (o[n] = null), t && !o[n] && (o[n] = []), o[n];
227
- }
228
- updateChildren() {
229
- const t = this.getChildren() || [], o = this.childNodes.map((r) => r.data), d = {}, n = [];
230
- t.forEach((r, l) => {
231
- const c = r[F];
232
- !!c && o.findIndex((g) => g[F] === c) >= 0 ? d[c] = { index: l, data: r } : n.push({ index: l, data: r });
233
- }), this.store.lazy || o.forEach((r) => {
234
- d[r[F]] || this.removeChildByData(r);
235
- }), n.forEach(({ index: r, data: l }) => {
236
- this.insertChild({ data: l }, r);
237
- }), this.updateLeafState();
238
- }
239
- loadData(t, o = {}) {
240
- if (this.store.lazy === !0 && this.store.load && !this.loaded && (!this.loading || Object.keys(o).length)) {
241
- this.loading = !0;
242
- const d = (n) => {
243
- this.childNodes = [], this.doCreateChildren(n, o), this.loaded = !0, this.loading = !1, this.updateLeafState(), t && t.call(this, n);
244
- };
245
- this.store.load(this, d);
246
- } else
247
- t && t.call(this);
248
- }
249
- }
250
- class st {
251
- constructor(t) {
252
- this.currentNode = null, this.currentNodeKey = null;
253
- for (const o in t)
254
- ye(t, o) && (this[o] = t[o]);
255
- this.nodesMap = {};
256
- }
257
- initialize() {
258
- if (this.root = new $({
259
- data: this.data,
260
- store: this
261
- }), this.root.initialize(), this.lazy && this.load) {
262
- const t = this.load;
263
- t(this.root, (o) => {
264
- this.root.doCreateChildren(o), this._initDefaultCheckedNodes();
265
- });
266
- } else
267
- this._initDefaultCheckedNodes();
268
- }
269
- filter(t) {
270
- const o = this.filterNodeMethod, d = this.lazy, n = function(r) {
271
- const l = r.root ? r.root.childNodes : r.childNodes;
272
- if (l.forEach((c) => {
273
- c.visible = o.call(c, t, c.data, c), n(c);
274
- }), !r.visible && l.length) {
275
- let c = !0;
276
- c = !l.some((i) => i.visible), r.root ? r.root.visible = c === !1 : r.visible = c === !1;
277
- }
278
- t && r.visible && !r.isLeaf && (!d || r.loaded) && r.expand();
279
- };
280
- n(this);
281
- }
282
- setData(t) {
283
- t !== this.root.data ? (this.root.setData(t), this._initDefaultCheckedNodes()) : this.root.updateChildren();
284
- }
285
- getNode(t) {
286
- if (t instanceof $)
287
- return t;
288
- const o = Re(t) ? be(this.key, t) : t;
289
- return this.nodesMap[o] || null;
290
- }
291
- insertBefore(t, o) {
292
- const d = this.getNode(o);
293
- d.parent.insertBefore({ data: t }, d);
294
- }
295
- insertAfter(t, o) {
296
- const d = this.getNode(o);
297
- d.parent.insertAfter({ data: t }, d);
298
- }
299
- remove(t) {
300
- const o = this.getNode(t);
301
- o && o.parent && (o === this.currentNode && (this.currentNode = null), o.parent.removeChild(o));
302
- }
303
- append(t, o) {
304
- const d = o ? this.getNode(o) : this.root;
305
- d && d.insertChild({ data: t });
306
- }
307
- _initDefaultCheckedNodes() {
308
- const t = this.defaultCheckedKeys || [], o = this.nodesMap;
309
- t.forEach((d) => {
310
- const n = o[d];
311
- n && n.setChecked(!0, !this.checkStrictly);
312
- });
313
- }
314
- _initDefaultCheckedNode(t) {
315
- (this.defaultCheckedKeys || []).includes(t.key) && t.setChecked(!0, !this.checkStrictly);
316
- }
317
- setDefaultCheckedKey(t) {
318
- t !== this.defaultCheckedKeys && (this.defaultCheckedKeys = t, this._initDefaultCheckedNodes());
319
- }
320
- registerNode(t) {
321
- const o = this.key;
322
- !t || !t.data || (o ? t.key !== void 0 && (this.nodesMap[t.key] = t) : this.nodesMap[t.id] = t);
323
- }
324
- deregisterNode(t) {
325
- !this.key || !t || !t.data || (t.childNodes.forEach((d) => {
326
- this.deregisterNode(d);
327
- }), delete this.nodesMap[t.key]);
328
- }
329
- getCheckedNodes(t = !1, o = !1) {
330
- const d = [], n = function(r) {
331
- (r.root ? r.root.childNodes : r.childNodes).forEach((c) => {
332
- (c.checked || o && c.indeterminate) && (!t || t && c.isLeaf) && d.push(c.data), n(c);
333
- });
334
- };
335
- return n(this), d;
336
- }
337
- getCheckedKeys(t = !1) {
338
- return this.getCheckedNodes(t).map((o) => (o || {})[this.key]);
339
- }
340
- getHalfCheckedNodes() {
341
- const t = [], o = function(d) {
342
- (d.root ? d.root.childNodes : d.childNodes).forEach((r) => {
343
- r.indeterminate && t.push(r.data), o(r);
344
- });
345
- };
346
- return o(this), t;
347
- }
348
- getHalfCheckedKeys() {
349
- return this.getHalfCheckedNodes().map((t) => (t || {})[this.key]);
350
- }
351
- _getAllNodes() {
352
- const t = [], o = this.nodesMap;
353
- for (const d in o)
354
- ye(o, d) && t.push(o[d]);
355
- return t;
356
- }
357
- updateChildren(t, o) {
358
- const d = this.nodesMap[t];
359
- if (!d)
360
- return;
361
- const n = d.childNodes;
362
- for (let r = n.length - 1; r >= 0; r--) {
363
- const l = n[r];
364
- this.remove(l.data);
365
- }
366
- for (let r = 0, l = o.length; r < l; r++) {
367
- const c = o[r];
368
- this.append(c, d.data);
369
- }
370
- }
371
- _setCheckedKeys(t, o = !1, d) {
372
- const n = this._getAllNodes().sort((i, g) => i.level - g.level), r = /* @__PURE__ */ Object.create(null), l = Object.keys(d);
373
- n.forEach((i) => i.setChecked(!1, !1));
374
- const c = (i) => {
375
- i.childNodes.forEach((g) => {
376
- var u;
377
- r[g.data[t]] = !0, (u = g.childNodes) != null && u.length && c(g);
378
- });
379
- };
380
- for (let i = 0, g = n.length; i < g; i++) {
381
- const u = n[i], a = u.data[t].toString();
382
- if (!l.includes(a)) {
383
- u.checked && !r[a] && u.setChecked(!1, !1);
384
- continue;
385
- }
386
- if (u.childNodes.length && c(u), u.isLeaf || this.checkStrictly) {
387
- u.setChecked(!0, !1);
388
- continue;
389
- }
390
- if (u.setChecked(!0, !0), o) {
391
- u.setChecked(!1, !1);
392
- const f = function(y) {
393
- y.childNodes.forEach((k) => {
394
- k.isLeaf || k.setChecked(!1, !1), f(k);
395
- });
396
- };
397
- f(u);
398
- }
399
- }
400
- }
401
- setCheckedNodes(t, o = !1) {
402
- const d = this.key, n = {};
403
- t.forEach((r) => {
404
- n[(r || {})[d]] = !0;
405
- }), this._setCheckedKeys(d, o, n);
406
- }
407
- setCheckedKeys(t, o = !1) {
408
- this.defaultCheckedKeys = t;
409
- const d = this.key, n = {};
410
- t.forEach((r) => {
411
- n[r] = !0;
412
- }), this._setCheckedKeys(d, o, n);
413
- }
414
- setDefaultExpandedKeys(t) {
415
- t = t || [], this.defaultExpandedKeys = t, t.forEach((o) => {
416
- const d = this.getNode(o);
417
- d && d.expand(null, this.autoExpandParent);
418
- });
419
- }
420
- setChecked(t, o, d) {
421
- const n = this.getNode(t);
422
- n && n.setChecked(!!o, d);
423
- }
424
- getCurrentNode() {
425
- return this.currentNode;
426
- }
427
- setCurrentNode(t) {
428
- const o = this.currentNode;
429
- o && (o.isCurrent = !1), this.currentNode = t, this.currentNode.isCurrent = !0;
430
- }
431
- setUserCurrentNode(t, o = !0) {
432
- const d = t[this.key], n = this.nodesMap[d];
433
- this.setCurrentNode(n), o && this.currentNode.level > 1 && this.currentNode.parent.expand(null, !0);
434
- }
435
- setCurrentNodeKey(t, o = !0) {
436
- if (t == null) {
437
- this.currentNode && (this.currentNode.isCurrent = !1), this.currentNode = null;
438
- return;
439
- }
440
- const d = this.getNode(t);
441
- d && (this.setCurrentNode(d), o && this.currentNode.level > 1 && this.currentNode.parent.expand(null, !0));
442
- }
443
- }
444
- const at = H({
445
- name: "ElTreeNodeContent",
446
- props: {
447
- node: {
448
- type: Object,
449
- required: !0
450
- },
451
- renderContent: Function
452
- },
453
- setup(e) {
454
- const t = U("tree"), o = V("NodeInstance"), d = V("RootTree");
455
- return () => {
456
- const n = e.node, { data: r, store: l } = n;
457
- return e.renderContent ? e.renderContent(G, { _self: o, node: n, data: r, store: l }) : Se(d.ctx.slots, "default", { node: n, data: r }, () => [
458
- G("span", { class: t.be("node", "label") }, [n.label])
459
- ]);
460
- };
461
- }
462
- });
463
- var it = /* @__PURE__ */ se(at, [["__file", "tree-node-content.vue"]]);
464
- function Me(e) {
465
- const t = V("TreeNodeMap", null), o = {
466
- treeNodeExpand: (d) => {
467
- e.node !== d && e.node.collapse();
468
- },
469
- children: []
470
- };
471
- return t && t.children.push(o), Q("TreeNodeMap", o), {
472
- broadcastExpanded: (d) => {
473
- if (e.accordion)
474
- for (const n of o.children)
475
- n.treeNodeExpand(d);
476
- }
477
- };
478
- }
479
- const Ie = Symbol("dragEvents");
480
- function lt({ props: e, ctx: t, el$: o, dropIndicator$: d, store: n }) {
481
- const r = U("tree"), l = w({
482
- showDropIndicator: !1,
483
- draggingNode: null,
484
- dropNode: null,
485
- allowDrop: !0,
486
- dropType: null
487
- });
488
- return Q(Ie, {
489
- treeNodeDragStart: ({ event: u, treeNode: a }) => {
490
- if (typeof e.allowDrag == "function" && !e.allowDrag(a.node))
491
- return u.preventDefault(), !1;
492
- u.dataTransfer.effectAllowed = "move";
493
- try {
494
- u.dataTransfer.setData("text/plain", "");
495
- } catch {
496
- }
497
- l.value.draggingNode = a, t.emit("node-drag-start", a.node, u);
498
- },
499
- treeNodeDragOver: ({ event: u, treeNode: a }) => {
500
- const s = a, f = l.value.dropNode;
501
- f && f.node.id !== s.node.id && ce(f.$el, r.is("drop-inner"));
502
- const y = l.value.draggingNode;
503
- if (!y || !s)
504
- return;
505
- let C = !0, k = !0, m = !0, x = !0;
506
- typeof e.allowDrop == "function" && (C = e.allowDrop(y.node, s.node, "prev"), x = k = e.allowDrop(y.node, s.node, "inner"), m = e.allowDrop(y.node, s.node, "next")), u.dataTransfer.dropEffect = k || C || m ? "move" : "none", (C || k || m) && (f == null ? void 0 : f.node.id) !== s.node.id && (f && t.emit("node-drag-leave", y.node, f.node, u), t.emit("node-drag-enter", y.node, s.node, u)), C || k || m ? l.value.dropNode = s : l.value.dropNode = null, s.node.nextSibling === y.node && (m = !1), s.node.previousSibling === y.node && (C = !1), s.node.contains(y.node, !1) && (k = !1), (y.node === s.node || y.node.contains(s.node)) && (C = !1, k = !1, m = !1);
507
- const v = s.$el.querySelector(`.${r.be("node", "content")}`).getBoundingClientRect(), O = o.value.getBoundingClientRect();
508
- let E;
509
- const D = C ? k ? 0.25 : m ? 0.45 : 1 : -1, X = m ? k ? 0.75 : C ? 0.55 : 0 : 1;
510
- let z = -9999;
511
- const p = u.clientY - v.top;
512
- p < v.height * D ? E = "before" : p > v.height * X ? E = "after" : k ? E = "inner" : E = "none";
513
- const b = s.$el.querySelector(`.${r.be("node", "expand-icon")}`).getBoundingClientRect(), K = d.value;
514
- E === "before" ? z = b.top - O.top : E === "after" && (z = b.bottom - O.top), K.style.top = `${z}px`, K.style.left = `${b.right - O.left}px`, E === "inner" ? He(s.$el, r.is("drop-inner")) : ce(s.$el, r.is("drop-inner")), l.value.showDropIndicator = E === "before" || E === "after", l.value.allowDrop = l.value.showDropIndicator || x, l.value.dropType = E, t.emit("node-drag-over", y.node, s.node, u);
515
- },
516
- treeNodeDragEnd: (u) => {
517
- const { draggingNode: a, dropType: s, dropNode: f } = l.value;
518
- if (u.preventDefault(), u.dataTransfer.dropEffect = "move", a && f) {
519
- const y = { data: a.node.data };
520
- s !== "none" && a.node.remove(), s === "before" ? f.node.parent.insertBefore(y, f.node) : s === "after" ? f.node.parent.insertAfter(y, f.node) : s === "inner" && f.node.insertChild(y), s !== "none" && n.value.registerNode(y), ce(f.$el, r.is("drop-inner")), t.emit("node-drag-end", a.node, f.node, s, u), s !== "none" && t.emit("node-drop", a.node, f.node, s, u);
521
- }
522
- a && !f && t.emit("node-drag-end", a.node, null, s, u), l.value.showDropIndicator = !1, l.value.draggingNode = null, l.value.dropNode = null, l.value.allowDrop = !0;
523
- }
524
- }), {
525
- dragState: l
526
- };
527
- }
528
- const ct = H({
529
- name: "ElTreeNode",
530
- components: {
531
- ElCollapseTransition: dt,
532
- ElCheckbox: Ue,
533
- NodeContent: it,
534
- ElIcon: We,
535
- Loading: Ye
536
- },
537
- props: {
538
- node: {
539
- type: $,
540
- default: () => ({})
541
- },
542
- props: {
543
- type: Object,
544
- default: () => ({})
545
- },
546
- accordion: Boolean,
547
- renderContent: Function,
548
- renderAfterExpand: Boolean,
549
- showCheckbox: {
550
- type: Boolean,
551
- default: !1
552
- }
553
- },
554
- emits: ["node-expand"],
555
- setup(e, t) {
556
- const o = U("tree"), { broadcastExpanded: d } = Me(e), n = V("RootTree"), r = w(!1), l = w(!1), c = w(null), i = w(null), g = w(null), u = V(Ie), a = me();
557
- Q("NodeInstance", a), n || Je("Tree", "Can not find node's tree."), e.node.expanded && (r.value = !0, l.value = !0);
558
- const s = n.props.props.children || "children";
559
- S(() => {
560
- const p = e.node.data[s];
561
- return p && [...p];
562
- }, () => {
563
- e.node.updateChildren();
564
- }), S(() => e.node.indeterminate, (p) => {
565
- C(e.node.checked, p);
566
- }), S(() => e.node.checked, (p) => {
567
- C(p, e.node.indeterminate);
568
- }), S(() => e.node.expanded, (p) => {
569
- R(() => r.value = p), p && (l.value = !0);
570
- });
571
- const f = (p) => be(n.props.nodeKey, p.data), y = (p) => {
572
- const b = e.props.class;
573
- if (!b)
574
- return {};
575
- let K;
576
- if (Le(b)) {
577
- const { data: ae } = p;
578
- K = b(ae, p);
579
- } else
580
- K = b;
581
- return Qe(K) ? { [K]: !0 } : K;
582
- }, C = (p, b) => {
583
- (c.value !== p || i.value !== b) && n.ctx.emit("check-change", e.node.data, p, b), c.value = p, i.value = b;
584
- }, k = (p) => {
585
- ge(n.store, n.ctx.emit, () => n.store.value.setCurrentNode(e.node)), n.currentNode.value = e.node, n.props.expandOnClickNode && x(), n.props.checkOnClickNode && !e.node.disabled && v(null, {
586
- target: { checked: !e.node.checked }
587
- }), n.ctx.emit("node-click", e.node.data, e.node, a, p);
588
- }, m = (p) => {
589
- n.instance.vnode.props.onNodeContextmenu && (p.stopPropagation(), p.preventDefault()), n.ctx.emit("node-contextmenu", p, e.node.data, e.node, a);
590
- }, x = () => {
591
- e.node.isLeaf || (r.value ? (n.ctx.emit("node-collapse", e.node.data, e.node, a), e.node.collapse()) : (e.node.expand(), t.emit("node-expand", e.node.data, e.node, a)));
592
- }, v = (p, b) => {
593
- e.node.setChecked(b.target.checked, !n.props.checkStrictly), R(() => {
594
- const K = n.store.value;
595
- n.ctx.emit("check", e.node.data, {
596
- checkedNodes: K.getCheckedNodes(),
597
- checkedKeys: K.getCheckedKeys(),
598
- halfCheckedNodes: K.getHalfCheckedNodes(),
599
- halfCheckedKeys: K.getHalfCheckedKeys()
600
- });
601
- });
602
- };
603
- return {
604
- ns: o,
605
- node$: g,
606
- tree: n,
607
- expanded: r,
608
- childNodeRendered: l,
609
- oldChecked: c,
610
- oldIndeterminate: i,
611
- getNodeKey: f,
612
- getNodeClass: y,
613
- handleSelectChange: C,
614
- handleClick: k,
615
- handleContextMenu: m,
616
- handleExpandIconClick: x,
617
- handleCheckChange: v,
618
- handleChildNodeExpand: (p, b, K) => {
619
- d(b), n.ctx.emit("node-expand", p, b, K);
620
- },
621
- handleDragStart: (p) => {
622
- n.props.draggable && u.treeNodeDragStart({ event: p, treeNode: e });
623
- },
624
- handleDragOver: (p) => {
625
- p.preventDefault(), n.props.draggable && u.treeNodeDragOver({
626
- event: p,
627
- treeNode: { $el: g.value, node: e.node }
628
- });
629
- },
630
- handleDrop: (p) => {
631
- p.preventDefault();
632
- },
633
- handleDragEnd: (p) => {
634
- n.props.draggable && u.treeNodeDragEnd(p);
635
- },
636
- CaretRight: Ge
637
- };
638
- }
639
- }), ht = ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key"], ut = ["aria-expanded"];
640
- function ft(e, t, o, d, n, r) {
641
- const l = I("el-icon"), c = I("el-checkbox"), i = I("loading"), g = I("node-content"), u = I("el-tree-node"), a = I("el-collapse-transition");
642
- return he((A(), j("div", {
643
- ref: "node$",
644
- class: T([
645
- e.ns.b("node"),
646
- e.ns.is("expanded", e.expanded),
647
- e.ns.is("current", e.node.isCurrent),
648
- e.ns.is("hidden", !e.node.visible),
649
- e.ns.is("focusable", !e.node.disabled),
650
- e.ns.is("checked", !e.node.disabled && e.node.checked),
651
- e.getNodeClass(e.node)
652
- ]),
653
- role: "treeitem",
654
- tabindex: "-1",
655
- "aria-expanded": e.expanded,
656
- "aria-disabled": e.node.disabled,
657
- "aria-checked": e.node.checked,
658
- draggable: e.tree.props.draggable,
659
- "data-key": e.getNodeKey(e.node),
660
- onClick: t[1] || (t[1] = L((...s) => e.handleClick && e.handleClick(...s), ["stop"])),
661
- onContextmenu: t[2] || (t[2] = (...s) => e.handleContextMenu && e.handleContextMenu(...s)),
662
- onDragstart: t[3] || (t[3] = L((...s) => e.handleDragStart && e.handleDragStart(...s), ["stop"])),
663
- onDragover: t[4] || (t[4] = L((...s) => e.handleDragOver && e.handleDragOver(...s), ["stop"])),
664
- onDragend: t[5] || (t[5] = L((...s) => e.handleDragEnd && e.handleDragEnd(...s), ["stop"])),
665
- onDrop: t[6] || (t[6] = L((...s) => e.handleDrop && e.handleDrop(...s), ["stop"]))
666
- }, [
667
- ue("div", {
668
- class: T(e.ns.be("node", "content")),
669
- style: Pe({ paddingLeft: (e.node.level - 1) * e.tree.props.indent + "px" })
670
- }, [
671
- e.tree.props.icon || e.CaretRight ? (A(), P(l, {
672
- key: 0,
673
- class: T([
674
- e.ns.be("node", "expand-icon"),
675
- e.ns.is("leaf", e.node.isLeaf),
676
- {
677
- expanded: !e.node.isLeaf && e.expanded
678
- }
679
- ]),
680
- onClick: L(e.handleExpandIconClick, ["stop"])
681
- }, {
682
- default: ie(() => [
683
- (A(), P(je(e.tree.props.icon || e.CaretRight)))
684
- ]),
685
- _: 1
686
- }, 8, ["class", "onClick"])) : J("v-if", !0),
687
- e.showCheckbox ? (A(), P(c, {
688
- key: 1,
689
- "model-value": e.node.checked,
690
- indeterminate: e.node.indeterminate,
691
- disabled: !!e.node.disabled,
692
- onClick: t[0] || (t[0] = L(() => {
693
- }, ["stop"])),
694
- onChange: e.handleCheckChange
695
- }, null, 8, ["model-value", "indeterminate", "disabled", "onChange"])) : J("v-if", !0),
696
- e.node.loading ? (A(), P(l, {
697
- key: 2,
698
- class: T([e.ns.be("node", "loading-icon"), e.ns.is("loading")])
699
- }, {
700
- default: ie(() => [
701
- le(i)
702
- ]),
703
- _: 1
704
- }, 8, ["class"])) : J("v-if", !0),
705
- le(g, {
706
- node: e.node,
707
- "render-content": e.renderContent
708
- }, null, 8, ["node", "render-content"])
709
- ], 6),
710
- le(a, null, {
711
- default: ie(() => [
712
- !e.renderAfterExpand || e.childNodeRendered ? he((A(), j("div", {
713
- key: 0,
714
- class: T(e.ns.be("node", "children")),
715
- role: "group",
716
- "aria-expanded": e.expanded
717
- }, [
718
- (A(!0), j(xe, null, Ae(e.node.childNodes, (s) => (A(), P(u, {
719
- key: e.getNodeKey(s),
720
- "render-content": e.renderContent,
721
- "render-after-expand": e.renderAfterExpand,
722
- "show-checkbox": e.showCheckbox,
723
- node: s,
724
- accordion: e.accordion,
725
- props: e.props,
726
- onNodeExpand: e.handleChildNodeExpand
727
- }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]))), 128))
728
- ], 10, ut)), [
729
- [fe, e.expanded]
730
- ]) : J("v-if", !0)
731
- ]),
732
- _: 1
733
- })
734
- ], 42, ht)), [
735
- [fe, e.node.visible]
736
- ]);
737
- }
738
- var yt = /* @__PURE__ */ se(ct, [["render", ft], ["__file", "tree-node.vue"]]);
739
- function pt({ el$: e }, t) {
740
- const o = U("tree"), d = Ee([]), n = Ee([]);
741
- Oe(() => {
742
- l();
743
- }), Fe(() => {
744
- d.value = Array.from(e.value.querySelectorAll("[role=treeitem]")), n.value = Array.from(e.value.querySelectorAll("input[type=checkbox]"));
745
- }), S(n, (c) => {
746
- c.forEach((i) => {
747
- i.setAttribute("tabindex", "-1");
748
- });
749
- }), Xe(e, "keydown", (c) => {
750
- const i = c.target;
751
- if (!i.className.includes(o.b("node")))
752
- return;
753
- const g = c.code;
754
- d.value = Array.from(e.value.querySelectorAll(`.${o.is("focusable")}[role=treeitem]`));
755
- const u = d.value.indexOf(i);
756
- let a;
757
- if ([M.up, M.down].includes(g)) {
758
- if (c.preventDefault(), g === M.up) {
759
- a = u === -1 ? 0 : u !== 0 ? u - 1 : d.value.length - 1;
760
- const f = a;
761
- for (; !t.value.getNode(d.value[a].dataset.key).canFocus; ) {
762
- if (a--, a === f) {
763
- a = -1;
764
- break;
765
- }
766
- a < 0 && (a = d.value.length - 1);
767
- }
768
- } else {
769
- a = u === -1 ? 0 : u < d.value.length - 1 ? u + 1 : 0;
770
- const f = a;
771
- for (; !t.value.getNode(d.value[a].dataset.key).canFocus; ) {
772
- if (a++, a === f) {
773
- a = -1;
774
- break;
775
- }
776
- a >= d.value.length && (a = 0);
777
- }
778
- }
779
- a !== -1 && d.value[a].focus();
780
- }
781
- [M.left, M.right].includes(g) && (c.preventDefault(), i.click());
782
- const s = i.querySelector('[type="checkbox"]');
783
- [M.enter, M.space].includes(g) && s && (c.preventDefault(), s.click());
784
- });
785
- const l = () => {
786
- var c;
787
- d.value = Array.from(e.value.querySelectorAll(`.${o.is("focusable")}[role=treeitem]`)), n.value = Array.from(e.value.querySelectorAll("input[type=checkbox]"));
788
- const i = e.value.querySelectorAll(`.${o.is("checked")}[role=treeitem]`);
789
- if (i.length) {
790
- i[0].setAttribute("tabindex", "0");
791
- return;
792
- }
793
- (c = d.value[0]) == null || c.setAttribute("tabindex", "0");
794
- };
795
- }
796
- const gt = H({
797
- name: "ElTree",
798
- components: { ElTreeNode: yt },
799
- props: {
800
- data: {
801
- type: Array,
802
- default: () => []
803
- },
804
- emptyText: {
805
- type: String
806
- },
807
- renderAfterExpand: {
808
- type: Boolean,
809
- default: !0
810
- },
811
- nodeKey: String,
812
- checkStrictly: Boolean,
813
- defaultExpandAll: Boolean,
814
- expandOnClickNode: {
815
- type: Boolean,
816
- default: !0
817
- },
818
- checkOnClickNode: Boolean,
819
- checkDescendants: {
820
- type: Boolean,
821
- default: !1
822
- },
823
- autoExpandParent: {
824
- type: Boolean,
825
- default: !0
826
- },
827
- defaultCheckedKeys: Array,
828
- defaultExpandedKeys: Array,
829
- currentNodeKey: [String, Number],
830
- renderContent: Function,
831
- showCheckbox: {
832
- type: Boolean,
833
- default: !1
834
- },
835
- draggable: {
836
- type: Boolean,
837
- default: !1
838
- },
839
- allowDrag: Function,
840
- allowDrop: Function,
841
- props: {
842
- type: Object,
843
- default: () => ({
844
- children: "children",
845
- label: "label",
846
- disabled: "disabled"
847
- })
848
- },
849
- lazy: {
850
- type: Boolean,
851
- default: !1
852
- },
853
- highlightCurrent: Boolean,
854
- load: Function,
855
- filterNodeMethod: Function,
856
- accordion: Boolean,
857
- indent: {
858
- type: Number,
859
- default: 18
860
- },
861
- icon: {
862
- type: Ze
863
- }
864
- },
865
- emits: [
866
- "check-change",
867
- "current-change",
868
- "node-click",
869
- "node-contextmenu",
870
- "node-collapse",
871
- "node-expand",
872
- "check",
873
- "node-drag-start",
874
- "node-drag-end",
875
- "node-drop",
876
- "node-drag-leave",
877
- "node-drag-enter",
878
- "node-drag-over"
879
- ],
880
- setup(e, t) {
881
- const { t: o } = _e(), d = U("tree"), n = w(new st({
882
- key: e.nodeKey,
883
- data: e.data,
884
- lazy: e.lazy,
885
- props: e.props,
886
- load: e.load,
887
- currentNodeKey: e.currentNodeKey,
888
- checkStrictly: e.checkStrictly,
889
- checkDescendants: e.checkDescendants,
890
- defaultCheckedKeys: e.defaultCheckedKeys,
891
- defaultExpandedKeys: e.defaultExpandedKeys,
892
- autoExpandParent: e.autoExpandParent,
893
- defaultExpandAll: e.defaultExpandAll,
894
- filterNodeMethod: e.filterNodeMethod
895
- }));
896
- n.value.initialize();
897
- const r = w(n.value.root), l = w(null), c = w(null), i = w(null), { broadcastExpanded: g } = Me(e), { dragState: u } = lt({
898
- props: e,
899
- ctx: t,
900
- el$: c,
901
- dropIndicator$: i,
902
- store: n
903
- });
904
- pt({ el$: c }, n);
905
- const a = B(() => {
906
- const { childNodes: h } = r.value;
907
- return !h || h.length === 0 || h.every(({ visible: N }) => !N);
908
- });
909
- S(() => e.currentNodeKey, (h) => {
910
- n.value.setCurrentNodeKey(h);
911
- }), S(() => e.defaultCheckedKeys, (h) => {
912
- n.value.setDefaultCheckedKey(h);
913
- }), S(() => e.defaultExpandedKeys, (h) => {
914
- n.value.setDefaultExpandedKeys(h);
915
- }), S(() => e.data, (h) => {
916
- n.value.setData(h);
917
- }, { deep: !0 }), S(() => e.checkStrictly, (h) => {
918
- n.value.checkStrictly = h;
919
- });
920
- const s = (h) => {
921
- if (!e.filterNodeMethod)
922
- throw new Error("[Tree] filterNodeMethod is required when filter");
923
- n.value.filter(h);
924
- }, f = (h) => be(e.nodeKey, h.data), y = (h) => {
925
- if (!e.nodeKey)
926
- throw new Error("[Tree] nodeKey is required in getNodePath");
927
- const N = n.value.getNode(h);
928
- if (!N)
929
- return [];
930
- const q = [N.data];
931
- let W = N.parent;
932
- for (; W && W !== r.value; )
933
- q.push(W.data), W = W.parent;
934
- return q.reverse();
935
- }, C = (h, N) => n.value.getCheckedNodes(h, N), k = (h) => n.value.getCheckedKeys(h), m = () => {
936
- const h = n.value.getCurrentNode();
937
- return h ? h.data : null;
938
- }, x = () => {
939
- if (!e.nodeKey)
940
- throw new Error("[Tree] nodeKey is required in getCurrentKey");
941
- const h = m();
942
- return h ? h[e.nodeKey] : null;
943
- }, v = (h, N) => {
944
- if (!e.nodeKey)
945
- throw new Error("[Tree] nodeKey is required in setCheckedNodes");
946
- n.value.setCheckedNodes(h, N);
947
- }, O = (h, N) => {
948
- if (!e.nodeKey)
949
- throw new Error("[Tree] nodeKey is required in setCheckedKeys");
950
- n.value.setCheckedKeys(h, N);
951
- }, E = (h, N, q) => {
952
- n.value.setChecked(h, N, q);
953
- }, D = () => n.value.getHalfCheckedNodes(), X = () => n.value.getHalfCheckedKeys(), z = (h, N = !0) => {
954
- if (!e.nodeKey)
955
- throw new Error("[Tree] nodeKey is required in setCurrentNode");
956
- ge(n, t.emit, () => n.value.setUserCurrentNode(h, N));
957
- }, p = (h, N = !0) => {
958
- if (!e.nodeKey)
959
- throw new Error("[Tree] nodeKey is required in setCurrentKey");
960
- ge(n, t.emit, () => n.value.setCurrentNodeKey(h, N));
961
- }, b = (h) => n.value.getNode(h), K = (h) => {
962
- n.value.remove(h);
963
- }, ae = (h, N) => {
964
- n.value.append(h, N);
965
- }, Be = (h, N) => {
966
- n.value.insertBefore(h, N);
967
- }, $e = (h, N) => {
968
- n.value.insertAfter(h, N);
969
- }, ze = (h, N, q) => {
970
- g(N), t.emit("node-expand", h, N, q);
971
- }, qe = (h, N) => {
972
- if (!e.nodeKey)
973
- throw new Error("[Tree] nodeKey is required in updateKeyChild");
974
- n.value.updateChildren(h, N);
975
- };
976
- return Q("RootTree", {
977
- ctx: t,
978
- props: e,
979
- store: n,
980
- root: r,
981
- currentNode: l,
982
- instance: me()
983
- }), Q(et, void 0), {
984
- ns: d,
985
- store: n,
986
- root: r,
987
- currentNode: l,
988
- dragState: u,
989
- el$: c,
990
- dropIndicator$: i,
991
- isEmpty: a,
992
- filter: s,
993
- getNodeKey: f,
994
- getNodePath: y,
995
- getCheckedNodes: C,
996
- getCheckedKeys: k,
997
- getCurrentNode: m,
998
- getCurrentKey: x,
999
- setCheckedNodes: v,
1000
- setCheckedKeys: O,
1001
- setChecked: E,
1002
- getHalfCheckedNodes: D,
1003
- getHalfCheckedKeys: X,
1004
- setCurrentNode: z,
1005
- setCurrentKey: p,
1006
- t: o,
1007
- getNode: b,
1008
- remove: K,
1009
- append: ae,
1010
- insertBefore: Be,
1011
- insertAfter: $e,
1012
- handleNodeExpand: ze,
1013
- updateKeyChildren: qe
1014
- };
1015
- }
1016
- });
1017
- function Nt(e, t, o, d, n, r) {
1018
- const l = I("el-tree-node");
1019
- return A(), j("div", {
1020
- ref: "el$",
1021
- class: T([
1022
- e.ns.b(),
1023
- e.ns.is("dragging", !!e.dragState.draggingNode),
1024
- e.ns.is("drop-not-allow", !e.dragState.allowDrop),
1025
- e.ns.is("drop-inner", e.dragState.dropType === "inner"),
1026
- { [e.ns.m("highlight-current")]: e.highlightCurrent }
1027
- ]),
1028
- role: "tree"
1029
- }, [
1030
- (A(!0), j(xe, null, Ae(e.root.childNodes, (c) => (A(), P(l, {
1031
- key: e.getNodeKey(c),
1032
- node: c,
1033
- props: e.props,
1034
- accordion: e.accordion,
1035
- "render-after-expand": e.renderAfterExpand,
1036
- "show-checkbox": e.showCheckbox,
1037
- "render-content": e.renderContent,
1038
- onNodeExpand: e.handleNodeExpand
1039
- }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]))), 128)),
1040
- e.isEmpty ? (A(), j("div", {
1041
- key: 0,
1042
- class: T(e.ns.e("empty-block"))
1043
- }, [
1044
- Se(e.$slots, "empty", {}, () => {
1045
- var c;
1046
- return [
1047
- ue("span", {
1048
- class: T(e.ns.e("empty-text"))
1049
- }, Ve((c = e.emptyText) != null ? c : e.t("el.tree.emptyText")), 3)
1050
- ];
1051
- })
1052
- ], 2)) : J("v-if", !0),
1053
- he(ue("div", {
1054
- ref: "dropIndicator$",
1055
- class: T(e.ns.e("drop-indicator"))
1056
- }, null, 2), [
1057
- [fe, e.dragState.showDropIndicator]
1058
- ])
1059
- ], 2);
1060
- }
1061
- var ne = /* @__PURE__ */ se(gt, [["render", Nt], ["__file", "tree.vue"]]);
1062
- ne.install = (e) => {
1063
- e.component(ne.name, ne);
1064
- };
1065
- const Ce = ne, Ct = (e, { attrs: t, emit: o }, {
1066
- select: d,
1067
- tree: n,
1068
- key: r
1069
- }) => {
1070
- const l = U("tree-select");
1071
- return S(() => e.data, () => {
1072
- e.filterable && R(() => {
1073
- var i, g;
1074
- (g = n.value) == null || g.filter((i = d.value) == null ? void 0 : i.states.inputValue);
1075
- });
1076
- }, { flush: "post" }), {
1077
- ...re(Te(e), Object.keys(pe.props)),
1078
- ...t,
1079
- "onUpdate:modelValue": (i) => o(ee, i),
1080
- valueKey: r,
1081
- popperClass: B(() => {
1082
- const i = [l.e("popper")];
1083
- return e.popperClass && i.push(e.popperClass), i.join(" ");
1084
- }),
1085
- filterMethod: (i = "") => {
1086
- var g;
1087
- e.filterMethod ? e.filterMethod(i) : e.remoteMethod ? e.remoteMethod(i) : (g = n.value) == null || g.filter(i);
1088
- }
1089
- };
1090
- }, kt = H({
1091
- extends: De,
1092
- setup(e, t) {
1093
- const o = De.setup(e, t);
1094
- delete o.selectOptionClick;
1095
- const d = me().proxy;
1096
- return R(() => {
1097
- o.select.states.cachedOptions.get(d.value) || o.select.onOptionCreate(d);
1098
- }), o;
1099
- },
1100
- methods: {
1101
- selectOptionClick() {
1102
- this.$el.parentElement.click();
1103
- }
1104
- }
1105
- });
1106
- function ke(e) {
1107
- return e || e === 0;
1108
- }
1109
- function Ke(e) {
1110
- return Array.isArray(e) && e.length;
1111
- }
1112
- function Y(e) {
1113
- return Array.isArray(e) ? e : ke(e) ? [e] : [];
1114
- }
1115
- function oe(e, t, o, d, n) {
1116
- for (let r = 0; r < e.length; r++) {
1117
- const l = e[r];
1118
- if (t(l, r, e, n))
1119
- return d ? d(l, r, e, n) : l;
1120
- {
1121
- const c = o(l);
1122
- if (Ke(c)) {
1123
- const i = oe(c, t, o, d, l);
1124
- if (i)
1125
- return i;
1126
- }
1127
- }
1128
- }
1129
- }
1130
- function ve(e, t, o, d) {
1131
- for (let n = 0; n < e.length; n++) {
1132
- const r = e[n];
1133
- t(r, n, e, d);
1134
- const l = o(r);
1135
- Ke(l) && ve(l, t, o, r);
1136
- }
1137
- }
1138
- const vt = (e, { attrs: t, slots: o, emit: d }, {
1139
- select: n,
1140
- tree: r,
1141
- key: l
1142
- }) => {
1143
- S(() => e.modelValue, () => {
1144
- e.showCheckbox && R(() => {
1145
- const a = r.value;
1146
- a && !tt(a.getCheckedKeys(), Y(e.modelValue)) && a.setCheckedKeys(Y(e.modelValue));
1147
- });
1148
- }, {
1149
- immediate: !0,
1150
- deep: !0
1151
- });
1152
- const c = B(() => ({
1153
- value: l.value,
1154
- label: "label",
1155
- children: "children",
1156
- disabled: "disabled",
1157
- isLeaf: "isLeaf",
1158
- ...e.props
1159
- })), i = (a, s) => {
1160
- var f;
1161
- const y = c.value[a];
1162
- return Le(y) ? y(s, (f = r.value) == null ? void 0 : f.getNode(i("value", s))) : s[y];
1163
- }, g = Y(e.modelValue).map((a) => oe(e.data || [], (s) => i("value", s) === a, (s) => i("children", s), (s, f, y, C) => C && i("value", C))).filter((a) => ke(a)), u = B(() => {
1164
- if (!e.renderAfterExpand && !e.lazy)
1165
- return [];
1166
- const a = [];
1167
- return ve(e.data.concat(e.cacheData), (s) => {
1168
- const f = i("value", s);
1169
- a.push({
1170
- value: f,
1171
- currentLabel: i("label", s),
1172
- isDisabled: i("disabled", s)
1173
- });
1174
- }, (s) => i("children", s)), a;
1175
- });
1176
- return {
1177
- ...re(Te(e), Object.keys(Ce.props)),
1178
- ...t,
1179
- nodeKey: l,
1180
- expandOnClickNode: B(() => !e.checkStrictly && e.expandOnClickNode),
1181
- defaultExpandedKeys: B(() => e.defaultExpandedKeys ? e.defaultExpandedKeys.concat(g) : g),
1182
- renderContent: (a, { node: s, data: f, store: y }) => a(kt, {
1183
- value: i("value", f),
1184
- label: i("label", f),
1185
- disabled: i("disabled", f)
1186
- }, e.renderContent ? () => e.renderContent(a, { node: s, data: f, store: y }) : o.default ? () => o.default({ node: s, data: f, store: y }) : void 0),
1187
- filterNodeMethod: (a, s, f) => e.filterNodeMethod ? e.filterNodeMethod(a, s, f) : a ? new RegExp(nt(a), "i").test(i("label", s) || "") : !0,
1188
- onNodeClick: (a, s, f) => {
1189
- var y, C, k, m;
1190
- if ((y = t.onNodeClick) == null || y.call(t, a, s, f), !(e.showCheckbox && e.checkOnClickNode)) {
1191
- if (!e.showCheckbox && (e.checkStrictly || s.isLeaf)) {
1192
- if (!i("disabled", a)) {
1193
- const x = (C = n.value) == null ? void 0 : C.states.options.get(i("value", a));
1194
- (k = n.value) == null || k.handleOptionSelect(x);
1195
- }
1196
- } else
1197
- e.expandOnClickNode && f.proxy.handleExpandIconClick();
1198
- (m = n.value) == null || m.focus();
1199
- }
1200
- },
1201
- onCheck: (a, s) => {
1202
- var f;
1203
- if (!e.showCheckbox)
1204
- return;
1205
- const y = i("value", a), C = {};
1206
- ve([r.value.store.root], (v) => C[v.key] = v, (v) => v.childNodes);
1207
- const k = s.checkedKeys, m = e.multiple ? Y(e.modelValue).filter((v) => !(v in C) && !k.includes(v)) : [], x = m.concat(k);
1208
- if (e.checkStrictly)
1209
- d(ee, e.multiple ? x : x.includes(y) ? y : void 0);
1210
- else if (e.multiple)
1211
- d(ee, m.concat(r.value.getCheckedKeys(!0)));
1212
- else {
1213
- const v = oe([a], (D) => !Ke(i("children", D)) && !i("disabled", D), (D) => i("children", D)), O = v ? i("value", v) : void 0, E = ke(e.modelValue) && !!oe([a], (D) => i("value", D) === e.modelValue, (D) => i("children", D));
1214
- d(ee, O === e.modelValue || E ? void 0 : O);
1215
- }
1216
- R(() => {
1217
- var v;
1218
- const O = Y(e.modelValue);
1219
- r.value.setCheckedKeys(O), (v = t.onCheck) == null || v.call(t, a, {
1220
- checkedKeys: r.value.getCheckedKeys(),
1221
- checkedNodes: r.value.getCheckedNodes(),
1222
- halfCheckedKeys: r.value.getHalfCheckedKeys(),
1223
- halfCheckedNodes: r.value.getHalfCheckedNodes()
1224
- });
1225
- }), (f = n.value) == null || f.focus();
1226
- },
1227
- cacheOptions: u
1228
- };
1229
- };
1230
- var mt = H({
1231
- props: {
1232
- data: {
1233
- type: Array,
1234
- default: () => []
1235
- }
1236
- },
1237
- setup(e) {
1238
- const t = V(ot);
1239
- return S(() => e.data, () => {
1240
- var o;
1241
- e.data.forEach((n) => {
1242
- t.states.cachedOptions.has(n.value) || t.states.cachedOptions.set(n.value, n);
1243
- });
1244
- const d = ((o = t.selectRef) == null ? void 0 : o.querySelectorAll("input")) || [];
1245
- Array.from(d).includes(document.activeElement) || t.setSelected();
1246
- }, { flush: "post", immediate: !0 }), () => {
1247
- };
1248
- }
1249
- });
1250
- const bt = H({
1251
- name: "ElTreeSelect",
1252
- inheritAttrs: !1,
1253
- props: {
1254
- ...pe.props,
1255
- ...Ce.props,
1256
- cacheData: {
1257
- type: Array,
1258
- default: () => []
1259
- }
1260
- },
1261
- setup(e, t) {
1262
- const { slots: o, expose: d } = t, n = w(), r = w(), l = B(() => e.nodeKey || e.valueKey || "value"), c = Ct(e, t, { select: n, tree: r, key: l }), { cacheOptions: i, ...g } = vt(e, t, {
1263
- select: n,
1264
- tree: r,
1265
- key: l
1266
- }), u = _({});
1267
- return d(u), Oe(() => {
1268
- Object.assign(u, {
1269
- ...re(r.value, [
1270
- "filter",
1271
- "updateKeyChildren",
1272
- "getCheckedNodes",
1273
- "setCheckedNodes",
1274
- "getCheckedKeys",
1275
- "setCheckedKeys",
1276
- "setChecked",
1277
- "getHalfCheckedNodes",
1278
- "getHalfCheckedKeys",
1279
- "getCurrentKey",
1280
- "getCurrentNode",
1281
- "setCurrentKey",
1282
- "setCurrentNode",
1283
- "getNode",
1284
- "remove",
1285
- "append",
1286
- "insertBefore",
1287
- "insertAfter"
1288
- ]),
1289
- ...re(n.value, ["focus", "blur"])
1290
- });
1291
- }), () => G(pe, _({
1292
- ...c,
1293
- ref: (a) => n.value = a
1294
- }), {
1295
- ...o,
1296
- default: () => [
1297
- G(mt, { data: i.value }),
1298
- G(Ce, _({
1299
- ...g,
1300
- ref: (a) => r.value = a
1301
- }))
1302
- ]
1303
- });
1304
- }
1305
- });
1306
- var de = /* @__PURE__ */ se(bt, [["__file", "tree-select.vue"]]);
1307
- de.install = (e) => {
1308
- e.component(de.name, de);
1309
- };
1310
- const Kt = de, St = Kt;
1311
- export {
1312
- St as E
1313
- };