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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1159 @@
1
+ import { defineComponent as oe, h as te, Transition as Re, inject as Ue, ref as b, computed as pe, watch as T, nextTick as he, onMounted as ge, resolveComponent as R, withDirectives as ne, openBlock as m, createElementBlock as O, withModifiers as L, normalizeClass as P, createElementVNode as A, normalizeStyle as Ve, createCommentVNode as $, createBlock as U, resolveDynamicComponent as We, createVNode as Ne, withCtx as ke, Fragment as Ce, renderList as ve, vShow as de, useSlots as Ye, getCurrentInstance as Ge, reactive as Je, provide as Qe, renderSlot as Xe, toDisplayString as Ze } from "vue";
2
+ import _e from "@cw-devops-fe/virtual-list-vue3";
3
+ const I = "$treeNodeId", ue = function(t, e) {
4
+ !e || e[I] || Object.defineProperty(e, I, {
5
+ value: t.id,
6
+ enumerable: !1,
7
+ configurable: !1,
8
+ writable: !1
9
+ });
10
+ }, re = function(t, e) {
11
+ return t ? e[t] : e[I];
12
+ }, H = (t) => {
13
+ let e = !0, n = !0, d = !0;
14
+ for (let r = 0, s = t.length; r < s; r++) {
15
+ const l = t[r];
16
+ (l.checked !== !0 || l.indeterminate) && (e = !1, l.disabled || (d = !1)), (l.checked !== !1 || l.indeterminate) && (n = !1);
17
+ }
18
+ return { all: e, none: n, allWithoutDisable: d, half: !e && !n };
19
+ }, F = function(t) {
20
+ if (t.childNodes.length === 0 || t.loading) return;
21
+ const { all: e, half: n, none: d } = H(t.childNodes);
22
+ e ? (t.checked = !0, t.indeterminate = !1) : n ? (t.checked = !1, t.indeterminate = !0) : d && (t.checked = !1, t.indeterminate = !1);
23
+ const r = t.parent;
24
+ !r || r.level === 0 || t.store.checkStrictly || F(r);
25
+ }, q = function(t, e) {
26
+ const n = t.store.props, d = t.data || {}, r = n[e];
27
+ if (typeof r == "function")
28
+ return r(d, t);
29
+ if (typeof r == "string")
30
+ return d[r];
31
+ if (typeof r > "u") {
32
+ const s = d[e];
33
+ return s === void 0 ? "" : s;
34
+ }
35
+ };
36
+ let et = 0;
37
+ class M {
38
+ constructor(e) {
39
+ this.id = et++, 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;
40
+ for (const l in e)
41
+ Object.prototype.hasOwnProperty.call(e, l) && (this[l] = e[l]);
42
+ this.level = 0, this.loaded = !1, this.childNodes = [], this.loading = !1, this.parent && (this.level = this.parent.level + 1);
43
+ const n = this.store;
44
+ if (!n)
45
+ throw new Error("[Node]store is required!");
46
+ n.registerNode(this);
47
+ const d = n.props;
48
+ if (d && typeof d.isLeaf < "u") {
49
+ const l = q(this, "isLeaf");
50
+ typeof l == "boolean" && (this.isLeafByUser = l);
51
+ }
52
+ 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) || ue(this, this.data), !this.data) return;
53
+ const r = n.defaultExpandedKeys, s = n.key;
54
+ s && r && r.indexOf(this.key) !== -1 && this.expand(null, n.autoExpandParent), s && n.currentNodeKey !== void 0 && this.key === n.currentNodeKey && (n.currentNode = this, n.currentNode.isCurrent = !0), n.lazy && n._initDefaultCheckedNode(this), this.updateLeafState();
55
+ }
56
+ setData(e) {
57
+ Array.isArray(e) || ue(this, e), this.data = e, this.childNodes = [];
58
+ let n;
59
+ this.level === 0 && this.data instanceof Array ? n = this.data : n = q(this, "children") || [];
60
+ for (let d = 0, r = n.length; d < r; d++)
61
+ this.insertChild({ data: n[d] });
62
+ }
63
+ get label() {
64
+ return q(this, "label");
65
+ }
66
+ get key() {
67
+ const e = this.store.key;
68
+ return this.data ? this.data[e] : null;
69
+ }
70
+ get disabled() {
71
+ return q(this, "disabled");
72
+ }
73
+ get nextSibling() {
74
+ const e = this.parent;
75
+ if (e) {
76
+ const n = e.childNodes.indexOf(this);
77
+ if (n > -1)
78
+ return e.childNodes[n + 1];
79
+ }
80
+ return null;
81
+ }
82
+ get previousSibling() {
83
+ const e = this.parent;
84
+ if (e) {
85
+ const n = e.childNodes.indexOf(this);
86
+ if (n > -1)
87
+ return n > 0 ? e.childNodes[n - 1] : null;
88
+ }
89
+ return null;
90
+ }
91
+ contains(e, n = !0) {
92
+ const d = function(r) {
93
+ const s = r.childNodes || [];
94
+ let l = !1;
95
+ for (let c = 0, y = s.length; c < y; c++) {
96
+ const u = s[c];
97
+ if (u === e || n && d(u)) {
98
+ l = !0;
99
+ break;
100
+ }
101
+ }
102
+ return l;
103
+ };
104
+ return d(this);
105
+ }
106
+ remove() {
107
+ const e = this.parent;
108
+ e && e.removeChild(this);
109
+ }
110
+ insertChild(e, n, d) {
111
+ if (!e) throw new Error("insertChild error: child is required.");
112
+ if (!(e instanceof M)) {
113
+ if (!d) {
114
+ const r = this.getChildren(!0) || [];
115
+ r.indexOf(e.data) === -1 && (typeof n > "u" || n < 0 ? r.push(e.data) : r.splice(n, 0, e.data));
116
+ }
117
+ Object.assign(e, { parent: this, store: this.store }), e = new M(e);
118
+ }
119
+ e.level = this.level + 1, typeof n > "u" || n < 0 ? this.childNodes.push(e) : this.childNodes.splice(n, 0, e), this.updateLeafState();
120
+ }
121
+ insertBefore(e, n) {
122
+ let d;
123
+ n && (d = this.childNodes.indexOf(n)), this.insertChild(e, d);
124
+ }
125
+ insertAfter(e, n) {
126
+ let d;
127
+ n && (d = this.childNodes.indexOf(n), d !== -1 && (d += 1)), this.insertChild(e, d);
128
+ }
129
+ removeChild(e) {
130
+ const n = this.getChildren() || [], d = n.indexOf(e.data);
131
+ d > -1 && n.splice(d, 1);
132
+ const r = this.childNodes.indexOf(e);
133
+ r > -1 && (this.store && this.store.deregisterNode(e), e.parent = null, this.childNodes.splice(r, 1)), this.updateLeafState();
134
+ }
135
+ removeChildByData(e) {
136
+ let n = null;
137
+ for (let d = 0; d < this.childNodes.length; d++)
138
+ if (this.childNodes[d].data === e) {
139
+ n = this.childNodes[d];
140
+ break;
141
+ }
142
+ n && this.removeChild(n);
143
+ }
144
+ expand(e, n) {
145
+ const d = () => {
146
+ if (n) {
147
+ let r = this.parent;
148
+ for (; r.level > 0; )
149
+ r.expanded = !0, r = r.parent;
150
+ }
151
+ this.expanded = !0, e && e();
152
+ };
153
+ this.shouldLoadData() ? this.loadData((r) => {
154
+ r instanceof Array && (this.checked ? this.setChecked(!0, !0) : this.store.checkStrictly || F(this), d());
155
+ }) : d();
156
+ }
157
+ doCreateChildren(e, n = {}) {
158
+ e.forEach((d) => {
159
+ this.insertChild(Object.assign({ data: d }, n), void 0, !0);
160
+ });
161
+ }
162
+ collapse() {
163
+ this.expanded = !1;
164
+ }
165
+ shouldLoadData() {
166
+ return this.store.lazy === !0 && this.store.load && !this.loaded;
167
+ }
168
+ updateLeafState() {
169
+ if (this.store.lazy === !0 && this.loaded !== !0 && typeof this.isLeafByUser < "u") {
170
+ this.isLeaf = this.isLeafByUser;
171
+ return;
172
+ }
173
+ const e = this.childNodes;
174
+ if (!this.store.lazy || this.store.lazy === !0 && this.loaded === !0) {
175
+ this.isLeaf = !e || e.length === 0;
176
+ return;
177
+ }
178
+ this.isLeaf = !1;
179
+ }
180
+ setChecked(e, n, d, r) {
181
+ if (this.indeterminate = e === "half", this.checked = e === !0, this.store.checkStrictly) return;
182
+ if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
183
+ const { allWithoutDisable: l } = H(this.childNodes);
184
+ !this.isLeaf && !H(this.childNodes).all && l && (this.checked = !1, e = !1);
185
+ const c = () => {
186
+ if (n) {
187
+ const y = this.childNodes;
188
+ for (let g = 0, C = y.length; g < C; g++) {
189
+ const E = y[g];
190
+ r = r || e !== !1;
191
+ const w = E.disabled ? E.checked : r;
192
+ E.setChecked(w, n, !0, r);
193
+ }
194
+ const { half: u, all: k } = H(y);
195
+ k || (this.checked = k, this.indeterminate = u);
196
+ }
197
+ };
198
+ if (this.shouldLoadData()) {
199
+ this.loadData(
200
+ () => {
201
+ c(), F(this);
202
+ },
203
+ { checked: e !== !1 }
204
+ );
205
+ return;
206
+ } else
207
+ c();
208
+ }
209
+ const s = this.parent;
210
+ !s || s.level === 0 || d || F(s);
211
+ }
212
+ getChildren(e = !1) {
213
+ if (this.level === 0) return this.data;
214
+ const n = this.data;
215
+ if (!n) return null;
216
+ const d = this.store.props;
217
+ let r = "children";
218
+ return d && (r = d.children || "children"), n[r] === void 0 && (n[r] = null), e && !n[r] && (n[r] = []), n[r];
219
+ }
220
+ updateChildren() {
221
+ const e = this.getChildren() || [], n = this.childNodes.map((s) => s.data), d = {}, r = [];
222
+ e.forEach((s, l) => {
223
+ const c = s[I];
224
+ !!c && n.findIndex((u) => u[I] === c) >= 0 ? d[c] = { index: l, data: s } : r.push({ index: l, data: s });
225
+ }), this.store.lazy || n.forEach((s) => {
226
+ d[s[I]] || this.removeChildByData(s);
227
+ }), r.forEach(({ index: s, data: l }) => {
228
+ this.insertChild({ data: l }, s);
229
+ }), this.updateLeafState();
230
+ }
231
+ loadData(e, n = {}) {
232
+ if (this.store.lazy === !0 && this.store.load && !this.loaded && (!this.loading || Object.keys(n).length)) {
233
+ this.loading = !0;
234
+ const d = (r) => {
235
+ this.childNodes = [], this.doCreateChildren(r, n), this.loaded = !0, this.loading = !1, this.updateLeafState(), e && e.call(this, r);
236
+ };
237
+ this.store.load(this, d);
238
+ } else
239
+ e && e.call(this);
240
+ }
241
+ }
242
+ class tt {
243
+ constructor(e) {
244
+ 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;
245
+ for (const n in e)
246
+ Object.prototype.hasOwnProperty.call(e, n) && (this[n] = e[n]);
247
+ if (this.nodesMap = {}, this.root = new M({
248
+ data: this.data,
249
+ store: this
250
+ }), this.lazy && this.load) {
251
+ const n = this.load;
252
+ n(this.root, (d) => {
253
+ this.root.doCreateChildren(d), this._initDefaultCheckedNodes();
254
+ });
255
+ } else
256
+ this._initDefaultCheckedNodes();
257
+ }
258
+ filter(e) {
259
+ const n = this.filterNodeMethod, d = this.lazy, r = function(s) {
260
+ const l = s.root ? s.root.childNodes : s.childNodes;
261
+ if (l.forEach((c) => {
262
+ c.visible = n.call(c, e, c.data, c), r(c);
263
+ }), !s.visible && l.length) {
264
+ let c = !0;
265
+ c = !l.some((y) => y.visible), s.root ? s.root.visible = c === !1 : s.visible = c === !1;
266
+ }
267
+ e && s.visible && !s.isLeaf && !d && s.expand();
268
+ };
269
+ r(this);
270
+ }
271
+ setData(e) {
272
+ e !== this.root.data ? (this.root.setData(e), this._initDefaultCheckedNodes()) : this.root.updateChildren();
273
+ }
274
+ getNode(e) {
275
+ if (e instanceof M) return e;
276
+ const n = typeof e != "object" ? e : re(this.key, e);
277
+ return this.nodesMap[n] || null;
278
+ }
279
+ insertBefore(e, n) {
280
+ const d = this.getNode(n);
281
+ d.parent.insertBefore({ data: e }, d);
282
+ }
283
+ insertAfter(e, n) {
284
+ const d = this.getNode(n);
285
+ d.parent.insertAfter({ data: e }, d);
286
+ }
287
+ remove(e) {
288
+ const n = this.getNode(e);
289
+ n && n.parent && (n === this.currentNode && (this.currentNode = null), n.parent.removeChild(n));
290
+ }
291
+ append(e, n) {
292
+ const d = n ? this.getNode(n) : this.root;
293
+ d && d.insertChild({ data: e });
294
+ }
295
+ _initDefaultCheckedNodes() {
296
+ const e = this.defaultCheckedKeys || [], n = this.nodesMap;
297
+ e.forEach((d) => {
298
+ const r = n[d];
299
+ r && r.setChecked(!0, !this.checkStrictly);
300
+ });
301
+ }
302
+ _initDefaultCheckedNode(e) {
303
+ (this.defaultCheckedKeys || []).indexOf(e.key) !== -1 && e.setChecked(!0, !this.checkStrictly);
304
+ }
305
+ setDefaultCheckedKey(e) {
306
+ e !== this.defaultCheckedKeys && (this.defaultCheckedKeys = e, this._initDefaultCheckedNodes());
307
+ }
308
+ registerNode(e) {
309
+ if (!this.key || !e || !e.data) return;
310
+ e.key !== void 0 && (this.nodesMap[e.key] = e);
311
+ }
312
+ deregisterNode(e) {
313
+ !this.key || !e || !e.data || (e.childNodes.forEach((d) => {
314
+ this.deregisterNode(d);
315
+ }), delete this.nodesMap[e.key]);
316
+ }
317
+ getCheckedNodes(e = !1, n = !1) {
318
+ const d = [], r = function(s) {
319
+ (s.root ? s.root.childNodes : s.childNodes).forEach((c) => {
320
+ (c.checked || n && c.indeterminate) && (!e || e && c.isLeaf) && d.push(c.data), r(c);
321
+ });
322
+ };
323
+ return r(this), d;
324
+ }
325
+ getCheckedKeys(e = !1) {
326
+ return this.getCheckedNodes(e).map((n) => (n || {})[this.key]);
327
+ }
328
+ getHalfCheckedNodes() {
329
+ const e = [], n = function(d) {
330
+ (d.root ? d.root.childNodes : d.childNodes).forEach((s) => {
331
+ s.indeterminate && e.push(s.data), n(s);
332
+ });
333
+ };
334
+ return n(this), e;
335
+ }
336
+ getHalfCheckedKeys() {
337
+ return this.getHalfCheckedNodes().map((e) => (e || {})[this.key]);
338
+ }
339
+ _getAllNodes() {
340
+ const e = [], n = this.nodesMap;
341
+ for (const d in n)
342
+ Object.prototype.hasOwnProperty.call(n, d) && e.push(n[d]);
343
+ return e;
344
+ }
345
+ updateChildren(e, n) {
346
+ const d = this.nodesMap[e];
347
+ if (!d) return;
348
+ const r = d.childNodes;
349
+ for (let s = r.length - 1; s >= 0; s--) {
350
+ const l = r[s];
351
+ this.remove(l.data);
352
+ }
353
+ for (let s = 0, l = n.length; s < l; s++) {
354
+ const c = n[s];
355
+ this.append(c, d.data);
356
+ }
357
+ }
358
+ _setCheckedKeys(e, n = !1, d) {
359
+ const r = this._getAllNodes().sort((c, y) => y.level - c.level), s = /* @__PURE__ */ Object.create(null), l = Object.keys(d);
360
+ r.forEach((c) => c.setChecked(!1, !1));
361
+ for (let c = 0, y = r.length; c < y; c++) {
362
+ const u = r[c], k = u.data[e].toString();
363
+ if (!(l.indexOf(k) > -1)) {
364
+ u.checked && !s[k] && u.setChecked(!1, !1);
365
+ continue;
366
+ }
367
+ let C = u.parent;
368
+ for (; C && C.level > 0; )
369
+ s[C.data[e]] = !0, C = C.parent;
370
+ if (u.isLeaf || this.checkStrictly) {
371
+ u.setChecked(!0, !1);
372
+ continue;
373
+ }
374
+ if (u.setChecked(!0, !0), n) {
375
+ u.setChecked(!1, !1);
376
+ const E = function(w) {
377
+ w.childNodes.forEach((S) => {
378
+ S.isLeaf || S.setChecked(!1, !1), E(S);
379
+ });
380
+ };
381
+ E(u);
382
+ }
383
+ }
384
+ }
385
+ setCheckedNodes(e, n = !1) {
386
+ const d = this.key, r = {};
387
+ e.forEach((s) => {
388
+ r[(s || {})[d]] = !0;
389
+ }), this._setCheckedKeys(d, n, r);
390
+ }
391
+ setCheckedKeys(e, n = !1) {
392
+ this.defaultCheckedKeys = e;
393
+ const d = this.key, r = {};
394
+ e.forEach((s) => {
395
+ r[s] = !0;
396
+ }), this._setCheckedKeys(d, n, r);
397
+ }
398
+ setDefaultExpandedKeys(e) {
399
+ e = e || [], this.defaultExpandedKeys = e, e.forEach((n) => {
400
+ const d = this.getNode(n);
401
+ d && d.expand(null, this.autoExpandParent);
402
+ });
403
+ }
404
+ setChecked(e, n, d) {
405
+ const r = this.getNode(e);
406
+ r && r.setChecked(!!n, d);
407
+ }
408
+ getCurrentNode() {
409
+ return this.currentNode;
410
+ }
411
+ setCurrentNode(e) {
412
+ const n = this.currentNode;
413
+ n && (n.isCurrent = !1), this.currentNode = e, this.currentNode.isCurrent = !0;
414
+ }
415
+ setUserCurrentNode(e) {
416
+ const n = e[this.key], d = this.nodesMap[n];
417
+ this.setCurrentNode(d);
418
+ }
419
+ setCurrentNodeKey(e) {
420
+ if (e == null) {
421
+ this.currentNode && (this.currentNode.isCurrent = !1), this.currentNode = null;
422
+ return;
423
+ }
424
+ const n = this.getNode(e);
425
+ n && this.setCurrentNode(n);
426
+ }
427
+ }
428
+ const fe = (t, e) => t.classList.add(e), ye = (t, e) => t.classList.remove(e), nt = oe({
429
+ name: "TreeCollapseTransition",
430
+ setup(t, { slots: e }) {
431
+ return () => te(
432
+ Re,
433
+ {
434
+ onBeforeEnter(n) {
435
+ const d = n;
436
+ fe(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";
437
+ },
438
+ onEnter(n) {
439
+ const d = n;
440
+ 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";
441
+ },
442
+ onAfterEnter(n) {
443
+ const d = n;
444
+ ye(d, "collapse-transition"), d.style.height = "", d.style.overflow = d.dataset.oldOverflow || "";
445
+ },
446
+ onBeforeLeave(n) {
447
+ const d = n;
448
+ 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";
449
+ },
450
+ onLeave(n) {
451
+ const d = n;
452
+ d.scrollHeight !== 0 && (fe(d, "collapse-transition"), d.style.height = "0", d.style.paddingTop = "0", d.style.paddingBottom = "0");
453
+ },
454
+ onAfterLeave(n) {
455
+ const d = n;
456
+ ye(d, "collapse-transition"), d.style.height = "", d.style.overflow = d.dataset.oldOverflow || "", d.style.paddingTop = d.dataset.oldPaddingTop || "", d.style.paddingBottom = d.dataset.oldPaddingBottom || "";
457
+ }
458
+ },
459
+ e.default
460
+ );
461
+ }
462
+ }), dt = oe({
463
+ name: "VueTreeNode",
464
+ components: {
465
+ TreeCollapseTransition: nt
466
+ },
467
+ props: {
468
+ node: {
469
+ type: Object,
470
+ required: !0
471
+ },
472
+ renderContent: Function,
473
+ renderAfterExpand: {
474
+ type: Boolean,
475
+ default: !0
476
+ },
477
+ showCheckbox: {
478
+ type: Boolean,
479
+ default: !1
480
+ }
481
+ },
482
+ emits: ["node-expand"],
483
+ setup(t, { emit: e }) {
484
+ const n = Ue("vueTree"), d = b(), r = b(!1), s = b(!1), l = b(null), c = b(null), y = pe(() => ({
485
+ props: { node: { type: Object, required: !0 } },
486
+ setup(h) {
487
+ return () => {
488
+ var N;
489
+ return t.renderContent ? t.renderContent(te, {
490
+ _self: n,
491
+ node: h.node,
492
+ data: h.node.data,
493
+ store: h.node.store
494
+ }) : (N = n == null ? void 0 : n.slots) != null && N.default ? n.slots.default({
495
+ node: h.node,
496
+ data: h.node.data
497
+ }) : te("span", { class: "vue-tree-node__label" }, h.node.label);
498
+ };
499
+ }
500
+ }));
501
+ T(
502
+ () => t.node.indeterminate,
503
+ (h) => {
504
+ k(t.node.checked, h);
505
+ }
506
+ ), T(
507
+ () => t.node.checked,
508
+ (h) => {
509
+ k(h, t.node.indeterminate);
510
+ }
511
+ ), T(
512
+ () => t.node.expanded,
513
+ (h) => {
514
+ he(() => r.value = h), h && (s.value = !0);
515
+ }
516
+ );
517
+ function u(h) {
518
+ return re(n.nodeKey, h.data);
519
+ }
520
+ function k(h, N) {
521
+ (l.value !== h || c.value !== N) && n.emitEvent("check-change", t.node.data, h, N), l.value = h, c.value = N;
522
+ }
523
+ function g() {
524
+ const h = n.store;
525
+ h.setCurrentNode(t.node), n.emitEvent(
526
+ "current-change",
527
+ h.currentNode ? h.currentNode.data : null,
528
+ h.currentNode
529
+ ), n.currentNode = d.value, n.expandOnClickNode && E(), n.checkOnClickNode && !t.node.disabled && w({
530
+ target: { checked: !t.node.checked }
531
+ }), n.emitEvent("node-click", t.node.data, t.node, { $el: d.value });
532
+ }
533
+ function C(h) {
534
+ n.emitEvent("node-contextmenu", h, t.node.data, t.node, {
535
+ $el: d.value
536
+ });
537
+ }
538
+ function E() {
539
+ t.node.isLeaf || (r.value ? (n.emitEvent("node-collapse", t.node.data, t.node, {
540
+ $el: d.value
541
+ }), t.node.collapse()) : (t.node.expand(), e("node-expand", t.node.data, t.node, { $el: d.value })));
542
+ }
543
+ function w(h) {
544
+ const N = h.target;
545
+ t.node.setChecked(N.checked, !n.checkStrictly), he(() => {
546
+ const B = n.store;
547
+ n.emitEvent("check", t.node.data, {
548
+ checkedNodes: B.getCheckedNodes(),
549
+ checkedKeys: B.getCheckedKeys(),
550
+ halfCheckedNodes: B.getHalfCheckedNodes(),
551
+ halfCheckedKeys: B.getHalfCheckedKeys()
552
+ });
553
+ });
554
+ }
555
+ function j(h, N, B) {
556
+ n.broadcastTreeNodeExpand(N), n.emitEvent("node-expand", h, N, B);
557
+ }
558
+ function S(h) {
559
+ n.draggable && n.handleTreeNodeDragStart(h, { node: t.node, $el: d.value });
560
+ }
561
+ function V(h) {
562
+ n.draggable && (n.handleTreeNodeDragOver(h, { node: t.node, $el: d.value }), h.preventDefault());
563
+ }
564
+ function W(h) {
565
+ h.preventDefault();
566
+ }
567
+ function Y(h) {
568
+ n.draggable && n.handleTreeNodeDragEnd(h, { node: t.node, $el: d.value });
569
+ }
570
+ const G = (h) => {
571
+ t.node !== h && t.node.collapse();
572
+ };
573
+ ge(() => {
574
+ n.accordion && n.onAccordionExpand(G);
575
+ });
576
+ const z = (n.props || {}).children || "children";
577
+ return T(
578
+ () => {
579
+ var h;
580
+ return (h = t.node.data) == null ? void 0 : h[z];
581
+ },
582
+ () => {
583
+ t.node.updateChildren();
584
+ }
585
+ ), t.node.expanded && (r.value = !0, s.value = !0), {
586
+ tree: n,
587
+ nodeRef: d,
588
+ expanded: r,
589
+ childNodeRendered: s,
590
+ nodeContentComponent: y,
591
+ getNodeKey: u,
592
+ handleClick: g,
593
+ handleContextMenu: C,
594
+ handleExpandIconClick: E,
595
+ handleCheckChange: w,
596
+ handleChildNodeExpand: j,
597
+ handleDragStart: S,
598
+ handleDragOver: V,
599
+ handleDrop: W,
600
+ handleDragEnd: Y
601
+ };
602
+ }
603
+ }), me = (t, e) => {
604
+ const n = t.__vccOpts || t;
605
+ for (const [d, r] of e)
606
+ n[d] = r;
607
+ return n;
608
+ }, ot = ["aria-expanded", "aria-disabled", "aria-checked", "draggable"], rt = ["checked", "disabled"], st = {
609
+ key: 1,
610
+ class: "vue-tree-node__loading-icon vue-icon-loading"
611
+ }, it = ["aria-expanded"];
612
+ function at(t, e, n, d, r, s) {
613
+ var y;
614
+ const l = R("vue-tree-node", !0), c = R("tree-collapse-transition");
615
+ return ne((m(), O("div", {
616
+ class: P(["vue-tree-node", {
617
+ "is-expanded": t.expanded,
618
+ "is-current": t.node.isCurrent,
619
+ "is-hidden": !t.node.visible,
620
+ "is-focusable": !t.node.disabled,
621
+ "is-checked": !t.node.disabled && t.node.checked
622
+ }]),
623
+ onClick: e[3] || (e[3] = L((...u) => t.handleClick && t.handleClick(...u), ["stop"])),
624
+ onContextmenu: e[4] || (e[4] = (...u) => t.handleContextMenu && t.handleContextMenu(...u)),
625
+ role: "treeitem",
626
+ tabindex: "-1",
627
+ "aria-expanded": t.expanded,
628
+ "aria-disabled": t.node.disabled,
629
+ "aria-checked": t.node.checked,
630
+ draggable: (y = t.tree) == null ? void 0 : y.draggable,
631
+ onDragstart: e[5] || (e[5] = L((...u) => t.handleDragStart && t.handleDragStart(...u), ["stop"])),
632
+ onDragover: e[6] || (e[6] = L((...u) => t.handleDragOver && t.handleDragOver(...u), ["stop"])),
633
+ onDragend: e[7] || (e[7] = L((...u) => t.handleDragEnd && t.handleDragEnd(...u), ["stop"])),
634
+ onDrop: e[8] || (e[8] = L((...u) => t.handleDrop && t.handleDrop(...u), ["stop"])),
635
+ ref: "nodeRef"
636
+ }, [
637
+ A("div", {
638
+ class: "vue-tree-node__content",
639
+ style: Ve({ "padding-left": (t.node.level - 1) * t.tree.indent + "px" })
640
+ }, [
641
+ A("span", {
642
+ onClick: e[0] || (e[0] = L((...u) => t.handleExpandIconClick && t.handleExpandIconClick(...u), ["stop"])),
643
+ class: P([
644
+ { "is-leaf": t.node.isLeaf, expanded: !t.node.isLeaf && t.expanded },
645
+ "vue-tree-node__expand-icon",
646
+ t.tree.iconClass ? t.tree.iconClass : "vue-icon-caret-right"
647
+ ])
648
+ }, null, 2),
649
+ t.showCheckbox ? (m(), O("label", {
650
+ key: 0,
651
+ class: P(["vue-checkbox", {
652
+ "is-checked": t.node.checked,
653
+ "is-indeterminate": t.node.indeterminate,
654
+ "is-disabled": !!t.node.disabled
655
+ }]),
656
+ onClick: e[2] || (e[2] = L(() => {
657
+ }, ["stop"]))
658
+ }, [
659
+ A("span", {
660
+ class: P(["vue-checkbox__input", {
661
+ "is-checked": t.node.checked,
662
+ "is-indeterminate": t.node.indeterminate,
663
+ "is-disabled": !!t.node.disabled
664
+ }])
665
+ }, [
666
+ e[9] || (e[9] = A("span", { class: "vue-checkbox__inner" }, null, -1)),
667
+ A("input", {
668
+ type: "checkbox",
669
+ class: "vue-checkbox__original",
670
+ checked: t.node.checked,
671
+ disabled: !!t.node.disabled,
672
+ onChange: e[1] || (e[1] = (...u) => t.handleCheckChange && t.handleCheckChange(...u))
673
+ }, null, 40, rt)
674
+ ], 2)
675
+ ], 2)) : $("", !0),
676
+ t.node.loading ? (m(), O("span", st)) : $("", !0),
677
+ (m(), U(We(t.nodeContentComponent), { node: t.node }, null, 8, ["node"]))
678
+ ], 4),
679
+ Ne(c, null, {
680
+ default: ke(() => [
681
+ !t.renderAfterExpand || t.childNodeRendered ? ne((m(), O("div", {
682
+ key: 0,
683
+ class: "vue-tree-node__children",
684
+ role: "group",
685
+ "aria-expanded": t.expanded
686
+ }, [
687
+ (m(!0), O(Ce, null, ve(t.node.childNodes, (u) => (m(), U(l, {
688
+ key: t.getNodeKey(u),
689
+ "render-content": t.renderContent,
690
+ "render-after-expand": t.renderAfterExpand,
691
+ "show-checkbox": t.showCheckbox,
692
+ node: u,
693
+ onNodeExpand: t.handleChildNodeExpand
694
+ }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "onNodeExpand"]))), 128))
695
+ ], 8, it)), [
696
+ [de, t.expanded]
697
+ ]) : $("", !0)
698
+ ]),
699
+ _: 1
700
+ })
701
+ ], 42, ot)), [
702
+ [de, t.node.visible]
703
+ ]);
704
+ }
705
+ const lt = /* @__PURE__ */ me(dt, [["render", at]]);
706
+ function ct(t, e) {
707
+ if (!t || !e) return;
708
+ const n = e.split(" ");
709
+ for (const d of n)
710
+ d && t.classList.add(d);
711
+ }
712
+ function ee(t, e) {
713
+ if (!t || !e) return;
714
+ const n = e.split(" ");
715
+ for (const d of n)
716
+ d && t.classList.remove(d);
717
+ }
718
+ const ht = oe({
719
+ name: "VueTree",
720
+ components: { VueTreeNode: lt, VirtualList: _e },
721
+ props: {
722
+ data: {
723
+ type: Array,
724
+ default: () => []
725
+ },
726
+ emptyText: {
727
+ type: String,
728
+ default: "暂无数据"
729
+ },
730
+ renderAfterExpand: {
731
+ type: Boolean,
732
+ default: !0
733
+ },
734
+ nodeKey: String,
735
+ checkStrictly: Boolean,
736
+ defaultExpandAll: Boolean,
737
+ expandOnClickNode: {
738
+ type: Boolean,
739
+ default: !0
740
+ },
741
+ checkOnClickNode: Boolean,
742
+ checkDescendants: {
743
+ type: Boolean,
744
+ default: !1
745
+ },
746
+ autoExpandParent: {
747
+ type: Boolean,
748
+ default: !0
749
+ },
750
+ defaultCheckedKeys: Array,
751
+ defaultExpandedKeys: Array,
752
+ currentNodeKey: [String, Number],
753
+ renderContent: Function,
754
+ showCheckbox: {
755
+ type: Boolean,
756
+ default: !1
757
+ },
758
+ draggable: {
759
+ type: Boolean,
760
+ default: !1
761
+ },
762
+ allowDrag: Function,
763
+ allowDrop: Function,
764
+ props: {
765
+ default() {
766
+ return {
767
+ children: "children",
768
+ label: "label",
769
+ disabled: "disabled"
770
+ };
771
+ }
772
+ },
773
+ lazy: {
774
+ type: Boolean,
775
+ default: !1
776
+ },
777
+ highlightCurrent: Boolean,
778
+ load: Function,
779
+ filterNodeMethod: Function,
780
+ accordion: Boolean,
781
+ indent: {
782
+ type: Number,
783
+ default: 18
784
+ },
785
+ iconClass: String,
786
+ /** 开启虚拟滚动(只虚拟化第一层节点)。默认 false,数据量大时传 true */
787
+ virtual: {
788
+ type: Boolean,
789
+ default: !1
790
+ }
791
+ },
792
+ emits: [
793
+ "node-expand",
794
+ "current-change",
795
+ "check-change",
796
+ "check",
797
+ "node-click",
798
+ "node-contextmenu",
799
+ "node-collapse",
800
+ "node-drag-start",
801
+ "node-drag-enter",
802
+ "node-drag-leave",
803
+ "node-drag-over",
804
+ "node-drag-end",
805
+ "node-drop"
806
+ ],
807
+ setup(t, { emit: e, expose: n }) {
808
+ const d = Ye(), r = Ge(), s = b(null), l = b(null), c = b(null), y = b(), u = b(), k = b(), g = Je({
809
+ showDropIndicator: !1,
810
+ draggingNode: null,
811
+ dropNode: null,
812
+ allowDrop: !0,
813
+ dropType: ""
814
+ }), C = [];
815
+ function E(o) {
816
+ C.push(o);
817
+ }
818
+ function w(o) {
819
+ C.forEach((i) => i(o));
820
+ }
821
+ function j(o, ...i) {
822
+ e(o, ...i);
823
+ }
824
+ Qe("vueTree", {
825
+ get store() {
826
+ return s.value;
827
+ },
828
+ get nodeKey() {
829
+ return t.nodeKey;
830
+ },
831
+ get props() {
832
+ return t.props;
833
+ },
834
+ get expandOnClickNode() {
835
+ return t.expandOnClickNode;
836
+ },
837
+ get checkOnClickNode() {
838
+ return t.checkOnClickNode;
839
+ },
840
+ get checkStrictly() {
841
+ return t.checkStrictly;
842
+ },
843
+ get draggable() {
844
+ return t.draggable;
845
+ },
846
+ get accordion() {
847
+ return t.accordion;
848
+ },
849
+ get indent() {
850
+ return t.indent;
851
+ },
852
+ get iconClass() {
853
+ return t.iconClass;
854
+ },
855
+ get currentNode() {
856
+ return c.value;
857
+ },
858
+ set currentNode(o) {
859
+ c.value = o;
860
+ },
861
+ slots: d,
862
+ emitEvent: j,
863
+ broadcastTreeNodeExpand: w,
864
+ onAccordionExpand: E,
865
+ handleTreeNodeDragStart: Me,
866
+ handleTreeNodeDragOver: je,
867
+ handleTreeNodeDragEnd: ze
868
+ }), s.value = new tt({
869
+ key: t.nodeKey,
870
+ data: t.data,
871
+ lazy: t.lazy,
872
+ props: t.props,
873
+ load: t.load,
874
+ currentNodeKey: t.currentNodeKey,
875
+ checkStrictly: t.checkStrictly,
876
+ checkDescendants: t.checkDescendants,
877
+ defaultCheckedKeys: t.defaultCheckedKeys,
878
+ defaultExpandedKeys: t.defaultExpandedKeys,
879
+ autoExpandParent: t.autoExpandParent,
880
+ defaultExpandAll: t.defaultExpandAll,
881
+ filterNodeMethod: t.filterNodeMethod
882
+ }), l.value = s.value.root;
883
+ function S(o) {
884
+ return re(t.nodeKey, o.data);
885
+ }
886
+ const V = pe(() => {
887
+ const o = l.value.childNodes;
888
+ return !o || o.length === 0 || o.every(({ visible: i }) => !i);
889
+ });
890
+ T(
891
+ () => t.defaultCheckedKeys,
892
+ (o) => {
893
+ s.value.setDefaultCheckedKey(o);
894
+ }
895
+ ), T(
896
+ () => t.defaultExpandedKeys,
897
+ (o) => {
898
+ s.value.defaultExpandedKeys = o, s.value.setDefaultExpandedKeys(o);
899
+ }
900
+ ), T(
901
+ () => t.data,
902
+ (o) => {
903
+ s.value.setData(o), t.currentNodeKey && s.value.setCurrentNodeKey(t.currentNodeKey);
904
+ }
905
+ ), T(
906
+ () => t.currentNodeKey,
907
+ (o) => {
908
+ o && s.value.setCurrentNodeKey(o);
909
+ }
910
+ ), T(
911
+ () => t.checkStrictly,
912
+ (o) => {
913
+ s.value.checkStrictly = !!o;
914
+ }
915
+ );
916
+ function W(o) {
917
+ if (!t.filterNodeMethod) throw new Error("[Tree] filterNodeMethod is required when filter");
918
+ s.value.filter(o);
919
+ }
920
+ function Y(o) {
921
+ if (!t.nodeKey) throw new Error("[Tree] nodeKey is required in getNodePath");
922
+ const i = s.value.getNode(o);
923
+ if (!i) return [];
924
+ const a = [i.data];
925
+ let f = i.parent;
926
+ for (; f && f !== l.value; )
927
+ a.push(f.data), f = f.parent;
928
+ return a.reverse();
929
+ }
930
+ function G(o, i) {
931
+ return s.value.getCheckedNodes(o, i);
932
+ }
933
+ function se(o) {
934
+ return s.value.getCheckedKeys(o);
935
+ }
936
+ function z() {
937
+ const o = s.value.getCurrentNode();
938
+ return o ? o.data : null;
939
+ }
940
+ function h() {
941
+ if (!t.nodeKey) throw new Error("[Tree] nodeKey is required in getCurrentKey");
942
+ const o = z();
943
+ return o ? o[t.nodeKey] : null;
944
+ }
945
+ function N(o, i) {
946
+ if (!t.nodeKey) throw new Error("[Tree] nodeKey is required in setCheckedNodes");
947
+ s.value.setCheckedNodes(o, i);
948
+ }
949
+ function B(o, i) {
950
+ if (!t.nodeKey) throw new Error("[Tree] nodeKey is required in setCheckedKeys");
951
+ s.value.setCheckedKeys(o, i);
952
+ }
953
+ function Ee(o, i, a) {
954
+ s.value.setChecked(o, i, a);
955
+ }
956
+ function Ke() {
957
+ return s.value.getHalfCheckedNodes();
958
+ }
959
+ function be() {
960
+ return s.value.getHalfCheckedKeys();
961
+ }
962
+ function De(o) {
963
+ if (!t.nodeKey) throw new Error("[Tree] nodeKey is required in setCurrentNode");
964
+ s.value.setUserCurrentNode(o);
965
+ }
966
+ function xe(o) {
967
+ if (!t.nodeKey) throw new Error("[Tree] nodeKey is required in setCurrentKey");
968
+ s.value.setCurrentNodeKey(o);
969
+ }
970
+ function ie(o) {
971
+ return !t.nodeKey || !t.virtual ? -1 : l.value.childNodes.findIndex((i) => String(S(i)) === String(o));
972
+ }
973
+ function we(o) {
974
+ var a, f;
975
+ const i = ie(o);
976
+ return i < 0 ? !1 : !!((f = (a = k.value) == null ? void 0 : a.isIndexVisible) != null && f.call(a, i));
977
+ }
978
+ async function Te(o) {
979
+ var a, f;
980
+ const i = ie(o);
981
+ i < 0 || await ((f = (a = k.value) == null ? void 0 : a.scrollToIndex) == null ? void 0 : f.call(a, i));
982
+ }
983
+ function Se(o) {
984
+ return s.value.getNode(o);
985
+ }
986
+ function Be(o) {
987
+ s.value.remove(o);
988
+ }
989
+ function Oe(o, i) {
990
+ s.value.append(o, i);
991
+ }
992
+ function Le(o, i) {
993
+ s.value.insertBefore(o, i);
994
+ }
995
+ function Ae(o, i) {
996
+ s.value.insertAfter(o, i);
997
+ }
998
+ function $e(o, i, a) {
999
+ w(i), e("node-expand", o, i, a);
1000
+ }
1001
+ function Ie(o, i, a) {
1002
+ e("node-collapse", o, i, a);
1003
+ }
1004
+ function Pe(o, i) {
1005
+ if (!t.nodeKey) throw new Error("[Tree] nodeKey is required in updateKeyChild");
1006
+ s.value.updateChildren(o, i);
1007
+ }
1008
+ function Me(o, i) {
1009
+ if (typeof t.allowDrag == "function" && !t.allowDrag(i.node))
1010
+ return o.preventDefault(), !1;
1011
+ o.dataTransfer.effectAllowed = "move";
1012
+ try {
1013
+ o.dataTransfer.setData("text/plain", "");
1014
+ } catch {
1015
+ }
1016
+ g.draggingNode = i, e("node-drag-start", i.node, o);
1017
+ }
1018
+ function je(o, i) {
1019
+ var ce;
1020
+ const a = i, f = g.dropNode;
1021
+ f && f !== a && ee(f.$el, "is-drop-inner");
1022
+ const p = g.draggingNode;
1023
+ if (!p || !a) return;
1024
+ let K = !0, v = !0, D = !0, ae = !0;
1025
+ typeof t.allowDrop == "function" && (K = t.allowDrop(p.node, a.node, "prev"), ae = v = t.allowDrop(p.node, a.node, "inner"), D = t.allowDrop(p.node, a.node, "next")), o.dataTransfer.dropEffect = v ? "move" : "none", (K || v || D) && f !== a && (f && e("node-drag-leave", p.node, f.node, o), e("node-drag-enter", p.node, a.node, o)), (K || v || D) && (g.dropNode = a), a.node.nextSibling === p.node && (D = !1), a.node.previousSibling === p.node && (K = !1), a.node.contains(p.node, !1) && (v = !1), (p.node === a.node || p.node.contains(a.node)) && (K = !1, v = !1, D = !1);
1026
+ const J = a.$el.getBoundingClientRect(), Q = ((ce = r == null ? void 0 : r.proxy) == null ? void 0 : ce.$el).getBoundingClientRect();
1027
+ let x;
1028
+ const He = K ? v ? 0.25 : D ? 0.45 : 1 : -1, Fe = D ? v ? 0.75 : K ? 0.55 : 0 : 1;
1029
+ let X = -9999;
1030
+ const le = o.clientY - J.top;
1031
+ le < J.height * He ? x = "before" : le > J.height * Fe ? x = "after" : v ? x = "inner" : x = "none";
1032
+ const Z = a.$el.querySelector(".vue-tree-node__expand-icon").getBoundingClientRect(), _ = y.value;
1033
+ x === "before" ? X = Z.top - Q.top : x === "after" && (X = Z.bottom - Q.top), _ && (_.style.top = X + "px", _.style.left = Z.right - Q.left + "px"), x === "inner" ? ct(a.$el, "is-drop-inner") : ee(a.$el, "is-drop-inner"), g.showDropIndicator = x === "before" || x === "after", g.allowDrop = g.showDropIndicator || ae, g.dropType = x, e("node-drag-over", p.node, a.node, o);
1034
+ }
1035
+ function ze(o) {
1036
+ const { draggingNode: i, dropType: a, dropNode: f } = g;
1037
+ if (o.preventDefault(), o.dataTransfer.dropEffect = "move", i && f) {
1038
+ const p = { data: i.node.data };
1039
+ a !== "none" && i.node.remove(), a === "before" ? f.node.parent.insertBefore(p, f.node) : a === "after" ? f.node.parent.insertAfter(p, f.node) : a === "inner" && f.node.insertChild(p), a !== "none" && s.value.registerNode(p), ee(f.$el, "is-drop-inner"), e("node-drag-end", i.node, f.node, a, o), a !== "none" && e("node-drop", i.node, f.node, a, o);
1040
+ }
1041
+ i && !f && e("node-drag-end", i.node, null, a, o), g.showDropIndicator = !1, g.draggingNode = null, g.dropNode = null, g.allowDrop = !0;
1042
+ }
1043
+ function qe(o) {
1044
+ var D;
1045
+ const i = o.target;
1046
+ if (i.className.indexOf("vue-tree-node") === -1) return;
1047
+ const a = (D = r == null ? void 0 : r.proxy) == null ? void 0 : D.$el, f = Array.from(
1048
+ a.querySelectorAll(".is-focusable[role=treeitem]")
1049
+ ), p = f.indexOf(i);
1050
+ let K;
1051
+ [38, 40].indexOf(o.keyCode) > -1 && (o.preventDefault(), o.keyCode === 38 ? K = p !== 0 ? p - 1 : 0 : K = p < f.length - 1 ? p + 1 : 0, f[K].focus()), [37, 39].indexOf(o.keyCode) > -1 && (o.preventDefault(), i.click());
1052
+ const v = i.querySelector('[type="checkbox"]');
1053
+ [13, 32].indexOf(o.keyCode) > -1 && v && (o.preventDefault(), v.click());
1054
+ }
1055
+ return ge(() => {
1056
+ var i;
1057
+ ((i = r == null ? void 0 : r.proxy) == null ? void 0 : i.$el).addEventListener("keydown", qe);
1058
+ }), n({
1059
+ filter: W,
1060
+ getNodePath: Y,
1061
+ getCheckedNodes: G,
1062
+ getCheckedKeys: se,
1063
+ getCurrentNode: z,
1064
+ getCurrentKey: h,
1065
+ setCheckedNodes: N,
1066
+ setCheckedKeys: B,
1067
+ setChecked: Ee,
1068
+ getHalfCheckedNodes: Ke,
1069
+ getHalfCheckedKeys: be,
1070
+ setCurrentNode: De,
1071
+ setCurrentKey: xe,
1072
+ isKeyVisible: we,
1073
+ scrollToKey: Te,
1074
+ getNode: Se,
1075
+ remove: Be,
1076
+ append: Oe,
1077
+ insertBefore: Le,
1078
+ insertAfter: Ae,
1079
+ updateKeyChildren: Pe,
1080
+ store: s
1081
+ }), {
1082
+ store: s,
1083
+ root: l,
1084
+ currentNode: c,
1085
+ dragState: g,
1086
+ dropIndicator: y,
1087
+ treeContainerRef: u,
1088
+ virtualListRef: k,
1089
+ isEmpty: V,
1090
+ getNodeKeyFn: S,
1091
+ handleNodeExpand: $e,
1092
+ handleNodeCollapse: Ie
1093
+ };
1094
+ }
1095
+ }), ut = {
1096
+ key: 2,
1097
+ class: "vue-tree__empty-block"
1098
+ }, ft = { class: "vue-tree__empty-text" }, yt = {
1099
+ class: "vue-tree__drop-indicator",
1100
+ ref: "dropIndicator"
1101
+ };
1102
+ function pt(t, e, n, d, r, s) {
1103
+ const l = R("vue-tree-node"), c = R("virtual-list");
1104
+ return m(), O("div", {
1105
+ ref: "treeContainerRef",
1106
+ class: P(["vue-tree", {
1107
+ "vue-tree--highlight-current": t.highlightCurrent,
1108
+ "vue-tree--virtual": t.virtual,
1109
+ "is-dragging": !!t.dragState.draggingNode,
1110
+ "is-drop-not-allow": !t.dragState.allowDrop,
1111
+ "is-drop-inner": t.dragState.dropType === "inner"
1112
+ }]),
1113
+ role: "tree"
1114
+ }, [
1115
+ t.virtual && !t.isEmpty ? (m(), U(c, {
1116
+ key: 0,
1117
+ ref: "virtualListRef",
1118
+ "list-data": t.root.childNodes,
1119
+ "estimated-item-size": 28,
1120
+ height: "100%"
1121
+ }, {
1122
+ default: ke(({ item: y }) => [
1123
+ Ne(l, {
1124
+ node: y.item,
1125
+ props: t.props,
1126
+ "render-after-expand": t.renderAfterExpand,
1127
+ "show-checkbox": t.showCheckbox,
1128
+ "render-content": t.renderContent,
1129
+ onNodeExpand: t.handleNodeExpand,
1130
+ onNodeCollapse: t.handleNodeCollapse
1131
+ }, null, 8, ["node", "props", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand", "onNodeCollapse"])
1132
+ ]),
1133
+ _: 1
1134
+ }, 8, ["list-data"])) : $("", !0),
1135
+ !t.virtual && !t.isEmpty ? (m(!0), O(Ce, { key: 1 }, ve(t.root.childNodes, (y) => (m(), U(l, {
1136
+ key: t.getNodeKeyFn(y),
1137
+ node: y,
1138
+ props: t.props,
1139
+ "render-after-expand": t.renderAfterExpand,
1140
+ "show-checkbox": t.showCheckbox,
1141
+ "render-content": t.renderContent,
1142
+ onNodeExpand: t.handleNodeExpand,
1143
+ onNodeCollapse: t.handleNodeCollapse
1144
+ }, null, 8, ["node", "props", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand", "onNodeCollapse"]))), 128)) : $("", !0),
1145
+ t.isEmpty ? (m(), O("div", ut, [
1146
+ Xe(t.$slots, "empty", {}, () => [
1147
+ A("span", ft, Ze(t.emptyText), 1)
1148
+ ])
1149
+ ])) : $("", !0),
1150
+ ne(A("div", yt, null, 512), [
1151
+ [de, t.dragState.showDropIndicator]
1152
+ ])
1153
+ ], 2);
1154
+ }
1155
+ const Ct = /* @__PURE__ */ me(ht, [["render", pt]]);
1156
+ export {
1157
+ Ct as VueTree,
1158
+ Ct as default
1159
+ };