@web-utils/form-ui 1.0.0-beta105 → 1.0.0-beta106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/BtvhUxHg2.mjs +1282 -0
- package/chunks/{DToOCCc02.mjs → P4gsvvG42.mjs} +1 -1
- package/chunks/{CsOtjwy72.mjs → TIdVye5D2.mjs} +1 -1
- package/element-dialog/style.css +1 -1
- package/form-tree-select/index.mjs +1 -1
- package/form-tree-select-multiple/index.mjs +1 -1
- package/fy-upload/index.d.ts +1 -1
- package/index.css +1 -1
- package/index.mjs +3 -3
- package/package.json +1 -1
- package/vue-tags-input/index.d.ts +1 -1
- package/vue-tree-select/index.d.ts +10 -1010
- package/vue-tree-select/index.mjs +1 -1
- package/web-types.json +1 -1
- package/chunks/D2NeD2g32.mjs +0 -1361
|
@@ -0,0 +1,1282 @@
|
|
|
1
|
+
import { allProps as e } from "../props/vue-tree-select.mjs";
|
|
2
|
+
import { Fragment as t, Teleport as n, Transition as r, TransitionGroup as i, computed as a, createBlock as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, inject as d, isVNode as f, mergeProps as p, nextTick as m, normalizeClass as h, onBeforeUnmount as g, onMounted as _, onUnmounted as v, openBlock as y, provide as b, reactive as x, ref as S, toRefs as C, unref as ee, useSlots as te, useTemplateRef as w, watch as T } from "vue";
|
|
3
|
+
import { isPromise as E } from "@web-utils/core";
|
|
4
|
+
import { debounce as D, last as ne, noop as re, once as ie } from "lodash-es";
|
|
5
|
+
//#region src/components/tree-select/utils/index.ts
|
|
6
|
+
var O = re, k = (e) => function(t, ...n) {
|
|
7
|
+
t.type === "mousedown" && t.button === 0 && e.call(this, t, ...n);
|
|
8
|
+
}, ae = (e, t) => {
|
|
9
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = t.offsetHeight / 3;
|
|
10
|
+
r.bottom + i > n.bottom ? e.scrollTop = Math.min(t.offsetTop + t.clientHeight - e.offsetHeight + i, e.scrollHeight) : r.top - i < n.top && (e.scrollTop = Math.max(t.offsetTop - i, 0));
|
|
11
|
+
};
|
|
12
|
+
function A(e) {
|
|
13
|
+
let t = [], n = e.parentNode;
|
|
14
|
+
for (; n && n.nodeName !== "BODY" && n.nodeType === document.ELEMENT_NODE;) j(n) && t.push(n), n = n.parentNode;
|
|
15
|
+
return t.push(window), t;
|
|
16
|
+
}
|
|
17
|
+
function j(e) {
|
|
18
|
+
if (!e) return !1;
|
|
19
|
+
let { overflow: t, overflowX: n, overflowY: r } = getComputedStyle(e);
|
|
20
|
+
return /(auto|scroll|overlay)/.test(t + r + n);
|
|
21
|
+
}
|
|
22
|
+
function M(e, t) {
|
|
23
|
+
let n = A(e);
|
|
24
|
+
return window.addEventListener("resize", t, { passive: !0 }), n.forEach((e) => {
|
|
25
|
+
e.addEventListener("scroll", t, { passive: !0 });
|
|
26
|
+
}), function() {
|
|
27
|
+
window.removeEventListener("resize", t), n.forEach((e) => {
|
|
28
|
+
e.removeEventListener("scroll", t);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
var oe = (e) => Number.isNaN(e), N = () => ({});
|
|
33
|
+
function P(e) {
|
|
34
|
+
return typeof e != "object" || !e ? !1 : Object.getPrototypeOf(e) === Object.prototype;
|
|
35
|
+
}
|
|
36
|
+
function se(e, t, n) {
|
|
37
|
+
P(n) ? (e[t] || (e[t] = {}), F(e[t], n)) : e[t] = n;
|
|
38
|
+
}
|
|
39
|
+
function F(e, t) {
|
|
40
|
+
if (P(t)) {
|
|
41
|
+
let n = Object.keys(t);
|
|
42
|
+
for (let r = 0, i = n.length; r < i; r++) se(e, n[r], t[n[r]]);
|
|
43
|
+
}
|
|
44
|
+
return e;
|
|
45
|
+
}
|
|
46
|
+
function ce(e, t, n) {
|
|
47
|
+
for (let r = 0, i = e.length; r < i; r++) if (t.call(n, e[r], r, e)) return e[r];
|
|
48
|
+
}
|
|
49
|
+
function le(e, t) {
|
|
50
|
+
let n = e.indexOf(t);
|
|
51
|
+
n !== -1 && e.splice(n, 1);
|
|
52
|
+
}
|
|
53
|
+
function ue(e, t) {
|
|
54
|
+
return e.indexOf(t) !== -1;
|
|
55
|
+
}
|
|
56
|
+
function de(e, t) {
|
|
57
|
+
if (e.length !== t.length) return !0;
|
|
58
|
+
for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !0;
|
|
59
|
+
return !1;
|
|
60
|
+
}
|
|
61
|
+
function fe(e, t) {
|
|
62
|
+
let n = t.length, r = e.length;
|
|
63
|
+
if (r > n) return !1;
|
|
64
|
+
if (r === n) return e === t;
|
|
65
|
+
outer: for (let i = 0, a = 0; i < r; i++) {
|
|
66
|
+
let r = e.charCodeAt(i);
|
|
67
|
+
for (; a < n;) if (t.charCodeAt(a++) === r) continue outer;
|
|
68
|
+
return !1;
|
|
69
|
+
}
|
|
70
|
+
return !0;
|
|
71
|
+
}
|
|
72
|
+
var I, L = [], R = 100;
|
|
73
|
+
function z() {
|
|
74
|
+
I = window.setInterval(() => {
|
|
75
|
+
L.forEach(me);
|
|
76
|
+
}, R);
|
|
77
|
+
}
|
|
78
|
+
function pe() {
|
|
79
|
+
I && clearInterval(I), I = null;
|
|
80
|
+
}
|
|
81
|
+
function me(e) {
|
|
82
|
+
let { $el: t, listener: n, lastWidth: r, lastHeight: i } = e, a = t.offsetWidth, o = t.offsetHeight;
|
|
83
|
+
(r !== a || i !== o) && (e.lastWidth = a, e.lastHeight = o, n({
|
|
84
|
+
width: a,
|
|
85
|
+
height: o
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
function he(e, t) {
|
|
89
|
+
let n = {
|
|
90
|
+
$el: e,
|
|
91
|
+
listener: t,
|
|
92
|
+
lastWidth: null,
|
|
93
|
+
lastHeight: null
|
|
94
|
+
};
|
|
95
|
+
return L.push(n), me(n), z(), () => {
|
|
96
|
+
le(L, n), L.length || pe();
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function ge(e, t) {
|
|
100
|
+
let n = document.createElement("_"), r = n.appendChild(document.createElement("_")), i = n.appendChild(document.createElement("_")), a = r.appendChild(document.createElement("_")), o, s;
|
|
101
|
+
return r.style.cssText = n.style.cssText = "height:100%;left:0;opacity:0;overflow:hidden;pointer-events:none;position:absolute;top:0;transition:0s;width:100%;z-index:-1", a.style.cssText = i.style.cssText = "display:block;height:100%;transition:0s;width:100%", a.style.width = a.style.height = "200%", e.appendChild(n), c(), u;
|
|
102
|
+
function c() {
|
|
103
|
+
l();
|
|
104
|
+
let a = e.offsetWidth, u = e.offsetHeight;
|
|
105
|
+
(a !== o || u !== s) && (o = a, s = u, i.style.width = `${a * 2}px`, i.style.height = `${u * 2}px`, n.scrollLeft = n.scrollWidth, n.scrollTop = n.scrollHeight, r.scrollLeft = r.scrollWidth, r.scrollTop = r.scrollHeight, t({
|
|
106
|
+
width: a,
|
|
107
|
+
height: u
|
|
108
|
+
})), r.addEventListener("scroll", c), n.addEventListener("scroll", c);
|
|
109
|
+
}
|
|
110
|
+
function l() {
|
|
111
|
+
r.removeEventListener("scroll", c), n.removeEventListener("scroll", c);
|
|
112
|
+
}
|
|
113
|
+
function u() {
|
|
114
|
+
l(), e.removeChild(n);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function _e(e, t) {
|
|
118
|
+
let n = document.documentMode === 9, r = !0, i = (n ? he : ge)(e, (...e) => r || t(...e));
|
|
119
|
+
return r = !1, i;
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/components/tree-select/constants.ts
|
|
123
|
+
var ve = "ALL_CHILDREN", ye = "ALL_DESCENDANTS", be = "LEAF_CHILDREN", xe = "LEAF_DESCENDANTS", Se = "LOAD_ROOT_OPTIONS", Ce = "LOAD_CHILDREN_OPTIONS", we = "ASYNC_SEARCH", B = {
|
|
124
|
+
BACKSPACE: 8,
|
|
125
|
+
ENTER: 13,
|
|
126
|
+
ESCAPE: 27,
|
|
127
|
+
END: 35,
|
|
128
|
+
HOME: 36,
|
|
129
|
+
ARROW_LEFT: 37,
|
|
130
|
+
ARROW_UP: 38,
|
|
131
|
+
ARROW_RIGHT: 39,
|
|
132
|
+
ARROW_DOWN: 40,
|
|
133
|
+
DELETE: 46
|
|
134
|
+
}, Te = process.env.NODE_ENV === "development" ? 10 : /* istanbul ignore next */ 200, V = Symbol("vueTreeSelect");
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/components/tree-select/components/VueTreeSelectHiddenFields.vue?vue&type=script&lang.jsx
|
|
137
|
+
function Ee(e) {
|
|
138
|
+
// istanbul ignore next
|
|
139
|
+
return typeof e == "string" ? e :
|
|
140
|
+
// istanbul ignore else
|
|
141
|
+
e != null && !oe(e) ? JSON.stringify(e) : "";
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/components/tree-select/components/VueTreeSelectHiddenFields.vue
|
|
145
|
+
var De = {
|
|
146
|
+
name: "VueTreeSelectHiddenFields",
|
|
147
|
+
setup() {
|
|
148
|
+
let e = d(V);
|
|
149
|
+
return () => {
|
|
150
|
+
if (!e.name || e.disabled || !e.hasValue) return null;
|
|
151
|
+
let t = e.internalValue.map(Ee);
|
|
152
|
+
return e.multiple && e.joinValues && (t = [t.join(e.delimiter)]), t.map((t, n) => u("input", {
|
|
153
|
+
type: "hidden",
|
|
154
|
+
name: e.name,
|
|
155
|
+
value: t,
|
|
156
|
+
key: `hidden-field-${n}`
|
|
157
|
+
}, null));
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}, Oe = [
|
|
161
|
+
B.ENTER,
|
|
162
|
+
B.END,
|
|
163
|
+
B.HOME,
|
|
164
|
+
B.ARROW_LEFT,
|
|
165
|
+
B.ARROW_UP,
|
|
166
|
+
B.ARROW_RIGHT,
|
|
167
|
+
B.ARROW_DOWN
|
|
168
|
+
], H = {
|
|
169
|
+
name: "VueTreeSelectInput",
|
|
170
|
+
setup(e, { expose: t }) {
|
|
171
|
+
let n = d(V), r = S(""), i = S(5), o = w("sizer"), s = w("input"), c = () => {
|
|
172
|
+
n.trigger.searchQuery = r.value;
|
|
173
|
+
}, l = D(c, Te, {
|
|
174
|
+
leading: !0,
|
|
175
|
+
trailing: !0
|
|
176
|
+
}), f = a(() => n.searchable && !n.disabled && n.multiple), h = a(() => ({ width: f.value ? `${i.value}px` : null })), g = () => {
|
|
177
|
+
if (!n.disabled) {
|
|
178
|
+
var e;
|
|
179
|
+
(e = s.value) == null || e.focus();
|
|
180
|
+
}
|
|
181
|
+
}, _ = () => {
|
|
182
|
+
var e;
|
|
183
|
+
(e = s.value) == null || e.blur();
|
|
184
|
+
}, v = () => {
|
|
185
|
+
// istanbul ignore else
|
|
186
|
+
n.trigger.isFocused = !0, n.openOnFocus && n.openMenu();
|
|
187
|
+
}, y = () => {
|
|
188
|
+
let e = n.getMenu();
|
|
189
|
+
// istanbul ignore next
|
|
190
|
+
if (e && document.activeElement === e) return g();
|
|
191
|
+
n.trigger.isFocused = !1, n.closeMenu();
|
|
192
|
+
}, b = (e) => {
|
|
193
|
+
let { value: t } = e.target;
|
|
194
|
+
r.value = t, t ? l() : (l.cancel(), c());
|
|
195
|
+
}, x = () => {
|
|
196
|
+
b({ target: { value: "" } });
|
|
197
|
+
}, C = (e) => {
|
|
198
|
+
let t = "which" in e ? e.which : /* istanbul ignore next */ e.keyCode;
|
|
199
|
+
if (!(e.ctrlKey || e.shiftKey || e.altKey || e.metaKey)) {
|
|
200
|
+
if (!n.menu.isOpen && ue(Oe, t)) return e.preventDefault(), n.openMenu();
|
|
201
|
+
switch (t) {
|
|
202
|
+
case B.BACKSPACE:
|
|
203
|
+
n.backspaceRemoves && !r.value.length && n.removeLastValue();
|
|
204
|
+
break;
|
|
205
|
+
case B.ENTER: {
|
|
206
|
+
if (e.preventDefault(), n.menu.current === null) return;
|
|
207
|
+
let t = n.getNode(n.menu.current);
|
|
208
|
+
if (t.isBranch && n.disableBranchNodes) return;
|
|
209
|
+
n.select(t);
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
case B.ESCAPE:
|
|
213
|
+
r.value.length ? x() : n.menu.isOpen && n.closeMenu();
|
|
214
|
+
break;
|
|
215
|
+
case B.END:
|
|
216
|
+
e.preventDefault(), n.highlightLastOption();
|
|
217
|
+
break;
|
|
218
|
+
case B.HOME:
|
|
219
|
+
e.preventDefault(), n.highlightFirstOption();
|
|
220
|
+
break;
|
|
221
|
+
case B.ARROW_LEFT: {
|
|
222
|
+
let t = n.getNode(n.menu.current);
|
|
223
|
+
t.isBranch && n.shouldExpand(t) ? (e.preventDefault(), n.toggleExpanded(t)) : !t.isRootNode && (t.isLeaf || t.isBranch && !n.shouldExpand(t)) && (e.preventDefault(), n.setCurrentHighlightedOption(t.parentNode));
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
case B.ARROW_UP:
|
|
227
|
+
e.preventDefault(), n.highlightPrevOption();
|
|
228
|
+
break;
|
|
229
|
+
case B.ARROW_RIGHT: {
|
|
230
|
+
let t = n.getNode(n.menu.current);
|
|
231
|
+
t.isBranch && !n.shouldExpand(t) && (e.preventDefault(), n.toggleExpanded(t));
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
case B.ARROW_DOWN:
|
|
235
|
+
e.preventDefault(), n.highlightNextOption();
|
|
236
|
+
break;
|
|
237
|
+
case B.DELETE:
|
|
238
|
+
n.deleteRemoves && !r.value.length && n.removeLastValue();
|
|
239
|
+
break;
|
|
240
|
+
default:
|
|
241
|
+
// istanbul ignore else
|
|
242
|
+
n.openMenu();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}, ee = (e) => {
|
|
246
|
+
// istanbul ignore next
|
|
247
|
+
r.value.length && e.stopPropagation();
|
|
248
|
+
}, te = () => u("input", {
|
|
249
|
+
ref: "input",
|
|
250
|
+
class: "vue-treeselect__input",
|
|
251
|
+
type: "text",
|
|
252
|
+
autocomplete: "off",
|
|
253
|
+
tabIndex: n.tabIndex,
|
|
254
|
+
required: n.required && !n.hasValue,
|
|
255
|
+
value: r.value,
|
|
256
|
+
style: h.value,
|
|
257
|
+
onFocus: v,
|
|
258
|
+
onInput: b,
|
|
259
|
+
onBlur: y,
|
|
260
|
+
onKeydown: C,
|
|
261
|
+
onMousedown: ee
|
|
262
|
+
}, null), E = () => u("div", {
|
|
263
|
+
ref: "sizer",
|
|
264
|
+
class: "vue-treeselect__sizer"
|
|
265
|
+
}, [r.value]), ne = () => {
|
|
266
|
+
var e;
|
|
267
|
+
i.value = Math.max(5, ((e = o.value) == null ? void 0 : e.scrollWidth) + 15);
|
|
268
|
+
};
|
|
269
|
+
return T(() => n.trigger.searchQuery, (e) => {
|
|
270
|
+
r.value = e;
|
|
271
|
+
}), T(r, () => {
|
|
272
|
+
// istanbul ignore else
|
|
273
|
+
f.value && m(ne);
|
|
274
|
+
}), t({
|
|
275
|
+
blur: _,
|
|
276
|
+
focus: g
|
|
277
|
+
}), () => {
|
|
278
|
+
let e = {}, t = [];
|
|
279
|
+
return n.searchable && !n.disabled && (t.push(te()), f.value && t.push(E())), n.searchable || F(e, {
|
|
280
|
+
on: {
|
|
281
|
+
focus: v,
|
|
282
|
+
blur: y,
|
|
283
|
+
keydown: C
|
|
284
|
+
},
|
|
285
|
+
ref: "input"
|
|
286
|
+
}), !n.searchable && !n.disabled && F(e, { attrs: { tabIndex: n.tabIndex } }), u("div", p({ class: "vue-treeselect__input-container" }, e), [t]);
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
}, U = {
|
|
290
|
+
name: "VueTreeSelectPlaceholder",
|
|
291
|
+
setup() {
|
|
292
|
+
let e = d(V);
|
|
293
|
+
return () => u("div", { class: {
|
|
294
|
+
"vue-treeselect__placeholder": !0,
|
|
295
|
+
"vue-treeselect-helper-zoom-effect-off": !0,
|
|
296
|
+
"vue-treeselect-helper-hide": e.hasValue || e.trigger.searchQuery
|
|
297
|
+
} }, [e.placeholder]);
|
|
298
|
+
}
|
|
299
|
+
}, ke = {
|
|
300
|
+
name: "VueTreeSelectSingleValue",
|
|
301
|
+
setup(e, { expose: n }) {
|
|
302
|
+
let r = d(V);
|
|
303
|
+
return n({ input: w("input") }), () => {
|
|
304
|
+
let e = r.selectedNodes[0];
|
|
305
|
+
return u(t, null, [
|
|
306
|
+
r.hasValue && !r.trigger.searchQuery ? u("div", { class: "vue-treeselect__single-value" }, [r.$slots["value-label"] ? r.$slots["value-label"]({ node: e }) : e.label]) : null,
|
|
307
|
+
u(U, null, null),
|
|
308
|
+
u(H, { ref: "input" }, null)
|
|
309
|
+
]);
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
}, W = {
|
|
313
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
314
|
+
viewBox: "0 0 348.333 348.333"
|
|
315
|
+
}, Ae = /* @__PURE__ */ Object.assign({ name: "VueTreeSelectDelete" }, {
|
|
316
|
+
__name: "VueTreeSelectDelete",
|
|
317
|
+
setup(e) {
|
|
318
|
+
return (e, t) => (y(), s("svg", W, [...t[0] || (t[0] = [c("path", { d: "M336.559 68.611L231.016 174.165l105.543 105.549c15.699 15.705 15.699 41.145 0 56.85-7.844 7.844-18.128 11.769-28.407 11.769-10.296 0-20.581-3.919-28.419-11.769L174.167 231.003 68.609 336.563c-7.843 7.844-18.128 11.769-28.416 11.769-10.285 0-20.563-3.919-28.413-11.769-15.699-15.698-15.699-41.139 0-56.85l105.54-105.549L11.774 68.611c-15.699-15.699-15.699-41.145 0-56.844 15.696-15.687 41.127-15.687 56.829 0l105.563 105.554L279.721 11.767c15.705-15.687 41.139-15.687 56.832 0 15.705 15.699 15.705 41.145.006 56.844z" }, null, -1)])]));
|
|
319
|
+
}
|
|
320
|
+
}), je = {
|
|
321
|
+
name: "VueTreeSelectMultiValueItem",
|
|
322
|
+
props: { node: {
|
|
323
|
+
type: Object,
|
|
324
|
+
required: !0
|
|
325
|
+
} },
|
|
326
|
+
setup(e) {
|
|
327
|
+
let t = d(V), n = k(() => {
|
|
328
|
+
t.select(e.node);
|
|
329
|
+
});
|
|
330
|
+
return () => u("div", { class: "vue-treeselect__multi-value-item-container" }, [u("div", {
|
|
331
|
+
class: {
|
|
332
|
+
"vue-treeselect__multi-value-item": !0,
|
|
333
|
+
"vue-treeselect__multi-value-item-disabled": e.node.isDisabled,
|
|
334
|
+
"vue-treeselect__multi-value-item-new": e.node.isNew
|
|
335
|
+
},
|
|
336
|
+
onMousedown: n
|
|
337
|
+
}, [u("span", { class: "vue-treeselect__multi-value-label" }, [t.$slots["value-label"] ? t.$slots["value-label"]({ node: e.node }) : e.node.label]), u("span", { class: "vue-treeselect__icon vue-treeselect__value-remove" }, [u(Ae, null, null)])])]);
|
|
338
|
+
}
|
|
339
|
+
}, Me = {
|
|
340
|
+
name: "VueTreeSelectMultiValue",
|
|
341
|
+
setup(e, { expose: t }) {
|
|
342
|
+
let n = d(V), r = { props: {
|
|
343
|
+
tag: "div",
|
|
344
|
+
name: "vue-treeselect__multi-value-item--transition",
|
|
345
|
+
appear: !0
|
|
346
|
+
} }, a = () => n.internalValue.slice(0, n.limit).map(n.getNode).map((e) => u(je, {
|
|
347
|
+
key: `multi-value-item-${e.id}`,
|
|
348
|
+
node: e
|
|
349
|
+
}, null)), o = () => {
|
|
350
|
+
let e = n.internalValue.length - n.limit;
|
|
351
|
+
return e <= 0 ? null : u("div", {
|
|
352
|
+
class: "vue-treeselect__limit-tip vue-treeselect-helper-zoom-effect-off",
|
|
353
|
+
key: "exceed-limit-tip"
|
|
354
|
+
}, [u("span", { class: "vue-treeselect__limit-tip-text" }, [n.limitText(e)])]);
|
|
355
|
+
};
|
|
356
|
+
return t({ input: w("input") }), () => u(i, p({ class: "vue-treeselect__multi-value" }, r), { default: () => [
|
|
357
|
+
a(),
|
|
358
|
+
o(),
|
|
359
|
+
u(U, { key: "placeholder" }, null),
|
|
360
|
+
u(H, {
|
|
361
|
+
ref: "input",
|
|
362
|
+
key: "input"
|
|
363
|
+
}, null)
|
|
364
|
+
] });
|
|
365
|
+
}
|
|
366
|
+
}, Ne = {
|
|
367
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
368
|
+
viewBox: "0 0 292.362 292.362"
|
|
369
|
+
}, Pe = /* @__PURE__ */ Object.assign({ name: "VueTreeSelectArrow" }, {
|
|
370
|
+
__name: "VueTreeSelectArrow",
|
|
371
|
+
setup(e) {
|
|
372
|
+
return (e, t) => (y(), s("svg", Ne, [...t[0] || (t[0] = [c("path", { d: "M286.935 69.377c-3.614-3.617-7.898-5.424-12.848-5.424H18.274c-4.952 0-9.233 1.807-12.85 5.424C1.807 72.998 0 77.279 0 82.228c0 4.948 1.807 9.229 5.424 12.847l127.907 127.907c3.621 3.617 7.902 5.428 12.85 5.428s9.233-1.811 12.847-5.428L286.935 95.074c3.613-3.617 5.427-7.898 5.427-12.847 0-4.948-1.814-9.229-5.427-12.85z" }, null, -1)])]));
|
|
373
|
+
}
|
|
374
|
+
}), Fe = {
|
|
375
|
+
name: "VueTreeSelectControl",
|
|
376
|
+
setup(e, { expose: t }) {
|
|
377
|
+
let n = d(V), r = a(() => n.hasValue && n.internalValue.some((e) => !n.getNode(e).isDisabled)), i = a(() => n.clearable && !n.disabled && n.hasValue && (r.value || n.allowClearingDisabled)), o = a(() => n.alwaysOpen ? !n.menu.isOpen : !0), s = k((e) => {
|
|
378
|
+
e.preventDefault(), e.stopPropagation(), n.focusInput(), n.toggleMenu();
|
|
379
|
+
}), c = () => {
|
|
380
|
+
let e = n.multiple ? n.clearAllText : n.clearValueText;
|
|
381
|
+
return i.value ? u("div", {
|
|
382
|
+
class: "vue-treeselect__x-container",
|
|
383
|
+
title: e,
|
|
384
|
+
onMousedown: f
|
|
385
|
+
}, [u(Ae, { class: "vue-treeselect__x" }, null)]) : null;
|
|
386
|
+
}, l = () => {
|
|
387
|
+
let e = {
|
|
388
|
+
"vue-treeselect__control-arrow": !0,
|
|
389
|
+
"vue-treeselect__control-arrow--rotated": n.menu.isOpen
|
|
390
|
+
};
|
|
391
|
+
return o.value ? u("div", {
|
|
392
|
+
class: "vue-treeselect__control-arrow-container",
|
|
393
|
+
onMousedown: s
|
|
394
|
+
}, [u(Pe, { class: e }, null)]) : null;
|
|
395
|
+
}, f = k((e) => {
|
|
396
|
+
e.stopPropagation(), e.preventDefault();
|
|
397
|
+
let t = n.beforeClearAll(), r = (e) => {
|
|
398
|
+
e && n.clear();
|
|
399
|
+
};
|
|
400
|
+
E(t) ? t.then(r) : setTimeout(() => r(t), 0);
|
|
401
|
+
});
|
|
402
|
+
return t({
|
|
403
|
+
container: w("container"),
|
|
404
|
+
valueContainer: w("value-container")
|
|
405
|
+
}), () => {
|
|
406
|
+
let e = n.single ? ke : Me;
|
|
407
|
+
return u("div", {
|
|
408
|
+
class: "vue-treeselect__control",
|
|
409
|
+
onMousedown: n.handleMouseDown
|
|
410
|
+
}, [
|
|
411
|
+
u("div", {
|
|
412
|
+
class: "vue-treeselect__value-container",
|
|
413
|
+
ref: "container"
|
|
414
|
+
}, [u(e, { ref: "value-container" }, null)]),
|
|
415
|
+
c(),
|
|
416
|
+
l()
|
|
417
|
+
]);
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/components/tree-select/components/VueTreeSelectTip.jsx
|
|
423
|
+
function G(e, { slots: t }) {
|
|
424
|
+
var n;
|
|
425
|
+
return u("div", { class: `vue-treeselect__tip vue-treeselect__${e.type}-tip` }, [u("div", { class: "vue-treeselect__icon-container" }, [u("span", { class: `vue-treeselect__icon-${e.icon}` }, null)]), u("span", { class: `vue-treeselect__tip-text vue-treeselect__${e.type}-tip-text` }, [(n = t.default) == null ? void 0 : n.call(t)])]);
|
|
426
|
+
}
|
|
427
|
+
G.props = {
|
|
428
|
+
type: {
|
|
429
|
+
type: String,
|
|
430
|
+
required: !0
|
|
431
|
+
},
|
|
432
|
+
icon: {
|
|
433
|
+
type: String,
|
|
434
|
+
required: !0
|
|
435
|
+
}
|
|
436
|
+
}, G.inheritAttrs = !1;
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region src/components/tree-select/components/VueTreeSelectOption.vue?vue&type=script&lang.jsx
|
|
439
|
+
function K(e) {
|
|
440
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
|
|
441
|
+
}
|
|
442
|
+
var q, J, Y, X = {
|
|
443
|
+
name: "VueTreeSelectOption",
|
|
444
|
+
props: { node: {
|
|
445
|
+
type: Object,
|
|
446
|
+
required: !0
|
|
447
|
+
} },
|
|
448
|
+
setup(e) {
|
|
449
|
+
let t = d(V), n = a(() => e.node.isBranch && t.shouldExpand(e.node)), i = a(() => t.shouldShowOptionInMenu(e.node)), o = () => u("div", {
|
|
450
|
+
class: {
|
|
451
|
+
"vue-treeselect__option": !0,
|
|
452
|
+
"vue-treeselect__option--disabled": e.node.isDisabled,
|
|
453
|
+
"vue-treeselect__option--selected": t.isSelected(e.node),
|
|
454
|
+
"vue-treeselect__option--highlight": e.node.isHighlighted,
|
|
455
|
+
"vue-treeselect__option--matched": t.localSearch.active && e.node.isMatched,
|
|
456
|
+
"vue-treeselect__option--hide": !i.value
|
|
457
|
+
},
|
|
458
|
+
onMouseenter: b,
|
|
459
|
+
"data-id": e.node.id
|
|
460
|
+
}, [c(), f([p([m()]), h()])]), s = () => n.value ? u("div", { class: "vue-treeselect__list" }, [
|
|
461
|
+
g(),
|
|
462
|
+
_(),
|
|
463
|
+
v(),
|
|
464
|
+
y()
|
|
465
|
+
]) : null, c = () => {
|
|
466
|
+
if (t.shouldFlattenOptions && i.value) return null;
|
|
467
|
+
if (e.node.isBranch) {
|
|
468
|
+
let e = { props: {
|
|
469
|
+
name: "vue-treeselect__option-arrow--prepare",
|
|
470
|
+
appear: !0
|
|
471
|
+
} }, t = {
|
|
472
|
+
"vue-treeselect__option-arrow": !0,
|
|
473
|
+
"vue-treeselect__option-arrow--rotated": n.value
|
|
474
|
+
};
|
|
475
|
+
return u("div", {
|
|
476
|
+
class: "vue-treeselect__option-arrow-container",
|
|
477
|
+
onMousedown: x
|
|
478
|
+
}, [u(r, e, { default: () => [u(Pe, { class: t }, null)] })]);
|
|
479
|
+
}
|
|
480
|
+
return t.hasBranchNodes ? (q || (q = u("div", { class: "vue-treeselect__option-arrow-placeholder" }, [l("\xA0")])), q) : null;
|
|
481
|
+
}, f = (e) => u("div", {
|
|
482
|
+
class: "vue-treeselect__label-container",
|
|
483
|
+
onMousedown: S
|
|
484
|
+
}, [e]), p = (n) => t.single || t.disableBranchNodes && e.node.isBranch ? null : u("div", { class: "vue-treeselect__checkbox-container" }, [n]), m = () => {
|
|
485
|
+
let n = t.forest.checkedStateMap[e.node.id], r = {
|
|
486
|
+
"vue-treeselect__checkbox": !0,
|
|
487
|
+
"vue-treeselect__checkbox--checked": n === 2,
|
|
488
|
+
"vue-treeselect__checkbox--indeterminate": n === 1,
|
|
489
|
+
"vue-treeselect__checkbox--unchecked": n === 0,
|
|
490
|
+
"vue-treeselect__checkbox--disabled": e.node.isDisabled
|
|
491
|
+
};
|
|
492
|
+
return J || (J = u("span", { class: "vue-treeselect__check-mark" }, null)), Y || (Y = u("span", { class: "vue-treeselect__minus-mark" }, null)), u("span", { class: r }, [J, Y]);
|
|
493
|
+
}, h = () => {
|
|
494
|
+
let n = e.node.isBranch && (t.localSearch.active ? t.showCountOnSearchComputed : t.showCount), r = n ? t.localSearch.active ? t.localSearch.countMap[e.node.id][t.showCountOf] : e.node.count[t.showCountOf] : NaN, i = "vue-treeselect__label", a = "vue-treeselect__count", o = t.$slots["option-label"];
|
|
495
|
+
return o ? o({
|
|
496
|
+
node: e.node,
|
|
497
|
+
shouldShowCount: n,
|
|
498
|
+
count: r,
|
|
499
|
+
labelClassName: i,
|
|
500
|
+
countClassName: a
|
|
501
|
+
}) : u("label", { class: i }, [e.node.label, n && u("span", { class: a }, [
|
|
502
|
+
l("("),
|
|
503
|
+
r,
|
|
504
|
+
l(")")
|
|
505
|
+
])]);
|
|
506
|
+
}, g = () => e.node.childrenStates.isLoaded ? e.node.children.map((e) => u(X, {
|
|
507
|
+
node: e,
|
|
508
|
+
key: e.id
|
|
509
|
+
}, null)) : null, _ = () => !e.node.childrenStates.isLoaded || e.node.children.length ? null : u(G, {
|
|
510
|
+
type: "no-children",
|
|
511
|
+
icon: "warning"
|
|
512
|
+
}, { default: () => [t.noChildrenText] }), v = () => e.node.childrenStates.isLoading ? u(G, {
|
|
513
|
+
type: "loading",
|
|
514
|
+
icon: "loader"
|
|
515
|
+
}, { default: () => [t.loadingText] }) : null, y = () => e.node.childrenStates.loadingError ? u(G, {
|
|
516
|
+
type: "error",
|
|
517
|
+
icon: "error"
|
|
518
|
+
}, { default: () => [e.node.childrenStates.loadingError, u("a", {
|
|
519
|
+
class: "vue-treeselect__retry",
|
|
520
|
+
title: t.retryTitle,
|
|
521
|
+
onMousedown: C
|
|
522
|
+
}, [t.retryText])] }) : null, b = (n) => {
|
|
523
|
+
n.target === n.currentTarget && t.setCurrentHighlightedOption(e.node, !1);
|
|
524
|
+
}, x = k(() => {
|
|
525
|
+
t.toggleExpanded(e.node);
|
|
526
|
+
}), S = k(() => {
|
|
527
|
+
e.node.isBranch && t.disableBranchNodes ? t.toggleExpanded(e.node) : t.select(e.node);
|
|
528
|
+
}), C = k(() => {
|
|
529
|
+
t.loadChildrenOptions(e.node);
|
|
530
|
+
});
|
|
531
|
+
return () => {
|
|
532
|
+
let n;
|
|
533
|
+
return u("div", { class: {
|
|
534
|
+
"vue-treeselect__list-item": !0,
|
|
535
|
+
[`vue-treeselect__indent-level-${t.shouldFlattenOptions ? 0 : e.node.level}`]: !0
|
|
536
|
+
} }, [o(), e.node.isBranch && u(r, { name: "vue-treeselect__list--transition" }, K(n = s()) ? n : { default: () => [n] })]);
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
//#endregion
|
|
541
|
+
//#region src/components/tree-select/components/VueTreeSelectMenu.vue?vue&type=script&lang.jsx
|
|
542
|
+
function Ie(e) {
|
|
543
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
|
|
544
|
+
}
|
|
545
|
+
var Le = {
|
|
546
|
+
top: "top",
|
|
547
|
+
bottom: "bottom",
|
|
548
|
+
above: "top",
|
|
549
|
+
below: "bottom"
|
|
550
|
+
}, Re = {
|
|
551
|
+
name: "VueTreeSelectMenu",
|
|
552
|
+
setup() {
|
|
553
|
+
let e = d(V), t = null, n = null, i = a(() => ({ maxHeight: `${e.maxHeight}px` })), o = a(() => ({ zIndex: e.appendToBody ? null : e.zIndex })), s = () => e.menu.isOpen ? u("div", {
|
|
554
|
+
ref: "menu",
|
|
555
|
+
class: "vue-treeselect__menu",
|
|
556
|
+
onMousedown: e.handleMouseDown,
|
|
557
|
+
style: i.value
|
|
558
|
+
}, [
|
|
559
|
+
c(),
|
|
560
|
+
e.async ? h() : e.localSearch.active ? p() : f(),
|
|
561
|
+
l()
|
|
562
|
+
]) : null, c = () => {
|
|
563
|
+
let t = e.$slots["before-list"];
|
|
564
|
+
return t ? t() : null;
|
|
565
|
+
}, l = () => {
|
|
566
|
+
let t = e.$slots["after-list"];
|
|
567
|
+
return t ? t() : null;
|
|
568
|
+
}, f = () => e.rootOptionsStates.isLoading ? b() : e.rootOptionsStates.loadingError ? x() : e.rootOptionsStates.isLoaded && e.forest.normalizedOptions.length === 0 ? C() : g(), p = () => e.rootOptionsStates.isLoading ? b() : e.rootOptionsStates.loadingError ? x() : e.rootOptionsStates.isLoaded && e.forest.normalizedOptions.length === 0 ? C() : e.localSearch.noResults ? ee() : g(), h = () => {
|
|
569
|
+
let t = e.getRemoteSearchEntry(), n = e.trigger.searchQuery === "" && !e.defaultOptions, r = n ? !1 : t.isLoaded && t.options.length === 0;
|
|
570
|
+
return n ? y() : t.isLoading ? b() : t.loadingError ? S() : r ? ee() : g();
|
|
571
|
+
}, g = () => u("div", { class: "vue-treeselect__list" }, [e.forest.normalizedOptions.map((e) => u(X, {
|
|
572
|
+
node: e,
|
|
573
|
+
key: e.id
|
|
574
|
+
}, null))]), y = () => u(G, {
|
|
575
|
+
type: "search-prompt",
|
|
576
|
+
icon: "warning"
|
|
577
|
+
}, { default: () => [e.searchPromptText] }), b = () => u(G, {
|
|
578
|
+
type: "loading",
|
|
579
|
+
icon: "loader"
|
|
580
|
+
}, { default: () => [e.loadingText] }), x = () => u(G, {
|
|
581
|
+
type: "error",
|
|
582
|
+
icon: "error"
|
|
583
|
+
}, { default: () => [e.rootOptionsStates.loadingError, u("a", {
|
|
584
|
+
class: "vue-treeselect__retry",
|
|
585
|
+
onClick: e.loadRootOptions,
|
|
586
|
+
title: e.retryTitle
|
|
587
|
+
}, [e.retryText])] }), S = () => {
|
|
588
|
+
let t = e.getRemoteSearchEntry();
|
|
589
|
+
return u(G, {
|
|
590
|
+
type: "error",
|
|
591
|
+
icon: "error"
|
|
592
|
+
}, { default: () => [t.loadingError, u("a", {
|
|
593
|
+
class: "vue-treeselect__retry",
|
|
594
|
+
onClick: e.handleRemoteSearch,
|
|
595
|
+
title: e.retryTitle
|
|
596
|
+
}, [e.retryText])] });
|
|
597
|
+
}, C = () => u(G, {
|
|
598
|
+
type: "no-options",
|
|
599
|
+
icon: "warning"
|
|
600
|
+
}, { default: () => [e.noOptionsText] }), ee = () => u(G, {
|
|
601
|
+
type: "no-results",
|
|
602
|
+
icon: "warning"
|
|
603
|
+
}, { default: () => [e.noResultsText] }), te = () => {
|
|
604
|
+
E(), D(), ne();
|
|
605
|
+
}, w = () => {
|
|
606
|
+
re(), ie();
|
|
607
|
+
}, E = () => {
|
|
608
|
+
if (!e.menu.isOpen) return;
|
|
609
|
+
let t = e.getMenu(), n = e.getControl(), r = t.getBoundingClientRect(), i = n.getBoundingClientRect(), a = r.height, o = window.innerHeight, s = i.top, c = window.innerHeight - i.bottom, l = i.top >= 0 && i.top <= o || i.top < 0 && i.bottom > 0, u = c > a + 40, d = s > a + 40;
|
|
610
|
+
l ? e.openDirection === "auto" ? u || !d ? e.menu.placement = "bottom" : e.menu.placement = "top" : e.menu.placement = Le[e.openDirection] : e.closeMenu();
|
|
611
|
+
}, D = () => {
|
|
612
|
+
let n = e.getMenu();
|
|
613
|
+
t || (t = { remove: _e(n, E) });
|
|
614
|
+
}, ne = () => {
|
|
615
|
+
let t = e.getControl();
|
|
616
|
+
n || (n = { remove: M(t, E) });
|
|
617
|
+
}, re = () => {
|
|
618
|
+
t && (t.remove(), t = null);
|
|
619
|
+
}, ie = () => {
|
|
620
|
+
n && (n.remove(), n = null);
|
|
621
|
+
};
|
|
622
|
+
return T(() => e.menu.isOpen, (e) => {
|
|
623
|
+
e ? m(te) : w();
|
|
624
|
+
}), _(() => {
|
|
625
|
+
e.menu.isOpen && m(te);
|
|
626
|
+
}), v(() => {
|
|
627
|
+
w();
|
|
628
|
+
}), () => {
|
|
629
|
+
let e;
|
|
630
|
+
return u("div", {
|
|
631
|
+
ref: "menu-container",
|
|
632
|
+
class: "vue-treeselect__menu-container",
|
|
633
|
+
style: o.value
|
|
634
|
+
}, [u(r, { name: "vue-treeselect__menu--transition" }, Ie(e = s()) ? e : { default: () => [e] })]);
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
}, ze = {
|
|
638
|
+
name: "VueTreeSelectPortalTarget",
|
|
639
|
+
setup() {
|
|
640
|
+
let e = d(V), t = w("el"), n = w("menu"), r = null, i = null, a = () => {
|
|
641
|
+
let r = e.getControl().getBoundingClientRect(), i = t.value.getBoundingClientRect(), a = e.menu.placement === "bottom" ? r.height : 0, o = `${Math.round(r.left - i.left)}px`, s = `${Math.round(r.top - i.top + a)}px`, c = n.value.$refs["menu-container"].style, l = ce([
|
|
642
|
+
"transform",
|
|
643
|
+
"webkitTransform",
|
|
644
|
+
"MozTransform",
|
|
645
|
+
"msTransform"
|
|
646
|
+
], (e) => e in document.body.style);
|
|
647
|
+
c[l] = `translate(${o}, ${s})`;
|
|
648
|
+
}, o = () => {
|
|
649
|
+
let t = e.getControl();
|
|
650
|
+
r || (r = { remove: M(t, a) });
|
|
651
|
+
}, s = () => {
|
|
652
|
+
let n = e.getControl().getBoundingClientRect();
|
|
653
|
+
t.value.style.width = `${n.width}px`;
|
|
654
|
+
}, c = () => {
|
|
655
|
+
let t = e.getControl();
|
|
656
|
+
i || (i = { remove: _e(t, () => {
|
|
657
|
+
s(), a();
|
|
658
|
+
}) });
|
|
659
|
+
}, l = () => {
|
|
660
|
+
r && (r.remove(), r = null);
|
|
661
|
+
}, f = () => {
|
|
662
|
+
i && (i.remove(), i = null);
|
|
663
|
+
}, p = () => {
|
|
664
|
+
l(), f();
|
|
665
|
+
}, m = () => {
|
|
666
|
+
s(), a(), o(), c();
|
|
667
|
+
};
|
|
668
|
+
return T(() => e.menu.isOpen, (e) => {
|
|
669
|
+
e ? m() : p();
|
|
670
|
+
}), T(() => e.menu.placement, () => {
|
|
671
|
+
a();
|
|
672
|
+
}), _(() => {
|
|
673
|
+
e.menu.isOpen && m();
|
|
674
|
+
}), g(() => {
|
|
675
|
+
p();
|
|
676
|
+
}), () => u("div", {
|
|
677
|
+
ref: "el",
|
|
678
|
+
class: ["vue-treeselect__portal-target", e.wrapperClass],
|
|
679
|
+
style: { zIndex: e.zIndex },
|
|
680
|
+
"data-instance-id": e.getInstanceId()
|
|
681
|
+
}, [u(Re, { ref: "menu" }, null)]);
|
|
682
|
+
}
|
|
683
|
+
}, Be = {
|
|
684
|
+
name: "VueTreeSelectMenuPortal",
|
|
685
|
+
setup(e, { expose: t }) {
|
|
686
|
+
return t({ portalTarget: w("portalTarget") }), () => u(n, { to: "body" }, { default: () => [u(ze, { ref: "portalTarget" }, null)] });
|
|
687
|
+
}
|
|
688
|
+
}, Ve = {
|
|
689
|
+
__name: "VueTreeSelect",
|
|
690
|
+
props: {
|
|
691
|
+
...e,
|
|
692
|
+
disabled: {
|
|
693
|
+
type: Boolean,
|
|
694
|
+
default: void 0
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
emits: [
|
|
698
|
+
"update:modelValue",
|
|
699
|
+
"search-change",
|
|
700
|
+
"close",
|
|
701
|
+
"open",
|
|
702
|
+
"deselect",
|
|
703
|
+
"select"
|
|
704
|
+
],
|
|
705
|
+
setup(e, { emit: t }) {
|
|
706
|
+
let n = e, r = t, i = te(), c = (e, t) => {
|
|
707
|
+
let n = 0;
|
|
708
|
+
do {
|
|
709
|
+
if (e.level < n) return -1;
|
|
710
|
+
if (t.level < n) return 1;
|
|
711
|
+
if (e.index[n] !== t.index[n]) return e.index[n] - t.index[n];
|
|
712
|
+
n++;
|
|
713
|
+
} while (!0);
|
|
714
|
+
}, l = (e, t) => e.level === t.level ? c(e, t) : e.level - t.level, d = () => ({
|
|
715
|
+
isLoaded: !1,
|
|
716
|
+
isLoading: !1,
|
|
717
|
+
loadingError: ""
|
|
718
|
+
}), f = (e) => typeof e == "string" ? e : typeof e == "number" && !oe(e) ? `${e}` : "", p = (e, t, n) => e ? fe(t, n) : ue(n, t), v = (e) => e.message || String(e), w = x({
|
|
719
|
+
isFocused: !1,
|
|
720
|
+
searchQuery: ""
|
|
721
|
+
}), D = x({
|
|
722
|
+
isOpen: !1,
|
|
723
|
+
current: null,
|
|
724
|
+
lastScrollPosition: 0,
|
|
725
|
+
placement: "bottom"
|
|
726
|
+
}), re = () => n.modelValue == null ? [] : n.valueFormat === "id" ? n.multiple ? n.modelValue.slice() : [n.modelValue] : (n.multiple ? n.modelValue : [n.modelValue]).map((e) => lt(e)).map((e) => e.id), A = x({
|
|
727
|
+
normalizedOptions: [],
|
|
728
|
+
nodeMap: N(),
|
|
729
|
+
checkedStateMap: N(),
|
|
730
|
+
selectedNodeIds: re(),
|
|
731
|
+
selectedNodeMap: N()
|
|
732
|
+
}), j = x(d()), M = x({
|
|
733
|
+
active: !1,
|
|
734
|
+
noResults: !0,
|
|
735
|
+
countMap: N()
|
|
736
|
+
}), P = x(N()), se = a(() => A.selectedNodeIds.map(W)), F = a(() => {
|
|
737
|
+
let e;
|
|
738
|
+
if (L.value || n.flat || n.disableBranchNodes || n.valueConsistsOf === "ALL") e = A.selectedNodeIds.slice();
|
|
739
|
+
else if (n.valueConsistsOf === "BRANCH_PRIORITY") e = A.selectedNodeIds.filter((e) => {
|
|
740
|
+
let t = W(e);
|
|
741
|
+
return t.isRootNode ? !0 : !G(t.parentNode);
|
|
742
|
+
});
|
|
743
|
+
else if (n.valueConsistsOf === "LEAF_PRIORITY") e = A.selectedNodeIds.filter((e) => {
|
|
744
|
+
let t = W(e);
|
|
745
|
+
return t.isLeaf ? !0 : t.children.length === 0;
|
|
746
|
+
});
|
|
747
|
+
else if (n.valueConsistsOf === "ALL_WITH_INDETERMINATE") {
|
|
748
|
+
let t = [];
|
|
749
|
+
e = A.selectedNodeIds.slice(), se.value.forEach((n) => {
|
|
750
|
+
n.ancestors.forEach((n) => {
|
|
751
|
+
ue(t, n.id) || ue(e, n.id) || t.push(n.id);
|
|
752
|
+
});
|
|
753
|
+
}), e.push(...t);
|
|
754
|
+
}
|
|
755
|
+
return n.sortValueBy === "LEVEL" ? e.sort((e, t) => l(W(e), W(t))) : n.sortValueBy === "INDEX" && e.sort((e, t) => c(W(e), W(t))), e;
|
|
756
|
+
}), I = a(() => F.value.length > 0), L = a(() => !n.multiple), R = a(() => {
|
|
757
|
+
let e = [];
|
|
758
|
+
return Y((t) => {
|
|
759
|
+
if ((!M.active || Je(t)) && e.push(t.id), t.isBranch && !qe(t)) return !1;
|
|
760
|
+
}), e;
|
|
761
|
+
}), z = a(() => R.value.length !== 0), pe = a(() => typeof n.showCountOnSearch == "boolean" ? n.showCountOnSearch : n.showCount), me = a(() => A.normalizedOptions.some((e) => e.isBranch)), he = a(() => M.active && n.flattenSearchResults), ge = a(() => ({
|
|
762
|
+
"vue-treeselect": !0,
|
|
763
|
+
"vue-treeselect--single": L.value,
|
|
764
|
+
"vue-treeselect--multi": n.multiple,
|
|
765
|
+
"vue-treeselect--searchable": n.searchable,
|
|
766
|
+
"vue-treeselect--disabled": n.disabled,
|
|
767
|
+
"vue-treeselect--focused": w.isFocused,
|
|
768
|
+
"vue-treeselect--has-value": I.value,
|
|
769
|
+
"vue-treeselect--open": D.isOpen,
|
|
770
|
+
"vue-treeselect--open-above": D.placement === "top",
|
|
771
|
+
"vue-treeselect--open-below": D.placement === "bottom",
|
|
772
|
+
"vue-treeselect--branch-nodes-disabled": n.disableBranchNodes,
|
|
773
|
+
"vue-treeselect--append-to-body": n.appendToBody
|
|
774
|
+
})), _e = S(!1), B = S(null), Te = S(null), Ee = S(null), Oe = S(null), H = () => {
|
|
775
|
+
let e = n.async ? Ke().options : n.options;
|
|
776
|
+
if (Array.isArray(e)) {
|
|
777
|
+
let t = A.nodeMap;
|
|
778
|
+
A.nodeMap = N(), Pe(t), A.normalizedOptions = ut(null, e, t), Ct(F.value);
|
|
779
|
+
} else A.normalizedOptions = [];
|
|
780
|
+
}, U = () => n.instanceId == null ? n.id : n.instanceId, ke = () => {
|
|
781
|
+
if (n.valueFormat === "id") return n.multiple ? F.value.slice() : F.value[0];
|
|
782
|
+
let e = F.value.map((e) => W(e).raw);
|
|
783
|
+
return n.multiple ? e : e[0];
|
|
784
|
+
}, W = (e) => (O(() => e != null, () => `Invalid node id: ${e}`), e == null ? null : e in A.nodeMap ? A.nodeMap[e] : Ae(e)), Ae = (e) => {
|
|
785
|
+
let t = je(e), n = {
|
|
786
|
+
id: e,
|
|
787
|
+
label: lt(t).label || `${e} (unknown)`,
|
|
788
|
+
ancestors: [],
|
|
789
|
+
parentNode: null,
|
|
790
|
+
isFallbackNode: !0,
|
|
791
|
+
isRootNode: !0,
|
|
792
|
+
isLeaf: !0,
|
|
793
|
+
isBranch: !1,
|
|
794
|
+
isDisabled: !1,
|
|
795
|
+
isNew: !1,
|
|
796
|
+
index: [-1],
|
|
797
|
+
level: 0,
|
|
798
|
+
raw: t
|
|
799
|
+
};
|
|
800
|
+
return A.nodeMap[e] = n;
|
|
801
|
+
}, je = (e) => {
|
|
802
|
+
let t = { id: e };
|
|
803
|
+
return n.valueFormat === "id" ? t : ce(n.multiple ? Array.isArray(n.modelValue) ? n.modelValue : [] : n.modelValue ? [n.modelValue] : [], (t) => t && lt(t).id === e) || t;
|
|
804
|
+
}, Me = () => {
|
|
805
|
+
O(() => n.async ? n.searchable : !0, () => "For async search mode, the value of \"searchable\" prop must be true."), n.options == null && !n.loadOptions && O(() => !1, () => "Are you meant to dynamically load options? You need to use \"loadOptions\" prop."), n.flat && O(() => n.multiple, () => "You are using flat mode. But you forgot to add \"multiple=true\"?"), n.flat || [
|
|
806
|
+
"autoSelectAncestors",
|
|
807
|
+
"autoSelectDescendants",
|
|
808
|
+
"autoDeselectAncestors",
|
|
809
|
+
"autoDeselectDescendants"
|
|
810
|
+
].forEach((e) => {
|
|
811
|
+
O(() => !n[e], () => `"${e}" only applies to flat mode.`);
|
|
812
|
+
});
|
|
813
|
+
}, Ne = () => {
|
|
814
|
+
_e.value = !1;
|
|
815
|
+
}, Pe = (e) => {
|
|
816
|
+
A.selectedNodeIds.forEach((t) => {
|
|
817
|
+
if (!e[t]) return;
|
|
818
|
+
let n = {
|
|
819
|
+
...e[t],
|
|
820
|
+
isFallbackNode: !0
|
|
821
|
+
};
|
|
822
|
+
A.nodeMap[t] = n;
|
|
823
|
+
});
|
|
824
|
+
}, G = (e) => A.selectedNodeMap[e.id] === !0, K = (e, t) => {
|
|
825
|
+
if (!e.isBranch) return;
|
|
826
|
+
let n = e.children.slice();
|
|
827
|
+
for (; n.length;) {
|
|
828
|
+
let e = n[0];
|
|
829
|
+
e.isBranch && n.push(...e.children), t(e), n.shift();
|
|
830
|
+
}
|
|
831
|
+
}, q = (e, t) => {
|
|
832
|
+
e.isBranch && e.children.forEach((e) => {
|
|
833
|
+
q(e, t), t(e);
|
|
834
|
+
});
|
|
835
|
+
}, J = (e) => {
|
|
836
|
+
A.normalizedOptions.forEach((t) => {
|
|
837
|
+
q(t, e), e(t);
|
|
838
|
+
});
|
|
839
|
+
}, Y = (e) => {
|
|
840
|
+
let t = (n) => {
|
|
841
|
+
n.children.forEach((n) => {
|
|
842
|
+
e(n) !== !1 && n.isBranch && t(n);
|
|
843
|
+
});
|
|
844
|
+
};
|
|
845
|
+
t({ children: A.normalizedOptions });
|
|
846
|
+
}, X = (e) => {
|
|
847
|
+
e ? document.addEventListener("mousedown", Ue, !1) : document.removeEventListener("mousedown", Ue, !1);
|
|
848
|
+
}, Ie = () => {
|
|
849
|
+
var e;
|
|
850
|
+
return (e = Te.value) == null ? void 0 : e.container;
|
|
851
|
+
}, Le = () => {
|
|
852
|
+
var e;
|
|
853
|
+
return (e = Te.value) == null || (e = e.valueContainer) == null ? void 0 : e.input;
|
|
854
|
+
}, ze = () => {
|
|
855
|
+
var e;
|
|
856
|
+
(e = Le()) == null || e.focus();
|
|
857
|
+
}, Ve = () => {
|
|
858
|
+
var e;
|
|
859
|
+
(e = Le()) == null || e.blur();
|
|
860
|
+
}, He = k((e) => {
|
|
861
|
+
var t;
|
|
862
|
+
e.preventDefault(), e.stopPropagation(), !n.disabled && ((t = Ie()) != null && t.contains(e.target) && !D.isOpen && (n.openOnClick || w.isFocused) && at(), _e.value ? Ve() : ze(), Ne());
|
|
863
|
+
}), Ue = (e) => {
|
|
864
|
+
B.value && !B.value.contains(e.target) && (Ve(), Z());
|
|
865
|
+
}, We = () => {
|
|
866
|
+
let { searchQuery: e } = w, t = () => $e(!0);
|
|
867
|
+
if (!e) return M.active = !1, t();
|
|
868
|
+
M.active = !0, M.noResults = !0, J((e) => {
|
|
869
|
+
e.isBranch && (e.isExpandedOnSearch = !1, e.showAllChildrenOnSearch = !1, e.isMatched = !1, e.hasMatchedDescendants = !1, M.countMap[e.id] = {
|
|
870
|
+
[ve]: 0,
|
|
871
|
+
[ye]: 0,
|
|
872
|
+
[be]: 0,
|
|
873
|
+
[xe]: 0
|
|
874
|
+
});
|
|
875
|
+
});
|
|
876
|
+
let r = e.trim().toLocaleLowerCase(), i = r.replace(/\s+/g, " ").split(" ");
|
|
877
|
+
J((e) => {
|
|
878
|
+
n.searchNested && i.length > 1 ? e.isMatched = i.every((t) => p(!1, t, e.nestedSearchLabel)) : e.isMatched = n.matchKeys.some((t) => p(!n.disableFuzzyMatching, r, e.lowerCased[t])), e.isMatched && (M.noResults = !1, e.ancestors.forEach((e) => M.countMap[e.id][ye]++), e.isLeaf && e.ancestors.forEach((e) => M.countMap[e.id][xe]++), e.parentNode !== null && (M.countMap[e.parentNode.id][ve] += 1, e.isLeaf && (M.countMap[e.parentNode.id][be] += 1))), (e.isMatched || e.isBranch && e.isExpandedOnSearch) && e.parentNode !== null && (e.parentNode.isExpandedOnSearch = !0, e.parentNode.hasMatchedDescendants = !0);
|
|
879
|
+
}), t();
|
|
880
|
+
}, Ge = () => {
|
|
881
|
+
let { searchQuery: e } = w, t = Ke(), r = () => {
|
|
882
|
+
H(), $e(!0);
|
|
883
|
+
};
|
|
884
|
+
if ((e === "" || n.cacheOptions) && t.isLoaded) return r();
|
|
885
|
+
pt({
|
|
886
|
+
action: we,
|
|
887
|
+
args: { searchQuery: e },
|
|
888
|
+
isPending() {
|
|
889
|
+
return t.isLoading;
|
|
890
|
+
},
|
|
891
|
+
start: () => {
|
|
892
|
+
t.isLoading = !0, t.isLoaded = !1, t.loadingError = "";
|
|
893
|
+
},
|
|
894
|
+
succeed: (n) => {
|
|
895
|
+
t.isLoaded = !0, t.options = n, w.searchQuery === e && r();
|
|
896
|
+
},
|
|
897
|
+
fail: (e) => {
|
|
898
|
+
t.loadingError = v(e);
|
|
899
|
+
},
|
|
900
|
+
end: () => {
|
|
901
|
+
t.isLoading = !1;
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
}, Ke = () => {
|
|
905
|
+
let { searchQuery: e } = w, t = P[e] || {
|
|
906
|
+
...d(),
|
|
907
|
+
options: []
|
|
908
|
+
};
|
|
909
|
+
if (e === "") {
|
|
910
|
+
if (Array.isArray(n.defaultOptions)) return t.options = n.defaultOptions, t.isLoaded = !0, t;
|
|
911
|
+
if (n.defaultOptions !== !0) return t.isLoaded = !0, t;
|
|
912
|
+
}
|
|
913
|
+
return P[e] || (P[e] = t), t;
|
|
914
|
+
}, qe = (e) => M.active ? e.isExpandedOnSearch : e.isExpanded, Je = (e) => !!(e.isMatched || e.isBranch && e.hasMatchedDescendants && !n.flattenSearchResults || !e.isRootNode && e.parentNode.showAllChildrenOnSearch), Ye = (e) => !(M.active && !Je(e)), Xe = () => {
|
|
915
|
+
var e;
|
|
916
|
+
return (e = Te.value) == null ? void 0 : e.$el;
|
|
917
|
+
}, Ze = () => {
|
|
918
|
+
var e, t;
|
|
919
|
+
let r = n.appendToBody ? (e = Ee.value) == null ? void 0 : e.portalTarget : B.value, i = r == null || (t = r.$refs) == null || (t = t.menu) == null || (t = t.$refs) == null ? void 0 : t.menu;
|
|
920
|
+
return i && i.nodeName !== "#comment" ? i : null;
|
|
921
|
+
}, Qe = (e, t = !0) => {
|
|
922
|
+
let n = D.current;
|
|
923
|
+
if (n != null && n in A.nodeMap && (A.nodeMap[n].isHighlighted = !1), D.current = e.id, e.isHighlighted = !0, D.isOpen && t) {
|
|
924
|
+
let t = () => {
|
|
925
|
+
let t = Ze(), n = t == null ? void 0 : t.querySelector(`.vue-treeselect__option[data-id="${e.id}"]`);
|
|
926
|
+
n && ae(t, n);
|
|
927
|
+
};
|
|
928
|
+
Ze() ? t() : m(t);
|
|
929
|
+
}
|
|
930
|
+
}, $e = (e = !1) => {
|
|
931
|
+
let { current: t } = D;
|
|
932
|
+
(e || t == null || !(t in A.nodeMap) || !Ye(W(t))) && et();
|
|
933
|
+
}, et = () => {
|
|
934
|
+
if (!z.value) return;
|
|
935
|
+
let e = R.value[0];
|
|
936
|
+
Qe(W(e));
|
|
937
|
+
}, tt = () => {
|
|
938
|
+
if (!z.value) return;
|
|
939
|
+
let e = R.value.indexOf(D.current) - 1;
|
|
940
|
+
if (e === -1) return rt();
|
|
941
|
+
Qe(W(R.value[e]));
|
|
942
|
+
}, nt = () => {
|
|
943
|
+
if (!z.value) return;
|
|
944
|
+
let e = R.value.indexOf(D.current) + 1;
|
|
945
|
+
if (e === R.value.length) return et();
|
|
946
|
+
Qe(W(R.value[e]));
|
|
947
|
+
}, rt = () => {
|
|
948
|
+
z.value && Qe(W(ne(R.value)));
|
|
949
|
+
}, it = () => {
|
|
950
|
+
w.searchQuery = "";
|
|
951
|
+
}, Z = () => {
|
|
952
|
+
!D.isOpen || !n.disabled && n.alwaysOpen || (xt(), D.isOpen = !1, X(!1), it(), r("close", ke(), U()));
|
|
953
|
+
}, at = () => {
|
|
954
|
+
n.disabled || D.isOpen || (D.isOpen = !0, m($e), m(St), !n.options && !n.async && dt(), X(!0), r("open", U()));
|
|
955
|
+
}, ot = () => {
|
|
956
|
+
D.isOpen ? Z() : at();
|
|
957
|
+
}, st = (e) => {
|
|
958
|
+
let t;
|
|
959
|
+
M.active ? (t = e.isExpandedOnSearch = !e.isExpandedOnSearch, t && (e.showAllChildrenOnSearch = !0)) : t = e.isExpanded = !e.isExpanded, t && !e.childrenStates.isLoaded && ft(e);
|
|
960
|
+
}, ct = () => {
|
|
961
|
+
let e = N();
|
|
962
|
+
A.selectedNodeIds.forEach((t) => {
|
|
963
|
+
e[t] = !0;
|
|
964
|
+
}), A.selectedNodeMap = e;
|
|
965
|
+
let t = N();
|
|
966
|
+
n.multiple && (Y((e) => {
|
|
967
|
+
t[e.id] = 0;
|
|
968
|
+
}), se.value.forEach((e) => {
|
|
969
|
+
t[e.id] = 2, !n.flat && !n.disableBranchNodes && e.ancestors.forEach((e) => {
|
|
970
|
+
G(e) || (t[e.id] = 1);
|
|
971
|
+
});
|
|
972
|
+
})), A.checkedStateMap = t;
|
|
973
|
+
}, lt = (e) => ({
|
|
974
|
+
...e,
|
|
975
|
+
...n.normalizer(e, U())
|
|
976
|
+
}), ut = (e, t, r) => {
|
|
977
|
+
let i = t.map((e) => [lt(e), e]).map(([t, i], a) => {
|
|
978
|
+
mt(t), ht(t);
|
|
979
|
+
let { id: o, label: s, children: c, isDefaultExpanded: l } = t, u = e === null, p = u ? 0 : e.level + 1, m = Array.isArray(c) || c === null, h = !m, g = !!t.isDisabled || !n.flat && !u && e.isDisabled, _ = !!t.isNew, v = n.matchKeys.reduce((e, n) => ({
|
|
980
|
+
...e,
|
|
981
|
+
[n]: f(t[n]).toLocaleLowerCase()
|
|
982
|
+
}), {}), y = u ? v.label : `${e.nestedSearchLabel} ${v.label}`;
|
|
983
|
+
A.nodeMap[o] = N();
|
|
984
|
+
let b = A.nodeMap[o];
|
|
985
|
+
if (b.id = o, b.label = s, b.level = p, b.ancestors = u ? [] : [e].concat(e.ancestors), b.index = (u ? [] : e.index).concat(a), b.parentNode = e, b.lowerCased = v, b.nestedSearchLabel = y, b.isDisabled = g, b.isNew = _, b.isMatched = !1, b.isHighlighted = !1, b.isBranch = m, b.isLeaf = h, b.isRootNode = u, b.raw = i, m) {
|
|
986
|
+
let e = Array.isArray(c);
|
|
987
|
+
b.childrenStates = {
|
|
988
|
+
...d(),
|
|
989
|
+
isLoaded: e
|
|
990
|
+
}, b.isExpanded = typeof l == "boolean" ? l : p < n.defaultExpandLevel, b.hasMatchedDescendants = !1, b.hasDisabledDescendants = !1, b.isExpandedOnSearch = !1, b.showAllChildrenOnSearch = !1, b.count = {
|
|
991
|
+
[ve]: 0,
|
|
992
|
+
[ye]: 0,
|
|
993
|
+
[be]: 0,
|
|
994
|
+
[xe]: 0
|
|
995
|
+
}, b.children = e ? ut(b, c, r) : [], l === !0 && b.ancestors.forEach((e) => {
|
|
996
|
+
e.isExpanded = !0;
|
|
997
|
+
}), !e && typeof n.loadOptions != "function" ? O(() => !1, () => "Unloaded branch node detected. \"loadOptions\" prop is required to load its children.") : !e && b.isExpanded && ft(b);
|
|
998
|
+
}
|
|
999
|
+
if (b.ancestors.forEach((e) => e.count[ye]++), h && b.ancestors.forEach((e) => e.count[xe]++), u || (e.count[ve] += 1, h && (e.count[be] += 1), g && (e.hasDisabledDescendants = !0)), r && r[o]) {
|
|
1000
|
+
let e = r[o];
|
|
1001
|
+
b.isMatched = e.isMatched, b.showAllChildrenOnSearch = e.showAllChildrenOnSearch, b.isHighlighted = e.isHighlighted, e.isBranch && b.isBranch && (b.isExpanded = e.isExpanded, b.isExpandedOnSearch = e.isExpandedOnSearch, e.childrenStates.isLoaded && !b.childrenStates.isLoaded ? b.isExpanded = !1 : b.childrenStates = { ...e.childrenStates });
|
|
1002
|
+
}
|
|
1003
|
+
return b;
|
|
1004
|
+
});
|
|
1005
|
+
if (n.branchNodesFirst) {
|
|
1006
|
+
let e = i.filter((e) => e.isBranch), t = i.filter((e) => e.isLeaf);
|
|
1007
|
+
i = e.concat(t);
|
|
1008
|
+
}
|
|
1009
|
+
return i;
|
|
1010
|
+
}, dt = () => {
|
|
1011
|
+
pt({
|
|
1012
|
+
action: Se,
|
|
1013
|
+
isPending: () => j.isLoading,
|
|
1014
|
+
start: () => {
|
|
1015
|
+
j.isLoading = !0, j.loadingError = "";
|
|
1016
|
+
},
|
|
1017
|
+
succeed: () => {
|
|
1018
|
+
j.isLoaded = !0, m(() => {
|
|
1019
|
+
$e(!0);
|
|
1020
|
+
});
|
|
1021
|
+
},
|
|
1022
|
+
fail: (e) => {
|
|
1023
|
+
j.loadingError = v(e);
|
|
1024
|
+
},
|
|
1025
|
+
end: () => {
|
|
1026
|
+
j.isLoading = !1;
|
|
1027
|
+
}
|
|
1028
|
+
});
|
|
1029
|
+
}, ft = (e) => {
|
|
1030
|
+
let { id: t, raw: n } = e;
|
|
1031
|
+
pt({
|
|
1032
|
+
action: Ce,
|
|
1033
|
+
args: { parentNode: n },
|
|
1034
|
+
isPending: () => W(t).childrenStates.isLoading,
|
|
1035
|
+
start: () => {
|
|
1036
|
+
W(t).childrenStates.isLoading = !0, W(t).childrenStates.loadingError = "";
|
|
1037
|
+
},
|
|
1038
|
+
succeed: () => {
|
|
1039
|
+
W(t).childrenStates.isLoaded = !0;
|
|
1040
|
+
},
|
|
1041
|
+
fail: (e) => {
|
|
1042
|
+
W(t).childrenStates.loadingError = v(e);
|
|
1043
|
+
},
|
|
1044
|
+
end: () => {
|
|
1045
|
+
W(t).childrenStates.isLoading = !1;
|
|
1046
|
+
}
|
|
1047
|
+
});
|
|
1048
|
+
}, pt = ({ action: e, args: t, isPending: r, start: i, succeed: a, fail: o, end: s }) => {
|
|
1049
|
+
if (!n.loadOptions || r()) return;
|
|
1050
|
+
i();
|
|
1051
|
+
let c = ie((e, t) => {
|
|
1052
|
+
e ? o(e) : a(t), s();
|
|
1053
|
+
}), l = n.loadOptions({
|
|
1054
|
+
id: U(),
|
|
1055
|
+
instanceId: U(),
|
|
1056
|
+
action: e,
|
|
1057
|
+
...t,
|
|
1058
|
+
callback: c
|
|
1059
|
+
});
|
|
1060
|
+
E(l) && l.then(() => {
|
|
1061
|
+
c();
|
|
1062
|
+
}, (e) => {
|
|
1063
|
+
c(e);
|
|
1064
|
+
}).catch((e) => {
|
|
1065
|
+
console.error(e);
|
|
1066
|
+
});
|
|
1067
|
+
}, mt = (e) => {
|
|
1068
|
+
O(() => !(e.id in A.nodeMap && !A.nodeMap[e.id].isFallbackNode), () => `Detected duplicate presence of node id ${JSON.stringify(e.id)}. Their labels are "${A.nodeMap[e.id].label}" and "${e.label}" respectively.`);
|
|
1069
|
+
}, ht = (e) => {
|
|
1070
|
+
O(() => !(e.children === void 0 && e.isBranch === !0), () => "Are you meant to declare an unloaded branch node? `isBranch: true` is no longer supported, please use `children: null` instead.");
|
|
1071
|
+
}, gt = (e) => {
|
|
1072
|
+
if (n.disabled || e.isDisabled) return;
|
|
1073
|
+
L.value && _t();
|
|
1074
|
+
let t = n.multiple && !n.flat ? A.checkedStateMap[e.id] === 0 : !G(e);
|
|
1075
|
+
t ? vt(e) : yt(e), ct(), r(t ? "select" : "deselect", e.raw, U()), M.active && t && (L.value || n.clearOnSelect) && it(), L.value && n.closeOnSelect && (Z(), n.searchable && (_e.value = !0));
|
|
1076
|
+
}, _t = () => {
|
|
1077
|
+
I.value && (L.value || n.allowClearingDisabled ? A.selectedNodeIds = [] : A.selectedNodeIds = A.selectedNodeIds.filter((e) => W(e).isDisabled), ct());
|
|
1078
|
+
}, vt = (e) => {
|
|
1079
|
+
if (L.value || n.disableBranchNodes) return Q(e);
|
|
1080
|
+
if (n.flat) {
|
|
1081
|
+
Q(e), n.autoSelectAncestors ? e.ancestors.forEach((e) => {
|
|
1082
|
+
!G(e) && !e.isDisabled && Q(e);
|
|
1083
|
+
}) : n.autoSelectDescendants && K(e, (e) => {
|
|
1084
|
+
!G(e) && !e.isDisabled && Q(e);
|
|
1085
|
+
});
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
let t = e.isLeaf || !e.hasDisabledDescendants || n.allowSelectingDisabledDescendants;
|
|
1089
|
+
if (t && Q(e), e.isBranch && K(e, (e) => {
|
|
1090
|
+
(!e.isDisabled || n.allowSelectingDisabledDescendants) && Q(e);
|
|
1091
|
+
}), t) {
|
|
1092
|
+
let t = e;
|
|
1093
|
+
for (; (t = t.parentNode) !== null && t.children.every(G);) Q(t);
|
|
1094
|
+
}
|
|
1095
|
+
}, yt = (e) => {
|
|
1096
|
+
if (n.disableBranchNodes) return $(e);
|
|
1097
|
+
if (n.flat) {
|
|
1098
|
+
$(e), n.autoDeselectAncestors ? e.ancestors.forEach((e) => {
|
|
1099
|
+
G(e) && !e.isDisabled && $(e);
|
|
1100
|
+
}) : n.autoDeselectDescendants && K(e, (e) => {
|
|
1101
|
+
G(e) && !e.isDisabled && $(e);
|
|
1102
|
+
});
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
let t = !1;
|
|
1106
|
+
if (e.isBranch && q(e, (e) => {
|
|
1107
|
+
(!e.isDisabled || n.allowSelectingDisabledDescendants) && ($(e), t = !0);
|
|
1108
|
+
}), e.isLeaf || t || e.children.length === 0) {
|
|
1109
|
+
$(e);
|
|
1110
|
+
let t = e;
|
|
1111
|
+
for (; (t = t.parentNode) !== null && G(t);) $(t);
|
|
1112
|
+
}
|
|
1113
|
+
}, Q = (e) => {
|
|
1114
|
+
A.selectedNodeIds.push(e.id), A.selectedNodeMap[e.id] = !0;
|
|
1115
|
+
}, $ = (e) => {
|
|
1116
|
+
le(A.selectedNodeIds, e.id), delete A.selectedNodeMap[e.id];
|
|
1117
|
+
}, bt = () => {
|
|
1118
|
+
if (I.value) {
|
|
1119
|
+
if (L.value) return _t();
|
|
1120
|
+
gt(W(ne(F.value)));
|
|
1121
|
+
}
|
|
1122
|
+
}, xt = () => {
|
|
1123
|
+
let e = Ze();
|
|
1124
|
+
e && (D.lastScrollPosition = e.scrollTop);
|
|
1125
|
+
}, St = () => {
|
|
1126
|
+
let e = Ze();
|
|
1127
|
+
e && (e.scrollTop = D.lastScrollPosition);
|
|
1128
|
+
}, Ct = (e) => {
|
|
1129
|
+
let t = [];
|
|
1130
|
+
if (L.value || n.flat || n.disableBranchNodes || n.valueConsistsOf === "ALL") t = e;
|
|
1131
|
+
else if (n.valueConsistsOf === "BRANCH_PRIORITY") e.forEach((e) => {
|
|
1132
|
+
t.push(e);
|
|
1133
|
+
let n = W(e);
|
|
1134
|
+
n.isBranch && K(n, (e) => {
|
|
1135
|
+
t.push(e.id);
|
|
1136
|
+
});
|
|
1137
|
+
});
|
|
1138
|
+
else if (n.valueConsistsOf === "LEAF_PRIORITY") {
|
|
1139
|
+
let n = N(), r = e.slice();
|
|
1140
|
+
for (; r.length;) {
|
|
1141
|
+
let e = r.shift(), i = W(e);
|
|
1142
|
+
t.push(e), !i.isRootNode && (i.parentNode.id in n || (n[i.parentNode.id] = i.parentNode.children.length), --n[i.parentNode.id] === 0 && r.push(i.parentNode.id));
|
|
1143
|
+
}
|
|
1144
|
+
} else if (n.valueConsistsOf === "ALL_WITH_INDETERMINATE") {
|
|
1145
|
+
let n = N(), r = e.filter((e) => {
|
|
1146
|
+
let t = W(e);
|
|
1147
|
+
return t.isLeaf || t.children.length === 0;
|
|
1148
|
+
});
|
|
1149
|
+
for (; r.length;) {
|
|
1150
|
+
let e = r.shift(), i = W(e);
|
|
1151
|
+
t.push(e), !i.isRootNode && (i.parentNode.id in n || (n[i.parentNode.id] = i.parentNode.children.length), --n[i.parentNode.id] === 0 && r.push(i.parentNode.id));
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
de(A.selectedNodeIds, t) && (A.selectedNodeIds = t), ct();
|
|
1155
|
+
};
|
|
1156
|
+
return T(() => n.alwaysOpen, (e) => {
|
|
1157
|
+
e ? at() : Z();
|
|
1158
|
+
}), T(() => n.branchNodesFirst, () => {
|
|
1159
|
+
H();
|
|
1160
|
+
}), T(() => n.disabled, (e) => {
|
|
1161
|
+
e && D.isOpen ? Z() : !e && !D.isOpen && n.alwaysOpen && at();
|
|
1162
|
+
}), T(() => n.flat, () => {
|
|
1163
|
+
H();
|
|
1164
|
+
}), T(F, (e, t) => {
|
|
1165
|
+
de(e, t) && r("update:modelValue", ke(), U());
|
|
1166
|
+
}), T(() => n.matchKeys, () => {
|
|
1167
|
+
H();
|
|
1168
|
+
}), T(() => n.multiple, (e) => {
|
|
1169
|
+
e && ct();
|
|
1170
|
+
}), T(() => n.options, () => {
|
|
1171
|
+
n.async || (H(), j.isLoaded = Array.isArray(n.options));
|
|
1172
|
+
}, {
|
|
1173
|
+
deep: !0,
|
|
1174
|
+
immediate: !0
|
|
1175
|
+
}), T(() => w.searchQuery, () => {
|
|
1176
|
+
n.async ? Ge() : We(), r("search-change", w.searchQuery, U());
|
|
1177
|
+
}), T(() => n.modelValue, () => {
|
|
1178
|
+
let e = re();
|
|
1179
|
+
de(e, F.value) && Ct(e);
|
|
1180
|
+
}), b(V, x({
|
|
1181
|
+
...C(n),
|
|
1182
|
+
$slots: i,
|
|
1183
|
+
trigger: w,
|
|
1184
|
+
menu: D,
|
|
1185
|
+
forest: A,
|
|
1186
|
+
rootOptionsStates: j,
|
|
1187
|
+
localSearch: M,
|
|
1188
|
+
remoteSearch: P,
|
|
1189
|
+
selectedNodes: se,
|
|
1190
|
+
internalValue: F,
|
|
1191
|
+
hasValue: I,
|
|
1192
|
+
single: L,
|
|
1193
|
+
visibleOptionIds: R,
|
|
1194
|
+
hasVisibleOptions: z,
|
|
1195
|
+
showCountOnSearchComputed: pe,
|
|
1196
|
+
hasBranchNodes: me,
|
|
1197
|
+
shouldFlattenOptions: he,
|
|
1198
|
+
getInstanceId: U,
|
|
1199
|
+
getValue: ke,
|
|
1200
|
+
getNode: W,
|
|
1201
|
+
createFallbackNode: Ae,
|
|
1202
|
+
extractCheckedNodeIdsFromValue: re,
|
|
1203
|
+
extractNodeFromValue: je,
|
|
1204
|
+
verifyProps: Me,
|
|
1205
|
+
resetFlags: Ne,
|
|
1206
|
+
initialize: H,
|
|
1207
|
+
keepDataOfSelectedNodes: Pe,
|
|
1208
|
+
isSelected: G,
|
|
1209
|
+
traverseDescendantsBFS: K,
|
|
1210
|
+
traverseDescendantsDFS: q,
|
|
1211
|
+
traverseAllNodesDFS: J,
|
|
1212
|
+
traverseAllNodesByIndex: Y,
|
|
1213
|
+
toggleClickOutsideEvent: X,
|
|
1214
|
+
getContainer: Ie,
|
|
1215
|
+
getInput: Le,
|
|
1216
|
+
focusInput: ze,
|
|
1217
|
+
blurInput: Ve,
|
|
1218
|
+
handleMouseDown: He,
|
|
1219
|
+
handleClickOutside: Ue,
|
|
1220
|
+
handleLocalSearch: We,
|
|
1221
|
+
handleRemoteSearch: Ge,
|
|
1222
|
+
getRemoteSearchEntry: Ke,
|
|
1223
|
+
shouldExpand: qe,
|
|
1224
|
+
shouldOptionBeIncludedInSearchResult: Je,
|
|
1225
|
+
shouldShowOptionInMenu: Ye,
|
|
1226
|
+
getControl: Xe,
|
|
1227
|
+
getMenu: Ze,
|
|
1228
|
+
setCurrentHighlightedOption: Qe,
|
|
1229
|
+
resetHighlightedOptionWhenNecessary: $e,
|
|
1230
|
+
highlightFirstOption: et,
|
|
1231
|
+
highlightPrevOption: tt,
|
|
1232
|
+
highlightNextOption: nt,
|
|
1233
|
+
highlightLastOption: rt,
|
|
1234
|
+
resetSearchQuery: it,
|
|
1235
|
+
closeMenu: Z,
|
|
1236
|
+
openMenu: at,
|
|
1237
|
+
toggleMenu: ot,
|
|
1238
|
+
toggleExpanded: st,
|
|
1239
|
+
buildForestState: ct,
|
|
1240
|
+
enhancedNormalizer: lt,
|
|
1241
|
+
normalize: ut,
|
|
1242
|
+
loadRootOptions: dt,
|
|
1243
|
+
loadChildrenOptions: ft,
|
|
1244
|
+
callLoadOptionsProp: pt,
|
|
1245
|
+
checkDuplication: mt,
|
|
1246
|
+
verifyNodeShape: ht,
|
|
1247
|
+
select: gt,
|
|
1248
|
+
clear: _t,
|
|
1249
|
+
addValue: Q,
|
|
1250
|
+
removeValue: $,
|
|
1251
|
+
removeLastValue: bt,
|
|
1252
|
+
saveMenuScrollPosition: xt,
|
|
1253
|
+
restoreMenuScrollPosition: St,
|
|
1254
|
+
fixSelectedNodeIds: Ct
|
|
1255
|
+
})), Me(), Ne(), _(() => {
|
|
1256
|
+
n.autoFocus && ze(), !n.options && !n.async && n.autoLoadRootOptions && dt(), n.alwaysOpen && at(), n.async && n.defaultOptions && Ge();
|
|
1257
|
+
}), g(() => {
|
|
1258
|
+
X(!1);
|
|
1259
|
+
}), (e, t) => (y(), s("div", {
|
|
1260
|
+
ref_key: "wrapperRef",
|
|
1261
|
+
ref: B,
|
|
1262
|
+
class: h(ee(ge))
|
|
1263
|
+
}, [
|
|
1264
|
+
u(De),
|
|
1265
|
+
u(Fe, {
|
|
1266
|
+
ref_key: "controlRef",
|
|
1267
|
+
ref: Te
|
|
1268
|
+
}, null, 512),
|
|
1269
|
+
e.appendToBody ? (y(), o(Be, {
|
|
1270
|
+
key: 0,
|
|
1271
|
+
ref_key: "portalRef",
|
|
1272
|
+
ref: Ee
|
|
1273
|
+
}, null, 512)) : (y(), o(Re, {
|
|
1274
|
+
key: 1,
|
|
1275
|
+
ref_key: "menuRef",
|
|
1276
|
+
ref: Oe
|
|
1277
|
+
}, null, 512))
|
|
1278
|
+
], 2));
|
|
1279
|
+
}
|
|
1280
|
+
};
|
|
1281
|
+
//#endregion
|
|
1282
|
+
export { Ve as t };
|