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