@xtctwins/tctwins-industry-engine 0.0.9 → 0.0.11

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 (33) hide show
  1. package/README.md +3 -3
  2. package/dist/{AnnotationTool-Dzd5rcwa.mjs → AnnotationTool-BZlQ0NIM.mjs} +14 -14
  3. package/dist/{BCFTool-kLs0Y5n5.mjs → BCFTool-DAqDUYS-.mjs} +5269 -5269
  4. package/dist/{CommentTool-BFDzk_5a.mjs → CommentTool-BwHOJoFe.mjs} +28 -28
  5. package/dist/Industry_Viewer_Lib.es.js +3 -3
  6. package/dist/Industry_Viewer_Lib.umd.js +144 -152
  7. package/dist/{InspectorTool-BOeo7StN.mjs → InspectorTool-BK5pX2nZ.mjs} +31 -31
  8. package/dist/{MeasureTool-qO_ci86K.mjs → MeasureTool-D92Tyu14.mjs} +24 -24
  9. package/dist/{MouseTool-CLryyMPf.mjs → MouseTool-Dpl4JLyb.mjs} +20 -20
  10. package/dist/{NavigateTool-BkwZL4ng.mjs → NavigateTool-B5ySsqph.mjs} +6 -6
  11. package/dist/{RoamTool-DyL44JV3.mjs → RoamTool-Nk4hYPJB.mjs} +12 -12
  12. package/dist/ScreenShotTool-D1cS2DkF.mjs +445 -0
  13. package/dist/{SectionTool-BG8pmY3A.mjs → SectionTool-D3885F5s.mjs} +46 -46
  14. package/dist/SettingTool-BI_soRCO.mjs +770 -0
  15. package/dist/StructureTree-CCWwAbnr.mjs +1824 -0
  16. package/dist/{XRayTool-DQeoOCKy.mjs → XRayTool-IRgKMGU8.mjs} +13 -13
  17. package/dist/{alert-D1vSywdn.mjs → alert-x4uA_EPv.mjs} +5 -5
  18. package/dist/el-checkbox-_VjUMARt.mjs +544 -0
  19. package/dist/el-input-number-Chi40nla.mjs +1028 -0
  20. package/dist/{index-DROkX_fP.mjs → index-CaiiH-9N.mjs} +37845 -35391
  21. package/dist/{panel.vue_vue_type_style_index_0_lang-Ce406nTf.mjs → panel.vue_vue_type_style_index_0_lang-D3swRKXl.mjs} +6 -6
  22. package/dist/style.css +1 -1
  23. package/dist/{tallPanel-CMZIMI6R.mjs → tallPanel-eXWPdhmU.mjs} +14 -14
  24. package/package.json +66 -65
  25. package/types/components/BimViewerComponents/StructureTree.vue.d.ts +2652 -1668
  26. package/types/components/MobileBCFComponents/MobileBCFDisplayList.vue.d.ts +264 -36
  27. package/types/components/MobileBCFComponents/MobileBCFFilter.vue.d.ts +264 -36
  28. package/dist/ScreenShotTool-cho_m-3z.mjs +0 -357
  29. package/dist/SettingTool-BgBA9v6q.mjs +0 -691
  30. package/dist/StructureTree-BRY3gEgI.mjs +0 -1591
  31. package/dist/el-checkbox-BCef2DnV.mjs +0 -460
  32. package/dist/el-input-number-33CYHG2x.mjs +0 -858
  33. package/dist/index.html +0 -17
@@ -1,1591 +0,0 @@
1
- import { u as re, _ as Ne, w as Ae, h as _e, i as Me, a as pe, b as Ee, c as ge, d as Le, e as He, f as ze, r as me, g as Fe, E as qe, j as Re, k as Ve, l as Q, m as Ue, n as We, s as Ye, o as Ge, p as Je, q as ee, t as be, T as Te, v as Qe, x as Xe, y as Ze, z as et } from "./index-DROkX_fP.mjs";
2
- import { _ as tt } from "./tallPanel-CMZIMI6R.mjs";
3
- import { _ as nt } from "./panel.vue_vue_type_style_index_0_lang-Ce406nTf.mjs";
4
- import { E as ot } from "./el-checkbox-BCef2DnV.mjs";
5
- import { defineComponent as ae, openBlock as x, createBlock as W, Transition as st, mergeProps as dt, unref as R, toHandlers as rt, withCtx as B, renderSlot as xe, reactive as at, inject as de, h as Se, provide as fe, ref as E, getCurrentInstance as $e, watch as O, nextTick as ke, resolveComponent as ne, withDirectives as V, createElementBlock as A, normalizeClass as P, withModifiers as te, createElementVNode as _, normalizeStyle as it, resolveDynamicComponent as lt, createCommentVNode as le, createVNode as S, Fragment as ue, renderList as he, vShow as U, shallowRef as Ie, onMounted as je, onUpdated as ct, computed as ut, toDisplayString as z, onBeforeUnmount as ht } from "vue";
6
- import { S as ye } from "./const-DeViLYl5.mjs";
7
- import { Loading as ft, CaretRight as pt } from "@element-plus/icons-vue";
8
- const yt = ae({
9
- name: "ElCollapseTransition"
10
- }), vt = /* @__PURE__ */ ae({
11
- ...yt,
12
- setup(t) {
13
- const e = re("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) => (x(), W(st, dt({
44
- name: R(e).b()
45
- }, rt(s)), {
46
- default: B(() => [
47
- xe(n.$slots, "default")
48
- ]),
49
- _: 3
50
- }, 16, ["name"]));
51
- }
52
- });
53
- var gt = /* @__PURE__ */ Ne(vt, [["__file", "collapse-transition.vue"]]);
54
- const kt = Ae(gt), se = "$treeNodeId", Be = function(t, e) {
55
- !e || e[se] || Object.defineProperty(e, se, {
56
- value: t.id,
57
- enumerable: !1,
58
- configurable: !1,
59
- writable: !1
60
- });
61
- }, De = function(t, e) {
62
- return t ? e[t] : e[se];
63
- }, we = (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
- }, Ke = (t) => {
69
- let e = !0, o = !0, s = !0;
70
- for (let n = 0, d = t.length; n < d; n++) {
71
- const i = t[n];
72
- (i.checked !== !0 || i.indeterminate) && (e = !1, i.disabled || (s = !1)), (i.checked !== !1 || i.indeterminate) && (o = !1);
73
- }
74
- return { all: e, none: o, allWithoutDisable: s, half: !e && !o };
75
- }, ce = function(t) {
76
- if (t.childNodes.length === 0 || t.loading)
77
- return;
78
- const { all: e, none: o, half: s } = Ke(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 || ce(n);
82
- }, ve = function(t, e) {
83
- const o = t.store.props, s = t.data || {}, n = o[e];
84
- if (ge(n))
85
- return n(s, t);
86
- if (Le(n))
87
- return s[n];
88
- if (Ee(n)) {
89
- const d = s[e];
90
- return d === void 0 ? "" : d;
91
- }
92
- };
93
- let Nt = 0;
94
- class oe {
95
- constructor(e) {
96
- this.id = Nt++, 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
- _e(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 = ve(this, "isLeaf");
109
- Me(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(), pe(this.data) || Be(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
- pe(e) || Be(this, e), this.data = e, this.childNodes = [];
118
- let o;
119
- this.level === 0 && pe(this.data) ? o = this.data : o = ve(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 ve(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 ve(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 oe)) {
162
- if (!s) {
163
- const n = this.getChildren(!0);
164
- n.includes(e.data) || (Ee(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 = at(new oe(e)), e instanceof oe && e.initialize();
170
- }
171
- e.level = this.level + 1, Ee(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
- pe(n) && (this.checked ? this.setChecked(!0, !0) : this.store.checkStrictly || ce(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: i, allWithoutDisable: l } = Ke(this.childNodes);
241
- !this.isLeaf && !i && l && (this.checked = !1, e = !1);
242
- const y = () => {
243
- if (o) {
244
- const k = this.childNodes;
245
- for (let c = 0, v = k.length; c < v; c++) {
246
- const N = k[c];
247
- n = n || e !== !1;
248
- const b = N.disabled ? N.checked : n;
249
- N.setChecked(b, o, !0, n);
250
- }
251
- const { half: a, all: u } = Ke(k);
252
- u || (this.checked = u, this.indeterminate = a);
253
- }
254
- };
255
- if (this.shouldLoadData()) {
256
- this.loadData(() => {
257
- y(), ce(this);
258
- }, {
259
- checked: e !== !1
260
- });
261
- return;
262
- } else
263
- y();
264
- }
265
- const d = this.parent;
266
- !d || d.level === 0 || s || ce(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, i) => {
281
- const l = d[se];
282
- !!l && o.findIndex((k) => k[se] === l) >= 0 ? s[l] = { index: i, data: d } : n.push({ index: i, data: d });
283
- }), this.store.lazy || o.forEach((d) => {
284
- s[d[se]] || this.removeChildByData(d);
285
- }), n.forEach(({ index: d, data: i }) => {
286
- this.insertChild({ data: i }, 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 || ce(this);
310
- }
311
- }
312
- class Ct {
313
- constructor(e) {
314
- this.currentNode = null, this.currentNodeKey = null;
315
- for (const o in e)
316
- _e(e, o) && (this[o] = e[o]);
317
- this.nodesMap = {};
318
- }
319
- initialize() {
320
- if (this.root = new oe({
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 i = d.root ? d.root.childNodes : d.childNodes;
334
- if (i.forEach((l) => {
335
- l.visible = o.call(l, e, l.data, l), n(l);
336
- }), !d.visible && i.length) {
337
- let l = !0;
338
- l = !i.some((y) => y.visible), d.root ? d.root.visible = l === !1 : d.visible = l === !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 oe)
349
- return e;
350
- const o = He(e) ? De(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 = ze(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((l) => {
394
- (l.checked || o && l.indeterminate) && (!e || e && l.isLeaf) && s.push(l.data), n(l);
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
- _e(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 i = n[d];
426
- this.remove(i.data);
427
- }
428
- for (let d = 0, i = o.length; d < i; d++) {
429
- const l = o[d];
430
- this.append(l, s.data);
431
- }
432
- }
433
- _setCheckedKeys(e, o = !1, s) {
434
- const n = this._getAllNodes().sort((y, k) => y.level - k.level), d = /* @__PURE__ */ Object.create(null), i = Object.keys(s);
435
- n.forEach((y) => y.setChecked(!1, !1));
436
- const l = (y) => {
437
- y.childNodes.forEach((k) => {
438
- var a;
439
- d[k.data[e]] = !0, (a = k.childNodes) != null && a.length && l(k);
440
- });
441
- };
442
- for (let y = 0, k = n.length; y < k; y++) {
443
- const a = n[y], u = a.data[e].toString();
444
- if (!i.includes(u)) {
445
- a.checked && !d[u] && a.setChecked(!1, !1);
446
- continue;
447
- }
448
- if (a.childNodes.length && l(a), a.isLeaf || this.checkStrictly) {
449
- a.setChecked(!0, !1);
450
- continue;
451
- }
452
- if (a.setChecked(!0, !0), o) {
453
- a.setChecked(!1, !1);
454
- const v = function(N) {
455
- N.childNodes.forEach((g) => {
456
- g.isLeaf || g.setChecked(!1, !1), v(g);
457
- });
458
- };
459
- v(a);
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 mt = ae({
507
- name: "ElTreeNodeContent",
508
- props: {
509
- node: {
510
- type: Object,
511
- required: !0
512
- },
513
- renderContent: Function
514
- },
515
- setup(t) {
516
- const e = re("tree"), o = de("NodeInstance"), s = de("RootTree");
517
- return () => {
518
- const n = t.node, { data: d, store: i } = n;
519
- return t.renderContent ? t.renderContent(Se, { _self: o, node: n, data: d, store: i }) : xe(s.ctx.slots, "default", { node: n, data: d }, () => [
520
- Se("span", { class: e.be("node", "label") }, [n.label])
521
- ]);
522
- };
523
- }
524
- });
525
- var bt = /* @__PURE__ */ Ne(mt, [["__file", "tree-node-content.vue"]]);
526
- function Oe(t) {
527
- const e = de("TreeNodeMap", null), o = {
528
- treeNodeExpand: (s) => {
529
- t.node !== s && t.node.collapse();
530
- },
531
- children: []
532
- };
533
- return e && e.children.push(o), fe("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 Pe = Symbol("dragEvents");
542
- function _t({ props: t, ctx: e, el$: o, dropIndicator$: s, store: n }) {
543
- const d = re("tree"), i = E({
544
- showDropIndicator: !1,
545
- draggingNode: null,
546
- dropNode: null,
547
- allowDrop: !0,
548
- dropType: null
549
- });
550
- return fe(Pe, {
551
- treeNodeDragStart: ({ event: a, treeNode: u }) => {
552
- if (ge(t.allowDrag) && !t.allowDrag(u.node))
553
- return a.preventDefault(), !1;
554
- a.dataTransfer.effectAllowed = "move";
555
- try {
556
- a.dataTransfer.setData("text/plain", "");
557
- } catch {
558
- }
559
- i.value.draggingNode = u, e.emit("node-drag-start", u.node, a);
560
- },
561
- treeNodeDragOver: ({ event: a, treeNode: u }) => {
562
- const c = u, v = i.value.dropNode;
563
- v && v.node.id !== c.node.id && me(v.$el, d.is("drop-inner"));
564
- const N = i.value.draggingNode;
565
- if (!N || !c)
566
- return;
567
- let b = !0, g = !0, I = !0, L = !0;
568
- ge(t.allowDrop) && (b = t.allowDrop(N.node, c.node, "prev"), L = g = t.allowDrop(N.node, c.node, "inner"), I = t.allowDrop(N.node, c.node, "next")), a.dataTransfer.dropEffect = g || b || I ? "move" : "none", (b || g || I) && (v == null ? void 0 : v.node.id) !== c.node.id && (v && e.emit("node-drag-leave", N.node, v.node, a), e.emit("node-drag-enter", N.node, c.node, a)), b || g || I ? i.value.dropNode = c : i.value.dropNode = null, c.node.nextSibling === N.node && (I = !1), c.node.previousSibling === N.node && (b = !1), c.node.contains(N.node, !1) && (g = !1), (N.node === c.node || N.node.contains(c.node)) && (b = !1, g = !1, I = !1);
569
- const M = c.$el.querySelector(`.${d.be("node", "content")}`).getBoundingClientRect(), j = o.value.getBoundingClientRect();
570
- let T;
571
- const X = b ? g ? 0.25 : I ? 0.45 : 1 : -1, H = I ? g ? 0.75 : b ? 0.55 : 0 : 1;
572
- let Y = -9999;
573
- const p = a.clientY - M.top;
574
- p < M.height * X ? T = "before" : p > M.height * H ? T = "after" : g ? T = "inner" : T = "none";
575
- const w = c.$el.querySelector(`.${d.be("node", "expand-icon")}`).getBoundingClientRect(), D = s.value;
576
- T === "before" ? Y = w.top - j.top : T === "after" && (Y = w.bottom - j.top), D.style.top = `${Y}px`, D.style.left = `${w.right - j.left}px`, T === "inner" ? Fe(c.$el, d.is("drop-inner")) : me(c.$el, d.is("drop-inner")), i.value.showDropIndicator = T === "before" || T === "after", i.value.allowDrop = i.value.showDropIndicator || L, i.value.dropType = T, e.emit("node-drag-over", N.node, c.node, a);
577
- },
578
- treeNodeDragEnd: (a) => {
579
- const { draggingNode: u, dropType: c, dropNode: v } = i.value;
580
- if (a.preventDefault(), a.dataTransfer && (a.dataTransfer.dropEffect = "move"), u && v) {
581
- const N = { data: u.node.data };
582
- c !== "none" && u.node.remove(), c === "before" ? v.node.parent.insertBefore(N, v.node) : c === "after" ? v.node.parent.insertAfter(N, v.node) : c === "inner" && v.node.insertChild(N), c !== "none" && (n.value.registerNode(N), n.value.key && u.node.eachNode((b) => {
583
- var g;
584
- (g = n.value.nodesMap[b.data[n.value.key]]) == null || g.setChecked(b.checked, !n.value.checkStrictly);
585
- })), me(v.$el, d.is("drop-inner")), e.emit("node-drag-end", u.node, v.node, c, a), c !== "none" && e.emit("node-drop", u.node, v.node, c, a);
586
- }
587
- u && !v && e.emit("node-drag-end", u.node, null, c, a), i.value.showDropIndicator = !1, i.value.draggingNode = null, i.value.dropNode = null, i.value.allowDrop = !0;
588
- }
589
- }), {
590
- dragState: i
591
- };
592
- }
593
- const Et = ae({
594
- name: "ElTreeNode",
595
- components: {
596
- ElCollapseTransition: kt,
597
- ElCheckbox: ot,
598
- NodeContent: bt,
599
- ElIcon: qe,
600
- Loading: ft
601
- },
602
- props: {
603
- node: {
604
- type: oe,
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 = re("tree"), { broadcastExpanded: s } = Oe(t), n = de("RootTree"), d = E(!1), i = E(!1), l = E(null), y = E(null), k = E(null), a = de(Pe), u = $e();
622
- fe("NodeInstance", u), n || Re("Tree", "Can not find node's tree."), t.node.expanded && (d.value = !0, i.value = !0);
623
- const c = n.props.props.children || "children";
624
- O(() => {
625
- const p = t.node.data[c];
626
- return p && [...p];
627
- }, () => {
628
- t.node.updateChildren();
629
- }), O(() => t.node.indeterminate, (p) => {
630
- b(t.node.checked, p);
631
- }), O(() => t.node.checked, (p) => {
632
- b(p, t.node.indeterminate);
633
- }), O(() => t.node.childNodes.length, () => t.node.reInitChecked()), O(() => t.node.expanded, (p) => {
634
- ke(() => d.value = p), p && (i.value = !0);
635
- });
636
- const v = (p) => De(n.props.nodeKey, p.data), N = (p) => {
637
- const w = t.props.class;
638
- if (!w)
639
- return {};
640
- let D;
641
- if (ge(w)) {
642
- const { data: G } = p;
643
- D = w(G, p);
644
- } else
645
- D = w;
646
- return Le(D) ? { [D]: !0 } : D;
647
- }, b = (p, w) => {
648
- (l.value !== p || y.value !== w) && n.ctx.emit("check-change", t.node.data, p, w), l.value = p, y.value = w;
649
- }, g = (p) => {
650
- we(n.store, n.ctx.emit, () => {
651
- var w;
652
- if ((w = n == null ? void 0 : n.props) == null ? void 0 : w.nodeKey) {
653
- const G = v(t.node);
654
- n.store.value.setCurrentNodeKey(G);
655
- } else
656
- n.store.value.setCurrentNode(t.node);
657
- }), n.currentNode.value = t.node, n.props.expandOnClickNode && L(), n.props.checkOnClickNode && !t.node.disabled && M(null, {
658
- target: { checked: !t.node.checked }
659
- }), n.ctx.emit("node-click", t.node.data, t.node, u, p);
660
- }, I = (p) => {
661
- n.instance.vnode.props.onNodeContextmenu && (p.stopPropagation(), p.preventDefault()), n.ctx.emit("node-contextmenu", p, t.node.data, t.node, u);
662
- }, L = () => {
663
- t.node.isLeaf || (d.value ? (n.ctx.emit("node-collapse", t.node.data, t.node, u), t.node.collapse()) : t.node.expand(() => {
664
- e.emit("node-expand", t.node.data, t.node, u);
665
- }));
666
- }, M = (p, w) => {
667
- t.node.setChecked(w.target.checked, !n.props.checkStrictly), ke(() => {
668
- const D = n.store.value;
669
- n.ctx.emit("check", t.node.data, {
670
- checkedNodes: D.getCheckedNodes(),
671
- checkedKeys: D.getCheckedKeys(),
672
- halfCheckedNodes: D.getHalfCheckedNodes(),
673
- halfCheckedKeys: D.getHalfCheckedKeys()
674
- });
675
- });
676
- };
677
- return {
678
- ns: o,
679
- node$: k,
680
- tree: n,
681
- expanded: d,
682
- childNodeRendered: i,
683
- oldChecked: l,
684
- oldIndeterminate: y,
685
- getNodeKey: v,
686
- getNodeClass: N,
687
- handleSelectChange: b,
688
- handleClick: g,
689
- handleContextMenu: I,
690
- handleExpandIconClick: L,
691
- handleCheckChange: M,
692
- handleChildNodeExpand: (p, w, D) => {
693
- s(w), n.ctx.emit("node-expand", p, w, D);
694
- },
695
- handleDragStart: (p) => {
696
- n.props.draggable && a.treeNodeDragStart({ event: p, treeNode: t });
697
- },
698
- handleDragOver: (p) => {
699
- p.preventDefault(), n.props.draggable && a.treeNodeDragOver({
700
- event: p,
701
- treeNode: { $el: k.value, node: t.node }
702
- });
703
- },
704
- handleDrop: (p) => {
705
- p.preventDefault();
706
- },
707
- handleDragEnd: (p) => {
708
- n.props.draggable && a.treeNodeDragEnd(p);
709
- },
710
- CaretRight: pt
711
- };
712
- }
713
- });
714
- function wt(t, e, o, s, n, d) {
715
- const i = ne("el-icon"), l = ne("el-checkbox"), y = ne("loading"), k = ne("node-content"), a = ne("el-tree-node"), u = ne("el-collapse-transition");
716
- return V((x(), A("div", {
717
- ref: "node$",
718
- class: P([
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: te(t.handleClick, ["stop"]),
735
- onContextmenu: t.handleContextMenu,
736
- onDragstart: te(t.handleDragStart, ["stop"]),
737
- onDragover: te(t.handleDragOver, ["stop"]),
738
- onDragend: te(t.handleDragEnd, ["stop"]),
739
- onDrop: te(t.handleDrop, ["stop"])
740
- }, [
741
- _("div", {
742
- class: P(t.ns.be("node", "content")),
743
- style: it({ paddingLeft: (t.node.level - 1) * t.tree.props.indent + "px" })
744
- }, [
745
- t.tree.props.icon || t.CaretRight ? (x(), W(i, {
746
- key: 0,
747
- class: P([
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: te(t.handleExpandIconClick, ["stop"])
755
- }, {
756
- default: B(() => [
757
- (x(), W(lt(t.tree.props.icon || t.CaretRight)))
758
- ]),
759
- _: 1
760
- }, 8, ["class", "onClick"])) : le("v-if", !0),
761
- t.showCheckbox ? (x(), W(l, {
762
- key: 1,
763
- "model-value": t.node.checked,
764
- indeterminate: t.node.indeterminate,
765
- disabled: !!t.node.disabled,
766
- onClick: te(() => {
767
- }, ["stop"]),
768
- onChange: t.handleCheckChange
769
- }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onChange"])) : le("v-if", !0),
770
- t.node.loading ? (x(), W(i, {
771
- key: 2,
772
- class: P([t.ns.be("node", "loading-icon"), t.ns.is("loading")])
773
- }, {
774
- default: B(() => [
775
- S(y)
776
- ]),
777
- _: 1
778
- }, 8, ["class"])) : le("v-if", !0),
779
- S(k, {
780
- node: t.node,
781
- "render-content": t.renderContent
782
- }, null, 8, ["node", "render-content"])
783
- ], 6),
784
- S(u, null, {
785
- default: B(() => [
786
- !t.renderAfterExpand || t.childNodeRendered ? V((x(), A("div", {
787
- key: 0,
788
- class: P(t.ns.be("node", "children")),
789
- role: "group",
790
- "aria-expanded": t.expanded
791
- }, [
792
- (x(!0), A(ue, null, he(t.node.childNodes, (c) => (x(), W(a, {
793
- key: t.getNodeKey(c),
794
- "render-content": t.renderContent,
795
- "render-after-expand": t.renderAfterExpand,
796
- "show-checkbox": t.showCheckbox,
797
- node: c,
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
- [U, t.expanded]
804
- ]) : le("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
- [U, t.node.visible]
810
- ]);
811
- }
812
- var Kt = /* @__PURE__ */ Ne(Et, [["render", wt], ["__file", "tree-node.vue"]]);
813
- function xt({ el$: t }, e) {
814
- const o = re("tree"), s = Ie([]), n = Ie([]);
815
- je(() => {
816
- i();
817
- }), ct(() => {
818
- s.value = Array.from(t.value.querySelectorAll("[role=treeitem]")), n.value = Array.from(t.value.querySelectorAll("input[type=checkbox]"));
819
- }), O(n, (l) => {
820
- l.forEach((y) => {
821
- y.setAttribute("tabindex", "-1");
822
- });
823
- }), Ve(t, "keydown", (l) => {
824
- const y = l.target;
825
- if (!y.className.includes(o.b("node")))
826
- return;
827
- const k = l.code;
828
- s.value = Array.from(t.value.querySelectorAll(`.${o.is("focusable")}[role=treeitem]`));
829
- const a = s.value.indexOf(y);
830
- let u;
831
- if ([Q.up, Q.down].includes(k)) {
832
- if (l.preventDefault(), k === Q.up) {
833
- u = a === -1 ? 0 : a !== 0 ? a - 1 : s.value.length - 1;
834
- const v = u;
835
- for (; !e.value.getNode(s.value[u].dataset.key).canFocus; ) {
836
- if (u--, u === v) {
837
- u = -1;
838
- break;
839
- }
840
- u < 0 && (u = s.value.length - 1);
841
- }
842
- } else {
843
- u = a === -1 ? 0 : a < s.value.length - 1 ? a + 1 : 0;
844
- const v = u;
845
- for (; !e.value.getNode(s.value[u].dataset.key).canFocus; ) {
846
- if (u++, u === v) {
847
- u = -1;
848
- break;
849
- }
850
- u >= s.value.length && (u = 0);
851
- }
852
- }
853
- u !== -1 && s.value[u].focus();
854
- }
855
- [Q.left, Q.right].includes(k) && (l.preventDefault(), y.click());
856
- const c = y.querySelector('[type="checkbox"]');
857
- [Q.enter, Q.numpadEnter, Q.space].includes(k) && c && (l.preventDefault(), c.click());
858
- });
859
- const i = () => {
860
- var l;
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 y = t.value.querySelectorAll(`.${o.is("checked")}[role=treeitem]`);
863
- if (y.length) {
864
- y[0].setAttribute("tabindex", "0");
865
- return;
866
- }
867
- (l = s.value[0]) == null || l.setAttribute("tabindex", "0");
868
- };
869
- }
870
- const Dt = ae({
871
- name: "ElTree",
872
- components: { ElTreeNode: Kt },
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: Ue
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 } = We(), s = re("tree"), n = de(Ye, null), d = E(new Ct({
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 i = E(d.value.root), l = E(null), y = E(null), k = E(null), { broadcastExpanded: a } = Oe(t), { dragState: u } = _t({
972
- props: t,
973
- ctx: e,
974
- el$: y,
975
- dropIndicator$: k,
976
- store: d
977
- });
978
- xt({ el$: y }, d);
979
- const c = ut(() => {
980
- const { childNodes: r } = i.value, C = n ? n.hasFilteredOptions !== 0 : !1;
981
- return (!r || r.length === 0 || r.every(({ visible: $ }) => !$)) && !C;
982
- });
983
- O(() => t.currentNodeKey, (r) => {
984
- d.value.setCurrentNodeKey(r);
985
- }), O(() => t.defaultCheckedKeys, (r) => {
986
- d.value.setDefaultCheckedKey(r);
987
- }), O(() => t.defaultExpandedKeys, (r) => {
988
- d.value.setDefaultExpandedKeys(r);
989
- }), O(() => t.data, (r) => {
990
- d.value.setData(r);
991
- }, { deep: !0 }), O(() => t.checkStrictly, (r) => {
992
- d.value.checkStrictly = r;
993
- });
994
- const v = (r) => {
995
- if (!t.filterNodeMethod)
996
- throw new Error("[Tree] filterNodeMethod is required when filter");
997
- d.value.filter(r);
998
- }, N = (r) => De(t.nodeKey, r.data), b = (r) => {
999
- if (!t.nodeKey)
1000
- throw new Error("[Tree] nodeKey is required in getNodePath");
1001
- const C = d.value.getNode(r);
1002
- if (!C)
1003
- return [];
1004
- const $ = [C.data];
1005
- let K = C.parent;
1006
- for (; K && K !== i.value; )
1007
- $.push(K.data), K = K.parent;
1008
- return $.reverse();
1009
- }, g = (r, C) => d.value.getCheckedNodes(r, C), I = (r) => d.value.getCheckedKeys(r), L = () => {
1010
- const r = d.value.getCurrentNode();
1011
- return r ? r.data : null;
1012
- }, M = () => {
1013
- if (!t.nodeKey)
1014
- throw new Error("[Tree] nodeKey is required in getCurrentKey");
1015
- const r = L();
1016
- return r ? r[t.nodeKey] : null;
1017
- }, j = (r, C) => {
1018
- if (!t.nodeKey)
1019
- throw new Error("[Tree] nodeKey is required in setCheckedNodes");
1020
- d.value.setCheckedNodes(r, C);
1021
- }, T = (r, C) => {
1022
- if (!t.nodeKey)
1023
- throw new Error("[Tree] nodeKey is required in setCheckedKeys");
1024
- d.value.setCheckedKeys(r, C);
1025
- }, X = (r, C, $) => {
1026
- d.value.setChecked(r, C, $);
1027
- }, H = () => d.value.getHalfCheckedNodes(), Y = () => d.value.getHalfCheckedKeys(), p = (r, C = !0) => {
1028
- if (!t.nodeKey)
1029
- throw new Error("[Tree] nodeKey is required in setCurrentNode");
1030
- we(d, e.emit, () => {
1031
- a(r), d.value.setUserCurrentNode(r, C);
1032
- });
1033
- }, w = (r, C = !0) => {
1034
- if (!t.nodeKey)
1035
- throw new Error("[Tree] nodeKey is required in setCurrentKey");
1036
- we(d, e.emit, () => {
1037
- a(), d.value.setCurrentNodeKey(r, C);
1038
- });
1039
- }, D = (r) => d.value.getNode(r), G = (r) => {
1040
- d.value.remove(r);
1041
- }, F = (r, C) => {
1042
- d.value.append(r, C);
1043
- }, q = (r, C) => {
1044
- d.value.insertBefore(r, C);
1045
- }, ie = (r, C) => {
1046
- d.value.insertAfter(r, C);
1047
- }, h = (r, C, $) => {
1048
- a(C), e.emit("node-expand", r, C, $);
1049
- }, f = (r, C) => {
1050
- if (!t.nodeKey)
1051
- throw new Error("[Tree] nodeKey is required in updateKeyChild");
1052
- d.value.updateChildren(r, C);
1053
- };
1054
- return fe("RootTree", {
1055
- ctx: e,
1056
- props: t,
1057
- store: d,
1058
- root: i,
1059
- currentNode: l,
1060
- instance: $e()
1061
- }), fe(Ge, void 0), {
1062
- ns: s,
1063
- store: d,
1064
- root: i,
1065
- currentNode: l,
1066
- dragState: u,
1067
- el$: y,
1068
- dropIndicator$: k,
1069
- isEmpty: c,
1070
- filter: v,
1071
- getNodeKey: N,
1072
- getNodePath: b,
1073
- getCheckedNodes: g,
1074
- getCheckedKeys: I,
1075
- getCurrentNode: L,
1076
- getCurrentKey: M,
1077
- setCheckedNodes: j,
1078
- setCheckedKeys: T,
1079
- setChecked: X,
1080
- getHalfCheckedNodes: H,
1081
- getHalfCheckedKeys: Y,
1082
- setCurrentNode: p,
1083
- setCurrentKey: w,
1084
- t: o,
1085
- getNode: D,
1086
- remove: G,
1087
- append: F,
1088
- insertBefore: q,
1089
- insertAfter: ie,
1090
- handleNodeExpand: h,
1091
- updateKeyChildren: f
1092
- };
1093
- }
1094
- });
1095
- function Tt(t, e, o, s, n, d) {
1096
- const i = ne("el-tree-node");
1097
- return x(), A("div", {
1098
- ref: "el$",
1099
- class: P([
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
- (x(!0), A(ue, null, he(t.root.childNodes, (l) => (x(), W(i, {
1109
- key: t.getNodeKey(l),
1110
- node: l,
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 ? (x(), A("div", {
1119
- key: 0,
1120
- class: P(t.ns.e("empty-block"))
1121
- }, [
1122
- xe(t.$slots, "empty", {}, () => {
1123
- var l;
1124
- return [
1125
- _("span", {
1126
- class: P(t.ns.e("empty-text"))
1127
- }, z((l = t.emptyText) != null ? l : t.t("el.tree.emptyText")), 3)
1128
- ];
1129
- })
1130
- ], 2)) : le("v-if", !0),
1131
- V(_("div", {
1132
- ref: "dropIndicator$",
1133
- class: P(t.ns.e("drop-indicator"))
1134
- }, null, 2), [
1135
- [U, t.dragState.showDropIndicator]
1136
- ])
1137
- ], 2);
1138
- }
1139
- var St = /* @__PURE__ */ Ne(Dt, [["render", Tt], ["__file", "tree.vue"]]);
1140
- const It = Ae(St), Bt = {
1141
- key: 0,
1142
- class: "panel_content"
1143
- }, At = { class: "types" }, Lt = ["onClick"], $t = { class: "tree" }, jt = {
1144
- key: 1,
1145
- class: "panel_content_null"
1146
- }, Ot = { class: "pc_tree_type_button" }, Pt = ["onClick"], Mt = { class: "pc_tree_content" }, Ht = { class: "tree-search-box" }, zt = { class: "tree-wrapper" }, Ft = ["id"], qt = { class: "tree-wrapper" }, Rt = ["id"], Vt = { class: "tree-wrapper" }, Ut = ["id"], Wt = {
1147
- key: 2,
1148
- class: "operate-tree-box"
1149
- }, Yt = { class: "operate-tree" }, Gt = { class: "tree-title-box" }, Jt = { class: "tree-title-icon" }, Qt = { class: "tree-category-box" }, Xt = { class: "tree-category-list" }, Zt = ["onClick"], en = { class: "tree-search-box" }, tn = { class: "tree-content" }, nn = { class: "tree-wrapper" }, on = ["id"], sn = { class: "tree-wrapper" }, dn = ["id"], rn = { class: "tree-wrapper" }, an = ["id"], ln = /* @__PURE__ */ ae({
1150
- __name: "StructureTree",
1151
- props: ["componentId"],
1152
- emits: ["closePanel", "emitHandler"],
1153
- setup(t, { emit: e }) {
1154
- const o = Je(), s = t, n = E(!1), d = E(!1), i = E(), l = E(), y = E(), k = E(), a = E(0), u = E(), c = E(), v = E(), N = E(), b = E();
1155
- let g;
1156
- const I = E(""), L = E(""), M = E("");
1157
- O(
1158
- () => o.isToolActive(s.componentId),
1159
- (h) => {
1160
- if (n.value && h) {
1161
- if (d.value || D(ye[0]), L.value == M.value || L.value == "")
1162
- return;
1163
- w(L.value);
1164
- }
1165
- }
1166
- ), O(I, (h) => {
1167
- var f, r, C;
1168
- a.value === 0 ? (f = i.value) == null || f.filter(h) : a.value === 1 ? (r = l.value) == null || r.filter(h) : a.value === 2 && ((C = y.value) == null || C.filter(h));
1169
- });
1170
- const j = (h, f) => h ? f.title.includes(I.value) : !0, T = {
1171
- children: "children",
1172
- label: "title",
1173
- value: "nodeId"
1174
- }, X = e, H = (h) => {
1175
- X("emitHandler", h);
1176
- }, Y = E(!1);
1177
- je(() => {
1178
- ee("userInfo").isInShare && ee("userInfo").isShareClient && (Y.value = !0), o.setReadyById(s.componentId);
1179
- });
1180
- const p = () => {
1181
- d.value = !1, g = window.bimViewer;
1182
- const { eventTrigger: h } = g;
1183
- h.on("treeAllReady", (f) => {
1184
- n.value = !0, k.value = f, console.log("初始化结构树数据", k.value), g.SetShowSpaceModeActive(!1);
1185
- }), ee("isMobile") || h.on("pickedEntity", (f) => {
1186
- d.value && (L.value = f.id, o.isToolActive(s.componentId) && w(f.id));
1187
- }), ee("isMobile") && (h.on("touchEntity", (f) => {
1188
- d.value !== !1 && (L.value = f.id, o.isToolActive(s.componentId) && w(f.id));
1189
- }), h.on("touchNothing", () => {
1190
- ke(() => {
1191
- b.value = "";
1192
- }), H({
1193
- isTool: !0,
1194
- event_target: "StructureTree",
1195
- event_name: "touchNothing",
1196
- content: {
1197
- msg: "pickedNothing"
1198
- }
1199
- });
1200
- }));
1201
- };
1202
- be.on("BimViewer", p), ht(() => {
1203
- be.off("BimViewer", p);
1204
- });
1205
- const w = (h) => {
1206
- let f, r;
1207
- a.value === 0 ? f = g.objectsExplorer.objectList[h] ? g.objectsExplorer.objectList[h] : null : a.value === 1 ? f = g.classesExplorer.objectList[h] ? g.classesExplorer.objectList[h] : null : a.value === 2 && (f = g.storeysExplorer.objectList[h] ? g.storeysExplorer.objectList[h] : null), f && (b.value = f.nodeId, a.value === 0 ? (i.value.setCurrentKey(f.nodeId, !0), r = document.getElementById(f.nodeId + "0")) : a.value === 1 ? (l.value.setCurrentKey(f.nodeId, !0), r = document.getElementById(f.nodeId + "1")) : a.value === 2 && (y.value.setCurrentKey(f.nodeId, !0), r = document.getElementById(f.nodeId + "2")), setTimeout(() => {
1208
- r && ke(() => {
1209
- r.scrollIntoView({ block: "center" });
1210
- });
1211
- }, 200), M.value = h, H({
1212
- isTool: !0,
1213
- event_target: "StructureTree",
1214
- event_name: "pickedEntity",
1215
- content: {
1216
- entityId: h,
1217
- viewer_nodeId: f.nodeId
1218
- }
1219
- }));
1220
- }, D = (h) => {
1221
- if (h.id == 0) {
1222
- if (!c.value) {
1223
- if (c.value = k.value.objectsData ? k.value.objectsData : [], c.value[0]) {
1224
- c.value[0].title = "全部";
1225
- const f = c.value.map((r) => r.nodeId);
1226
- i.value.setCheckedKeys(f);
1227
- }
1228
- d.value = !0;
1229
- }
1230
- } else if (h.id == 1) {
1231
- if (!N.value && (v.value = k.value.classesData ? k.value.classesData : [], v.value[0])) {
1232
- v.value[0].title = "全部";
1233
- const f = v.value.map((r) => r.nodeId);
1234
- l.value.setCheckedKeys(f);
1235
- }
1236
- } else if (h.id == 2 && !N.value && (N.value = k.value.storeysData ? k.value.storeysData : [], N.value[0])) {
1237
- N.value[0].title = "全部";
1238
- const f = N.value.map((r) => r.nodeId);
1239
- y.value.setCheckedKeys(f);
1240
- }
1241
- H({
1242
- isTool: !0,
1243
- event_target: "StructureTree",
1244
- event_name: "changeTreeStructure",
1245
- content: {
1246
- item: h
1247
- }
1248
- }), a.value !== h.id && (a.value = h.id);
1249
- };
1250
- let G = [];
1251
- const F = (h, f) => {
1252
- G.includes(h.nodeId) ? h.checked = !0 : h.checked = !h.checked;
1253
- const r = g.viewer.scene.objects[h.objectId];
1254
- r ? g.setEntityVisible(r, h.checked) : C(h, h.checked), $(h, h.checked), H({
1255
- isTool: !0,
1256
- event_target: "StructureTree",
1257
- event_name: "clickTreeBox",
1258
- content: {
1259
- active_tree: a.value,
1260
- nodeId: h.nodeId,
1261
- status: h.checked
1262
- }
1263
- });
1264
- function C(K, Z) {
1265
- if (K.checked = Z, K.children.length == 0) {
1266
- const J = g.viewer.scene.objects[K.objectId];
1267
- J && g.setEntityVisible(J, K.checked);
1268
- } else
1269
- for (let J = 0; J < K.children.length; J++)
1270
- C(K.children[J], Z);
1271
- }
1272
- function $(K, Z) {
1273
- K.checked = Z, K.parent && $(K.parent, Z);
1274
- }
1275
- G = f.halfCheckedKeys;
1276
- }, q = (h, f) => {
1277
- const r = g.viewer.scene.objects[h.objectId];
1278
- r && (g.setAllObjectsSelected(!1), g.setEntitySelected(r), g.viewFitEntity(r)), be.emit("tree_clickNode", r), H({
1279
- isTool: !0,
1280
- event_target: "StructureTree",
1281
- event_name: "clickTreeNode",
1282
- content: {
1283
- active_tree: a.value,
1284
- objectId: h.objectId
1285
- }
1286
- });
1287
- }, ie = () => {
1288
- X("closePanel");
1289
- };
1290
- return (h, f) => {
1291
- const r = It, C = nt, $ = Qe, K = Xe, Z = tt, J = Ze;
1292
- return !R(ee)("isMobile") && R(Te).currentTheme == "blue" ? (x(), W(C, {
1293
- key: 0,
1294
- class: "web_tree_container",
1295
- width: 268,
1296
- panelTitle: "结构树",
1297
- "click-handle": ie
1298
- }, {
1299
- default: B(() => [
1300
- d.value ? (x(), A("div", Bt, [
1301
- _("div", At, [
1302
- (x(!0), A(ue, null, he(R(ye), (m) => (x(), A("div", {
1303
- key: m.id,
1304
- class: P(["types-item", { "types-item-active": a.value === m.id }]),
1305
- onClick: (Ce) => D(m)
1306
- }, z(m.name), 11, Lt))), 128))
1307
- ]),
1308
- _("div", $t, [
1309
- S(r, {
1310
- ref: "tree",
1311
- height: 700,
1312
- "node-key": "nodeId",
1313
- data: u.value,
1314
- "current-node-key": b.value,
1315
- "highlight-current": !0,
1316
- props: T,
1317
- "show-checkbox": "",
1318
- onCheck: F,
1319
- onNodeClick: q,
1320
- "empty-text": "暂无数据"
1321
- }, null, 8, ["data", "current-node-key"])
1322
- ])
1323
- ])) : (x(), A("div", jt, f[2] || (f[2] = [
1324
- _("span", null, "加载中...", -1)
1325
- ])))
1326
- ]),
1327
- _: 1
1328
- })) : !R(ee)("isMobile") && R(Te).currentTheme == "light-gray" ? (x(), W(Z, {
1329
- key: 1,
1330
- class: "pc_structure_container",
1331
- width: 286,
1332
- panelTitle: "结构树",
1333
- "click-handle": ie,
1334
- pos: R(ee)("treePos"),
1335
- setWidth: ""
1336
- }, {
1337
- default: B(() => [
1338
- _("div", Ot, [
1339
- (x(!0), A(ue, null, he(R(ye), (m) => (x(), A("div", {
1340
- key: m.id,
1341
- class: P(["type_button", { type_button_active: a.value === m.id }]),
1342
- onClick: (Ce) => D(m)
1343
- }, z(m.name), 11, Pt))), 128))
1344
- ]),
1345
- _("div", Mt, [
1346
- _("div", Ht, [
1347
- S($, {
1348
- modelValue: I.value,
1349
- "onUpdate:modelValue": f[0] || (f[0] = (m) => I.value = m),
1350
- placeholder: "请输入需搜索的内容",
1351
- "prefix-icon": "Search",
1352
- clearable: ""
1353
- }, null, 8, ["modelValue"])
1354
- ]),
1355
- V(_("div", zt, [
1356
- S(K, null, {
1357
- default: B(() => [
1358
- S(r, {
1359
- ref_key: "tree0",
1360
- ref: i,
1361
- "node-key": "nodeId",
1362
- data: c.value,
1363
- "current-node-key": b.value,
1364
- "highlight-current": !0,
1365
- props: T,
1366
- "filter-node-method": j,
1367
- "show-checkbox": "",
1368
- onCheck: F,
1369
- onNodeClick: q,
1370
- "empty-text": "暂无数据"
1371
- }, {
1372
- default: B(({ node: m }) => [
1373
- _("span", {
1374
- id: m.key + "0",
1375
- class: "tree_node_text"
1376
- }, z(m.data.title), 9, Ft)
1377
- ]),
1378
- _: 1
1379
- }, 8, ["data", "current-node-key"])
1380
- ]),
1381
- _: 1
1382
- })
1383
- ], 512), [
1384
- [U, a.value == 0]
1385
- ]),
1386
- V(_("div", qt, [
1387
- S(K, null, {
1388
- default: B(() => [
1389
- S(r, {
1390
- ref_key: "tree1",
1391
- ref: l,
1392
- "node-key": "nodeId",
1393
- data: v.value,
1394
- "current-node-key": b.value,
1395
- "highlight-current": !0,
1396
- props: T,
1397
- "filter-node-method": j,
1398
- "show-checkbox": "",
1399
- onCheck: F,
1400
- onNodeClick: q,
1401
- "empty-text": "暂无数据"
1402
- }, {
1403
- default: B(({ node: m }) => [
1404
- _("span", {
1405
- id: m.key + "1",
1406
- class: "tree_node_text"
1407
- }, z(m.data.title), 9, Rt)
1408
- ]),
1409
- _: 1
1410
- }, 8, ["data", "current-node-key"])
1411
- ]),
1412
- _: 1
1413
- })
1414
- ], 512), [
1415
- [U, a.value == 1]
1416
- ]),
1417
- V(_("div", Vt, [
1418
- S(K, null, {
1419
- default: B(() => [
1420
- S(r, {
1421
- ref_key: "tree2",
1422
- ref: y,
1423
- "node-key": "nodeId",
1424
- data: N.value,
1425
- "current-node-key": b.value,
1426
- "highlight-current": !0,
1427
- props: T,
1428
- "filter-node-method": j,
1429
- "show-checkbox": "",
1430
- onCheck: F,
1431
- onNodeClick: q,
1432
- "empty-text": "暂无数据"
1433
- }, {
1434
- default: B(({ node: m }) => [
1435
- _("span", {
1436
- id: m.key + "2",
1437
- class: "tree_node_text"
1438
- }, z(m.data.title), 9, Ut)
1439
- ]),
1440
- _: 1
1441
- }, 8, ["data", "current-node-key"])
1442
- ]),
1443
- _: 1
1444
- })
1445
- ], 512), [
1446
- [U, a.value == 2]
1447
- ])
1448
- ])
1449
- ]),
1450
- _: 1
1451
- }, 8, ["pos"])) : (x(), A("div", Wt, [
1452
- _("div", Yt, [
1453
- _("div", Gt, [
1454
- f[3] || (f[3] = _("div", { class: "tree-title" }, "结构树", -1)),
1455
- _("div", Jt, [
1456
- S(J, {
1457
- class: "close",
1458
- width: 0.4,
1459
- "size-type": "rem",
1460
- "click-handle": ie
1461
- })
1462
- ])
1463
- ]),
1464
- _("div", Qt, [
1465
- S(K, null, {
1466
- default: B(() => [
1467
- _("div", Xt, [
1468
- (x(!0), A(ue, null, he(R(ye), (m, Ce) => (x(), A("div", {
1469
- key: Ce,
1470
- class: P(["tree-category-item", {
1471
- "tree-category-item-active": m.id === a.value
1472
- }]),
1473
- onClick: (cn) => D(m)
1474
- }, z(m.name), 11, Zt))), 128))
1475
- ])
1476
- ]),
1477
- _: 1
1478
- })
1479
- ]),
1480
- _("div", en, [
1481
- S($, {
1482
- modelValue: I.value,
1483
- "onUpdate:modelValue": f[1] || (f[1] = (m) => I.value = m),
1484
- placeholder: "请输入需搜索的内容",
1485
- "prefix-icon": "Search",
1486
- clearable: ""
1487
- }, null, 8, ["modelValue"])
1488
- ]),
1489
- _("div", tn, [
1490
- V(_("div", nn, [
1491
- S(K, null, {
1492
- default: B(() => [
1493
- S(r, {
1494
- ref_key: "tree0",
1495
- ref: i,
1496
- "node-key": "nodeId",
1497
- data: c.value,
1498
- "current-node-key": b.value,
1499
- "highlight-current": !0,
1500
- props: T,
1501
- "filter-node-method": j,
1502
- "show-checkbox": "",
1503
- onCheck: F,
1504
- onNodeClick: q,
1505
- "empty-text": "暂无数据"
1506
- }, {
1507
- default: B(({ node: m }) => [
1508
- _("span", {
1509
- id: m.key + "0",
1510
- class: "tree_node_text"
1511
- }, z(m.data.title), 9, on)
1512
- ]),
1513
- _: 1
1514
- }, 8, ["data", "current-node-key"])
1515
- ]),
1516
- _: 1
1517
- })
1518
- ], 512), [
1519
- [U, a.value == 0]
1520
- ]),
1521
- V(_("div", sn, [
1522
- S(K, null, {
1523
- default: B(() => [
1524
- S(r, {
1525
- ref_key: "tree1",
1526
- ref: l,
1527
- "node-key": "nodeId",
1528
- data: v.value,
1529
- "current-node-key": b.value,
1530
- "highlight-current": !0,
1531
- props: T,
1532
- "filter-node-method": j,
1533
- "show-checkbox": "",
1534
- onCheck: F,
1535
- onNodeClick: q,
1536
- "empty-text": "暂无数据"
1537
- }, {
1538
- default: B(({ node: m }) => [
1539
- _("span", {
1540
- id: m.key + "1",
1541
- class: "tree_node_text"
1542
- }, z(m.data.title), 9, dn)
1543
- ]),
1544
- _: 1
1545
- }, 8, ["data", "current-node-key"])
1546
- ]),
1547
- _: 1
1548
- })
1549
- ], 512), [
1550
- [U, a.value == 1]
1551
- ]),
1552
- V(_("div", rn, [
1553
- S(K, null, {
1554
- default: B(() => [
1555
- S(r, {
1556
- ref_key: "tree2",
1557
- ref: y,
1558
- "node-key": "nodeId",
1559
- data: N.value,
1560
- "current-node-key": b.value,
1561
- "highlight-current": !0,
1562
- props: T,
1563
- "filter-node-method": j,
1564
- "show-checkbox": "",
1565
- onCheck: F,
1566
- onNodeClick: q,
1567
- "empty-text": "暂无数据"
1568
- }, {
1569
- default: B(({ node: m }) => [
1570
- _("span", {
1571
- id: m.key + "2",
1572
- class: "tree_node_text"
1573
- }, z(m.data.title), 9, an)
1574
- ]),
1575
- _: 1
1576
- }, 8, ["data", "current-node-key"])
1577
- ]),
1578
- _: 1
1579
- })
1580
- ], 512), [
1581
- [U, a.value == 2]
1582
- ])
1583
- ])
1584
- ])
1585
- ]));
1586
- };
1587
- }
1588
- }), kn = /* @__PURE__ */ et(ln, [["__scopeId", "data-v-3c1af895"]]);
1589
- export {
1590
- kn as default
1591
- };