@night-owl-elite/vue-select 1.3.43 → 1.3.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue-select.css +1 -1
- package/dist/vue-select.es.js +341 -321
- package/dist/vue-select.umd.js +1 -1
- package/package.json +1 -1
package/dist/vue-select.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@keyframes spin-89f9b7e1{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.svg-icon-spin[data-v-89f9b7e1]{animation:spin-89f9b7e1 1s linear infinite}.list-group-item[data-v-
|
|
1
|
+
@keyframes spin-89f9b7e1{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.svg-icon-spin[data-v-89f9b7e1]{animation:spin-89f9b7e1 1s linear infinite}.tree-select-item-wrapper[data-v-3a344aeb]{position:relative}.list-group-item[data-v-3a344aeb]{cursor:pointer;border:0;border-radius:0;padding-top:.25rem;padding-bottom:.25rem;position:relative;min-height:2rem}.list-group-item.is-disabled[data-v-3a344aeb]{cursor:not-allowed;opacity:.65}.tree-indent[data-v-3a344aeb]{position:absolute;top:0;bottom:0;pointer-events:none}.tree-indent[data-v-3a344aeb]:before{content:"";position:absolute;top:50%;left:0;right:.35rem;height:1px;background-color:#dee2e6}.tree-indent[data-v-3a344aeb]:after{content:"";position:absolute;top:-50%;bottom:50%;left:0;width:1px;background-color:#dee2e6}.tree-indent.last-child-connector[data-v-3a344aeb]:after{height:100%;background-color:transparent;border-left:1px solid #dee2e6}.tree-select-item-wrapper.is-last-child>.list-group-item[data-v-3a344aeb]:before{content:"";position:absolute;left:0;bottom:0;top:50%;width:2px;background:#fff;z-index:1}.expander-icon[data-v-3a344aeb]{width:.85rem;height:.85rem;transition:transform .2s ease-in-out;color:#6c757d;z-index:2}.expander-placeholder[data-v-3a344aeb]{display:inline-block;width:.85rem}.rotate-90[data-v-3a344aeb]{transform:rotate(90deg)}.item-content[data-v-3a344aeb]{flex-grow:1;font-size:.9rem}.tree-select-main[data-v-880ba6da]{--bs-form-select-bg-img: none;display:block;width:100%;font-weight:400;line-height:1.5;color:var(--bs-body-color);appearance:none;background-color:var(--bs-body-bg);border:var(--bs-border-width) solid var(--bs-border-color);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;text-align:left}.tree-select-display-container[data-v-880ba6da]{flex:1;overflow:hidden}.transition-transform[data-v-880ba6da]{transition:transform .2s ease-in-out}.rotate-180[data-v-880ba6da]{transform:rotate(180deg)}.tree-select-dropdown[data-v-880ba6da]{position:absolute;background:#fff;border:1px solid rgba(0,0,0,.15);border-radius:.375rem}.is-loading[data-v-880ba6da]{cursor:wait}.loading-icon[data-v-880ba6da]{animation:spin-880ba6da 1s linear infinite}.clear-icon[data-v-880ba6da]{cursor:pointer;opacity:.6;transition:opacity .2s ease}.clear-icon[data-v-880ba6da]:hover{opacity:1}.tooltip-trigger-icon[data-v-880ba6da]{cursor:pointer;opacity:.6;transition:opacity .2s ease;width:1em;height:1em}.tooltip-trigger-icon[data-v-880ba6da]:hover{opacity:1}@keyframes spin-880ba6da{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.btn-xl[data-v-880ba6da]{padding:.75rem 1.5rem;font-size:1.25rem;border-radius:var(--bs-border-radius-lg)}.form-control-xl[data-v-880ba6da]{min-height:calc(1.5em + 1.5rem + (var(--bs-border-width) * 2));padding:.75rem 1.5rem;font-size:1.25rem;border-radius:var(--bs-border-radius-lg)}.tree-select-body[data-v-880ba6da]::-webkit-scrollbar{width:6px}.tree-select-body[data-v-880ba6da]::-webkit-scrollbar-track{background:#f1f1f1;border-radius:3px}.tree-select-body[data-v-880ba6da]::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.tree-select-body[data-v-880ba6da]::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.tree-select-main.disabled .more-button[data-v-880ba6da]{pointer-events:auto;cursor:pointer}.tree-select-main.has-chips[data-v-880ba6da]{height:auto;min-height:calc(1.5em + .5rem + calc(var(--bs-border-width) * 2))}.tree-select-main.has-chips.btn-lg[data-v-880ba6da]{min-height:calc(1.5em + 1rem + calc(var(--bs-border-width) * 2))}.tree-select-main.has-chips.btn-xl[data-v-880ba6da]{min-height:calc(1.5em + 1.5rem + calc(var(--bs-border-width) * 2))}.chips-container[data-v-880ba6da]{position:relative;display:flex;flex-wrap:nowrap;gap:.25rem;overflow:hidden;align-items:center}.chip[data-v-880ba6da]{flex:0 0 auto;display:flex;align-items:center;max-width:100px;padding:.2em .6em;overflow:hidden}.chip-label[data-v-880ba6da]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}.chip-measure-layer[data-v-880ba6da]{position:absolute;left:0;top:0;display:flex;gap:.25rem;flex-wrap:nowrap;visibility:hidden;pointer-events:none}.chip-remove[data-v-880ba6da]{width:.8em;height:.8em;margin-left:.4em;cursor:pointer;opacity:.7;transition:opacity .2s}.chip-remove[data-v-880ba6da]:hover{opacity:1}.more-button[data-v-880ba6da]{font-size:.75em;line-height:1;padding:.3em .5em}.more-popover[data-v-880ba6da]{width:250px;max-width:80vw;max-height:200px;overflow-y:auto;font-size:.9rem}.tree-select-tooltip[data-v-880ba6da]{background-color:var(--bs-body-bg);border:var(--bs-border-width) solid var(--bs-border-color);font-size:.875rem;max-width:400px;word-wrap:break-word;pointer-events:none}@media (max-width: 576px){.tree-select-dropdown[data-v-880ba6da]{max-width:90vw;left:0!important;right:0!important;margin:0 auto}}
|
package/dist/vue-select.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { createPopper as
|
|
3
|
-
const
|
|
1
|
+
import { computed as p, createElementBlock as r, openBlock as i, normalizeClass as w, createCommentVNode as m, createElementVNode as f, resolveComponent as et, normalizeStyle as be, createBlock as O, withModifiers as C, renderSlot as ue, Fragment as j, renderList as Z, withCtx as Re, ref as g, watch as xe, onMounted as tt, nextTick as R, onUnmounted as lt, withDirectives as ke, withKeys as we, toDisplayString as S, createVNode as te, vModelText as nt, vModelSelect as st, createTextVNode as de, vShow as at } from "vue";
|
|
2
|
+
import { createPopper as Se } from "@popperjs/core";
|
|
3
|
+
const Ce = (t, q) => {
|
|
4
4
|
const l = t.__vccOpts || t;
|
|
5
5
|
for (const [h, c] of q)
|
|
6
6
|
l[h] = c;
|
|
7
7
|
return l;
|
|
8
|
-
},
|
|
8
|
+
}, it = { key: 0 }, ot = { key: 1 }, rt = { key: 2 }, dt = { key: 3 }, ut = { key: 4 }, ct = { key: 5 }, ft = { key: 6 }, mt = { key: 7 }, vt = {
|
|
9
9
|
__name: "SvgIcon",
|
|
10
10
|
props: {
|
|
11
11
|
name: {
|
|
@@ -14,56 +14,53 @@ const xe = (t, q) => {
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
setup(t) {
|
|
17
|
-
const q = t, l =
|
|
17
|
+
const q = t, l = p(() => ({
|
|
18
18
|
"svg-icon-spin": q.name === "spinner"
|
|
19
19
|
}));
|
|
20
|
-
return (h, c) => (
|
|
20
|
+
return (h, c) => (i(), r("svg", {
|
|
21
21
|
xmlns: "http://www.w3.org/2000/svg",
|
|
22
22
|
viewBox: "0 0 24 24",
|
|
23
23
|
fill: "currentColor",
|
|
24
24
|
width: "1em",
|
|
25
25
|
height: "1em",
|
|
26
|
-
class:
|
|
26
|
+
class: w(l.value)
|
|
27
27
|
}, [
|
|
28
|
-
t.name === "spinner" ? (
|
|
28
|
+
t.name === "spinner" ? (i(), r("g", it, c[0] || (c[0] = [
|
|
29
29
|
f("path", { d: "M12,4V2A10,10,0,0,0,2,12H4A8,8,0,0,1,12,4Z" }, null, -1)
|
|
30
30
|
]))) : m("", !0),
|
|
31
|
-
t.name === "times" ? (
|
|
31
|
+
t.name === "times" ? (i(), r("g", ot, c[1] || (c[1] = [
|
|
32
32
|
f("path", { d: "M13.41,12l4.3-4.29a1,1,0,1,0-1.42-1.42L12,10.59,7.71,6.29A1,1,0,0,0,6.29,7.71L10.59,12l-4.3,4.29a1,1,0,0,0,0,1.42,1,1,0,0,0,1.42,0L12,13.41l4.29,4.3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42Z" }, null, -1)
|
|
33
33
|
]))) : m("", !0),
|
|
34
|
-
t.name === "chevron-down" ? (
|
|
34
|
+
t.name === "chevron-down" ? (i(), r("g", rt, c[2] || (c[2] = [
|
|
35
35
|
f("path", { d: "M17,9.17a1,1,0,0,0-1.41,0L12,12.71,8.46,9.17a1,1,0,0,0-1.41,0,1,1,0,0,0,0,1.42l4.24,4.24a1,1,0,0,0,1.42,0L17,10.59A1,1,0,0,0,17,9.17Z" }, null, -1)
|
|
36
36
|
]))) : m("", !0),
|
|
37
|
-
t.name === "chevron-right" ? (
|
|
37
|
+
t.name === "chevron-right" ? (i(), r("g", dt, c[3] || (c[3] = [
|
|
38
38
|
f("path", { d: "M10.83,12l-4.24,4.24a1,1,0,0,0,1.41,1.41L13.66,12,8,6.34A1,1,0,0,0,6.59,7.76Z" }, null, -1)
|
|
39
39
|
]))) : m("", !0),
|
|
40
|
-
t.name === "search" ? (
|
|
40
|
+
t.name === "search" ? (i(), r("g", ut, c[4] || (c[4] = [
|
|
41
41
|
f("path", { d: "M21.71,20.29,18,16.61A9,9,0,1,0,16.61,18l3.68,3.68a1,1,0,0,0,1.42,0A1,1,0,0,0,21.71,20.29ZM11,18a7,7,0,1,1,7-7A7,7,0,0,1,11,18Z" }, null, -1)
|
|
42
42
|
]))) : m("", !0),
|
|
43
|
-
t.name === "asc" ? (
|
|
43
|
+
t.name === "asc" ? (i(), r("g", ct, c[5] || (c[5] = [
|
|
44
44
|
f("path", {
|
|
45
45
|
fill: "currentColor",
|
|
46
46
|
d: "M4.869 11H2.667L6 3h2l3.333 8H9.131l-.41-1H5.28zm1.23-3h1.803L7 5.8zm12.9 8V3h-2v13h-3l4 5l4-5zm-8-3H3v2h4.855L3 19v2h8v-2H6.146L11 15z"
|
|
47
47
|
}, null, -1)
|
|
48
48
|
]))) : m("", !0),
|
|
49
|
-
t.name === "desc" ? (
|
|
49
|
+
t.name === "desc" ? (i(), r("g", ft, c[6] || (c[6] = [
|
|
50
50
|
f("path", {
|
|
51
51
|
fill: "currentColor",
|
|
52
52
|
d: "M4.869 11H2.667L6 3h2l3.333 8H9.131l-.41-1H5.28zm1.23-3h1.803L7 5.8zm15.9 0l-4-5l-4 5h3v13h2V8zm-11 5H3v2h4.855L3 19v2h8v-2H6.146L11 15z"
|
|
53
53
|
}, null, -1)
|
|
54
54
|
]))) : m("", !0),
|
|
55
|
-
t.name === "info-circle" ? (
|
|
55
|
+
t.name === "info-circle" ? (i(), r("g", mt, c[7] || (c[7] = [
|
|
56
56
|
f("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" }, null, -1)
|
|
57
57
|
]))) : m("", !0)
|
|
58
58
|
], 2));
|
|
59
59
|
}
|
|
60
|
-
}, A = /* @__PURE__ */
|
|
61
|
-
key:
|
|
60
|
+
}, A = /* @__PURE__ */ Ce(vt, [["__scopeId", "data-v-89f9b7e1"]]), ht = {
|
|
61
|
+
key: 2,
|
|
62
62
|
class: "expander-placeholder flex-shrink-0"
|
|
63
|
-
},
|
|
64
|
-
key: 0,
|
|
65
|
-
class: "children-wrapper"
|
|
66
|
-
}, bt = {
|
|
63
|
+
}, yt = ["checked", ".indeterminate", "disabled"], gt = { class: "item-content text-start text-break lh-1" }, le = 0.91, pt = {
|
|
67
64
|
__name: "TreeSelectItem",
|
|
68
65
|
props: {
|
|
69
66
|
item: { type: Object, required: !0 },
|
|
@@ -76,42 +73,55 @@ const xe = (t, q) => {
|
|
|
76
73
|
optionLabel: { type: String, required: !0 },
|
|
77
74
|
optionValue: { type: String, required: !0 },
|
|
78
75
|
disabledKey: { type: String, default: null },
|
|
79
|
-
disableBranchNode: { type: Boolean, default: !1 }
|
|
76
|
+
disableBranchNode: { type: Boolean, default: !1 },
|
|
77
|
+
displayMode: { type: String, default: "text" },
|
|
78
|
+
index: { type: Number, default: 0 },
|
|
79
|
+
siblingsCount: { type: Number, default: 1 }
|
|
80
80
|
},
|
|
81
81
|
emits: ["select", "toggle-expand"],
|
|
82
82
|
setup(t, { emit: q }) {
|
|
83
|
-
const l = t, h = (v) => v[l.optionValue] || v.id || v.value,
|
|
84
|
-
let
|
|
85
|
-
return v.children && v.children.forEach((
|
|
86
|
-
|
|
87
|
-
}),
|
|
88
|
-
},
|
|
89
|
-
return (v,
|
|
90
|
-
const
|
|
91
|
-
return
|
|
83
|
+
const l = t, h = p(() => l.index === l.siblingsCount - 1), c = (v) => v[l.optionValue] || v.id || v.value, $ = (v) => !l.disabledKey || !v ? !1 : v.hasOwnProperty(l.disabledKey) && v[l.disabledKey] !== null, V = p(() => l.item.children && l.item.children.length > 0), k = p(() => l.expandedItems.has(c(l.item))), N = p(() => l.selectedItems.includes(c(l.item))), K = (v) => {
|
|
84
|
+
let y = [];
|
|
85
|
+
return v.children && v.children.forEach((L) => {
|
|
86
|
+
y.push(c(L)), y.push(...K(L));
|
|
87
|
+
}), y;
|
|
88
|
+
}, H = p(() => !l.multiple || !l.selectAll || !V.value || N.value ? !1 : K(l.item).some((y) => l.selectedItems.includes(y)));
|
|
89
|
+
return (v, y) => {
|
|
90
|
+
const L = et("TreeSelectItem", !0);
|
|
91
|
+
return i(), r("div", {
|
|
92
|
+
class: w(["tree-select-item-wrapper", { "is-last-child": h.value }])
|
|
93
|
+
}, [
|
|
92
94
|
f("div", {
|
|
93
|
-
class:
|
|
94
|
-
"bg-primary text-white":
|
|
95
|
-
"is-disabled text-muted bg-light":
|
|
95
|
+
class: w(["list-group-item list-group-item-action d-flex align-items-center gap-1", {
|
|
96
|
+
"bg-primary text-white": N.value && (t.selectMode === "highlight" || !t.multiple) && !$(t.item) && !(t.disableBranchNode && V.value),
|
|
97
|
+
"is-disabled text-muted bg-light": $(t.item)
|
|
96
98
|
}]),
|
|
97
|
-
style:
|
|
98
|
-
onClick:
|
|
99
|
+
style: be({ paddingLeft: `${t.level * le + 0.5}rem` }),
|
|
100
|
+
onClick: y[2] || (y[2] = (B) => $(t.item) ? null : v.$emit("select", t.item))
|
|
99
101
|
}, [
|
|
100
|
-
|
|
102
|
+
t.displayMode === "tree-node" && t.level > 0 ? (i(), r("div", {
|
|
101
103
|
key: 0,
|
|
104
|
+
class: w(["tree-indent", { "last-child-connector": h.value }]),
|
|
105
|
+
style: be({
|
|
106
|
+
left: `${(t.level - 1) * le + le / 2}rem`,
|
|
107
|
+
width: "2.3rem"
|
|
108
|
+
})
|
|
109
|
+
}, null, 6)) : m("", !0),
|
|
110
|
+
V.value ? (i(), O(A, {
|
|
111
|
+
key: 1,
|
|
102
112
|
name: "chevron-right",
|
|
103
|
-
class:
|
|
104
|
-
onClick:
|
|
105
|
-
}, null, 8, ["class"])) : (
|
|
106
|
-
t.multiple && t.selectMode === "checkbox" && !(t.disableBranchNode && V.value) ? (
|
|
107
|
-
key:
|
|
113
|
+
class: w(["expander-icon flex-shrink-0", { "rotate-90": k.value }]),
|
|
114
|
+
onClick: y[0] || (y[0] = C((B) => v.$emit("toggle-expand", c(t.item)), ["stop"]))
|
|
115
|
+
}, null, 8, ["class"])) : (i(), r("span", ht)),
|
|
116
|
+
t.multiple && t.selectMode === "checkbox" && !(t.disableBranchNode && V.value) ? (i(), r("input", {
|
|
117
|
+
key: 3,
|
|
108
118
|
type: "checkbox",
|
|
109
119
|
class: "tree-checkbox",
|
|
110
|
-
checked:
|
|
111
|
-
".indeterminate":
|
|
112
|
-
disabled:
|
|
113
|
-
onClick:
|
|
114
|
-
}, null, 40,
|
|
120
|
+
checked: N.value,
|
|
121
|
+
".indeterminate": H.value,
|
|
122
|
+
disabled: $(t.item),
|
|
123
|
+
onClick: y[1] || (y[1] = C((B) => v.$emit("select", t.item), ["stop"]))
|
|
124
|
+
}, null, 40, yt)) : m("", !0),
|
|
115
125
|
f("div", gt, [
|
|
116
126
|
ue(v.$slots, "default", {
|
|
117
127
|
item: t.item,
|
|
@@ -119,10 +129,14 @@ const xe = (t, q) => {
|
|
|
119
129
|
}, void 0, !0)
|
|
120
130
|
])
|
|
121
131
|
], 6),
|
|
122
|
-
V.value &&
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
132
|
+
V.value && k.value ? (i(), r("div", {
|
|
133
|
+
key: 0,
|
|
134
|
+
class: w(["children-wrapper", { "tree-branch-guide": t.displayMode === "tree-node" && !h.value }]),
|
|
135
|
+
style: be(t.displayMode === "tree-node" ? { marginLeft: `${t.level * le + le / 2}rem` } : {})
|
|
136
|
+
}, [
|
|
137
|
+
(i(!0), r(j, null, Z(t.item.children, (B, ne) => (i(), O(L, {
|
|
138
|
+
key: c(B),
|
|
139
|
+
item: B,
|
|
126
140
|
level: t.level + 1,
|
|
127
141
|
"selected-items": t.selectedItems,
|
|
128
142
|
"expanded-items": t.expandedItems,
|
|
@@ -133,50 +147,53 @@ const xe = (t, q) => {
|
|
|
133
147
|
"option-value": t.optionValue,
|
|
134
148
|
"disabled-key": t.disabledKey,
|
|
135
149
|
"disable-branch-node": t.disableBranchNode,
|
|
136
|
-
|
|
137
|
-
|
|
150
|
+
"display-mode": t.displayMode,
|
|
151
|
+
index: ne,
|
|
152
|
+
"siblings-count": t.item.children.length,
|
|
153
|
+
onSelect: y[3] || (y[3] = (M) => v.$emit("select", M)),
|
|
154
|
+
onToggleExpand: y[4] || (y[4] = (M) => v.$emit("toggle-expand", M))
|
|
138
155
|
}, {
|
|
139
|
-
default:
|
|
156
|
+
default: Re(({ item: M, level: z }) => [
|
|
140
157
|
ue(v.$slots, "default", {
|
|
141
|
-
item:
|
|
142
|
-
level:
|
|
158
|
+
item: M,
|
|
159
|
+
level: z
|
|
143
160
|
}, void 0, !0)
|
|
144
161
|
]),
|
|
145
162
|
_: 2
|
|
146
|
-
}, 1032, ["item", "level", "selected-items", "expanded-items", "multiple", "select-all", "select-mode", "option-label", "option-value", "disabled-key", "disable-branch-node"]))), 128))
|
|
147
|
-
])) : m("", !0)
|
|
148
|
-
]);
|
|
163
|
+
}, 1032, ["item", "level", "selected-items", "expanded-items", "multiple", "select-all", "select-mode", "option-label", "option-value", "disabled-key", "disable-branch-node", "display-mode", "index", "siblings-count"]))), 128))
|
|
164
|
+
], 6)) : m("", !0)
|
|
165
|
+
], 2);
|
|
149
166
|
};
|
|
150
167
|
}
|
|
151
|
-
},
|
|
168
|
+
}, bt = /* @__PURE__ */ Ce(pt, [["__scopeId", "data-v-3a344aeb"]]), xt = ["onKeydown"], kt = { class: "tree-select-display-container" }, wt = {
|
|
152
169
|
key: 0,
|
|
153
170
|
class: "d-flex align-items-center justify-content-start w-100"
|
|
154
|
-
},
|
|
171
|
+
}, St = ["title"], Ct = { key: 1 }, Vt = {
|
|
155
172
|
key: 0,
|
|
156
173
|
class: "text-muted"
|
|
157
|
-
},
|
|
174
|
+
}, Lt = {
|
|
158
175
|
class: "chip-measure-layer",
|
|
159
176
|
"aria-hidden": "true"
|
|
160
|
-
},
|
|
177
|
+
}, Mt = { class: "chip-label" }, It = { class: "chip-label" }, At = { class: "d-flex align-items-center gap-2" }, $t = { class: "list-group list-group-flush" }, Nt = { class: "text-wrap text-start me-2" }, Bt = { class: "p-2 border-bottom d-flex flex-column gap-2" }, Tt = ["onKeydown"], zt = {
|
|
161
178
|
key: 1,
|
|
162
179
|
class: "d-flex align-items-center gap-2"
|
|
163
|
-
},
|
|
180
|
+
}, Et = ["value"], Kt = ["disabled"], Dt = {
|
|
164
181
|
key: 0,
|
|
165
182
|
class: "p-4 text-muted text-center"
|
|
166
|
-
},
|
|
183
|
+
}, Pt = {
|
|
167
184
|
key: 1,
|
|
168
185
|
class: "tree-select-body",
|
|
169
186
|
style: { "max-height": "300px", "overflow-y": "auto" }
|
|
170
|
-
},
|
|
187
|
+
}, Rt = {
|
|
171
188
|
key: 0,
|
|
172
189
|
class: "list-group list-group-flush"
|
|
173
|
-
},
|
|
190
|
+
}, Ot = {
|
|
174
191
|
class: "d-flex align-items-center gap-2",
|
|
175
192
|
style: { "white-space": "wrap" }
|
|
176
|
-
},
|
|
193
|
+
}, Ft = {
|
|
177
194
|
key: 1,
|
|
178
195
|
class: "p-3 text-muted text-center"
|
|
179
|
-
},
|
|
196
|
+
}, qt = { key: 0 }, Ht = { key: 0 }, Wt = { key: 1 }, jt = { key: 0 }, Zt = { key: 1 }, Ut = {
|
|
180
197
|
__name: "TreeSelectMain",
|
|
181
198
|
props: {
|
|
182
199
|
modelValue: {
|
|
@@ -186,7 +203,7 @@ const xe = (t, q) => {
|
|
|
186
203
|
displayMode: {
|
|
187
204
|
type: String,
|
|
188
205
|
default: "text",
|
|
189
|
-
validator: (t) => ["text", "chips"].includes(t)
|
|
206
|
+
validator: (t) => ["text", "chips", "tree-node"].includes(t)
|
|
190
207
|
},
|
|
191
208
|
items: {
|
|
192
209
|
type: Array,
|
|
@@ -309,10 +326,10 @@ const xe = (t, q) => {
|
|
|
309
326
|
},
|
|
310
327
|
emits: ["update:modelValue", "change", "clear", "deselect", "select", "focus", "blur", "add-new"],
|
|
311
328
|
setup(t, { emit: q }) {
|
|
312
|
-
const l = t, h = q, c = g(null),
|
|
313
|
-
const s =
|
|
329
|
+
const l = t, h = q, c = g(null), $ = g(null), V = g(null), k = g(""), N = g(!1), K = g(/* @__PURE__ */ new Set()), H = g(null), v = g(null), y = g(null), L = g(!1), B = g(null), ne = g(null), M = g(!1), z = g(l.defaultSortKey), U = g(l.defaultSortDirection), G = g(null), se = g(null), J = g(!1), ae = g(null), Ve = g(null), ce = g(0), Le = p(() => l.size === "sm" ? "btn-sm" : l.size === "lg" ? "btn-lg" : l.size === "xl" ? "btn-xl" : ""), Me = p(() => l.size === "sm" ? "form-control-sm" : l.size === "lg" ? "form-control-lg" : l.size === "xl" ? "form-control-xl" : ""), Oe = p(() => oe.value === 0 ? [] : W.value.slice(ye.value)), Q = p(() => !l.multiple || !l.excludeFromSelectedListKey ? P.value : P.value.filter((e) => {
|
|
330
|
+
const s = D(e);
|
|
314
331
|
return !s || !s[l.excludeFromSelectedListKey];
|
|
315
|
-
})),
|
|
332
|
+
})), Ie = p(() => {
|
|
316
333
|
const e = Q.value;
|
|
317
334
|
if (e.length === 0) return l.placeholder;
|
|
318
335
|
if (l.multiple) {
|
|
@@ -324,68 +341,68 @@ const xe = (t, q) => {
|
|
|
324
341
|
}
|
|
325
342
|
const s = Y(e[0]);
|
|
326
343
|
return s ? s.join(" → ") : e[0];
|
|
327
|
-
}),
|
|
328
|
-
await
|
|
329
|
-
const e =
|
|
344
|
+
}), Fe = p(() => l.multiple ? Array.isArray(l.modelValue) ? l.modelValue : [] : l.modelValue !== null && l.modelValue !== void 0 ? [l.modelValue] : []), qe = p(() => Fe.value.filter((e) => e === "" || e === null || e === void 0 || e === 0 ? !1 : !D(e))), Ae = async () => {
|
|
345
|
+
await R();
|
|
346
|
+
const e = ne.value;
|
|
330
347
|
if (l.multiple || l.displayMode === "chips" || Q.value.length === 0 || !e) {
|
|
331
|
-
|
|
348
|
+
M.value = !1;
|
|
332
349
|
return;
|
|
333
350
|
}
|
|
334
|
-
|
|
335
|
-
},
|
|
351
|
+
M.value = e.scrollWidth > e.clientWidth;
|
|
352
|
+
}, E = (e) => e && (e[l.optionLabel] || e.label || e.name) || "", b = (e) => e ? e[l.optionValue] || e.id || e.value : null, fe = (e) => !l.disabledKey || !e ? !1 : e.hasOwnProperty(l.disabledKey) && e[l.disabledKey] !== null, I = (e) => e.children && e.children.length > 0, X = (e, s) => {
|
|
336
353
|
if (s)
|
|
337
354
|
return s.split(".").reduce((n, a) => n && n[a], e);
|
|
338
|
-
},
|
|
355
|
+
}, D = (e, s = l.items) => {
|
|
339
356
|
for (const n of s) {
|
|
340
357
|
if (b(n) === e) return n;
|
|
341
|
-
if (
|
|
342
|
-
const a =
|
|
358
|
+
if (I(n)) {
|
|
359
|
+
const a = D(e, n.children);
|
|
343
360
|
if (a) return a;
|
|
344
361
|
}
|
|
345
362
|
}
|
|
346
363
|
return null;
|
|
347
|
-
},
|
|
364
|
+
}, me = (e) => {
|
|
348
365
|
const s = [];
|
|
349
|
-
return
|
|
350
|
-
|
|
366
|
+
return I(e) && e.children.forEach((n) => {
|
|
367
|
+
fe(n) || (s.push(b(n)), s.push(...me(n)));
|
|
351
368
|
}), s;
|
|
352
|
-
},
|
|
353
|
-
await
|
|
354
|
-
const e =
|
|
369
|
+
}, ie = async () => {
|
|
370
|
+
await R();
|
|
371
|
+
const e = Ve.value;
|
|
355
372
|
if (!e) return;
|
|
356
373
|
const s = e.querySelector(".chip-measure-layer");
|
|
357
374
|
if (!s) return;
|
|
358
375
|
const n = Array.from(s.children);
|
|
359
376
|
if (!n.length) {
|
|
360
|
-
|
|
377
|
+
ce.value = 0;
|
|
361
378
|
return;
|
|
362
379
|
}
|
|
363
|
-
const a = e.clientWidth,
|
|
364
|
-
let
|
|
365
|
-
for (let
|
|
366
|
-
const
|
|
367
|
-
if (
|
|
380
|
+
const a = e.clientWidth, o = 4, d = 40;
|
|
381
|
+
let u = 0, x = 0;
|
|
382
|
+
for (let T = 0; T < n.length; T++) {
|
|
383
|
+
const Pe = n[T].offsetWidth + o, _e = T < n.length - 1 ? d : 0;
|
|
384
|
+
if (u + Pe + _e > a)
|
|
368
385
|
break;
|
|
369
|
-
|
|
386
|
+
u += Pe, x++;
|
|
370
387
|
}
|
|
371
|
-
|
|
372
|
-
},
|
|
388
|
+
ce.value = Math.max(x, 1);
|
|
389
|
+
}, ve = (e, s = l.items, n = []) => {
|
|
373
390
|
for (const a of s) {
|
|
374
391
|
if (b(a) === e) return n;
|
|
375
|
-
if (
|
|
376
|
-
const
|
|
377
|
-
if (
|
|
392
|
+
if (I(a)) {
|
|
393
|
+
const o = ve(e, a.children, [...n, b(a)]);
|
|
394
|
+
if (o) return o;
|
|
378
395
|
}
|
|
379
396
|
}
|
|
380
397
|
return null;
|
|
381
|
-
},
|
|
398
|
+
}, P = p(() => {
|
|
382
399
|
const e = new Set(Array.isArray(l.modelValue) ? l.modelValue : [l.modelValue].filter(Boolean));
|
|
383
400
|
if (l.multiple && l.selectAll) {
|
|
384
401
|
const s = (n) => {
|
|
385
402
|
n.forEach((a) => {
|
|
386
|
-
if (
|
|
387
|
-
const
|
|
388
|
-
|
|
403
|
+
if (I(a)) {
|
|
404
|
+
const o = a.children.filter((u) => !fe(u));
|
|
405
|
+
o.length > 0 && o.every((u) => e.has(b(u))) && e.add(b(a)), s(a.children);
|
|
389
406
|
}
|
|
390
407
|
});
|
|
391
408
|
};
|
|
@@ -394,139 +411,139 @@ const xe = (t, q) => {
|
|
|
394
411
|
return Array.from(e);
|
|
395
412
|
}), Y = (e, s = l.items, n = []) => {
|
|
396
413
|
for (const a of s) {
|
|
397
|
-
const
|
|
398
|
-
if (b(a) === e) return
|
|
399
|
-
if (
|
|
400
|
-
const
|
|
401
|
-
if (
|
|
414
|
+
const o = [...n, E(a)];
|
|
415
|
+
if (b(a) === e) return o;
|
|
416
|
+
if (I(a)) {
|
|
417
|
+
const d = Y(e, a.children, o);
|
|
418
|
+
if (d) return d;
|
|
402
419
|
}
|
|
403
420
|
}
|
|
404
421
|
return null;
|
|
405
|
-
},
|
|
422
|
+
}, $e = (e) => {
|
|
406
423
|
if (!e || e.length === 0) return "";
|
|
407
424
|
const s = e.join(" → ");
|
|
408
425
|
return s.length <= 40 ? s : e.length > 2 ? `${e[0]} → ... → ${e[e.length - 1]}` : s;
|
|
409
|
-
},
|
|
426
|
+
}, he = p(() => {
|
|
410
427
|
const e = Q.value;
|
|
411
428
|
if (e.length === 0) return l.placeholder;
|
|
412
429
|
if (l.multiple) {
|
|
413
430
|
if (e.length === 1) {
|
|
414
|
-
const
|
|
415
|
-
if (!
|
|
431
|
+
const o = D(e[0]);
|
|
432
|
+
if (!o)
|
|
416
433
|
return `${e[0]} (No longer available)`;
|
|
417
|
-
const
|
|
418
|
-
return
|
|
434
|
+
const d = Y(e[0]);
|
|
435
|
+
return d ? $e(d) : E(o);
|
|
419
436
|
}
|
|
420
437
|
return `${e.length} items selected`;
|
|
421
438
|
}
|
|
422
|
-
const s = e[0], n =
|
|
439
|
+
const s = e[0], n = D(s);
|
|
423
440
|
if (!n)
|
|
424
441
|
return `${s} (No longer available)`;
|
|
425
442
|
const a = Y(s);
|
|
426
|
-
return a ?
|
|
427
|
-
}),
|
|
443
|
+
return a ? $e(a) : E(n);
|
|
444
|
+
}), W = p(() => {
|
|
428
445
|
if (!l.multiple || Q.value.length === 0) return [];
|
|
429
446
|
const e = Q.value.map((a) => {
|
|
430
|
-
const
|
|
431
|
-
return
|
|
447
|
+
const o = D(a);
|
|
448
|
+
return o || {
|
|
432
449
|
[l.optionValue]: a,
|
|
433
450
|
[l.optionLabel]: `${a} (No longer available)`,
|
|
434
451
|
__missing: !0
|
|
435
452
|
};
|
|
436
453
|
});
|
|
437
|
-
if (!l.sortable || !
|
|
454
|
+
if (!l.sortable || !z.value)
|
|
438
455
|
return e;
|
|
439
|
-
const s =
|
|
440
|
-
return [...e].sort((a,
|
|
456
|
+
const s = z.value, n = U.value;
|
|
457
|
+
return [...e].sort((a, o) => {
|
|
441
458
|
if (a.__missing) return 1;
|
|
442
|
-
if (
|
|
443
|
-
const
|
|
444
|
-
if (
|
|
445
|
-
if (
|
|
446
|
-
let
|
|
447
|
-
return typeof
|
|
459
|
+
if (o.__missing) return -1;
|
|
460
|
+
const d = X(a, s), u = X(o, s);
|
|
461
|
+
if (d == null) return 1;
|
|
462
|
+
if (u == null) return -1;
|
|
463
|
+
let x = 0;
|
|
464
|
+
return typeof d == "string" && typeof u == "string" ? x = d.localeCompare(u) : d > u ? x = 1 : d < u && (x = -1), n === "desc" ? x * -1 : x;
|
|
448
465
|
});
|
|
449
|
-
}),
|
|
450
|
-
() =>
|
|
451
|
-
),
|
|
452
|
-
const e =
|
|
466
|
+
}), Ne = p(
|
|
467
|
+
() => W.value.slice(0, ye.value)
|
|
468
|
+
), ye = p(() => l.maxVisibleChipsDisplay !== null ? l.maxVisibleChipsDisplay : Math.max(ce.value, 1)), oe = p(() => {
|
|
469
|
+
const e = W.value.length - ye.value;
|
|
453
470
|
return e > 0 ? e : 0;
|
|
454
|
-
}),
|
|
471
|
+
}), Be = (e, s) => {
|
|
455
472
|
const n = s.toLowerCase();
|
|
456
473
|
return e.map((a) => {
|
|
457
|
-
let
|
|
474
|
+
let o = !1;
|
|
458
475
|
if (l.keyFilters && l.keyFilters.length > 0)
|
|
459
|
-
for (const
|
|
460
|
-
const
|
|
461
|
-
if (
|
|
462
|
-
|
|
476
|
+
for (const u of l.keyFilters) {
|
|
477
|
+
const x = X(a, u);
|
|
478
|
+
if (x != null && String(x).toLowerCase().includes(n)) {
|
|
479
|
+
o = !0;
|
|
463
480
|
break;
|
|
464
481
|
}
|
|
465
482
|
}
|
|
466
483
|
else
|
|
467
|
-
|
|
468
|
-
if (!
|
|
469
|
-
return
|
|
470
|
-
const
|
|
471
|
-
return
|
|
484
|
+
o = E(a).toLowerCase().includes(n);
|
|
485
|
+
if (!I(a))
|
|
486
|
+
return o ? a : null;
|
|
487
|
+
const d = Be(a.children, s);
|
|
488
|
+
return o ? { ...a, children: a.children } : d.length > 0 ? { ...a, children: d } : null;
|
|
472
489
|
}).filter(Boolean);
|
|
473
|
-
},
|
|
474
|
-
const
|
|
475
|
-
if (
|
|
476
|
-
if (
|
|
477
|
-
let
|
|
478
|
-
return typeof
|
|
479
|
-
}).map((
|
|
480
|
-
const e =
|
|
481
|
-
return !l.sortable || !
|
|
482
|
-
}),
|
|
483
|
-
if (l.disableBranchNodes &&
|
|
484
|
-
const
|
|
485
|
-
|
|
490
|
+
}, Te = (e, s, n) => !e || !s ? e : [...e].sort((o, d) => {
|
|
491
|
+
const u = X(o, s), x = X(d, s);
|
|
492
|
+
if (u == null) return 1;
|
|
493
|
+
if (x == null) return -1;
|
|
494
|
+
let T = 0;
|
|
495
|
+
return typeof u == "string" && typeof x == "string" ? T = u.localeCompare(x) : u > x ? T = 1 : u < x && (T = -1), n === "desc" ? T * -1 : T;
|
|
496
|
+
}).map((o) => I(o) ? { ...o, children: Te(o.children, s, n) } : o), _ = p(() => {
|
|
497
|
+
const e = k.value.trim(), s = e ? Be(l.items, e) : l.items;
|
|
498
|
+
return !l.sortable || !z.value ? s : Te(s, z.value, U.value);
|
|
499
|
+
}), He = (e) => {
|
|
500
|
+
if (l.disableBranchNodes && I(e)) {
|
|
501
|
+
const o = b(e);
|
|
502
|
+
ze(o);
|
|
486
503
|
return;
|
|
487
504
|
}
|
|
488
|
-
if (
|
|
505
|
+
if (fe(e)) return;
|
|
489
506
|
const s = b(e);
|
|
490
|
-
let n = new Set(
|
|
507
|
+
let n = new Set(P.value);
|
|
491
508
|
if (l.multiple) {
|
|
492
|
-
const
|
|
493
|
-
if (l.selectAll &&
|
|
494
|
-
const
|
|
495
|
-
|
|
509
|
+
const o = n.has(s);
|
|
510
|
+
if (l.selectAll && I(e)) {
|
|
511
|
+
const d = me(e);
|
|
512
|
+
o ? (n.delete(s), h("deselect", e), l.deselectAll && d.forEach((u) => n.delete(u))) : (n.add(s), d.forEach((u) => n.add(u)), h("select", e));
|
|
496
513
|
} else
|
|
497
|
-
|
|
514
|
+
o ? (n.delete(s), l.selectAll && ve(s)?.forEach((u) => n.delete(u))) : n.add(s);
|
|
498
515
|
} else {
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
|
|
516
|
+
const o = l.modelValue, d = b(e);
|
|
517
|
+
o === d ? (n.clear(), h("deselect", e)) : (n.clear(), n.add(d), o != null && D(o), h("select", e)), l.closeOnSelect && F(), R(() => {
|
|
518
|
+
V.value?.focus();
|
|
502
519
|
});
|
|
503
520
|
}
|
|
504
521
|
let a = Array.from(n);
|
|
505
|
-
l.multiple && l.excludeFromSelectedListKey && (a = a.filter((
|
|
506
|
-
const
|
|
507
|
-
return !
|
|
522
|
+
l.multiple && l.excludeFromSelectedListKey && (a = a.filter((o) => {
|
|
523
|
+
const d = D(o);
|
|
524
|
+
return !d || !d[l.excludeFromSelectedListKey];
|
|
508
525
|
})), h("update:modelValue", l.multiple ? a : a[0] || null), h("change", l.multiple ? a : a[0] || null);
|
|
509
|
-
},
|
|
526
|
+
}, ge = (e) => {
|
|
510
527
|
if (l.disabled || !e) return;
|
|
511
|
-
const s = b(e), n = new Set(
|
|
512
|
-
n.delete(s), l.selectAll && (l.deselectAll &&
|
|
528
|
+
const s = b(e), n = new Set(P.value);
|
|
529
|
+
n.delete(s), l.selectAll && (l.deselectAll && I(e) && me(e).forEach((u) => n.delete(u)), ve(s)?.forEach((d) => n.delete(d)));
|
|
513
530
|
const a = Array.from(n);
|
|
514
531
|
h("update:modelValue", a), h("change", a);
|
|
515
|
-
},
|
|
516
|
-
|
|
517
|
-
},
|
|
532
|
+
}, ze = (e) => {
|
|
533
|
+
K.value.has(e) ? K.value.delete(e) : K.value.add(e);
|
|
534
|
+
}, We = () => {
|
|
518
535
|
U.value = U.value === "asc" ? "desc" : "asc";
|
|
519
|
-
},
|
|
536
|
+
}, je = () => {
|
|
520
537
|
const e = l.multiple ? [] : null;
|
|
521
|
-
h("clear"), h("update:modelValue", e), h("change", e),
|
|
522
|
-
},
|
|
523
|
-
!l.allowAddNew || !
|
|
524
|
-
},
|
|
525
|
-
l.allowAddNew && l.addNewMode === "enter" &&
|
|
526
|
-
},
|
|
538
|
+
h("clear"), h("update:modelValue", e), h("change", e), ee();
|
|
539
|
+
}, Ee = () => {
|
|
540
|
+
!l.allowAddNew || !k.value.trim() || (h("add-new", k.value.trim()), F());
|
|
541
|
+
}, Ze = () => {
|
|
542
|
+
l.allowAddNew && l.addNewMode === "enter" && k.value.trim() && _.value.length === 0 && Ee();
|
|
543
|
+
}, Ue = (e) => {
|
|
527
544
|
h("focus", e);
|
|
528
|
-
},
|
|
529
|
-
l.disabled || (
|
|
545
|
+
}, Ge = async () => {
|
|
546
|
+
l.disabled || (ee(), N.value = !0, re(), await R(), $.value && V.value && (H.value = Se(V.value, $.value, {
|
|
530
547
|
placement: "bottom-start",
|
|
531
548
|
strategy: "fixed",
|
|
532
549
|
modifiers: [
|
|
@@ -546,192 +563,192 @@ const xe = (t, q) => {
|
|
|
546
563
|
}
|
|
547
564
|
}
|
|
548
565
|
]
|
|
549
|
-
})), l.searchable && (await
|
|
566
|
+
})), l.searchable && (await R(), $.value?.querySelector(".tree-search-input")?.focus()));
|
|
550
567
|
}, F = () => {
|
|
551
|
-
|
|
552
|
-
},
|
|
553
|
-
F(),
|
|
568
|
+
N.value = !1, k.value = "", H.value?.destroy(), H.value = null, h("blur", l.modelValue);
|
|
569
|
+
}, pe = () => N.value ? F() : Ge(), Je = async () => {
|
|
570
|
+
F(), re(), J.value = !0, await R(), se.value && G.value && (ae.value = Se(G.value, se.value, {
|
|
554
571
|
placement: "bottom-end",
|
|
555
572
|
strategy: "fixed",
|
|
556
573
|
modifiers: [{ name: "offset", options: { offset: [0, 4] } }]
|
|
557
574
|
}));
|
|
558
|
-
},
|
|
559
|
-
J.value = !1,
|
|
560
|
-
},
|
|
561
|
-
|
|
562
|
-
},
|
|
575
|
+
}, ee = () => {
|
|
576
|
+
J.value = !1, ae.value?.destroy(), ae.value = null;
|
|
577
|
+
}, Ke = () => J.value ? ee() : Je(), De = (e) => {
|
|
578
|
+
N.value && !V.value?.contains(e.target) && !$.value?.contains(e.target) && F(), J.value && !G.value?.contains(e.target) && !se.value?.contains(e.target) && ee(), L.value && !B.value?.$el?.contains(e.target) && !v.value?.contains(e.target) && re();
|
|
579
|
+
}, Qe = (e) => {
|
|
563
580
|
c.value?.contains(e.relatedTarget) || F();
|
|
564
|
-
},
|
|
565
|
-
!
|
|
581
|
+
}, Xe = async () => {
|
|
582
|
+
!M.value || L.value || (F(), ee(), L.value = !0, await R(), v.value && B.value && (y.value = Se(B.value.$el, v.value, {
|
|
566
583
|
// ⬅️ 5b. USE $el
|
|
567
584
|
placement: "top",
|
|
568
585
|
strategy: "fixed",
|
|
569
586
|
modifiers: [{ name: "offset", options: { offset: [0, 8] } }]
|
|
570
587
|
})));
|
|
571
|
-
},
|
|
572
|
-
|
|
573
|
-
},
|
|
574
|
-
|
|
588
|
+
}, Ye = () => {
|
|
589
|
+
L.value ? re() : Xe();
|
|
590
|
+
}, re = () => {
|
|
591
|
+
L.value = !1, y.value?.destroy(), y.value = null;
|
|
575
592
|
};
|
|
576
|
-
return
|
|
593
|
+
return xe(k, (e) => {
|
|
577
594
|
if (e.trim()) {
|
|
578
595
|
const s = (n) => {
|
|
579
596
|
n.forEach((a) => {
|
|
580
|
-
|
|
597
|
+
I(a) && (K.value.add(b(a)), s(a.children));
|
|
581
598
|
});
|
|
582
599
|
};
|
|
583
|
-
s(
|
|
600
|
+
s(_.value);
|
|
584
601
|
}
|
|
585
|
-
}),
|
|
602
|
+
}), xe(he, () => {
|
|
586
603
|
Ae();
|
|
587
|
-
}),
|
|
588
|
-
document.addEventListener("click",
|
|
589
|
-
}),
|
|
590
|
-
document.removeEventListener("click",
|
|
591
|
-
}), (e, s) => (
|
|
604
|
+
}), xe(W, ie), tt(async () => {
|
|
605
|
+
document.addEventListener("click", De), window.addEventListener("resize", ie), await R(), ie(), Ae();
|
|
606
|
+
}), lt(() => {
|
|
607
|
+
document.removeEventListener("click", De), window.removeEventListener("resize", ie), H.value?.destroy(), ae.value?.destroy(), y.value?.destroy();
|
|
608
|
+
}), (e, s) => (i(), r("div", {
|
|
592
609
|
ref_key: "wrapperRef",
|
|
593
610
|
ref: c,
|
|
594
611
|
class: "tree-select-wrapper",
|
|
595
|
-
onFocusin:
|
|
596
|
-
onFocusout:
|
|
612
|
+
onFocusin: Ue,
|
|
613
|
+
onFocusout: Qe
|
|
597
614
|
}, [
|
|
598
615
|
f("div", {
|
|
599
616
|
ref_key: "triggerRef",
|
|
600
|
-
ref:
|
|
617
|
+
ref: V,
|
|
601
618
|
role: "button",
|
|
602
619
|
tabindex: "0",
|
|
603
|
-
class:
|
|
604
|
-
|
|
620
|
+
class: w(["btn tree-select-trigger w-100 d-flex justify-content-between align-items-center tree-select-main", [
|
|
621
|
+
Le.value,
|
|
605
622
|
{
|
|
606
623
|
"btn-outline-secondary": !t.isInvalid,
|
|
607
624
|
"border-danger": t.isInvalid,
|
|
608
625
|
disabled: t.disabled || t.isLoading,
|
|
609
626
|
"is-loading": t.isLoading,
|
|
610
|
-
"has-chips": t.multiple && t.displayMode === "chips" &&
|
|
627
|
+
"has-chips": t.multiple && t.displayMode === "chips" && P.value.length > 0
|
|
611
628
|
}
|
|
612
629
|
]]),
|
|
613
|
-
onClick:
|
|
630
|
+
onClick: pe,
|
|
614
631
|
onKeydown: [
|
|
615
|
-
|
|
616
|
-
|
|
632
|
+
we(C(pe, ["prevent"]), ["enter"]),
|
|
633
|
+
we(C(pe, ["prevent"]), ["space"])
|
|
617
634
|
]
|
|
618
635
|
}, [
|
|
619
|
-
f("div",
|
|
636
|
+
f("div", kt, [
|
|
620
637
|
ue(e.$slots, "display", {
|
|
621
|
-
selectedItems:
|
|
622
|
-
displayText:
|
|
638
|
+
selectedItems: W.value,
|
|
639
|
+
displayText: he.value,
|
|
623
640
|
placeholder: t.placeholder,
|
|
624
641
|
isLoading: t.isLoading,
|
|
625
|
-
removeItem:
|
|
626
|
-
getItemLabel:
|
|
642
|
+
removeItem: ge,
|
|
643
|
+
getItemLabel: E,
|
|
627
644
|
getItemValue: b,
|
|
628
|
-
visibleChips:
|
|
629
|
-
hiddenChipsCount:
|
|
630
|
-
toggleMorePopover:
|
|
645
|
+
visibleChips: Ne.value,
|
|
646
|
+
hiddenChipsCount: oe.value,
|
|
647
|
+
toggleMorePopover: Ke,
|
|
631
648
|
moreTriggerRef: G.value
|
|
632
649
|
}, () => [
|
|
633
|
-
!t.multiple || t.displayMode === "text" ? (
|
|
650
|
+
!t.multiple || t.displayMode === "text" ? (i(), r("div", wt, [
|
|
634
651
|
f("span", {
|
|
635
652
|
ref_key: "textDisplaySpanRef",
|
|
636
|
-
ref:
|
|
637
|
-
class:
|
|
638
|
-
title:
|
|
639
|
-
},
|
|
640
|
-
|
|
653
|
+
ref: ne,
|
|
654
|
+
class: w(["text-truncate", { "text-danger": qe.value.length > 0 }]),
|
|
655
|
+
title: M.value ? Ie.value : ""
|
|
656
|
+
}, S(t.isLoading ? "Loading data..." : he.value), 11, St),
|
|
657
|
+
M.value && !t.isLoading ? (i(), O(A, {
|
|
641
658
|
key: 0,
|
|
642
659
|
ref_key: "tooltipTriggerIconRef",
|
|
643
|
-
ref:
|
|
660
|
+
ref: B,
|
|
644
661
|
name: "info-circle",
|
|
645
662
|
class: "tooltip-trigger-icon ms-2 flex-shrink-0",
|
|
646
|
-
onClick: C(
|
|
663
|
+
onClick: C(Ye, ["stop"])
|
|
647
664
|
}, null, 512)) : m("", !0)
|
|
648
|
-
])) : t.multiple && t.displayMode === "chips" ? (
|
|
649
|
-
|
|
665
|
+
])) : t.multiple && t.displayMode === "chips" ? (i(), r("div", Ct, [
|
|
666
|
+
P.value.length === 0 ? (i(), r("span", Vt, S(t.placeholder), 1)) : (i(), r("div", {
|
|
650
667
|
key: 1,
|
|
651
668
|
class: "chips-container",
|
|
652
669
|
ref_key: "chipsContainerRef",
|
|
653
|
-
ref:
|
|
670
|
+
ref: Ve
|
|
654
671
|
}, [
|
|
655
|
-
f("div",
|
|
656
|
-
(
|
|
672
|
+
f("div", Lt, [
|
|
673
|
+
(i(!0), r(j, null, Z(W.value, (n) => (i(), r("span", {
|
|
657
674
|
key: "measure-" + b(n),
|
|
658
675
|
class: "badge chip"
|
|
659
676
|
}, [
|
|
660
|
-
f("span",
|
|
661
|
-
|
|
677
|
+
f("span", Mt, S(E(n)), 1),
|
|
678
|
+
te(A, {
|
|
662
679
|
name: "times",
|
|
663
680
|
class: "chip-remove"
|
|
664
681
|
})
|
|
665
682
|
]))), 128))
|
|
666
683
|
]),
|
|
667
|
-
(
|
|
684
|
+
(i(!0), r(j, null, Z(Ne.value, (n) => (i(), r("span", {
|
|
668
685
|
key: b(n),
|
|
669
|
-
class:
|
|
686
|
+
class: w(["badge chip", n.__missing ? "bg-danger text-white" : "bg-primary text-white"])
|
|
670
687
|
}, [
|
|
671
|
-
f("span",
|
|
672
|
-
|
|
688
|
+
f("span", It, S(E(n)), 1),
|
|
689
|
+
te(A, {
|
|
673
690
|
name: "times",
|
|
674
691
|
class: "chip-remove",
|
|
675
|
-
onClick: C((a) =>
|
|
692
|
+
onClick: C((a) => ge(n), ["stop"])
|
|
676
693
|
}, null, 8, ["onClick"])
|
|
677
694
|
], 2))), 128)),
|
|
678
|
-
|
|
695
|
+
oe.value > 0 ? (i(), r("button", {
|
|
679
696
|
key: 0,
|
|
680
697
|
ref_key: "moreTriggerRef",
|
|
681
698
|
ref: G,
|
|
682
699
|
type: "button",
|
|
683
700
|
class: "btn btn-sm btn-light more-button",
|
|
684
|
-
onClick: C(
|
|
685
|
-
}, " +" +
|
|
701
|
+
onClick: C(Ke, ["stop"])
|
|
702
|
+
}, " +" + S(oe.value), 513)) : m("", !0)
|
|
686
703
|
], 512))
|
|
687
704
|
])) : m("", !0)
|
|
688
705
|
], !0)
|
|
689
706
|
]),
|
|
690
|
-
f("div",
|
|
691
|
-
t.isLoading ? (
|
|
707
|
+
f("div", At, [
|
|
708
|
+
t.isLoading ? (i(), O(A, {
|
|
692
709
|
key: 0,
|
|
693
710
|
name: "spinner",
|
|
694
711
|
class: "loading-icon"
|
|
695
712
|
})) : m("", !0),
|
|
696
|
-
t.showClearButton &&
|
|
713
|
+
t.showClearButton && P.value.length > 0 && !t.disabled && !t.isLoading ? (i(), O(A, {
|
|
697
714
|
key: 1,
|
|
698
715
|
name: "times",
|
|
699
|
-
onClick: C(
|
|
716
|
+
onClick: C(je, ["stop"]),
|
|
700
717
|
class: "clear-icon"
|
|
701
718
|
})) : m("", !0),
|
|
702
|
-
t.isLoading ? m("", !0) : (
|
|
719
|
+
t.isLoading ? m("", !0) : (i(), O(A, {
|
|
703
720
|
key: 2,
|
|
704
721
|
name: "chevron-down",
|
|
705
|
-
class:
|
|
722
|
+
class: w(["transition-transform", { "rotate-180": N.value }])
|
|
706
723
|
}, null, 8, ["class"]))
|
|
707
724
|
])
|
|
708
|
-
], 42,
|
|
709
|
-
J.value ? (
|
|
725
|
+
], 42, xt),
|
|
726
|
+
J.value ? (i(), r("div", {
|
|
710
727
|
key: 0,
|
|
711
728
|
ref_key: "morePopoverRef",
|
|
712
|
-
ref:
|
|
729
|
+
ref: se,
|
|
713
730
|
class: "card shadow-lg border-0 more-popover",
|
|
714
731
|
style: { "z-index": "1060" }
|
|
715
732
|
}, [
|
|
716
|
-
f("div",
|
|
717
|
-
(
|
|
733
|
+
f("div", $t, [
|
|
734
|
+
(i(!0), r(j, null, Z(Oe.value, (n) => (i(), r("div", {
|
|
718
735
|
key: b(n),
|
|
719
736
|
class: "list-group-item d-flex justify-content-between align-items-center py-1 px-2"
|
|
720
737
|
}, [
|
|
721
|
-
f("small", Nt,
|
|
722
|
-
t.disabled ? m("", !0) : (
|
|
738
|
+
f("small", Nt, S(E(n)), 1),
|
|
739
|
+
t.disabled ? m("", !0) : (i(), O(A, {
|
|
723
740
|
key: 0,
|
|
724
741
|
name: "times",
|
|
725
742
|
class: "chip-remove flex-shrink-0",
|
|
726
|
-
onClick: C((a) =>
|
|
743
|
+
onClick: C((a) => ge(n), ["stop"])
|
|
727
744
|
}, null, 8, ["onClick"]))
|
|
728
745
|
]))), 128))
|
|
729
746
|
])
|
|
730
747
|
], 512)) : m("", !0),
|
|
731
|
-
|
|
748
|
+
N.value ? (i(), r("div", {
|
|
732
749
|
key: 1,
|
|
733
750
|
ref_key: "dropdownRef",
|
|
734
|
-
ref:
|
|
751
|
+
ref: $,
|
|
735
752
|
class: "tree-select-dropdown card shadow-lg border-0",
|
|
736
753
|
onMousedown: s[2] || (s[2] = C(() => {
|
|
737
754
|
}, ["prevent"])),
|
|
@@ -739,59 +756,60 @@ const xe = (t, q) => {
|
|
|
739
756
|
}, ["stop"])),
|
|
740
757
|
style: { "z-index": "1050" }
|
|
741
758
|
}, [
|
|
742
|
-
f("div",
|
|
743
|
-
t.searchable ?
|
|
759
|
+
f("div", Bt, [
|
|
760
|
+
t.searchable ? ke((i(), r("input", {
|
|
744
761
|
key: 0,
|
|
745
|
-
"onUpdate:modelValue": s[0] || (s[0] = (n) =>
|
|
762
|
+
"onUpdate:modelValue": s[0] || (s[0] = (n) => k.value = n),
|
|
746
763
|
type: "text",
|
|
747
|
-
class:
|
|
764
|
+
class: w(["form-control tree-search-input", Me.value]),
|
|
748
765
|
placeholder: "Search...",
|
|
749
|
-
onKeydown:
|
|
750
|
-
}, null, 42,
|
|
751
|
-
[
|
|
766
|
+
onKeydown: we(C(Ze, ["prevent"]), ["enter"])
|
|
767
|
+
}, null, 42, Tt)), [
|
|
768
|
+
[nt, k.value]
|
|
752
769
|
]) : m("", !0),
|
|
753
|
-
t.sortable && t.sortOptions.length > 0 ? (
|
|
754
|
-
|
|
755
|
-
"onUpdate:modelValue": s[1] || (s[1] = (n) =>
|
|
756
|
-
class:
|
|
770
|
+
t.sortable && t.sortOptions.length > 0 ? (i(), r("div", zt, [
|
|
771
|
+
ke(f("select", {
|
|
772
|
+
"onUpdate:modelValue": s[1] || (s[1] = (n) => z.value = n),
|
|
773
|
+
class: w(["form-select flex-grow-1", Me.value])
|
|
757
774
|
}, [
|
|
758
775
|
s[4] || (s[4] = f("option", {
|
|
759
776
|
value: null,
|
|
760
777
|
disabled: ""
|
|
761
778
|
}, "Sort by...", -1)),
|
|
762
|
-
(
|
|
779
|
+
(i(!0), r(j, null, Z(t.sortOptions, (n) => (i(), r("option", {
|
|
763
780
|
key: n.value,
|
|
764
781
|
value: n.value
|
|
765
|
-
},
|
|
782
|
+
}, S(n.label), 9, Et))), 128))
|
|
766
783
|
], 2), [
|
|
767
|
-
[
|
|
784
|
+
[st, z.value]
|
|
768
785
|
]),
|
|
769
786
|
f("button", {
|
|
770
787
|
type: "button",
|
|
771
|
-
class:
|
|
772
|
-
disabled: !
|
|
773
|
-
onClick:
|
|
788
|
+
class: w(["btn btn-outline-secondary", Le.value]),
|
|
789
|
+
disabled: !z.value,
|
|
790
|
+
onClick: We
|
|
774
791
|
}, [
|
|
775
|
-
|
|
792
|
+
te(A, {
|
|
776
793
|
name: U.value === "asc" ? "asc" : "desc"
|
|
777
794
|
}, null, 8, ["name"])
|
|
778
|
-
], 10,
|
|
795
|
+
], 10, Kt)
|
|
779
796
|
])) : m("", !0)
|
|
780
797
|
]),
|
|
781
|
-
t.isLoading ? (
|
|
782
|
-
|
|
798
|
+
t.isLoading ? (i(), r("div", Dt, [
|
|
799
|
+
te(A, {
|
|
783
800
|
name: "spinner",
|
|
784
801
|
class: "me-2"
|
|
785
802
|
}),
|
|
786
803
|
s[5] || (s[5] = f("span", null, "Loading...", -1))
|
|
787
|
-
])) : (
|
|
788
|
-
|
|
789
|
-
(
|
|
804
|
+
])) : (i(), r("div", Pt, [
|
|
805
|
+
_.value.length > 0 ? (i(), r("div", Rt, [
|
|
806
|
+
(i(!0), r(j, null, Z(_.value, (n, a) => (i(), O(bt, {
|
|
790
807
|
key: b(n),
|
|
791
808
|
item: n,
|
|
792
809
|
level: 0,
|
|
793
|
-
"
|
|
794
|
-
"
|
|
810
|
+
"display-mode": t.displayMode,
|
|
811
|
+
"selected-items": P.value,
|
|
812
|
+
"expanded-items": K.value,
|
|
795
813
|
multiple: t.multiple,
|
|
796
814
|
"select-all": t.selectAll,
|
|
797
815
|
"select-mode": t.selectMode,
|
|
@@ -799,66 +817,68 @@ const xe = (t, q) => {
|
|
|
799
817
|
"option-value": t.optionValue,
|
|
800
818
|
"disabled-key": t.disabledKey,
|
|
801
819
|
"disable-branch-node": t.disableBranchNodes,
|
|
802
|
-
|
|
803
|
-
|
|
820
|
+
index: a,
|
|
821
|
+
"siblings-count": _.value.length,
|
|
822
|
+
onSelect: He,
|
|
823
|
+
onToggleExpand: ze
|
|
804
824
|
}, {
|
|
805
|
-
default:
|
|
825
|
+
default: Re(({ item: o, level: d }) => [
|
|
806
826
|
ue(e.$slots, "default", {
|
|
807
|
-
item:
|
|
808
|
-
level:
|
|
827
|
+
item: o,
|
|
828
|
+
level: d
|
|
809
829
|
}, () => [
|
|
810
|
-
f("div",
|
|
811
|
-
|
|
812
|
-
|
|
830
|
+
f("div", Ot, [
|
|
831
|
+
de(S(E(o)) + " ", 1),
|
|
832
|
+
o.icon ? (i(), r("i", {
|
|
813
833
|
key: 0,
|
|
814
|
-
class:
|
|
834
|
+
class: w(o.icon)
|
|
815
835
|
}, null, 2)) : m("", !0)
|
|
816
836
|
])
|
|
817
837
|
], !0)
|
|
818
838
|
]),
|
|
819
839
|
_: 2
|
|
820
|
-
}, 1032, ["item", "selected-items", "expanded-items", "multiple", "select-all", "select-mode", "option-label", "option-value", "disabled-key", "disable-branch-node"]))), 128))
|
|
821
|
-
])) : (
|
|
822
|
-
t.allowAddNew ? (
|
|
823
|
-
t.addNewMode === "button" ? (
|
|
840
|
+
}, 1032, ["item", "display-mode", "selected-items", "expanded-items", "multiple", "select-all", "select-mode", "option-label", "option-value", "disabled-key", "disable-branch-node", "index", "siblings-count"]))), 128))
|
|
841
|
+
])) : (i(), r("div", Ft, [
|
|
842
|
+
t.allowAddNew ? (i(), r("div", qt, [
|
|
843
|
+
t.addNewMode === "button" ? (i(), r("button", {
|
|
824
844
|
key: 0,
|
|
825
845
|
type: "button",
|
|
826
846
|
class: "btn btn-success btn-sm w-100",
|
|
827
|
-
onClick:
|
|
847
|
+
onClick: Ee
|
|
828
848
|
}, [
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
])) : t.addNewMode === "enter" ? (
|
|
832
|
-
|
|
833
|
-
|
|
849
|
+
de(' No items found "Click" to ' + S(t.addNewLabel) + " ", 1),
|
|
850
|
+
k.value.trim() ? (i(), r("span", Ht, ' : "' + S(k.value) + '" ', 1)) : m("", !0)
|
|
851
|
+
])) : t.addNewMode === "enter" ? (i(), r("span", Wt, [
|
|
852
|
+
de(' No items found "Press Enter" to ' + S(t.addNewLabel) + " ", 1),
|
|
853
|
+
k.value.trim() ? (i(), r("span", jt, ' : "' + S(k.value) + '" ', 1)) : m("", !0)
|
|
834
854
|
])) : m("", !0)
|
|
835
|
-
])) : (
|
|
836
|
-
|
|
855
|
+
])) : (i(), r("div", Zt, [
|
|
856
|
+
te(A, {
|
|
837
857
|
name: "search",
|
|
838
858
|
class: "me-1"
|
|
839
859
|
}),
|
|
840
|
-
s[6] || (s[6] =
|
|
860
|
+
s[6] || (s[6] = de(" No items found ", -1))
|
|
841
861
|
]))
|
|
842
862
|
]))
|
|
843
863
|
]))
|
|
844
864
|
], 544)) : m("", !0),
|
|
845
|
-
|
|
865
|
+
ke(f("div", {
|
|
846
866
|
ref_key: "tooltipRef",
|
|
847
|
-
ref:
|
|
867
|
+
ref: v,
|
|
848
868
|
class: "tree-select-tooltip card shadow-sm py-1 px-2",
|
|
849
869
|
role: "tooltip",
|
|
850
870
|
style: { "z-index": "1070" }
|
|
851
|
-
},
|
|
852
|
-
[
|
|
871
|
+
}, S(Ie.value), 513), [
|
|
872
|
+
[at, L.value]
|
|
853
873
|
])
|
|
854
874
|
], 544));
|
|
855
875
|
}
|
|
856
|
-
},
|
|
876
|
+
}, Gt = /* @__PURE__ */ Ce(Ut, [["__scopeId", "data-v-880ba6da"]]), Yt = {
|
|
857
877
|
install(t) {
|
|
858
|
-
t.component("VSelect",
|
|
878
|
+
t.component("VSelect", Gt);
|
|
859
879
|
}
|
|
860
880
|
};
|
|
861
881
|
export {
|
|
862
|
-
|
|
863
|
-
|
|
882
|
+
Gt as VSelect,
|
|
883
|
+
Yt as default
|
|
864
884
|
};
|
package/dist/vue-select.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(x,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@popperjs/core")):typeof define=="function"&&define.amd?define(["exports","vue","@popperjs/core"],e):(x=typeof globalThis<"u"?globalThis:x||self,e(x.VueSelect={},x.Vue,x.Popper))})(this,(function(x,e,X){"use strict";const Y=(l,T)=>{const n=l.__vccOpts||l;for(const[u,d]of T)n[u]=d;return n},Ve={key:0},we={key:1},xe={key:2},Ce={key:3},Se={key:4},Ee={key:5},Ne={key:6},Le={key:7},k=Y({__name:"SvgIcon",props:{name:{type:String,required:!0}},setup(l){const T=l,n=e.computed(()=>({"svg-icon-spin":T.name==="spinner"}));return(u,d)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"1em",height:"1em",class:e.normalizeClass(n.value)},[l.name==="spinner"?(e.openBlock(),e.createElementBlock("g",Ve,d[0]||(d[0]=[e.createElementVNode("path",{d:"M12,4V2A10,10,0,0,0,2,12H4A8,8,0,0,1,12,4Z"},null,-1)]))):e.createCommentVNode("",!0),l.name==="times"?(e.openBlock(),e.createElementBlock("g",we,d[1]||(d[1]=[e.createElementVNode("path",{d:"M13.41,12l4.3-4.29a1,1,0,1,0-1.42-1.42L12,10.59,7.71,6.29A1,1,0,0,0,6.29,7.71L10.59,12l-4.3,4.29a1,1,0,0,0,0,1.42,1,1,0,0,0,1.42,0L12,13.41l4.29,4.3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42Z"},null,-1)]))):e.createCommentVNode("",!0),l.name==="chevron-down"?(e.openBlock(),e.createElementBlock("g",xe,d[2]||(d[2]=[e.createElementVNode("path",{d:"M17,9.17a1,1,0,0,0-1.41,0L12,12.71,8.46,9.17a1,1,0,0,0-1.41,0,1,1,0,0,0,0,1.42l4.24,4.24a1,1,0,0,0,1.42,0L17,10.59A1,1,0,0,0,17,9.17Z"},null,-1)]))):e.createCommentVNode("",!0),l.name==="chevron-right"?(e.openBlock(),e.createElementBlock("g",Ce,d[3]||(d[3]=[e.createElementVNode("path",{d:"M10.83,12l-4.24,4.24a1,1,0,0,0,1.41,1.41L13.66,12,8,6.34A1,1,0,0,0,6.59,7.76Z"},null,-1)]))):e.createCommentVNode("",!0),l.name==="search"?(e.openBlock(),e.createElementBlock("g",Se,d[4]||(d[4]=[e.createElementVNode("path",{d:"M21.71,20.29,18,16.61A9,9,0,1,0,16.61,18l3.68,3.68a1,1,0,0,0,1.42,0A1,1,0,0,0,21.71,20.29ZM11,18a7,7,0,1,1,7-7A7,7,0,0,1,11,18Z"},null,-1)]))):e.createCommentVNode("",!0),l.name==="asc"?(e.openBlock(),e.createElementBlock("g",Ee,d[5]||(d[5]=[e.createElementVNode("path",{fill:"currentColor",d:"M4.869 11H2.667L6 3h2l3.333 8H9.131l-.41-1H5.28zm1.23-3h1.803L7 5.8zm12.9 8V3h-2v13h-3l4 5l4-5zm-8-3H3v2h4.855L3 19v2h8v-2H6.146L11 15z"},null,-1)]))):e.createCommentVNode("",!0),l.name==="desc"?(e.openBlock(),e.createElementBlock("g",Ne,d[6]||(d[6]=[e.createElementVNode("path",{fill:"currentColor",d:"M4.869 11H2.667L6 3h2l3.333 8H9.131l-.41-1H5.28zm1.23-3h1.803L7 5.8zm15.9 0l-4-5l-4 5h3v13h2V8zm-11 5H3v2h4.855L3 19v2h8v-2H6.146L11 15z"},null,-1)]))):e.createCommentVNode("",!0),l.name==="info-circle"?(e.openBlock(),e.createElementBlock("g",Le,d[7]||(d[7]=[e.createElementVNode("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},null,-1)]))):e.createCommentVNode("",!0)],2))}},[["__scopeId","data-v-89f9b7e1"]]),Me={class:"tree-select-item-wrapper"},Ae={key:1,class:"expander-placeholder flex-shrink-0"},Ie=["checked",".indeterminate","disabled"],$e={class:"item-content text-start text-break lh-sm"},Te={key:0,class:"children-wrapper"},ze=Y({__name:"TreeSelectItem",props:{item:{type:Object,required:!0},level:{type:Number,required:!0},selectedItems:{type:Array,required:!0},expandedItems:{type:Set,required:!0},multiple:{type:Boolean,required:!0},selectAll:{type:Boolean,required:!0},selectMode:{type:String,required:!0},optionLabel:{type:String,required:!0},optionValue:{type:String,required:!0},disabledKey:{type:String,default:null},disableBranchNode:{type:Boolean,default:!1}},emits:["select","toggle-expand"],setup(l,{emit:T}){const n=l,u=m=>m[n.optionValue]||m.id||m.value,d=m=>!n.disabledKey||!m?!1:m.hasOwnProperty(n.disabledKey)&&m[n.disabledKey]!==null,b=e.computed(()=>n.item.children&&n.item.children.length>0),N=e.computed(()=>n.expandedItems.has(u(n.item))),g=e.computed(()=>n.selectedItems.includes(u(n.item))),C=m=>{let f=[];return m.children&&m.children.forEach(S=>{f.push(u(S)),f.push(...C(S))}),f},A=e.computed(()=>!n.multiple||!n.selectAll||!b.value||g.value?!1:C(n.item).some(f=>n.selectedItems.includes(f)));return(m,f)=>{const S=e.resolveComponent("TreeSelectItem",!0);return e.openBlock(),e.createElementBlock("div",Me,[e.createElementVNode("div",{class:e.normalizeClass(["list-group-item list-group-item-action d-flex align-items-center gap-2",{"bg-primary text-white":g.value&&(l.selectMode==="highlight"||!l.multiple)&&!d(l.item)&&!(l.disableBranchNode&&b.value),"is-disabled text-muted bg-light":d(l.item)}]),style:e.normalizeStyle({"padding-left":`${l.level*1.5+1}rem`}),onClick:f[2]||(f[2]=y=>d(l.item)?null:m.$emit("select",l.item))},[b.value?(e.openBlock(),e.createBlock(k,{key:0,name:"chevron-right",class:e.normalizeClass(["expander-icon flex-shrink-0 mt-1",{"rotate-90":N.value}]),onClick:f[0]||(f[0]=e.withModifiers(y=>m.$emit("toggle-expand",u(l.item)),["stop"]))},null,8,["class"])):(e.openBlock(),e.createElementBlock("span",Ae)),l.multiple&&l.selectMode==="checkbox"&&!(l.disableBranchNode&&b.value)?(e.openBlock(),e.createElementBlock("input",{key:2,type:"checkbox",class:"tree-checkbox",checked:g.value,".indeterminate":A.value,disabled:d(l.item),onClick:f[1]||(f[1]=e.withModifiers(y=>m.$emit("select",l.item),["stop"]))},null,40,Ie)):e.createCommentVNode("",!0),e.createElementVNode("div",$e,[e.renderSlot(m.$slots,"default",{item:l.item,level:l.level},void 0,!0)])],6),b.value&&N.value?(e.openBlock(),e.createElementBlock("div",Te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.children,y=>(e.openBlock(),e.createBlock(S,{key:u(y),item:y,level:l.level+1,"selected-items":l.selectedItems,"expanded-items":l.expandedItems,multiple:l.multiple,"select-all":l.selectAll,"select-mode":l.selectMode,"option-label":l.optionLabel,"option-value":l.optionValue,"disabled-key":l.disabledKey,"disable-branch-node":l.disableBranchNode,onSelect:f[3]||(f[3]=V=>m.$emit("select",V)),onToggleExpand:f[4]||(f[4]=V=>m.$emit("toggle-expand",V))},{default:e.withCtx(({item:V,level:H})=>[e.renderSlot(m.$slots,"default",{item:V,level:H},void 0,!0)]),_:2},1032,["item","level","selected-items","expanded-items","multiple","select-all","select-mode","option-label","option-value","disabled-key","disable-branch-node"]))),128))])):e.createCommentVNode("",!0)])}}},[["__scopeId","data-v-11d582f4"]]),De=["onKeydown"],Ke={class:"tree-select-display-container"},Pe={key:0,class:"d-flex align-items-center justify-content-start w-100"},Fe=["title"],Re={key:1},Oe={key:0,class:"text-muted"},qe={class:"chip-measure-layer","aria-hidden":"true"},je={class:"chip-label"},He={class:"chip-label"},We={class:"d-flex align-items-center gap-2"},Ze={class:"list-group list-group-flush"},Ue={class:"text-wrap text-start me-2"},Ge={class:"p-2 border-bottom d-flex flex-column gap-2"},Je=["onKeydown"],Qe={key:1,class:"d-flex align-items-center gap-2"},Xe=["value"],Ye=["disabled"],ve={key:0,class:"p-4 text-muted text-center"},_e={key:1,class:"tree-select-body",style:{"max-height":"300px","overflow-y":"auto"}},et={key:0,class:"list-group list-group-flush"},tt={class:"d-flex align-items-center gap-2",style:{"white-space":"wrap"}},lt={key:1,class:"p-3 text-muted text-center"},nt={key:0},ot={key:0},at={key:1},rt={key:0},st={key:1},re=Y({__name:"TreeSelectMain",props:{modelValue:{type:[String,Number,Array],default:null},displayMode:{type:String,default:"text",validator:l=>["text","chips"].includes(l)},items:{type:Array,default:()=>[]},multiple:{type:Boolean,default:!1},selectMode:{type:String,default:"checkbox",validator:l=>["checkbox","highlight"].includes(l)},placeholder:{type:String,default:"Select item..."},isInvalid:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},searchable:{type:Boolean,default:!0},isLoading:{type:Boolean,default:!1},showClearButton:{type:Boolean,default:!0},selectAll:{type:Boolean,default:!1},deselectAll:{type:Boolean,default:!0},canDeselect:{type:Boolean,default:!0},optionLabel:{type:String,default:"value"},optionValue:{type:String,default:"code"},disabledKey:{type:String,default:null},excludeFromSelectedListKey:{type:String,default:null},disableBranchNodes:{type:Boolean,default:!1},size:{type:String,default:"sm",validator:l=>["sm","md","lg","xl"].includes(l)},sortable:{type:Boolean,default:!1},sortOptions:{type:Array,default:()=>[]},defaultSortKey:{type:String,default:null},defaultSortDirection:{type:String,default:"asc",validator:l=>["asc","desc"].includes(l)},maxVisibleChipsDisplay:{type:Number,default:null},closeOnSelect:{type:Boolean,default:!0},allowAddNew:{type:Boolean,default:!1},addNewMode:{type:String,default:"button",validator:l=>["button","enter"].includes(l)},addNewLabel:{type:String,default:"Add new record"},keyFilters:{type:Array,default:()=>[]}},emits:["update:modelValue","change","clear","deselect","select","focus","blur","add-new"],setup(l,{emit:T}){const n=l,u=T,d=e.ref(null),b=e.ref(null),N=e.ref(null),g=e.ref(""),C=e.ref(!1),A=e.ref(new Set),m=e.ref(null),f=e.ref(null),S=e.ref(null),y=e.ref(!1),V=e.ref(null),H=e.ref(null),D=e.ref(!1),I=e.ref(n.defaultSortKey),K=e.ref(n.defaultSortDirection),P=e.ref(null),W=e.ref(null),F=e.ref(!1),Z=e.ref(null),se=e.ref(null),v=e.ref(0),ie=e.computed(()=>n.size==="sm"?"btn-sm":n.size==="lg"?"btn-lg":n.size==="xl"?"btn-xl":""),ce=e.computed(()=>n.size==="sm"?"form-control-sm":n.size==="lg"?"form-control-lg":n.size==="xl"?"form-control-xl":""),ct=e.computed(()=>G.value===0?[]:z.value.slice(ne.value)),R=e.computed(()=>!n.multiple||!n.excludeFromSelectedListKey?M.value:M.value.filter(t=>{const a=L(t);return!a||!a[n.excludeFromSelectedListKey]})),de=e.computed(()=>{const t=R.value;if(t.length===0)return n.placeholder;if(n.multiple){if(t.length===1){const o=q(t[0]);return o?o.join(" → "):t[0]}return`${t.length} items selected`}const a=q(t[0]);return a?a.join(" → "):t[0]}),dt=e.computed(()=>n.multiple?Array.isArray(n.modelValue)?n.modelValue:[]:n.modelValue!==null&&n.modelValue!==void 0?[n.modelValue]:[]),mt=e.computed(()=>dt.value.filter(t=>!L(t))),me=async()=>{await e.nextTick();const t=H.value;if(n.multiple||n.displayMode==="chips"||R.value.length===0||!t){D.value=!1;return}D.value=t.scrollWidth>t.clientWidth},E=t=>t&&(t[n.optionLabel]||t.label||t.name)||"",p=t=>t?t[n.optionValue]||t.id||t.value:null,_=t=>!n.disabledKey||!t?!1:t.hasOwnProperty(n.disabledKey)&&t[n.disabledKey]!==null,B=t=>t.children&&t.children.length>0,O=(t,a)=>{if(a)return a.split(".").reduce((o,r)=>o&&o[r],t)},L=(t,a=n.items)=>{for(const o of a){if(p(o)===t)return o;if(B(o)){const r=L(t,o.children);if(r)return r}}return null},ee=t=>{const a=[];return B(t)&&t.children.forEach(o=>{_(o)||(a.push(p(o)),a.push(...ee(o)))}),a},U=async()=>{await e.nextTick();const t=se.value;if(!t)return;const a=t.querySelector(".chip-measure-layer");if(!a)return;const o=Array.from(a.children);if(!o.length){v.value=0;return}const r=t.clientWidth,s=4,i=40;let c=0,h=0;for(let w=0;w<o.length;w++){const Be=o[w].offsetWidth+s,wt=w<o.length-1?i:0;if(c+Be+wt>r)break;c+=Be,h++}v.value=Math.max(h,1)},te=(t,a=n.items,o=[])=>{for(const r of a){if(p(r)===t)return o;if(B(r)){const s=te(t,r.children,[...o,p(r)]);if(s)return s}}return null},M=e.computed(()=>{const t=new Set(Array.isArray(n.modelValue)?n.modelValue:[n.modelValue].filter(Boolean));if(n.multiple&&n.selectAll){const a=o=>{o.forEach(r=>{if(B(r)){const s=r.children.filter(c=>!_(c));s.length>0&&s.every(c=>t.has(p(c)))&&t.add(p(r)),a(r.children)}})};a(n.items)}return Array.from(t)}),q=(t,a=n.items,o=[])=>{for(const r of a){const s=[...o,E(r)];if(p(r)===t)return s;if(B(r)){const i=q(t,r.children,s);if(i)return i}}return null},ue=t=>{if(!t||t.length===0)return"";const a=t.join(" → ");return a.length<=40?a:t.length>2?`${t[0]} → ... → ${t[t.length-1]}`:a},le=e.computed(()=>{const t=R.value;if(t.length===0)return n.placeholder;if(n.multiple){if(t.length===1){const s=L(t[0]);if(!s)return`${t[0]} (No longer available)`;const i=q(t[0]);return i?ue(i):E(s)}return`${t.length} items selected`}const a=t[0],o=L(a);if(!o)return`${a} (No longer available)`;const r=q(a);return r?ue(r):E(o)}),z=e.computed(()=>{if(!n.multiple||R.value.length===0)return[];const t=R.value.map(r=>{const s=L(r);return s||{[n.optionValue]:r,[n.optionLabel]:`${r} (No longer available)`,__missing:!0}});if(!n.sortable||!I.value)return t;const a=I.value,o=K.value;return[...t].sort((r,s)=>{if(r.__missing)return 1;if(s.__missing)return-1;const i=O(r,a),c=O(s,a);if(i==null)return 1;if(c==null)return-1;let h=0;return typeof i=="string"&&typeof c=="string"?h=i.localeCompare(c):i>c?h=1:i<c&&(h=-1),o==="desc"?h*-1:h})}),fe=e.computed(()=>z.value.slice(0,ne.value)),ne=e.computed(()=>n.maxVisibleChipsDisplay!==null?n.maxVisibleChipsDisplay:Math.max(v.value,1)),G=e.computed(()=>{const t=z.value.length-ne.value;return t>0?t:0}),pe=(t,a)=>{const o=a.toLowerCase();return t.map(r=>{let s=!1;if(n.keyFilters&&n.keyFilters.length>0)for(const c of n.keyFilters){const h=O(r,c);if(h!=null&&String(h).toLowerCase().includes(o)){s=!0;break}}else s=E(r).toLowerCase().includes(o);if(!B(r))return s?r:null;const i=pe(r.children,a);return s?{...r,children:r.children}:i.length>0?{...r,children:i}:null}).filter(Boolean)},he=(t,a,o)=>!t||!a?t:[...t].sort((s,i)=>{const c=O(s,a),h=O(i,a);if(c==null)return 1;if(h==null)return-1;let w=0;return typeof c=="string"&&typeof h=="string"?w=c.localeCompare(h):c>h?w=1:c<h&&(w=-1),o==="desc"?w*-1:w}).map(s=>B(s)?{...s,children:he(s.children,a,o)}:s),J=e.computed(()=>{const t=g.value.trim(),a=t?pe(n.items,t):n.items;return!n.sortable||!I.value?a:he(a,I.value,K.value)}),ut=t=>{if(n.disableBranchNodes&&B(t)){const s=p(t);ge(s);return}if(_(t))return;const a=p(t);let o=new Set(M.value);if(n.multiple){const s=o.has(a);if(n.selectAll&&B(t)){const i=ee(t);s?(o.delete(a),u("deselect",t),n.deselectAll&&i.forEach(c=>o.delete(c))):(o.add(a),i.forEach(c=>o.add(c)),u("select",t))}else s?(o.delete(a),n.selectAll&&te(a)?.forEach(c=>o.delete(c))):o.add(a)}else{const s=n.modelValue,i=p(t);s===i?(o.clear(),u("deselect",t)):(o.clear(),o.add(i),s!=null&&L(s),u("select",t)),n.closeOnSelect&&$(),e.nextTick(()=>{N.value?.focus()})}let r=Array.from(o);n.multiple&&n.excludeFromSelectedListKey&&(r=r.filter(s=>{const i=L(s);return!i||!i[n.excludeFromSelectedListKey]})),u("update:modelValue",n.multiple?r:r[0]||null),u("change",n.multiple?r:r[0]||null)},oe=t=>{if(n.disabled||!t)return;const a=p(t),o=new Set(M.value);o.delete(a),n.selectAll&&(n.deselectAll&&B(t)&&ee(t).forEach(c=>o.delete(c)),te(a)?.forEach(i=>o.delete(i)));const r=Array.from(o);u("update:modelValue",r),u("change",r)},ge=t=>{A.value.has(t)?A.value.delete(t):A.value.add(t)},ft=()=>{K.value=K.value==="asc"?"desc":"asc"},pt=()=>{const t=n.multiple?[]:null;u("clear"),u("update:modelValue",t),u("change",t),j()},ye=()=>{!n.allowAddNew||!g.value.trim()||(u("add-new",g.value.trim()),$())},ht=()=>{n.allowAddNew&&n.addNewMode==="enter"&&g.value.trim()&&J.value.length===0&&ye()},gt=t=>{u("focus",t)},yt=async()=>{n.disabled||(j(),C.value=!0,Q(),await e.nextTick(),b.value&&N.value&&(m.value=X.createPopper(N.value,b.value,{placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,4]}},{name:"preventOverflow",options:{padding:8}},{name:"flip",options:{fallbackPlacements:["top-start"]}},{name:"sameWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:t})=>{t.styles.popper.width=`${t.rects.reference.width}px`},effect:({state:t})=>{t.elements.popper.style.width=`${t.elements.reference.offsetWidth}px`}}]})),n.searchable&&(await e.nextTick(),b.value?.querySelector(".tree-search-input")?.focus()))},$=()=>{C.value=!1,g.value="",m.value?.destroy(),m.value=null,u("blur",n.modelValue)},ae=()=>C.value?$():yt(),kt=async()=>{$(),Q(),F.value=!0,await e.nextTick(),W.value&&P.value&&(Z.value=X.createPopper(P.value,W.value,{placement:"bottom-end",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,4]}}]}))},j=()=>{F.value=!1,Z.value?.destroy(),Z.value=null},ke=()=>F.value?j():kt(),be=t=>{C.value&&!N.value?.contains(t.target)&&!b.value?.contains(t.target)&&$(),F.value&&!P.value?.contains(t.target)&&!W.value?.contains(t.target)&&j(),y.value&&!V.value?.$el?.contains(t.target)&&!f.value?.contains(t.target)&&Q()},bt=t=>{d.value?.contains(t.relatedTarget)||$()},Bt=async()=>{!D.value||y.value||($(),j(),y.value=!0,await e.nextTick(),f.value&&V.value&&(S.value=X.createPopper(V.value.$el,f.value,{placement:"top",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,8]}}]})))},Vt=()=>{y.value?Q():Bt()},Q=()=>{y.value=!1,S.value?.destroy(),S.value=null};return e.watch(g,t=>{if(t.trim()){const a=o=>{o.forEach(r=>{B(r)&&(A.value.add(p(r)),a(r.children))})};a(J.value)}}),e.watch(le,()=>{me()}),e.watch(z,U),e.onMounted(async()=>{document.addEventListener("click",be),window.addEventListener("resize",U),await e.nextTick(),U(),me()}),e.onUnmounted(()=>{document.removeEventListener("click",be),window.removeEventListener("resize",U),m.value?.destroy(),Z.value?.destroy(),S.value?.destroy()}),(t,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:d,class:"tree-select-wrapper",onFocusin:gt,onFocusout:bt},[e.createElementVNode("div",{ref_key:"triggerRef",ref:N,role:"button",tabindex:"0",class:e.normalizeClass(["btn tree-select-trigger w-100 d-flex justify-content-between align-items-center tree-select-main",[ie.value,{"btn-outline-secondary":!l.isInvalid,"border-danger":l.isInvalid,disabled:l.disabled||l.isLoading,"is-loading":l.isLoading,"has-chips":l.multiple&&l.displayMode==="chips"&&M.value.length>0}]]),onClick:ae,onKeydown:[e.withKeys(e.withModifiers(ae,["prevent"]),["enter"]),e.withKeys(e.withModifiers(ae,["prevent"]),["space"])]},[e.createElementVNode("div",Ke,[e.renderSlot(t.$slots,"display",{selectedItems:z.value,displayText:le.value,placeholder:l.placeholder,isLoading:l.isLoading,removeItem:oe,getItemLabel:E,getItemValue:p,visibleChips:fe.value,hiddenChipsCount:G.value,toggleMorePopover:ke,moreTriggerRef:P.value},()=>[!l.multiple||l.displayMode==="text"?(e.openBlock(),e.createElementBlock("div",Pe,[e.createElementVNode("span",{ref_key:"textDisplaySpanRef",ref:H,class:e.normalizeClass(["text-truncate",{"text-danger":mt.value.length>0}]),title:D.value?de.value:""},e.toDisplayString(l.isLoading?"Loading data...":le.value),11,Fe),D.value&&!l.isLoading?(e.openBlock(),e.createBlock(k,{key:0,ref_key:"tooltipTriggerIconRef",ref:V,name:"info-circle",class:"tooltip-trigger-icon ms-2 flex-shrink-0",onClick:e.withModifiers(Vt,["stop"])},null,512)):e.createCommentVNode("",!0)])):l.multiple&&l.displayMode==="chips"?(e.openBlock(),e.createElementBlock("div",Re,[M.value.length===0?(e.openBlock(),e.createElementBlock("span",Oe,e.toDisplayString(l.placeholder),1)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"chips-container",ref_key:"chipsContainerRef",ref:se},[e.createElementVNode("div",qe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,o=>(e.openBlock(),e.createElementBlock("span",{key:"measure-"+p(o),class:"badge chip"},[e.createElementVNode("span",je,e.toDisplayString(E(o)),1),e.createVNode(k,{name:"times",class:"chip-remove"})]))),128))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(fe.value,o=>(e.openBlock(),e.createElementBlock("span",{key:p(o),class:e.normalizeClass(["badge chip",o.__missing?"bg-danger text-white":"bg-primary text-white"])},[e.createElementVNode("span",He,e.toDisplayString(E(o)),1),e.createVNode(k,{name:"times",class:"chip-remove",onClick:e.withModifiers(r=>oe(o),["stop"])},null,8,["onClick"])],2))),128)),G.value>0?(e.openBlock(),e.createElementBlock("button",{key:0,ref_key:"moreTriggerRef",ref:P,type:"button",class:"btn btn-sm btn-light more-button",onClick:e.withModifiers(ke,["stop"])}," +"+e.toDisplayString(G.value),513)):e.createCommentVNode("",!0)],512))])):e.createCommentVNode("",!0)],!0)]),e.createElementVNode("div",We,[l.isLoading?(e.openBlock(),e.createBlock(k,{key:0,name:"spinner",class:"loading-icon"})):e.createCommentVNode("",!0),l.showClearButton&&M.value.length>0&&!l.disabled&&!l.isLoading?(e.openBlock(),e.createBlock(k,{key:1,name:"times",onClick:e.withModifiers(pt,["stop"]),class:"clear-icon"})):e.createCommentVNode("",!0),l.isLoading?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(k,{key:2,name:"chevron-down",class:e.normalizeClass(["transition-transform",{"rotate-180":C.value}])},null,8,["class"]))])],42,De),F.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"morePopoverRef",ref:W,class:"card shadow-lg border-0 more-popover",style:{"z-index":"1060"}},[e.createElementVNode("div",Ze,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ct.value,o=>(e.openBlock(),e.createElementBlock("div",{key:p(o),class:"list-group-item d-flex justify-content-between align-items-center py-1 px-2"},[e.createElementVNode("small",Ue,e.toDisplayString(E(o)),1),l.disabled?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(k,{key:0,name:"times",class:"chip-remove flex-shrink-0",onClick:e.withModifiers(r=>oe(o),["stop"])},null,8,["onClick"]))]))),128))])],512)):e.createCommentVNode("",!0),C.value?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"dropdownRef",ref:b,class:"tree-select-dropdown card shadow-lg border-0",onMousedown:a[2]||(a[2]=e.withModifiers(()=>{},["prevent"])),onClick:a[3]||(a[3]=e.withModifiers(()=>{},["stop"])),style:{"z-index":"1050"}},[e.createElementVNode("div",Ge,[l.searchable?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,"onUpdate:modelValue":a[0]||(a[0]=o=>g.value=o),type:"text",class:e.normalizeClass(["form-control tree-search-input",ce.value]),placeholder:"Search...",onKeydown:e.withKeys(e.withModifiers(ht,["prevent"]),["enter"])},null,42,Je)),[[e.vModelText,g.value]]):e.createCommentVNode("",!0),l.sortable&&l.sortOptions.length>0?(e.openBlock(),e.createElementBlock("div",Qe,[e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":a[1]||(a[1]=o=>I.value=o),class:e.normalizeClass(["form-select flex-grow-1",ce.value])},[a[4]||(a[4]=e.createElementVNode("option",{value:null,disabled:""},"Sort by...",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.sortOptions,o=>(e.openBlock(),e.createElementBlock("option",{key:o.value,value:o.value},e.toDisplayString(o.label),9,Xe))),128))],2),[[e.vModelSelect,I.value]]),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["btn btn-outline-secondary",ie.value]),disabled:!I.value,onClick:ft},[e.createVNode(k,{name:K.value==="asc"?"asc":"desc"},null,8,["name"])],10,Ye)])):e.createCommentVNode("",!0)]),l.isLoading?(e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(k,{name:"spinner",class:"me-2"}),a[5]||(a[5]=e.createElementVNode("span",null,"Loading...",-1))])):(e.openBlock(),e.createElementBlock("div",_e,[J.value.length>0?(e.openBlock(),e.createElementBlock("div",et,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(J.value,o=>(e.openBlock(),e.createBlock(ze,{key:p(o),item:o,level:0,"selected-items":M.value,"expanded-items":A.value,multiple:l.multiple,"select-all":l.selectAll,"select-mode":l.selectMode,"option-label":l.optionLabel,"option-value":l.optionValue,"disabled-key":l.disabledKey,"disable-branch-node":l.disableBranchNodes,onSelect:ut,onToggleExpand:ge},{default:e.withCtx(({item:r,level:s})=>[e.renderSlot(t.$slots,"default",{item:r,level:s},()=>[e.createElementVNode("div",tt,[e.createTextVNode(e.toDisplayString(E(r))+" ",1),r.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(r.icon)},null,2)):e.createCommentVNode("",!0)])],!0)]),_:2},1032,["item","selected-items","expanded-items","multiple","select-all","select-mode","option-label","option-value","disabled-key","disable-branch-node"]))),128))])):(e.openBlock(),e.createElementBlock("div",lt,[l.allowAddNew?(e.openBlock(),e.createElementBlock("div",nt,[l.addNewMode==="button"?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"btn btn-success btn-sm w-100",onClick:ye},[e.createTextVNode(' No items found "Click" to '+e.toDisplayString(l.addNewLabel)+" ",1),g.value.trim()?(e.openBlock(),e.createElementBlock("span",ot,' : "'+e.toDisplayString(g.value)+'" ',1)):e.createCommentVNode("",!0)])):l.addNewMode==="enter"?(e.openBlock(),e.createElementBlock("span",at,[e.createTextVNode(' No items found "Press Enter" to '+e.toDisplayString(l.addNewLabel)+" ",1),g.value.trim()?(e.openBlock(),e.createElementBlock("span",rt,' : "'+e.toDisplayString(g.value)+'" ',1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",st,[e.createVNode(k,{name:"search",class:"me-1"}),a[6]||(a[6]=e.createTextVNode(" No items found ",-1))]))]))]))],544)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",{ref_key:"tooltipRef",ref:f,class:"tree-select-tooltip card shadow-sm py-1 px-2",role:"tooltip",style:{"z-index":"1070"}},e.toDisplayString(de.value),513),[[e.vShow,y.value]])],544))}},[["__scopeId","data-v-41032f5c"]]),it={install(l){l.component("VSelect",re)}};x.VSelect=re,x.default=it,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(E,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@popperjs/core")):typeof define=="function"&&define.amd?define(["exports","vue","@popperjs/core"],e):(E=typeof globalThis<"u"?globalThis:E||self,e(E.VueSelect={},E.Vue,E.Popper))})(this,(function(E,e,Y){"use strict";const v=(l,z)=>{const n=l.__vccOpts||l;for(const[u,d]of z)n[u]=d;return n},we={key:0},xe={key:1},Ce={key:2},Se={key:3},Ee={key:4},Ne={key:5},Le={key:6},Me={key:7},g=v({__name:"SvgIcon",props:{name:{type:String,required:!0}},setup(l){const z=l,n=e.computed(()=>({"svg-icon-spin":z.name==="spinner"}));return(u,d)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"1em",height:"1em",class:e.normalizeClass(n.value)},[l.name==="spinner"?(e.openBlock(),e.createElementBlock("g",we,d[0]||(d[0]=[e.createElementVNode("path",{d:"M12,4V2A10,10,0,0,0,2,12H4A8,8,0,0,1,12,4Z"},null,-1)]))):e.createCommentVNode("",!0),l.name==="times"?(e.openBlock(),e.createElementBlock("g",xe,d[1]||(d[1]=[e.createElementVNode("path",{d:"M13.41,12l4.3-4.29a1,1,0,1,0-1.42-1.42L12,10.59,7.71,6.29A1,1,0,0,0,6.29,7.71L10.59,12l-4.3,4.29a1,1,0,0,0,0,1.42,1,1,0,0,0,1.42,0L12,13.41l4.29,4.3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42Z"},null,-1)]))):e.createCommentVNode("",!0),l.name==="chevron-down"?(e.openBlock(),e.createElementBlock("g",Ce,d[2]||(d[2]=[e.createElementVNode("path",{d:"M17,9.17a1,1,0,0,0-1.41,0L12,12.71,8.46,9.17a1,1,0,0,0-1.41,0,1,1,0,0,0,0,1.42l4.24,4.24a1,1,0,0,0,1.42,0L17,10.59A1,1,0,0,0,17,9.17Z"},null,-1)]))):e.createCommentVNode("",!0),l.name==="chevron-right"?(e.openBlock(),e.createElementBlock("g",Se,d[3]||(d[3]=[e.createElementVNode("path",{d:"M10.83,12l-4.24,4.24a1,1,0,0,0,1.41,1.41L13.66,12,8,6.34A1,1,0,0,0,6.59,7.76Z"},null,-1)]))):e.createCommentVNode("",!0),l.name==="search"?(e.openBlock(),e.createElementBlock("g",Ee,d[4]||(d[4]=[e.createElementVNode("path",{d:"M21.71,20.29,18,16.61A9,9,0,1,0,16.61,18l3.68,3.68a1,1,0,0,0,1.42,0A1,1,0,0,0,21.71,20.29ZM11,18a7,7,0,1,1,7-7A7,7,0,0,1,11,18Z"},null,-1)]))):e.createCommentVNode("",!0),l.name==="asc"?(e.openBlock(),e.createElementBlock("g",Ne,d[5]||(d[5]=[e.createElementVNode("path",{fill:"currentColor",d:"M4.869 11H2.667L6 3h2l3.333 8H9.131l-.41-1H5.28zm1.23-3h1.803L7 5.8zm12.9 8V3h-2v13h-3l4 5l4-5zm-8-3H3v2h4.855L3 19v2h8v-2H6.146L11 15z"},null,-1)]))):e.createCommentVNode("",!0),l.name==="desc"?(e.openBlock(),e.createElementBlock("g",Le,d[6]||(d[6]=[e.createElementVNode("path",{fill:"currentColor",d:"M4.869 11H2.667L6 3h2l3.333 8H9.131l-.41-1H5.28zm1.23-3h1.803L7 5.8zm15.9 0l-4-5l-4 5h3v13h2V8zm-11 5H3v2h4.855L3 19v2h8v-2H6.146L11 15z"},null,-1)]))):e.createCommentVNode("",!0),l.name==="info-circle"?(e.openBlock(),e.createElementBlock("g",Me,d[7]||(d[7]=[e.createElementVNode("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},null,-1)]))):e.createCommentVNode("",!0)],2))}},[["__scopeId","data-v-89f9b7e1"]]),Ie={key:2,class:"expander-placeholder flex-shrink-0"},Ae=["checked",".indeterminate","disabled"],$e={class:"item-content text-start text-break lh-1"},K=.91,ze=v({__name:"TreeSelectItem",props:{item:{type:Object,required:!0},level:{type:Number,required:!0},selectedItems:{type:Array,required:!0},expandedItems:{type:Set,required:!0},multiple:{type:Boolean,required:!0},selectAll:{type:Boolean,required:!0},selectMode:{type:String,required:!0},optionLabel:{type:String,required:!0},optionValue:{type:String,required:!0},disabledKey:{type:String,default:null},disableBranchNode:{type:Boolean,default:!1},displayMode:{type:String,default:"text"},index:{type:Number,default:0},siblingsCount:{type:Number,default:1}},emits:["select","toggle-expand"],setup(l,{emit:z}){const n=l,u=e.computed(()=>n.index===n.siblingsCount-1),d=m=>m[n.optionValue]||m.id||m.value,w=m=>!n.disabledKey||!m?!1:m.hasOwnProperty(n.disabledKey)&&m[n.disabledKey]!==null,k=e.computed(()=>n.item.children&&n.item.children.length>0),y=e.computed(()=>n.expandedItems.has(d(n.item))),x=e.computed(()=>n.selectedItems.includes(d(n.item))),M=m=>{let f=[];return m.children&&m.children.forEach(b=>{f.push(d(b)),f.push(...M(b))}),f},T=e.computed(()=>!n.multiple||!n.selectAll||!k.value||x.value?!1:M(n.item).some(f=>n.selectedItems.includes(f)));return(m,f)=>{const b=e.resolveComponent("TreeSelectItem",!0);return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tree-select-item-wrapper",{"is-last-child":u.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["list-group-item list-group-item-action d-flex align-items-center gap-1",{"bg-primary text-white":x.value&&(l.selectMode==="highlight"||!l.multiple)&&!w(l.item)&&!(l.disableBranchNode&&k.value),"is-disabled text-muted bg-light":w(l.item)}]),style:e.normalizeStyle({paddingLeft:`${l.level*K+.5}rem`}),onClick:f[2]||(f[2]=C=>w(l.item)?null:m.$emit("select",l.item))},[l.displayMode==="tree-node"&&l.level>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["tree-indent",{"last-child-connector":u.value}]),style:e.normalizeStyle({left:`${(l.level-1)*K+K/2}rem`,width:"2.3rem"})},null,6)):e.createCommentVNode("",!0),k.value?(e.openBlock(),e.createBlock(g,{key:1,name:"chevron-right",class:e.normalizeClass(["expander-icon flex-shrink-0",{"rotate-90":y.value}]),onClick:f[0]||(f[0]=e.withModifiers(C=>m.$emit("toggle-expand",d(l.item)),["stop"]))},null,8,["class"])):(e.openBlock(),e.createElementBlock("span",Ie)),l.multiple&&l.selectMode==="checkbox"&&!(l.disableBranchNode&&k.value)?(e.openBlock(),e.createElementBlock("input",{key:3,type:"checkbox",class:"tree-checkbox",checked:x.value,".indeterminate":T.value,disabled:w(l.item),onClick:f[1]||(f[1]=e.withModifiers(C=>m.$emit("select",l.item),["stop"]))},null,40,Ae)):e.createCommentVNode("",!0),e.createElementVNode("div",$e,[e.renderSlot(m.$slots,"default",{item:l.item,level:l.level},void 0,!0)])],6),k.value&&y.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["children-wrapper",{"tree-branch-guide":l.displayMode==="tree-node"&&!u.value}]),style:e.normalizeStyle(l.displayMode==="tree-node"?{marginLeft:`${l.level*K+K/2}rem`}:{})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.children,(C,Z)=>(e.openBlock(),e.createBlock(b,{key:d(C),item:C,level:l.level+1,"selected-items":l.selectedItems,"expanded-items":l.expandedItems,multiple:l.multiple,"select-all":l.selectAll,"select-mode":l.selectMode,"option-label":l.optionLabel,"option-value":l.optionValue,"disabled-key":l.disabledKey,"disable-branch-node":l.disableBranchNode,"display-mode":l.displayMode,index:Z,"siblings-count":l.item.children.length,onSelect:f[3]||(f[3]=B=>m.$emit("select",B)),onToggleExpand:f[4]||(f[4]=B=>m.$emit("toggle-expand",B))},{default:e.withCtx(({item:B,level:N})=>[e.renderSlot(m.$slots,"default",{item:B,level:N},void 0,!0)]),_:2},1032,["item","level","selected-items","expanded-items","multiple","select-all","select-mode","option-label","option-value","disabled-key","disable-branch-node","display-mode","index","siblings-count"]))),128))],6)):e.createCommentVNode("",!0)],2)}}},[["__scopeId","data-v-3a344aeb"]]),Te=["onKeydown"],De={class:"tree-select-display-container"},Ke={key:0,class:"d-flex align-items-center justify-content-start w-100"},Pe=["title"],Fe={key:1},Re={key:0,class:"text-muted"},Oe={class:"chip-measure-layer","aria-hidden":"true"},qe={class:"chip-label"},je={class:"chip-label"},He={class:"d-flex align-items-center gap-2"},We={class:"list-group list-group-flush"},Ze={class:"text-wrap text-start me-2"},Ue={class:"p-2 border-bottom d-flex flex-column gap-2"},Ge=["onKeydown"],Je={key:1,class:"d-flex align-items-center gap-2"},Qe=["value"],Xe=["disabled"],Ye={key:0,class:"p-4 text-muted text-center"},ve={key:1,class:"tree-select-body",style:{"max-height":"300px","overflow-y":"auto"}},_e={key:0,class:"list-group list-group-flush"},et={class:"d-flex align-items-center gap-2",style:{"white-space":"wrap"}},tt={key:1,class:"p-3 text-muted text-center"},lt={key:0},nt={key:0},ot={key:1},at={key:0},rt={key:1},se=v({__name:"TreeSelectMain",props:{modelValue:{type:[String,Number,Array],default:null},displayMode:{type:String,default:"text",validator:l=>["text","chips","tree-node"].includes(l)},items:{type:Array,default:()=>[]},multiple:{type:Boolean,default:!1},selectMode:{type:String,default:"checkbox",validator:l=>["checkbox","highlight"].includes(l)},placeholder:{type:String,default:"Select item..."},isInvalid:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},searchable:{type:Boolean,default:!0},isLoading:{type:Boolean,default:!1},showClearButton:{type:Boolean,default:!0},selectAll:{type:Boolean,default:!1},deselectAll:{type:Boolean,default:!0},canDeselect:{type:Boolean,default:!0},optionLabel:{type:String,default:"value"},optionValue:{type:String,default:"code"},disabledKey:{type:String,default:null},excludeFromSelectedListKey:{type:String,default:null},disableBranchNodes:{type:Boolean,default:!1},size:{type:String,default:"sm",validator:l=>["sm","md","lg","xl"].includes(l)},sortable:{type:Boolean,default:!1},sortOptions:{type:Array,default:()=>[]},defaultSortKey:{type:String,default:null},defaultSortDirection:{type:String,default:"asc",validator:l=>["asc","desc"].includes(l)},maxVisibleChipsDisplay:{type:Number,default:null},closeOnSelect:{type:Boolean,default:!0},allowAddNew:{type:Boolean,default:!1},addNewMode:{type:String,default:"button",validator:l=>["button","enter"].includes(l)},addNewLabel:{type:String,default:"Add new record"},keyFilters:{type:Array,default:()=>[]}},emits:["update:modelValue","change","clear","deselect","select","focus","blur","add-new"],setup(l,{emit:z}){const n=l,u=z,d=e.ref(null),w=e.ref(null),k=e.ref(null),y=e.ref(""),x=e.ref(!1),M=e.ref(new Set),T=e.ref(null),m=e.ref(null),f=e.ref(null),b=e.ref(!1),C=e.ref(null),Z=e.ref(null),B=e.ref(!1),N=e.ref(n.defaultSortKey),P=e.ref(n.defaultSortDirection),F=e.ref(null),U=e.ref(null),R=e.ref(!1),G=e.ref(null),ie=e.ref(null),_=e.ref(0),ce=e.computed(()=>n.size==="sm"?"btn-sm":n.size==="lg"?"btn-lg":n.size==="xl"?"btn-xl":""),de=e.computed(()=>n.size==="sm"?"form-control-sm":n.size==="lg"?"form-control-lg":n.size==="xl"?"form-control-xl":""),it=e.computed(()=>Q.value===0?[]:D.value.slice(oe.value)),O=e.computed(()=>!n.multiple||!n.excludeFromSelectedListKey?A.value:A.value.filter(t=>{const a=I(t);return!a||!a[n.excludeFromSelectedListKey]})),me=e.computed(()=>{const t=O.value;if(t.length===0)return n.placeholder;if(n.multiple){if(t.length===1){const o=j(t[0]);return o?o.join(" → "):t[0]}return`${t.length} items selected`}const a=j(t[0]);return a?a.join(" → "):t[0]}),ct=e.computed(()=>n.multiple?Array.isArray(n.modelValue)?n.modelValue:[]:n.modelValue!==null&&n.modelValue!==void 0?[n.modelValue]:[]),dt=e.computed(()=>ct.value.filter(t=>t===""||t===null||t===void 0||t===0?!1:!I(t))),ue=async()=>{await e.nextTick();const t=Z.value;if(n.multiple||n.displayMode==="chips"||O.value.length===0||!t){B.value=!1;return}B.value=t.scrollWidth>t.clientWidth},L=t=>t&&(t[n.optionLabel]||t.label||t.name)||"",p=t=>t?t[n.optionValue]||t.id||t.value:null,ee=t=>!n.disabledKey||!t?!1:t.hasOwnProperty(n.disabledKey)&&t[n.disabledKey]!==null,V=t=>t.children&&t.children.length>0,q=(t,a)=>{if(a)return a.split(".").reduce((o,r)=>o&&o[r],t)},I=(t,a=n.items)=>{for(const o of a){if(p(o)===t)return o;if(V(o)){const r=I(t,o.children);if(r)return r}}return null},te=t=>{const a=[];return V(t)&&t.children.forEach(o=>{ee(o)||(a.push(p(o)),a.push(...te(o)))}),a},J=async()=>{await e.nextTick();const t=ie.value;if(!t)return;const a=t.querySelector(".chip-measure-layer");if(!a)return;const o=Array.from(a.children);if(!o.length){_.value=0;return}const r=t.clientWidth,s=4,i=40;let c=0,h=0;for(let S=0;S<o.length;S++){const Ve=o[S].offsetWidth+s,Vt=S<o.length-1?i:0;if(c+Ve+Vt>r)break;c+=Ve,h++}_.value=Math.max(h,1)},le=(t,a=n.items,o=[])=>{for(const r of a){if(p(r)===t)return o;if(V(r)){const s=le(t,r.children,[...o,p(r)]);if(s)return s}}return null},A=e.computed(()=>{const t=new Set(Array.isArray(n.modelValue)?n.modelValue:[n.modelValue].filter(Boolean));if(n.multiple&&n.selectAll){const a=o=>{o.forEach(r=>{if(V(r)){const s=r.children.filter(c=>!ee(c));s.length>0&&s.every(c=>t.has(p(c)))&&t.add(p(r)),a(r.children)}})};a(n.items)}return Array.from(t)}),j=(t,a=n.items,o=[])=>{for(const r of a){const s=[...o,L(r)];if(p(r)===t)return s;if(V(r)){const i=j(t,r.children,s);if(i)return i}}return null},fe=t=>{if(!t||t.length===0)return"";const a=t.join(" → ");return a.length<=40?a:t.length>2?`${t[0]} → ... → ${t[t.length-1]}`:a},ne=e.computed(()=>{const t=O.value;if(t.length===0)return n.placeholder;if(n.multiple){if(t.length===1){const s=I(t[0]);if(!s)return`${t[0]} (No longer available)`;const i=j(t[0]);return i?fe(i):L(s)}return`${t.length} items selected`}const a=t[0],o=I(a);if(!o)return`${a} (No longer available)`;const r=j(a);return r?fe(r):L(o)}),D=e.computed(()=>{if(!n.multiple||O.value.length===0)return[];const t=O.value.map(r=>{const s=I(r);return s||{[n.optionValue]:r,[n.optionLabel]:`${r} (No longer available)`,__missing:!0}});if(!n.sortable||!N.value)return t;const a=N.value,o=P.value;return[...t].sort((r,s)=>{if(r.__missing)return 1;if(s.__missing)return-1;const i=q(r,a),c=q(s,a);if(i==null)return 1;if(c==null)return-1;let h=0;return typeof i=="string"&&typeof c=="string"?h=i.localeCompare(c):i>c?h=1:i<c&&(h=-1),o==="desc"?h*-1:h})}),pe=e.computed(()=>D.value.slice(0,oe.value)),oe=e.computed(()=>n.maxVisibleChipsDisplay!==null?n.maxVisibleChipsDisplay:Math.max(_.value,1)),Q=e.computed(()=>{const t=D.value.length-oe.value;return t>0?t:0}),he=(t,a)=>{const o=a.toLowerCase();return t.map(r=>{let s=!1;if(n.keyFilters&&n.keyFilters.length>0)for(const c of n.keyFilters){const h=q(r,c);if(h!=null&&String(h).toLowerCase().includes(o)){s=!0;break}}else s=L(r).toLowerCase().includes(o);if(!V(r))return s?r:null;const i=he(r.children,a);return s?{...r,children:r.children}:i.length>0?{...r,children:i}:null}).filter(Boolean)},ye=(t,a,o)=>!t||!a?t:[...t].sort((s,i)=>{const c=q(s,a),h=q(i,a);if(c==null)return 1;if(h==null)return-1;let S=0;return typeof c=="string"&&typeof h=="string"?S=c.localeCompare(h):c>h?S=1:c<h&&(S=-1),o==="desc"?S*-1:S}).map(s=>V(s)?{...s,children:ye(s.children,a,o)}:s),H=e.computed(()=>{const t=y.value.trim(),a=t?he(n.items,t):n.items;return!n.sortable||!N.value?a:ye(a,N.value,P.value)}),mt=t=>{if(n.disableBranchNodes&&V(t)){const s=p(t);ge(s);return}if(ee(t))return;const a=p(t);let o=new Set(A.value);if(n.multiple){const s=o.has(a);if(n.selectAll&&V(t)){const i=te(t);s?(o.delete(a),u("deselect",t),n.deselectAll&&i.forEach(c=>o.delete(c))):(o.add(a),i.forEach(c=>o.add(c)),u("select",t))}else s?(o.delete(a),n.selectAll&&le(a)?.forEach(c=>o.delete(c))):o.add(a)}else{const s=n.modelValue,i=p(t);s===i?(o.clear(),u("deselect",t)):(o.clear(),o.add(i),s!=null&&I(s),u("select",t)),n.closeOnSelect&&$(),e.nextTick(()=>{k.value?.focus()})}let r=Array.from(o);n.multiple&&n.excludeFromSelectedListKey&&(r=r.filter(s=>{const i=I(s);return!i||!i[n.excludeFromSelectedListKey]})),u("update:modelValue",n.multiple?r:r[0]||null),u("change",n.multiple?r:r[0]||null)},ae=t=>{if(n.disabled||!t)return;const a=p(t),o=new Set(A.value);o.delete(a),n.selectAll&&(n.deselectAll&&V(t)&&te(t).forEach(c=>o.delete(c)),le(a)?.forEach(i=>o.delete(i)));const r=Array.from(o);u("update:modelValue",r),u("change",r)},ge=t=>{M.value.has(t)?M.value.delete(t):M.value.add(t)},ut=()=>{P.value=P.value==="asc"?"desc":"asc"},ft=()=>{const t=n.multiple?[]:null;u("clear"),u("update:modelValue",t),u("change",t),W()},ke=()=>{!n.allowAddNew||!y.value.trim()||(u("add-new",y.value.trim()),$())},pt=()=>{n.allowAddNew&&n.addNewMode==="enter"&&y.value.trim()&&H.value.length===0&&ke()},ht=t=>{u("focus",t)},yt=async()=>{n.disabled||(W(),x.value=!0,X(),await e.nextTick(),w.value&&k.value&&(T.value=Y.createPopper(k.value,w.value,{placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,4]}},{name:"preventOverflow",options:{padding:8}},{name:"flip",options:{fallbackPlacements:["top-start"]}},{name:"sameWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:t})=>{t.styles.popper.width=`${t.rects.reference.width}px`},effect:({state:t})=>{t.elements.popper.style.width=`${t.elements.reference.offsetWidth}px`}}]})),n.searchable&&(await e.nextTick(),w.value?.querySelector(".tree-search-input")?.focus()))},$=()=>{x.value=!1,y.value="",T.value?.destroy(),T.value=null,u("blur",n.modelValue)},re=()=>x.value?$():yt(),gt=async()=>{$(),X(),R.value=!0,await e.nextTick(),U.value&&F.value&&(G.value=Y.createPopper(F.value,U.value,{placement:"bottom-end",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,4]}}]}))},W=()=>{R.value=!1,G.value?.destroy(),G.value=null},be=()=>R.value?W():gt(),Be=t=>{x.value&&!k.value?.contains(t.target)&&!w.value?.contains(t.target)&&$(),R.value&&!F.value?.contains(t.target)&&!U.value?.contains(t.target)&&W(),b.value&&!C.value?.$el?.contains(t.target)&&!m.value?.contains(t.target)&&X()},kt=t=>{d.value?.contains(t.relatedTarget)||$()},bt=async()=>{!B.value||b.value||($(),W(),b.value=!0,await e.nextTick(),m.value&&C.value&&(f.value=Y.createPopper(C.value.$el,m.value,{placement:"top",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,8]}}]})))},Bt=()=>{b.value?X():bt()},X=()=>{b.value=!1,f.value?.destroy(),f.value=null};return e.watch(y,t=>{if(t.trim()){const a=o=>{o.forEach(r=>{V(r)&&(M.value.add(p(r)),a(r.children))})};a(H.value)}}),e.watch(ne,()=>{ue()}),e.watch(D,J),e.onMounted(async()=>{document.addEventListener("click",Be),window.addEventListener("resize",J),await e.nextTick(),J(),ue()}),e.onUnmounted(()=>{document.removeEventListener("click",Be),window.removeEventListener("resize",J),T.value?.destroy(),G.value?.destroy(),f.value?.destroy()}),(t,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:d,class:"tree-select-wrapper",onFocusin:ht,onFocusout:kt},[e.createElementVNode("div",{ref_key:"triggerRef",ref:k,role:"button",tabindex:"0",class:e.normalizeClass(["btn tree-select-trigger w-100 d-flex justify-content-between align-items-center tree-select-main",[ce.value,{"btn-outline-secondary":!l.isInvalid,"border-danger":l.isInvalid,disabled:l.disabled||l.isLoading,"is-loading":l.isLoading,"has-chips":l.multiple&&l.displayMode==="chips"&&A.value.length>0}]]),onClick:re,onKeydown:[e.withKeys(e.withModifiers(re,["prevent"]),["enter"]),e.withKeys(e.withModifiers(re,["prevent"]),["space"])]},[e.createElementVNode("div",De,[e.renderSlot(t.$slots,"display",{selectedItems:D.value,displayText:ne.value,placeholder:l.placeholder,isLoading:l.isLoading,removeItem:ae,getItemLabel:L,getItemValue:p,visibleChips:pe.value,hiddenChipsCount:Q.value,toggleMorePopover:be,moreTriggerRef:F.value},()=>[!l.multiple||l.displayMode==="text"?(e.openBlock(),e.createElementBlock("div",Ke,[e.createElementVNode("span",{ref_key:"textDisplaySpanRef",ref:Z,class:e.normalizeClass(["text-truncate",{"text-danger":dt.value.length>0}]),title:B.value?me.value:""},e.toDisplayString(l.isLoading?"Loading data...":ne.value),11,Pe),B.value&&!l.isLoading?(e.openBlock(),e.createBlock(g,{key:0,ref_key:"tooltipTriggerIconRef",ref:C,name:"info-circle",class:"tooltip-trigger-icon ms-2 flex-shrink-0",onClick:e.withModifiers(Bt,["stop"])},null,512)):e.createCommentVNode("",!0)])):l.multiple&&l.displayMode==="chips"?(e.openBlock(),e.createElementBlock("div",Fe,[A.value.length===0?(e.openBlock(),e.createElementBlock("span",Re,e.toDisplayString(l.placeholder),1)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"chips-container",ref_key:"chipsContainerRef",ref:ie},[e.createElementVNode("div",Oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(D.value,o=>(e.openBlock(),e.createElementBlock("span",{key:"measure-"+p(o),class:"badge chip"},[e.createElementVNode("span",qe,e.toDisplayString(L(o)),1),e.createVNode(g,{name:"times",class:"chip-remove"})]))),128))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(pe.value,o=>(e.openBlock(),e.createElementBlock("span",{key:p(o),class:e.normalizeClass(["badge chip",o.__missing?"bg-danger text-white":"bg-primary text-white"])},[e.createElementVNode("span",je,e.toDisplayString(L(o)),1),e.createVNode(g,{name:"times",class:"chip-remove",onClick:e.withModifiers(r=>ae(o),["stop"])},null,8,["onClick"])],2))),128)),Q.value>0?(e.openBlock(),e.createElementBlock("button",{key:0,ref_key:"moreTriggerRef",ref:F,type:"button",class:"btn btn-sm btn-light more-button",onClick:e.withModifiers(be,["stop"])}," +"+e.toDisplayString(Q.value),513)):e.createCommentVNode("",!0)],512))])):e.createCommentVNode("",!0)],!0)]),e.createElementVNode("div",He,[l.isLoading?(e.openBlock(),e.createBlock(g,{key:0,name:"spinner",class:"loading-icon"})):e.createCommentVNode("",!0),l.showClearButton&&A.value.length>0&&!l.disabled&&!l.isLoading?(e.openBlock(),e.createBlock(g,{key:1,name:"times",onClick:e.withModifiers(ft,["stop"]),class:"clear-icon"})):e.createCommentVNode("",!0),l.isLoading?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(g,{key:2,name:"chevron-down",class:e.normalizeClass(["transition-transform",{"rotate-180":x.value}])},null,8,["class"]))])],42,Te),R.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"morePopoverRef",ref:U,class:"card shadow-lg border-0 more-popover",style:{"z-index":"1060"}},[e.createElementVNode("div",We,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(it.value,o=>(e.openBlock(),e.createElementBlock("div",{key:p(o),class:"list-group-item d-flex justify-content-between align-items-center py-1 px-2"},[e.createElementVNode("small",Ze,e.toDisplayString(L(o)),1),l.disabled?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(g,{key:0,name:"times",class:"chip-remove flex-shrink-0",onClick:e.withModifiers(r=>ae(o),["stop"])},null,8,["onClick"]))]))),128))])],512)):e.createCommentVNode("",!0),x.value?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"dropdownRef",ref:w,class:"tree-select-dropdown card shadow-lg border-0",onMousedown:a[2]||(a[2]=e.withModifiers(()=>{},["prevent"])),onClick:a[3]||(a[3]=e.withModifiers(()=>{},["stop"])),style:{"z-index":"1050"}},[e.createElementVNode("div",Ue,[l.searchable?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,"onUpdate:modelValue":a[0]||(a[0]=o=>y.value=o),type:"text",class:e.normalizeClass(["form-control tree-search-input",de.value]),placeholder:"Search...",onKeydown:e.withKeys(e.withModifiers(pt,["prevent"]),["enter"])},null,42,Ge)),[[e.vModelText,y.value]]):e.createCommentVNode("",!0),l.sortable&&l.sortOptions.length>0?(e.openBlock(),e.createElementBlock("div",Je,[e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":a[1]||(a[1]=o=>N.value=o),class:e.normalizeClass(["form-select flex-grow-1",de.value])},[a[4]||(a[4]=e.createElementVNode("option",{value:null,disabled:""},"Sort by...",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.sortOptions,o=>(e.openBlock(),e.createElementBlock("option",{key:o.value,value:o.value},e.toDisplayString(o.label),9,Qe))),128))],2),[[e.vModelSelect,N.value]]),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["btn btn-outline-secondary",ce.value]),disabled:!N.value,onClick:ut},[e.createVNode(g,{name:P.value==="asc"?"asc":"desc"},null,8,["name"])],10,Xe)])):e.createCommentVNode("",!0)]),l.isLoading?(e.openBlock(),e.createElementBlock("div",Ye,[e.createVNode(g,{name:"spinner",class:"me-2"}),a[5]||(a[5]=e.createElementVNode("span",null,"Loading...",-1))])):(e.openBlock(),e.createElementBlock("div",ve,[H.value.length>0?(e.openBlock(),e.createElementBlock("div",_e,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(H.value,(o,r)=>(e.openBlock(),e.createBlock(ze,{key:p(o),item:o,level:0,"display-mode":l.displayMode,"selected-items":A.value,"expanded-items":M.value,multiple:l.multiple,"select-all":l.selectAll,"select-mode":l.selectMode,"option-label":l.optionLabel,"option-value":l.optionValue,"disabled-key":l.disabledKey,"disable-branch-node":l.disableBranchNodes,index:r,"siblings-count":H.value.length,onSelect:mt,onToggleExpand:ge},{default:e.withCtx(({item:s,level:i})=>[e.renderSlot(t.$slots,"default",{item:s,level:i},()=>[e.createElementVNode("div",et,[e.createTextVNode(e.toDisplayString(L(s))+" ",1),s.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(s.icon)},null,2)):e.createCommentVNode("",!0)])],!0)]),_:2},1032,["item","display-mode","selected-items","expanded-items","multiple","select-all","select-mode","option-label","option-value","disabled-key","disable-branch-node","index","siblings-count"]))),128))])):(e.openBlock(),e.createElementBlock("div",tt,[l.allowAddNew?(e.openBlock(),e.createElementBlock("div",lt,[l.addNewMode==="button"?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"btn btn-success btn-sm w-100",onClick:ke},[e.createTextVNode(' No items found "Click" to '+e.toDisplayString(l.addNewLabel)+" ",1),y.value.trim()?(e.openBlock(),e.createElementBlock("span",nt,' : "'+e.toDisplayString(y.value)+'" ',1)):e.createCommentVNode("",!0)])):l.addNewMode==="enter"?(e.openBlock(),e.createElementBlock("span",ot,[e.createTextVNode(' No items found "Press Enter" to '+e.toDisplayString(l.addNewLabel)+" ",1),y.value.trim()?(e.openBlock(),e.createElementBlock("span",at,' : "'+e.toDisplayString(y.value)+'" ',1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",rt,[e.createVNode(g,{name:"search",class:"me-1"}),a[6]||(a[6]=e.createTextVNode(" No items found ",-1))]))]))]))],544)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",{ref_key:"tooltipRef",ref:m,class:"tree-select-tooltip card shadow-sm py-1 px-2",role:"tooltip",style:{"z-index":"1070"}},e.toDisplayString(me.value),513),[[e.vShow,b.value]])],544))}},[["__scopeId","data-v-880ba6da"]]),st={install(l){l.component("VSelect",se)}};E.VSelect=se,E.default=st,Object.defineProperties(E,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|