@xtctwins/tctwins-bimx-engine 0.1.21 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/{AnnotationTool-BvFG1vTX.mjs → AnnotationTool-CgiAUuLM.mjs} +12 -12
  2. package/dist/BIMX_Viewer_Lib.es.js +4 -4
  3. package/dist/BIMX_Viewer_Lib.umd.js +86 -91
  4. package/dist/CommentTool-BeT1ECI-.mjs +338 -0
  5. package/dist/HiddenTool-qqISJ_uV.mjs +58 -0
  6. package/dist/InspectorTool-CLPjV6WW.mjs +609 -0
  7. package/dist/MeasureTool-Be-rmUeb.mjs +1540 -0
  8. package/dist/{NavigateTool-CCIb1X4u.mjs → NavigateTool-C-VsKB0k.mjs} +7 -7
  9. package/dist/{RoamTool-B1w0efz8.mjs → RoamTool-DdHBNeVg.mjs} +20 -20
  10. package/dist/{ScreenShotTool-BviRVFSg.mjs → ScreenShotTool-Da7D2dkW.mjs} +67 -67
  11. package/dist/SectionTool-CHcmUQul.mjs +624 -0
  12. package/dist/SettingTool-CkR1F4x_.mjs +525 -0
  13. package/dist/StructureTree-DBu9xTue.mjs +1438 -0
  14. package/dist/{debounce-Cg3LHv0T.mjs → debounce-DLzt_q3i.mjs} +13 -13
  15. package/dist/{el-checkbox-lp8vWAXQ.mjs → el-checkbox-DsUGOsl_.mjs} +46 -46
  16. package/dist/{el-input-Bwqgf3wZ.mjs → el-input-UdjCNTtW.mjs} +66 -68
  17. package/dist/{el-input-number-0OWyX276.mjs → el-input-number-ySU-dVGM.mjs} +75 -75
  18. package/dist/{index-CQ8depiU.mjs → index-BfLgpvcd.mjs} +3 -3
  19. package/dist/{index-CYEu_kT4.mjs → index-DQKkZiNH.mjs} +1 -1
  20. package/dist/{index-DX-eYsBm.mjs → index-DyFDTMAw.mjs} +1795 -1794
  21. package/dist/{isEqual-Bg-tyY30.mjs → isEqual-BWlMaoTp.mjs} +9 -9
  22. package/dist/panel.vue_vue_type_style_index_0_lang-ZCDiwNFo.mjs +96 -0
  23. package/dist/style.css +1 -1
  24. package/dist/tallPanel-Cz_n6AsB.mjs +49 -0
  25. package/package.json +1 -1
  26. package/types/components/utilsComponents/tallPanel.vue.d.ts +41 -0
  27. package/types/services/fileApi/fileManager.d.ts +5 -5
  28. package/types/store/themeManager.d.ts +1 -1
  29. package/dist/CommentTool-B6ruuuGV.mjs +0 -338
  30. package/dist/HiddenTool-DW-lRdW5.mjs +0 -58
  31. package/dist/InspectorTool-Cc288ySp.mjs +0 -515
  32. package/dist/MeasureTool-DdfM3U_3.mjs +0 -1542
  33. package/dist/SectionTool-jSjWX32j.mjs +0 -630
  34. package/dist/SettingTool-CVMZAx2H.mjs +0 -536
  35. package/dist/StructureTree-4OCdRRPG.mjs +0 -2672
  36. package/dist/panel.vue_vue_type_style_index_0_scope_true_lang-BfE1I0S9.mjs +0 -82
@@ -1,2672 +0,0 @@
1
- import { i as ft, u as le, _ as Le, w as vt, m as dn, b as we, d as oe, a as xe, B as cn, c as Pe, e as _t, f as Ve, h as Ge, t as un, g as It, j as hn, r as Qe, k as fn, l as vn, n as Ot, E as Ne, o as Mt, p as yn, q as De, s as ge, v as pn, x as gn } from "./index-DX-eYsBm.mjs";
2
- import { E as Lt } from "./el-checkbox-lp8vWAXQ.mjs";
3
- import { i as kn, m as Ie, E as At, a as Bt, b as mn } from "./el-input-Bwqgf3wZ.mjs";
4
- import { _ as Nn, a as Cn } from "./panel.vue_vue_type_style_index_0_scope_true_lang-BfE1I0S9.mjs";
5
- import { defineComponent as ae, openBlock as F, createBlock as se, Transition as bn, mergeProps as En, unref as p, toHandlers as Sn, withCtx as ye, renderSlot as yt, getCurrentInstance as Ae, computed as H, ref as A, reactive as Rt, watch as J, onBeforeUnmount as wn, h as ve, withModifiers as ce, onMounted as pt, onUpdated as zt, onActivated as xn, resolveDynamicComponent as Ue, nextTick as te, inject as ke, provide as Se, resolveComponent as Ce, withDirectives as He, createElementBlock as ne, normalizeClass as X, createElementVNode as W, normalizeStyle as gt, createCommentVNode as be, createVNode as ue, Fragment as We, renderList as Ye, vShow as Fe, shallowRef as tt, toDisplayString as Xe, useSlots as Kn, pushScopeId as Tn, popScopeId as Dn } from "vue";
6
- import { S as Et } from "./const-CbUmfuHy.mjs";
7
- import { Loading as _n, CaretRight as $t } from "@element-plus/icons-vue";
8
- import { u as Ht } from "./index-CQ8depiU.mjs";
9
- import { s as In } from "./token-UNVJeAU8.mjs";
10
- const Ft = (e) => ft ? window.requestAnimationFrame(e) : setTimeout(e, 16), Pt = (e) => ft ? window.cancelAnimationFrame(e) : clearTimeout(e), On = ae({
11
- name: "ElCollapseTransition"
12
- }), Mn = /* @__PURE__ */ ae({
13
- ...On,
14
- setup(e) {
15
- const t = le("collapse-transition"), o = (n) => {
16
- n.style.maxHeight = "", n.style.overflow = n.dataset.oldOverflow, n.style.paddingTop = n.dataset.oldPaddingTop, n.style.paddingBottom = n.dataset.oldPaddingBottom;
17
- }, s = {
18
- beforeEnter(n) {
19
- n.dataset || (n.dataset = {}), n.dataset.oldPaddingTop = n.style.paddingTop, n.dataset.oldPaddingBottom = n.style.paddingBottom, n.style.height && (n.dataset.elExistsHeight = n.style.height), n.style.maxHeight = 0, n.style.paddingTop = 0, n.style.paddingBottom = 0;
20
- },
21
- enter(n) {
22
- requestAnimationFrame(() => {
23
- n.dataset.oldOverflow = n.style.overflow, n.dataset.elExistsHeight ? n.style.maxHeight = n.dataset.elExistsHeight : n.scrollHeight !== 0 ? n.style.maxHeight = `${n.scrollHeight}px` : n.style.maxHeight = 0, n.style.paddingTop = n.dataset.oldPaddingTop, n.style.paddingBottom = n.dataset.oldPaddingBottom, n.style.overflow = "hidden";
24
- });
25
- },
26
- afterEnter(n) {
27
- n.style.maxHeight = "", n.style.overflow = n.dataset.oldOverflow;
28
- },
29
- enterCancelled(n) {
30
- o(n);
31
- },
32
- beforeLeave(n) {
33
- n.dataset || (n.dataset = {}), n.dataset.oldPaddingTop = n.style.paddingTop, n.dataset.oldPaddingBottom = n.style.paddingBottom, n.dataset.oldOverflow = n.style.overflow, n.style.maxHeight = `${n.scrollHeight}px`, n.style.overflow = "hidden";
34
- },
35
- leave(n) {
36
- n.scrollHeight !== 0 && (n.style.maxHeight = 0, n.style.paddingTop = 0, n.style.paddingBottom = 0);
37
- },
38
- afterLeave(n) {
39
- o(n);
40
- },
41
- leaveCancelled(n) {
42
- o(n);
43
- }
44
- };
45
- return (n, a) => (F(), se(bn, En({
46
- name: p(t).b()
47
- }, Sn(s)), {
48
- default: ye(() => [
49
- yt(n.$slots, "default")
50
- ]),
51
- _: 3
52
- }, 16, ["name"]));
53
- }
54
- });
55
- var Ln = /* @__PURE__ */ Le(Mn, [["__file", "collapse-transition.vue"]]);
56
- const An = vt(Ln);
57
- var St = Number.isNaN || function(t) {
58
- return typeof t == "number" && t !== t;
59
- };
60
- function Bn(e, t) {
61
- return !!(e === t || St(e) && St(t));
62
- }
63
- function Rn(e, t) {
64
- if (e.length !== t.length)
65
- return !1;
66
- for (var o = 0; o < e.length; o++)
67
- if (!Bn(e[o], t[o]))
68
- return !1;
69
- return !0;
70
- }
71
- function zn(e, t) {
72
- t === void 0 && (t = Rn);
73
- var o = null;
74
- function s() {
75
- for (var n = [], a = 0; a < arguments.length; a++)
76
- n[a] = arguments[a];
77
- if (o && o.lastThis === this && t(n, o.lastArgs))
78
- return o.lastResult;
79
- var d = e.apply(this, n);
80
- return o = {
81
- lastResult: d,
82
- lastArgs: n,
83
- lastThis: this
84
- }, d;
85
- }
86
- return s.clear = function() {
87
- o = null;
88
- }, s;
89
- }
90
- const $n = () => {
91
- const t = Ae().proxy.$props;
92
- return H(() => {
93
- const o = (s, n, a) => ({});
94
- return t.perfMode ? dn(o) : zn(o);
95
- });
96
- }, wt = "itemRendered", xt = "scroll", jt = "forward", qt = "backward", nt = "auto", Hn = "smart", Fn = "start", Kt = "center", Pn = "end", Me = "horizontal", kt = "vertical", jn = "ltr", qe = "rtl", ot = "negative", Vt = "positive-ascending", Gt = "positive-descending", qn = {
97
- [Me]: "left",
98
- [kt]: "top"
99
- }, Vn = 20, Gn = {
100
- [Me]: "deltaX",
101
- [kt]: "deltaY"
102
- }, Un = ({ atEndEdge: e, atStartEdge: t, layout: o }, s) => {
103
- let n, a = 0;
104
- const d = (h) => h < 0 && t.value || h > 0 && e.value;
105
- return {
106
- hasReachedEdge: d,
107
- onWheel: (h) => {
108
- Pt(n);
109
- const k = h[Gn[o.value]];
110
- d(a) && d(a + k) || (a += k, kn() || h.preventDefault(), n = Ft(() => {
111
- s(a), a = 0;
112
- }));
113
- }
114
- };
115
- }, st = we({
116
- type: oe([Number, Function]),
117
- required: !0
118
- }), at = we({
119
- type: Number
120
- }), lt = we({
121
- type: Number,
122
- default: 2
123
- }), Wn = we({
124
- type: String,
125
- values: ["ltr", "rtl"],
126
- default: "ltr"
127
- }), rt = we({
128
- type: Number,
129
- default: 0
130
- }), Ze = we({
131
- type: Number,
132
- required: !0
133
- }), Ut = we({
134
- type: String,
135
- values: ["horizontal", "vertical"],
136
- default: kt
137
- }), Wt = xe({
138
- className: {
139
- type: String,
140
- default: ""
141
- },
142
- containerElement: {
143
- type: oe([String, Object]),
144
- default: "div"
145
- },
146
- data: {
147
- type: oe(Array),
148
- default: () => Ie([])
149
- },
150
- direction: Wn,
151
- height: {
152
- type: [String, Number],
153
- required: !0
154
- },
155
- innerElement: {
156
- type: [String, Object],
157
- default: "div"
158
- },
159
- style: {
160
- type: oe([Object, String, Array])
161
- },
162
- useIsScrolling: {
163
- type: Boolean,
164
- default: !1
165
- },
166
- width: {
167
- type: [Number, String],
168
- required: !1
169
- },
170
- perfMode: {
171
- type: Boolean,
172
- default: !0
173
- },
174
- scrollbarAlwaysOn: {
175
- type: Boolean,
176
- default: !1
177
- }
178
- }), Yn = xe({
179
- cache: lt,
180
- estimatedItemSize: at,
181
- layout: Ut,
182
- initScrollOffset: rt,
183
- total: Ze,
184
- itemSize: st,
185
- ...Wt
186
- }), dt = {
187
- type: Number,
188
- default: 6
189
- }, Yt = { type: Number, default: 0 }, Xt = { type: Number, default: 2 };
190
- xe({
191
- columnCache: lt,
192
- columnWidth: st,
193
- estimatedColumnWidth: at,
194
- estimatedRowHeight: at,
195
- initScrollLeft: rt,
196
- initScrollTop: rt,
197
- itemKey: {
198
- type: oe(Function),
199
- default: ({
200
- columnIndex: e,
201
- rowIndex: t
202
- }) => `${t}:${e}`
203
- },
204
- rowCache: lt,
205
- rowHeight: st,
206
- totalColumn: Ze,
207
- totalRow: Ze,
208
- hScrollbarSize: dt,
209
- vScrollbarSize: dt,
210
- scrollbarStartGap: Yt,
211
- scrollbarEndGap: Xt,
212
- role: String,
213
- ...Wt
214
- });
215
- const Xn = xe({
216
- alwaysOn: Boolean,
217
- class: String,
218
- layout: Ut,
219
- total: Ze,
220
- ratio: {
221
- type: Number,
222
- required: !0
223
- },
224
- clientSize: {
225
- type: Number,
226
- required: !0
227
- },
228
- scrollFrom: {
229
- type: Number,
230
- required: !0
231
- },
232
- scrollbarSize: dt,
233
- startGap: Yt,
234
- endGap: Xt,
235
- visible: Boolean
236
- }), et = (e, t) => e < t ? jt : qt, it = (e) => e === jn || e === qe || e === Me;
237
- let _e = null;
238
- function Tt(e = !1) {
239
- if (_e === null || e) {
240
- const t = document.createElement("div"), o = t.style;
241
- o.width = "50px", o.height = "50px", o.overflow = "scroll", o.direction = "rtl";
242
- const s = document.createElement("div"), n = s.style;
243
- return n.width = "100px", n.height = "100px", t.appendChild(s), document.body.appendChild(t), t.scrollLeft > 0 ? _e = Gt : (t.scrollLeft = 1, t.scrollLeft === 0 ? _e = ot : _e = Vt), document.body.removeChild(t), _e;
244
- }
245
- return _e;
246
- }
247
- function Zn({ move: e, size: t, bar: o }, s) {
248
- const n = {}, a = `translate${o.axis}(${e}px)`;
249
- return n[o.size] = t, n.transform = a, n.msTransform = a, n.webkitTransform = a, s === "horizontal" ? n.height = "100%" : n.width = "100%", n;
250
- }
251
- const Jn = ae({
252
- name: "ElVirtualScrollBar",
253
- props: Xn,
254
- emits: ["scroll", "start-move", "stop-move"],
255
- setup(e, { emit: t }) {
256
- const o = H(() => e.startGap + e.endGap), s = le("virtual-scrollbar"), n = le("scrollbar"), a = A(), d = A();
257
- let i = null, h = null;
258
- const k = Rt({
259
- isDragging: !1,
260
- traveled: 0
261
- }), r = H(() => cn[e.layout]), l = H(() => e.clientSize - p(o)), f = H(() => ({
262
- position: "absolute",
263
- width: `${Me === e.layout ? l.value : e.scrollbarSize}px`,
264
- height: `${Me === e.layout ? e.scrollbarSize : l.value}px`,
265
- [qn[e.layout]]: "2px",
266
- right: "2px",
267
- bottom: "2px",
268
- borderRadius: "4px"
269
- })), y = H(() => {
270
- const v = e.ratio, D = e.clientSize;
271
- if (v >= 100)
272
- return Number.POSITIVE_INFINITY;
273
- if (v >= 50)
274
- return v * D / 100;
275
- const B = D / 3;
276
- return Math.floor(Math.min(Math.max(v * D, Vn), B));
277
- }), b = H(() => {
278
- if (!Number.isFinite(y.value))
279
- return {
280
- display: "none"
281
- };
282
- const v = `${y.value}px`;
283
- return Zn({
284
- bar: r.value,
285
- size: v,
286
- move: k.traveled
287
- }, e.layout);
288
- }), E = H(() => Math.floor(e.clientSize - y.value - p(o))), L = () => {
289
- window.addEventListener("mousemove", C), window.addEventListener("mouseup", N);
290
- const v = p(d);
291
- v && (h = document.onselectstart, document.onselectstart = () => !1, v.addEventListener("touchmove", C, { passive: !0 }), v.addEventListener("touchend", N));
292
- }, w = () => {
293
- window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", N), document.onselectstart = h, h = null;
294
- const v = p(d);
295
- v && (v.removeEventListener("touchmove", C), v.removeEventListener("touchend", N));
296
- }, z = (v) => {
297
- v.stopImmediatePropagation(), !(v.ctrlKey || [1, 2].includes(v.button)) && (k.isDragging = !0, k[r.value.axis] = v.currentTarget[r.value.offset] - (v[r.value.client] - v.currentTarget.getBoundingClientRect()[r.value.direction]), t("start-move"), L());
298
- }, N = () => {
299
- k.isDragging = !1, k[r.value.axis] = 0, t("stop-move"), w();
300
- }, C = (v) => {
301
- const { isDragging: D } = k;
302
- if (!D || !d.value || !a.value)
303
- return;
304
- const B = k[r.value.axis];
305
- if (!B)
306
- return;
307
- Pt(i);
308
- const g = (a.value.getBoundingClientRect()[r.value.direction] - v[r.value.client]) * -1, _ = d.value[r.value.offset] - B, I = g - _;
309
- i = Ft(() => {
310
- k.traveled = Math.max(e.startGap, Math.min(I, E.value)), t("scroll", I, E.value);
311
- });
312
- }, x = (v) => {
313
- const D = Math.abs(v.target.getBoundingClientRect()[r.value.direction] - v[r.value.client]), B = d.value[r.value.offset] / 2, g = D - B;
314
- k.traveled = Math.max(0, Math.min(g, E.value)), t("scroll", g, E.value);
315
- };
316
- return J(() => e.scrollFrom, (v) => {
317
- k.isDragging || (k.traveled = Math.ceil(v * E.value));
318
- }), wn(() => {
319
- w();
320
- }), () => ve("div", {
321
- role: "presentation",
322
- ref: a,
323
- class: [
324
- s.b(),
325
- e.class,
326
- (e.alwaysOn || k.isDragging) && "always-on"
327
- ],
328
- style: f.value,
329
- onMousedown: ce(x, ["stop", "prevent"]),
330
- onTouchstartPrevent: z
331
- }, ve("div", {
332
- ref: d,
333
- class: n.e("thumb"),
334
- style: b.value,
335
- onMousedown: z
336
- }, []));
337
- }
338
- }), Qn = ({
339
- name: e,
340
- getOffset: t,
341
- getItemSize: o,
342
- getItemOffset: s,
343
- getEstimatedTotalSize: n,
344
- getStartIndexForOffset: a,
345
- getStopIndexForStartIndex: d,
346
- initCache: i,
347
- clearCache: h,
348
- validateProps: k
349
- }) => ae({
350
- name: e ?? "ElVirtualList",
351
- props: Yn,
352
- emits: [wt, xt],
353
- setup(r, { emit: l, expose: f }) {
354
- k(r);
355
- const y = Ae(), b = le("vl"), E = A(i(r, y)), L = $n(), w = A(), z = A(), N = A(), C = A({
356
- isScrolling: !1,
357
- scrollDir: "forward",
358
- scrollOffset: Pe(r.initScrollOffset) ? r.initScrollOffset : 0,
359
- updateRequested: !1,
360
- isScrollbarDragging: !1,
361
- scrollbarAlwaysOn: r.scrollbarAlwaysOn
362
- }), x = H(() => {
363
- const { total: S, cache: T } = r, { isScrolling: M, scrollDir: P, scrollOffset: $ } = p(C);
364
- if (S === 0)
365
- return [0, 0, 0, 0];
366
- const G = a(r, $, p(E)), U = d(r, G, $, p(E)), pe = !M || P === qt ? Math.max(1, T) : 1, c = !M || P === jt ? Math.max(1, T) : 1;
367
- return [
368
- Math.max(0, G - pe),
369
- Math.max(0, Math.min(S - 1, U + c)),
370
- G,
371
- U
372
- ];
373
- }), v = H(() => n(r, p(E))), D = H(() => it(r.layout)), B = H(() => [
374
- {
375
- position: "relative",
376
- [`overflow-${D.value ? "x" : "y"}`]: "scroll",
377
- WebkitOverflowScrolling: "touch",
378
- willChange: "transform"
379
- },
380
- {
381
- direction: r.direction,
382
- height: Pe(r.height) ? `${r.height}px` : r.height,
383
- width: Pe(r.width) ? `${r.width}px` : r.width
384
- },
385
- r.style
386
- ]), g = H(() => {
387
- const S = p(v), T = p(D);
388
- return {
389
- height: T ? "100%" : `${S}px`,
390
- pointerEvents: p(C).isScrolling ? "none" : void 0,
391
- width: T ? `${S}px` : "100%"
392
- };
393
- }), _ = H(() => D.value ? r.width : r.height), { onWheel: I } = Un({
394
- atStartEdge: H(() => C.value.scrollOffset <= 0),
395
- atEndEdge: H(() => C.value.scrollOffset >= v.value),
396
- layout: H(() => r.layout)
397
- }, (S) => {
398
- var T, M;
399
- (M = (T = N.value).onMouseUp) == null || M.call(T), O(Math.min(C.value.scrollOffset + S, v.value - _.value));
400
- });
401
- _t(w, "wheel", I, {
402
- passive: !1
403
- });
404
- const V = () => {
405
- const { total: S } = r;
406
- if (S > 0) {
407
- const [$, G, U, pe] = p(x);
408
- l(wt, $, G, U, pe);
409
- }
410
- const { scrollDir: T, scrollOffset: M, updateRequested: P } = p(C);
411
- l(xt, T, M, P);
412
- }, Q = (S) => {
413
- const { clientHeight: T, scrollHeight: M, scrollTop: P } = S.currentTarget, $ = p(C);
414
- if ($.scrollOffset === P)
415
- return;
416
- const G = Math.max(0, Math.min(P, M - T));
417
- C.value = {
418
- ...$,
419
- isScrolling: !0,
420
- scrollDir: et($.scrollOffset, G),
421
- scrollOffset: G,
422
- updateRequested: !1
423
- }, te(j);
424
- }, Z = (S) => {
425
- const { clientWidth: T, scrollLeft: M, scrollWidth: P } = S.currentTarget, $ = p(C);
426
- if ($.scrollOffset === M)
427
- return;
428
- const { direction: G } = r;
429
- let U = M;
430
- if (G === qe)
431
- switch (Tt()) {
432
- case ot: {
433
- U = -M;
434
- break;
435
- }
436
- case Gt: {
437
- U = P - T - M;
438
- break;
439
- }
440
- }
441
- U = Math.max(0, Math.min(U, P - T)), C.value = {
442
- ...$,
443
- isScrolling: !0,
444
- scrollDir: et($.scrollOffset, U),
445
- scrollOffset: U,
446
- updateRequested: !1
447
- }, te(j);
448
- }, ee = (S) => {
449
- p(D) ? Z(S) : Q(S), V();
450
- }, m = (S, T) => {
451
- const M = (v.value - _.value) / T * S;
452
- O(Math.min(v.value - _.value, M));
453
- }, O = (S) => {
454
- S = Math.max(S, 0), S !== p(C).scrollOffset && (C.value = {
455
- ...p(C),
456
- scrollOffset: S,
457
- scrollDir: et(p(C).scrollOffset, S),
458
- updateRequested: !0
459
- }, te(j));
460
- }, u = (S, T = nt) => {
461
- const { scrollOffset: M } = p(C);
462
- S = Math.max(0, Math.min(S, r.total - 1)), O(t(r, S, T, M, p(E)));
463
- }, K = (S) => {
464
- const { direction: T, itemSize: M, layout: P } = r, $ = L.value(h && M, h && P, h && T);
465
- let G;
466
- if (Ge($, String(S)))
467
- G = $[S];
468
- else {
469
- const U = s(r, S, p(E)), pe = o(r, S, p(E)), c = p(D), R = T === qe, Y = c ? U : 0;
470
- $[S] = G = {
471
- position: "absolute",
472
- left: R ? void 0 : `${Y}px`,
473
- right: R ? `${Y}px` : void 0,
474
- top: c ? 0 : `${U}px`,
475
- height: c ? "100%" : `${pe}px`,
476
- width: c ? `${pe}px` : "100%"
477
- };
478
- }
479
- return G;
480
- }, j = () => {
481
- C.value.isScrolling = !1, te(() => {
482
- L.value(-1, null, null);
483
- });
484
- }, q = () => {
485
- const S = w.value;
486
- S && (S.scrollTop = 0);
487
- };
488
- pt(() => {
489
- if (!ft)
490
- return;
491
- const { initScrollOffset: S } = r, T = p(w);
492
- Pe(S) && T && (p(D) ? T.scrollLeft = S : T.scrollTop = S), V();
493
- }), zt(() => {
494
- const { direction: S, layout: T } = r, { scrollOffset: M, updateRequested: P } = p(C), $ = p(w);
495
- if (P && $)
496
- if (T === Me)
497
- if (S === qe)
498
- switch (Tt()) {
499
- case ot: {
500
- $.scrollLeft = -M;
501
- break;
502
- }
503
- case Vt: {
504
- $.scrollLeft = M;
505
- break;
506
- }
507
- default: {
508
- const { clientWidth: G, scrollWidth: U } = $;
509
- $.scrollLeft = U - G - M;
510
- break;
511
- }
512
- }
513
- else
514
- $.scrollLeft = M;
515
- else
516
- $.scrollTop = M;
517
- }), xn(() => {
518
- p(w).scrollTop = p(C).scrollOffset;
519
- });
520
- const re = {
521
- ns: b,
522
- clientSize: _,
523
- estimatedTotalSize: v,
524
- windowStyle: B,
525
- windowRef: w,
526
- innerRef: z,
527
- innerStyle: g,
528
- itemsToRender: x,
529
- scrollbarRef: N,
530
- states: C,
531
- getItemStyle: K,
532
- onScroll: ee,
533
- onScrollbarScroll: m,
534
- onWheel: I,
535
- scrollTo: O,
536
- scrollToItem: u,
537
- resetScrollTop: q
538
- };
539
- return f({
540
- windowRef: w,
541
- innerRef: z,
542
- getItemStyleCache: L,
543
- scrollTo: O,
544
- scrollToItem: u,
545
- resetScrollTop: q,
546
- states: C
547
- }), re;
548
- },
549
- render(r) {
550
- var l;
551
- const {
552
- $slots: f,
553
- className: y,
554
- clientSize: b,
555
- containerElement: E,
556
- data: L,
557
- getItemStyle: w,
558
- innerElement: z,
559
- itemsToRender: N,
560
- innerStyle: C,
561
- layout: x,
562
- total: v,
563
- onScroll: D,
564
- onScrollbarScroll: B,
565
- states: g,
566
- useIsScrolling: _,
567
- windowStyle: I,
568
- ns: V
569
- } = r, [Q, Z] = N, ee = Ue(E), m = Ue(z), O = [];
570
- if (v > 0)
571
- for (let q = Q; q <= Z; q++)
572
- O.push((l = f.default) == null ? void 0 : l.call(f, {
573
- data: L,
574
- key: q,
575
- index: q,
576
- isScrolling: _ ? g.isScrolling : void 0,
577
- style: w(q)
578
- }));
579
- const u = [
580
- ve(m, {
581
- style: C,
582
- ref: "innerRef"
583
- }, Ve(m) ? O : {
584
- default: () => O
585
- })
586
- ], K = ve(Jn, {
587
- ref: "scrollbarRef",
588
- clientSize: b,
589
- layout: x,
590
- onScroll: B,
591
- ratio: b * 100 / this.estimatedTotalSize,
592
- scrollFrom: g.scrollOffset / (this.estimatedTotalSize - b),
593
- total: v
594
- }), j = ve(ee, {
595
- class: [V.e("window"), y],
596
- style: I,
597
- onScroll: D,
598
- ref: "windowRef",
599
- key: 0
600
- }, Ve(ee) ? [u] : { default: () => [u] });
601
- return ve("div", {
602
- key: 0,
603
- class: [V.e("wrapper"), g.scrollbarAlwaysOn ? "always-on" : ""]
604
- }, [j, K]);
605
- }
606
- }), eo = Qn({
607
- name: "ElFixedSizeList",
608
- getItemOffset: ({ itemSize: e }, t) => t * e,
609
- getItemSize: ({ itemSize: e }) => e,
610
- getEstimatedTotalSize: ({ total: e, itemSize: t }) => t * e,
611
- getOffset: ({ height: e, total: t, itemSize: o, layout: s, width: n }, a, d, i) => {
612
- const h = it(s) ? n : e;
613
- process.env.NODE_ENV !== "production" && Ve(h) && un("[ElVirtualList]", `
614
- You should set
615
- width/height
616
- to number when your layout is
617
- horizontal/vertical
618
- `);
619
- const k = Math.max(0, t * o - h), r = Math.min(k, a * o), l = Math.max(0, (a + 1) * o - h);
620
- switch (d === Hn && (i >= l - h && i <= r + h ? d = nt : d = Kt), d) {
621
- case Fn:
622
- return r;
623
- case Pn:
624
- return l;
625
- case Kt: {
626
- const f = Math.round(l + (r - l) / 2);
627
- return f < Math.ceil(h / 2) ? 0 : f > k + Math.floor(h / 2) ? k : f;
628
- }
629
- case nt:
630
- default:
631
- return i >= l && i <= r ? i : i < l ? l : r;
632
- }
633
- },
634
- getStartIndexForOffset: ({ total: e, itemSize: t }, o) => Math.max(0, Math.min(e - 1, Math.floor(o / t))),
635
- getStopIndexForStartIndex: ({ height: e, total: t, itemSize: o, layout: s, width: n }, a, d) => {
636
- const i = a * o, h = it(s) ? n : e, k = Math.ceil((h + d - i) / o);
637
- return Math.max(0, Math.min(t - 1, a + k - 1));
638
- },
639
- initCache() {
640
- },
641
- clearCache: !0,
642
- validateProps() {
643
- }
644
- }), Oe = "$treeNodeId", Dt = function(e, t) {
645
- !t || t[Oe] || Object.defineProperty(t, Oe, {
646
- value: e.id,
647
- enumerable: !1,
648
- configurable: !1,
649
- writable: !1
650
- });
651
- }, mt = function(e, t) {
652
- return e ? t[e] : t[Oe];
653
- }, ct = (e, t, o) => {
654
- const s = e.value.currentNode;
655
- o();
656
- const n = e.value.currentNode;
657
- s !== n && t("current-change", n ? n.data : null, n);
658
- }, ut = (e) => {
659
- let t = !0, o = !0, s = !0;
660
- for (let n = 0, a = e.length; n < a; n++) {
661
- const d = e[n];
662
- (d.checked !== !0 || d.indeterminate) && (t = !1, d.disabled || (s = !1)), (d.checked !== !1 || d.indeterminate) && (o = !1);
663
- }
664
- return { all: t, none: o, allWithoutDisable: s, half: !t && !o };
665
- }, ze = function(e) {
666
- if (e.childNodes.length === 0 || e.loading)
667
- return;
668
- const { all: t, none: o, half: s } = ut(e.childNodes);
669
- t ? (e.checked = !0, e.indeterminate = !1) : s ? (e.checked = !1, e.indeterminate = !0) : o && (e.checked = !1, e.indeterminate = !1);
670
- const n = e.parent;
671
- !n || n.level === 0 || e.store.checkStrictly || ze(n);
672
- }, je = function(e, t) {
673
- const o = e.store.props, s = e.data || {}, n = o[t];
674
- if (typeof n == "function")
675
- return n(s, e);
676
- if (typeof n == "string")
677
- return s[n];
678
- if (typeof n > "u") {
679
- const a = s[t];
680
- return a === void 0 ? "" : a;
681
- }
682
- };
683
- let to = 0;
684
- class Ee {
685
- constructor(t) {
686
- this.id = to++, this.text = null, this.checked = !1, this.indeterminate = !1, this.data = null, this.expanded = !1, this.parent = null, this.visible = !0, this.isCurrent = !1, this.canFocus = !1;
687
- for (const o in t)
688
- Ge(t, o) && (this[o] = t[o]);
689
- this.level = 0, this.loaded = !1, this.childNodes = [], this.loading = !1, this.parent && (this.level = this.parent.level + 1);
690
- }
691
- initialize() {
692
- const t = this.store;
693
- if (!t)
694
- throw new Error("[Node]store is required!");
695
- t.registerNode(this);
696
- const o = t.props;
697
- if (o && typeof o.isLeaf < "u") {
698
- const a = je(this, "isLeaf");
699
- typeof a == "boolean" && (this.isLeafByUser = a);
700
- }
701
- if (t.lazy !== !0 && this.data ? (this.setData(this.data), t.defaultExpandAll && (this.expanded = !0, this.canFocus = !0)) : this.level > 0 && t.lazy && t.defaultExpandAll && !this.isLeafByUser && this.expand(), Array.isArray(this.data) || Dt(this, this.data), !this.data)
702
- return;
703
- const s = t.defaultExpandedKeys, n = t.key;
704
- n && s && s.includes(this.key) && this.expand(null, t.autoExpandParent), n && t.currentNodeKey !== void 0 && this.key === t.currentNodeKey && (t.currentNode = this, t.currentNode.isCurrent = !0), t.lazy && t._initDefaultCheckedNode(this), this.updateLeafState(), this.parent && (this.level === 1 || this.parent.expanded === !0) && (this.canFocus = !0);
705
- }
706
- setData(t) {
707
- Array.isArray(t) || Dt(this, t), this.data = t, this.childNodes = [];
708
- let o;
709
- this.level === 0 && Array.isArray(this.data) ? o = this.data : o = je(this, "children") || [];
710
- for (let s = 0, n = o.length; s < n; s++)
711
- this.insertChild({ data: o[s] });
712
- }
713
- get label() {
714
- return je(this, "label");
715
- }
716
- get key() {
717
- const t = this.store.key;
718
- return this.data ? this.data[t] : null;
719
- }
720
- get disabled() {
721
- return je(this, "disabled");
722
- }
723
- get nextSibling() {
724
- const t = this.parent;
725
- if (t) {
726
- const o = t.childNodes.indexOf(this);
727
- if (o > -1)
728
- return t.childNodes[o + 1];
729
- }
730
- return null;
731
- }
732
- get previousSibling() {
733
- const t = this.parent;
734
- if (t) {
735
- const o = t.childNodes.indexOf(this);
736
- if (o > -1)
737
- return o > 0 ? t.childNodes[o - 1] : null;
738
- }
739
- return null;
740
- }
741
- contains(t, o = !0) {
742
- return (this.childNodes || []).some((s) => s === t || o && s.contains(t));
743
- }
744
- remove() {
745
- const t = this.parent;
746
- t && t.removeChild(this);
747
- }
748
- insertChild(t, o, s) {
749
- if (!t)
750
- throw new Error("InsertChild error: child is required.");
751
- if (!(t instanceof Ee)) {
752
- if (!s) {
753
- const n = this.getChildren(!0);
754
- n.includes(t.data) || (typeof o > "u" || o < 0 ? n.push(t.data) : n.splice(o, 0, t.data));
755
- }
756
- Object.assign(t, {
757
- parent: this,
758
- store: this.store
759
- }), t = Rt(new Ee(t)), t instanceof Ee && t.initialize();
760
- }
761
- t.level = this.level + 1, typeof o > "u" || o < 0 ? this.childNodes.push(t) : this.childNodes.splice(o, 0, t), this.updateLeafState();
762
- }
763
- insertBefore(t, o) {
764
- let s;
765
- o && (s = this.childNodes.indexOf(o)), this.insertChild(t, s);
766
- }
767
- insertAfter(t, o) {
768
- let s;
769
- o && (s = this.childNodes.indexOf(o), s !== -1 && (s += 1)), this.insertChild(t, s);
770
- }
771
- removeChild(t) {
772
- const o = this.getChildren() || [], s = o.indexOf(t.data);
773
- s > -1 && o.splice(s, 1);
774
- const n = this.childNodes.indexOf(t);
775
- n > -1 && (this.store && this.store.deregisterNode(t), t.parent = null, this.childNodes.splice(n, 1)), this.updateLeafState();
776
- }
777
- removeChildByData(t) {
778
- let o = null;
779
- for (let s = 0; s < this.childNodes.length; s++)
780
- if (this.childNodes[s].data === t) {
781
- o = this.childNodes[s];
782
- break;
783
- }
784
- o && this.removeChild(o);
785
- }
786
- expand(t, o) {
787
- const s = () => {
788
- if (o) {
789
- let n = this.parent;
790
- for (; n.level > 0; )
791
- n.expanded = !0, n = n.parent;
792
- }
793
- this.expanded = !0, t && t(), this.childNodes.forEach((n) => {
794
- n.canFocus = !0;
795
- });
796
- };
797
- this.shouldLoadData() ? this.loadData((n) => {
798
- Array.isArray(n) && (this.checked ? this.setChecked(!0, !0) : this.store.checkStrictly || ze(this), s());
799
- }) : s();
800
- }
801
- doCreateChildren(t, o = {}) {
802
- t.forEach((s) => {
803
- this.insertChild(Object.assign({ data: s }, o), void 0, !0);
804
- });
805
- }
806
- collapse() {
807
- this.expanded = !1, this.childNodes.forEach((t) => {
808
- t.canFocus = !1;
809
- });
810
- }
811
- shouldLoadData() {
812
- return this.store.lazy === !0 && this.store.load && !this.loaded;
813
- }
814
- updateLeafState() {
815
- if (this.store.lazy === !0 && this.loaded !== !0 && typeof this.isLeafByUser < "u") {
816
- this.isLeaf = this.isLeafByUser;
817
- return;
818
- }
819
- const t = this.childNodes;
820
- if (!this.store.lazy || this.store.lazy === !0 && this.loaded === !0) {
821
- this.isLeaf = !t || t.length === 0;
822
- return;
823
- }
824
- this.isLeaf = !1;
825
- }
826
- setChecked(t, o, s, n) {
827
- if (this.indeterminate = t === "half", this.checked = t === !0, this.store.checkStrictly)
828
- return;
829
- if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
830
- const { all: d, allWithoutDisable: i } = ut(this.childNodes);
831
- !this.isLeaf && !d && i && (this.checked = !1, t = !1);
832
- const h = () => {
833
- if (o) {
834
- const k = this.childNodes;
835
- for (let f = 0, y = k.length; f < y; f++) {
836
- const b = k[f];
837
- n = n || t !== !1;
838
- const E = b.disabled ? b.checked : n;
839
- b.setChecked(E, o, !0, n);
840
- }
841
- const { half: r, all: l } = ut(k);
842
- l || (this.checked = l, this.indeterminate = r);
843
- }
844
- };
845
- if (this.shouldLoadData()) {
846
- this.loadData(() => {
847
- h(), ze(this);
848
- }, {
849
- checked: t !== !1
850
- });
851
- return;
852
- } else
853
- h();
854
- }
855
- const a = this.parent;
856
- !a || a.level === 0 || s || ze(a);
857
- }
858
- getChildren(t = !1) {
859
- if (this.level === 0)
860
- return this.data;
861
- const o = this.data;
862
- if (!o)
863
- return null;
864
- const s = this.store.props;
865
- let n = "children";
866
- return s && (n = s.children || "children"), o[n] === void 0 && (o[n] = null), t && !o[n] && (o[n] = []), o[n];
867
- }
868
- updateChildren() {
869
- const t = this.getChildren() || [], o = this.childNodes.map((a) => a.data), s = {}, n = [];
870
- t.forEach((a, d) => {
871
- const i = a[Oe];
872
- !!i && o.findIndex((k) => k[Oe] === i) >= 0 ? s[i] = { index: d, data: a } : n.push({ index: d, data: a });
873
- }), this.store.lazy || o.forEach((a) => {
874
- s[a[Oe]] || this.removeChildByData(a);
875
- }), n.forEach(({ index: a, data: d }) => {
876
- this.insertChild({ data: d }, a);
877
- }), this.updateLeafState();
878
- }
879
- loadData(t, o = {}) {
880
- if (this.store.lazy === !0 && this.store.load && !this.loaded && (!this.loading || Object.keys(o).length)) {
881
- this.loading = !0;
882
- const s = (a) => {
883
- this.childNodes = [], this.doCreateChildren(a, o), this.loaded = !0, this.loading = !1, this.updateLeafState(), t && t.call(this, a);
884
- }, n = () => {
885
- this.loading = !1;
886
- };
887
- this.store.load(this, s, n);
888
- } else
889
- t && t.call(this);
890
- }
891
- eachNode(t) {
892
- const o = [this];
893
- for (; o.length; ) {
894
- const s = o.shift();
895
- o.unshift(...s.childNodes), t(s);
896
- }
897
- }
898
- reInitChecked() {
899
- this.store.checkStrictly || ze(this);
900
- }
901
- }
902
- class no {
903
- constructor(t) {
904
- this.currentNode = null, this.currentNodeKey = null;
905
- for (const o in t)
906
- Ge(t, o) && (this[o] = t[o]);
907
- this.nodesMap = {};
908
- }
909
- initialize() {
910
- if (this.root = new Ee({
911
- data: this.data,
912
- store: this
913
- }), this.root.initialize(), this.lazy && this.load) {
914
- const t = this.load;
915
- t(this.root, (o) => {
916
- this.root.doCreateChildren(o), this._initDefaultCheckedNodes();
917
- });
918
- } else
919
- this._initDefaultCheckedNodes();
920
- }
921
- filter(t) {
922
- const o = this.filterNodeMethod, s = this.lazy, n = function(a) {
923
- const d = a.root ? a.root.childNodes : a.childNodes;
924
- if (d.forEach((i) => {
925
- i.visible = o.call(i, t, i.data, i), n(i);
926
- }), !a.visible && d.length) {
927
- let i = !0;
928
- i = !d.some((h) => h.visible), a.root ? a.root.visible = i === !1 : a.visible = i === !1;
929
- }
930
- t && a.visible && !a.isLeaf && (!s || a.loaded) && a.expand();
931
- };
932
- n(this);
933
- }
934
- setData(t) {
935
- t !== this.root.data ? (this.root.setData(t), this._initDefaultCheckedNodes()) : this.root.updateChildren();
936
- }
937
- getNode(t) {
938
- if (t instanceof Ee)
939
- return t;
940
- const o = It(t) ? mt(this.key, t) : t;
941
- return this.nodesMap[o] || null;
942
- }
943
- insertBefore(t, o) {
944
- const s = this.getNode(o);
945
- s.parent.insertBefore({ data: t }, s);
946
- }
947
- insertAfter(t, o) {
948
- const s = this.getNode(o);
949
- s.parent.insertAfter({ data: t }, s);
950
- }
951
- remove(t) {
952
- const o = this.getNode(t);
953
- o && o.parent && (o === this.currentNode && (this.currentNode = null), o.parent.removeChild(o));
954
- }
955
- append(t, o) {
956
- const s = hn(o) ? this.root : this.getNode(o);
957
- s && s.insertChild({ data: t });
958
- }
959
- _initDefaultCheckedNodes() {
960
- const t = this.defaultCheckedKeys || [], o = this.nodesMap;
961
- t.forEach((s) => {
962
- const n = o[s];
963
- n && n.setChecked(!0, !this.checkStrictly);
964
- });
965
- }
966
- _initDefaultCheckedNode(t) {
967
- (this.defaultCheckedKeys || []).includes(t.key) && t.setChecked(!0, !this.checkStrictly);
968
- }
969
- setDefaultCheckedKey(t) {
970
- t !== this.defaultCheckedKeys && (this.defaultCheckedKeys = t, this._initDefaultCheckedNodes());
971
- }
972
- registerNode(t) {
973
- const o = this.key;
974
- !t || !t.data || (o ? t.key !== void 0 && (this.nodesMap[t.key] = t) : this.nodesMap[t.id] = t);
975
- }
976
- deregisterNode(t) {
977
- !this.key || !t || !t.data || (t.childNodes.forEach((s) => {
978
- this.deregisterNode(s);
979
- }), delete this.nodesMap[t.key]);
980
- }
981
- getCheckedNodes(t = !1, o = !1) {
982
- const s = [], n = function(a) {
983
- (a.root ? a.root.childNodes : a.childNodes).forEach((i) => {
984
- (i.checked || o && i.indeterminate) && (!t || t && i.isLeaf) && s.push(i.data), n(i);
985
- });
986
- };
987
- return n(this), s;
988
- }
989
- getCheckedKeys(t = !1) {
990
- return this.getCheckedNodes(t).map((o) => (o || {})[this.key]);
991
- }
992
- getHalfCheckedNodes() {
993
- const t = [], o = function(s) {
994
- (s.root ? s.root.childNodes : s.childNodes).forEach((a) => {
995
- a.indeterminate && t.push(a.data), o(a);
996
- });
997
- };
998
- return o(this), t;
999
- }
1000
- getHalfCheckedKeys() {
1001
- return this.getHalfCheckedNodes().map((t) => (t || {})[this.key]);
1002
- }
1003
- _getAllNodes() {
1004
- const t = [], o = this.nodesMap;
1005
- for (const s in o)
1006
- Ge(o, s) && t.push(o[s]);
1007
- return t;
1008
- }
1009
- updateChildren(t, o) {
1010
- const s = this.nodesMap[t];
1011
- if (!s)
1012
- return;
1013
- const n = s.childNodes;
1014
- for (let a = n.length - 1; a >= 0; a--) {
1015
- const d = n[a];
1016
- this.remove(d.data);
1017
- }
1018
- for (let a = 0, d = o.length; a < d; a++) {
1019
- const i = o[a];
1020
- this.append(i, s.data);
1021
- }
1022
- }
1023
- _setCheckedKeys(t, o = !1, s) {
1024
- const n = this._getAllNodes().sort((h, k) => h.level - k.level), a = /* @__PURE__ */ Object.create(null), d = Object.keys(s);
1025
- n.forEach((h) => h.setChecked(!1, !1));
1026
- const i = (h) => {
1027
- h.childNodes.forEach((k) => {
1028
- var r;
1029
- a[k.data[t]] = !0, (r = k.childNodes) != null && r.length && i(k);
1030
- });
1031
- };
1032
- for (let h = 0, k = n.length; h < k; h++) {
1033
- const r = n[h], l = r.data[t].toString();
1034
- if (!d.includes(l)) {
1035
- r.checked && !a[l] && r.setChecked(!1, !1);
1036
- continue;
1037
- }
1038
- if (r.childNodes.length && i(r), r.isLeaf || this.checkStrictly) {
1039
- r.setChecked(!0, !1);
1040
- continue;
1041
- }
1042
- if (r.setChecked(!0, !0), o) {
1043
- r.setChecked(!1, !1);
1044
- const y = function(b) {
1045
- b.childNodes.forEach((L) => {
1046
- L.isLeaf || L.setChecked(!1, !1), y(L);
1047
- });
1048
- };
1049
- y(r);
1050
- }
1051
- }
1052
- }
1053
- setCheckedNodes(t, o = !1) {
1054
- const s = this.key, n = {};
1055
- t.forEach((a) => {
1056
- n[(a || {})[s]] = !0;
1057
- }), this._setCheckedKeys(s, o, n);
1058
- }
1059
- setCheckedKeys(t, o = !1) {
1060
- this.defaultCheckedKeys = t;
1061
- const s = this.key, n = {};
1062
- t.forEach((a) => {
1063
- n[a] = !0;
1064
- }), this._setCheckedKeys(s, o, n);
1065
- }
1066
- setDefaultExpandedKeys(t) {
1067
- t = t || [], this.defaultExpandedKeys = t, t.forEach((o) => {
1068
- const s = this.getNode(o);
1069
- s && s.expand(null, this.autoExpandParent);
1070
- });
1071
- }
1072
- setChecked(t, o, s) {
1073
- const n = this.getNode(t);
1074
- n && n.setChecked(!!o, s);
1075
- }
1076
- getCurrentNode() {
1077
- return this.currentNode;
1078
- }
1079
- setCurrentNode(t) {
1080
- const o = this.currentNode;
1081
- o && (o.isCurrent = !1), this.currentNode = t, this.currentNode.isCurrent = !0;
1082
- }
1083
- setUserCurrentNode(t, o = !0) {
1084
- const s = t[this.key], n = this.nodesMap[s];
1085
- this.setCurrentNode(n), o && this.currentNode.level > 1 && this.currentNode.parent.expand(null, !0);
1086
- }
1087
- setCurrentNodeKey(t, o = !0) {
1088
- if (t == null) {
1089
- this.currentNode && (this.currentNode.isCurrent = !1), this.currentNode = null;
1090
- return;
1091
- }
1092
- const s = this.getNode(t);
1093
- s && (this.setCurrentNode(s), o && this.currentNode.level > 1 && this.currentNode.parent.expand(null, !0));
1094
- }
1095
- }
1096
- const oo = ae({
1097
- name: "ElTreeNodeContent",
1098
- props: {
1099
- node: {
1100
- type: Object,
1101
- required: !0
1102
- },
1103
- renderContent: Function
1104
- },
1105
- setup(e) {
1106
- const t = le("tree"), o = ke("NodeInstance"), s = ke("RootTree");
1107
- return () => {
1108
- const n = e.node, { data: a, store: d } = n;
1109
- return e.renderContent ? e.renderContent(ve, { _self: o, node: n, data: a, store: d }) : yt(s.ctx.slots, "default", { node: n, data: a }, () => [
1110
- ve("span", { class: t.be("node", "label") }, [n.label])
1111
- ]);
1112
- };
1113
- }
1114
- });
1115
- var so = /* @__PURE__ */ Le(oo, [["__file", "tree-node-content.vue"]]);
1116
- function Zt(e) {
1117
- const t = ke("TreeNodeMap", null), o = {
1118
- treeNodeExpand: (s) => {
1119
- e.node !== s && e.node.collapse();
1120
- },
1121
- children: []
1122
- };
1123
- return t && t.children.push(o), Se("TreeNodeMap", o), {
1124
- broadcastExpanded: (s) => {
1125
- if (e.accordion)
1126
- for (const n of o.children)
1127
- n.treeNodeExpand(s);
1128
- }
1129
- };
1130
- }
1131
- const Jt = Symbol("dragEvents");
1132
- function ao({ props: e, ctx: t, el$: o, dropIndicator$: s, store: n }) {
1133
- const a = le("tree"), d = A({
1134
- showDropIndicator: !1,
1135
- draggingNode: null,
1136
- dropNode: null,
1137
- allowDrop: !0,
1138
- dropType: null
1139
- });
1140
- return Se(Jt, {
1141
- treeNodeDragStart: ({ event: r, treeNode: l }) => {
1142
- if (typeof e.allowDrag == "function" && !e.allowDrag(l.node))
1143
- return r.preventDefault(), !1;
1144
- r.dataTransfer.effectAllowed = "move";
1145
- try {
1146
- r.dataTransfer.setData("text/plain", "");
1147
- } catch {
1148
- }
1149
- d.value.draggingNode = l, t.emit("node-drag-start", l.node, r);
1150
- },
1151
- treeNodeDragOver: ({ event: r, treeNode: l }) => {
1152
- const f = l, y = d.value.dropNode;
1153
- y && y.node.id !== f.node.id && Qe(y.$el, a.is("drop-inner"));
1154
- const b = d.value.draggingNode;
1155
- if (!b || !f)
1156
- return;
1157
- let E = !0, L = !0, w = !0, z = !0;
1158
- typeof e.allowDrop == "function" && (E = e.allowDrop(b.node, f.node, "prev"), z = L = e.allowDrop(b.node, f.node, "inner"), w = e.allowDrop(b.node, f.node, "next")), r.dataTransfer.dropEffect = L || E || w ? "move" : "none", (E || L || w) && (y == null ? void 0 : y.node.id) !== f.node.id && (y && t.emit("node-drag-leave", b.node, y.node, r), t.emit("node-drag-enter", b.node, f.node, r)), E || L || w ? d.value.dropNode = f : d.value.dropNode = null, f.node.nextSibling === b.node && (w = !1), f.node.previousSibling === b.node && (E = !1), f.node.contains(b.node, !1) && (L = !1), (b.node === f.node || b.node.contains(f.node)) && (E = !1, L = !1, w = !1);
1159
- const N = f.$el.querySelector(`.${a.be("node", "content")}`).getBoundingClientRect(), C = o.value.getBoundingClientRect();
1160
- let x;
1161
- const v = E ? L ? 0.25 : w ? 0.45 : 1 : -1, D = w ? L ? 0.75 : E ? 0.55 : 0 : 1;
1162
- let B = -9999;
1163
- const g = r.clientY - N.top;
1164
- g < N.height * v ? x = "before" : g > N.height * D ? x = "after" : L ? x = "inner" : x = "none";
1165
- const _ = f.$el.querySelector(`.${a.be("node", "expand-icon")}`).getBoundingClientRect(), I = s.value;
1166
- x === "before" ? B = _.top - C.top : x === "after" && (B = _.bottom - C.top), I.style.top = `${B}px`, I.style.left = `${_.right - C.left}px`, x === "inner" ? fn(f.$el, a.is("drop-inner")) : Qe(f.$el, a.is("drop-inner")), d.value.showDropIndicator = x === "before" || x === "after", d.value.allowDrop = d.value.showDropIndicator || z, d.value.dropType = x, t.emit("node-drag-over", b.node, f.node, r);
1167
- },
1168
- treeNodeDragEnd: (r) => {
1169
- const { draggingNode: l, dropType: f, dropNode: y } = d.value;
1170
- if (r.preventDefault(), r.dataTransfer.dropEffect = "move", l && y) {
1171
- const b = { data: l.node.data };
1172
- f !== "none" && l.node.remove(), f === "before" ? y.node.parent.insertBefore(b, y.node) : f === "after" ? y.node.parent.insertAfter(b, y.node) : f === "inner" && y.node.insertChild(b), f !== "none" && (n.value.registerNode(b), n.value.key && l.node.eachNode((E) => {
1173
- var L;
1174
- (L = n.value.nodesMap[E.data[n.value.key]]) == null || L.setChecked(E.checked, !n.value.checkStrictly);
1175
- })), Qe(y.$el, a.is("drop-inner")), t.emit("node-drag-end", l.node, y.node, f, r), f !== "none" && t.emit("node-drop", l.node, y.node, f, r);
1176
- }
1177
- l && !y && t.emit("node-drag-end", l.node, null, f, r), d.value.showDropIndicator = !1, d.value.draggingNode = null, d.value.dropNode = null, d.value.allowDrop = !0;
1178
- }
1179
- }), {
1180
- dragState: d
1181
- };
1182
- }
1183
- const lo = ae({
1184
- name: "ElTreeNode",
1185
- components: {
1186
- ElCollapseTransition: An,
1187
- ElCheckbox: Lt,
1188
- NodeContent: so,
1189
- ElIcon: At,
1190
- Loading: _n
1191
- },
1192
- props: {
1193
- node: {
1194
- type: Ee,
1195
- default: () => ({})
1196
- },
1197
- props: {
1198
- type: Object,
1199
- default: () => ({})
1200
- },
1201
- accordion: Boolean,
1202
- renderContent: Function,
1203
- renderAfterExpand: Boolean,
1204
- showCheckbox: {
1205
- type: Boolean,
1206
- default: !1
1207
- }
1208
- },
1209
- emits: ["node-expand"],
1210
- setup(e, t) {
1211
- const o = le("tree"), { broadcastExpanded: s } = Zt(e), n = ke("RootTree"), a = A(!1), d = A(!1), i = A(null), h = A(null), k = A(null), r = ke(Jt), l = Ae();
1212
- Se("NodeInstance", l), n || vn("Tree", "Can not find node's tree."), e.node.expanded && (a.value = !0, d.value = !0);
1213
- const f = n.props.props.children || "children";
1214
- J(() => {
1215
- const g = e.node.data[f];
1216
- return g && [...g];
1217
- }, () => {
1218
- e.node.updateChildren();
1219
- }), J(() => e.node.indeterminate, (g) => {
1220
- E(e.node.checked, g);
1221
- }), J(() => e.node.checked, (g) => {
1222
- E(g, e.node.indeterminate);
1223
- }), J(() => e.node.childNodes.length, () => e.node.reInitChecked()), J(() => e.node.expanded, (g) => {
1224
- te(() => a.value = g), g && (d.value = !0);
1225
- });
1226
- const y = (g) => mt(n.props.nodeKey, g.data), b = (g) => {
1227
- const _ = e.props.class;
1228
- if (!_)
1229
- return {};
1230
- let I;
1231
- if (Ot(_)) {
1232
- const { data: V } = g;
1233
- I = _(V, g);
1234
- } else
1235
- I = _;
1236
- return Ve(I) ? { [I]: !0 } : I;
1237
- }, E = (g, _) => {
1238
- (i.value !== g || h.value !== _) && n.ctx.emit("check-change", e.node.data, g, _), i.value = g, h.value = _;
1239
- }, L = (g) => {
1240
- ct(n.store, n.ctx.emit, () => n.store.value.setCurrentNode(e.node)), n.currentNode.value = e.node, n.props.expandOnClickNode && z(), n.props.checkOnClickNode && !e.node.disabled && N(null, {
1241
- target: { checked: !e.node.checked }
1242
- }), n.ctx.emit("node-click", e.node.data, e.node, l, g);
1243
- }, w = (g) => {
1244
- n.instance.vnode.props.onNodeContextmenu && (g.stopPropagation(), g.preventDefault()), n.ctx.emit("node-contextmenu", g, e.node.data, e.node, l);
1245
- }, z = () => {
1246
- e.node.isLeaf || (a.value ? (n.ctx.emit("node-collapse", e.node.data, e.node, l), e.node.collapse()) : (e.node.expand(), t.emit("node-expand", e.node.data, e.node, l)));
1247
- }, N = (g, _) => {
1248
- e.node.setChecked(_.target.checked, !n.props.checkStrictly), te(() => {
1249
- const I = n.store.value;
1250
- n.ctx.emit("check", e.node.data, {
1251
- checkedNodes: I.getCheckedNodes(),
1252
- checkedKeys: I.getCheckedKeys(),
1253
- halfCheckedNodes: I.getHalfCheckedNodes(),
1254
- halfCheckedKeys: I.getHalfCheckedKeys()
1255
- });
1256
- });
1257
- };
1258
- return {
1259
- ns: o,
1260
- node$: k,
1261
- tree: n,
1262
- expanded: a,
1263
- childNodeRendered: d,
1264
- oldChecked: i,
1265
- oldIndeterminate: h,
1266
- getNodeKey: y,
1267
- getNodeClass: b,
1268
- handleSelectChange: E,
1269
- handleClick: L,
1270
- handleContextMenu: w,
1271
- handleExpandIconClick: z,
1272
- handleCheckChange: N,
1273
- handleChildNodeExpand: (g, _, I) => {
1274
- s(_), n.ctx.emit("node-expand", g, _, I);
1275
- },
1276
- handleDragStart: (g) => {
1277
- n.props.draggable && r.treeNodeDragStart({ event: g, treeNode: e });
1278
- },
1279
- handleDragOver: (g) => {
1280
- g.preventDefault(), n.props.draggable && r.treeNodeDragOver({
1281
- event: g,
1282
- treeNode: { $el: k.value, node: e.node }
1283
- });
1284
- },
1285
- handleDrop: (g) => {
1286
- g.preventDefault();
1287
- },
1288
- handleDragEnd: (g) => {
1289
- n.props.draggable && r.treeNodeDragEnd(g);
1290
- },
1291
- CaretRight: $t
1292
- };
1293
- }
1294
- });
1295
- function ro(e, t, o, s, n, a) {
1296
- const d = Ce("el-icon"), i = Ce("el-checkbox"), h = Ce("loading"), k = Ce("node-content"), r = Ce("el-tree-node"), l = Ce("el-collapse-transition");
1297
- return He((F(), ne("div", {
1298
- ref: "node$",
1299
- class: X([
1300
- e.ns.b("node"),
1301
- e.ns.is("expanded", e.expanded),
1302
- e.ns.is("current", e.node.isCurrent),
1303
- e.ns.is("hidden", !e.node.visible),
1304
- e.ns.is("focusable", !e.node.disabled),
1305
- e.ns.is("checked", !e.node.disabled && e.node.checked),
1306
- e.getNodeClass(e.node)
1307
- ]),
1308
- role: "treeitem",
1309
- tabindex: "-1",
1310
- "aria-expanded": e.expanded,
1311
- "aria-disabled": e.node.disabled,
1312
- "aria-checked": e.node.checked,
1313
- draggable: e.tree.props.draggable,
1314
- "data-key": e.getNodeKey(e.node),
1315
- onClick: ce(e.handleClick, ["stop"]),
1316
- onContextmenu: e.handleContextMenu,
1317
- onDragstart: ce(e.handleDragStart, ["stop"]),
1318
- onDragover: ce(e.handleDragOver, ["stop"]),
1319
- onDragend: ce(e.handleDragEnd, ["stop"]),
1320
- onDrop: ce(e.handleDrop, ["stop"])
1321
- }, [
1322
- W("div", {
1323
- class: X(e.ns.be("node", "content")),
1324
- style: gt({ paddingLeft: (e.node.level - 1) * e.tree.props.indent + "px" })
1325
- }, [
1326
- e.tree.props.icon || e.CaretRight ? (F(), se(d, {
1327
- key: 0,
1328
- class: X([
1329
- e.ns.be("node", "expand-icon"),
1330
- e.ns.is("leaf", e.node.isLeaf),
1331
- {
1332
- expanded: !e.node.isLeaf && e.expanded
1333
- }
1334
- ]),
1335
- onClick: ce(e.handleExpandIconClick, ["stop"])
1336
- }, {
1337
- default: ye(() => [
1338
- (F(), se(Ue(e.tree.props.icon || e.CaretRight)))
1339
- ]),
1340
- _: 1
1341
- }, 8, ["class", "onClick"])) : be("v-if", !0),
1342
- e.showCheckbox ? (F(), se(i, {
1343
- key: 1,
1344
- "model-value": e.node.checked,
1345
- indeterminate: e.node.indeterminate,
1346
- disabled: !!e.node.disabled,
1347
- onClick: ce(() => {
1348
- }, ["stop"]),
1349
- onChange: e.handleCheckChange
1350
- }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onChange"])) : be("v-if", !0),
1351
- e.node.loading ? (F(), se(d, {
1352
- key: 2,
1353
- class: X([e.ns.be("node", "loading-icon"), e.ns.is("loading")])
1354
- }, {
1355
- default: ye(() => [
1356
- ue(h)
1357
- ]),
1358
- _: 1
1359
- }, 8, ["class"])) : be("v-if", !0),
1360
- ue(k, {
1361
- node: e.node,
1362
- "render-content": e.renderContent
1363
- }, null, 8, ["node", "render-content"])
1364
- ], 6),
1365
- ue(l, null, {
1366
- default: ye(() => [
1367
- !e.renderAfterExpand || e.childNodeRendered ? He((F(), ne("div", {
1368
- key: 0,
1369
- class: X(e.ns.be("node", "children")),
1370
- role: "group",
1371
- "aria-expanded": e.expanded
1372
- }, [
1373
- (F(!0), ne(We, null, Ye(e.node.childNodes, (f) => (F(), se(r, {
1374
- key: e.getNodeKey(f),
1375
- "render-content": e.renderContent,
1376
- "render-after-expand": e.renderAfterExpand,
1377
- "show-checkbox": e.showCheckbox,
1378
- node: f,
1379
- accordion: e.accordion,
1380
- props: e.props,
1381
- onNodeExpand: e.handleChildNodeExpand
1382
- }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]))), 128))
1383
- ], 10, ["aria-expanded"])), [
1384
- [Fe, e.expanded]
1385
- ]) : be("v-if", !0)
1386
- ]),
1387
- _: 1
1388
- })
1389
- ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key", "onClick", "onContextmenu", "onDragstart", "onDragover", "onDragend", "onDrop"])), [
1390
- [Fe, e.node.visible]
1391
- ]);
1392
- }
1393
- var io = /* @__PURE__ */ Le(lo, [["render", ro], ["__file", "tree-node.vue"]]);
1394
- function co({ el$: e }, t) {
1395
- const o = le("tree"), s = tt([]), n = tt([]);
1396
- pt(() => {
1397
- d();
1398
- }), zt(() => {
1399
- s.value = Array.from(e.value.querySelectorAll("[role=treeitem]")), n.value = Array.from(e.value.querySelectorAll("input[type=checkbox]"));
1400
- }), J(n, (i) => {
1401
- i.forEach((h) => {
1402
- h.setAttribute("tabindex", "-1");
1403
- });
1404
- }), _t(e, "keydown", (i) => {
1405
- const h = i.target;
1406
- if (!h.className.includes(o.b("node")))
1407
- return;
1408
- const k = i.code;
1409
- s.value = Array.from(e.value.querySelectorAll(`.${o.is("focusable")}[role=treeitem]`));
1410
- const r = s.value.indexOf(h);
1411
- let l;
1412
- if ([Ne.up, Ne.down].includes(k)) {
1413
- if (i.preventDefault(), k === Ne.up) {
1414
- l = r === -1 ? 0 : r !== 0 ? r - 1 : s.value.length - 1;
1415
- const y = l;
1416
- for (; !t.value.getNode(s.value[l].dataset.key).canFocus; ) {
1417
- if (l--, l === y) {
1418
- l = -1;
1419
- break;
1420
- }
1421
- l < 0 && (l = s.value.length - 1);
1422
- }
1423
- } else {
1424
- l = r === -1 ? 0 : r < s.value.length - 1 ? r + 1 : 0;
1425
- const y = l;
1426
- for (; !t.value.getNode(s.value[l].dataset.key).canFocus; ) {
1427
- if (l++, l === y) {
1428
- l = -1;
1429
- break;
1430
- }
1431
- l >= s.value.length && (l = 0);
1432
- }
1433
- }
1434
- l !== -1 && s.value[l].focus();
1435
- }
1436
- [Ne.left, Ne.right].includes(k) && (i.preventDefault(), h.click());
1437
- const f = h.querySelector('[type="checkbox"]');
1438
- [Ne.enter, Ne.space].includes(k) && f && (i.preventDefault(), f.click());
1439
- });
1440
- const d = () => {
1441
- var i;
1442
- s.value = Array.from(e.value.querySelectorAll(`.${o.is("focusable")}[role=treeitem]`)), n.value = Array.from(e.value.querySelectorAll("input[type=checkbox]"));
1443
- const h = e.value.querySelectorAll(`.${o.is("checked")}[role=treeitem]`);
1444
- if (h.length) {
1445
- h[0].setAttribute("tabindex", "0");
1446
- return;
1447
- }
1448
- (i = s.value[0]) == null || i.setAttribute("tabindex", "0");
1449
- };
1450
- }
1451
- const uo = ae({
1452
- name: "ElTree",
1453
- components: { ElTreeNode: io },
1454
- props: {
1455
- data: {
1456
- type: Array,
1457
- default: () => []
1458
- },
1459
- emptyText: {
1460
- type: String
1461
- },
1462
- renderAfterExpand: {
1463
- type: Boolean,
1464
- default: !0
1465
- },
1466
- nodeKey: String,
1467
- checkStrictly: Boolean,
1468
- defaultExpandAll: Boolean,
1469
- expandOnClickNode: {
1470
- type: Boolean,
1471
- default: !0
1472
- },
1473
- checkOnClickNode: Boolean,
1474
- checkDescendants: {
1475
- type: Boolean,
1476
- default: !1
1477
- },
1478
- autoExpandParent: {
1479
- type: Boolean,
1480
- default: !0
1481
- },
1482
- defaultCheckedKeys: Array,
1483
- defaultExpandedKeys: Array,
1484
- currentNodeKey: [String, Number],
1485
- renderContent: Function,
1486
- showCheckbox: {
1487
- type: Boolean,
1488
- default: !1
1489
- },
1490
- draggable: {
1491
- type: Boolean,
1492
- default: !1
1493
- },
1494
- allowDrag: Function,
1495
- allowDrop: Function,
1496
- props: {
1497
- type: Object,
1498
- default: () => ({
1499
- children: "children",
1500
- label: "label",
1501
- disabled: "disabled"
1502
- })
1503
- },
1504
- lazy: {
1505
- type: Boolean,
1506
- default: !1
1507
- },
1508
- highlightCurrent: Boolean,
1509
- load: Function,
1510
- filterNodeMethod: Function,
1511
- accordion: Boolean,
1512
- indent: {
1513
- type: Number,
1514
- default: 18
1515
- },
1516
- icon: {
1517
- type: Bt
1518
- }
1519
- },
1520
- emits: [
1521
- "check-change",
1522
- "current-change",
1523
- "node-click",
1524
- "node-contextmenu",
1525
- "node-collapse",
1526
- "node-expand",
1527
- "check",
1528
- "node-drag-start",
1529
- "node-drag-end",
1530
- "node-drop",
1531
- "node-drag-leave",
1532
- "node-drag-enter",
1533
- "node-drag-over"
1534
- ],
1535
- setup(e, t) {
1536
- const { t: o } = Ht(), s = le("tree"), n = ke(In, null), a = A(new no({
1537
- key: e.nodeKey,
1538
- data: e.data,
1539
- lazy: e.lazy,
1540
- props: e.props,
1541
- load: e.load,
1542
- currentNodeKey: e.currentNodeKey,
1543
- checkStrictly: e.checkStrictly,
1544
- checkDescendants: e.checkDescendants,
1545
- defaultCheckedKeys: e.defaultCheckedKeys,
1546
- defaultExpandedKeys: e.defaultExpandedKeys,
1547
- autoExpandParent: e.autoExpandParent,
1548
- defaultExpandAll: e.defaultExpandAll,
1549
- filterNodeMethod: e.filterNodeMethod
1550
- }));
1551
- a.value.initialize();
1552
- const d = A(a.value.root), i = A(null), h = A(null), k = A(null), { broadcastExpanded: r } = Zt(e), { dragState: l } = ao({
1553
- props: e,
1554
- ctx: t,
1555
- el$: h,
1556
- dropIndicator$: k,
1557
- store: a
1558
- });
1559
- co({ el$: h }, a);
1560
- const f = H(() => {
1561
- const { childNodes: u } = d.value, K = n ? n.hasFilteredOptions !== 0 : !1;
1562
- return (!u || u.length === 0 || u.every(({ visible: j }) => !j)) && !K;
1563
- });
1564
- J(() => e.currentNodeKey, (u) => {
1565
- a.value.setCurrentNodeKey(u);
1566
- }), J(() => e.defaultCheckedKeys, (u) => {
1567
- a.value.setDefaultCheckedKey(u);
1568
- }), J(() => e.defaultExpandedKeys, (u) => {
1569
- a.value.setDefaultExpandedKeys(u);
1570
- }), J(() => e.data, (u) => {
1571
- a.value.setData(u);
1572
- }, { deep: !0 }), J(() => e.checkStrictly, (u) => {
1573
- a.value.checkStrictly = u;
1574
- });
1575
- const y = (u) => {
1576
- if (!e.filterNodeMethod)
1577
- throw new Error("[Tree] filterNodeMethod is required when filter");
1578
- a.value.filter(u);
1579
- }, b = (u) => mt(e.nodeKey, u.data), E = (u) => {
1580
- if (!e.nodeKey)
1581
- throw new Error("[Tree] nodeKey is required in getNodePath");
1582
- const K = a.value.getNode(u);
1583
- if (!K)
1584
- return [];
1585
- const j = [K.data];
1586
- let q = K.parent;
1587
- for (; q && q !== d.value; )
1588
- j.push(q.data), q = q.parent;
1589
- return j.reverse();
1590
- }, L = (u, K) => a.value.getCheckedNodes(u, K), w = (u) => a.value.getCheckedKeys(u), z = () => {
1591
- const u = a.value.getCurrentNode();
1592
- return u ? u.data : null;
1593
- }, N = () => {
1594
- if (!e.nodeKey)
1595
- throw new Error("[Tree] nodeKey is required in getCurrentKey");
1596
- const u = z();
1597
- return u ? u[e.nodeKey] : null;
1598
- }, C = (u, K) => {
1599
- if (!e.nodeKey)
1600
- throw new Error("[Tree] nodeKey is required in setCheckedNodes");
1601
- a.value.setCheckedNodes(u, K);
1602
- }, x = (u, K) => {
1603
- if (!e.nodeKey)
1604
- throw new Error("[Tree] nodeKey is required in setCheckedKeys");
1605
- a.value.setCheckedKeys(u, K);
1606
- }, v = (u, K, j) => {
1607
- a.value.setChecked(u, K, j);
1608
- }, D = () => a.value.getHalfCheckedNodes(), B = () => a.value.getHalfCheckedKeys(), g = (u, K = !0) => {
1609
- if (!e.nodeKey)
1610
- throw new Error("[Tree] nodeKey is required in setCurrentNode");
1611
- ct(a, t.emit, () => {
1612
- r(u), a.value.setUserCurrentNode(u, K);
1613
- });
1614
- }, _ = (u, K = !0) => {
1615
- if (!e.nodeKey)
1616
- throw new Error("[Tree] nodeKey is required in setCurrentKey");
1617
- ct(a, t.emit, () => {
1618
- r(), a.value.setCurrentNodeKey(u, K);
1619
- });
1620
- }, I = (u) => a.value.getNode(u), V = (u) => {
1621
- a.value.remove(u);
1622
- }, Q = (u, K) => {
1623
- a.value.append(u, K);
1624
- }, Z = (u, K) => {
1625
- a.value.insertBefore(u, K);
1626
- }, ee = (u, K) => {
1627
- a.value.insertAfter(u, K);
1628
- }, m = (u, K, j) => {
1629
- r(K), t.emit("node-expand", u, K, j);
1630
- }, O = (u, K) => {
1631
- if (!e.nodeKey)
1632
- throw new Error("[Tree] nodeKey is required in updateKeyChild");
1633
- a.value.updateChildren(u, K);
1634
- };
1635
- return Se("RootTree", {
1636
- ctx: t,
1637
- props: e,
1638
- store: a,
1639
- root: d,
1640
- currentNode: i,
1641
- instance: Ae()
1642
- }), Se(Mt, void 0), {
1643
- ns: s,
1644
- store: a,
1645
- root: d,
1646
- currentNode: i,
1647
- dragState: l,
1648
- el$: h,
1649
- dropIndicator$: k,
1650
- isEmpty: f,
1651
- filter: y,
1652
- getNodeKey: b,
1653
- getNodePath: E,
1654
- getCheckedNodes: L,
1655
- getCheckedKeys: w,
1656
- getCurrentNode: z,
1657
- getCurrentKey: N,
1658
- setCheckedNodes: C,
1659
- setCheckedKeys: x,
1660
- setChecked: v,
1661
- getHalfCheckedNodes: D,
1662
- getHalfCheckedKeys: B,
1663
- setCurrentNode: g,
1664
- setCurrentKey: _,
1665
- t: o,
1666
- getNode: I,
1667
- remove: V,
1668
- append: Q,
1669
- insertBefore: Z,
1670
- insertAfter: ee,
1671
- handleNodeExpand: m,
1672
- updateKeyChildren: O
1673
- };
1674
- }
1675
- });
1676
- function ho(e, t, o, s, n, a) {
1677
- const d = Ce("el-tree-node");
1678
- return F(), ne("div", {
1679
- ref: "el$",
1680
- class: X([
1681
- e.ns.b(),
1682
- e.ns.is("dragging", !!e.dragState.draggingNode),
1683
- e.ns.is("drop-not-allow", !e.dragState.allowDrop),
1684
- e.ns.is("drop-inner", e.dragState.dropType === "inner"),
1685
- { [e.ns.m("highlight-current")]: e.highlightCurrent }
1686
- ]),
1687
- role: "tree"
1688
- }, [
1689
- (F(!0), ne(We, null, Ye(e.root.childNodes, (i) => (F(), se(d, {
1690
- key: e.getNodeKey(i),
1691
- node: i,
1692
- props: e.props,
1693
- accordion: e.accordion,
1694
- "render-after-expand": e.renderAfterExpand,
1695
- "show-checkbox": e.showCheckbox,
1696
- "render-content": e.renderContent,
1697
- onNodeExpand: e.handleNodeExpand
1698
- }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]))), 128)),
1699
- e.isEmpty ? (F(), ne("div", {
1700
- key: 0,
1701
- class: X(e.ns.e("empty-block"))
1702
- }, [
1703
- yt(e.$slots, "empty", {}, () => {
1704
- var i;
1705
- return [
1706
- W("span", {
1707
- class: X(e.ns.e("empty-text"))
1708
- }, Xe((i = e.emptyText) != null ? i : e.t("el.tree.emptyText")), 3)
1709
- ];
1710
- })
1711
- ], 2)) : be("v-if", !0),
1712
- He(W("div", {
1713
- ref: "dropIndicator$",
1714
- class: X(e.ns.e("drop-indicator"))
1715
- }, null, 2), [
1716
- [Fe, e.dragState.showDropIndicator]
1717
- ])
1718
- ], 2);
1719
- }
1720
- var fo = /* @__PURE__ */ Le(uo, [["render", ho], ["__file", "tree.vue"]]);
1721
- const vo = vt(fo), Nt = Symbol(), yo = {
1722
- key: -1,
1723
- level: -1,
1724
- data: {}
1725
- };
1726
- var $e = /* @__PURE__ */ ((e) => (e.KEY = "id", e.LABEL = "label", e.CHILDREN = "children", e.DISABLED = "disabled", e))($e || {}), ht = /* @__PURE__ */ ((e) => (e.ADD = "add", e.DELETE = "delete", e))(ht || {});
1727
- const Qt = {
1728
- type: Number,
1729
- default: 26
1730
- }, po = xe({
1731
- data: {
1732
- type: oe(Array),
1733
- default: () => Ie([])
1734
- },
1735
- emptyText: {
1736
- type: String
1737
- },
1738
- height: {
1739
- type: Number,
1740
- default: 200
1741
- },
1742
- props: {
1743
- type: oe(Object),
1744
- default: () => Ie({
1745
- children: "children",
1746
- label: "label",
1747
- disabled: "disabled",
1748
- value: "id"
1749
- /* KEY */
1750
- })
1751
- },
1752
- highlightCurrent: {
1753
- type: Boolean,
1754
- default: !1
1755
- },
1756
- showCheckbox: {
1757
- type: Boolean,
1758
- default: !1
1759
- },
1760
- defaultCheckedKeys: {
1761
- type: oe(Array),
1762
- default: () => Ie([])
1763
- },
1764
- checkStrictly: {
1765
- type: Boolean,
1766
- default: !1
1767
- },
1768
- defaultExpandedKeys: {
1769
- type: oe(Array),
1770
- default: () => Ie([])
1771
- },
1772
- indent: {
1773
- type: Number,
1774
- default: 16
1775
- },
1776
- itemSize: Qt,
1777
- icon: {
1778
- type: Bt
1779
- },
1780
- expandOnClickNode: {
1781
- type: Boolean,
1782
- default: !0
1783
- },
1784
- checkOnClickNode: {
1785
- type: Boolean,
1786
- default: !1
1787
- },
1788
- currentNodeKey: {
1789
- type: oe([String, Number])
1790
- },
1791
- accordion: {
1792
- type: Boolean,
1793
- default: !1
1794
- },
1795
- filterMethod: {
1796
- type: oe(Function)
1797
- },
1798
- perfMode: {
1799
- type: Boolean,
1800
- default: !0
1801
- }
1802
- }), go = xe({
1803
- node: {
1804
- type: oe(Object),
1805
- default: () => Ie(yo)
1806
- },
1807
- expanded: {
1808
- type: Boolean,
1809
- default: !1
1810
- },
1811
- checked: {
1812
- type: Boolean,
1813
- default: !1
1814
- },
1815
- indeterminate: {
1816
- type: Boolean,
1817
- default: !1
1818
- },
1819
- showCheckbox: {
1820
- type: Boolean,
1821
- default: !1
1822
- },
1823
- disabled: {
1824
- type: Boolean,
1825
- default: !1
1826
- },
1827
- current: {
1828
- type: Boolean,
1829
- default: !1
1830
- },
1831
- hiddenExpandIcon: {
1832
- type: Boolean,
1833
- default: !1
1834
- },
1835
- itemSize: Qt
1836
- }), ko = xe({
1837
- node: {
1838
- type: oe(Object),
1839
- required: !0
1840
- }
1841
- }), en = "node-click", tn = "node-expand", nn = "node-collapse", on = "current-change", sn = "check", an = "check-change", ln = "node-contextmenu", mo = {
1842
- [en]: (e, t, o) => e && t && o,
1843
- [tn]: (e, t) => e && t,
1844
- [nn]: (e, t) => e && t,
1845
- [on]: (e, t) => e && t,
1846
- [sn]: (e, t) => e && t,
1847
- [an]: (e, t) => e && typeof t == "boolean",
1848
- [ln]: (e, t, o) => e && t && o
1849
- }, No = {
1850
- click: (e, t) => !!(e && t),
1851
- toggle: (e) => !!e,
1852
- check: (e, t) => e && typeof t == "boolean"
1853
- };
1854
- function Co(e, t) {
1855
- const o = A(/* @__PURE__ */ new Set()), s = A(/* @__PURE__ */ new Set()), { emit: n } = Ae();
1856
- J([() => t.value, () => e.defaultCheckedKeys], () => te(() => {
1857
- z(e.defaultCheckedKeys);
1858
- }), {
1859
- immediate: !0
1860
- });
1861
- const a = () => {
1862
- if (!t.value || !e.showCheckbox || e.checkStrictly)
1863
- return;
1864
- const { levelTreeNodeMap: N, maxLevel: C } = t.value, x = o.value, v = /* @__PURE__ */ new Set();
1865
- for (let D = C - 1; D >= 1; --D) {
1866
- const B = N.get(D);
1867
- B && B.forEach((g) => {
1868
- const _ = g.children;
1869
- if (_) {
1870
- let I = !0, V = !1;
1871
- for (const Q of _) {
1872
- const Z = Q.key;
1873
- if (x.has(Z))
1874
- V = !0;
1875
- else if (v.has(Z)) {
1876
- I = !1, V = !0;
1877
- break;
1878
- } else
1879
- I = !1;
1880
- }
1881
- I ? x.add(g.key) : V ? (v.add(g.key), x.delete(g.key)) : (x.delete(g.key), v.delete(g.key));
1882
- }
1883
- });
1884
- }
1885
- s.value = v;
1886
- }, d = (N) => o.value.has(N.key), i = (N) => s.value.has(N.key), h = (N, C, x = !0) => {
1887
- const v = o.value, D = (B, g) => {
1888
- v[g ? ht.ADD : ht.DELETE](B.key);
1889
- const _ = B.children;
1890
- !e.checkStrictly && _ && _.forEach((I) => {
1891
- I.disabled || D(I, g);
1892
- });
1893
- };
1894
- D(N, C), a(), x && k(N, C);
1895
- }, k = (N, C) => {
1896
- const { checkedNodes: x, checkedKeys: v } = b(), { halfCheckedNodes: D, halfCheckedKeys: B } = E();
1897
- n(sn, N.data, {
1898
- checkedKeys: v,
1899
- checkedNodes: x,
1900
- halfCheckedKeys: B,
1901
- halfCheckedNodes: D
1902
- }), n(an, N.data, C);
1903
- };
1904
- function r(N = !1) {
1905
- return b(N).checkedKeys;
1906
- }
1907
- function l(N = !1) {
1908
- return b(N).checkedNodes;
1909
- }
1910
- function f() {
1911
- return E().halfCheckedKeys;
1912
- }
1913
- function y() {
1914
- return E().halfCheckedNodes;
1915
- }
1916
- function b(N = !1) {
1917
- const C = [], x = [];
1918
- if (t != null && t.value && e.showCheckbox) {
1919
- const { treeNodeMap: v } = t.value;
1920
- o.value.forEach((D) => {
1921
- const B = v.get(D);
1922
- B && (!N || N && B.isLeaf) && (x.push(D), C.push(B.data));
1923
- });
1924
- }
1925
- return {
1926
- checkedKeys: x,
1927
- checkedNodes: C
1928
- };
1929
- }
1930
- function E() {
1931
- const N = [], C = [];
1932
- if (t != null && t.value && e.showCheckbox) {
1933
- const { treeNodeMap: x } = t.value;
1934
- s.value.forEach((v) => {
1935
- const D = x.get(v);
1936
- D && (C.push(v), N.push(D.data));
1937
- });
1938
- }
1939
- return {
1940
- halfCheckedNodes: N,
1941
- halfCheckedKeys: C
1942
- };
1943
- }
1944
- function L(N) {
1945
- o.value.clear(), s.value.clear(), te(() => {
1946
- z(N);
1947
- });
1948
- }
1949
- function w(N, C) {
1950
- if (t != null && t.value && e.showCheckbox) {
1951
- const x = t.value.treeNodeMap.get(N);
1952
- x && h(x, C, !1);
1953
- }
1954
- }
1955
- function z(N) {
1956
- if (t != null && t.value) {
1957
- const { treeNodeMap: C } = t.value;
1958
- if (e.showCheckbox && C && N)
1959
- for (const x of N) {
1960
- const v = C.get(x);
1961
- v && !d(v) && h(v, !0, !1);
1962
- }
1963
- }
1964
- }
1965
- return {
1966
- updateCheckedKeys: a,
1967
- toggleCheckbox: h,
1968
- isChecked: d,
1969
- isIndeterminate: i,
1970
- getCheckedKeys: r,
1971
- getCheckedNodes: l,
1972
- getHalfCheckedKeys: f,
1973
- getHalfCheckedNodes: y,
1974
- setChecked: w,
1975
- setCheckedKeys: L
1976
- };
1977
- }
1978
- function bo(e, t) {
1979
- const o = A(/* @__PURE__ */ new Set([])), s = A(/* @__PURE__ */ new Set([])), n = H(() => Ot(e.filterMethod));
1980
- function a(i) {
1981
- var h;
1982
- if (!n.value)
1983
- return;
1984
- const k = /* @__PURE__ */ new Set(), r = s.value, l = o.value, f = [], y = ((h = t.value) == null ? void 0 : h.treeNodes) || [], b = e.filterMethod;
1985
- l.clear();
1986
- function E(L) {
1987
- L.forEach((w) => {
1988
- f.push(w), b != null && b(i, w.data) ? f.forEach((N) => {
1989
- k.add(N.key);
1990
- }) : w.isLeaf && l.add(w.key);
1991
- const z = w.children;
1992
- if (z && E(z), !w.isLeaf) {
1993
- if (!k.has(w.key))
1994
- l.add(w.key);
1995
- else if (z) {
1996
- let N = !0;
1997
- for (const C of z)
1998
- if (!l.has(C.key)) {
1999
- N = !1;
2000
- break;
2001
- }
2002
- N ? r.add(w.key) : r.delete(w.key);
2003
- }
2004
- }
2005
- f.pop();
2006
- });
2007
- }
2008
- return E(y), k;
2009
- }
2010
- function d(i) {
2011
- return s.value.has(i.key);
2012
- }
2013
- return {
2014
- hiddenExpandIconKeySet: s,
2015
- hiddenNodeKeySet: o,
2016
- doFilter: a,
2017
- isForceHiddenExpandIcon: d
2018
- };
2019
- }
2020
- function Eo(e, t) {
2021
- const o = A(new Set(e.defaultExpandedKeys)), s = A(), n = tt(), a = A();
2022
- J(() => e.currentNodeKey, (c) => {
2023
- s.value = c;
2024
- }, {
2025
- immediate: !0
2026
- }), J(() => e.data, (c) => {
2027
- $(c);
2028
- }, {
2029
- immediate: !0
2030
- });
2031
- const {
2032
- isIndeterminate: d,
2033
- isChecked: i,
2034
- toggleCheckbox: h,
2035
- getCheckedKeys: k,
2036
- getCheckedNodes: r,
2037
- getHalfCheckedKeys: l,
2038
- getHalfCheckedNodes: f,
2039
- setChecked: y,
2040
- setCheckedKeys: b
2041
- } = Co(e, n), { doFilter: E, hiddenNodeKeySet: L, isForceHiddenExpandIcon: w } = bo(e, n), z = H(() => {
2042
- var c;
2043
- return ((c = e.props) == null ? void 0 : c.value) || $e.KEY;
2044
- }), N = H(() => {
2045
- var c;
2046
- return ((c = e.props) == null ? void 0 : c.children) || $e.CHILDREN;
2047
- }), C = H(() => {
2048
- var c;
2049
- return ((c = e.props) == null ? void 0 : c.disabled) || $e.DISABLED;
2050
- }), x = H(() => {
2051
- var c;
2052
- return ((c = e.props) == null ? void 0 : c.label) || $e.LABEL;
2053
- }), v = H(() => {
2054
- const c = o.value, R = L.value, Y = [], he = n.value && n.value.treeNodes || [];
2055
- function me() {
2056
- const Ke = [];
2057
- for (let de = he.length - 1; de >= 0; --de)
2058
- Ke.push(he[de]);
2059
- for (; Ke.length; ) {
2060
- const de = Ke.pop();
2061
- if (de && (R.has(de.key) || Y.push(de), c.has(de.key))) {
2062
- const ie = de.children;
2063
- if (ie) {
2064
- const Je = ie.length;
2065
- for (let Te = Je - 1; Te >= 0; --Te)
2066
- Ke.push(ie[Te]);
2067
- }
2068
- }
2069
- }
2070
- }
2071
- return me(), Y;
2072
- }), D = H(() => v.value.length > 0);
2073
- function B(c) {
2074
- const R = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map();
2075
- let he = 1;
2076
- function me(de, ie = 1, Je = void 0) {
2077
- var Te;
2078
- const Ct = [];
2079
- for (const Be of de) {
2080
- const bt = I(Be), fe = {
2081
- level: ie,
2082
- key: bt,
2083
- data: Be
2084
- };
2085
- fe.label = Q(Be), fe.parent = Je;
2086
- const Re = _(Be);
2087
- fe.disabled = V(Be), fe.isLeaf = !Re || Re.length === 0, Re && Re.length && (fe.children = me(Re, ie + 1, fe)), Ct.push(fe), R.set(bt, fe), Y.has(ie) || Y.set(ie, []), (Te = Y.get(ie)) == null || Te.push(fe);
2088
- }
2089
- return ie > he && (he = ie), Ct;
2090
- }
2091
- const Ke = me(c);
2092
- return {
2093
- treeNodeMap: R,
2094
- levelTreeNodeMap: Y,
2095
- maxLevel: he,
2096
- treeNodes: Ke
2097
- };
2098
- }
2099
- function g(c) {
2100
- const R = E(c);
2101
- R && (o.value = R);
2102
- }
2103
- function _(c) {
2104
- return c[N.value];
2105
- }
2106
- function I(c) {
2107
- return c ? c[z.value] : "";
2108
- }
2109
- function V(c) {
2110
- return c[C.value];
2111
- }
2112
- function Q(c) {
2113
- return c[x.value];
2114
- }
2115
- function Z(c) {
2116
- o.value.has(c.key) ? j(c) : K(c);
2117
- }
2118
- function ee(c) {
2119
- o.value = new Set(c);
2120
- }
2121
- function m(c, R) {
2122
- t(en, c.data, c, R), O(c), e.expandOnClickNode && Z(c), e.showCheckbox && e.checkOnClickNode && !c.disabled && h(c, !i(c), !0);
2123
- }
2124
- function O(c) {
2125
- S(c) || (s.value = c.key, t(on, c.data, c));
2126
- }
2127
- function u(c, R) {
2128
- h(c, R);
2129
- }
2130
- function K(c) {
2131
- const R = o.value;
2132
- if (n.value && e.accordion) {
2133
- const { treeNodeMap: Y } = n.value;
2134
- R.forEach((he) => {
2135
- const me = Y.get(he);
2136
- c && c.level === (me == null ? void 0 : me.level) && R.delete(he);
2137
- });
2138
- }
2139
- R.add(c.key), t(tn, c.data, c);
2140
- }
2141
- function j(c) {
2142
- o.value.delete(c.key), t(nn, c.data, c);
2143
- }
2144
- function q(c) {
2145
- return o.value.has(c.key);
2146
- }
2147
- function re(c) {
2148
- return !!c.disabled;
2149
- }
2150
- function S(c) {
2151
- const R = s.value;
2152
- return R !== void 0 && R === c.key;
2153
- }
2154
- function T() {
2155
- var c, R;
2156
- if (s.value)
2157
- return (R = (c = n.value) == null ? void 0 : c.treeNodeMap.get(s.value)) == null ? void 0 : R.data;
2158
- }
2159
- function M() {
2160
- return s.value;
2161
- }
2162
- function P(c) {
2163
- s.value = c;
2164
- }
2165
- function $(c) {
2166
- te(() => n.value = B(c));
2167
- }
2168
- function G(c) {
2169
- var R;
2170
- const Y = It(c) ? I(c) : c;
2171
- return (R = n.value) == null ? void 0 : R.treeNodeMap.get(Y);
2172
- }
2173
- function U(c, R = "auto") {
2174
- const Y = G(c);
2175
- Y && a.value && a.value.scrollToItem(v.value.indexOf(Y), R);
2176
- }
2177
- function pe(c) {
2178
- var R;
2179
- (R = a.value) == null || R.scrollTo(c);
2180
- }
2181
- return {
2182
- tree: n,
2183
- flattenTree: v,
2184
- isNotEmpty: D,
2185
- listRef: a,
2186
- getKey: I,
2187
- getChildren: _,
2188
- toggleExpand: Z,
2189
- toggleCheckbox: h,
2190
- isExpanded: q,
2191
- isChecked: i,
2192
- isIndeterminate: d,
2193
- isDisabled: re,
2194
- isCurrent: S,
2195
- isForceHiddenExpandIcon: w,
2196
- handleNodeClick: m,
2197
- handleNodeCheck: u,
2198
- getCurrentNode: T,
2199
- getCurrentKey: M,
2200
- setCurrentKey: P,
2201
- getCheckedKeys: k,
2202
- getCheckedNodes: r,
2203
- getHalfCheckedKeys: l,
2204
- getHalfCheckedNodes: f,
2205
- setChecked: y,
2206
- setCheckedKeys: b,
2207
- filter: g,
2208
- setData: $,
2209
- getNode: G,
2210
- expandNode: K,
2211
- collapseNode: j,
2212
- setExpandedKeys: ee,
2213
- scrollToNode: U,
2214
- scrollTo: pe
2215
- };
2216
- }
2217
- var So = ae({
2218
- name: "ElTreeNodeContent",
2219
- props: ko,
2220
- setup(e) {
2221
- const t = ke(Nt), o = le("tree");
2222
- return () => {
2223
- const s = e.node, { data: n } = s;
2224
- return t != null && t.ctx.slots.default ? t.ctx.slots.default({ node: s, data: n }) : ve("span", { class: o.be("node", "label") }, [s == null ? void 0 : s.label]);
2225
- };
2226
- }
2227
- });
2228
- const wo = ae({
2229
- name: "ElTreeNode"
2230
- }), xo = /* @__PURE__ */ ae({
2231
- ...wo,
2232
- props: go,
2233
- emits: No,
2234
- setup(e, { emit: t }) {
2235
- const o = e, s = ke(Nt), n = le("tree"), a = H(() => {
2236
- var l;
2237
- return (l = s == null ? void 0 : s.props.indent) != null ? l : 16;
2238
- }), d = H(() => {
2239
- var l;
2240
- return (l = s == null ? void 0 : s.props.icon) != null ? l : $t;
2241
- }), i = (l) => {
2242
- t("click", o.node, l);
2243
- }, h = () => {
2244
- t("toggle", o.node);
2245
- }, k = (l) => {
2246
- t("check", o.node, l);
2247
- }, r = (l) => {
2248
- var f, y, b, E;
2249
- (b = (y = (f = s == null ? void 0 : s.instance) == null ? void 0 : f.vnode) == null ? void 0 : y.props) != null && b.onNodeContextmenu && (l.stopPropagation(), l.preventDefault()), s == null || s.ctx.emit(ln, l, (E = o.node) == null ? void 0 : E.data, o.node);
2250
- };
2251
- return (l, f) => {
2252
- var y, b, E;
2253
- return F(), ne("div", {
2254
- ref: "node$",
2255
- class: X([
2256
- p(n).b("node"),
2257
- p(n).is("expanded", l.expanded),
2258
- p(n).is("current", l.current),
2259
- p(n).is("focusable", !l.disabled),
2260
- p(n).is("checked", !l.disabled && l.checked)
2261
- ]),
2262
- role: "treeitem",
2263
- tabindex: "-1",
2264
- "aria-expanded": l.expanded,
2265
- "aria-disabled": l.disabled,
2266
- "aria-checked": l.checked,
2267
- "data-key": (y = l.node) == null ? void 0 : y.key,
2268
- onClick: ce(i, ["stop"]),
2269
- onContextmenu: r
2270
- }, [
2271
- W("div", {
2272
- class: X(p(n).be("node", "content")),
2273
- style: gt({
2274
- paddingLeft: `${(l.node.level - 1) * p(a)}px`,
2275
- height: l.itemSize + "px"
2276
- })
2277
- }, [
2278
- p(d) ? (F(), se(p(At), {
2279
- key: 0,
2280
- class: X([
2281
- p(n).is("leaf", !!((b = l.node) != null && b.isLeaf)),
2282
- p(n).is("hidden", l.hiddenExpandIcon),
2283
- {
2284
- expanded: !((E = l.node) != null && E.isLeaf) && l.expanded
2285
- },
2286
- p(n).be("node", "expand-icon")
2287
- ]),
2288
- onClick: ce(h, ["stop"])
2289
- }, {
2290
- default: ye(() => [
2291
- (F(), se(Ue(p(d))))
2292
- ]),
2293
- _: 1
2294
- }, 8, ["class", "onClick"])) : be("v-if", !0),
2295
- l.showCheckbox ? (F(), se(p(Lt), {
2296
- key: 1,
2297
- "model-value": l.checked,
2298
- indeterminate: l.indeterminate,
2299
- disabled: l.disabled,
2300
- onChange: k,
2301
- onClick: ce(() => {
2302
- }, ["stop"])
2303
- }, null, 8, ["model-value", "indeterminate", "disabled", "onClick"])) : be("v-if", !0),
2304
- ue(p(So), { node: l.node }, null, 8, ["node"])
2305
- ], 6)
2306
- ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick"]);
2307
- };
2308
- }
2309
- });
2310
- var Ko = /* @__PURE__ */ Le(xo, [["__file", "tree-node.vue"]]);
2311
- const To = ae({
2312
- name: "ElTreeV2"
2313
- }), Do = /* @__PURE__ */ ae({
2314
- ...To,
2315
- props: po,
2316
- emits: mo,
2317
- setup(e, { expose: t, emit: o }) {
2318
- const s = e, n = Kn(), a = H(() => s.itemSize);
2319
- Se(Nt, {
2320
- ctx: {
2321
- emit: o,
2322
- slots: n
2323
- },
2324
- props: s,
2325
- instance: Ae()
2326
- }), Se(Mt, void 0);
2327
- const { t: d } = Ht(), i = le("tree"), {
2328
- flattenTree: h,
2329
- isNotEmpty: k,
2330
- listRef: r,
2331
- toggleExpand: l,
2332
- isExpanded: f,
2333
- isIndeterminate: y,
2334
- isChecked: b,
2335
- isDisabled: E,
2336
- isCurrent: L,
2337
- isForceHiddenExpandIcon: w,
2338
- handleNodeClick: z,
2339
- handleNodeCheck: N,
2340
- toggleCheckbox: C,
2341
- getCurrentNode: x,
2342
- getCurrentKey: v,
2343
- setCurrentKey: D,
2344
- getCheckedKeys: B,
2345
- getCheckedNodes: g,
2346
- getHalfCheckedKeys: _,
2347
- getHalfCheckedNodes: I,
2348
- setChecked: V,
2349
- setCheckedKeys: Q,
2350
- filter: Z,
2351
- setData: ee,
2352
- getNode: m,
2353
- expandNode: O,
2354
- collapseNode: u,
2355
- setExpandedKeys: K,
2356
- scrollToNode: j,
2357
- scrollTo: q
2358
- } = Eo(s, o);
2359
- return t({
2360
- toggleCheckbox: C,
2361
- getCurrentNode: x,
2362
- getCurrentKey: v,
2363
- setCurrentKey: D,
2364
- getCheckedKeys: B,
2365
- getCheckedNodes: g,
2366
- getHalfCheckedKeys: _,
2367
- getHalfCheckedNodes: I,
2368
- setChecked: V,
2369
- setCheckedKeys: Q,
2370
- filter: Z,
2371
- setData: ee,
2372
- getNode: m,
2373
- expandNode: O,
2374
- collapseNode: u,
2375
- setExpandedKeys: K,
2376
- scrollToNode: j,
2377
- scrollTo: q
2378
- }), (re, S) => {
2379
- var T;
2380
- return F(), ne("div", {
2381
- class: X([p(i).b(), { [p(i).m("highlight-current")]: re.highlightCurrent }]),
2382
- role: "tree"
2383
- }, [
2384
- p(k) ? (F(), se(p(eo), {
2385
- key: 0,
2386
- ref_key: "listRef",
2387
- ref: r,
2388
- "class-name": p(i).b("virtual-list"),
2389
- data: p(h),
2390
- total: p(h).length,
2391
- height: re.height,
2392
- "item-size": p(a),
2393
- "perf-mode": re.perfMode
2394
- }, {
2395
- default: ye(({ data: M, index: P, style: $ }) => [
2396
- (F(), se(Ko, {
2397
- key: M[P].key,
2398
- style: gt($),
2399
- node: M[P],
2400
- expanded: p(f)(M[P]),
2401
- "show-checkbox": re.showCheckbox,
2402
- checked: p(b)(M[P]),
2403
- indeterminate: p(y)(M[P]),
2404
- "item-size": p(a),
2405
- disabled: p(E)(M[P]),
2406
- current: p(L)(M[P]),
2407
- "hidden-expand-icon": p(w)(M[P]),
2408
- onClick: p(z),
2409
- onToggle: p(l),
2410
- onCheck: p(N)
2411
- }, null, 8, ["style", "node", "expanded", "show-checkbox", "checked", "indeterminate", "item-size", "disabled", "current", "hidden-expand-icon", "onClick", "onToggle", "onCheck"]))
2412
- ]),
2413
- _: 1
2414
- }, 8, ["class-name", "data", "total", "height", "item-size", "perf-mode"])) : (F(), ne("div", {
2415
- key: 1,
2416
- class: X(p(i).e("empty-block"))
2417
- }, [
2418
- W("span", {
2419
- class: X(p(i).e("empty-text"))
2420
- }, Xe((T = re.emptyText) != null ? T : p(d)("el.tree.emptyText")), 3)
2421
- ], 2))
2422
- ], 2);
2423
- };
2424
- }
2425
- });
2426
- var _o = /* @__PURE__ */ Le(Do, [["__file", "tree.vue"]]);
2427
- const Io = vt(_o), rn = (e) => (Tn("data-v-36434180"), e = e(), Dn(), e), Oo = { class: "panel_content" }, Mo = { class: "types" }, Lo = ["onClick"], Ao = { class: "tree" }, Bo = { class: "panel_content_null" }, Ro = /* @__PURE__ */ rn(() => /* @__PURE__ */ W("span", null, "加载中...", -1)), zo = [
2428
- Ro
2429
- ], $o = {
2430
- key: 1,
2431
- class: "operate-tree-box"
2432
- }, Ho = { class: "operate-tree" }, Fo = { class: "tree-title-box" }, Po = /* @__PURE__ */ rn(() => /* @__PURE__ */ W("div", { class: "tree-title" }, "构件树", -1)), jo = { class: "tree-title-icon" }, qo = { class: "tree-category-box" }, Vo = { class: "tree-category-list" }, Go = ["onClick"], Uo = { class: "tree-search-box" }, Wo = { class: "tree-content" }, Yo = /* @__PURE__ */ ae({
2433
- __name: "StructureTree",
2434
- props: ["componentId"],
2435
- emits: ["closePanel", "emitHandler"],
2436
- setup(e, { emit: t }) {
2437
- const o = yn(), s = e, n = A(), a = A(0), d = A(), i = A(), h = A(), k = A(), r = A(), l = A([]), f = A();
2438
- let y, b, E, L;
2439
- const w = A("");
2440
- J(w, (m) => {
2441
- var O;
2442
- (O = n.value) == null || O.filter(m);
2443
- });
2444
- const z = (m, O) => m ? O.title.includes(w.value) : !0, N = A(!1), C = {
2445
- children: "children",
2446
- label: "title",
2447
- value: "nodeId"
2448
- }, x = t, v = (m) => {
2449
- x("emitHandler", m);
2450
- }, D = A(!1);
2451
- pt(() => {
2452
- De("userInfo").isInShare && De("userInfo").isShareClient && (D.value = !0), o.setReadyById(s.componentId);
2453
- }), ge.on("BimViewer", () => {
2454
- y = window.BimViewer;
2455
- const { eventTrigger: m } = y;
2456
- b = y.objectsExplorer, E = y.classesExplorer, L = y.storeysExplorer, m.on("treeAllReady", (O) => {
2457
- i.value = O.objectsData, h.value = O.classesData, k.value = O.storeysData, d.value = i.value, y.SetShowSpaceModeActive(!1), console.log("初始化结构树数据", d.value), te(() => {
2458
- if (d.value) {
2459
- if (!d.value[0]) return;
2460
- d.value[0].title = "全部", De("isMobile") || (f.value = d.value[0].nodeId, n.value.setCurrentKey(d.value[0].nodeId)), _(), N.value = !0;
2461
- }
2462
- });
2463
- }), De("isMobile") || m.on("pickedEntity", (O) => {
2464
- if (N.value === !1) return;
2465
- let u, K;
2466
- a.value === 0 ? u = y.objectsExplorer.getNodeIdByObjectId(O.id) : a.value === 1 ? u = y.classesExplorer.getNodeIdByObjectId(O.id) : a.value === 2 && (u = y.storeysExplorer.getNodeIdByObjectId(O.id)), u && (K = n.value.getNode(u), te(() => {
2467
- f.value = u, n.value.setCurrentKey(u, !0), l.value = [], B(K), n.value.setExpandedKeys(l.value);
2468
- }), v({
2469
- isTool: !0,
2470
- event_target: "StructureTree",
2471
- event_name: "pickedEntity",
2472
- content: {
2473
- entityId: O.id,
2474
- viewer_nodeId: u
2475
- }
2476
- }));
2477
- }), De("isMobile") && (m.on("touchEntity", (O) => {
2478
- if (N.value === !1) return;
2479
- let u, K;
2480
- if (a.value === 0 ? u = y.objectsExplorer.getNodeIdByObjectId(O.id) : a.value === 1 ? u = y.classesExplorer.getNodeIdByObjectId(O.id) : a.value === 2 && (u = y.storeysExplorer.getNodeIdByObjectId(O.id)), !!u) {
2481
- if (K = n.value.getNode(u), !K) {
2482
- console.log("node!!!");
2483
- return;
2484
- }
2485
- f.value = u;
2486
- }
2487
- }), m.on("touchNothing", () => {
2488
- te(() => {
2489
- f.value = "";
2490
- }), v({
2491
- isTool: !0,
2492
- event_target: "StructureTree",
2493
- event_name: "touchNothing",
2494
- content: {
2495
- msg: "pickedNothing"
2496
- }
2497
- });
2498
- }));
2499
- });
2500
- const B = (m) => {
2501
- m.parent && B(m.parent), l.value = [...l.value, m.key];
2502
- }, g = () => {
2503
- x("closePanel");
2504
- }, _ = () => {
2505
- te(() => {
2506
- const m = d.value.map((O) => O.nodeId);
2507
- n.value.setCheckedKeys(m);
2508
- });
2509
- };
2510
- ge.on("receiveTreeType", (m) => {
2511
- a.value = m, V();
2512
- });
2513
- const I = (m) => {
2514
- v({
2515
- isTool: !0,
2516
- event_target: "StructureTree",
2517
- event_name: "changeTreeStructure",
2518
- content: {
2519
- item: m
2520
- }
2521
- }), a.value !== m.id && (a.value = m.id, V());
2522
- }, V = () => {
2523
- a.value === 0 ? d.value = i.value : a.value === 1 ? d.value = h.value : a.value === 2 && (d.value = k.value), d.value[0].title = "全部", te(() => {
2524
- f.value = d.value[0].nodeId, n.value.setCurrentKey(d.value[0].nodeId);
2525
- }), _();
2526
- }, Q = (m) => {
2527
- v({
2528
- isTool: !0,
2529
- event_target: "StructureTree",
2530
- event_name: "clickTreeBox",
2531
- content: {
2532
- active_tree: a.value,
2533
- nodeId: m.nodeId,
2534
- status: m.checked
2535
- }
2536
- });
2537
- }, Z = (m, O) => {
2538
- const u = y.viewer.scene.objects[m.objectId];
2539
- u && (y.setAllObjectsSelected(!1), y.setEntitySelected(u), y.viewFitEntity(u)), v({
2540
- isTool: !0,
2541
- event_target: "StructureTree",
2542
- event_name: "clickTreeNode",
2543
- content: {
2544
- active_tree: a.value,
2545
- objectId: m.objectId
2546
- }
2547
- });
2548
- };
2549
- ge.on("getTreeNodeId1", (m) => {
2550
- b.checkboxChangeHandler(m.nodeId, m.status), n.value.setChecked(m.nodeId, m.status);
2551
- }), ge.on("getTreeNodeId2", (m) => {
2552
- E.checkboxChangeHandler(m.nodeId, !m.checked), n.value.setChecked(m.nodeId, m.status);
2553
- }), ge.on("getTreeNodeId3", (m) => {
2554
- L.checkboxChangeHandler(m.nodeId, !m.checked), n.value.setChecked(m.nodeId, m.status);
2555
- }), ge.on("structure_tree_title_objects", (m) => {
2556
- ee(m);
2557
- }), ge.on("structure_tree_title_categorys", (m) => {
2558
- ee(m);
2559
- }), ge.on("structure_tree_title_floors", (m) => {
2560
- ee(m);
2561
- });
2562
- const ee = (m) => {
2563
- l.value.includes(m.nodeId) ? l.value = l.value.filter((O) => O !== m.nodeId) : l.value = [...l.value, m.nodeId], n.value.setExpandedKeys(l.value);
2564
- };
2565
- return (m, O) => {
2566
- const u = Io, K = Nn, j = Cn, q = pn, re = mn, S = vo;
2567
- return p(De)("isMobile") ? (F(), ne("div", $o, [
2568
- W("div", Ho, [
2569
- W("div", Fo, [
2570
- Po,
2571
- W("div", jo, [
2572
- ue(j, {
2573
- class: "close",
2574
- "click-handle": g
2575
- })
2576
- ])
2577
- ]),
2578
- W("div", qo, [
2579
- ue(q, null, {
2580
- default: ye(() => [
2581
- W("div", Vo, [
2582
- (F(!0), ne(We, null, Ye(p(Et), (T, M) => (F(), ne("div", {
2583
- key: M,
2584
- class: X(["tree-category-item", {
2585
- "tree-category-item-active": T.id === a.value
2586
- }]),
2587
- onClick: (P) => I(T)
2588
- }, Xe(T.name), 11, Go))), 128))
2589
- ])
2590
- ]),
2591
- _: 1
2592
- })
2593
- ]),
2594
- W("div", Uo, [
2595
- ue(re, {
2596
- modelValue: w.value,
2597
- "onUpdate:modelValue": O[0] || (O[0] = (T) => w.value = T),
2598
- placeholder: "请输入需搜索的内容",
2599
- "prefix-icon": "Search",
2600
- clearable: ""
2601
- }, null, 8, ["modelValue"])
2602
- ]),
2603
- W("div", Wo, [
2604
- ue(q, null, {
2605
- default: ye(() => [
2606
- ue(S, {
2607
- ref_key: "tree",
2608
- ref: n,
2609
- "node-key": "nodeId",
2610
- data: d.value,
2611
- "default-expanded-keys": l.value,
2612
- "current-node-key": f.value,
2613
- "highlight-current": !0,
2614
- "default-checked-keys": r.value,
2615
- props: C,
2616
- "filter-node-method": z,
2617
- "show-checkbox": "",
2618
- onCheck: Q,
2619
- onNodeClick: Z
2620
- }, null, 8, ["data", "default-expanded-keys", "current-node-key", "default-checked-keys"])
2621
- ]),
2622
- _: 1
2623
- })
2624
- ])
2625
- ])
2626
- ])) : (F(), se(K, {
2627
- key: 0,
2628
- class: "structure_container",
2629
- width: 268,
2630
- panelTitle: "结构树",
2631
- "click-handle": g
2632
- }, {
2633
- default: ye(() => [
2634
- He(W("div", Oo, [
2635
- W("div", Mo, [
2636
- (F(!0), ne(We, null, Ye(p(Et), (T) => (F(), ne("div", {
2637
- key: T.id,
2638
- class: X(["types-item", { "types-item-active": a.value === T.id }]),
2639
- onClick: (M) => I(T)
2640
- }, Xe(T.name), 11, Lo))), 128))
2641
- ]),
2642
- W("div", Ao, [
2643
- ue(u, {
2644
- ref_key: "tree",
2645
- ref: n,
2646
- height: 700,
2647
- "node-key": "nodeId",
2648
- data: d.value,
2649
- "default-expanded-keys": l.value,
2650
- "current-node-key": f.value,
2651
- "highlight-current": !0,
2652
- props: C,
2653
- "show-checkbox": "",
2654
- onCheck: Q,
2655
- onNodeClick: Z
2656
- }, null, 8, ["data", "default-expanded-keys", "current-node-key"])
2657
- ])
2658
- ], 512), [
2659
- [Fe, N.value]
2660
- ]),
2661
- He(W("div", Bo, zo, 512), [
2662
- [Fe, !N.value]
2663
- ])
2664
- ]),
2665
- _: 1
2666
- }));
2667
- };
2668
- }
2669
- }), as = /* @__PURE__ */ gn(Yo, [["__scopeId", "data-v-36434180"]]);
2670
- export {
2671
- as as default
2672
- };