@night-owl-elite/vue-select 1.3.21 → 1.3.23
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 +240 -233
- package/dist/vue-select.umd.js +1 -1
- package/package.json +1 -1
package/dist/vue-select.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@keyframes spin-d347d13a{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.svg-icon-spin[data-v-d347d13a]{animation:spin-d347d13a 1s linear infinite}.list-group-item[data-v-9766821f]{cursor:pointer;border:0;border-radius:0;padding-top:.5rem;padding-bottom:.5rem}.list-group-item.is-disabled[data-v-9766821f]{cursor:not-allowed;opacity:.65}.expander-icon[data-v-9766821f]{width:1rem;height:1rem;flex-shrink:0;transition:transform .2s ease-in-out;color:#6c757d}.expander-placeholder[data-v-9766821f]{display:inline-block;width:1rem;flex-shrink:0}.rotate-90[data-v-9766821f]{transform:rotate(90deg)}.item-content[data-v-9766821f]{flex-grow:1}.tree-select-main[data-v-
|
|
1
|
+
@keyframes spin-d347d13a{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.svg-icon-spin[data-v-d347d13a]{animation:spin-d347d13a 1s linear infinite}.list-group-item[data-v-9766821f]{cursor:pointer;border:0;border-radius:0;padding-top:.5rem;padding-bottom:.5rem}.list-group-item.is-disabled[data-v-9766821f]{cursor:not-allowed;opacity:.65}.expander-icon[data-v-9766821f]{width:1rem;height:1rem;flex-shrink:0;transition:transform .2s ease-in-out;color:#6c757d}.expander-placeholder[data-v-9766821f]{display:inline-block;width:1rem;flex-shrink:0}.rotate-90[data-v-9766821f]{transform:rotate(90deg)}.item-content[data-v-9766821f]{flex-grow:1}.tree-select-main[data-v-3c61512a]{--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-3c61512a]{flex:1;overflow:hidden}.clear-icon[data-v-3c61512a]{cursor:pointer;opacity:.6;transition:opacity .2s ease}.clear-icon[data-v-3c61512a]:hover{opacity:1}.transition-transform[data-v-3c61512a]{transition:transform .2s ease-in-out}.rotate-180[data-v-3c61512a]{transform:rotate(180deg)}.tree-select-dropdown[data-v-3c61512a]{position:absolute;background:#fff;border:1px solid rgba(0,0,0,.15);border-radius:.375rem}.is-loading[data-v-3c61512a]{cursor:wait}.loading-icon[data-v-3c61512a]{animation:spin-3c61512a 1s linear infinite}@keyframes spin-3c61512a{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.btn-xl[data-v-3c61512a]{padding:.75rem 1.5rem;font-size:1.25rem;border-radius:var(--bs-border-radius-lg)}.form-control-xl[data-v-3c61512a]{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-3c61512a]::-webkit-scrollbar{width:6px}.tree-select-body[data-v-3c61512a]::-webkit-scrollbar-track{background:#f1f1f1;border-radius:3px}.tree-select-body[data-v-3c61512a]::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.tree-select-body[data-v-3c61512a]::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.tree-select-main.disabled .more-button[data-v-3c61512a]{pointer-events:auto;cursor:pointer}.tree-select-main.has-chips[data-v-3c61512a]{height:auto;min-height:calc(1.5em + .5rem + calc(var(--bs-border-width) * 2))}.tree-select-main.has-chips.btn-lg[data-v-3c61512a]{min-height:calc(1.5em + 1rem + calc(var(--bs-border-width) * 2))}.tree-select-main.has-chips.btn-xl[data-v-3c61512a]{min-height:calc(1.5em + 1.5rem + calc(var(--bs-border-width) * 2))}.chips-container[data-v-3c61512a]{display:flex;flex-wrap:wrap;gap:.25rem;max-height:8rem;overflow-y:auto}.chip[data-v-3c61512a]{display:inline-flex;align-items:center;padding:.2em .6em}.chip-remove[data-v-3c61512a]{width:.8em;height:.8em;margin-left:.4em;cursor:pointer;opacity:.7;transition:opacity .2s}.chip-remove[data-v-3c61512a]:hover{opacity:1}.more-button[data-v-3c61512a]{font-size:.75em;line-height:1;padding:.3em .5em}.more-popover[data-v-3c61512a]{width:250px;max-width:80vw;max-height:200px;overflow-y:auto;font-size:.9rem}@media (max-width: 576px){.tree-select-dropdown[data-v-3c61512a]{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 g, createElementBlock as o, openBlock as i, normalizeClass as
|
|
2
|
-
import { createPopper as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
import { computed as g, createElementBlock as o, openBlock as i, normalizeClass as $, createCommentVNode as v, createElementVNode as h, resolveComponent as Ie, normalizeStyle as Be, createBlock as E, withModifiers as z, renderSlot as se, Fragment as H, renderList as O, withCtx as ge, ref as b, onMounted as $e, onUnmounted as Ae, watch as Me, withKeys as ve, toDisplayString as K, createTextVNode as le, createVNode as j, withDirectives as he, vModelText as ze, vModelSelect as Ke, nextTick as ne } from "vue";
|
|
2
|
+
import { createPopper as pe } from "@popperjs/core";
|
|
3
|
+
const ae = (t, N) => {
|
|
4
|
+
const l = t.__vccOpts || t;
|
|
5
5
|
for (const [p, d] of N)
|
|
6
|
-
|
|
7
|
-
return
|
|
8
|
-
}, Ee = { key: 0 },
|
|
6
|
+
l[p] = d;
|
|
7
|
+
return l;
|
|
8
|
+
}, Ee = { key: 0 }, Ne = { key: 1 }, Pe = { key: 2 }, De = { key: 3 }, qe = { key: 4 }, Te = { key: 5 }, He = { key: 6 }, Oe = {
|
|
9
9
|
__name: "SvgIcon",
|
|
10
10
|
props: {
|
|
11
11
|
name: {
|
|
@@ -14,7 +14,7 @@ const ne = (t, N) => {
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
setup(t) {
|
|
17
|
-
const N = t,
|
|
17
|
+
const N = t, l = g(() => ({
|
|
18
18
|
"svg-icon-spin": N.name === "spinner"
|
|
19
19
|
}));
|
|
20
20
|
return (p, d) => (i(), o("svg", {
|
|
@@ -23,21 +23,21 @@ const ne = (t, N) => {
|
|
|
23
23
|
fill: "currentColor",
|
|
24
24
|
width: "1em",
|
|
25
25
|
height: "1em",
|
|
26
|
-
class:
|
|
26
|
+
class: $(l.value)
|
|
27
27
|
}, [
|
|
28
28
|
t.name === "spinner" ? (i(), o("g", Ee, d[0] || (d[0] = [
|
|
29
29
|
h("path", { d: "M12,4V2A10,10,0,0,0,2,12H4A8,8,0,0,1,12,4Z" }, null, -1)
|
|
30
30
|
]))) : v("", !0),
|
|
31
|
-
t.name === "times" ? (i(), o("g",
|
|
31
|
+
t.name === "times" ? (i(), o("g", Ne, d[1] || (d[1] = [
|
|
32
32
|
h("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
|
]))) : v("", !0),
|
|
34
|
-
t.name === "chevron-down" ? (i(), o("g",
|
|
34
|
+
t.name === "chevron-down" ? (i(), o("g", Pe, d[2] || (d[2] = [
|
|
35
35
|
h("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
|
]))) : v("", !0),
|
|
37
|
-
t.name === "chevron-right" ? (i(), o("g",
|
|
37
|
+
t.name === "chevron-right" ? (i(), o("g", De, d[3] || (d[3] = [
|
|
38
38
|
h("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
|
]))) : v("", !0),
|
|
40
|
-
t.name === "search" ? (i(), o("g",
|
|
40
|
+
t.name === "search" ? (i(), o("g", qe, d[4] || (d[4] = [
|
|
41
41
|
h("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
|
]))) : v("", !0),
|
|
43
43
|
t.name === "asc" ? (i(), o("g", Te, d[5] || (d[5] = [
|
|
@@ -46,7 +46,7 @@ const ne = (t, N) => {
|
|
|
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
|
]))) : v("", !0),
|
|
49
|
-
t.name === "desc" ? (i(), o("g",
|
|
49
|
+
t.name === "desc" ? (i(), o("g", He, d[6] || (d[6] = [
|
|
50
50
|
h("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"
|
|
@@ -54,13 +54,13 @@ const ne = (t, N) => {
|
|
|
54
54
|
]))) : v("", !0)
|
|
55
55
|
], 2));
|
|
56
56
|
}
|
|
57
|
-
}, B = /* @__PURE__ */
|
|
57
|
+
}, B = /* @__PURE__ */ ae(Oe, [["__scopeId", "data-v-d347d13a"]]), Re = { class: "tree-select-item-wrapper" }, Fe = {
|
|
58
58
|
key: 1,
|
|
59
59
|
class: "expander-placeholder"
|
|
60
|
-
}, Ze = ["checked", ".indeterminate", "disabled"], je = { class: "item-content" },
|
|
60
|
+
}, Ze = ["checked", ".indeterminate", "disabled"], je = { class: "item-content" }, Ue = {
|
|
61
61
|
key: 0,
|
|
62
62
|
class: "children-wrapper"
|
|
63
|
-
},
|
|
63
|
+
}, We = {
|
|
64
64
|
__name: "TreeSelectItem",
|
|
65
65
|
props: {
|
|
66
66
|
item: { type: Object, required: !0 },
|
|
@@ -77,49 +77,49 @@ const ne = (t, N) => {
|
|
|
77
77
|
},
|
|
78
78
|
emits: ["select", "toggle-expand"],
|
|
79
79
|
setup(t, { emit: N }) {
|
|
80
|
-
const
|
|
81
|
-
let
|
|
82
|
-
return u.children && u.children.forEach((
|
|
83
|
-
|
|
84
|
-
}),
|
|
85
|
-
}, P = g(() => !
|
|
86
|
-
return (u,
|
|
87
|
-
const
|
|
88
|
-
return i(), o("div",
|
|
80
|
+
const l = t, p = (u) => u[l.optionValue] || u.id || u.value, d = (u) => !l.disabledKey || !u ? !1 : u.hasOwnProperty(l.disabledKey) && u[l.disabledKey] !== null, x = g(() => l.item.children && l.item.children.length > 0), L = g(() => l.expandedItems.has(p(l.item))), C = g(() => l.selectedItems.includes(p(l.item))), A = (u) => {
|
|
81
|
+
let f = [];
|
|
82
|
+
return u.children && u.children.forEach((I) => {
|
|
83
|
+
f.push(p(I)), f.push(...A(I));
|
|
84
|
+
}), f;
|
|
85
|
+
}, P = g(() => !l.multiple || !l.selectAll || !x.value || C.value ? !1 : A(l.item).some((f) => l.selectedItems.includes(f)));
|
|
86
|
+
return (u, f) => {
|
|
87
|
+
const I = Ie("TreeSelectItem", !0);
|
|
88
|
+
return i(), o("div", Re, [
|
|
89
89
|
h("div", {
|
|
90
|
-
class:
|
|
91
|
-
"bg-primary text-white":
|
|
90
|
+
class: $(["list-group-item list-group-item-action d-flex align-items-center gap-2", {
|
|
91
|
+
"bg-primary text-white": C.value && (t.selectMode === "highlight" || !t.multiple) && !d(t.item) && !(t.disableBranchNode && x.value),
|
|
92
92
|
"is-disabled text-muted bg-light": d(t.item)
|
|
93
93
|
}]),
|
|
94
|
-
style:
|
|
95
|
-
onClick:
|
|
94
|
+
style: Be({ "padding-left": `${t.level * 1.5 + 1}rem` }),
|
|
95
|
+
onClick: f[2] || (f[2] = (V) => d(t.item) || t.disableBranchNode && x.value ? null : u.$emit("select", t.item))
|
|
96
96
|
}, [
|
|
97
|
-
x.value ? (i(),
|
|
97
|
+
x.value ? (i(), E(B, {
|
|
98
98
|
key: 0,
|
|
99
99
|
name: "chevron-right",
|
|
100
|
-
class:
|
|
101
|
-
onClick:
|
|
102
|
-
}, null, 8, ["class"])) : (i(), o("span",
|
|
100
|
+
class: $(["expander-icon", { "rotate-90": L.value }]),
|
|
101
|
+
onClick: f[0] || (f[0] = z((V) => u.$emit("toggle-expand", p(t.item)), ["stop"]))
|
|
102
|
+
}, null, 8, ["class"])) : (i(), o("span", Fe)),
|
|
103
103
|
t.multiple && t.selectMode === "checkbox" && !(t.disableBranchNode && x.value) ? (i(), o("input", {
|
|
104
104
|
key: 2,
|
|
105
105
|
type: "checkbox",
|
|
106
106
|
class: "form-check-input",
|
|
107
|
-
checked:
|
|
107
|
+
checked: C.value,
|
|
108
108
|
".indeterminate": P.value,
|
|
109
109
|
disabled: d(t.item),
|
|
110
|
-
onClick:
|
|
110
|
+
onClick: f[1] || (f[1] = z((V) => u.$emit("select", t.item), ["stop"]))
|
|
111
111
|
}, null, 40, Ze)) : v("", !0),
|
|
112
112
|
h("div", je, [
|
|
113
|
-
|
|
113
|
+
se(u.$slots, "default", {
|
|
114
114
|
item: t.item,
|
|
115
115
|
level: t.level
|
|
116
116
|
}, void 0, !0)
|
|
117
117
|
])
|
|
118
118
|
], 6),
|
|
119
|
-
x.value &&
|
|
120
|
-
(i(!0), o(H, null, O(t.item.children, (
|
|
121
|
-
key: p(
|
|
122
|
-
item:
|
|
119
|
+
x.value && L.value ? (i(), o("div", Ue, [
|
|
120
|
+
(i(!0), o(H, null, O(t.item.children, (V) => (i(), E(I, {
|
|
121
|
+
key: p(V),
|
|
122
|
+
item: V,
|
|
123
123
|
level: t.level + 1,
|
|
124
124
|
"selected-items": t.selectedItems,
|
|
125
125
|
"expanded-items": t.expandedItems,
|
|
@@ -130,11 +130,11 @@ const ne = (t, N) => {
|
|
|
130
130
|
"option-value": t.optionValue,
|
|
131
131
|
"disabled-key": t.disabledKey,
|
|
132
132
|
"disable-branch-node": t.disableBranchNode,
|
|
133
|
-
onSelect:
|
|
134
|
-
onToggleExpand:
|
|
133
|
+
onSelect: f[3] || (f[3] = (k) => u.$emit("select", k)),
|
|
134
|
+
onToggleExpand: f[4] || (f[4] = (k) => u.$emit("toggle-expand", k))
|
|
135
135
|
}, {
|
|
136
|
-
default:
|
|
137
|
-
|
|
136
|
+
default: ge(({ item: k, level: D }) => [
|
|
137
|
+
se(u.$slots, "default", {
|
|
138
138
|
item: k,
|
|
139
139
|
level: D
|
|
140
140
|
}, void 0, !0)
|
|
@@ -145,35 +145,35 @@ const ne = (t, N) => {
|
|
|
145
145
|
]);
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
},
|
|
148
|
+
}, Ge = /* @__PURE__ */ ae(We, [["__scopeId", "data-v-9766821f"]]), Je = { class: "tree-select-wrapper" }, Qe = ["onKeydown"], Xe = { class: "tree-select-display-container" }, Ye = {
|
|
149
149
|
key: 0,
|
|
150
150
|
class: "text-truncate"
|
|
151
|
-
},
|
|
151
|
+
}, _e = { key: 1 }, et = {
|
|
152
152
|
key: 0,
|
|
153
153
|
class: "text-muted"
|
|
154
|
-
},
|
|
154
|
+
}, tt = {
|
|
155
155
|
key: 1,
|
|
156
156
|
class: "chips-container"
|
|
157
|
-
},
|
|
157
|
+
}, lt = { class: "d-flex align-items-center gap-2" }, nt = { class: "list-group list-group-flush" }, st = { class: "text-wrap text-start me-2" }, at = { class: "p-2 border-bottom d-flex flex-column gap-2" }, it = {
|
|
158
158
|
key: 1,
|
|
159
159
|
class: "d-flex align-items-center gap-2"
|
|
160
|
-
},
|
|
160
|
+
}, ot = ["value"], rt = ["disabled"], dt = {
|
|
161
161
|
key: 0,
|
|
162
162
|
class: "p-4 text-muted text-center"
|
|
163
|
-
},
|
|
163
|
+
}, ut = {
|
|
164
164
|
key: 1,
|
|
165
165
|
class: "tree-select-body",
|
|
166
166
|
style: { "max-height": "300px", "overflow-y": "auto" }
|
|
167
|
-
},
|
|
167
|
+
}, ct = {
|
|
168
168
|
key: 0,
|
|
169
169
|
class: "list-group list-group-flush"
|
|
170
|
-
},
|
|
170
|
+
}, ft = {
|
|
171
171
|
class: "d-flex align-items-center gap-2",
|
|
172
172
|
style: { "white-space": "wrap" }
|
|
173
|
-
},
|
|
173
|
+
}, mt = {
|
|
174
174
|
key: 1,
|
|
175
175
|
class: "p-3 text-muted text-center"
|
|
176
|
-
},
|
|
176
|
+
}, vt = {
|
|
177
177
|
__name: "TreeSelectMain",
|
|
178
178
|
props: {
|
|
179
179
|
modelValue: {
|
|
@@ -226,6 +226,10 @@ const ne = (t, N) => {
|
|
|
226
226
|
type: Boolean,
|
|
227
227
|
default: !1
|
|
228
228
|
},
|
|
229
|
+
deselectAll: {
|
|
230
|
+
type: Boolean,
|
|
231
|
+
default: !0
|
|
232
|
+
},
|
|
229
233
|
optionLabel: {
|
|
230
234
|
type: String,
|
|
231
235
|
default: "value"
|
|
@@ -276,141 +280,144 @@ const ne = (t, N) => {
|
|
|
276
280
|
},
|
|
277
281
|
emits: ["update:modelValue", "change"],
|
|
278
282
|
setup(t, { emit: N }) {
|
|
279
|
-
const
|
|
283
|
+
const l = t, p = N, d = b(null), x = b(null), L = b(""), C = b(!1), A = b(/* @__PURE__ */ new Set()), P = b(null), u = b(l.defaultSortKey), f = b(l.defaultSortDirection), I = b(null), V = b(null), k = b(!1), D = b(null), ie = g(() => l.size === "sm" ? "btn-sm" : l.size === "lg" ? "btn-lg" : l.size === "xl" ? "btn-xl" : ""), oe = g(() => l.size === "sm" ? "form-control-sm" : l.size === "lg" ? "form-control-lg" : l.size === "xl" ? "form-control-xl" : ""), ye = g(() => Y.value === 0 ? [] : X.value.slice(l.maxVisibleChipsDisplay)), U = g(() => !l.multiple || !l.excludeFromSelectedListKey ? M.value : M.value.filter((e) => {
|
|
284
|
+
const s = F(e);
|
|
285
|
+
return !s || !s[l.excludeFromSelectedListKey];
|
|
286
|
+
})), q = (e) => e && (e[l.optionLabel] || e.label || e.name) || "", y = (e) => e ? e[l.optionValue] || e.id || e.value : null, W = (e) => !l.disabledKey || !e ? !1 : e.hasOwnProperty(l.disabledKey) && e[l.disabledKey] !== null, S = (e) => e.children && e.children.length > 0, R = (e, s) => {
|
|
280
287
|
if (s)
|
|
281
|
-
return s.split(".").reduce((
|
|
282
|
-
},
|
|
283
|
-
for (const
|
|
284
|
-
if (y(
|
|
285
|
-
if (
|
|
286
|
-
const a =
|
|
288
|
+
return s.split(".").reduce((n, a) => n && n[a], e);
|
|
289
|
+
}, F = (e, s = l.items) => {
|
|
290
|
+
for (const n of s) {
|
|
291
|
+
if (y(n) === e) return n;
|
|
292
|
+
if (S(n)) {
|
|
293
|
+
const a = F(e, n.children);
|
|
287
294
|
if (a) return a;
|
|
288
295
|
}
|
|
289
296
|
}
|
|
290
297
|
return null;
|
|
291
|
-
},
|
|
298
|
+
}, G = (e) => {
|
|
292
299
|
const s = [];
|
|
293
|
-
return
|
|
294
|
-
|
|
300
|
+
return S(e) && e.children.forEach((n) => {
|
|
301
|
+
W(n) || (s.push(y(n)), s.push(...G(n)));
|
|
295
302
|
}), s;
|
|
296
|
-
},
|
|
303
|
+
}, J = (e, s = l.items, n = []) => {
|
|
297
304
|
for (const a of s) {
|
|
298
|
-
if (y(a) === e) return
|
|
299
|
-
if (
|
|
300
|
-
const r =
|
|
305
|
+
if (y(a) === e) return n;
|
|
306
|
+
if (S(a)) {
|
|
307
|
+
const r = J(e, a.children, [...n, y(a)]);
|
|
301
308
|
if (r) return r;
|
|
302
309
|
}
|
|
303
310
|
}
|
|
304
311
|
return null;
|
|
305
|
-
},
|
|
306
|
-
const e = new Set(Array.isArray(
|
|
307
|
-
if (
|
|
308
|
-
const s = (
|
|
309
|
-
|
|
310
|
-
if (
|
|
311
|
-
const r = a.children.filter((
|
|
312
|
-
r.length > 0 && r.every((
|
|
312
|
+
}, M = g(() => {
|
|
313
|
+
const e = new Set(Array.isArray(l.modelValue) ? l.modelValue : [l.modelValue].filter(Boolean));
|
|
314
|
+
if (l.multiple && l.selectAll) {
|
|
315
|
+
const s = (n) => {
|
|
316
|
+
n.forEach((a) => {
|
|
317
|
+
if (S(a)) {
|
|
318
|
+
const r = a.children.filter((c) => !W(c));
|
|
319
|
+
r.length > 0 && r.every((c) => e.has(y(c))) && e.add(y(a)), s(a.children);
|
|
313
320
|
}
|
|
314
321
|
});
|
|
315
322
|
};
|
|
316
|
-
s(
|
|
323
|
+
s(l.items);
|
|
317
324
|
}
|
|
318
325
|
return Array.from(e);
|
|
319
|
-
}),
|
|
326
|
+
}), Q = (e, s = l.items, n = []) => {
|
|
320
327
|
for (const a of s) {
|
|
321
|
-
const r = [...
|
|
328
|
+
const r = [...n, q(a)];
|
|
322
329
|
if (y(a) === e) return r;
|
|
323
|
-
if (
|
|
324
|
-
const m =
|
|
330
|
+
if (S(a)) {
|
|
331
|
+
const m = Q(e, a.children, r);
|
|
325
332
|
if (m) return m;
|
|
326
333
|
}
|
|
327
334
|
}
|
|
328
335
|
return null;
|
|
329
|
-
},
|
|
336
|
+
}, re = (e) => {
|
|
330
337
|
if (!e || e.length === 0) return "";
|
|
331
338
|
const s = e.join(" → ");
|
|
332
339
|
return s.length <= 40 ? s : e.length > 2 ? `${e[0]} → ... → ${e[e.length - 1]}` : s;
|
|
333
|
-
},
|
|
334
|
-
const e =
|
|
335
|
-
if (e.length === 0) return
|
|
336
|
-
if (
|
|
340
|
+
}, be = g(() => {
|
|
341
|
+
const e = U.value;
|
|
342
|
+
if (e.length === 0) return l.placeholder;
|
|
343
|
+
if (l.multiple) {
|
|
337
344
|
if (e.length === 1) {
|
|
338
|
-
const
|
|
339
|
-
return
|
|
345
|
+
const n = Q(e[0]);
|
|
346
|
+
return n ? re(n) : e[0];
|
|
340
347
|
}
|
|
341
348
|
return `${e.length} items selected`;
|
|
342
349
|
}
|
|
343
|
-
const s =
|
|
344
|
-
return s ?
|
|
345
|
-
}),
|
|
346
|
-
if (!
|
|
347
|
-
const e =
|
|
348
|
-
if (!
|
|
350
|
+
const s = Q(e[0]);
|
|
351
|
+
return s ? re(s) : e[0];
|
|
352
|
+
}), X = g(() => {
|
|
353
|
+
if (!l.multiple || U.value.length === 0) return [];
|
|
354
|
+
const e = U.value.map((a) => F(a)).filter(Boolean);
|
|
355
|
+
if (!l.sortable || !u.value)
|
|
349
356
|
return e;
|
|
350
|
-
const s = u.value,
|
|
357
|
+
const s = u.value, n = f.value;
|
|
351
358
|
return [...e].sort((a, r) => {
|
|
352
|
-
const m = R(a, s),
|
|
359
|
+
const m = R(a, s), c = R(r, s);
|
|
353
360
|
if (m == null) return 1;
|
|
354
|
-
if (
|
|
355
|
-
let
|
|
356
|
-
return typeof m == "string" && typeof
|
|
361
|
+
if (c == null) return -1;
|
|
362
|
+
let w = 0;
|
|
363
|
+
return typeof m == "string" && typeof c == "string" ? w = m.localeCompare(c) : m > c ? w = 1 : m < c && (w = -1), n === "desc" ? w * -1 : w;
|
|
357
364
|
});
|
|
358
|
-
}),
|
|
359
|
-
const e =
|
|
365
|
+
}), xe = g(() => X.value.slice(0, l.maxVisibleChipsDisplay)), Y = g(() => {
|
|
366
|
+
const e = X.value.length - l.maxVisibleChipsDisplay;
|
|
360
367
|
return e > 0 ? e : 0;
|
|
361
|
-
}),
|
|
362
|
-
const a =
|
|
363
|
-
if (!
|
|
364
|
-
return a ?
|
|
365
|
-
const r =
|
|
366
|
-
return a ? { ...
|
|
367
|
-
}).filter(Boolean),
|
|
368
|
-
const
|
|
369
|
-
if (
|
|
370
|
-
if (
|
|
371
|
-
let
|
|
372
|
-
return typeof
|
|
373
|
-
}).map((r) =>
|
|
374
|
-
const e =
|
|
375
|
-
return !
|
|
376
|
-
}),
|
|
377
|
-
if (
|
|
378
|
-
const r = e
|
|
379
|
-
|
|
368
|
+
}), de = (e, s) => e.map((n) => {
|
|
369
|
+
const a = q(n).toLowerCase().includes(s);
|
|
370
|
+
if (!S(n))
|
|
371
|
+
return a ? n : null;
|
|
372
|
+
const r = de(n.children, s);
|
|
373
|
+
return a ? { ...n, children: n.children } : r.length > 0 ? { ...n, children: r } : null;
|
|
374
|
+
}).filter(Boolean), ue = (e, s, n) => !e || !s ? e : [...e].sort((r, m) => {
|
|
375
|
+
const c = R(r, s), w = R(m, s);
|
|
376
|
+
if (c == null) return 1;
|
|
377
|
+
if (w == null) return -1;
|
|
378
|
+
let T = 0;
|
|
379
|
+
return typeof c == "string" && typeof w == "string" ? T = c.localeCompare(w) : c > w ? T = 1 : c < w && (T = -1), n === "desc" ? T * -1 : T;
|
|
380
|
+
}).map((r) => S(r) ? { ...r, children: ue(r.children, s, n) } : r), _ = g(() => {
|
|
381
|
+
const e = L.value.trim() ? de(l.items, L.value.toLowerCase()) : l.items;
|
|
382
|
+
return !l.sortable || !u.value ? e : ue(e, u.value, f.value);
|
|
383
|
+
}), ke = (e) => {
|
|
384
|
+
if (l.disableBranchNodes && S(e)) {
|
|
385
|
+
const r = y(e);
|
|
386
|
+
fe(r);
|
|
380
387
|
return;
|
|
381
388
|
}
|
|
382
|
-
if (
|
|
389
|
+
if (W(e)) return;
|
|
383
390
|
const s = y(e);
|
|
384
|
-
let
|
|
385
|
-
if (
|
|
386
|
-
const r =
|
|
387
|
-
if (
|
|
388
|
-
const m =
|
|
389
|
-
r ? (
|
|
391
|
+
let n = new Set(M.value);
|
|
392
|
+
if (l.multiple) {
|
|
393
|
+
const r = n.has(s);
|
|
394
|
+
if (l.selectAll && S(e)) {
|
|
395
|
+
const m = G(e);
|
|
396
|
+
r ? (n.delete(s), l.deselectAll && m.forEach((c) => n.delete(c))) : (n.add(s), m.forEach((c) => n.add(c)));
|
|
390
397
|
} else
|
|
391
|
-
r ? (
|
|
398
|
+
r ? (n.delete(s), l.selectAll && J(s)?.forEach((c) => n.delete(c))) : n.add(s);
|
|
392
399
|
} else
|
|
393
|
-
|
|
394
|
-
let a = Array.from(
|
|
395
|
-
|
|
396
|
-
const m =
|
|
397
|
-
return !m || !m[
|
|
398
|
-
})), p("update:modelValue",
|
|
399
|
-
}, ue = (e) => {
|
|
400
|
-
if (n.disabled || !e) return;
|
|
401
|
-
const s = y(e), l = new Set($.value);
|
|
402
|
-
l.delete(s), n.selectAll && W(s)?.forEach((m) => l.delete(m));
|
|
403
|
-
const a = Array.from(l);
|
|
404
|
-
p("update:modelValue", a), p("change", a);
|
|
400
|
+
n = /* @__PURE__ */ new Set([s]), ee();
|
|
401
|
+
let a = Array.from(n);
|
|
402
|
+
l.multiple && l.excludeFromSelectedListKey && (a = a.filter((r) => {
|
|
403
|
+
const m = F(r);
|
|
404
|
+
return !m || !m[l.excludeFromSelectedListKey];
|
|
405
|
+
})), p("update:modelValue", l.multiple ? a : a[0] || null), p("change", l.multiple ? a : a[0] || null);
|
|
405
406
|
}, ce = (e) => {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
407
|
+
if (l.disabled || !e) return;
|
|
408
|
+
const s = y(e), n = new Set(M.value);
|
|
409
|
+
n.delete(s), l.selectAll && (l.deselectAll && S(e) && G(e).forEach((c) => n.delete(c)), J(s)?.forEach((m) => n.delete(m)));
|
|
410
|
+
const a = Array.from(n);
|
|
411
|
+
p("update:modelValue", a), p("change", a);
|
|
412
|
+
}, fe = (e) => {
|
|
413
|
+
A.value.has(e) ? A.value.delete(e) : A.value.add(e);
|
|
409
414
|
}, Se = () => {
|
|
410
|
-
|
|
415
|
+
f.value = f.value === "asc" ? "desc" : "asc";
|
|
416
|
+
}, we = () => {
|
|
417
|
+
const e = l.multiple ? [] : null;
|
|
411
418
|
p("update:modelValue", e), p("change", e), Z();
|
|
412
|
-
},
|
|
413
|
-
|
|
419
|
+
}, Ce = async () => {
|
|
420
|
+
l.disabled || (Z(), C.value = !0, await ne(), d.value && x.value && (P.value = pe(x.value, d.value, {
|
|
414
421
|
placement: "bottom-start",
|
|
415
422
|
strategy: "fixed",
|
|
416
423
|
modifiers: [
|
|
@@ -430,178 +437,178 @@ const ne = (t, N) => {
|
|
|
430
437
|
}
|
|
431
438
|
}
|
|
432
439
|
]
|
|
433
|
-
})),
|
|
434
|
-
},
|
|
435
|
-
|
|
436
|
-
},
|
|
437
|
-
k.value = !0, await
|
|
440
|
+
})), l.searchable && (await ne(), d.value?.querySelector(".tree-search-input")?.focus()));
|
|
441
|
+
}, ee = () => {
|
|
442
|
+
C.value = !1, L.value = "", P.value?.destroy(), P.value = null;
|
|
443
|
+
}, te = () => C.value ? ee() : Ce(), Ve = async () => {
|
|
444
|
+
k.value = !0, await ne(), V.value && I.value && (D.value = pe(I.value, V.value, {
|
|
438
445
|
placement: "bottom-end",
|
|
439
446
|
strategy: "fixed",
|
|
440
447
|
modifiers: [{ name: "offset", options: { offset: [0, 4] } }]
|
|
441
448
|
}));
|
|
442
449
|
}, Z = () => {
|
|
443
450
|
k.value = !1, D.value?.destroy(), D.value = null;
|
|
444
|
-
},
|
|
445
|
-
|
|
451
|
+
}, Le = () => k.value ? Z() : Ve(), me = (e) => {
|
|
452
|
+
C.value && !x.value?.contains(e.target) && !d.value?.contains(e.target) && ee(), k.value && !I.value?.contains(e.target) && !V.value?.contains(e.target) && Z();
|
|
446
453
|
};
|
|
447
|
-
return $e(() => document.addEventListener("click",
|
|
448
|
-
document.removeEventListener("click",
|
|
449
|
-
}),
|
|
454
|
+
return $e(() => document.addEventListener("click", me)), Ae(() => {
|
|
455
|
+
document.removeEventListener("click", me), P.value?.destroy(), D.value?.destroy();
|
|
456
|
+
}), Me(L, (e) => {
|
|
450
457
|
if (e.trim()) {
|
|
451
|
-
const s = (
|
|
452
|
-
|
|
453
|
-
|
|
458
|
+
const s = (n) => {
|
|
459
|
+
n.forEach((a) => {
|
|
460
|
+
S(a) && (A.value.add(y(a)), s(a.children));
|
|
454
461
|
});
|
|
455
462
|
};
|
|
456
|
-
s(
|
|
463
|
+
s(_.value);
|
|
457
464
|
}
|
|
458
|
-
}), (e, s) => (i(), o("div",
|
|
465
|
+
}), (e, s) => (i(), o("div", Je, [
|
|
459
466
|
h("div", {
|
|
460
467
|
ref_key: "triggerRef",
|
|
461
468
|
ref: x,
|
|
462
469
|
role: "button",
|
|
463
470
|
tabindex: "0",
|
|
464
|
-
class:
|
|
465
|
-
|
|
471
|
+
class: $(["btn tree-select-trigger w-100 d-flex justify-content-between align-items-center tree-select-main", [
|
|
472
|
+
ie.value,
|
|
466
473
|
{
|
|
467
474
|
"btn-outline-secondary": !t.isInvalid,
|
|
468
475
|
"border-danger": t.isInvalid,
|
|
469
476
|
disabled: t.disabled || t.isLoading,
|
|
470
477
|
"is-loading": t.isLoading,
|
|
471
|
-
"has-chips": t.multiple && t.displayMode === "chips" &&
|
|
478
|
+
"has-chips": t.multiple && t.displayMode === "chips" && M.value.length > 0
|
|
472
479
|
}
|
|
473
480
|
]]),
|
|
474
|
-
onClick:
|
|
481
|
+
onClick: te,
|
|
475
482
|
onKeydown: [
|
|
476
|
-
|
|
477
|
-
|
|
483
|
+
ve(z(te, ["prevent"]), ["enter"]),
|
|
484
|
+
ve(z(te, ["prevent"]), ["space"])
|
|
478
485
|
]
|
|
479
486
|
}, [
|
|
480
|
-
h("div",
|
|
481
|
-
!t.multiple || t.displayMode === "text" ? (i(), o("span",
|
|
482
|
-
|
|
483
|
-
(i(!0), o(H, null, O(
|
|
484
|
-
key: y(
|
|
487
|
+
h("div", Xe, [
|
|
488
|
+
!t.multiple || t.displayMode === "text" ? (i(), o("span", Ye, K(t.isLoading ? "Loading data..." : be.value), 1)) : t.multiple && t.displayMode === "chips" ? (i(), o("div", _e, [
|
|
489
|
+
M.value.length === 0 ? (i(), o("span", et, K(t.placeholder), 1)) : (i(), o("div", tt, [
|
|
490
|
+
(i(!0), o(H, null, O(xe.value, (n) => (i(), o("span", {
|
|
491
|
+
key: y(n),
|
|
485
492
|
class: "badge text-bg-primary chip bg-primary"
|
|
486
493
|
}, [
|
|
487
|
-
|
|
494
|
+
le(K(q(n)) + " ", 1),
|
|
488
495
|
j(B, {
|
|
489
496
|
name: "times",
|
|
490
497
|
class: "chip-remove",
|
|
491
|
-
onClick: z((a) =>
|
|
498
|
+
onClick: z((a) => ce(n), ["stop"])
|
|
492
499
|
}, null, 8, ["onClick"])
|
|
493
500
|
]))), 128)),
|
|
494
|
-
|
|
501
|
+
Y.value > 0 ? (i(), o("button", {
|
|
495
502
|
key: 0,
|
|
496
503
|
ref_key: "moreTriggerRef",
|
|
497
|
-
ref:
|
|
504
|
+
ref: I,
|
|
498
505
|
type: "button",
|
|
499
506
|
class: "btn btn-sm btn-light more-button",
|
|
500
|
-
onClick: z(
|
|
501
|
-
}, " +" +
|
|
507
|
+
onClick: z(Le, ["stop"])
|
|
508
|
+
}, " +" + K(Y.value), 513)) : v("", !0)
|
|
502
509
|
]))
|
|
503
510
|
])) : v("", !0)
|
|
504
511
|
]),
|
|
505
|
-
h("div",
|
|
506
|
-
t.isLoading ? (i(),
|
|
512
|
+
h("div", lt, [
|
|
513
|
+
t.isLoading ? (i(), E(B, {
|
|
507
514
|
key: 0,
|
|
508
515
|
name: "spinner",
|
|
509
516
|
class: "loading-icon"
|
|
510
517
|
})) : v("", !0),
|
|
511
|
-
t.showClearButton &&
|
|
518
|
+
t.showClearButton && M.value.length > 0 && !t.disabled && !t.isLoading ? (i(), E(B, {
|
|
512
519
|
key: 1,
|
|
513
520
|
name: "times",
|
|
514
|
-
onClick: z(
|
|
521
|
+
onClick: z(we, ["stop"]),
|
|
515
522
|
class: "clear-icon"
|
|
516
523
|
})) : v("", !0),
|
|
517
|
-
t.isLoading ? v("", !0) : (i(),
|
|
524
|
+
t.isLoading ? v("", !0) : (i(), E(B, {
|
|
518
525
|
key: 2,
|
|
519
526
|
name: "chevron-down",
|
|
520
|
-
class:
|
|
527
|
+
class: $(["transition-transform", { "rotate-180": C.value }])
|
|
521
528
|
}, null, 8, ["class"]))
|
|
522
529
|
])
|
|
523
|
-
], 42,
|
|
530
|
+
], 42, Qe),
|
|
524
531
|
k.value ? (i(), o("div", {
|
|
525
532
|
key: 0,
|
|
526
533
|
ref_key: "morePopoverRef",
|
|
527
|
-
ref:
|
|
534
|
+
ref: V,
|
|
528
535
|
class: "card shadow-lg border-0 more-popover",
|
|
529
536
|
style: { "z-index": "1060" }
|
|
530
537
|
}, [
|
|
531
|
-
h("div",
|
|
532
|
-
(i(!0), o(H, null, O(
|
|
533
|
-
key: y(
|
|
538
|
+
h("div", nt, [
|
|
539
|
+
(i(!0), o(H, null, O(ye.value, (n) => (i(), o("div", {
|
|
540
|
+
key: y(n),
|
|
534
541
|
class: "list-group-item d-flex justify-content-between align-items-center py-1 px-2"
|
|
535
542
|
}, [
|
|
536
|
-
h("small",
|
|
537
|
-
t.disabled ? v("", !0) : (i(),
|
|
543
|
+
h("small", st, K(q(n)), 1),
|
|
544
|
+
t.disabled ? v("", !0) : (i(), E(B, {
|
|
538
545
|
key: 0,
|
|
539
546
|
name: "times",
|
|
540
547
|
class: "chip-remove flex-shrink-0",
|
|
541
|
-
onClick: z((a) =>
|
|
548
|
+
onClick: z((a) => ce(n), ["stop"])
|
|
542
549
|
}, null, 8, ["onClick"]))
|
|
543
550
|
]))), 128))
|
|
544
551
|
])
|
|
545
552
|
], 512)) : v("", !0),
|
|
546
|
-
|
|
553
|
+
C.value ? (i(), o("div", {
|
|
547
554
|
key: 1,
|
|
548
555
|
ref_key: "dropdownRef",
|
|
549
556
|
ref: d,
|
|
550
557
|
class: "tree-select-dropdown card shadow-lg border-0",
|
|
551
558
|
style: { "z-index": "1050" }
|
|
552
559
|
}, [
|
|
553
|
-
h("div",
|
|
554
|
-
t.searchable ?
|
|
560
|
+
h("div", at, [
|
|
561
|
+
t.searchable ? he((i(), o("input", {
|
|
555
562
|
key: 0,
|
|
556
|
-
"onUpdate:modelValue": s[0] || (s[0] = (
|
|
563
|
+
"onUpdate:modelValue": s[0] || (s[0] = (n) => L.value = n),
|
|
557
564
|
type: "text",
|
|
558
|
-
class:
|
|
565
|
+
class: $(["form-control tree-search-input", oe.value]),
|
|
559
566
|
placeholder: "Search..."
|
|
560
567
|
}, null, 2)), [
|
|
561
|
-
[
|
|
568
|
+
[ze, L.value]
|
|
562
569
|
]) : v("", !0),
|
|
563
|
-
t.sortable && t.sortOptions.length > 0 ? (i(), o("div",
|
|
564
|
-
|
|
565
|
-
"onUpdate:modelValue": s[1] || (s[1] = (
|
|
566
|
-
class:
|
|
570
|
+
t.sortable && t.sortOptions.length > 0 ? (i(), o("div", it, [
|
|
571
|
+
he(h("select", {
|
|
572
|
+
"onUpdate:modelValue": s[1] || (s[1] = (n) => u.value = n),
|
|
573
|
+
class: $(["form-select flex-grow-1", oe.value])
|
|
567
574
|
}, [
|
|
568
575
|
s[2] || (s[2] = h("option", {
|
|
569
576
|
value: null,
|
|
570
577
|
disabled: ""
|
|
571
578
|
}, "Sort by...", -1)),
|
|
572
|
-
(i(!0), o(H, null, O(t.sortOptions, (
|
|
573
|
-
key:
|
|
574
|
-
value:
|
|
575
|
-
},
|
|
579
|
+
(i(!0), o(H, null, O(t.sortOptions, (n) => (i(), o("option", {
|
|
580
|
+
key: n.value,
|
|
581
|
+
value: n.value
|
|
582
|
+
}, K(n.label), 9, ot))), 128))
|
|
576
583
|
], 2), [
|
|
577
|
-
[
|
|
584
|
+
[Ke, u.value]
|
|
578
585
|
]),
|
|
579
586
|
h("button", {
|
|
580
587
|
type: "button",
|
|
581
|
-
class:
|
|
588
|
+
class: $(["btn btn-outline-secondary", ie.value]),
|
|
582
589
|
disabled: !u.value,
|
|
583
|
-
onClick:
|
|
590
|
+
onClick: Se
|
|
584
591
|
}, [
|
|
585
592
|
j(B, {
|
|
586
|
-
name:
|
|
593
|
+
name: f.value === "asc" ? "asc" : "desc"
|
|
587
594
|
}, null, 8, ["name"])
|
|
588
|
-
], 10,
|
|
595
|
+
], 10, rt)
|
|
589
596
|
])) : v("", !0)
|
|
590
597
|
]),
|
|
591
|
-
t.isLoading ? (i(), o("div",
|
|
598
|
+
t.isLoading ? (i(), o("div", dt, [
|
|
592
599
|
j(B, {
|
|
593
600
|
name: "spinner",
|
|
594
601
|
class: "me-2"
|
|
595
602
|
}),
|
|
596
603
|
s[3] || (s[3] = h("span", null, "Loading...", -1))
|
|
597
|
-
])) : (i(), o("div",
|
|
598
|
-
|
|
599
|
-
(i(!0), o(H, null, O(
|
|
600
|
-
key: y(
|
|
601
|
-
item:
|
|
604
|
+
])) : (i(), o("div", ut, [
|
|
605
|
+
_.value.length > 0 ? (i(), o("div", ct, [
|
|
606
|
+
(i(!0), o(H, null, O(_.value, (n) => (i(), E(Ge, {
|
|
607
|
+
key: y(n),
|
|
608
|
+
item: n,
|
|
602
609
|
level: 0,
|
|
603
|
-
"selected-items":
|
|
604
|
-
"expanded-items":
|
|
610
|
+
"selected-items": M.value,
|
|
611
|
+
"expanded-items": A.value,
|
|
605
612
|
multiple: t.multiple,
|
|
606
613
|
"select-all": t.selectAll,
|
|
607
614
|
"select-mode": t.selectMode,
|
|
@@ -609,42 +616,42 @@ const ne = (t, N) => {
|
|
|
609
616
|
"option-value": t.optionValue,
|
|
610
617
|
"disabled-key": t.disabledKey,
|
|
611
618
|
"disable-branch-node": t.disableBranchNodes,
|
|
612
|
-
onSelect:
|
|
613
|
-
onToggleExpand:
|
|
619
|
+
onSelect: ke,
|
|
620
|
+
onToggleExpand: fe
|
|
614
621
|
}, {
|
|
615
|
-
default:
|
|
616
|
-
|
|
622
|
+
default: ge(({ item: a, level: r }) => [
|
|
623
|
+
se(e.$slots, "default", {
|
|
617
624
|
item: a,
|
|
618
625
|
level: r
|
|
619
626
|
}, () => [
|
|
620
|
-
h("div",
|
|
621
|
-
|
|
627
|
+
h("div", ft, [
|
|
628
|
+
le(K(q(a)) + " ", 1),
|
|
622
629
|
a.icon ? (i(), o("i", {
|
|
623
630
|
key: 0,
|
|
624
|
-
class:
|
|
631
|
+
class: $(a.icon)
|
|
625
632
|
}, null, 2)) : v("", !0)
|
|
626
633
|
])
|
|
627
634
|
], !0)
|
|
628
635
|
]),
|
|
629
636
|
_: 2
|
|
630
637
|
}, 1032, ["item", "selected-items", "expanded-items", "multiple", "select-all", "select-mode", "option-label", "option-value", "disabled-key", "disable-branch-node"]))), 128))
|
|
631
|
-
])) : (i(), o("div",
|
|
638
|
+
])) : (i(), o("div", mt, [
|
|
632
639
|
j(B, {
|
|
633
640
|
name: "search",
|
|
634
641
|
class: "me-1"
|
|
635
642
|
}),
|
|
636
|
-
s[4] || (s[4] =
|
|
643
|
+
s[4] || (s[4] = le(" No items found ", -1))
|
|
637
644
|
]))
|
|
638
645
|
]))
|
|
639
646
|
], 512)) : v("", !0)
|
|
640
647
|
]));
|
|
641
648
|
}
|
|
642
|
-
},
|
|
649
|
+
}, ht = /* @__PURE__ */ ae(vt, [["__scopeId", "data-v-3c61512a"]]), yt = {
|
|
643
650
|
install(t) {
|
|
644
|
-
t.component("VSelect",
|
|
651
|
+
t.component("VSelect", ht);
|
|
645
652
|
}
|
|
646
653
|
};
|
|
647
654
|
export {
|
|
648
|
-
|
|
649
|
-
|
|
655
|
+
ht as VSelect,
|
|
656
|
+
yt as default
|
|
650
657
|
};
|
package/dist/vue-select.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(B,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):(B=typeof globalThis<"u"?globalThis:B||self,e(B.VueSelect={},B.Vue,B.Popper))})(this,(function(B,e,Z){"use strict";const D=(l,N)=>{const o=l.__vccOpts||l;for(const[f,i]of N)o[f]=i;return o},te={key:0},le={key:1},ne={key:2},oe={key:3},ae={key:4},re={key:5},se={key:6},V=D({__name:"SvgIcon",props:{name:{type:String,required:!0}},setup(l){const N=l,o=e.computed(()=>({"svg-icon-spin":N.name==="spinner"}));return(f,i)=>(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(o.value)},[l.name==="spinner"?(e.openBlock(),e.createElementBlock("g",te,i[0]||(i[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",le,i[1]||(i[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",ne,i[2]||(i[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",oe,i[3]||(i[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",ae,i[4]||(i[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",re,i[5]||(i[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",se,i[6]||(i[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)],2))}},[["__scopeId","data-v-d347d13a"]]),ie={class:"tree-select-item-wrapper"},ce={key:1,class:"expander-placeholder"},de=["checked",".indeterminate","disabled"],me={class:"item-content"},ue={key:0,class:"children-wrapper"},fe=D({__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:N}){const o=l,f=c=>c[o.optionValue]||c.id||c.value,i=c=>!o.disabledKey||!c?!1:c.hasOwnProperty(o.disabledKey)&&c[o.disabledKey]!==null,h=e.computed(()=>o.item.children&&o.item.children.length>0),x=e.computed(()=>o.expandedItems.has(f(o.item))),k=e.computed(()=>o.selectedItems.includes(f(o.item))),w=c=>{let d=[];return c.children&&c.children.forEach(S=>{d.push(f(S)),d.push(...w(S))}),d},L=e.computed(()=>!o.multiple||!o.selectAll||!h.value||k.value?!1:w(o.item).some(d=>o.selectedItems.includes(d)));return(c,d)=>{const S=e.resolveComponent("TreeSelectItem",!0);return e.openBlock(),e.createElementBlock("div",ie,[e.createElementVNode("div",{class:e.normalizeClass(["list-group-item list-group-item-action d-flex align-items-center gap-2",{"bg-primary text-white":k.value&&(l.selectMode==="highlight"||!l.multiple)&&!i(l.item)&&!(l.disableBranchNode&&h.value),"is-disabled text-muted bg-light":i(l.item)}]),style:e.normalizeStyle({"padding-left":`${l.level*1.5+1}rem`}),onClick:d[2]||(d[2]=b=>i(l.item)||l.disableBranchNode&&h.value?null:c.$emit("select",l.item))},[h.value?(e.openBlock(),e.createBlock(V,{key:0,name:"chevron-right",class:e.normalizeClass(["expander-icon",{"rotate-90":x.value}]),onClick:d[0]||(d[0]=e.withModifiers(b=>c.$emit("toggle-expand",f(l.item)),["stop"]))},null,8,["class"])):(e.openBlock(),e.createElementBlock("span",ce)),l.multiple&&l.selectMode==="checkbox"&&!(l.disableBranchNode&&h.value)?(e.openBlock(),e.createElementBlock("input",{key:2,type:"checkbox",class:"form-check-input",checked:k.value,".indeterminate":L.value,disabled:i(l.item),onClick:d[1]||(d[1]=e.withModifiers(b=>c.$emit("select",l.item),["stop"]))},null,40,de)):e.createCommentVNode("",!0),e.createElementVNode("div",me,[e.renderSlot(c.$slots,"default",{item:l.item,level:l.level},void 0,!0)])],6),h.value&&x.value?(e.openBlock(),e.createElementBlock("div",ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.children,b=>(e.openBlock(),e.createBlock(S,{key:f(b),item:b,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:d[3]||(d[3]=g=>c.$emit("select",g)),onToggleExpand:d[4]||(d[4]=g=>c.$emit("toggle-expand",g))},{default:e.withCtx(({item:g,level:M})=>[e.renderSlot(c.$slots,"default",{item:g,level:M},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-9766821f"]]),pe={class:"tree-select-wrapper"},he=["onKeydown"],ge={class:"tree-select-display-container"},ye={key:0,class:"text-truncate"},ke={key:1},be={key:0,class:"text-muted"},Be={key:1,class:"chips-container"},Ve={class:"d-flex align-items-center gap-2"},xe={class:"list-group list-group-flush"},Se={class:"text-wrap text-start me-2"},Ce={class:"p-2 border-bottom d-flex flex-column gap-2"},Ee={key:1,class:"d-flex align-items-center gap-2"},we=["value"],Ne=["disabled"],Le={key:0,class:"p-4 text-muted text-center"},Me={key:1,class:"tree-select-body",style:{"max-height":"300px","overflow-y":"auto"}},Ie={key:0,class:"list-group list-group-flush"},$e={class:"d-flex align-items-center gap-2",style:{"white-space":"wrap"}},ze={key:1,class:"p-3 text-muted text-center"},U=D({__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},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:3}},emits:["update:modelValue","change"],setup(l,{emit:N}){const o=l,f=N,i=e.ref(null),h=e.ref(null),x=e.ref(""),k=e.ref(!1),w=e.ref(new Set),L=e.ref(null),c=e.ref(o.defaultSortKey),d=e.ref(o.defaultSortDirection),S=e.ref(null),b=e.ref(null),g=e.ref(!1),M=e.ref(null),W=e.computed(()=>o.size==="sm"?"btn-sm":o.size==="lg"?"btn-lg":o.size==="xl"?"btn-xl":""),G=e.computed(()=>o.size==="sm"?"form-control-sm":o.size==="lg"?"form-control-lg":o.size==="xl"?"form-control-xl":""),De=e.computed(()=>H.value===0?[]:O.value.slice(o.maxVisibleChipsDisplay)),I=t=>t&&(t[o.optionLabel]||t.label||t.name)||"",p=t=>t?t[o.optionValue]||t.id||t.value:null,T=t=>!o.disabledKey||!t?!1:t.hasOwnProperty(o.disabledKey)&&t[o.disabledKey]!==null,C=t=>t.children&&t.children.length>0,z=(t,a)=>{if(a)return a.split(".").reduce((n,r)=>n&&n[r],t)},K=(t,a=o.items)=>{for(const n of a){if(p(n)===t)return n;if(C(n)){const r=K(t,n.children);if(r)return r}}return null},J=t=>{const a=[];return C(t)&&t.children.forEach(n=>{T(n)||(a.push(p(n)),a.push(...J(n)))}),a},P=(t,a=o.items,n=[])=>{for(const r of a){if(p(r)===t)return n;if(C(r)){const s=P(t,r.children,[...n,p(r)]);if(s)return s}}return null},E=e.computed(()=>{const t=new Set(Array.isArray(o.modelValue)?o.modelValue:[o.modelValue].filter(Boolean));if(o.multiple&&o.selectAll){const a=n=>{n.forEach(r=>{if(C(r)){const s=r.children.filter(m=>!T(m));s.length>0&&s.every(m=>t.has(p(m)))&&t.add(p(r)),a(r.children)}})};a(o.items)}return Array.from(t)}),q=(t,a=o.items,n=[])=>{for(const r of a){const s=[...n,I(r)];if(p(r)===t)return s;if(C(r)){const u=q(t,r.children,s);if(u)return u}}return null},Q=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},Te=e.computed(()=>{const t=E.value;if(t.length===0)return o.placeholder;if(o.multiple){if(t.length===1){const n=q(t[0]);return n?Q(n):t[0]}return`${t.length} items selected`}const a=q(t[0]);return a?Q(a):t[0]}),O=e.computed(()=>{if(!o.multiple||E.value.length===0)return[];const t=E.value.map(r=>K(r)).filter(Boolean);if(!o.sortable||!c.value)return t;const a=c.value,n=d.value;return[...t].sort((r,s)=>{const u=z(r,a),m=z(s,a);if(u==null)return 1;if(m==null)return-1;let y=0;return typeof u=="string"&&typeof m=="string"?y=u.localeCompare(m):u>m?y=1:u<m&&(y=-1),n==="desc"?y*-1:y})}),Ke=e.computed(()=>O.value.slice(0,o.maxVisibleChipsDisplay)),H=e.computed(()=>{const t=O.value.length-o.maxVisibleChipsDisplay;return t>0?t:0}),X=(t,a)=>t.map(n=>{const r=I(n).toLowerCase().includes(a);if(!C(n))return r?n:null;const s=X(n.children,a);return r?{...n,children:n.children}:s.length>0?{...n,children:s}:null}).filter(Boolean),Y=(t,a,n)=>!t||!a?t:[...t].sort((s,u)=>{const m=z(s,a),y=z(u,a);if(m==null)return 1;if(y==null)return-1;let $=0;return typeof m=="string"&&typeof y=="string"?$=m.localeCompare(y):m>y?$=1:m<y&&($=-1),n==="desc"?$*-1:$}).map(s=>C(s)?{...s,children:Y(s.children,a,n)}:s),R=e.computed(()=>{const t=x.value.trim()?X(o.items,x.value.toLowerCase()):o.items;return!o.sortable||!c.value?t:Y(t,c.value,d.value)}),Pe=t=>{if(o.disableBranchNodes&&t.children&&t.children.length>0){const s=t[o.optionValue]||t.id||t.value;_(s);return}if(T(t))return;const a=p(t);let n=new Set(E.value);if(o.multiple){const s=n.has(a);if(o.selectAll&&C(t)){const u=J(t);s?(n.delete(a),u.forEach(m=>n.delete(m))):(n.add(a),u.forEach(m=>n.add(m)))}else s?(n.delete(a),o.selectAll&&P(a)?.forEach(m=>n.delete(m))):n.add(a)}else n=new Set([a]),j();let r=Array.from(n);o.multiple&&o.excludeFromSelectedListKey&&(r=r.filter(s=>{const u=K(s);return!u||!u[o.excludeFromSelectedListKey]})),f("update:modelValue",o.multiple?r:r[0]||null),f("change",o.multiple?r:r[0]||null)},v=t=>{if(o.disabled||!t)return;const a=p(t),n=new Set(E.value);n.delete(a),o.selectAll&&P(a)?.forEach(u=>n.delete(u));const r=Array.from(n);f("update:modelValue",r),f("change",r)},_=t=>{w.value.has(t)?w.value.delete(t):w.value.add(t)},qe=()=>{d.value=d.value==="asc"?"desc":"asc"},Oe=()=>{const t=o.multiple?[]:null;f("update:modelValue",t),f("change",t),A()},He=async()=>{o.disabled||(A(),k.value=!0,await e.nextTick(),i.value&&h.value&&(L.value=Z.createPopper(h.value,i.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`}}]})),o.searchable&&(await e.nextTick(),i.value?.querySelector(".tree-search-input")?.focus()))},j=()=>{k.value=!1,x.value="",L.value?.destroy(),L.value=null},F=()=>k.value?j():He(),Re=async()=>{g.value=!0,await e.nextTick(),b.value&&S.value&&(M.value=Z.createPopper(S.value,b.value,{placement:"bottom-end",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,4]}}]}))},A=()=>{g.value=!1,M.value?.destroy(),M.value=null},je=()=>g.value?A():Re(),ee=t=>{k.value&&!h.value?.contains(t.target)&&!i.value?.contains(t.target)&&j(),g.value&&!S.value?.contains(t.target)&&!b.value?.contains(t.target)&&A()};return e.onMounted(()=>document.addEventListener("click",ee)),e.onUnmounted(()=>{document.removeEventListener("click",ee),L.value?.destroy(),M.value?.destroy()}),e.watch(x,t=>{if(t.trim()){const a=n=>{n.forEach(r=>{C(r)&&(w.value.add(p(r)),a(r.children))})};a(R.value)}}),(t,a)=>(e.openBlock(),e.createElementBlock("div",pe,[e.createElementVNode("div",{ref_key:"triggerRef",ref:h,role:"button",tabindex:"0",class:e.normalizeClass(["btn tree-select-trigger w-100 d-flex justify-content-between align-items-center tree-select-main",[W.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"&&E.value.length>0}]]),onClick:F,onKeydown:[e.withKeys(e.withModifiers(F,["prevent"]),["enter"]),e.withKeys(e.withModifiers(F,["prevent"]),["space"])]},[e.createElementVNode("div",ge,[!l.multiple||l.displayMode==="text"?(e.openBlock(),e.createElementBlock("span",ye,e.toDisplayString(l.isLoading?"Loading data...":Te.value),1)):l.multiple&&l.displayMode==="chips"?(e.openBlock(),e.createElementBlock("div",ke,[E.value.length===0?(e.openBlock(),e.createElementBlock("span",be,e.toDisplayString(l.placeholder),1)):(e.openBlock(),e.createElementBlock("div",Be,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ke.value,n=>(e.openBlock(),e.createElementBlock("span",{key:p(n),class:"badge text-bg-primary chip bg-primary"},[e.createTextVNode(e.toDisplayString(I(n))+" ",1),e.createVNode(V,{name:"times",class:"chip-remove",onClick:e.withModifiers(r=>v(n),["stop"])},null,8,["onClick"])]))),128)),H.value>0?(e.openBlock(),e.createElementBlock("button",{key:0,ref_key:"moreTriggerRef",ref:S,type:"button",class:"btn btn-sm btn-light more-button",onClick:e.withModifiers(je,["stop"])}," +"+e.toDisplayString(H.value),513)):e.createCommentVNode("",!0)]))])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ve,[l.isLoading?(e.openBlock(),e.createBlock(V,{key:0,name:"spinner",class:"loading-icon"})):e.createCommentVNode("",!0),l.showClearButton&&E.value.length>0&&!l.disabled&&!l.isLoading?(e.openBlock(),e.createBlock(V,{key:1,name:"times",onClick:e.withModifiers(Oe,["stop"]),class:"clear-icon"})):e.createCommentVNode("",!0),l.isLoading?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(V,{key:2,name:"chevron-down",class:e.normalizeClass(["transition-transform",{"rotate-180":k.value}])},null,8,["class"]))])],42,he),g.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"morePopoverRef",ref:b,class:"card shadow-lg border-0 more-popover",style:{"z-index":"1060"}},[e.createElementVNode("div",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(De.value,n=>(e.openBlock(),e.createElementBlock("div",{key:p(n),class:"list-group-item d-flex justify-content-between align-items-center py-1 px-2"},[e.createElementVNode("small",Se,e.toDisplayString(I(n)),1),l.disabled?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(V,{key:0,name:"times",class:"chip-remove flex-shrink-0",onClick:e.withModifiers(r=>v(n),["stop"])},null,8,["onClick"]))]))),128))])],512)):e.createCommentVNode("",!0),k.value?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"dropdownRef",ref:i,class:"tree-select-dropdown card shadow-lg border-0",style:{"z-index":"1050"}},[e.createElementVNode("div",Ce,[l.searchable?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,"onUpdate:modelValue":a[0]||(a[0]=n=>x.value=n),type:"text",class:e.normalizeClass(["form-control tree-search-input",G.value]),placeholder:"Search..."},null,2)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0),l.sortable&&l.sortOptions.length>0?(e.openBlock(),e.createElementBlock("div",Ee,[e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":a[1]||(a[1]=n=>c.value=n),class:e.normalizeClass(["form-select flex-grow-1",G.value])},[a[2]||(a[2]=e.createElementVNode("option",{value:null,disabled:""},"Sort by...",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.sortOptions,n=>(e.openBlock(),e.createElementBlock("option",{key:n.value,value:n.value},e.toDisplayString(n.label),9,we))),128))],2),[[e.vModelSelect,c.value]]),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["btn btn-outline-secondary",W.value]),disabled:!c.value,onClick:qe},[e.createVNode(V,{name:d.value==="asc"?"asc":"desc"},null,8,["name"])],10,Ne)])):e.createCommentVNode("",!0)]),l.isLoading?(e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(V,{name:"spinner",class:"me-2"}),a[3]||(a[3]=e.createElementVNode("span",null,"Loading...",-1))])):(e.openBlock(),e.createElementBlock("div",Me,[R.value.length>0?(e.openBlock(),e.createElementBlock("div",Ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,n=>(e.openBlock(),e.createBlock(fe,{key:p(n),item:n,level:0,"selected-items":E.value,"expanded-items":w.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:Pe,onToggleExpand:_},{default:e.withCtx(({item:r,level:s})=>[e.renderSlot(t.$slots,"default",{item:r,level:s},()=>[e.createElementVNode("div",$e,[e.createTextVNode(e.toDisplayString(I(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",ze,[e.createVNode(V,{name:"search",class:"me-1"}),a[4]||(a[4]=e.createTextVNode(" No items found ",-1))]))]))],512)):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-11e3fd3d"]]),Ae={install(l){l.component("VSelect",U)}};B.VSelect=U,B.default=Ae,Object.defineProperties(B,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(V,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):(V=typeof globalThis<"u"?globalThis:V||self,e(V.VueSelect={},V.Vue,V.Popper))})(this,(function(V,e,W){"use strict";const K=(l,N)=>{const n=l.__vccOpts||l;for(const[f,i]of N)n[f]=i;return n},le={key:0},ne={key:1},oe={key:2},ae={key:3},re={key:4},se={key:5},ie={key:6},x=K({__name:"SvgIcon",props:{name:{type:String,required:!0}},setup(l){const N=l,n=e.computed(()=>({"svg-icon-spin":N.name==="spinner"}));return(f,i)=>(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",le,i[0]||(i[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",ne,i[1]||(i[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",oe,i[2]||(i[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",ae,i[3]||(i[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",re,i[4]||(i[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",se,i[5]||(i[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",ie,i[6]||(i[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)],2))}},[["__scopeId","data-v-d347d13a"]]),ce={class:"tree-select-item-wrapper"},de={key:1,class:"expander-placeholder"},me=["checked",".indeterminate","disabled"],ue={class:"item-content"},fe={key:0,class:"children-wrapper"},pe=K({__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:N}){const n=l,f=c=>c[n.optionValue]||c.id||c.value,i=c=>!n.disabledKey||!c?!1:c.hasOwnProperty(n.disabledKey)&&c[n.disabledKey]!==null,h=e.computed(()=>n.item.children&&n.item.children.length>0),S=e.computed(()=>n.expandedItems.has(f(n.item))),b=e.computed(()=>n.selectedItems.includes(f(n.item))),C=c=>{let m=[];return c.children&&c.children.forEach(E=>{m.push(f(E)),m.push(...C(E))}),m},L=e.computed(()=>!n.multiple||!n.selectAll||!h.value||b.value?!1:C(n.item).some(m=>n.selectedItems.includes(m)));return(c,m)=>{const E=e.resolveComponent("TreeSelectItem",!0);return e.openBlock(),e.createElementBlock("div",ce,[e.createElementVNode("div",{class:e.normalizeClass(["list-group-item list-group-item-action d-flex align-items-center gap-2",{"bg-primary text-white":b.value&&(l.selectMode==="highlight"||!l.multiple)&&!i(l.item)&&!(l.disableBranchNode&&h.value),"is-disabled text-muted bg-light":i(l.item)}]),style:e.normalizeStyle({"padding-left":`${l.level*1.5+1}rem`}),onClick:m[2]||(m[2]=B=>i(l.item)||l.disableBranchNode&&h.value?null:c.$emit("select",l.item))},[h.value?(e.openBlock(),e.createBlock(x,{key:0,name:"chevron-right",class:e.normalizeClass(["expander-icon",{"rotate-90":S.value}]),onClick:m[0]||(m[0]=e.withModifiers(B=>c.$emit("toggle-expand",f(l.item)),["stop"]))},null,8,["class"])):(e.openBlock(),e.createElementBlock("span",de)),l.multiple&&l.selectMode==="checkbox"&&!(l.disableBranchNode&&h.value)?(e.openBlock(),e.createElementBlock("input",{key:2,type:"checkbox",class:"form-check-input",checked:b.value,".indeterminate":L.value,disabled:i(l.item),onClick:m[1]||(m[1]=e.withModifiers(B=>c.$emit("select",l.item),["stop"]))},null,40,me)):e.createCommentVNode("",!0),e.createElementVNode("div",ue,[e.renderSlot(c.$slots,"default",{item:l.item,level:l.level},void 0,!0)])],6),h.value&&S.value?(e.openBlock(),e.createElementBlock("div",fe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.children,B=>(e.openBlock(),e.createBlock(E,{key:f(B),item:B,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:m[3]||(m[3]=g=>c.$emit("select",g)),onToggleExpand:m[4]||(m[4]=g=>c.$emit("toggle-expand",g))},{default:e.withCtx(({item:g,level:M})=>[e.renderSlot(c.$slots,"default",{item:g,level:M},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-9766821f"]]),he={class:"tree-select-wrapper"},ge=["onKeydown"],ye={class:"tree-select-display-container"},ke={key:0,class:"text-truncate"},be={key:1},Be={key:0,class:"text-muted"},Ve={key:1,class:"chips-container"},xe={class:"d-flex align-items-center gap-2"},Se={class:"list-group list-group-flush"},Ee={class:"text-wrap text-start me-2"},Ce={class:"p-2 border-bottom d-flex flex-column gap-2"},we={key:1,class:"d-flex align-items-center gap-2"},Ne=["value"],Le=["disabled"],Me={key:0,class:"p-4 text-muted text-center"},Ie={key:1,class:"tree-select-body",style:{"max-height":"300px","overflow-y":"auto"}},$e={key:0,class:"list-group list-group-flush"},Ae={class:"d-flex align-items-center gap-2",style:{"white-space":"wrap"}},ze={key:1,class:"p-3 text-muted text-center"},G=K({__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},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:3}},emits:["update:modelValue","change"],setup(l,{emit:N}){const n=l,f=N,i=e.ref(null),h=e.ref(null),S=e.ref(""),b=e.ref(!1),C=e.ref(new Set),L=e.ref(null),c=e.ref(n.defaultSortKey),m=e.ref(n.defaultSortDirection),E=e.ref(null),B=e.ref(null),g=e.ref(!1),M=e.ref(null),J=e.computed(()=>n.size==="sm"?"btn-sm":n.size==="lg"?"btn-lg":n.size==="xl"?"btn-xl":""),Q=e.computed(()=>n.size==="sm"?"form-control-sm":n.size==="lg"?"form-control-lg":n.size==="xl"?"form-control-xl":""),Ke=e.computed(()=>j.value===0?[]:F.value.slice(n.maxVisibleChipsDisplay)),P=e.computed(()=>!n.multiple||!n.excludeFromSelectedListKey?w.value:w.value.filter(t=>{const a=z(t);return!a||!a[n.excludeFromSelectedListKey]})),I=t=>t&&(t[n.optionLabel]||t.label||t.name)||"",p=t=>t?t[n.optionValue]||t.id||t.value:null,T=t=>!n.disabledKey||!t?!1:t.hasOwnProperty(n.disabledKey)&&t[n.disabledKey]!==null,y=t=>t.children&&t.children.length>0,A=(t,a)=>{if(a)return a.split(".").reduce((o,r)=>o&&o[r],t)},z=(t,a=n.items)=>{for(const o of a){if(p(o)===t)return o;if(y(o)){const r=z(t,o.children);if(r)return r}}return null},q=t=>{const a=[];return y(t)&&t.children.forEach(o=>{T(o)||(a.push(p(o)),a.push(...q(o)))}),a},O=(t,a=n.items,o=[])=>{for(const r of a){if(p(r)===t)return o;if(y(r)){const s=O(t,r.children,[...o,p(r)]);if(s)return s}}return null},w=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(y(r)){const s=r.children.filter(d=>!T(d));s.length>0&&s.every(d=>t.has(p(d)))&&t.add(p(r)),a(r.children)}})};a(n.items)}return Array.from(t)}),H=(t,a=n.items,o=[])=>{for(const r of a){const s=[...o,I(r)];if(p(r)===t)return s;if(y(r)){const u=H(t,r.children,s);if(u)return u}}return null},X=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},Pe=e.computed(()=>{const t=P.value;if(t.length===0)return n.placeholder;if(n.multiple){if(t.length===1){const o=H(t[0]);return o?X(o):t[0]}return`${t.length} items selected`}const a=H(t[0]);return a?X(a):t[0]}),F=e.computed(()=>{if(!n.multiple||P.value.length===0)return[];const t=P.value.map(r=>z(r)).filter(Boolean);if(!n.sortable||!c.value)return t;const a=c.value,o=m.value;return[...t].sort((r,s)=>{const u=A(r,a),d=A(s,a);if(u==null)return 1;if(d==null)return-1;let k=0;return typeof u=="string"&&typeof d=="string"?k=u.localeCompare(d):u>d?k=1:u<d&&(k=-1),o==="desc"?k*-1:k})}),Te=e.computed(()=>F.value.slice(0,n.maxVisibleChipsDisplay)),j=e.computed(()=>{const t=F.value.length-n.maxVisibleChipsDisplay;return t>0?t:0}),Y=(t,a)=>t.map(o=>{const r=I(o).toLowerCase().includes(a);if(!y(o))return r?o:null;const s=Y(o.children,a);return r?{...o,children:o.children}:s.length>0?{...o,children:s}:null}).filter(Boolean),v=(t,a,o)=>!t||!a?t:[...t].sort((s,u)=>{const d=A(s,a),k=A(u,a);if(d==null)return 1;if(k==null)return-1;let $=0;return typeof d=="string"&&typeof k=="string"?$=d.localeCompare(k):d>k?$=1:d<k&&($=-1),o==="desc"?$*-1:$}).map(s=>y(s)?{...s,children:v(s.children,a,o)}:s),R=e.computed(()=>{const t=S.value.trim()?Y(n.items,S.value.toLowerCase()):n.items;return!n.sortable||!c.value?t:v(t,c.value,m.value)}),qe=t=>{if(n.disableBranchNodes&&y(t)){const s=p(t);ee(s);return}if(T(t))return;const a=p(t);let o=new Set(w.value);if(n.multiple){const s=o.has(a);if(n.selectAll&&y(t)){const u=q(t);s?(o.delete(a),n.deselectAll&&u.forEach(d=>o.delete(d))):(o.add(a),u.forEach(d=>o.add(d)))}else s?(o.delete(a),n.selectAll&&O(a)?.forEach(d=>o.delete(d))):o.add(a)}else o=new Set([a]),Z();let r=Array.from(o);n.multiple&&n.excludeFromSelectedListKey&&(r=r.filter(s=>{const u=z(s);return!u||!u[n.excludeFromSelectedListKey]})),f("update:modelValue",n.multiple?r:r[0]||null),f("change",n.multiple?r:r[0]||null)},_=t=>{if(n.disabled||!t)return;const a=p(t),o=new Set(w.value);o.delete(a),n.selectAll&&(n.deselectAll&&y(t)&&q(t).forEach(d=>o.delete(d)),O(a)?.forEach(u=>o.delete(u)));const r=Array.from(o);f("update:modelValue",r),f("change",r)},ee=t=>{C.value.has(t)?C.value.delete(t):C.value.add(t)},Oe=()=>{m.value=m.value==="asc"?"desc":"asc"},He=()=>{const t=n.multiple?[]:null;f("update:modelValue",t),f("change",t),D()},Fe=async()=>{n.disabled||(D(),b.value=!0,await e.nextTick(),i.value&&h.value&&(L.value=W.createPopper(h.value,i.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(),i.value?.querySelector(".tree-search-input")?.focus()))},Z=()=>{b.value=!1,S.value="",L.value?.destroy(),L.value=null},U=()=>b.value?Z():Fe(),je=async()=>{g.value=!0,await e.nextTick(),B.value&&E.value&&(M.value=W.createPopper(E.value,B.value,{placement:"bottom-end",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,4]}}]}))},D=()=>{g.value=!1,M.value?.destroy(),M.value=null},Re=()=>g.value?D():je(),te=t=>{b.value&&!h.value?.contains(t.target)&&!i.value?.contains(t.target)&&Z(),g.value&&!E.value?.contains(t.target)&&!B.value?.contains(t.target)&&D()};return e.onMounted(()=>document.addEventListener("click",te)),e.onUnmounted(()=>{document.removeEventListener("click",te),L.value?.destroy(),M.value?.destroy()}),e.watch(S,t=>{if(t.trim()){const a=o=>{o.forEach(r=>{y(r)&&(C.value.add(p(r)),a(r.children))})};a(R.value)}}),(t,a)=>(e.openBlock(),e.createElementBlock("div",he,[e.createElementVNode("div",{ref_key:"triggerRef",ref:h,role:"button",tabindex:"0",class:e.normalizeClass(["btn tree-select-trigger w-100 d-flex justify-content-between align-items-center tree-select-main",[J.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"&&w.value.length>0}]]),onClick:U,onKeydown:[e.withKeys(e.withModifiers(U,["prevent"]),["enter"]),e.withKeys(e.withModifiers(U,["prevent"]),["space"])]},[e.createElementVNode("div",ye,[!l.multiple||l.displayMode==="text"?(e.openBlock(),e.createElementBlock("span",ke,e.toDisplayString(l.isLoading?"Loading data...":Pe.value),1)):l.multiple&&l.displayMode==="chips"?(e.openBlock(),e.createElementBlock("div",be,[w.value.length===0?(e.openBlock(),e.createElementBlock("span",Be,e.toDisplayString(l.placeholder),1)):(e.openBlock(),e.createElementBlock("div",Ve,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Te.value,o=>(e.openBlock(),e.createElementBlock("span",{key:p(o),class:"badge text-bg-primary chip bg-primary"},[e.createTextVNode(e.toDisplayString(I(o))+" ",1),e.createVNode(x,{name:"times",class:"chip-remove",onClick:e.withModifiers(r=>_(o),["stop"])},null,8,["onClick"])]))),128)),j.value>0?(e.openBlock(),e.createElementBlock("button",{key:0,ref_key:"moreTriggerRef",ref:E,type:"button",class:"btn btn-sm btn-light more-button",onClick:e.withModifiers(Re,["stop"])}," +"+e.toDisplayString(j.value),513)):e.createCommentVNode("",!0)]))])):e.createCommentVNode("",!0)]),e.createElementVNode("div",xe,[l.isLoading?(e.openBlock(),e.createBlock(x,{key:0,name:"spinner",class:"loading-icon"})):e.createCommentVNode("",!0),l.showClearButton&&w.value.length>0&&!l.disabled&&!l.isLoading?(e.openBlock(),e.createBlock(x,{key:1,name:"times",onClick:e.withModifiers(He,["stop"]),class:"clear-icon"})):e.createCommentVNode("",!0),l.isLoading?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(x,{key:2,name:"chevron-down",class:e.normalizeClass(["transition-transform",{"rotate-180":b.value}])},null,8,["class"]))])],42,ge),g.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"morePopoverRef",ref:B,class:"card shadow-lg border-0 more-popover",style:{"z-index":"1060"}},[e.createElementVNode("div",Se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ke.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",Ee,e.toDisplayString(I(o)),1),l.disabled?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(x,{key:0,name:"times",class:"chip-remove flex-shrink-0",onClick:e.withModifiers(r=>_(o),["stop"])},null,8,["onClick"]))]))),128))])],512)):e.createCommentVNode("",!0),b.value?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"dropdownRef",ref:i,class:"tree-select-dropdown card shadow-lg border-0",style:{"z-index":"1050"}},[e.createElementVNode("div",Ce,[l.searchable?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,"onUpdate:modelValue":a[0]||(a[0]=o=>S.value=o),type:"text",class:e.normalizeClass(["form-control tree-search-input",Q.value]),placeholder:"Search..."},null,2)),[[e.vModelText,S.value]]):e.createCommentVNode("",!0),l.sortable&&l.sortOptions.length>0?(e.openBlock(),e.createElementBlock("div",we,[e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":a[1]||(a[1]=o=>c.value=o),class:e.normalizeClass(["form-select flex-grow-1",Q.value])},[a[2]||(a[2]=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,Ne))),128))],2),[[e.vModelSelect,c.value]]),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["btn btn-outline-secondary",J.value]),disabled:!c.value,onClick:Oe},[e.createVNode(x,{name:m.value==="asc"?"asc":"desc"},null,8,["name"])],10,Le)])):e.createCommentVNode("",!0)]),l.isLoading?(e.openBlock(),e.createElementBlock("div",Me,[e.createVNode(x,{name:"spinner",class:"me-2"}),a[3]||(a[3]=e.createElementVNode("span",null,"Loading...",-1))])):(e.openBlock(),e.createElementBlock("div",Ie,[R.value.length>0?(e.openBlock(),e.createElementBlock("div",$e,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,o=>(e.openBlock(),e.createBlock(pe,{key:p(o),item:o,level:0,"selected-items":w.value,"expanded-items":C.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:qe,onToggleExpand:ee},{default:e.withCtx(({item:r,level:s})=>[e.renderSlot(t.$slots,"default",{item:r,level:s},()=>[e.createElementVNode("div",Ae,[e.createTextVNode(e.toDisplayString(I(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",ze,[e.createVNode(x,{name:"search",class:"me-1"}),a[4]||(a[4]=e.createTextVNode(" No items found ",-1))]))]))],512)):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-3c61512a"]]),De={install(l){l.component("VSelect",G)}};V.VSelect=G,V.default=De,Object.defineProperties(V,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|