@xtctwins/tctwins-industry-engine 0.0.6 → 0.0.8

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 (25) hide show
  1. package/dist/{AnnotationTool-CI2uKvcT.mjs → AnnotationTool-CG5vARdK.mjs} +2 -2
  2. package/dist/{BCFTool-DMTJWHGp.mjs → BCFTool-BQLaEDZx.mjs} +2 -2
  3. package/dist/CommentTool-CcWmN9an.mjs +168 -0
  4. package/dist/Industry_Viewer_Lib.es.js +1 -1
  5. package/dist/Industry_Viewer_Lib.umd.js +67 -67
  6. package/dist/{InspectorTool-M14bTfJy.mjs → InspectorTool-bDQLZaVJ.mjs} +5 -5
  7. package/dist/{MeasureTool-fpe5lUfA.mjs → MeasureTool-C4BQ_ynw.mjs} +2 -2
  8. package/dist/{MouseTool-DD_r7w8g.mjs → MouseTool-BKNINn0k.mjs} +20 -18
  9. package/dist/{NavigateTool-h6mbQBx1.mjs → NavigateTool-Dzpxqz_P.mjs} +1 -1
  10. package/dist/{RoamTool-BW-qnHb2.mjs → RoamTool-Cdl62N2A.mjs} +1 -1
  11. package/dist/{ScreenShotTool-C1u0hG7E.mjs → ScreenShotTool-Bv5C5Obh.mjs} +2 -2
  12. package/dist/{SectionTool-B5Wtjqxa.mjs → SectionTool-yzuX_KaV.mjs} +3 -3
  13. package/dist/{SettingTool-CuFUj90w.mjs → SettingTool-MnaXWQ7Z.mjs} +4 -4
  14. package/dist/StructureTree-CPB_MVJm.mjs +1591 -0
  15. package/dist/{XRayTool-C0m0cNvJ.mjs → XRayTool-vHLBinZD.mjs} +1 -1
  16. package/dist/{alert-BVfdQL8W.mjs → alert-Dn13cpN1.mjs} +1 -1
  17. package/dist/{el-checkbox-D7fM1J1k.mjs → el-checkbox-Day69Q-U.mjs} +1 -1
  18. package/dist/{el-input-number-BPhVD6dp.mjs → el-input-number-DiFyiybL.mjs} +1 -1
  19. package/dist/{index-CQhsx45j.mjs → index-JDDvIbJ_.mjs} +1170 -1168
  20. package/dist/{panel.vue_vue_type_style_index_0_lang-BoKU9_z2.mjs → panel.vue_vue_type_style_index_0_lang-D96FeHYN.mjs} +1 -1
  21. package/dist/style.css +1 -1
  22. package/dist/{tallPanel-DOV7VQ7X.mjs → tallPanel-BsnhCyIr.mjs} +1 -1
  23. package/package.json +1 -1
  24. package/dist/CommentTool-BRhMRcYU.mjs +0 -167
  25. package/dist/StructureTree-xbI_WYLM.mjs +0 -1591
@@ -1,1591 +0,0 @@
1
- import { u as de, _ as ke, w as Be, h as be, i as Pe, a as fe, b as _e, c as ve, d as Ae, e as Me, f as He, r as Ce, g as ze, E as Fe, j as qe, k as Re, l as Q, m as Ve, n as Ue, s as We, o as Ye, p as Ge, q as X, t as me, T as De, v as Je, x as Qe, y as Xe, z as Ze } from "./index-CQhsx45j.mjs";
2
- import { _ as et } from "./tallPanel-DOV7VQ7X.mjs";
3
- import { _ as tt } from "./panel.vue_vue_type_style_index_0_lang-BoKU9_z2.mjs";
4
- import { E as nt } from "./el-checkbox-D7fM1J1k.mjs";
5
- import { defineComponent as re, openBlock as D, createBlock as G, Transition as ot, mergeProps as st, unref as U, toHandlers as dt, withCtx as I, renderSlot as Ke, reactive as rt, inject as se, h as Te, provide as he, ref as x, getCurrentInstance as Le, watch as M, nextTick as ge, resolveComponent as ee, withDirectives as W, createElementBlock as $, normalizeClass as H, withModifiers as Z, createElementVNode as _, normalizeStyle as at, resolveDynamicComponent as it, createCommentVNode as ie, createVNode as S, Fragment as ce, renderList as ue, vShow as Y, shallowRef as Se, onMounted as $e, onUpdated as lt, computed as ct, toDisplayString as q, onBeforeUnmount as ut } from "vue";
6
- import { S as pe } from "./const-DeViLYl5.mjs";
7
- import { Loading as ht, CaretRight as ft } from "@element-plus/icons-vue";
8
- const pt = re({
9
- name: "ElCollapseTransition"
10
- }), yt = /* @__PURE__ */ re({
11
- ...pt,
12
- setup(t) {
13
- const e = de("collapse-transition"), o = (n) => {
14
- n.style.maxHeight = "", n.style.overflow = n.dataset.oldOverflow, n.style.paddingTop = n.dataset.oldPaddingTop, n.style.paddingBottom = n.dataset.oldPaddingBottom;
15
- }, s = {
16
- beforeEnter(n) {
17
- 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;
18
- },
19
- enter(n) {
20
- requestAnimationFrame(() => {
21
- 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";
22
- });
23
- },
24
- afterEnter(n) {
25
- n.style.maxHeight = "", n.style.overflow = n.dataset.oldOverflow;
26
- },
27
- enterCancelled(n) {
28
- o(n);
29
- },
30
- beforeLeave(n) {
31
- 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";
32
- },
33
- leave(n) {
34
- n.scrollHeight !== 0 && (n.style.maxHeight = 0, n.style.paddingTop = 0, n.style.paddingBottom = 0);
35
- },
36
- afterLeave(n) {
37
- o(n);
38
- },
39
- leaveCancelled(n) {
40
- o(n);
41
- }
42
- };
43
- return (n, d) => (D(), G(ot, st({
44
- name: U(e).b()
45
- }, dt(s)), {
46
- default: I(() => [
47
- Ke(n.$slots, "default")
48
- ]),
49
- _: 3
50
- }, 16, ["name"]));
51
- }
52
- });
53
- var vt = /* @__PURE__ */ ke(yt, [["__file", "collapse-transition.vue"]]);
54
- const gt = Be(vt), oe = "$treeNodeId", Ie = function(t, e) {
55
- !e || e[oe] || Object.defineProperty(e, oe, {
56
- value: t.id,
57
- enumerable: !1,
58
- configurable: !1,
59
- writable: !1
60
- });
61
- }, xe = function(t, e) {
62
- return t ? e[t] : e[oe];
63
- }, Ee = (t, e, o) => {
64
- const s = t.value.currentNode;
65
- o();
66
- const n = t.value.currentNode;
67
- s !== n && e("current-change", n ? n.data : null, n);
68
- }, we = (t) => {
69
- let e = !0, o = !0, s = !0;
70
- for (let n = 0, d = t.length; n < d; n++) {
71
- const r = t[n];
72
- (r.checked !== !0 || r.indeterminate) && (e = !1, r.disabled || (s = !1)), (r.checked !== !1 || r.indeterminate) && (o = !1);
73
- }
74
- return { all: e, none: o, allWithoutDisable: s, half: !e && !o };
75
- }, le = function(t) {
76
- if (t.childNodes.length === 0 || t.loading)
77
- return;
78
- const { all: e, none: o, half: s } = we(t.childNodes);
79
- e ? (t.checked = !0, t.indeterminate = !1) : s ? (t.checked = !1, t.indeterminate = !0) : o && (t.checked = !1, t.indeterminate = !1);
80
- const n = t.parent;
81
- !n || n.level === 0 || t.store.checkStrictly || le(n);
82
- }, ye = function(t, e) {
83
- const o = t.store.props, s = t.data || {}, n = o[e];
84
- if (ve(n))
85
- return n(s, t);
86
- if (Ae(n))
87
- return s[n];
88
- if (_e(n)) {
89
- const d = s[e];
90
- return d === void 0 ? "" : d;
91
- }
92
- };
93
- let kt = 0;
94
- class te {
95
- constructor(e) {
96
- this.id = kt++, 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;
97
- for (const o in e)
98
- be(e, o) && (this[o] = e[o]);
99
- this.level = 0, this.loaded = !1, this.childNodes = [], this.loading = !1, this.parent && (this.level = this.parent.level + 1);
100
- }
101
- initialize() {
102
- const e = this.store;
103
- if (!e)
104
- throw new Error("[Node]store is required!");
105
- e.registerNode(this);
106
- const o = e.props;
107
- if (o && typeof o.isLeaf < "u") {
108
- const d = ye(this, "isLeaf");
109
- Pe(d) && (this.isLeafByUser = d);
110
- }
111
- if (e.lazy !== !0 && this.data ? (this.setData(this.data), e.defaultExpandAll && (this.expanded = !0, this.canFocus = !0)) : this.level > 0 && e.lazy && e.defaultExpandAll && !this.isLeafByUser && this.expand(), fe(this.data) || Ie(this, this.data), !this.data)
112
- return;
113
- const s = e.defaultExpandedKeys, n = e.key;
114
- n && s && s.includes(this.key) && this.expand(null, e.autoExpandParent), n && e.currentNodeKey !== void 0 && this.key === e.currentNodeKey && (e.currentNode = this, e.currentNode.isCurrent = !0), e.lazy && e._initDefaultCheckedNode(this), this.updateLeafState(), this.parent && (this.level === 1 || this.parent.expanded === !0) && (this.canFocus = !0);
115
- }
116
- setData(e) {
117
- fe(e) || Ie(this, e), this.data = e, this.childNodes = [];
118
- let o;
119
- this.level === 0 && fe(this.data) ? o = this.data : o = ye(this, "children") || [];
120
- for (let s = 0, n = o.length; s < n; s++)
121
- this.insertChild({ data: o[s] });
122
- }
123
- get label() {
124
- return ye(this, "label");
125
- }
126
- get key() {
127
- const e = this.store.key;
128
- return this.data ? this.data[e] : null;
129
- }
130
- get disabled() {
131
- return ye(this, "disabled");
132
- }
133
- get nextSibling() {
134
- const e = this.parent;
135
- if (e) {
136
- const o = e.childNodes.indexOf(this);
137
- if (o > -1)
138
- return e.childNodes[o + 1];
139
- }
140
- return null;
141
- }
142
- get previousSibling() {
143
- const e = this.parent;
144
- if (e) {
145
- const o = e.childNodes.indexOf(this);
146
- if (o > -1)
147
- return o > 0 ? e.childNodes[o - 1] : null;
148
- }
149
- return null;
150
- }
151
- contains(e, o = !0) {
152
- return (this.childNodes || []).some((s) => s === e || o && s.contains(e));
153
- }
154
- remove() {
155
- const e = this.parent;
156
- e && e.removeChild(this);
157
- }
158
- insertChild(e, o, s) {
159
- if (!e)
160
- throw new Error("InsertChild error: child is required.");
161
- if (!(e instanceof te)) {
162
- if (!s) {
163
- const n = this.getChildren(!0);
164
- n.includes(e.data) || (_e(o) || o < 0 ? n.push(e.data) : n.splice(o, 0, e.data));
165
- }
166
- Object.assign(e, {
167
- parent: this,
168
- store: this.store
169
- }), e = rt(new te(e)), e instanceof te && e.initialize();
170
- }
171
- e.level = this.level + 1, _e(o) || o < 0 ? this.childNodes.push(e) : this.childNodes.splice(o, 0, e), this.updateLeafState();
172
- }
173
- insertBefore(e, o) {
174
- let s;
175
- o && (s = this.childNodes.indexOf(o)), this.insertChild(e, s);
176
- }
177
- insertAfter(e, o) {
178
- let s;
179
- o && (s = this.childNodes.indexOf(o), s !== -1 && (s += 1)), this.insertChild(e, s);
180
- }
181
- removeChild(e) {
182
- const o = this.getChildren() || [], s = o.indexOf(e.data);
183
- s > -1 && o.splice(s, 1);
184
- const n = this.childNodes.indexOf(e);
185
- n > -1 && (this.store && this.store.deregisterNode(e), e.parent = null, this.childNodes.splice(n, 1)), this.updateLeafState();
186
- }
187
- removeChildByData(e) {
188
- let o = null;
189
- for (let s = 0; s < this.childNodes.length; s++)
190
- if (this.childNodes[s].data === e) {
191
- o = this.childNodes[s];
192
- break;
193
- }
194
- o && this.removeChild(o);
195
- }
196
- expand(e, o) {
197
- const s = () => {
198
- if (o) {
199
- let n = this.parent;
200
- for (; n.level > 0; )
201
- n.expanded = !0, n = n.parent;
202
- }
203
- this.expanded = !0, e && e(), this.childNodes.forEach((n) => {
204
- n.canFocus = !0;
205
- });
206
- };
207
- this.shouldLoadData() ? this.loadData((n) => {
208
- fe(n) && (this.checked ? this.setChecked(!0, !0) : this.store.checkStrictly || le(this), s());
209
- }) : s();
210
- }
211
- doCreateChildren(e, o = {}) {
212
- e.forEach((s) => {
213
- this.insertChild(Object.assign({ data: s }, o), void 0, !0);
214
- });
215
- }
216
- collapse() {
217
- this.expanded = !1, this.childNodes.forEach((e) => {
218
- e.canFocus = !1;
219
- });
220
- }
221
- shouldLoadData() {
222
- return this.store.lazy === !0 && this.store.load && !this.loaded;
223
- }
224
- updateLeafState() {
225
- if (this.store.lazy === !0 && this.loaded !== !0 && typeof this.isLeafByUser < "u") {
226
- this.isLeaf = this.isLeafByUser;
227
- return;
228
- }
229
- const e = this.childNodes;
230
- if (!this.store.lazy || this.store.lazy === !0 && this.loaded === !0) {
231
- this.isLeaf = !e || e.length === 0;
232
- return;
233
- }
234
- this.isLeaf = !1;
235
- }
236
- setChecked(e, o, s, n) {
237
- if (this.indeterminate = e === "half", this.checked = e === !0, this.store.checkStrictly)
238
- return;
239
- if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
240
- const { all: r, allWithoutDisable: i } = we(this.childNodes);
241
- !this.isLeaf && !r && i && (this.checked = !1, e = !1);
242
- const p = () => {
243
- if (o) {
244
- const h = this.childNodes;
245
- for (let u = 0, g = h.length; u < g; u++) {
246
- const N = h[u];
247
- n = n || e !== !1;
248
- const k = N.disabled ? N.checked : n;
249
- N.setChecked(k, o, !0, n);
250
- }
251
- const { half: c, all: l } = we(h);
252
- l || (this.checked = l, this.indeterminate = c);
253
- }
254
- };
255
- if (this.shouldLoadData()) {
256
- this.loadData(() => {
257
- p(), le(this);
258
- }, {
259
- checked: e !== !1
260
- });
261
- return;
262
- } else
263
- p();
264
- }
265
- const d = this.parent;
266
- !d || d.level === 0 || s || le(d);
267
- }
268
- getChildren(e = !1) {
269
- if (this.level === 0)
270
- return this.data;
271
- const o = this.data;
272
- if (!o)
273
- return null;
274
- const s = this.store.props;
275
- let n = "children";
276
- return s && (n = s.children || "children"), o[n] === void 0 && (o[n] = null), e && !o[n] && (o[n] = []), o[n];
277
- }
278
- updateChildren() {
279
- const e = this.getChildren() || [], o = this.childNodes.map((d) => d.data), s = {}, n = [];
280
- e.forEach((d, r) => {
281
- const i = d[oe];
282
- !!i && o.findIndex((h) => h[oe] === i) >= 0 ? s[i] = { index: r, data: d } : n.push({ index: r, data: d });
283
- }), this.store.lazy || o.forEach((d) => {
284
- s[d[oe]] || this.removeChildByData(d);
285
- }), n.forEach(({ index: d, data: r }) => {
286
- this.insertChild({ data: r }, d);
287
- }), this.updateLeafState();
288
- }
289
- loadData(e, o = {}) {
290
- if (this.store.lazy === !0 && this.store.load && !this.loaded && (!this.loading || Object.keys(o).length)) {
291
- this.loading = !0;
292
- const s = (d) => {
293
- this.childNodes = [], this.doCreateChildren(d, o), this.loaded = !0, this.loading = !1, this.updateLeafState(), e && e.call(this, d);
294
- }, n = () => {
295
- this.loading = !1;
296
- };
297
- this.store.load(this, s, n);
298
- } else
299
- e && e.call(this);
300
- }
301
- eachNode(e) {
302
- const o = [this];
303
- for (; o.length; ) {
304
- const s = o.shift();
305
- o.unshift(...s.childNodes), e(s);
306
- }
307
- }
308
- reInitChecked() {
309
- this.store.checkStrictly || le(this);
310
- }
311
- }
312
- class Nt {
313
- constructor(e) {
314
- this.currentNode = null, this.currentNodeKey = null;
315
- for (const o in e)
316
- be(e, o) && (this[o] = e[o]);
317
- this.nodesMap = {};
318
- }
319
- initialize() {
320
- if (this.root = new te({
321
- data: this.data,
322
- store: this
323
- }), this.root.initialize(), this.lazy && this.load) {
324
- const e = this.load;
325
- e(this.root, (o) => {
326
- this.root.doCreateChildren(o), this._initDefaultCheckedNodes();
327
- });
328
- } else
329
- this._initDefaultCheckedNodes();
330
- }
331
- filter(e) {
332
- const o = this.filterNodeMethod, s = this.lazy, n = function(d) {
333
- const r = d.root ? d.root.childNodes : d.childNodes;
334
- if (r.forEach((i) => {
335
- i.visible = o.call(i, e, i.data, i), n(i);
336
- }), !d.visible && r.length) {
337
- let i = !0;
338
- i = !r.some((p) => p.visible), d.root ? d.root.visible = i === !1 : d.visible = i === !1;
339
- }
340
- e && d.visible && !d.isLeaf && (!s || d.loaded) && d.expand();
341
- };
342
- n(this);
343
- }
344
- setData(e) {
345
- e !== this.root.data ? (this.nodesMap = {}, this.root.setData(e), this._initDefaultCheckedNodes(), this.setCurrentNodeKey(this.currentNodeKey)) : this.root.updateChildren();
346
- }
347
- getNode(e) {
348
- if (e instanceof te)
349
- return e;
350
- const o = Me(e) ? xe(this.key, e) : e;
351
- return this.nodesMap[o] || null;
352
- }
353
- insertBefore(e, o) {
354
- const s = this.getNode(o);
355
- s.parent.insertBefore({ data: e }, s);
356
- }
357
- insertAfter(e, o) {
358
- const s = this.getNode(o);
359
- s.parent.insertAfter({ data: e }, s);
360
- }
361
- remove(e) {
362
- const o = this.getNode(e);
363
- o && o.parent && (o === this.currentNode && (this.currentNode = null), o.parent.removeChild(o));
364
- }
365
- append(e, o) {
366
- const s = He(o) ? this.root : this.getNode(o);
367
- s && s.insertChild({ data: e });
368
- }
369
- _initDefaultCheckedNodes() {
370
- const e = this.defaultCheckedKeys || [], o = this.nodesMap;
371
- e.forEach((s) => {
372
- const n = o[s];
373
- n && n.setChecked(!0, !this.checkStrictly);
374
- });
375
- }
376
- _initDefaultCheckedNode(e) {
377
- (this.defaultCheckedKeys || []).includes(e.key) && e.setChecked(!0, !this.checkStrictly);
378
- }
379
- setDefaultCheckedKey(e) {
380
- e !== this.defaultCheckedKeys && (this.defaultCheckedKeys = e, this._initDefaultCheckedNodes());
381
- }
382
- registerNode(e) {
383
- const o = this.key;
384
- !e || !e.data || (o ? e.key !== void 0 && (this.nodesMap[e.key] = e) : this.nodesMap[e.id] = e);
385
- }
386
- deregisterNode(e) {
387
- !this.key || !e || !e.data || (e.childNodes.forEach((s) => {
388
- this.deregisterNode(s);
389
- }), delete this.nodesMap[e.key]);
390
- }
391
- getCheckedNodes(e = !1, o = !1) {
392
- const s = [], n = function(d) {
393
- (d.root ? d.root.childNodes : d.childNodes).forEach((i) => {
394
- (i.checked || o && i.indeterminate) && (!e || e && i.isLeaf) && s.push(i.data), n(i);
395
- });
396
- };
397
- return n(this), s;
398
- }
399
- getCheckedKeys(e = !1) {
400
- return this.getCheckedNodes(e).map((o) => (o || {})[this.key]);
401
- }
402
- getHalfCheckedNodes() {
403
- const e = [], o = function(s) {
404
- (s.root ? s.root.childNodes : s.childNodes).forEach((d) => {
405
- d.indeterminate && e.push(d.data), o(d);
406
- });
407
- };
408
- return o(this), e;
409
- }
410
- getHalfCheckedKeys() {
411
- return this.getHalfCheckedNodes().map((e) => (e || {})[this.key]);
412
- }
413
- _getAllNodes() {
414
- const e = [], o = this.nodesMap;
415
- for (const s in o)
416
- be(o, s) && e.push(o[s]);
417
- return e;
418
- }
419
- updateChildren(e, o) {
420
- const s = this.nodesMap[e];
421
- if (!s)
422
- return;
423
- const n = s.childNodes;
424
- for (let d = n.length - 1; d >= 0; d--) {
425
- const r = n[d];
426
- this.remove(r.data);
427
- }
428
- for (let d = 0, r = o.length; d < r; d++) {
429
- const i = o[d];
430
- this.append(i, s.data);
431
- }
432
- }
433
- _setCheckedKeys(e, o = !1, s) {
434
- const n = this._getAllNodes().sort((p, h) => p.level - h.level), d = /* @__PURE__ */ Object.create(null), r = Object.keys(s);
435
- n.forEach((p) => p.setChecked(!1, !1));
436
- const i = (p) => {
437
- p.childNodes.forEach((h) => {
438
- var c;
439
- d[h.data[e]] = !0, (c = h.childNodes) != null && c.length && i(h);
440
- });
441
- };
442
- for (let p = 0, h = n.length; p < h; p++) {
443
- const c = n[p], l = c.data[e].toString();
444
- if (!r.includes(l)) {
445
- c.checked && !d[l] && c.setChecked(!1, !1);
446
- continue;
447
- }
448
- if (c.childNodes.length && i(c), c.isLeaf || this.checkStrictly) {
449
- c.setChecked(!0, !1);
450
- continue;
451
- }
452
- if (c.setChecked(!0, !0), o) {
453
- c.setChecked(!1, !1);
454
- const g = function(N) {
455
- N.childNodes.forEach((E) => {
456
- E.isLeaf || E.setChecked(!1, !1), g(E);
457
- });
458
- };
459
- g(c);
460
- }
461
- }
462
- }
463
- setCheckedNodes(e, o = !1) {
464
- const s = this.key, n = {};
465
- e.forEach((d) => {
466
- n[(d || {})[s]] = !0;
467
- }), this._setCheckedKeys(s, o, n);
468
- }
469
- setCheckedKeys(e, o = !1) {
470
- this.defaultCheckedKeys = e;
471
- const s = this.key, n = {};
472
- e.forEach((d) => {
473
- n[d] = !0;
474
- }), this._setCheckedKeys(s, o, n);
475
- }
476
- setDefaultExpandedKeys(e) {
477
- e = e || [], this.defaultExpandedKeys = e, e.forEach((o) => {
478
- const s = this.getNode(o);
479
- s && s.expand(null, this.autoExpandParent);
480
- });
481
- }
482
- setChecked(e, o, s) {
483
- const n = this.getNode(e);
484
- n && n.setChecked(!!o, s);
485
- }
486
- getCurrentNode() {
487
- return this.currentNode;
488
- }
489
- setCurrentNode(e) {
490
- const o = this.currentNode;
491
- o && (o.isCurrent = !1), this.currentNode = e, this.currentNode.isCurrent = !0;
492
- }
493
- setUserCurrentNode(e, o = !0) {
494
- const s = e[this.key], n = this.nodesMap[s];
495
- this.setCurrentNode(n), o && this.currentNode.level > 1 && this.currentNode.parent.expand(null, !0);
496
- }
497
- setCurrentNodeKey(e, o = !0) {
498
- if (this.currentNodeKey = e, e == null) {
499
- this.currentNode && (this.currentNode.isCurrent = !1), this.currentNode = null;
500
- return;
501
- }
502
- const s = this.getNode(e);
503
- s && (this.setCurrentNode(s), o && this.currentNode.level > 1 && this.currentNode.parent.expand(null, !0));
504
- }
505
- }
506
- const Ct = re({
507
- name: "ElTreeNodeContent",
508
- props: {
509
- node: {
510
- type: Object,
511
- required: !0
512
- },
513
- renderContent: Function
514
- },
515
- setup(t) {
516
- const e = de("tree"), o = se("NodeInstance"), s = se("RootTree");
517
- return () => {
518
- const n = t.node, { data: d, store: r } = n;
519
- return t.renderContent ? t.renderContent(Te, { _self: o, node: n, data: d, store: r }) : Ke(s.ctx.slots, "default", { node: n, data: d }, () => [
520
- Te("span", { class: e.be("node", "label") }, [n.label])
521
- ]);
522
- };
523
- }
524
- });
525
- var mt = /* @__PURE__ */ ke(Ct, [["__file", "tree-node-content.vue"]]);
526
- function je(t) {
527
- const e = se("TreeNodeMap", null), o = {
528
- treeNodeExpand: (s) => {
529
- t.node !== s && t.node.collapse();
530
- },
531
- children: []
532
- };
533
- return e && e.children.push(o), he("TreeNodeMap", o), {
534
- broadcastExpanded: (s) => {
535
- if (t.accordion)
536
- for (const n of o.children)
537
- n.treeNodeExpand(s);
538
- }
539
- };
540
- }
541
- const Oe = Symbol("dragEvents");
542
- function bt({ props: t, ctx: e, el$: o, dropIndicator$: s, store: n }) {
543
- const d = de("tree"), r = x({
544
- showDropIndicator: !1,
545
- draggingNode: null,
546
- dropNode: null,
547
- allowDrop: !0,
548
- dropType: null
549
- });
550
- return he(Oe, {
551
- treeNodeDragStart: ({ event: c, treeNode: l }) => {
552
- if (ve(t.allowDrag) && !t.allowDrag(l.node))
553
- return c.preventDefault(), !1;
554
- c.dataTransfer.effectAllowed = "move";
555
- try {
556
- c.dataTransfer.setData("text/plain", "");
557
- } catch {
558
- }
559
- r.value.draggingNode = l, e.emit("node-drag-start", l.node, c);
560
- },
561
- treeNodeDragOver: ({ event: c, treeNode: l }) => {
562
- const u = l, g = r.value.dropNode;
563
- g && g.node.id !== u.node.id && Ce(g.$el, d.is("drop-inner"));
564
- const N = r.value.draggingNode;
565
- if (!N || !u)
566
- return;
567
- let k = !0, E = !0, B = !0, z = !0;
568
- ve(t.allowDrop) && (k = t.allowDrop(N.node, u.node, "prev"), z = E = t.allowDrop(N.node, u.node, "inner"), B = t.allowDrop(N.node, u.node, "next")), c.dataTransfer.dropEffect = E || k || B ? "move" : "none", (k || E || B) && (g == null ? void 0 : g.node.id) !== u.node.id && (g && e.emit("node-drag-leave", N.node, g.node, c), e.emit("node-drag-enter", N.node, u.node, c)), k || E || B ? r.value.dropNode = u : r.value.dropNode = null, u.node.nextSibling === N.node && (B = !1), u.node.previousSibling === N.node && (k = !1), u.node.contains(N.node, !1) && (E = !1), (N.node === u.node || N.node.contains(u.node)) && (k = !1, E = !1, B = !1);
569
- const L = u.$el.querySelector(`.${d.be("node", "content")}`).getBoundingClientRect(), j = o.value.getBoundingClientRect();
570
- let A;
571
- const F = k ? E ? 0.25 : B ? 0.45 : 1 : -1, ne = B ? E ? 0.75 : k ? 0.55 : 0 : 1;
572
- let R = -9999;
573
- const y = c.clientY - L.top;
574
- y < L.height * F ? A = "before" : y > L.height * ne ? A = "after" : E ? A = "inner" : A = "none";
575
- const w = u.$el.querySelector(`.${d.be("node", "expand-icon")}`).getBoundingClientRect(), T = s.value;
576
- A === "before" ? R = w.top - j.top : A === "after" && (R = w.bottom - j.top), T.style.top = `${R}px`, T.style.left = `${w.right - j.left}px`, A === "inner" ? ze(u.$el, d.is("drop-inner")) : Ce(u.$el, d.is("drop-inner")), r.value.showDropIndicator = A === "before" || A === "after", r.value.allowDrop = r.value.showDropIndicator || z, r.value.dropType = A, e.emit("node-drag-over", N.node, u.node, c);
577
- },
578
- treeNodeDragEnd: (c) => {
579
- const { draggingNode: l, dropType: u, dropNode: g } = r.value;
580
- if (c.preventDefault(), c.dataTransfer && (c.dataTransfer.dropEffect = "move"), l && g) {
581
- const N = { data: l.node.data };
582
- u !== "none" && l.node.remove(), u === "before" ? g.node.parent.insertBefore(N, g.node) : u === "after" ? g.node.parent.insertAfter(N, g.node) : u === "inner" && g.node.insertChild(N), u !== "none" && (n.value.registerNode(N), n.value.key && l.node.eachNode((k) => {
583
- var E;
584
- (E = n.value.nodesMap[k.data[n.value.key]]) == null || E.setChecked(k.checked, !n.value.checkStrictly);
585
- })), Ce(g.$el, d.is("drop-inner")), e.emit("node-drag-end", l.node, g.node, u, c), u !== "none" && e.emit("node-drop", l.node, g.node, u, c);
586
- }
587
- l && !g && e.emit("node-drag-end", l.node, null, u, c), r.value.showDropIndicator = !1, r.value.draggingNode = null, r.value.dropNode = null, r.value.allowDrop = !0;
588
- }
589
- }), {
590
- dragState: r
591
- };
592
- }
593
- const _t = re({
594
- name: "ElTreeNode",
595
- components: {
596
- ElCollapseTransition: gt,
597
- ElCheckbox: nt,
598
- NodeContent: mt,
599
- ElIcon: Fe,
600
- Loading: ht
601
- },
602
- props: {
603
- node: {
604
- type: te,
605
- default: () => ({})
606
- },
607
- props: {
608
- type: Object,
609
- default: () => ({})
610
- },
611
- accordion: Boolean,
612
- renderContent: Function,
613
- renderAfterExpand: Boolean,
614
- showCheckbox: {
615
- type: Boolean,
616
- default: !1
617
- }
618
- },
619
- emits: ["node-expand"],
620
- setup(t, e) {
621
- const o = de("tree"), { broadcastExpanded: s } = je(t), n = se("RootTree"), d = x(!1), r = x(!1), i = x(null), p = x(null), h = x(null), c = se(Oe), l = Le();
622
- he("NodeInstance", l), n || qe("Tree", "Can not find node's tree."), t.node.expanded && (d.value = !0, r.value = !0);
623
- const u = n.props.props.children || "children";
624
- M(() => {
625
- const y = t.node.data[u];
626
- return y && [...y];
627
- }, () => {
628
- t.node.updateChildren();
629
- }), M(() => t.node.indeterminate, (y) => {
630
- k(t.node.checked, y);
631
- }), M(() => t.node.checked, (y) => {
632
- k(y, t.node.indeterminate);
633
- }), M(() => t.node.childNodes.length, () => t.node.reInitChecked()), M(() => t.node.expanded, (y) => {
634
- ge(() => d.value = y), y && (r.value = !0);
635
- });
636
- const g = (y) => xe(n.props.nodeKey, y.data), N = (y) => {
637
- const w = t.props.class;
638
- if (!w)
639
- return {};
640
- let T;
641
- if (ve(w)) {
642
- const { data: O } = y;
643
- T = w(O, y);
644
- } else
645
- T = w;
646
- return Ae(T) ? { [T]: !0 } : T;
647
- }, k = (y, w) => {
648
- (i.value !== y || p.value !== w) && n.ctx.emit("check-change", t.node.data, y, w), i.value = y, p.value = w;
649
- }, E = (y) => {
650
- Ee(n.store, n.ctx.emit, () => {
651
- var w;
652
- if ((w = n == null ? void 0 : n.props) == null ? void 0 : w.nodeKey) {
653
- const O = g(t.node);
654
- n.store.value.setCurrentNodeKey(O);
655
- } else
656
- n.store.value.setCurrentNode(t.node);
657
- }), n.currentNode.value = t.node, n.props.expandOnClickNode && z(), n.props.checkOnClickNode && !t.node.disabled && L(null, {
658
- target: { checked: !t.node.checked }
659
- }), n.ctx.emit("node-click", t.node.data, t.node, l, y);
660
- }, B = (y) => {
661
- n.instance.vnode.props.onNodeContextmenu && (y.stopPropagation(), y.preventDefault()), n.ctx.emit("node-contextmenu", y, t.node.data, t.node, l);
662
- }, z = () => {
663
- t.node.isLeaf || (d.value ? (n.ctx.emit("node-collapse", t.node.data, t.node, l), t.node.collapse()) : t.node.expand(() => {
664
- e.emit("node-expand", t.node.data, t.node, l);
665
- }));
666
- }, L = (y, w) => {
667
- t.node.setChecked(w.target.checked, !n.props.checkStrictly), ge(() => {
668
- const T = n.store.value;
669
- n.ctx.emit("check", t.node.data, {
670
- checkedNodes: T.getCheckedNodes(),
671
- checkedKeys: T.getCheckedKeys(),
672
- halfCheckedNodes: T.getHalfCheckedNodes(),
673
- halfCheckedKeys: T.getHalfCheckedKeys()
674
- });
675
- });
676
- };
677
- return {
678
- ns: o,
679
- node$: h,
680
- tree: n,
681
- expanded: d,
682
- childNodeRendered: r,
683
- oldChecked: i,
684
- oldIndeterminate: p,
685
- getNodeKey: g,
686
- getNodeClass: N,
687
- handleSelectChange: k,
688
- handleClick: E,
689
- handleContextMenu: B,
690
- handleExpandIconClick: z,
691
- handleCheckChange: L,
692
- handleChildNodeExpand: (y, w, T) => {
693
- s(w), n.ctx.emit("node-expand", y, w, T);
694
- },
695
- handleDragStart: (y) => {
696
- n.props.draggable && c.treeNodeDragStart({ event: y, treeNode: t });
697
- },
698
- handleDragOver: (y) => {
699
- y.preventDefault(), n.props.draggable && c.treeNodeDragOver({
700
- event: y,
701
- treeNode: { $el: h.value, node: t.node }
702
- });
703
- },
704
- handleDrop: (y) => {
705
- y.preventDefault();
706
- },
707
- handleDragEnd: (y) => {
708
- n.props.draggable && c.treeNodeDragEnd(y);
709
- },
710
- CaretRight: ft
711
- };
712
- }
713
- });
714
- function Et(t, e, o, s, n, d) {
715
- const r = ee("el-icon"), i = ee("el-checkbox"), p = ee("loading"), h = ee("node-content"), c = ee("el-tree-node"), l = ee("el-collapse-transition");
716
- return W((D(), $("div", {
717
- ref: "node$",
718
- class: H([
719
- t.ns.b("node"),
720
- t.ns.is("expanded", t.expanded),
721
- t.ns.is("current", t.node.isCurrent),
722
- t.ns.is("hidden", !t.node.visible),
723
- t.ns.is("focusable", !t.node.disabled),
724
- t.ns.is("checked", !t.node.disabled && t.node.checked),
725
- t.getNodeClass(t.node)
726
- ]),
727
- role: "treeitem",
728
- tabindex: "-1",
729
- "aria-expanded": t.expanded,
730
- "aria-disabled": t.node.disabled,
731
- "aria-checked": t.node.checked,
732
- draggable: t.tree.props.draggable,
733
- "data-key": t.getNodeKey(t.node),
734
- onClick: Z(t.handleClick, ["stop"]),
735
- onContextmenu: t.handleContextMenu,
736
- onDragstart: Z(t.handleDragStart, ["stop"]),
737
- onDragover: Z(t.handleDragOver, ["stop"]),
738
- onDragend: Z(t.handleDragEnd, ["stop"]),
739
- onDrop: Z(t.handleDrop, ["stop"])
740
- }, [
741
- _("div", {
742
- class: H(t.ns.be("node", "content")),
743
- style: at({ paddingLeft: (t.node.level - 1) * t.tree.props.indent + "px" })
744
- }, [
745
- t.tree.props.icon || t.CaretRight ? (D(), G(r, {
746
- key: 0,
747
- class: H([
748
- t.ns.be("node", "expand-icon"),
749
- t.ns.is("leaf", t.node.isLeaf),
750
- {
751
- expanded: !t.node.isLeaf && t.expanded
752
- }
753
- ]),
754
- onClick: Z(t.handleExpandIconClick, ["stop"])
755
- }, {
756
- default: I(() => [
757
- (D(), G(it(t.tree.props.icon || t.CaretRight)))
758
- ]),
759
- _: 1
760
- }, 8, ["class", "onClick"])) : ie("v-if", !0),
761
- t.showCheckbox ? (D(), G(i, {
762
- key: 1,
763
- "model-value": t.node.checked,
764
- indeterminate: t.node.indeterminate,
765
- disabled: !!t.node.disabled,
766
- onClick: Z(() => {
767
- }, ["stop"]),
768
- onChange: t.handleCheckChange
769
- }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onChange"])) : ie("v-if", !0),
770
- t.node.loading ? (D(), G(r, {
771
- key: 2,
772
- class: H([t.ns.be("node", "loading-icon"), t.ns.is("loading")])
773
- }, {
774
- default: I(() => [
775
- S(p)
776
- ]),
777
- _: 1
778
- }, 8, ["class"])) : ie("v-if", !0),
779
- S(h, {
780
- node: t.node,
781
- "render-content": t.renderContent
782
- }, null, 8, ["node", "render-content"])
783
- ], 6),
784
- S(l, null, {
785
- default: I(() => [
786
- !t.renderAfterExpand || t.childNodeRendered ? W((D(), $("div", {
787
- key: 0,
788
- class: H(t.ns.be("node", "children")),
789
- role: "group",
790
- "aria-expanded": t.expanded
791
- }, [
792
- (D(!0), $(ce, null, ue(t.node.childNodes, (u) => (D(), G(c, {
793
- key: t.getNodeKey(u),
794
- "render-content": t.renderContent,
795
- "render-after-expand": t.renderAfterExpand,
796
- "show-checkbox": t.showCheckbox,
797
- node: u,
798
- accordion: t.accordion,
799
- props: t.props,
800
- onNodeExpand: t.handleChildNodeExpand
801
- }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]))), 128))
802
- ], 10, ["aria-expanded"])), [
803
- [Y, t.expanded]
804
- ]) : ie("v-if", !0)
805
- ]),
806
- _: 1
807
- })
808
- ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key", "onClick", "onContextmenu", "onDragstart", "onDragover", "onDragend", "onDrop"])), [
809
- [Y, t.node.visible]
810
- ]);
811
- }
812
- var wt = /* @__PURE__ */ ke(_t, [["render", Et], ["__file", "tree-node.vue"]]);
813
- function Kt({ el$: t }, e) {
814
- const o = de("tree"), s = Se([]), n = Se([]);
815
- $e(() => {
816
- r();
817
- }), lt(() => {
818
- s.value = Array.from(t.value.querySelectorAll("[role=treeitem]")), n.value = Array.from(t.value.querySelectorAll("input[type=checkbox]"));
819
- }), M(n, (i) => {
820
- i.forEach((p) => {
821
- p.setAttribute("tabindex", "-1");
822
- });
823
- }), Re(t, "keydown", (i) => {
824
- const p = i.target;
825
- if (!p.className.includes(o.b("node")))
826
- return;
827
- const h = i.code;
828
- s.value = Array.from(t.value.querySelectorAll(`.${o.is("focusable")}[role=treeitem]`));
829
- const c = s.value.indexOf(p);
830
- let l;
831
- if ([Q.up, Q.down].includes(h)) {
832
- if (i.preventDefault(), h === Q.up) {
833
- l = c === -1 ? 0 : c !== 0 ? c - 1 : s.value.length - 1;
834
- const g = l;
835
- for (; !e.value.getNode(s.value[l].dataset.key).canFocus; ) {
836
- if (l--, l === g) {
837
- l = -1;
838
- break;
839
- }
840
- l < 0 && (l = s.value.length - 1);
841
- }
842
- } else {
843
- l = c === -1 ? 0 : c < s.value.length - 1 ? c + 1 : 0;
844
- const g = l;
845
- for (; !e.value.getNode(s.value[l].dataset.key).canFocus; ) {
846
- if (l++, l === g) {
847
- l = -1;
848
- break;
849
- }
850
- l >= s.value.length && (l = 0);
851
- }
852
- }
853
- l !== -1 && s.value[l].focus();
854
- }
855
- [Q.left, Q.right].includes(h) && (i.preventDefault(), p.click());
856
- const u = p.querySelector('[type="checkbox"]');
857
- [Q.enter, Q.numpadEnter, Q.space].includes(h) && u && (i.preventDefault(), u.click());
858
- });
859
- const r = () => {
860
- var i;
861
- s.value = Array.from(t.value.querySelectorAll(`.${o.is("focusable")}[role=treeitem]`)), n.value = Array.from(t.value.querySelectorAll("input[type=checkbox]"));
862
- const p = t.value.querySelectorAll(`.${o.is("checked")}[role=treeitem]`);
863
- if (p.length) {
864
- p[0].setAttribute("tabindex", "0");
865
- return;
866
- }
867
- (i = s.value[0]) == null || i.setAttribute("tabindex", "0");
868
- };
869
- }
870
- const xt = re({
871
- name: "ElTree",
872
- components: { ElTreeNode: wt },
873
- props: {
874
- data: {
875
- type: Array,
876
- default: () => []
877
- },
878
- emptyText: {
879
- type: String
880
- },
881
- renderAfterExpand: {
882
- type: Boolean,
883
- default: !0
884
- },
885
- nodeKey: String,
886
- checkStrictly: Boolean,
887
- defaultExpandAll: Boolean,
888
- expandOnClickNode: {
889
- type: Boolean,
890
- default: !0
891
- },
892
- checkOnClickNode: Boolean,
893
- checkDescendants: {
894
- type: Boolean,
895
- default: !1
896
- },
897
- autoExpandParent: {
898
- type: Boolean,
899
- default: !0
900
- },
901
- defaultCheckedKeys: Array,
902
- defaultExpandedKeys: Array,
903
- currentNodeKey: [String, Number],
904
- renderContent: Function,
905
- showCheckbox: {
906
- type: Boolean,
907
- default: !1
908
- },
909
- draggable: {
910
- type: Boolean,
911
- default: !1
912
- },
913
- allowDrag: Function,
914
- allowDrop: Function,
915
- props: {
916
- type: Object,
917
- default: () => ({
918
- children: "children",
919
- label: "label",
920
- disabled: "disabled"
921
- })
922
- },
923
- lazy: {
924
- type: Boolean,
925
- default: !1
926
- },
927
- highlightCurrent: Boolean,
928
- load: Function,
929
- filterNodeMethod: Function,
930
- accordion: Boolean,
931
- indent: {
932
- type: Number,
933
- default: 18
934
- },
935
- icon: {
936
- type: Ve
937
- }
938
- },
939
- emits: [
940
- "check-change",
941
- "current-change",
942
- "node-click",
943
- "node-contextmenu",
944
- "node-collapse",
945
- "node-expand",
946
- "check",
947
- "node-drag-start",
948
- "node-drag-end",
949
- "node-drop",
950
- "node-drag-leave",
951
- "node-drag-enter",
952
- "node-drag-over"
953
- ],
954
- setup(t, e) {
955
- const { t: o } = Ue(), s = de("tree"), n = se(We, null), d = x(new Nt({
956
- key: t.nodeKey,
957
- data: t.data,
958
- lazy: t.lazy,
959
- props: t.props,
960
- load: t.load,
961
- currentNodeKey: t.currentNodeKey,
962
- checkStrictly: t.checkStrictly,
963
- checkDescendants: t.checkDescendants,
964
- defaultCheckedKeys: t.defaultCheckedKeys,
965
- defaultExpandedKeys: t.defaultExpandedKeys,
966
- autoExpandParent: t.autoExpandParent,
967
- defaultExpandAll: t.defaultExpandAll,
968
- filterNodeMethod: t.filterNodeMethod
969
- }));
970
- d.value.initialize();
971
- const r = x(d.value.root), i = x(null), p = x(null), h = x(null), { broadcastExpanded: c } = je(t), { dragState: l } = bt({
972
- props: t,
973
- ctx: e,
974
- el$: p,
975
- dropIndicator$: h,
976
- store: d
977
- });
978
- Kt({ el$: p }, d);
979
- const u = ct(() => {
980
- const { childNodes: a } = r.value, m = n ? n.hasFilteredOptions !== 0 : !1;
981
- return (!a || a.length === 0 || a.every(({ visible: K }) => !K)) && !m;
982
- });
983
- M(() => t.currentNodeKey, (a) => {
984
- d.value.setCurrentNodeKey(a);
985
- }), M(() => t.defaultCheckedKeys, (a) => {
986
- d.value.setDefaultCheckedKey(a);
987
- }), M(() => t.defaultExpandedKeys, (a) => {
988
- d.value.setDefaultExpandedKeys(a);
989
- }), M(() => t.data, (a) => {
990
- d.value.setData(a);
991
- }, { deep: !0 }), M(() => t.checkStrictly, (a) => {
992
- d.value.checkStrictly = a;
993
- });
994
- const g = (a) => {
995
- if (!t.filterNodeMethod)
996
- throw new Error("[Tree] filterNodeMethod is required when filter");
997
- d.value.filter(a);
998
- }, N = (a) => xe(t.nodeKey, a.data), k = (a) => {
999
- if (!t.nodeKey)
1000
- throw new Error("[Tree] nodeKey is required in getNodePath");
1001
- const m = d.value.getNode(a);
1002
- if (!m)
1003
- return [];
1004
- const K = [m.data];
1005
- let P = m.parent;
1006
- for (; P && P !== r.value; )
1007
- K.push(P.data), P = P.parent;
1008
- return K.reverse();
1009
- }, E = (a, m) => d.value.getCheckedNodes(a, m), B = (a) => d.value.getCheckedKeys(a), z = () => {
1010
- const a = d.value.getCurrentNode();
1011
- return a ? a.data : null;
1012
- }, L = () => {
1013
- if (!t.nodeKey)
1014
- throw new Error("[Tree] nodeKey is required in getCurrentKey");
1015
- const a = z();
1016
- return a ? a[t.nodeKey] : null;
1017
- }, j = (a, m) => {
1018
- if (!t.nodeKey)
1019
- throw new Error("[Tree] nodeKey is required in setCheckedNodes");
1020
- d.value.setCheckedNodes(a, m);
1021
- }, A = (a, m) => {
1022
- if (!t.nodeKey)
1023
- throw new Error("[Tree] nodeKey is required in setCheckedKeys");
1024
- d.value.setCheckedKeys(a, m);
1025
- }, F = (a, m, K) => {
1026
- d.value.setChecked(a, m, K);
1027
- }, ne = () => d.value.getHalfCheckedNodes(), R = () => d.value.getHalfCheckedKeys(), y = (a, m = !0) => {
1028
- if (!t.nodeKey)
1029
- throw new Error("[Tree] nodeKey is required in setCurrentNode");
1030
- Ee(d, e.emit, () => {
1031
- c(a), d.value.setUserCurrentNode(a, m);
1032
- });
1033
- }, w = (a, m = !0) => {
1034
- if (!t.nodeKey)
1035
- throw new Error("[Tree] nodeKey is required in setCurrentKey");
1036
- Ee(d, e.emit, () => {
1037
- c(), d.value.setCurrentNodeKey(a, m);
1038
- });
1039
- }, T = (a) => d.value.getNode(a), O = (a) => {
1040
- d.value.remove(a);
1041
- }, V = (a, m) => {
1042
- d.value.append(a, m);
1043
- }, ae = (a, m) => {
1044
- d.value.insertBefore(a, m);
1045
- }, f = (a, m) => {
1046
- d.value.insertAfter(a, m);
1047
- }, v = (a, m, K) => {
1048
- c(m), e.emit("node-expand", a, m, K);
1049
- }, b = (a, m) => {
1050
- if (!t.nodeKey)
1051
- throw new Error("[Tree] nodeKey is required in updateKeyChild");
1052
- d.value.updateChildren(a, m);
1053
- };
1054
- return he("RootTree", {
1055
- ctx: e,
1056
- props: t,
1057
- store: d,
1058
- root: r,
1059
- currentNode: i,
1060
- instance: Le()
1061
- }), he(Ye, void 0), {
1062
- ns: s,
1063
- store: d,
1064
- root: r,
1065
- currentNode: i,
1066
- dragState: l,
1067
- el$: p,
1068
- dropIndicator$: h,
1069
- isEmpty: u,
1070
- filter: g,
1071
- getNodeKey: N,
1072
- getNodePath: k,
1073
- getCheckedNodes: E,
1074
- getCheckedKeys: B,
1075
- getCurrentNode: z,
1076
- getCurrentKey: L,
1077
- setCheckedNodes: j,
1078
- setCheckedKeys: A,
1079
- setChecked: F,
1080
- getHalfCheckedNodes: ne,
1081
- getHalfCheckedKeys: R,
1082
- setCurrentNode: y,
1083
- setCurrentKey: w,
1084
- t: o,
1085
- getNode: T,
1086
- remove: O,
1087
- append: V,
1088
- insertBefore: ae,
1089
- insertAfter: f,
1090
- handleNodeExpand: v,
1091
- updateKeyChildren: b
1092
- };
1093
- }
1094
- });
1095
- function Dt(t, e, o, s, n, d) {
1096
- const r = ee("el-tree-node");
1097
- return D(), $("div", {
1098
- ref: "el$",
1099
- class: H([
1100
- t.ns.b(),
1101
- t.ns.is("dragging", !!t.dragState.draggingNode),
1102
- t.ns.is("drop-not-allow", !t.dragState.allowDrop),
1103
- t.ns.is("drop-inner", t.dragState.dropType === "inner"),
1104
- { [t.ns.m("highlight-current")]: t.highlightCurrent }
1105
- ]),
1106
- role: "tree"
1107
- }, [
1108
- (D(!0), $(ce, null, ue(t.root.childNodes, (i) => (D(), G(r, {
1109
- key: t.getNodeKey(i),
1110
- node: i,
1111
- props: t.props,
1112
- accordion: t.accordion,
1113
- "render-after-expand": t.renderAfterExpand,
1114
- "show-checkbox": t.showCheckbox,
1115
- "render-content": t.renderContent,
1116
- onNodeExpand: t.handleNodeExpand
1117
- }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]))), 128)),
1118
- t.isEmpty ? (D(), $("div", {
1119
- key: 0,
1120
- class: H(t.ns.e("empty-block"))
1121
- }, [
1122
- Ke(t.$slots, "empty", {}, () => {
1123
- var i;
1124
- return [
1125
- _("span", {
1126
- class: H(t.ns.e("empty-text"))
1127
- }, q((i = t.emptyText) != null ? i : t.t("el.tree.emptyText")), 3)
1128
- ];
1129
- })
1130
- ], 2)) : ie("v-if", !0),
1131
- W(_("div", {
1132
- ref: "dropIndicator$",
1133
- class: H(t.ns.e("drop-indicator"))
1134
- }, null, 2), [
1135
- [Y, t.dragState.showDropIndicator]
1136
- ])
1137
- ], 2);
1138
- }
1139
- var Tt = /* @__PURE__ */ ke(xt, [["render", Dt], ["__file", "tree.vue"]]);
1140
- const St = Be(Tt), It = {
1141
- key: 0,
1142
- class: "panel_content"
1143
- }, Bt = { class: "types" }, At = ["onClick"], Lt = { class: "tree" }, $t = {
1144
- key: 1,
1145
- class: "panel_content_null"
1146
- }, jt = { class: "pc_tree_type_button" }, Ot = ["onClick"], Pt = { class: "pc_tree_content" }, Mt = { class: "tree-search-box" }, Ht = { class: "tree-wrapper" }, zt = ["id"], Ft = { class: "tree-wrapper" }, qt = ["id"], Rt = { class: "tree-wrapper" }, Vt = ["id"], Ut = {
1147
- key: 2,
1148
- class: "operate-tree-box"
1149
- }, Wt = { class: "operate-tree" }, Yt = { class: "tree-title-box" }, Gt = { class: "tree-title-icon" }, Jt = { class: "tree-category-box" }, Qt = { class: "tree-category-list" }, Xt = ["onClick"], Zt = { class: "tree-search-box" }, en = { class: "tree-content" }, tn = { class: "tree-wrapper" }, nn = ["id"], on = { class: "tree-wrapper" }, sn = ["id"], dn = { class: "tree-wrapper" }, rn = ["id"], an = /* @__PURE__ */ re({
1150
- __name: "StructureTree",
1151
- props: ["componentId"],
1152
- emits: ["closePanel", "emitHandler"],
1153
- setup(t, { emit: e }) {
1154
- const o = Ge(), s = t, n = x(!1), d = x(), r = x(), i = x(), p = x(), h = x(0), c = x(), l = x(), u = x(), g = x(), N = x();
1155
- let k;
1156
- const E = x(""), B = x(""), z = x("");
1157
- M(
1158
- () => o.isToolActive(s.componentId),
1159
- (f) => {
1160
- if (f) {
1161
- if (n.value || w(pe[0]), B.value == z.value || B.value == "")
1162
- return;
1163
- y(B.value);
1164
- }
1165
- }
1166
- ), M(E, (f) => {
1167
- var v, b, a;
1168
- h.value === 0 ? (v = d.value) == null || v.filter(f) : h.value === 1 ? (b = r.value) == null || b.filter(f) : h.value === 2 && ((a = i.value) == null || a.filter(f));
1169
- });
1170
- const L = (f, v) => f ? v.title.includes(E.value) : !0, j = {
1171
- children: "children",
1172
- label: "title",
1173
- value: "nodeId"
1174
- }, A = e, F = (f) => {
1175
- A("emitHandler", f);
1176
- }, ne = x(!1);
1177
- $e(() => {
1178
- X("userInfo").isInShare && X("userInfo").isShareClient && (ne.value = !0), o.setReadyById(s.componentId);
1179
- });
1180
- const R = () => {
1181
- n.value = !1, k = window.bimViewer;
1182
- const { eventTrigger: f } = k;
1183
- f.on("treeAllReady", (v) => {
1184
- p.value = v, console.log("初始化结构树数据", p.value), k.SetShowSpaceModeActive(!1);
1185
- }), X("isMobile") || f.on("pickedEntity", (v) => {
1186
- n.value && (B.value = v.id, o.isToolActive(s.componentId) && y(v.id));
1187
- }), X("isMobile") && (f.on("touchEntity", (v) => {
1188
- n.value !== !1 && (B.value = v.id, o.isToolActive(s.componentId) && y(v.id));
1189
- }), f.on("touchNothing", () => {
1190
- ge(() => {
1191
- N.value = "";
1192
- }), F({
1193
- isTool: !0,
1194
- event_target: "StructureTree",
1195
- event_name: "touchNothing",
1196
- content: {
1197
- msg: "pickedNothing"
1198
- }
1199
- });
1200
- }));
1201
- };
1202
- me.on("BimViewer", R), ut(() => {
1203
- me.off("BimViewer", R);
1204
- });
1205
- const y = (f) => {
1206
- let v, b;
1207
- h.value === 0 ? v = k.objectsExplorer.objectList[f] ? k.objectsExplorer.objectList[f] : null : h.value === 1 ? v = k.classesExplorer.objectList[f] ? k.classesExplorer.objectList[f] : null : h.value === 2 && (v = k.storeysExplorer.objectList[f] ? k.storeysExplorer.objectList[f] : null), v && (N.value = v.nodeId, h.value === 0 ? (d.value.setCurrentKey(v.nodeId, !0), b = document.getElementById(v.nodeId + "0")) : h.value === 1 ? (r.value.setCurrentKey(v.nodeId, !0), b = document.getElementById(v.nodeId + "1")) : h.value === 2 && (i.value.setCurrentKey(v.nodeId, !0), b = document.getElementById(v.nodeId + "2")), setTimeout(() => {
1208
- b && ge(() => {
1209
- b.scrollIntoView({ block: "center" });
1210
- });
1211
- }, 200), z.value = f, F({
1212
- isTool: !0,
1213
- event_target: "StructureTree",
1214
- event_name: "pickedEntity",
1215
- content: {
1216
- entityId: f,
1217
- viewer_nodeId: v.nodeId
1218
- }
1219
- }));
1220
- }, w = (f) => {
1221
- if (f.id == 0) {
1222
- if (!l.value) {
1223
- if (l.value = p.value.objectsData ? p.value.objectsData : [], l.value[0]) {
1224
- l.value[0].title = "全部";
1225
- const v = l.value.map((b) => b.nodeId);
1226
- d.value.setCheckedKeys(v);
1227
- }
1228
- n.value = !0;
1229
- }
1230
- } else if (f.id == 1) {
1231
- if (!g.value && (u.value = p.value.classesData ? p.value.classesData : [], u.value[0])) {
1232
- u.value[0].title = "全部";
1233
- const v = u.value.map((b) => b.nodeId);
1234
- r.value.setCheckedKeys(v);
1235
- }
1236
- } else if (f.id == 2 && !g.value && (g.value = p.value.storeysData ? p.value.storeysData : [], g.value[0])) {
1237
- g.value[0].title = "全部";
1238
- const v = g.value.map((b) => b.nodeId);
1239
- i.value.setCheckedKeys(v);
1240
- }
1241
- F({
1242
- isTool: !0,
1243
- event_target: "StructureTree",
1244
- event_name: "changeTreeStructure",
1245
- content: {
1246
- item: f
1247
- }
1248
- }), h.value !== f.id && (h.value = f.id);
1249
- };
1250
- let T = [];
1251
- const O = (f, v) => {
1252
- T.includes(f.nodeId) ? f.checked = !0 : f.checked = !f.checked;
1253
- const b = k.viewer.scene.objects[f.objectId];
1254
- b ? k.setEntityVisible(b, f.checked) : a(f, f.checked), m(f, f.checked), F({
1255
- isTool: !0,
1256
- event_target: "StructureTree",
1257
- event_name: "clickTreeBox",
1258
- content: {
1259
- active_tree: h.value,
1260
- nodeId: f.nodeId,
1261
- status: f.checked
1262
- }
1263
- });
1264
- function a(K, P) {
1265
- if (K.checked = P, K.children.length == 0) {
1266
- const J = k.viewer.scene.objects[K.objectId];
1267
- J && k.setEntityVisible(J, K.checked);
1268
- } else
1269
- for (let J = 0; J < K.children.length; J++)
1270
- a(K.children[J], P);
1271
- }
1272
- function m(K, P) {
1273
- K.checked = P, K.parent && m(K.parent, P);
1274
- }
1275
- T = v.halfCheckedKeys;
1276
- }, V = (f, v) => {
1277
- const b = k.viewer.scene.objects[f.objectId];
1278
- b && (k.setAllObjectsSelected(!1), k.setEntitySelected(b), k.viewFitEntity(b)), me.emit("tree_clickNode", b), F({
1279
- isTool: !0,
1280
- event_target: "StructureTree",
1281
- event_name: "clickTreeNode",
1282
- content: {
1283
- active_tree: h.value,
1284
- objectId: f.objectId
1285
- }
1286
- });
1287
- }, ae = () => {
1288
- A("closePanel");
1289
- };
1290
- return (f, v) => {
1291
- const b = St, a = tt, m = Je, K = Qe, P = et, J = Xe;
1292
- return !U(X)("isMobile") && U(De).currentTheme == "blue" ? (D(), G(a, {
1293
- key: 0,
1294
- class: "web_tree_container",
1295
- width: 268,
1296
- panelTitle: "结构树",
1297
- "click-handle": ae
1298
- }, {
1299
- default: I(() => [
1300
- n.value ? (D(), $("div", It, [
1301
- _("div", Bt, [
1302
- (D(!0), $(ce, null, ue(U(pe), (C) => (D(), $("div", {
1303
- key: C.id,
1304
- class: H(["types-item", { "types-item-active": h.value === C.id }]),
1305
- onClick: (Ne) => w(C)
1306
- }, q(C.name), 11, At))), 128))
1307
- ]),
1308
- _("div", Lt, [
1309
- S(b, {
1310
- ref: "tree",
1311
- height: 700,
1312
- "node-key": "nodeId",
1313
- data: c.value,
1314
- "current-node-key": N.value,
1315
- "highlight-current": !0,
1316
- props: j,
1317
- "show-checkbox": "",
1318
- onCheck: O,
1319
- onNodeClick: V,
1320
- "empty-text": "暂无数据"
1321
- }, null, 8, ["data", "current-node-key"])
1322
- ])
1323
- ])) : (D(), $("div", $t, v[2] || (v[2] = [
1324
- _("span", null, "加载中...", -1)
1325
- ])))
1326
- ]),
1327
- _: 1
1328
- })) : !U(X)("isMobile") && U(De).currentTheme == "light-gray" ? (D(), G(P, {
1329
- key: 1,
1330
- class: "pc_structure_container",
1331
- width: 286,
1332
- panelTitle: "结构树",
1333
- "click-handle": ae,
1334
- pos: U(X)("treePos"),
1335
- setWidth: ""
1336
- }, {
1337
- default: I(() => [
1338
- _("div", jt, [
1339
- (D(!0), $(ce, null, ue(U(pe), (C) => (D(), $("div", {
1340
- key: C.id,
1341
- class: H(["type_button", { type_button_active: h.value === C.id }]),
1342
- onClick: (Ne) => w(C)
1343
- }, q(C.name), 11, Ot))), 128))
1344
- ]),
1345
- _("div", Pt, [
1346
- _("div", Mt, [
1347
- S(m, {
1348
- modelValue: E.value,
1349
- "onUpdate:modelValue": v[0] || (v[0] = (C) => E.value = C),
1350
- placeholder: "请输入需搜索的内容",
1351
- "prefix-icon": "Search",
1352
- clearable: ""
1353
- }, null, 8, ["modelValue"])
1354
- ]),
1355
- W(_("div", Ht, [
1356
- S(K, null, {
1357
- default: I(() => [
1358
- S(b, {
1359
- ref_key: "tree0",
1360
- ref: d,
1361
- "node-key": "nodeId",
1362
- data: l.value,
1363
- "current-node-key": N.value,
1364
- "highlight-current": !0,
1365
- props: j,
1366
- "filter-node-method": L,
1367
- "show-checkbox": "",
1368
- onCheck: O,
1369
- onNodeClick: V,
1370
- "empty-text": "暂无数据"
1371
- }, {
1372
- default: I(({ node: C }) => [
1373
- _("span", {
1374
- id: C.key + "0",
1375
- class: "tree_node_text"
1376
- }, q(C.data.title), 9, zt)
1377
- ]),
1378
- _: 1
1379
- }, 8, ["data", "current-node-key"])
1380
- ]),
1381
- _: 1
1382
- })
1383
- ], 512), [
1384
- [Y, h.value == 0]
1385
- ]),
1386
- W(_("div", Ft, [
1387
- S(K, null, {
1388
- default: I(() => [
1389
- S(b, {
1390
- ref_key: "tree1",
1391
- ref: r,
1392
- "node-key": "nodeId",
1393
- data: u.value,
1394
- "current-node-key": N.value,
1395
- "highlight-current": !0,
1396
- props: j,
1397
- "filter-node-method": L,
1398
- "show-checkbox": "",
1399
- onCheck: O,
1400
- onNodeClick: V,
1401
- "empty-text": "暂无数据"
1402
- }, {
1403
- default: I(({ node: C }) => [
1404
- _("span", {
1405
- id: C.key + "1",
1406
- class: "tree_node_text"
1407
- }, q(C.data.title), 9, qt)
1408
- ]),
1409
- _: 1
1410
- }, 8, ["data", "current-node-key"])
1411
- ]),
1412
- _: 1
1413
- })
1414
- ], 512), [
1415
- [Y, h.value == 1]
1416
- ]),
1417
- W(_("div", Rt, [
1418
- S(K, null, {
1419
- default: I(() => [
1420
- S(b, {
1421
- ref_key: "tree2",
1422
- ref: i,
1423
- "node-key": "nodeId",
1424
- data: g.value,
1425
- "current-node-key": N.value,
1426
- "highlight-current": !0,
1427
- props: j,
1428
- "filter-node-method": L,
1429
- "show-checkbox": "",
1430
- onCheck: O,
1431
- onNodeClick: V,
1432
- "empty-text": "暂无数据"
1433
- }, {
1434
- default: I(({ node: C }) => [
1435
- _("span", {
1436
- id: C.key + "2",
1437
- class: "tree_node_text"
1438
- }, q(C.data.title), 9, Vt)
1439
- ]),
1440
- _: 1
1441
- }, 8, ["data", "current-node-key"])
1442
- ]),
1443
- _: 1
1444
- })
1445
- ], 512), [
1446
- [Y, h.value == 2]
1447
- ])
1448
- ])
1449
- ]),
1450
- _: 1
1451
- }, 8, ["pos"])) : (D(), $("div", Ut, [
1452
- _("div", Wt, [
1453
- _("div", Yt, [
1454
- v[3] || (v[3] = _("div", { class: "tree-title" }, "结构树", -1)),
1455
- _("div", Gt, [
1456
- S(J, {
1457
- class: "close",
1458
- width: 0.4,
1459
- "size-type": "rem",
1460
- "click-handle": ae
1461
- })
1462
- ])
1463
- ]),
1464
- _("div", Jt, [
1465
- S(K, null, {
1466
- default: I(() => [
1467
- _("div", Qt, [
1468
- (D(!0), $(ce, null, ue(U(pe), (C, Ne) => (D(), $("div", {
1469
- key: Ne,
1470
- class: H(["tree-category-item", {
1471
- "tree-category-item-active": C.id === h.value
1472
- }]),
1473
- onClick: (ln) => w(C)
1474
- }, q(C.name), 11, Xt))), 128))
1475
- ])
1476
- ]),
1477
- _: 1
1478
- })
1479
- ]),
1480
- _("div", Zt, [
1481
- S(m, {
1482
- modelValue: E.value,
1483
- "onUpdate:modelValue": v[1] || (v[1] = (C) => E.value = C),
1484
- placeholder: "请输入需搜索的内容",
1485
- "prefix-icon": "Search",
1486
- clearable: ""
1487
- }, null, 8, ["modelValue"])
1488
- ]),
1489
- _("div", en, [
1490
- W(_("div", tn, [
1491
- S(K, null, {
1492
- default: I(() => [
1493
- S(b, {
1494
- ref_key: "tree0",
1495
- ref: d,
1496
- "node-key": "nodeId",
1497
- data: l.value,
1498
- "current-node-key": N.value,
1499
- "highlight-current": !0,
1500
- props: j,
1501
- "filter-node-method": L,
1502
- "show-checkbox": "",
1503
- onCheck: O,
1504
- onNodeClick: V,
1505
- "empty-text": "暂无数据"
1506
- }, {
1507
- default: I(({ node: C }) => [
1508
- _("span", {
1509
- id: C.key + "0",
1510
- class: "tree_node_text"
1511
- }, q(C.data.title), 9, nn)
1512
- ]),
1513
- _: 1
1514
- }, 8, ["data", "current-node-key"])
1515
- ]),
1516
- _: 1
1517
- })
1518
- ], 512), [
1519
- [Y, h.value == 0]
1520
- ]),
1521
- W(_("div", on, [
1522
- S(K, null, {
1523
- default: I(() => [
1524
- S(b, {
1525
- ref_key: "tree1",
1526
- ref: r,
1527
- "node-key": "nodeId",
1528
- data: u.value,
1529
- "current-node-key": N.value,
1530
- "highlight-current": !0,
1531
- props: j,
1532
- "filter-node-method": L,
1533
- "show-checkbox": "",
1534
- onCheck: O,
1535
- onNodeClick: V,
1536
- "empty-text": "暂无数据"
1537
- }, {
1538
- default: I(({ node: C }) => [
1539
- _("span", {
1540
- id: C.key + "1",
1541
- class: "tree_node_text"
1542
- }, q(C.data.title), 9, sn)
1543
- ]),
1544
- _: 1
1545
- }, 8, ["data", "current-node-key"])
1546
- ]),
1547
- _: 1
1548
- })
1549
- ], 512), [
1550
- [Y, h.value == 1]
1551
- ]),
1552
- W(_("div", dn, [
1553
- S(K, null, {
1554
- default: I(() => [
1555
- S(b, {
1556
- ref_key: "tree2",
1557
- ref: i,
1558
- "node-key": "nodeId",
1559
- data: g.value,
1560
- "current-node-key": N.value,
1561
- "highlight-current": !0,
1562
- props: j,
1563
- "filter-node-method": L,
1564
- "show-checkbox": "",
1565
- onCheck: O,
1566
- onNodeClick: V,
1567
- "empty-text": "暂无数据"
1568
- }, {
1569
- default: I(({ node: C }) => [
1570
- _("span", {
1571
- id: C.key + "2",
1572
- class: "tree_node_text"
1573
- }, q(C.data.title), 9, rn)
1574
- ]),
1575
- _: 1
1576
- }, 8, ["data", "current-node-key"])
1577
- ]),
1578
- _: 1
1579
- })
1580
- ], 512), [
1581
- [Y, h.value == 2]
1582
- ])
1583
- ])
1584
- ])
1585
- ]));
1586
- };
1587
- }
1588
- }), gn = /* @__PURE__ */ Ze(an, [["__scopeId", "data-v-4191e41c"]]);
1589
- export {
1590
- gn as default
1591
- };