@cw-devops-fe/vue-tree-vue3 0.0.0-stage → 1.1.0

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/index.js ADDED
@@ -0,0 +1,1634 @@
1
+ import { reactive as ve, computed as z, watch as I, defineComponent as Y, h as W, Transition as dt, inject as me, ref as S, nextTick as X, onMounted as Ee, resolveComponent as _, withDirectives as ee, openBlock as b, createElementBlock as $, withModifiers as x, normalizeClass as R, createElementVNode as A, normalizeStyle as be, createCommentVNode as q, createBlock as H, resolveDynamicComponent as we, createVNode as De, withCtx as te, Fragment as Ke, renderList as xe, vShow as ne, renderSlot as de, toDisplayString as Te, onBeforeUnmount as ot, unref as it, createSlots as Se, useSlots as rt, getCurrentInstance as at, provide as st } from "vue";
2
+ import lt from "@cw-devops-fe/virtual-list-vue3";
3
+ const F = "$treeNodeId", Ce = function(e, t) {
4
+ !t || t[F] || Object.defineProperty(t, F, {
5
+ value: e.id,
6
+ enumerable: !1,
7
+ configurable: !1,
8
+ writable: !1
9
+ });
10
+ }, he = function(e, t) {
11
+ return e ? t[e] : t[F];
12
+ }, Q = (e) => {
13
+ let t = !0, n = !0, d = !0;
14
+ for (let o = 0, a = e.length; o < a; o++) {
15
+ const r = e[o];
16
+ (r.checked !== !0 || r.indeterminate) && (t = !1, r.disabled || (d = !1)), (r.checked !== !1 || r.indeterminate) && (n = !1);
17
+ }
18
+ return { all: t, none: n, allWithoutDisable: d, half: !t && !n };
19
+ };
20
+ function Be(e) {
21
+ const { all: t, half: n, none: d } = Q(e.childNodes);
22
+ t ? (e.checked = !0, e.indeterminate = !1) : n ? (e.checked = !1, e.indeterminate = !0) : d && (e.checked = !1, e.indeterminate = !1);
23
+ }
24
+ const U = function(e) {
25
+ if (e.childNodes.length === 0 || e.loading) return;
26
+ Be(e);
27
+ const t = e.parent;
28
+ !t || t.level === 0 || e.store.checkStrictly || U(t);
29
+ }, J = function(e, t) {
30
+ const n = e.store.props, d = e.data || {}, o = n[t];
31
+ if (typeof o == "function")
32
+ return o(d, e);
33
+ if (typeof o == "string")
34
+ return d[o];
35
+ if (typeof o > "u") {
36
+ const a = d[t];
37
+ return a === void 0 ? "" : a;
38
+ }
39
+ };
40
+ let ct = 0;
41
+ class P {
42
+ constructor(t) {
43
+ var r;
44
+ this.id = ct++, 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.isLeaf = !1;
45
+ for (const s in t)
46
+ Object.prototype.hasOwnProperty.call(t, s) && (this[s] = t[s]);
47
+ this.level = 0, this.loaded = !1, this.childNodes = [], this.loading = !1, this.parent && (this.level = this.parent.level + 1);
48
+ const n = this.store;
49
+ if (!n)
50
+ throw new Error("[Node]store is required!");
51
+ n.registerNode(this);
52
+ const d = n.props;
53
+ if (d && typeof d.isLeaf < "u") {
54
+ const s = J(this, "isLeaf");
55
+ typeof s == "boolean" && (this.isLeafByUser = s);
56
+ }
57
+ if (n.lazy !== !0 && this.data ? (this.setData(this.data), n.defaultExpandAll && (this.expanded = !0)) : this.level > 0 && n.lazy && n.defaultExpandAll && this.expand(), Array.isArray(this.data) || Ce(this, this.data), !this.data) return;
58
+ const o = n.defaultExpandedKeys, a = n.key;
59
+ a && o && o.indexOf(this.key) !== -1 && this.expand(null, n.autoExpandParent), (r = n.isVirtual) != null && r.call(n) ? a && n.currentNodeKey != null && this.key === n.currentNodeKey && n.setCurrentNode(this) : a && n.currentNodeKey !== void 0 && this.key === n.currentNodeKey && (n.currentNode = this, n.currentNode.isCurrent = !0), n.lazy && n._initDefaultCheckedNode(this), this.updateLeafState();
60
+ }
61
+ setData(t) {
62
+ var d, o;
63
+ Array.isArray(t) || Ce(this, t), this.data = t, this.childNodes = [];
64
+ let n;
65
+ this.level === 0 && ((o = (d = this.store).isVirtual) != null && o.call(d) ? Array.isArray(this.data) : this.data instanceof Array) ? n = this.data : n = J(this, "children") || [];
66
+ for (let a = 0, r = n.length; a < r; a++)
67
+ this.insertChild({ data: n[a] });
68
+ }
69
+ get label() {
70
+ return J(this, "label");
71
+ }
72
+ get key() {
73
+ const t = this.store.key;
74
+ return this.data ? this.data[t] : null;
75
+ }
76
+ get disabled() {
77
+ return J(this, "disabled");
78
+ }
79
+ get nextSibling() {
80
+ const t = this.parent;
81
+ if (t) {
82
+ const n = t.childNodes.indexOf(this);
83
+ if (n > -1)
84
+ return t.childNodes[n + 1];
85
+ }
86
+ return null;
87
+ }
88
+ get previousSibling() {
89
+ const t = this.parent;
90
+ if (t) {
91
+ const n = t.childNodes.indexOf(this);
92
+ if (n > -1)
93
+ return n > 0 ? t.childNodes[n - 1] : null;
94
+ }
95
+ return null;
96
+ }
97
+ contains(t, n = !0) {
98
+ const d = function(o) {
99
+ const a = o.childNodes || [];
100
+ let r = !1;
101
+ for (let s = 0, u = a.length; s < u; s++) {
102
+ const l = a[s];
103
+ if (l === t || n && d(l)) {
104
+ r = !0;
105
+ break;
106
+ }
107
+ }
108
+ return r;
109
+ };
110
+ return d(this);
111
+ }
112
+ remove() {
113
+ const t = this.parent;
114
+ t && t.removeChild(this);
115
+ }
116
+ insertChild(t, n, d) {
117
+ if (!t) throw new Error("insertChild error: child is required.");
118
+ if (!(t instanceof P)) {
119
+ if (!d) {
120
+ const o = this.getChildren(!0) || [];
121
+ o.indexOf(t.data) === -1 && (typeof n > "u" || n < 0 ? o.push(t.data) : o.splice(n, 0, t.data));
122
+ }
123
+ Object.assign(t, { parent: this, store: this.store }), t = new P(t);
124
+ }
125
+ t.level = this.level + 1, typeof n > "u" || n < 0 ? this.childNodes.push(t) : this.childNodes.splice(n, 0, t), this.updateLeafState();
126
+ }
127
+ insertBefore(t, n) {
128
+ let d;
129
+ n && (d = this.childNodes.indexOf(n)), this.insertChild(t, d);
130
+ }
131
+ insertAfter(t, n) {
132
+ let d;
133
+ n && (d = this.childNodes.indexOf(n), d !== -1 && (d += 1)), this.insertChild(t, d);
134
+ }
135
+ removeChild(t) {
136
+ const n = this.getChildren() || [], d = n.indexOf(t.data);
137
+ d > -1 && n.splice(d, 1);
138
+ const o = this.childNodes.indexOf(t);
139
+ o > -1 && (this.store && this.store.deregisterNode(t), t.parent = null, this.childNodes.splice(o, 1)), this.updateLeafState();
140
+ }
141
+ removeChildByData(t) {
142
+ let n = null;
143
+ for (let d = 0; d < this.childNodes.length; d++)
144
+ if (this.childNodes[d].data === t) {
145
+ n = this.childNodes[d];
146
+ break;
147
+ }
148
+ n && this.removeChild(n);
149
+ }
150
+ expand(t, n) {
151
+ var o, a;
152
+ if ((a = (o = this.store).isVirtual) != null && a.call(o)) {
153
+ this.expandVirtual(t, n);
154
+ return;
155
+ }
156
+ const d = () => {
157
+ if (n) {
158
+ let r = this.parent;
159
+ for (; r.level > 0; )
160
+ r.expanded = !0, r = r.parent;
161
+ }
162
+ this.expanded = !0, t && t();
163
+ };
164
+ this.shouldLoadData() ? this.loadData((r) => {
165
+ r instanceof Array && (this.checked ? this.setChecked(!0, !0) : this.store.checkStrictly || U(this), d());
166
+ }) : d();
167
+ }
168
+ /**
169
+ * 把当前节点标为展开,让平铺列表读取它的子项。
170
+ * 例如 A > B > C,展开 C 时传入 expandParent=true,也会把已存在的 A、B 标为展开。
171
+ * 这里只修改祖先的状态,尚未创建的路径需要调用方先按层加载。
172
+ * 无需加载时立即回调。需要加载时,收到子项数组并同步勾选状态后回调。
173
+ */
174
+ expandVirtual(t, n) {
175
+ if (n) {
176
+ let d = this.parent;
177
+ for (; d && d.level > 0; )
178
+ d.expanded = !0, d = d.parent;
179
+ }
180
+ if (this.expanded = !0, this.shouldLoadData()) {
181
+ const d = ve(this);
182
+ d.loadData((o) => {
183
+ Array.isArray(o) && (d.checked ? d.setChecked(!0, !0) : d.store.checkStrictly || U(d), t == null || t());
184
+ });
185
+ } else
186
+ t == null || t();
187
+ }
188
+ doCreateChildren(t, n = {}) {
189
+ t.forEach((d) => {
190
+ this.insertChild(Object.assign({ data: d }, n), void 0, !0);
191
+ });
192
+ }
193
+ collapse() {
194
+ this.expanded = !1;
195
+ }
196
+ shouldLoadData() {
197
+ return this.store.lazy === !0 && this.store.load && !this.loaded;
198
+ }
199
+ updateLeafState() {
200
+ if (this.store.lazy === !0 && this.loaded !== !0 && typeof this.isLeafByUser < "u") {
201
+ this.isLeaf = this.isLeafByUser;
202
+ return;
203
+ }
204
+ const t = this.childNodes;
205
+ if (!this.store.lazy || this.store.lazy === !0 && this.loaded === !0) {
206
+ this.isLeaf = !t || t.length === 0;
207
+ return;
208
+ }
209
+ this.isLeaf = !1;
210
+ }
211
+ setChecked(t, n, d, o) {
212
+ if (this.indeterminate = t === "half", this.checked = t === !0, this.store.checkStrictly) return;
213
+ if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
214
+ const { allWithoutDisable: r } = Q(this.childNodes);
215
+ !this.isLeaf && !Q(this.childNodes).all && r && (this.checked = !1, t = !1);
216
+ const s = () => {
217
+ if (n) {
218
+ const u = this.childNodes;
219
+ for (let g = 0, C = u.length; g < C; g++) {
220
+ const p = u[g];
221
+ o = o || t !== !1;
222
+ const v = p.disabled ? p.checked : o;
223
+ p.setChecked(v, n, !0, o);
224
+ }
225
+ const { half: l, all: y } = Q(u);
226
+ y || (this.checked = y, this.indeterminate = l);
227
+ }
228
+ };
229
+ if (this.shouldLoadData()) {
230
+ this.loadData(
231
+ () => {
232
+ s(), U(this);
233
+ },
234
+ { checked: t !== !1 }
235
+ );
236
+ return;
237
+ } else
238
+ s();
239
+ }
240
+ const a = this.parent;
241
+ !a || a.level === 0 || d || U(a);
242
+ }
243
+ getChildren(t = !1) {
244
+ var a, r;
245
+ if (this.level === 0) return this.data;
246
+ const n = this.data;
247
+ if (!n) return null;
248
+ const d = this.store.props;
249
+ let o = "children";
250
+ return d && (o = d.children || "children"), !((r = (a = this.store).isVirtual) != null && r.call(a)) && n[o] === void 0 && (n[o] = null), t && !n[o] && (n[o] = []), n[o];
251
+ }
252
+ updateChildren() {
253
+ var a, r;
254
+ if ((r = (a = this.store).isVirtual) != null && r.call(a) && !this.store.lazy) {
255
+ this.updateVirtualChildren();
256
+ return;
257
+ }
258
+ const t = this.getChildren() || [], n = this.childNodes.map((s) => s.data), d = {}, o = [];
259
+ t.forEach((s, u) => {
260
+ const l = s[F];
261
+ !!l && n.findIndex((g) => g[F] === l) >= 0 ? d[l] = { index: u, data: s } : o.push({ index: u, data: s });
262
+ }), this.store.lazy || n.forEach((s) => {
263
+ d[s[F]] || this.removeChildByData(s);
264
+ }), o.forEach(({ index: s, data: u }) => {
265
+ this.insertChild({ data: u }, s);
266
+ }), this.updateLeafState();
267
+ }
268
+ /**
269
+ * 把外部 children 的增删和顺序变化同步到内部 childNodes。
270
+ * 例如 [B, C, D] 变成 [C, B, E],就复用 C、B,创建 E,并移除 D。
271
+ */
272
+ updateVirtualChildren() {
273
+ const t = this.getChildren() || [], n = new Map(this.childNodes.map((o) => [o.data, o])), d = [];
274
+ t.forEach((o) => {
275
+ const a = n.get(o);
276
+ a ? (d.push(a), n.delete(o)) : d.push(new P({ data: o, parent: this, store: this.store }));
277
+ }), n.forEach((o) => {
278
+ this.store.deregisterNode(o), o.parent = null;
279
+ }), this.childNodes = d, this.updateLeafState();
280
+ }
281
+ loadData(t, n = {}) {
282
+ if (this.store.lazy === !0 && this.store.load && !this.loaded && (!this.loading || Object.keys(n).length)) {
283
+ this.loading = !0;
284
+ const d = (o) => {
285
+ this.childNodes = [], this.doCreateChildren(o, n), this.loaded = !0, this.loading = !1, this.updateLeafState(), t && t.call(this, o);
286
+ };
287
+ this.store.load(this, d);
288
+ } else
289
+ t && t.call(this);
290
+ }
291
+ }
292
+ class ht {
293
+ constructor(t) {
294
+ var n;
295
+ this.currentNode = null, this.currentNodeKey = null, this.key = "", this.data = null, this.lazy = !1, this.load = null, this.props = {}, this.checkStrictly = !1, this.checkDescendants = !1, this.defaultCheckedKeys = [], this.defaultExpandedKeys = [], this.autoExpandParent = !0, this.defaultExpandAll = !1, this.filterNodeMethod = null;
296
+ for (const d in t)
297
+ Object.prototype.hasOwnProperty.call(t, d) && (this[d] = t[d]);
298
+ this.nodesMap = {}, this.root = new P({
299
+ data: this.data,
300
+ store: this
301
+ }), !((n = this.isVirtual) != null && n.call(this)) && this.initializeRoot();
302
+ }
303
+ /**
304
+ * 普通树在构造时调用,虚拟树在 store 进入响应式状态后调用。
305
+ * 例如首次打开懒加载虚拟树时,列表可能为空。等根节点的 load 回调返回,
306
+ * 通过响应式 root 写入顶层子项,平铺列表就会更新。子项登记到索引后,再按默认勾选键查找节点。
307
+ */
308
+ initializeRoot() {
309
+ const t = this.load;
310
+ if (this.lazy && t) {
311
+ t(this.root, (n) => {
312
+ this.root.doCreateChildren(n), this._initDefaultCheckedNodes();
313
+ });
314
+ return;
315
+ }
316
+ this._initDefaultCheckedNodes();
317
+ }
318
+ /**
319
+ * 手风琴保留目标和它的祖先链。遍历已加载的对象树,收起路径外的节点,
320
+ * 包括暂时未挂载的后代,避免它们下次滚入或重新展开时带回旧状态。
321
+ */
322
+ collapseOtherBranches(t) {
323
+ const n = /* @__PURE__ */ new Set();
324
+ for (let o = t; o !== this.root; o = o.parent)
325
+ n.add(o);
326
+ const d = (o) => {
327
+ o.childNodes.forEach((a) => {
328
+ n.has(a) || a.collapse(), d(a);
329
+ });
330
+ };
331
+ d(this.root);
332
+ }
333
+ filter(t) {
334
+ const n = this.filterNodeMethod, d = this.lazy, o = function(a) {
335
+ const r = a.root ? a.root.childNodes : a.childNodes;
336
+ if (r.forEach((s) => {
337
+ s.visible = n.call(s, t, s.data, s), o(s);
338
+ }), !a.visible && r.length) {
339
+ let s = !0;
340
+ s = !r.some((u) => u.visible), a.root ? a.root.visible = s === !1 : a.visible = s === !1;
341
+ }
342
+ t && a.visible && !a.isLeaf && !d && a.expand();
343
+ };
344
+ o(this);
345
+ }
346
+ setData(t) {
347
+ var d;
348
+ t !== this.root.data ? ((d = this.isVirtual) != null && d.call(this) && (this.root.childNodes.forEach((o) => this.deregisterVirtualNode(o)), this.data = t), this.root.setData(t), this._initDefaultCheckedNodes()) : this.root.updateChildren();
349
+ }
350
+ getNode(t) {
351
+ if (t instanceof P) return t;
352
+ const n = typeof t != "object" ? t : he(this.key, t);
353
+ return this.nodesMap[n] || null;
354
+ }
355
+ insertBefore(t, n) {
356
+ const d = this.getNode(n);
357
+ d.parent.insertBefore({ data: t }, d);
358
+ }
359
+ insertAfter(t, n) {
360
+ const d = this.getNode(n);
361
+ d.parent.insertAfter({ data: t }, d);
362
+ }
363
+ remove(t) {
364
+ var d;
365
+ const n = this.getNode(t);
366
+ if (n && n.parent) {
367
+ const o = (d = this.isVirtual) == null ? void 0 : d.call(this);
368
+ !o && n === this.currentNode && (this.currentNode = null), n.parent.removeChild(n), o && !this.currentNode && (this.currentNodeKey = null);
369
+ }
370
+ }
371
+ append(t, n) {
372
+ const d = n ? this.getNode(n) : this.root;
373
+ d && d.insertChild({ data: t });
374
+ }
375
+ _initDefaultCheckedNodes() {
376
+ const t = this.defaultCheckedKeys || [], n = this.nodesMap;
377
+ t.forEach((d) => {
378
+ const o = n[d];
379
+ o && o.setChecked(!0, !this.checkStrictly);
380
+ });
381
+ }
382
+ _initDefaultCheckedNode(t) {
383
+ (this.defaultCheckedKeys || []).indexOf(t.key) !== -1 && t.setChecked(!0, !this.checkStrictly);
384
+ }
385
+ setDefaultCheckedKey(t) {
386
+ t !== this.defaultCheckedKeys && (this.defaultCheckedKeys = t, this._initDefaultCheckedNodes());
387
+ }
388
+ registerNode(t) {
389
+ if (!this.key || !t || !t.data) return;
390
+ t.key !== void 0 && (this.nodesMap[t.key] = t);
391
+ }
392
+ deregisterNode(t) {
393
+ var d;
394
+ if ((d = this.isVirtual) != null && d.call(this)) {
395
+ this.deregisterVirtualNode(t);
396
+ return;
397
+ }
398
+ !this.key || !t || !t.data || (t.childNodes.forEach((o) => {
399
+ this.deregisterNode(o);
400
+ }), delete this.nodesMap[t.key]);
401
+ }
402
+ // 解绑整个分支的索引和当前节点引用。保留键的策略由调用方决定,
403
+ // 整树替换可凭原键恢复高亮,显式删除由 remove 清空键。
404
+ deregisterVirtualNode(t) {
405
+ t.childNodes.forEach((n) => this.deregisterVirtualNode(n)), this.currentNode === t && (this.currentNode = null, t.isCurrent = !1), this.key && this.nodesMap[t.key] === t && delete this.nodesMap[t.key];
406
+ }
407
+ getCheckedNodes(t = !1, n = !1) {
408
+ const d = [], o = function(a) {
409
+ (a.root ? a.root.childNodes : a.childNodes).forEach((s) => {
410
+ (s.checked || n && s.indeterminate) && (!t || t && s.isLeaf) && d.push(s.data), o(s);
411
+ });
412
+ };
413
+ return o(this), d;
414
+ }
415
+ getCheckedKeys(t = !1) {
416
+ return this.getCheckedNodes(t).map((n) => (n || {})[this.key]);
417
+ }
418
+ getHalfCheckedNodes() {
419
+ const t = [], n = function(d) {
420
+ (d.root ? d.root.childNodes : d.childNodes).forEach((a) => {
421
+ a.indeterminate && t.push(a.data), n(a);
422
+ });
423
+ };
424
+ return n(this), t;
425
+ }
426
+ getHalfCheckedKeys() {
427
+ return this.getHalfCheckedNodes().map((t) => (t || {})[this.key]);
428
+ }
429
+ _getAllNodes() {
430
+ const t = [], n = this.nodesMap;
431
+ for (const d in n)
432
+ Object.prototype.hasOwnProperty.call(n, d) && t.push(n[d]);
433
+ return t;
434
+ }
435
+ updateChildren(t, n) {
436
+ const d = this.nodesMap[t];
437
+ if (!d) return;
438
+ const o = d.childNodes;
439
+ for (let a = o.length - 1; a >= 0; a--) {
440
+ const r = o[a];
441
+ this.remove(r.data);
442
+ }
443
+ for (let a = 0, r = n.length; a < r; a++) {
444
+ const s = n[a];
445
+ this.append(s, d.data);
446
+ }
447
+ }
448
+ /**
449
+ * 按给定键更新已加载节点的勾选状态。虚拟且非懒加载时,可以批量重置并直接处理叶子键。
450
+ * 例如一个目录下有 1000 个文件,逐个调用 setChecked 会让同一个父目录反复扫描这 1000 项。
451
+ * 批量路径先更新深层节点,轮到父目录时再用已经写好的子项状态汇总一次。
452
+ *
453
+ * @param key 节点数据中的业务键字段,用于把记录中的键对应到模型节点。
454
+ * @param leafOnly 选中目录并向下联动后,是否按既有规则只保留叶子节点勾选。
455
+ * @param checkedKeys 本次要勾选的键集合,由 setCheckedKeys 或 setCheckedNodes 整理。
456
+ */
457
+ _setCheckedKeys(t, n = !1, d) {
458
+ var u;
459
+ const o = Object.keys(d), a = (u = this.isVirtual) != null && u.call(this) && !this.lazy ? new Set(o) : void 0, r = this._getAllNodes();
460
+ if (a && (!o.length || this.checkStrictly || o.every((l) => {
461
+ var y;
462
+ return ((y = this.nodesMap[l]) == null ? void 0 : y.isLeaf) ?? !0;
463
+ }))) {
464
+ const l = o.length > 0 && !this.checkStrictly;
465
+ l && r.sort((y, g) => g.level - y.level), r.forEach((y) => {
466
+ l && !y.isLeaf ? Be(y) : (y.checked = a.has(String(y.key)), y.indeterminate = !1);
467
+ });
468
+ return;
469
+ }
470
+ r.sort((l, y) => y.level - l.level);
471
+ const s = /* @__PURE__ */ Object.create(null);
472
+ r.forEach((l) => {
473
+ a ? (l.checked = !1, l.indeterminate = !1) : l.setChecked(!1, !1);
474
+ });
475
+ for (let l = 0, y = r.length; l < y; l++) {
476
+ const g = r[l], C = g.data[t].toString();
477
+ if (!(a ? a.has(C) : o.indexOf(C) > -1)) {
478
+ g.checked && !s[C] && g.setChecked(!1, !1);
479
+ continue;
480
+ }
481
+ let v = g.parent;
482
+ for (; v && v.level > 0; )
483
+ s[v.data[t]] = !0, v = v.parent;
484
+ if (g.isLeaf || this.checkStrictly) {
485
+ g.setChecked(!0, !1);
486
+ continue;
487
+ }
488
+ if (g.setChecked(!0, !0), n) {
489
+ g.setChecked(!1, !1);
490
+ const K = function(k) {
491
+ k.childNodes.forEach((L) => {
492
+ L.isLeaf || L.setChecked(!1, !1), K(L);
493
+ });
494
+ };
495
+ K(g);
496
+ }
497
+ }
498
+ }
499
+ setCheckedNodes(t, n = !1) {
500
+ const d = this.key, o = {};
501
+ t.forEach((a) => {
502
+ o[(a || {})[d]] = !0;
503
+ }), this._setCheckedKeys(d, n, o);
504
+ }
505
+ setCheckedKeys(t, n = !1) {
506
+ this.defaultCheckedKeys = t;
507
+ const d = this.key, o = {};
508
+ t.forEach((a) => {
509
+ o[a] = !0;
510
+ }), this._setCheckedKeys(d, n, o);
511
+ }
512
+ setDefaultExpandedKeys(t) {
513
+ t = t || [], this.defaultExpandedKeys = t, t.forEach((n) => {
514
+ const d = this.getNode(n);
515
+ d && d.expand(null, this.autoExpandParent);
516
+ });
517
+ }
518
+ setChecked(t, n, d) {
519
+ const o = this.getNode(t);
520
+ o && o.setChecked(!!n, d);
521
+ }
522
+ getCurrentNode() {
523
+ return this.currentNode;
524
+ }
525
+ setCurrentNode(t) {
526
+ var d;
527
+ const n = this.currentNode;
528
+ n && (n.isCurrent = !1), this.currentNode = t, (d = this.isVirtual) != null && d.call(this) && (this.currentNodeKey = t.key), this.currentNode.isCurrent = !0;
529
+ }
530
+ setUserCurrentNode(t) {
531
+ const n = t[this.key], d = this.nodesMap[n];
532
+ this.setCurrentNode(d);
533
+ }
534
+ setCurrentNodeKey(t) {
535
+ var d;
536
+ if (t == null) {
537
+ this.currentNode && (this.currentNode.isCurrent = !1), this.currentNode = null, (d = this.isVirtual) != null && d.call(this) && (this.currentNodeKey = null);
538
+ return;
539
+ }
540
+ const n = this.getNode(t);
541
+ n && this.setCurrentNode(n);
542
+ }
543
+ }
544
+ function ut(e) {
545
+ const t = [], n = (d) => {
546
+ d.visible && (t.push(d), d.expanded && d.childNodes.forEach(n));
547
+ };
548
+ return e.childNodes.forEach(n), t;
549
+ }
550
+ function ft(e, t, n, d) {
551
+ const o = z(() => {
552
+ if (!t()) return;
553
+ const r = /* @__PURE__ */ new Map(), s = n(), u = (l) => {
554
+ var g;
555
+ const y = s ? l === e ? void 0 : l.getChildren() : (g = l.getChildren()) == null ? void 0 : g.slice();
556
+ r.set(l, y), l.childNodes.forEach(u);
557
+ };
558
+ return u(e), r;
559
+ }), a = z(() => {
560
+ if (!t()) return;
561
+ const r = /* @__PURE__ */ new Map(), s = (u) => {
562
+ u !== e && r.set(u, { checked: u.checked, indeterminate: u.indeterminate }), u.childNodes.forEach(s);
563
+ };
564
+ return s(e), r;
565
+ });
566
+ I([o, a], ([r, s], [u, l]) => {
567
+ if (!r || !s) return;
568
+ const y = (p, v) => {
569
+ const K = l == null ? void 0 : l.get(p);
570
+ K && (K.checked !== v.checked || K.indeterminate !== v.indeterminate) && d(p);
571
+ };
572
+ if (r === u) {
573
+ s.forEach((p, v) => y(v, p));
574
+ return;
575
+ }
576
+ const g = n(), C = (p) => {
577
+ if (!r.has(p)) return;
578
+ const v = r.get(p);
579
+ g ? p !== e && (u != null && u.has(p)) && v !== u.get(p) && p.updateChildren() : (((v == null ? void 0 : v.length) ?? 0) !== p.childNodes.length || v != null && v.some((E, L) => E !== p.childNodes[L].data)) && p.updateChildren();
580
+ const K = s.get(p);
581
+ K && y(p, K), p.childNodes.forEach(C);
582
+ };
583
+ C(e);
584
+ }, { immediate: !0 });
585
+ }
586
+ const pe = (e, t) => e.classList.add(t), Ne = (e, t) => e.classList.remove(t), gt = Y({
587
+ name: "TreeCollapseTransition",
588
+ setup(e, { slots: t }) {
589
+ return () => W(
590
+ dt,
591
+ {
592
+ onBeforeEnter(n) {
593
+ const d = n;
594
+ pe(d, "collapse-transition"), d.dataset.oldPaddingTop = d.style.paddingTop, d.dataset.oldPaddingBottom = d.style.paddingBottom, d.style.height = "0", d.style.paddingTop = "0", d.style.paddingBottom = "0";
595
+ },
596
+ onEnter(n) {
597
+ const d = n;
598
+ d.dataset.oldOverflow = d.style.overflow, d.scrollHeight !== 0 ? (d.style.height = d.scrollHeight + "px", d.style.paddingTop = d.dataset.oldPaddingTop || "", d.style.paddingBottom = d.dataset.oldPaddingBottom || "") : (d.style.height = "", d.style.paddingTop = d.dataset.oldPaddingTop || "", d.style.paddingBottom = d.dataset.oldPaddingBottom || ""), d.style.overflow = "hidden";
599
+ },
600
+ onAfterEnter(n) {
601
+ const d = n;
602
+ Ne(d, "collapse-transition"), d.style.height = "", d.style.overflow = d.dataset.oldOverflow || "";
603
+ },
604
+ onBeforeLeave(n) {
605
+ const d = n;
606
+ d.dataset.oldPaddingTop = d.style.paddingTop, d.dataset.oldPaddingBottom = d.style.paddingBottom, d.dataset.oldOverflow = d.style.overflow, d.style.height = d.scrollHeight + "px", d.style.overflow = "hidden";
607
+ },
608
+ onLeave(n) {
609
+ const d = n;
610
+ d.scrollHeight !== 0 && (pe(d, "collapse-transition"), d.style.height = "0", d.style.paddingTop = "0", d.style.paddingBottom = "0");
611
+ },
612
+ onAfterLeave(n) {
613
+ const d = n;
614
+ Ne(d, "collapse-transition"), d.style.height = "", d.style.overflow = d.dataset.oldOverflow || "", d.style.paddingTop = d.dataset.oldPaddingTop || "", d.style.paddingBottom = d.dataset.oldPaddingBottom || "";
615
+ }
616
+ },
617
+ t.default
618
+ );
619
+ }
620
+ }), yt = Y({
621
+ name: "VueTreeNode",
622
+ components: {
623
+ TreeCollapseTransition: gt
624
+ },
625
+ props: {
626
+ node: {
627
+ type: Object,
628
+ required: !0
629
+ },
630
+ renderContent: Function,
631
+ renderAfterExpand: {
632
+ type: Boolean,
633
+ default: !0
634
+ },
635
+ showCheckbox: {
636
+ type: Boolean,
637
+ default: !1
638
+ }
639
+ },
640
+ emits: ["node-expand"],
641
+ setup(e, { emit: t }) {
642
+ const n = me("vueTree"), d = S(), o = S(!1), a = S(!1), r = S(null), s = S(null), u = z(() => ({
643
+ props: { node: { type: Object, required: !0 } },
644
+ setup(f) {
645
+ return () => {
646
+ var B;
647
+ return e.renderContent ? e.renderContent(W, {
648
+ _self: n,
649
+ node: f.node,
650
+ data: f.node.data,
651
+ store: f.node.store
652
+ }) : (B = n == null ? void 0 : n.slots) != null && B.default ? n.slots.default({
653
+ node: f.node,
654
+ data: f.node.data
655
+ }) : W("span", { class: "vue-tree-node__label" }, f.node.label);
656
+ };
657
+ }
658
+ }));
659
+ I(
660
+ () => e.node.indeterminate,
661
+ (f) => {
662
+ y(e.node.checked, f);
663
+ }
664
+ ), I(
665
+ () => e.node.checked,
666
+ (f) => {
667
+ y(f, e.node.indeterminate);
668
+ }
669
+ ), I(
670
+ () => e.node.expanded,
671
+ (f) => {
672
+ X(() => o.value = f), f && (a.value = !0);
673
+ }
674
+ );
675
+ function l(f) {
676
+ return he(n.nodeKey, f.data);
677
+ }
678
+ function y(f, B) {
679
+ (r.value !== f || s.value !== B) && n.emitEvent("check-change", e.node.data, f, B), r.value = f, s.value = B;
680
+ }
681
+ function g() {
682
+ const f = n.store;
683
+ f.setCurrentNode(e.node), n.emitEvent(
684
+ "current-change",
685
+ f.currentNode ? f.currentNode.data : null,
686
+ f.currentNode
687
+ ), n.currentNode = d.value, n.expandOnClickNode && p(), n.checkOnClickNode && !e.node.disabled && v({
688
+ target: { checked: !e.node.checked }
689
+ }), n.emitEvent("node-click", e.node.data, e.node, { $el: d.value });
690
+ }
691
+ function C(f) {
692
+ n.emitEvent("node-contextmenu", f, e.node.data, e.node, {
693
+ $el: d.value
694
+ });
695
+ }
696
+ function p() {
697
+ e.node.isLeaf || (o.value ? (n.emitEvent("node-collapse", e.node.data, e.node, {
698
+ $el: d.value
699
+ }), e.node.collapse()) : (e.node.expand(), t("node-expand", e.node.data, e.node, { $el: d.value })));
700
+ }
701
+ function v(f) {
702
+ const B = f.target;
703
+ e.node.setChecked(B.checked, !n.checkStrictly), X(() => {
704
+ const M = n.store;
705
+ n.emitEvent("check", e.node.data, {
706
+ checkedNodes: M.getCheckedNodes(),
707
+ checkedKeys: M.getCheckedKeys(),
708
+ halfCheckedNodes: M.getHalfCheckedNodes(),
709
+ halfCheckedKeys: M.getHalfCheckedKeys()
710
+ });
711
+ });
712
+ }
713
+ function K(f, B, M) {
714
+ n.broadcastTreeNodeExpand(B), n.emitEvent("node-expand", f, B, M);
715
+ }
716
+ function k(f) {
717
+ n.draggable && n.handleTreeNodeDragStart(f, { node: e.node, $el: d.value });
718
+ }
719
+ function E(f) {
720
+ n.draggable && (n.handleTreeNodeDragOver(f, { node: e.node, $el: d.value }), f.preventDefault());
721
+ }
722
+ function L(f) {
723
+ f.preventDefault();
724
+ }
725
+ function Z(f) {
726
+ n.draggable && n.handleTreeNodeDragEnd(f, { node: e.node, $el: d.value });
727
+ }
728
+ const oe = (f) => {
729
+ e.node !== f && e.node.collapse();
730
+ };
731
+ Ee(() => {
732
+ n.accordion && n.onAccordionExpand(oe);
733
+ });
734
+ const ie = (n.props || {}).children || "children";
735
+ return I(
736
+ () => {
737
+ var f;
738
+ return (f = e.node.data) == null ? void 0 : f[ie];
739
+ },
740
+ () => {
741
+ e.node.updateChildren();
742
+ }
743
+ ), e.node.expanded && (o.value = !0, a.value = !0), {
744
+ tree: n,
745
+ nodeRef: d,
746
+ expanded: o,
747
+ childNodeRendered: a,
748
+ nodeContentComponent: u,
749
+ getNodeKey: l,
750
+ handleClick: g,
751
+ handleContextMenu: C,
752
+ handleExpandIconClick: p,
753
+ handleCheckChange: v,
754
+ handleChildNodeExpand: K,
755
+ handleDragStart: k,
756
+ handleDragOver: E,
757
+ handleDrop: L,
758
+ handleDragEnd: Z
759
+ };
760
+ }
761
+ }), ue = (e, t) => {
762
+ const n = e.__vccOpts || e;
763
+ for (const [d, o] of t)
764
+ n[d] = o;
765
+ return n;
766
+ }, kt = ["aria-expanded", "aria-disabled", "aria-checked", "draggable"], Ct = ["checked", "disabled"], pt = {
767
+ key: 1,
768
+ class: "vue-tree-node__loading-icon vue-icon-loading"
769
+ }, Nt = ["aria-expanded"];
770
+ function vt(e, t, n, d, o, a) {
771
+ var u;
772
+ const r = _("vue-tree-node", !0), s = _("tree-collapse-transition");
773
+ return ee((b(), $("div", {
774
+ class: R(["vue-tree-node", {
775
+ "is-expanded": e.expanded,
776
+ "is-current": e.node.isCurrent,
777
+ "is-hidden": !e.node.visible,
778
+ "is-focusable": !e.node.disabled,
779
+ "is-checked": !e.node.disabled && e.node.checked
780
+ }]),
781
+ onClick: t[3] || (t[3] = x((...l) => e.handleClick && e.handleClick(...l), ["stop"])),
782
+ onContextmenu: t[4] || (t[4] = (...l) => e.handleContextMenu && e.handleContextMenu(...l)),
783
+ role: "treeitem",
784
+ tabindex: "-1",
785
+ "aria-expanded": e.expanded,
786
+ "aria-disabled": e.node.disabled,
787
+ "aria-checked": e.node.checked,
788
+ draggable: (u = e.tree) == null ? void 0 : u.draggable,
789
+ onDragstart: t[5] || (t[5] = x((...l) => e.handleDragStart && e.handleDragStart(...l), ["stop"])),
790
+ onDragover: t[6] || (t[6] = x((...l) => e.handleDragOver && e.handleDragOver(...l), ["stop"])),
791
+ onDragend: t[7] || (t[7] = x((...l) => e.handleDragEnd && e.handleDragEnd(...l), ["stop"])),
792
+ onDrop: t[8] || (t[8] = x((...l) => e.handleDrop && e.handleDrop(...l), ["stop"])),
793
+ ref: "nodeRef"
794
+ }, [
795
+ A("div", {
796
+ class: "vue-tree-node__content",
797
+ style: be({ "padding-left": (e.node.level - 1) * e.tree.indent + "px" })
798
+ }, [
799
+ A("span", {
800
+ onClick: t[0] || (t[0] = x((...l) => e.handleExpandIconClick && e.handleExpandIconClick(...l), ["stop"])),
801
+ class: R([
802
+ { "is-leaf": e.node.isLeaf, expanded: !e.node.isLeaf && e.expanded },
803
+ "vue-tree-node__expand-icon",
804
+ e.tree.iconClass ? e.tree.iconClass : "vue-icon-caret-right"
805
+ ])
806
+ }, null, 2),
807
+ e.showCheckbox ? (b(), $("label", {
808
+ key: 0,
809
+ class: R(["vue-checkbox", {
810
+ "is-checked": e.node.checked,
811
+ "is-indeterminate": e.node.indeterminate,
812
+ "is-disabled": !!e.node.disabled
813
+ }]),
814
+ onClick: t[2] || (t[2] = x(() => {
815
+ }, ["stop"]))
816
+ }, [
817
+ A("span", {
818
+ class: R(["vue-checkbox__input", {
819
+ "is-checked": e.node.checked,
820
+ "is-indeterminate": e.node.indeterminate,
821
+ "is-disabled": !!e.node.disabled
822
+ }])
823
+ }, [
824
+ t[9] || (t[9] = A("span", { class: "vue-checkbox__inner" }, null, -1)),
825
+ A("input", {
826
+ type: "checkbox",
827
+ class: "vue-checkbox__original",
828
+ checked: e.node.checked,
829
+ disabled: !!e.node.disabled,
830
+ onChange: t[1] || (t[1] = (...l) => e.handleCheckChange && e.handleCheckChange(...l))
831
+ }, null, 40, Ct)
832
+ ], 2)
833
+ ], 2)) : q("", !0),
834
+ e.node.loading ? (b(), $("span", pt)) : q("", !0),
835
+ (b(), H(we(e.nodeContentComponent), { node: e.node }, null, 8, ["node"]))
836
+ ], 4),
837
+ De(s, null, {
838
+ default: te(() => [
839
+ !e.renderAfterExpand || e.childNodeRendered ? ee((b(), $("div", {
840
+ key: 0,
841
+ class: "vue-tree-node__children",
842
+ role: "group",
843
+ "aria-expanded": e.expanded
844
+ }, [
845
+ (b(!0), $(Ke, null, xe(e.node.childNodes, (l) => (b(), H(r, {
846
+ key: e.getNodeKey(l),
847
+ "render-content": e.renderContent,
848
+ "render-after-expand": e.renderAfterExpand,
849
+ "show-checkbox": e.showCheckbox,
850
+ node: l,
851
+ onNodeExpand: e.handleChildNodeExpand
852
+ }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "onNodeExpand"]))), 128))
853
+ ], 8, Nt)), [
854
+ [ne, e.expanded]
855
+ ]) : q("", !0)
856
+ ]),
857
+ _: 1
858
+ })
859
+ ], 42, kt)), [
860
+ [ne, e.node.visible]
861
+ ]);
862
+ }
863
+ const mt = /* @__PURE__ */ ue(yt, [["render", vt]]), Et = Y({
864
+ // VirtualTreeRows 为每个挂载的列表项传入一个 Node,子节点由列表作为另外的行渲染。
865
+ name: "VueTreeItem",
866
+ props: {
867
+ node: {
868
+ type: Object,
869
+ required: !0
870
+ },
871
+ // 平铺列表里的当前索引。父组件按这个索引判断本行是否在屏幕内。
872
+ index: { type: Number, required: !0 },
873
+ scheduleContent: Function,
874
+ renderContent: Function,
875
+ showCheckbox: {
876
+ type: Boolean,
877
+ default: !1
878
+ }
879
+ },
880
+ setup(e) {
881
+ const t = me("vueTree"), n = S(), d = z(() => e.node.expanded), o = z(() => {
882
+ var E;
883
+ const k = t.loadingKey;
884
+ return e.node.loading || !!(k && ((E = e.node.data) != null && E[k]));
885
+ }), a = S(!1);
886
+ I(() => e.scheduleContent, (k, E, L) => {
887
+ a.value || (k ? L(k(() => {
888
+ a.value = !0;
889
+ }, () => e.index)) : a.value = !0);
890
+ }, { immediate: !0 });
891
+ const r = z(() => ({
892
+ props: { node: { type: Object, required: !0 } },
893
+ setup(k) {
894
+ return () => {
895
+ var E;
896
+ return e.renderContent ? e.renderContent(W, {
897
+ _self: t,
898
+ node: k.node,
899
+ data: k.node.data,
900
+ store: k.node.store
901
+ }) : (E = t == null ? void 0 : t.slots) != null && E.default ? t.slots.default({
902
+ node: k.node,
903
+ data: k.node.data
904
+ }) : W("span", { class: "vue-tree-node__label" }, k.node.label);
905
+ };
906
+ }
907
+ }));
908
+ function s() {
909
+ const k = t.store;
910
+ k.setCurrentNode(e.node), t.emitEvent(
911
+ "current-change",
912
+ k.currentNode ? k.currentNode.data : null,
913
+ k.currentNode
914
+ ), t.expandOnClickNode && l(), t.checkOnClickNode && !e.node.disabled && g(!e.node.checked), t.emitEvent("node-click", e.node.data, e.node, { $el: n.value });
915
+ }
916
+ function u(k) {
917
+ t.emitEvent("node-contextmenu", k, e.node.data, e.node, {
918
+ $el: n.value
919
+ });
920
+ }
921
+ function l() {
922
+ e.node.isLeaf || (d.value ? (t.emitEvent("node-collapse", e.node.data, e.node, {
923
+ $el: n.value
924
+ }), e.node.collapse()) : (e.node.expand(), t.handleVirtualNodeExpand(e.node.data, e.node, { $el: n.value })));
925
+ }
926
+ function y(k) {
927
+ g(k.target.checked);
928
+ }
929
+ function g(k) {
930
+ e.node.setChecked(k, !t.checkStrictly), X(() => {
931
+ const E = t.store;
932
+ t.emitEvent("check", e.node.data, {
933
+ checkedNodes: E.getCheckedNodes(),
934
+ checkedKeys: E.getCheckedKeys(),
935
+ halfCheckedNodes: E.getHalfCheckedNodes(),
936
+ halfCheckedKeys: E.getHalfCheckedKeys()
937
+ });
938
+ });
939
+ }
940
+ function C(k) {
941
+ t.draggable && t.handleTreeNodeDragStart(k, { node: e.node, $el: n.value });
942
+ }
943
+ function p(k) {
944
+ t.draggable && (t.handleTreeNodeDragOver(k, { node: e.node, $el: n.value }), k.preventDefault());
945
+ }
946
+ function v(k) {
947
+ k.preventDefault();
948
+ }
949
+ function K(k) {
950
+ t.draggable && t.handleTreeNodeDragEnd(k, { node: e.node, $el: n.value });
951
+ }
952
+ return {
953
+ tree: t,
954
+ nodeRef: n,
955
+ expanded: d,
956
+ loading: o,
957
+ contentReady: a,
958
+ nodeContentComponent: r,
959
+ handleClick: s,
960
+ handleContextMenu: u,
961
+ handleExpandIconClick: l,
962
+ handleCheckChange: y,
963
+ handleDragStart: C,
964
+ handleDragOver: p,
965
+ handleDrop: v,
966
+ handleDragEnd: K
967
+ };
968
+ }
969
+ }), bt = ["aria-level", "data-tree-node-id", "aria-expanded", "aria-disabled", "aria-checked", "aria-busy", "draggable"], wt = ["checked", "disabled"], Dt = {
970
+ key: 4,
971
+ class: "vue-tree-node__label"
972
+ };
973
+ function Kt(e, t, n, d, o, a) {
974
+ var r;
975
+ return ee((b(), $("div", {
976
+ class: R(["vue-tree-node", {
977
+ "is-expanded": e.expanded,
978
+ "is-current": e.node.isCurrent,
979
+ "is-hidden": !e.node.visible,
980
+ "is-focusable": !e.node.disabled,
981
+ "is-checked": !e.node.disabled && e.node.checked
982
+ }]),
983
+ onClick: t[4] || (t[4] = x((...s) => e.handleClick && e.handleClick(...s), ["stop"])),
984
+ onContextmenu: t[5] || (t[5] = (...s) => e.handleContextMenu && e.handleContextMenu(...s)),
985
+ role: "treeitem",
986
+ "aria-level": e.node.level,
987
+ "data-tree-node-id": e.node.id,
988
+ tabindex: "-1",
989
+ "aria-expanded": e.expanded,
990
+ "aria-disabled": e.node.disabled,
991
+ "aria-checked": e.node.checked,
992
+ "aria-busy": e.loading || void 0,
993
+ draggable: (r = e.tree) == null ? void 0 : r.draggable,
994
+ onDragstart: t[6] || (t[6] = x((...s) => e.handleDragStart && e.handleDragStart(...s), ["stop"])),
995
+ onDragover: t[7] || (t[7] = x((...s) => e.handleDragOver && e.handleDragOver(...s), ["stop"])),
996
+ onDragend: t[8] || (t[8] = x((...s) => e.handleDragEnd && e.handleDragEnd(...s), ["stop"])),
997
+ onDrop: t[9] || (t[9] = x((...s) => e.handleDrop && e.handleDrop(...s), ["stop"])),
998
+ ref: "nodeRef"
999
+ }, [
1000
+ A("div", {
1001
+ class: "vue-tree-node__content",
1002
+ style: be({ "padding-left": (e.node.level - 1) * e.tree.indent + "px" })
1003
+ }, [
1004
+ e.loading ? (b(), $("div", {
1005
+ key: 0,
1006
+ class: "vue-tree-node__expand-icon is-loading",
1007
+ onClick: t[0] || (t[0] = x((...s) => e.handleExpandIconClick && e.handleExpandIconClick(...s), ["stop"]))
1008
+ }, [
1009
+ de(e.$slots, "node-loading", {}, () => [
1010
+ t[10] || (t[10] = A("span", {
1011
+ class: "vue-tree-node__loading-icon vue-icon-loading",
1012
+ "aria-hidden": "true"
1013
+ }, null, -1))
1014
+ ])
1015
+ ])) : (b(), $("span", {
1016
+ key: 1,
1017
+ onClick: t[1] || (t[1] = x((...s) => e.handleExpandIconClick && e.handleExpandIconClick(...s), ["stop"])),
1018
+ class: R([
1019
+ { "is-leaf": e.node.isLeaf, expanded: !e.node.isLeaf && e.expanded },
1020
+ "vue-tree-node__expand-icon",
1021
+ e.tree.iconClass ? e.tree.iconClass : "vue-icon-caret-right"
1022
+ ])
1023
+ }, null, 2)),
1024
+ e.showCheckbox ? (b(), $("label", {
1025
+ key: 2,
1026
+ class: R(["vue-checkbox", {
1027
+ "is-checked": e.node.checked,
1028
+ "is-indeterminate": e.node.indeterminate,
1029
+ "is-disabled": !!e.node.disabled
1030
+ }]),
1031
+ onClick: t[3] || (t[3] = x(() => {
1032
+ }, ["stop"]))
1033
+ }, [
1034
+ A("span", {
1035
+ class: R(["vue-checkbox__input", {
1036
+ "is-checked": e.node.checked,
1037
+ "is-indeterminate": e.node.indeterminate,
1038
+ "is-disabled": !!e.node.disabled
1039
+ }])
1040
+ }, [
1041
+ t[11] || (t[11] = A("span", { class: "vue-checkbox__inner" }, null, -1)),
1042
+ A("input", {
1043
+ type: "checkbox",
1044
+ class: "vue-checkbox__original",
1045
+ checked: e.node.checked,
1046
+ disabled: !!e.node.disabled,
1047
+ onChange: t[2] || (t[2] = (...s) => e.handleCheckChange && e.handleCheckChange(...s))
1048
+ }, null, 40, wt)
1049
+ ], 2)
1050
+ ], 2)) : q("", !0),
1051
+ e.contentReady ? (b(), H(we(e.nodeContentComponent), {
1052
+ key: 3,
1053
+ node: e.node
1054
+ }, null, 8, ["node"])) : (b(), $("span", Dt, Te(e.node.label), 1))
1055
+ ], 4)
1056
+ ], 42, bt)), [
1057
+ [ne, e.node.visible]
1058
+ ]);
1059
+ }
1060
+ const xt = /* @__PURE__ */ ue(Et, [["render", Kt]]), Tt = 8, St = /* @__PURE__ */ Y({
1061
+ __name: "VirtualTreeRows",
1062
+ props: {
1063
+ rows: {},
1064
+ getRowKey: { type: Function },
1065
+ showCheckbox: { type: Boolean },
1066
+ renderContent: { type: Function },
1067
+ deferContent: { type: Boolean }
1068
+ },
1069
+ setup(e, { expose: t }) {
1070
+ const n = e, d = S(), o = (l) => n.getRowKey(l), a = /* @__PURE__ */ new Map();
1071
+ let r = null;
1072
+ function s(l, y) {
1073
+ return a.set(l, y), r === null && (r = requestAnimationFrame(u)), () => a.delete(l);
1074
+ }
1075
+ function u() {
1076
+ r = null;
1077
+ const l = (g) => {
1078
+ var C;
1079
+ return Number(((C = d.value) == null ? void 0 : C.isIndexVisible(g)) ?? !1);
1080
+ }, y = [...a].map(([g, C]) => ({ mount: g, index: C() })).sort((g, C) => l(C.index) - l(g.index) || g.index - C.index).slice(0, Tt);
1081
+ for (const { mount: g } of y)
1082
+ a.delete(g), g();
1083
+ a.size && (r = requestAnimationFrame(u));
1084
+ }
1085
+ return ot(() => {
1086
+ r !== null && cancelAnimationFrame(r), a.clear();
1087
+ }), t({
1088
+ isIndexVisible: (l) => {
1089
+ var y;
1090
+ return ((y = d.value) == null ? void 0 : y.isIndexVisible(l)) ?? !1;
1091
+ },
1092
+ scrollToIndex: (l) => {
1093
+ var y;
1094
+ return (y = d.value) == null ? void 0 : y.scrollToIndex(l);
1095
+ }
1096
+ }), (l, y) => (b(), H(it(lt), {
1097
+ ref_key: "list",
1098
+ ref: d,
1099
+ "list-data": e.rows,
1100
+ "item-key": o,
1101
+ "immediate-scroll-update": "",
1102
+ "estimated-item-size": 28,
1103
+ height: "100%"
1104
+ }, {
1105
+ default: te(({ item: { item: g, index: C } }) => [
1106
+ De(xt, {
1107
+ node: g,
1108
+ index: Number(C.slice(1)),
1109
+ "show-checkbox": e.showCheckbox,
1110
+ "render-content": e.renderContent,
1111
+ "schedule-content": e.deferContent ? s : void 0
1112
+ }, Se({ _: 2 }, [
1113
+ l.$slots["node-loading"] ? {
1114
+ name: "node-loading",
1115
+ fn: te(() => [
1116
+ de(l.$slots, "node-loading")
1117
+ ]),
1118
+ key: "0"
1119
+ } : void 0
1120
+ ]), 1032, ["node", "index", "show-checkbox", "render-content", "schedule-content"])
1121
+ ]),
1122
+ _: 3
1123
+ }, 8, ["list-data"]));
1124
+ }
1125
+ });
1126
+ function Bt(e, t) {
1127
+ if (!e || !t) return;
1128
+ const n = t.split(" ");
1129
+ for (const d of n)
1130
+ d && e.classList.add(d);
1131
+ }
1132
+ function ce(e, t) {
1133
+ if (!e || !t) return;
1134
+ const n = t.split(" ");
1135
+ for (const d of n)
1136
+ d && e.classList.remove(d);
1137
+ }
1138
+ const Ot = Y({
1139
+ name: "VueTree",
1140
+ components: { VueTreeNode: mt, VirtualTreeRows: St },
1141
+ props: {
1142
+ data: {
1143
+ type: Array,
1144
+ default: () => []
1145
+ },
1146
+ emptyText: {
1147
+ type: String,
1148
+ default: "暂无数据"
1149
+ },
1150
+ renderAfterExpand: {
1151
+ type: Boolean,
1152
+ default: !0
1153
+ },
1154
+ nodeKey: String,
1155
+ checkStrictly: Boolean,
1156
+ defaultExpandAll: Boolean,
1157
+ expandOnClickNode: {
1158
+ type: Boolean,
1159
+ default: !0
1160
+ },
1161
+ checkOnClickNode: Boolean,
1162
+ checkDescendants: {
1163
+ type: Boolean,
1164
+ default: !1
1165
+ },
1166
+ autoExpandParent: {
1167
+ type: Boolean,
1168
+ default: !0
1169
+ },
1170
+ defaultCheckedKeys: Array,
1171
+ defaultExpandedKeys: Array,
1172
+ currentNodeKey: [String, Number],
1173
+ renderContent: Function,
1174
+ showCheckbox: {
1175
+ type: Boolean,
1176
+ default: !1
1177
+ },
1178
+ draggable: {
1179
+ type: Boolean,
1180
+ default: !1
1181
+ },
1182
+ allowDrag: Function,
1183
+ allowDrop: Function,
1184
+ props: {
1185
+ default() {
1186
+ return {
1187
+ children: "children",
1188
+ label: "label",
1189
+ disabled: "disabled"
1190
+ };
1191
+ }
1192
+ },
1193
+ lazy: {
1194
+ type: Boolean,
1195
+ default: !1
1196
+ },
1197
+ highlightCurrent: Boolean,
1198
+ load: Function,
1199
+ filterNodeMethod: Function,
1200
+ accordion: Boolean,
1201
+ indent: {
1202
+ type: Number,
1203
+ default: 18
1204
+ },
1205
+ iconClass: String,
1206
+ /** 已展开且未被过滤的各层节点共用一个虚拟窗口,隐藏或收起的子树仍由模型保存。 */
1207
+ virtual: {
1208
+ type: Boolean,
1209
+ default: !1
1210
+ },
1211
+ /**
1212
+ * 仅用于有 renderContent 或默认插槽的虚拟树。行、文件名和复选框先显示,
1213
+ * 图标、菜单等自定义内容由 VirtualTreeRows 分帧安排,轮到本行时再挂载。
1214
+ */
1215
+ deferContent: Boolean,
1216
+ /** 虚拟行可读取调用方的数据字段。例如 loadingKey="pending" 对应 data.pending。 */
1217
+ loadingKey: String
1218
+ },
1219
+ emits: [
1220
+ "node-expand",
1221
+ "current-change",
1222
+ "check-change",
1223
+ "check",
1224
+ "node-click",
1225
+ "node-contextmenu",
1226
+ "node-collapse",
1227
+ "node-drag-start",
1228
+ "node-drag-enter",
1229
+ "node-drag-leave",
1230
+ "node-drag-over",
1231
+ "node-drag-end",
1232
+ "node-drop"
1233
+ ],
1234
+ setup(e, { emit: t, expose: n }) {
1235
+ const d = rt(), o = at();
1236
+ function a() {
1237
+ return e.deferContent && !!(e.renderContent || d.default);
1238
+ }
1239
+ const r = S(null), s = S(null), u = S(null), l = S(), y = S(), g = S(), C = ve({
1240
+ showDropIndicator: !1,
1241
+ draggingNode: null,
1242
+ dropNode: null,
1243
+ allowDrop: !0,
1244
+ dropType: ""
1245
+ }), p = [];
1246
+ function v(i) {
1247
+ p.push(i);
1248
+ }
1249
+ function K(i) {
1250
+ p.forEach((c) => c(i));
1251
+ }
1252
+ function k(i, ...c) {
1253
+ t(i, ...c);
1254
+ }
1255
+ st("vueTree", {
1256
+ get store() {
1257
+ return r.value;
1258
+ },
1259
+ get nodeKey() {
1260
+ return e.nodeKey;
1261
+ },
1262
+ get props() {
1263
+ return e.props;
1264
+ },
1265
+ get expandOnClickNode() {
1266
+ return e.expandOnClickNode;
1267
+ },
1268
+ get checkOnClickNode() {
1269
+ return e.checkOnClickNode;
1270
+ },
1271
+ get checkStrictly() {
1272
+ return e.checkStrictly;
1273
+ },
1274
+ get draggable() {
1275
+ return e.draggable;
1276
+ },
1277
+ get accordion() {
1278
+ return e.accordion;
1279
+ },
1280
+ get indent() {
1281
+ return e.indent;
1282
+ },
1283
+ get loadingKey() {
1284
+ return e.loadingKey;
1285
+ },
1286
+ get iconClass() {
1287
+ return e.iconClass;
1288
+ },
1289
+ get currentNode() {
1290
+ return u.value;
1291
+ },
1292
+ set currentNode(i) {
1293
+ u.value = i;
1294
+ },
1295
+ slots: d,
1296
+ emitEvent: k,
1297
+ broadcastTreeNodeExpand: K,
1298
+ onAccordionExpand: v,
1299
+ handleVirtualNodeExpand: Ye,
1300
+ handleTreeNodeDragStart: Je,
1301
+ handleTreeNodeDragOver: Qe,
1302
+ handleTreeNodeDragEnd: Xe
1303
+ }), r.value = new ht({
1304
+ key: e.nodeKey,
1305
+ isVirtual: () => e.virtual,
1306
+ data: e.data,
1307
+ lazy: e.lazy,
1308
+ props: e.props,
1309
+ load: e.load,
1310
+ currentNodeKey: e.currentNodeKey,
1311
+ checkStrictly: e.checkStrictly,
1312
+ checkDescendants: e.checkDescendants,
1313
+ defaultCheckedKeys: e.defaultCheckedKeys,
1314
+ defaultExpandedKeys: e.defaultExpandedKeys,
1315
+ autoExpandParent: e.autoExpandParent,
1316
+ defaultExpandAll: e.defaultExpandAll,
1317
+ filterNodeMethod: e.filterNodeMethod
1318
+ }), s.value = r.value.root, e.virtual && r.value.initializeRoot();
1319
+ const E = z(() => e.virtual ? ut(s.value) : []), L = (i) => Z(i) ?? i.id;
1320
+ ft(s.value, () => e.virtual, () => e.lazy, (i) => {
1321
+ t("check-change", i.data, i.checked, i.indeterminate);
1322
+ });
1323
+ function Z(i) {
1324
+ return he(e.nodeKey, i.data);
1325
+ }
1326
+ const oe = z(() => {
1327
+ const i = s.value.childNodes;
1328
+ return !i || i.length === 0 || i.every(({ visible: c }) => !c);
1329
+ });
1330
+ I(
1331
+ () => e.defaultCheckedKeys,
1332
+ (i) => {
1333
+ r.value.setDefaultCheckedKey(i);
1334
+ }
1335
+ ), I(
1336
+ () => e.defaultExpandedKeys,
1337
+ (i) => {
1338
+ r.value.defaultExpandedKeys = i, r.value.setDefaultExpandedKeys(i);
1339
+ }
1340
+ ), I(
1341
+ () => e.data,
1342
+ (i) => {
1343
+ r.value.setData(i), e.currentNodeKey && r.value.setCurrentNodeKey(e.currentNodeKey);
1344
+ }
1345
+ ), I(
1346
+ () => e.currentNodeKey,
1347
+ (i) => {
1348
+ i && r.value.setCurrentNodeKey(i);
1349
+ }
1350
+ ), I(
1351
+ () => e.checkStrictly,
1352
+ (i) => {
1353
+ r.value.checkStrictly = !!i;
1354
+ }
1355
+ );
1356
+ function fe(i) {
1357
+ if (!e.filterNodeMethod) throw new Error("[Tree] filterNodeMethod is required when filter");
1358
+ r.value.filter(i);
1359
+ }
1360
+ function ie(i) {
1361
+ if (!e.nodeKey) throw new Error("[Tree] nodeKey is required in getNodePath");
1362
+ const c = r.value.getNode(i);
1363
+ if (!c) return [];
1364
+ const h = [c.data];
1365
+ let N = c.parent;
1366
+ for (; N && N !== s.value; )
1367
+ h.push(N.data), N = N.parent;
1368
+ return h.reverse();
1369
+ }
1370
+ function f(i, c) {
1371
+ return r.value.getCheckedNodes(i, c);
1372
+ }
1373
+ function B(i) {
1374
+ return r.value.getCheckedKeys(i);
1375
+ }
1376
+ function M() {
1377
+ const i = r.value.getCurrentNode();
1378
+ return i ? i.data : null;
1379
+ }
1380
+ function Oe() {
1381
+ if (!e.nodeKey) throw new Error("[Tree] nodeKey is required in getCurrentKey");
1382
+ const i = M();
1383
+ return i ? i[e.nodeKey] : null;
1384
+ }
1385
+ function $e(i, c) {
1386
+ if (!e.nodeKey) throw new Error("[Tree] nodeKey is required in setCheckedNodes");
1387
+ r.value.setCheckedNodes(i, c);
1388
+ }
1389
+ function Ae(i, c) {
1390
+ if (!e.nodeKey) throw new Error("[Tree] nodeKey is required in setCheckedKeys");
1391
+ r.value.setCheckedKeys(i, c);
1392
+ }
1393
+ function Le(i, c, h) {
1394
+ r.value.setChecked(i, c, h);
1395
+ }
1396
+ function Ie() {
1397
+ return r.value.getHalfCheckedNodes();
1398
+ }
1399
+ function Ve() {
1400
+ return r.value.getHalfCheckedKeys();
1401
+ }
1402
+ function Me(i) {
1403
+ if (!e.nodeKey) throw new Error("[Tree] nodeKey is required in setCurrentNode");
1404
+ r.value.setUserCurrentNode(i);
1405
+ }
1406
+ function Re(i) {
1407
+ if (!e.nodeKey) throw new Error("[Tree] nodeKey is required in setCurrentKey");
1408
+ r.value.setCurrentNodeKey(i);
1409
+ }
1410
+ function ge(i) {
1411
+ if (!e.virtual || !e.nodeKey) return -1;
1412
+ const c = r.value.getNode(i);
1413
+ return c ? E.value.indexOf(c) : -1;
1414
+ }
1415
+ function ze(i) {
1416
+ var h;
1417
+ const c = ge(i);
1418
+ return c >= 0 && !!((h = g.value) != null && h.isIndexVisible(c));
1419
+ }
1420
+ async function qe(i) {
1421
+ var h;
1422
+ if (!e.virtual) return;
1423
+ await X();
1424
+ const c = ge(i);
1425
+ c >= 0 && await ((h = g.value) == null ? void 0 : h.scrollToIndex(c));
1426
+ }
1427
+ function je(i) {
1428
+ return r.value.getNode(i);
1429
+ }
1430
+ function Fe(i) {
1431
+ r.value.remove(i);
1432
+ }
1433
+ function Pe(i, c) {
1434
+ r.value.append(i, c);
1435
+ }
1436
+ function He(i, c) {
1437
+ r.value.insertBefore(i, c);
1438
+ }
1439
+ function Ue(i, c) {
1440
+ r.value.insertAfter(i, c);
1441
+ }
1442
+ function We(i, c, h) {
1443
+ K(c), t("node-expand", i, c, h);
1444
+ }
1445
+ function Ye(i, c, h) {
1446
+ e.accordion && r.value.collapseOtherBranches(c), t("node-expand", i, c, h);
1447
+ }
1448
+ function Ze(i, c, h) {
1449
+ t("node-collapse", i, c, h);
1450
+ }
1451
+ function Ge(i, c) {
1452
+ if (!e.nodeKey) throw new Error("[Tree] nodeKey is required in updateKeyChild");
1453
+ r.value.updateChildren(i, c);
1454
+ }
1455
+ function Je(i, c) {
1456
+ if (typeof e.allowDrag == "function" && !e.allowDrag(c.node))
1457
+ return i.preventDefault(), !1;
1458
+ i.dataTransfer.effectAllowed = "move";
1459
+ try {
1460
+ i.dataTransfer.setData("text/plain", "");
1461
+ } catch {
1462
+ }
1463
+ C.draggingNode = c, t("node-drag-start", c.node, i);
1464
+ }
1465
+ function Qe(i, c) {
1466
+ var ke;
1467
+ const h = c, N = C.dropNode;
1468
+ N && N !== h && ce(N.$el, "is-drop-inner");
1469
+ const m = C.draggingNode;
1470
+ if (!m || !h) return;
1471
+ let T = !0, w = !0, D = !0, O = !0;
1472
+ typeof e.allowDrop == "function" && (T = e.allowDrop(m.node, h.node, "prev"), O = w = e.allowDrop(m.node, h.node, "inner"), D = e.allowDrop(m.node, h.node, "next")), i.dataTransfer.dropEffect = w ? "move" : "none", (T || w || D) && N !== h && (N && t("node-drag-leave", m.node, N.node, i), t("node-drag-enter", m.node, h.node, i)), (T || w || D) && (C.dropNode = h), h.node.nextSibling === m.node && (D = !1), h.node.previousSibling === m.node && (T = !1), h.node.contains(m.node, !1) && (w = !1), (m.node === h.node || m.node.contains(h.node)) && (T = !1, w = !1, D = !1);
1473
+ const j = h.$el.getBoundingClientRect(), re = ((ke = o == null ? void 0 : o.proxy) == null ? void 0 : ke.$el).getBoundingClientRect();
1474
+ let V;
1475
+ const tt = T ? w ? 0.25 : D ? 0.45 : 1 : -1, nt = D ? w ? 0.75 : T ? 0.55 : 0 : 1;
1476
+ let ae = -9999;
1477
+ const ye = i.clientY - j.top;
1478
+ ye < j.height * tt ? V = "before" : ye > j.height * nt ? V = "after" : w ? V = "inner" : V = "none";
1479
+ const se = h.$el.querySelector(".vue-tree-node__expand-icon").getBoundingClientRect(), le = l.value;
1480
+ V === "before" ? ae = se.top - re.top : V === "after" && (ae = se.bottom - re.top), le && (le.style.top = ae + "px", le.style.left = se.right - re.left + "px"), V === "inner" ? Bt(h.$el, "is-drop-inner") : ce(h.$el, "is-drop-inner"), C.showDropIndicator = V === "before" || V === "after", C.allowDrop = C.showDropIndicator || O, C.dropType = V, t("node-drag-over", m.node, h.node, i);
1481
+ }
1482
+ function Xe(i) {
1483
+ const { draggingNode: c, dropType: h, dropNode: N } = C;
1484
+ if (i.preventDefault(), i.dataTransfer.dropEffect = "move", c && N) {
1485
+ const m = { data: c.node.data };
1486
+ h !== "none" && c.node.remove(), h === "before" ? N.node.parent.insertBefore(m, N.node) : h === "after" ? N.node.parent.insertAfter(m, N.node) : h === "inner" && N.node.insertChild(m), h !== "none" && r.value.registerNode(m), ce(N.$el, "is-drop-inner"), t("node-drag-end", c.node, N.node, h, i), h !== "none" && t("node-drop", c.node, N.node, h, i);
1487
+ }
1488
+ c && !N && t("node-drag-end", c.node, null, h, i), C.showDropIndicator = !1, C.draggingNode = null, C.dropNode = null, C.allowDrop = !0;
1489
+ }
1490
+ function _e(i) {
1491
+ var D;
1492
+ const c = i.target;
1493
+ if (c.className.indexOf("vue-tree-node") === -1) return;
1494
+ const h = (D = o == null ? void 0 : o.proxy) == null ? void 0 : D.$el, N = Array.from(
1495
+ h.querySelectorAll(".is-focusable[role=treeitem]")
1496
+ ), m = N.indexOf(c);
1497
+ let T;
1498
+ [38, 40].indexOf(i.keyCode) > -1 && (i.preventDefault(), i.keyCode === 38 ? T = m !== 0 ? m - 1 : 0 : T = m < N.length - 1 ? m + 1 : 0, N[T].focus()), [37, 39].indexOf(i.keyCode) > -1 && (i.preventDefault(), c.click());
1499
+ const w = c.querySelector('[type="checkbox"]');
1500
+ [13, 32].indexOf(i.keyCode) > -1 && w && (i.preventDefault(), w.click());
1501
+ }
1502
+ async function et(i) {
1503
+ var h, N, m, T;
1504
+ const c = i.target;
1505
+ if (c.matches('.vue-tree-node[role="treeitem"]')) {
1506
+ if (i.key === "ArrowUp" || i.key === "ArrowDown") {
1507
+ i.preventDefault();
1508
+ const w = i.key === "ArrowDown" ? 1 : -1, D = E.value;
1509
+ let O = D.findIndex((G) => String(G.id) === c.dataset.treeNodeId);
1510
+ if (O < 0) return;
1511
+ do
1512
+ O += w;
1513
+ while (O >= 0 && O < D.length && D[O].disabled);
1514
+ w === 1 && O === D.length && (O = D.findIndex((G) => !G.disabled));
1515
+ const j = D[O];
1516
+ if (!j) return;
1517
+ (h = g.value) != null && h.isIndexVisible(O) || await ((N = g.value) == null ? void 0 : N.scrollToIndex(O)), (T = (m = y.value) == null ? void 0 : m.querySelector(
1518
+ `[data-tree-node-id="${j.id}"]`
1519
+ )) == null || T.focus();
1520
+ } else if (i.key === "ArrowLeft" || i.key === "ArrowRight")
1521
+ i.preventDefault(), c.click();
1522
+ else if (i.key === "Enter" || i.key === " ") {
1523
+ const w = c.querySelector('[type="checkbox"]');
1524
+ w && (i.preventDefault(), w.click());
1525
+ }
1526
+ }
1527
+ }
1528
+ return Ee(() => {
1529
+ var c;
1530
+ ((c = o == null ? void 0 : o.proxy) == null ? void 0 : c.$el).addEventListener("keydown", (h) => {
1531
+ e.virtual ? et(h) : _e(h);
1532
+ });
1533
+ }), n({
1534
+ filter: fe,
1535
+ getNodePath: ie,
1536
+ getCheckedNodes: f,
1537
+ getCheckedKeys: B,
1538
+ getCurrentNode: M,
1539
+ getCurrentKey: Oe,
1540
+ setCheckedNodes: $e,
1541
+ setCheckedKeys: Ae,
1542
+ setChecked: Le,
1543
+ getHalfCheckedNodes: Ie,
1544
+ getHalfCheckedKeys: Ve,
1545
+ setCurrentNode: Me,
1546
+ setCurrentKey: Re,
1547
+ isKeyVisible: ze,
1548
+ scrollToKey: qe,
1549
+ getNode: je,
1550
+ remove: Fe,
1551
+ append: Pe,
1552
+ insertBefore: He,
1553
+ insertAfter: Ue,
1554
+ updateKeyChildren: Ge,
1555
+ store: r
1556
+ }), {
1557
+ store: r,
1558
+ root: s,
1559
+ currentNode: u,
1560
+ dragState: C,
1561
+ dropIndicator: l,
1562
+ treeContainerRef: y,
1563
+ virtualListRef: g,
1564
+ expandedRows: E,
1565
+ shouldDeferContent: a,
1566
+ getRowKey: L,
1567
+ isEmpty: oe,
1568
+ getNodeKeyFn: Z,
1569
+ handleNodeExpand: We,
1570
+ handleNodeCollapse: Ze
1571
+ };
1572
+ }
1573
+ }), $t = {
1574
+ key: 2,
1575
+ class: "vue-tree__empty-block"
1576
+ }, At = { class: "vue-tree__empty-text" }, Lt = {
1577
+ class: "vue-tree__drop-indicator",
1578
+ ref: "dropIndicator"
1579
+ };
1580
+ function It(e, t, n, d, o, a) {
1581
+ const r = _("VirtualTreeRows"), s = _("vue-tree-node");
1582
+ return b(), $("div", {
1583
+ ref: "treeContainerRef",
1584
+ class: R(["vue-tree", {
1585
+ "vue-tree--highlight-current": e.highlightCurrent,
1586
+ "vue-tree--virtual": e.virtual,
1587
+ "is-dragging": !!e.dragState.draggingNode,
1588
+ "is-drop-not-allow": !e.dragState.allowDrop,
1589
+ "is-drop-inner": e.dragState.dropType === "inner"
1590
+ }]),
1591
+ role: "tree"
1592
+ }, [
1593
+ e.virtual && !e.isEmpty ? (b(), H(r, {
1594
+ key: 0,
1595
+ ref: "virtualListRef",
1596
+ rows: e.expandedRows,
1597
+ "get-row-key": e.getRowKey,
1598
+ "show-checkbox": e.showCheckbox,
1599
+ "render-content": e.renderContent,
1600
+ "defer-content": e.shouldDeferContent()
1601
+ }, Se({ _: 2 }, [
1602
+ e.$slots["node-loading"] ? {
1603
+ name: "node-loading",
1604
+ fn: te(() => [
1605
+ de(e.$slots, "node-loading")
1606
+ ]),
1607
+ key: "0"
1608
+ } : void 0
1609
+ ]), 1032, ["rows", "get-row-key", "show-checkbox", "render-content", "defer-content"])) : q("", !0),
1610
+ !e.virtual && !e.isEmpty ? (b(!0), $(Ke, { key: 1 }, xe(e.root.childNodes, (u) => (b(), H(s, {
1611
+ key: e.getNodeKeyFn(u),
1612
+ node: u,
1613
+ props: e.props,
1614
+ "render-after-expand": e.renderAfterExpand,
1615
+ "show-checkbox": e.showCheckbox,
1616
+ "render-content": e.renderContent,
1617
+ onNodeExpand: e.handleNodeExpand,
1618
+ onNodeCollapse: e.handleNodeCollapse
1619
+ }, null, 8, ["node", "props", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand", "onNodeCollapse"]))), 128)) : q("", !0),
1620
+ e.isEmpty ? (b(), $("div", $t, [
1621
+ de(e.$slots, "empty", {}, () => [
1622
+ A("span", At, Te(e.emptyText), 1)
1623
+ ])
1624
+ ])) : q("", !0),
1625
+ ee(A("div", Lt, null, 512), [
1626
+ [ne, e.dragState.showDropIndicator]
1627
+ ])
1628
+ ], 2);
1629
+ }
1630
+ const Rt = /* @__PURE__ */ ue(Ot, [["render", It]]);
1631
+ export {
1632
+ Rt as VueTree,
1633
+ Rt as default
1634
+ };