@pantograph/vue 0.23.22 → 0.23.24
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/Combobox/index.js +1 -1
- package/dist/Combobox/index.umd.cjs +1 -1
- package/dist/Combobox/types.d.ts +2 -0
- package/dist/{Combobox.vue_vue_type_style_index_0_lang-xUIlRKTq.js → Combobox.vue_vue_type_style_index_0_lang-CfAe6sbQ.js} +278 -265
- package/dist/Combobox.vue_vue_type_style_index_0_lang-nxzc0c0f.js +1 -0
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
- package/dist/Combobox.vue_vue_type_style_index_0_lang-Dr2iY00V.js +0 -1
package/dist/Combobox/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as s, C as t, a as x, i as C, p as a } from "../Combobox.vue_vue_type_style_index_0_lang-
|
|
1
|
+
import { _ as s, C as t, a as x, i as C, p as a } from "../Combobox.vue_vue_type_style_index_0_lang-CfAe6sbQ.js";
|
|
2
2
|
export {
|
|
3
3
|
s as Combobox,
|
|
4
4
|
t as ComboboxSizes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../Combobox.vue_vue_type_style_index_0_lang-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../Combobox.vue_vue_type_style_index_0_lang-nxzc0c0f.js");exports.Combobox=o._sfc_main;exports.ComboboxSizes=o.ComboboxSizes;exports.ComboboxStatuses=o.ComboboxStatuses;exports.injectComboboxContext=o.injectComboboxContext;exports.provideComboboxContext=o.provideComboboxContext;
|
package/dist/Combobox/types.d.ts
CHANGED
|
@@ -97,6 +97,8 @@ export interface ComboboxOptionSlots {
|
|
|
97
97
|
interface ComboboxTriggerDefSlotProps {
|
|
98
98
|
modelValue: string | string[] | undefined;
|
|
99
99
|
open: boolean;
|
|
100
|
+
option?: ComboboxOptionType;
|
|
101
|
+
options?: ComboboxOptionType[];
|
|
100
102
|
}
|
|
101
103
|
export interface ComboboxTriggerSlots {
|
|
102
104
|
trigger?: (data: ComboboxTriggerDefSlotProps) => never;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { computed as f, unref as L, defineComponent as ne, createBlock as Ce, openBlock as ie, mergeProps as Me, withCtx as de, createElementBlock as Le, createVNode as we, h as l, normalizeClass as
|
|
2
|
-
import { createContext as
|
|
1
|
+
import { computed as f, unref as L, defineComponent as ne, createBlock as Ce, openBlock as ie, mergeProps as Me, withCtx as de, createElementBlock as Le, createVNode as we, h as l, normalizeClass as He, renderSlot as Ee, ref as be, watch as Ke, useSlots as qe, useAttrs as Ye, createSlots as Je, renderList as Qe, normalizeProps as Xe, guardReactiveProps as Ze } from "vue";
|
|
2
|
+
import { createContext as Ne, ComboboxInput as et, ComboboxAnchor as tt, injectComboboxRootContext as ot, useFilter as nt, ComboboxPortal as rt, ComboboxContent as at, useEmitAsProps as lt, ComboboxRoot as st } from "reka-ui";
|
|
3
3
|
import { g as it, h as oe, o as pt, f as Ie, j as ut } from "./FormItem.vue_vue_type_style_index_0_lang-BpgRONei.js";
|
|
4
|
-
import { a as
|
|
5
|
-
import { getBemBlock as dt, getBemElement as
|
|
6
|
-
import { a as ge, i as
|
|
4
|
+
import { a as _e, g as ct } from "./options-D4et5euX.js";
|
|
5
|
+
import { getBemBlock as dt, getBemElement as k, generateVariantClassList as q } from "@pantograph/utils";
|
|
6
|
+
import { a as ge, i as U, b as Ve, u as gt, d as ke } from "./index-jwkhq8oW.js";
|
|
7
7
|
import { cva as xe } from "class-variance-authority";
|
|
8
8
|
import { a as mt, l as ft, o as Te } from "./omit-BuBwx_M2.js";
|
|
9
9
|
import { _ as vt } from "./Empty.vue_vue_type_style_index_0_lang-jfObDGf0.js";
|
|
10
10
|
import { _ as ht } from "./Skeleton.vue_vue_type_style_index_0_lang-Xi8CteLp.js";
|
|
11
11
|
import { _ as ye } from "./Divider.vue_vue_type_style_index_0_lang-B6fQsp1Y.js";
|
|
12
|
-
import { b as R, f as bt, a as yt, i as Ct, d as
|
|
13
|
-
import { u as
|
|
12
|
+
import { b as R, f as bt, a as yt, i as Ct, d as Vt } from "./element-BfQuKSll.js";
|
|
13
|
+
import { u as _t, U as xt } from "./useInputDataStates-0nK-AuOK.js";
|
|
14
14
|
import { u as St } from "./useLazyLoading-Zo-PEp2E.js";
|
|
15
|
-
import { g as
|
|
15
|
+
import { g as Bt, b as Ot } from "./Popover.vue_vue_type_style_index_0_lang-DyIDJxIC.js";
|
|
16
16
|
import { _ as Pt } from "./ScrollContainer.vue_vue_type_style_index_0_lang-DfMU1mTu.js";
|
|
17
17
|
import { _ as It } from "./Tree.vue_vue_type_style_index_0_lang-E0A2gSV2.js";
|
|
18
18
|
import { u as ze } from "./uniq-Cxafs-eV.js";
|
|
@@ -20,9 +20,9 @@ import { i as X } from "./isEmpty-wdqPTIXx.js";
|
|
|
20
20
|
import { _ as kt } from "./Chip.vue_vue_type_style_index_0_lang-DXsCoBle.js";
|
|
21
21
|
import { _ as Tt } from "./ChipGroup.vue_vue_type_style_index_0_lang-R-SmBNur.js";
|
|
22
22
|
import { _ as Se } from "./Icon.vue_vue_type_style_index_0_lang-CbLL-Ngi.js";
|
|
23
|
-
import { d as zt, _ as
|
|
23
|
+
import { d as zt, _ as Re } from "./Avatar.vue_vue_type_style_index_0_lang-DRTI7zpy.js";
|
|
24
24
|
import { _ as Dt } from "./GraphicalObjectGroup.vue_vue_type_style_index_0_lang-C3LfQ7iN.js";
|
|
25
|
-
import { _ as
|
|
25
|
+
import { _ as Ae } from "./GraphicalObject.vue_vue_type_script_setup_true_lang-Cm_eOjGc.js";
|
|
26
26
|
import { _ as Mt } from "./Input.vue_vue_type_style_index_0_lang-oEQu3uIk.js";
|
|
27
27
|
import { whenever as Lt, useVModel as wt } from "@vueuse/core";
|
|
28
28
|
import { last as Et } from "lodash-es";
|
|
@@ -30,7 +30,7 @@ import { a as Kt } from "./MenuItem.vue_vue_type_style_index_0_lang-7T_SPKSm.js"
|
|
|
30
30
|
import "@iconify/vue";
|
|
31
31
|
import { _ as Nt } from "./Checkbox.vue_vue_type_style_index_0_lang-aDK0Pvm-.js";
|
|
32
32
|
import "@pantograph/tokens";
|
|
33
|
-
const [
|
|
33
|
+
const [Be, Rt] = Ne("Combobox"), [At, $t] = Ne("_Combobox"), E = dt("combobox");
|
|
34
34
|
var Ft = 1 / 0;
|
|
35
35
|
function Wt(c) {
|
|
36
36
|
var o = c == null ? 0 : c.length;
|
|
@@ -42,13 +42,13 @@ function Gt({
|
|
|
42
42
|
arr: o,
|
|
43
43
|
getChildren: t
|
|
44
44
|
}) {
|
|
45
|
-
const e = [], u = (i,
|
|
46
|
-
i.forEach((
|
|
47
|
-
const
|
|
48
|
-
if (ce(
|
|
49
|
-
e.push({ ...
|
|
50
|
-
const
|
|
51
|
-
|
|
45
|
+
const e = [], u = (i, T) => {
|
|
46
|
+
i.forEach((z) => {
|
|
47
|
+
const x = c(z);
|
|
48
|
+
if (ce(x)) {
|
|
49
|
+
e.push({ ...z, _parentKeys: T, _key: x });
|
|
50
|
+
const C = t(z);
|
|
51
|
+
C != null && C.length && u(C, [...T ?? [], x]);
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
};
|
|
@@ -67,84 +67,84 @@ const Ut = ({
|
|
|
67
67
|
return u.value.filter((m) => {
|
|
68
68
|
var v;
|
|
69
69
|
if (g) {
|
|
70
|
-
const
|
|
71
|
-
return
|
|
70
|
+
const b = ft(m._parentKeys ?? []);
|
|
71
|
+
return b && b === r;
|
|
72
72
|
}
|
|
73
73
|
return (v = m._parentKeys) == null ? void 0 : v.includes(r);
|
|
74
74
|
});
|
|
75
|
-
},
|
|
76
|
-
if (a &&
|
|
75
|
+
}, T = (a) => {
|
|
76
|
+
if (a && U(a))
|
|
77
77
|
return oe(a);
|
|
78
78
|
const g = L(o());
|
|
79
|
-
return g &&
|
|
80
|
-
},
|
|
81
|
-
const r =
|
|
79
|
+
return g && U(g) ? oe(g) : [];
|
|
80
|
+
}, z = (a, g) => {
|
|
81
|
+
const r = T(g), m = i(a);
|
|
82
82
|
if (m != null && m.length)
|
|
83
83
|
return m.some((v) => {
|
|
84
84
|
var s;
|
|
85
|
-
const
|
|
86
|
-
return
|
|
85
|
+
const b = v._key;
|
|
86
|
+
return b && ((s = r == null ? void 0 : r.includes) == null ? void 0 : s.call(r, b));
|
|
87
87
|
});
|
|
88
|
-
},
|
|
89
|
-
const r =
|
|
88
|
+
}, x = (a, g) => {
|
|
89
|
+
const r = T(g), m = i(a);
|
|
90
90
|
if (m != null && m.length)
|
|
91
91
|
return m.every((v) => {
|
|
92
92
|
var s;
|
|
93
|
-
const
|
|
94
|
-
return
|
|
93
|
+
const b = v._key;
|
|
94
|
+
return b && ((s = r == null ? void 0 : r.includes) == null ? void 0 : s.call(r, b));
|
|
95
95
|
});
|
|
96
|
-
},
|
|
97
|
-
const r =
|
|
98
|
-
return m != null && m.length ?
|
|
96
|
+
}, C = (a, g) => {
|
|
97
|
+
const r = T(g), m = i(a), v = t(a);
|
|
98
|
+
return m != null && m.length ? x(a) ? !0 : z(a) ? "intermediate" : !1 : r.includes(v);
|
|
99
99
|
}, K = (a) => ce(a) ? u.value.find((g) => g._key === a) : void 0;
|
|
100
100
|
return {
|
|
101
101
|
flattenData: u,
|
|
102
102
|
getNodeChildren: i,
|
|
103
|
-
isSomeChildrenSelected:
|
|
104
|
-
isAllChildrenSelected:
|
|
105
|
-
isSelected:
|
|
103
|
+
isSomeChildrenSelected: z,
|
|
104
|
+
isAllChildrenSelected: x,
|
|
105
|
+
isSelected: C,
|
|
106
106
|
selectValues: (a, g) => {
|
|
107
107
|
if (a.length) {
|
|
108
|
-
let r =
|
|
108
|
+
let r = T();
|
|
109
109
|
const m = a.filter(ce);
|
|
110
|
-
g ? r.push(...m) : r = r.filter((
|
|
111
|
-
const v = r.map(K).filter((
|
|
112
|
-
return s.forEach((
|
|
113
|
-
const M = t(
|
|
114
|
-
|
|
115
|
-
}), r.push(...
|
|
110
|
+
g ? r.push(...m) : r = r.filter((h) => !m.includes(h));
|
|
111
|
+
const v = r.map(K).filter((h) => h && h._parentKeys), s = ze(Wt(v.map((h) => h._parentKeys))).filter(ce).map(K).filter(Boolean), O = [], P = [];
|
|
112
|
+
return s.forEach((h) => {
|
|
113
|
+
const M = t(h);
|
|
114
|
+
x(h, r) ? O.push(M) : P.push(M);
|
|
115
|
+
}), r.push(...O), ze(r.filter((h) => !P.includes(h)));
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
|
-
}, $e = ["sm", "md", "lg"], jt = ["error", "warning", "success"], Ht = { key: 1 },
|
|
119
|
+
}, $e = ["sm", "md", "lg"], jt = ["error", "warning", "success"], Ht = { key: 1 }, Fe = /* @__PURE__ */ ne({
|
|
120
120
|
__name: "ComboboxInput",
|
|
121
121
|
setup(c) {
|
|
122
|
-
const o =
|
|
122
|
+
const o = Be();
|
|
123
123
|
Lt(
|
|
124
124
|
() => o.open.value && o.headerInputElement.value,
|
|
125
125
|
() => {
|
|
126
126
|
o.headerInputElement.value && o.open.value && o.focusOnInput();
|
|
127
127
|
}
|
|
128
128
|
);
|
|
129
|
-
const t = f(() => !X(o.modelValue.value)), e = f(() => t.value ?
|
|
130
|
-
if (
|
|
131
|
-
const
|
|
132
|
-
o.focusOnInput(), clearTimeout(
|
|
129
|
+
const t = f(() => !X(o.modelValue.value)), e = f(() => t.value ? U(o.modelValue.value) ? o.getLabelByValue(Et(o.modelValue.value)) : o.getLabelByValue(o.modelValue.value) : o.props.placeholder), u = (z) => {
|
|
130
|
+
if (z.key === "Backspace" && o.props.multiple && U(o.modelValue.value) && X(o.searchModel.value) && (o.setModelValue(o.modelValue.value.slice(0, -1)), X(o.modelValue.value))) {
|
|
131
|
+
const x = setTimeout(() => {
|
|
132
|
+
o.focusOnInput(), clearTimeout(x);
|
|
133
133
|
}, 2);
|
|
134
134
|
}
|
|
135
|
-
}, i =
|
|
135
|
+
}, i = k(E, "input"), T = xe(i, {
|
|
136
136
|
variants: {
|
|
137
|
-
valuePlaceholder:
|
|
137
|
+
valuePlaceholder: q("value-placeholder", i)
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
|
-
return (
|
|
140
|
+
return (z, x) => (ie(), Ce(L(et), Me(L(o).comboboxInputBinding.value, {
|
|
141
141
|
disabled: L(o).getDisabled.value,
|
|
142
142
|
placeholder: e.value,
|
|
143
143
|
"as-child": "",
|
|
144
144
|
modelValue: L(o).searchModel.value,
|
|
145
|
-
"onUpdate:modelValue":
|
|
145
|
+
"onUpdate:modelValue": x[0] || (x[0] = (C) => L(o).searchModel.value = C),
|
|
146
146
|
onKeydown: u,
|
|
147
|
-
class: L(
|
|
147
|
+
class: L(T)({
|
|
148
148
|
valuePlaceholder: t.value
|
|
149
149
|
}),
|
|
150
150
|
displayValue: () => ""
|
|
@@ -155,9 +155,9 @@ const Ut = ({
|
|
|
155
155
|
ref: L(o).headerInputElement,
|
|
156
156
|
placeholder: L(o).props.placeholder
|
|
157
157
|
}, {
|
|
158
|
-
leading: de(({ iconSize:
|
|
158
|
+
leading: de(({ iconSize: C }) => [
|
|
159
159
|
we(Se, {
|
|
160
|
-
size:
|
|
160
|
+
size: C,
|
|
161
161
|
icon: "tabler:search",
|
|
162
162
|
flipOnDir: "rtl"
|
|
163
163
|
}, null, 8, ["size"])
|
|
@@ -169,31 +169,31 @@ const Ut = ({
|
|
|
169
169
|
}, 16, ["disabled", "placeholder", "modelValue", "class"]));
|
|
170
170
|
}
|
|
171
171
|
}), qt = /* @__PURE__ */ ne({
|
|
172
|
-
name:
|
|
172
|
+
name: _e("ComboboxTrigger"),
|
|
173
173
|
props: {},
|
|
174
174
|
setup(c, {
|
|
175
175
|
slots: o,
|
|
176
176
|
attrs: t
|
|
177
177
|
}) {
|
|
178
|
-
const e =
|
|
178
|
+
const e = Be(), u = ({
|
|
179
179
|
value: s
|
|
180
|
-
},
|
|
181
|
-
if (
|
|
182
|
-
const
|
|
183
|
-
e.setModelValue(
|
|
180
|
+
}, O) => {
|
|
181
|
+
if (O.stopPropagation(), s && U(e.modelValue.value) && !e.getDisabled.value) {
|
|
182
|
+
const P = e.modelValue.value.filter((h) => h !== s);
|
|
183
|
+
e.setModelValue(P);
|
|
184
184
|
}
|
|
185
|
-
}, i =
|
|
185
|
+
}, i = k(E, "trigger"), T = xe(i, {
|
|
186
186
|
variants: {
|
|
187
|
-
size:
|
|
188
|
-
headerSearch:
|
|
189
|
-
status:
|
|
190
|
-
bordered:
|
|
191
|
-
multiple:
|
|
192
|
-
contentFit:
|
|
193
|
-
wrapped:
|
|
194
|
-
filled:
|
|
187
|
+
size: q($e, i),
|
|
188
|
+
headerSearch: q("header-search", i),
|
|
189
|
+
status: q(jt, i),
|
|
190
|
+
bordered: q("bordered", i),
|
|
191
|
+
multiple: q("multiple", i),
|
|
192
|
+
contentFit: q("content-fit", i),
|
|
193
|
+
wrapped: q("wrapped", i),
|
|
194
|
+
filled: q("filled", i)
|
|
195
195
|
}
|
|
196
|
-
}),
|
|
196
|
+
}), z = f(() => {
|
|
197
197
|
switch (e.getSize.value) {
|
|
198
198
|
case "sm":
|
|
199
199
|
return "2xsm";
|
|
@@ -201,22 +201,28 @@ const Ut = ({
|
|
|
201
201
|
default:
|
|
202
202
|
return "xsm";
|
|
203
203
|
}
|
|
204
|
-
}),
|
|
204
|
+
}), x = f(() => {
|
|
205
205
|
if (!e.props.multiple && ge(e.modelValue.value) && !X(e.modelValue.value))
|
|
206
206
|
return e.getOptionByValue(e.modelValue.value);
|
|
207
|
-
}),
|
|
208
|
-
if (e.props.selectedItemIconAsTrailingIcon &&
|
|
207
|
+
}), C = (s = x.value) => {
|
|
208
|
+
if (e.props.selectedItemIconAsTrailingIcon && Ve(s) && "icon" in s)
|
|
209
209
|
return s.icon;
|
|
210
|
-
}, K = f(() =>
|
|
210
|
+
}, K = f(() => C()), A = f(() => {
|
|
211
211
|
if (!e.props.noTrailing)
|
|
212
212
|
return e.props.trailingIcon;
|
|
213
|
-
}), a = f(() =>
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
}), a = f(() => {
|
|
214
|
+
var P, h;
|
|
215
|
+
const s = oe(e.modelValue.value), O = U(e.modelValue.value);
|
|
216
|
+
return {
|
|
217
|
+
modelValue: s,
|
|
218
|
+
open: oe(e.open.value),
|
|
219
|
+
option: O ? void 0 : e.getOptionByValue(e.modelValue.value),
|
|
220
|
+
options: O ? (h = (P = e.modelValue.value).map) == null ? void 0 : h.call(P, e.getOptionByValue).filter(Boolean) : void 0
|
|
221
|
+
};
|
|
222
|
+
}), g = () => {
|
|
217
223
|
e.onOpenChange(!e.open.value);
|
|
218
224
|
}, r = (s) => {
|
|
219
|
-
|
|
225
|
+
e.props.headerSearch;
|
|
220
226
|
}, m = f(() => ({
|
|
221
227
|
disabled: e.getDisabled.value,
|
|
222
228
|
tabindex: e.getDisabled.value || !e.props.headerSearch ? -1 : 0,
|
|
@@ -228,7 +234,7 @@ const Ut = ({
|
|
|
228
234
|
"aria-expanded": e.open.value,
|
|
229
235
|
"aria-controls": e.contentId,
|
|
230
236
|
"data-state": e.open.value ? "open" : "closed",
|
|
231
|
-
class: [
|
|
237
|
+
class: [T({
|
|
232
238
|
size: e.getSize.value,
|
|
233
239
|
status: e.getStatus.value === "success" && X(e.modelValue.value) ? void 0 : e.getStatus.value,
|
|
234
240
|
bordered: e.props.bordered,
|
|
@@ -239,61 +245,61 @@ const Ut = ({
|
|
|
239
245
|
headerSearch: e.props.headerSearch
|
|
240
246
|
}), e.props.triggerCls],
|
|
241
247
|
...t
|
|
242
|
-
})), v = (s,
|
|
248
|
+
})), v = (s, O = z.value) => l(Se, {
|
|
243
249
|
icon: s,
|
|
244
|
-
size:
|
|
245
|
-
}),
|
|
246
|
-
var
|
|
250
|
+
size: O
|
|
251
|
+
}), b = () => {
|
|
252
|
+
var P;
|
|
247
253
|
let s;
|
|
248
|
-
const
|
|
249
|
-
if (R(
|
|
254
|
+
const O = (P = o.triggerTrailing) == null ? void 0 : P.call(o, a.value);
|
|
255
|
+
if (R(O) ? A.value && (s = v(A.value)) : s = O, s)
|
|
250
256
|
return l("div", {
|
|
251
|
-
class: [
|
|
257
|
+
class: [k(i, "trailing"), e.props.triggerTrailingCls]
|
|
252
258
|
}, s);
|
|
253
259
|
};
|
|
254
260
|
return () => {
|
|
255
|
-
var
|
|
256
|
-
const s = (
|
|
261
|
+
var h;
|
|
262
|
+
const s = (h = o.trigger) == null ? void 0 : h.call(o, a.value), P = (() => {
|
|
257
263
|
if (R(s)) return !1;
|
|
258
|
-
const M = bt(s) ?? null,
|
|
259
|
-
return
|
|
264
|
+
const M = bt(s) ?? null, $ = M.length === 1 ? M[0] : M;
|
|
265
|
+
return $ ? yt($) && !Ct($) : !0;
|
|
260
266
|
})();
|
|
261
267
|
return l(tt, {
|
|
262
268
|
...m.value,
|
|
263
269
|
...e.comboboxTriggerBinding.value,
|
|
264
|
-
asChild:
|
|
265
|
-
as:
|
|
266
|
-
key: String(
|
|
270
|
+
asChild: P,
|
|
271
|
+
as: P ? "template" : "button",
|
|
272
|
+
key: String(P),
|
|
267
273
|
onKeyUp: r,
|
|
268
274
|
onClick: g
|
|
269
275
|
}, () => {
|
|
270
276
|
if (!R(s))
|
|
271
277
|
return s;
|
|
272
|
-
const M = (
|
|
273
|
-
var Q,
|
|
274
|
-
const F = e.getOptionByValue(
|
|
275
|
-
return l(
|
|
276
|
-
...F ? ((
|
|
278
|
+
const M = (I) => {
|
|
279
|
+
var Q, H;
|
|
280
|
+
const F = e.getOptionByValue(I);
|
|
281
|
+
return l(Re, {
|
|
282
|
+
...F ? ((H = (Q = e.props).getTagProps) == null ? void 0 : H.call(Q, F)) ?? {} : {},
|
|
277
283
|
size: e.getTagSize.value
|
|
278
284
|
});
|
|
279
|
-
},
|
|
280
|
-
var Q,
|
|
281
|
-
const F = e.getOptionByValue(
|
|
282
|
-
return l(
|
|
283
|
-
...F ? ((
|
|
285
|
+
}, $ = (I) => {
|
|
286
|
+
var Q, H;
|
|
287
|
+
const F = e.getOptionByValue(I);
|
|
288
|
+
return l(Ae, {
|
|
289
|
+
...F ? ((H = (Q = e.props).getTagProps) == null ? void 0 : H.call(Q, F)) ?? {} : {},
|
|
284
290
|
size: e.getTagSize.value
|
|
285
291
|
});
|
|
286
292
|
}, me = () => {
|
|
287
|
-
if (!e.props.multiple && !
|
|
288
|
-
let
|
|
289
|
-
if (e.props.tagRenderMode === "avatar" ?
|
|
293
|
+
if (!e.props.multiple && !U(e.modelValue.value) && e.modelValue.value && (e.props.tagRenderMode && ["avatar", "go"].includes(e.props.tagRenderMode) || K.value || e.props.leadingIcon)) {
|
|
294
|
+
let I;
|
|
295
|
+
if (e.props.tagRenderMode === "avatar" ? I = M(e.modelValue.value) : e.props.tagRenderMode === "go" ? I = $(e.modelValue.value) : K.value ? I = v(K.value) : e.props.leadingIcon && (I = v(e.props.leadingIcon)), !R(I))
|
|
290
296
|
return l("div", {
|
|
291
|
-
class: [
|
|
292
|
-
},
|
|
297
|
+
class: [k(i, "leading"), e.props.triggerLeadingCls]
|
|
298
|
+
}, I);
|
|
293
299
|
}
|
|
294
300
|
}, fe = () => {
|
|
295
|
-
const
|
|
296
|
-
if (e.props.multiple &&
|
|
301
|
+
const I = [], F = [k(i, "tags"), e.props.triggerContentCls, X(e.modelValue.value) ? e.props.triggerContentPlaceholderCls : e.props.triggerContentValueCls], H = (() => {
|
|
302
|
+
if (e.props.multiple && U(e.modelValue.value)) {
|
|
297
303
|
if (e.props.tagRenderMode === "avatar")
|
|
298
304
|
return l(zt, {
|
|
299
305
|
maxCount: e.props.maxCount,
|
|
@@ -311,7 +317,7 @@ const Ut = ({
|
|
|
311
317
|
noPopover: !0,
|
|
312
318
|
noWrap: !e.props.wrapped,
|
|
313
319
|
class: F
|
|
314
|
-
}, () => e.modelValue.value.map(
|
|
320
|
+
}, () => e.modelValue.value.map($));
|
|
315
321
|
if (e.props.tagRenderMode === "chip")
|
|
316
322
|
return l(Tt, {
|
|
317
323
|
maxCount: e.props.maxCount,
|
|
@@ -327,14 +333,14 @@ const Ut = ({
|
|
|
327
333
|
const ae = () => e.getLabelByValue(Y), Z = ({
|
|
328
334
|
size: ve
|
|
329
335
|
}) => {
|
|
330
|
-
const te =
|
|
336
|
+
const te = C(e.getOptionByValue(Y)) ?? e.props.leadingIcon;
|
|
331
337
|
return te ? v(te, ve) : null;
|
|
332
338
|
}, ee = e.getOptionByValue(Y);
|
|
333
339
|
return l(kt, {
|
|
334
340
|
...ee ? ((le = (ue = e.props).getTagProps) == null ? void 0 : le.call(ue, ee)) ?? {} : {},
|
|
335
341
|
value: Y,
|
|
336
|
-
class: [
|
|
337
|
-
closeIconCls:
|
|
342
|
+
class: [k(i, "tag"), e.props.tagCls],
|
|
343
|
+
closeIconCls: k(i, "tag__close")
|
|
338
344
|
}, {
|
|
339
345
|
text: ae,
|
|
340
346
|
leading: Z
|
|
@@ -342,13 +348,13 @@ const Ut = ({
|
|
|
342
348
|
}));
|
|
343
349
|
}
|
|
344
350
|
})();
|
|
345
|
-
return
|
|
346
|
-
class:
|
|
347
|
-
},
|
|
348
|
-
},
|
|
349
|
-
R(re) ||
|
|
350
|
-
const pe =
|
|
351
|
-
return R(pe) ||
|
|
351
|
+
return H && I.push(H), e.props.headerSearch || I.push(l(Fe)), l("div", {
|
|
352
|
+
class: k(i, "content")
|
|
353
|
+
}, I);
|
|
354
|
+
}, j = [], re = me();
|
|
355
|
+
R(re) || j.push(re), j.push(fe());
|
|
356
|
+
const pe = b();
|
|
357
|
+
return R(pe) || j.push(pe), j;
|
|
352
358
|
});
|
|
353
359
|
};
|
|
354
360
|
}
|
|
@@ -356,13 +362,13 @@ const Ut = ({
|
|
|
356
362
|
__name: "ComboboxLabel",
|
|
357
363
|
setup(c) {
|
|
358
364
|
return (o, t) => (ie(), Le("div", {
|
|
359
|
-
class:
|
|
365
|
+
class: He(L(k)(L(E), "label"))
|
|
360
366
|
}, [
|
|
361
367
|
Ee(o.$slots, "default")
|
|
362
368
|
], 2));
|
|
363
369
|
}
|
|
364
370
|
}), De = /* @__PURE__ */ ne({
|
|
365
|
-
name:
|
|
371
|
+
name: _e("SelectOption"),
|
|
366
372
|
props: {
|
|
367
373
|
option: {
|
|
368
374
|
type: [Object, String],
|
|
@@ -373,7 +379,7 @@ const Ut = ({
|
|
|
373
379
|
setup(c, {
|
|
374
380
|
slots: o
|
|
375
381
|
}) {
|
|
376
|
-
const t =
|
|
382
|
+
const t = Be(), e = f(() => {
|
|
377
383
|
switch (t.getSize.value) {
|
|
378
384
|
case "sm":
|
|
379
385
|
return "2xsm";
|
|
@@ -383,13 +389,13 @@ const Ut = ({
|
|
|
383
389
|
default:
|
|
384
390
|
return "xsm";
|
|
385
391
|
}
|
|
386
|
-
}), u = f(() => t.getOptionValue(c.option)), i = f(() => t.getOptionNoCheckbox(c.option)),
|
|
392
|
+
}), u = f(() => t.getOptionValue(c.option)), i = f(() => t.getOptionNoCheckbox(c.option)), T = f(() => t.getOptionSingle(c.option)), z = f(() => t.getOptionLabel(c.option)), x = f(() => t.getOptionIcon(c.option)), C = f(() => t.props.tree ? void 0 : t.getOptionDescription(c.option)), K = f(() => t.getOptionDisabled(c.option)), A = f(() => t.isItemSelected(u.value)), a = k(E, "option"), g = () => {
|
|
387
393
|
if (!(t.props.tree || !u.value || K.value))
|
|
388
394
|
if (t.props.multiple)
|
|
389
|
-
if (
|
|
395
|
+
if (T.value)
|
|
390
396
|
t.setModelValue([u.value]), t.emit("select", u.value, !0);
|
|
391
397
|
else {
|
|
392
|
-
let r =
|
|
398
|
+
let r = U(t.modelValue.value) ? t.modelValue.value : [];
|
|
393
399
|
const m = r.includes(u.value);
|
|
394
400
|
r.length === 1 && t.getSingleByValue(r[0]) && u.value !== r[0] && (r = []), m ? (t.setModelValue(r.filter((v) => v !== u.value)), t.emit("select", u.value, !0)) : (t.setModelValue([...r, u.value]), t.emit("select", u.value, !1));
|
|
395
401
|
}
|
|
@@ -399,35 +405,35 @@ const Ut = ({
|
|
|
399
405
|
if (!c.option) throw new Error("option is required");
|
|
400
406
|
return () => {
|
|
401
407
|
const r = (v) => {
|
|
402
|
-
var
|
|
403
|
-
const
|
|
404
|
-
!t.props.tree && t.props.multiple && t.props.checkbox && !i.value &&
|
|
405
|
-
modelValue:
|
|
408
|
+
var O, P, h, M, $;
|
|
409
|
+
const b = [];
|
|
410
|
+
!t.props.tree && t.props.multiple && t.props.checkbox && !i.value && b.push(l(Nt, {
|
|
411
|
+
modelValue: A.value,
|
|
406
412
|
size: v.checkboxSize,
|
|
407
413
|
disabled: K.value
|
|
408
414
|
}));
|
|
409
|
-
const s = (
|
|
415
|
+
const s = (O = o.leading) == null ? void 0 : O.call(o, {
|
|
410
416
|
option: c.option
|
|
411
417
|
});
|
|
412
|
-
return R(s) ? t.props.tagRenderMode === "avatar" ?
|
|
413
|
-
...((
|
|
418
|
+
return R(s) ? t.props.tagRenderMode === "avatar" ? b.push(l(Re, {
|
|
419
|
+
...((h = (P = t.props).getTagProps) == null ? void 0 : h.call(P, c.option)) ?? {},
|
|
414
420
|
size: t.getTagSize.value
|
|
415
|
-
})) : t.props.tagRenderMode === "go" ?
|
|
416
|
-
...((
|
|
421
|
+
})) : t.props.tagRenderMode === "go" ? b.push(l(Ae, {
|
|
422
|
+
...(($ = (M = t.props).getTagProps) == null ? void 0 : $.call(M, c.option)) ?? {},
|
|
417
423
|
size: t.getTagSize.value
|
|
418
|
-
})) :
|
|
419
|
-
icon:
|
|
424
|
+
})) : x.value && b.push(l(Se, {
|
|
425
|
+
icon: x.value,
|
|
420
426
|
size: e.value
|
|
421
|
-
})) :
|
|
427
|
+
})) : b.push(s), R(b) ? null : b;
|
|
422
428
|
};
|
|
423
429
|
return (() => {
|
|
424
|
-
const v = !!
|
|
430
|
+
const v = !!C.value;
|
|
425
431
|
return l(Kt, {
|
|
426
432
|
class: a,
|
|
427
|
-
description:
|
|
428
|
-
title:
|
|
433
|
+
description: C.value,
|
|
434
|
+
title: z.value,
|
|
429
435
|
key: u.value,
|
|
430
|
-
selected:
|
|
436
|
+
selected: A.value,
|
|
431
437
|
unFocusable: !0,
|
|
432
438
|
leadingCenter: !v,
|
|
433
439
|
size: t.getSize.value,
|
|
@@ -436,8 +442,8 @@ const Ut = ({
|
|
|
436
442
|
}, {
|
|
437
443
|
leading: r,
|
|
438
444
|
trailing: () => {
|
|
439
|
-
var
|
|
440
|
-
return (
|
|
445
|
+
var b;
|
|
446
|
+
return (b = o.trailing) == null ? void 0 : b.call(o, {
|
|
441
447
|
option: c.option
|
|
442
448
|
});
|
|
443
449
|
}
|
|
@@ -446,23 +452,23 @@ const Ut = ({
|
|
|
446
452
|
};
|
|
447
453
|
}
|
|
448
454
|
}), Jt = /* @__PURE__ */ ne({
|
|
449
|
-
name:
|
|
455
|
+
name: _e("ComboboxWrapper"),
|
|
450
456
|
setup(c, {
|
|
451
457
|
slots: o
|
|
452
458
|
}) {
|
|
453
|
-
const t =
|
|
459
|
+
const t = At(), e = ot(), u = be();
|
|
454
460
|
St({
|
|
455
461
|
target: u
|
|
456
462
|
});
|
|
457
|
-
const i = be(),
|
|
463
|
+
const i = be(), T = Bt({
|
|
458
464
|
triggerRef: i,
|
|
459
465
|
props: t.props
|
|
460
466
|
}), {
|
|
461
|
-
getFlipOnDir:
|
|
462
|
-
getDir:
|
|
463
|
-
} = gt(),
|
|
467
|
+
getFlipOnDir: z,
|
|
468
|
+
getDir: x
|
|
469
|
+
} = gt(), C = z("reversePlacementOnDir"), K = x(), A = Ot({
|
|
464
470
|
props: t.props,
|
|
465
|
-
flip:
|
|
471
|
+
flip: C,
|
|
466
472
|
emitsAsProps: t.emitsAsProps,
|
|
467
473
|
_dir: K,
|
|
468
474
|
controlAutoFocus: !1,
|
|
@@ -470,20 +476,20 @@ const Ut = ({
|
|
|
470
476
|
}), a = ({
|
|
471
477
|
key: n,
|
|
472
478
|
getterKey: p,
|
|
473
|
-
defaultValue:
|
|
479
|
+
defaultValue: y,
|
|
474
480
|
noReturnOption: S
|
|
475
|
-
}) => (
|
|
476
|
-
const N = ke(
|
|
477
|
-
if (
|
|
478
|
-
const W =
|
|
481
|
+
}) => (V) => {
|
|
482
|
+
const N = ke(y) ? y(V) : y;
|
|
483
|
+
if (Ve(V)) {
|
|
484
|
+
const W = V[n] ?? N, G = p && t.props[p];
|
|
479
485
|
if (G) {
|
|
480
486
|
if (ge(G))
|
|
481
|
-
return
|
|
482
|
-
if (ke(G)) return G(
|
|
487
|
+
return V[G] ?? W;
|
|
488
|
+
if (ke(G)) return G(V) ?? W;
|
|
483
489
|
}
|
|
484
490
|
return W;
|
|
485
491
|
}
|
|
486
|
-
return ge(
|
|
492
|
+
return ge(V) && !S ? V ?? N : N;
|
|
487
493
|
}, g = a({
|
|
488
494
|
getterKey: "getValue",
|
|
489
495
|
key: "value"
|
|
@@ -498,7 +504,7 @@ const Ut = ({
|
|
|
498
504
|
getterKey: "getLabel",
|
|
499
505
|
key: "label",
|
|
500
506
|
defaultValue: g
|
|
501
|
-
}),
|
|
507
|
+
}), b = a({
|
|
502
508
|
getterKey: "getIcon",
|
|
503
509
|
key: "icon",
|
|
504
510
|
noReturnOption: !0
|
|
@@ -506,32 +512,32 @@ const Ut = ({
|
|
|
506
512
|
getterKey: "getDescription",
|
|
507
513
|
key: "description",
|
|
508
514
|
noReturnOption: !0
|
|
509
|
-
}),
|
|
515
|
+
}), O = a({
|
|
510
516
|
getterKey: "getDisabled",
|
|
511
517
|
key: "disabled",
|
|
512
518
|
defaultValue: !1,
|
|
513
519
|
noReturnOption: !0
|
|
514
|
-
}),
|
|
520
|
+
}), P = a({
|
|
515
521
|
getterKey: "getGroupLabel",
|
|
516
522
|
key: "label",
|
|
517
523
|
noReturnOption: !0
|
|
518
|
-
}),
|
|
524
|
+
}), h = a({
|
|
519
525
|
getterKey: "getGroupOptions",
|
|
520
526
|
key: "options",
|
|
521
527
|
noReturnOption: !0
|
|
522
528
|
}), M = (n) => {
|
|
523
529
|
var p;
|
|
524
|
-
if ((p = t.props.options) != null && p.length)
|
|
525
|
-
for (const
|
|
526
|
-
if (g(
|
|
527
|
-
const S = y
|
|
530
|
+
if ((p = t.props.options) != null && p.length && n)
|
|
531
|
+
for (const y of t.props.options) {
|
|
532
|
+
if (g(y) === n) return y;
|
|
533
|
+
const S = h(y);
|
|
528
534
|
if (S != null && S.length) {
|
|
529
|
-
for (const
|
|
530
|
-
if (g(
|
|
535
|
+
for (const V of S)
|
|
536
|
+
if (g(V) === n) return V;
|
|
531
537
|
}
|
|
532
538
|
}
|
|
533
539
|
return n;
|
|
534
|
-
},
|
|
540
|
+
}, $ = (n) => {
|
|
535
541
|
const p = M(n);
|
|
536
542
|
return p ? v(p) ?? n : n;
|
|
537
543
|
}, me = (n) => {
|
|
@@ -541,26 +547,26 @@ const Ut = ({
|
|
|
541
547
|
contains: fe
|
|
542
548
|
} = nt({
|
|
543
549
|
sensitivity: "base"
|
|
544
|
-
}),
|
|
545
|
-
const n = (p) => p == null ? void 0 : p.map((
|
|
546
|
-
const S = v(
|
|
547
|
-
if (d &&
|
|
550
|
+
}), j = f(() => {
|
|
551
|
+
const n = (p) => p == null ? void 0 : p.map((y) => {
|
|
552
|
+
const S = v(y), V = g(y), N = O(y), W = P(y), G = !t.searchModel.value || S && fe(S, t.searchModel.value), d = h(y), B = !t.props.tree || V;
|
|
553
|
+
if (d && B) {
|
|
548
554
|
const _ = n(d);
|
|
549
555
|
if (_ != null && _.length || G)
|
|
550
556
|
return {
|
|
551
557
|
groupLabel: W,
|
|
552
558
|
title: S,
|
|
553
|
-
key:
|
|
559
|
+
key: V,
|
|
554
560
|
disabled: N,
|
|
555
561
|
children: _,
|
|
556
|
-
_option:
|
|
562
|
+
_option: y
|
|
557
563
|
};
|
|
558
564
|
}
|
|
559
|
-
return G &&
|
|
565
|
+
return G && B ? {
|
|
560
566
|
title: S,
|
|
561
|
-
key:
|
|
567
|
+
key: V,
|
|
562
568
|
disabled: N,
|
|
563
|
-
_option:
|
|
569
|
+
_option: y
|
|
564
570
|
} : null;
|
|
565
571
|
}).filter(Boolean);
|
|
566
572
|
if (t.props.options)
|
|
@@ -568,13 +574,13 @@ const Ut = ({
|
|
|
568
574
|
}), {
|
|
569
575
|
getDisabled: re,
|
|
570
576
|
getStatus: pe,
|
|
571
|
-
getSize:
|
|
572
|
-
} =
|
|
577
|
+
getSize: I
|
|
578
|
+
} = _t({
|
|
573
579
|
getDisabled: () => t.props.disabled,
|
|
574
580
|
getSize: () => t.props.size,
|
|
575
581
|
getStatus: () => t.props.status
|
|
576
582
|
}), F = f(() => {
|
|
577
|
-
switch (
|
|
583
|
+
switch (I.value) {
|
|
578
584
|
case "sm":
|
|
579
585
|
return "xsm";
|
|
580
586
|
case "lg":
|
|
@@ -585,12 +591,12 @@ const Ut = ({
|
|
|
585
591
|
}
|
|
586
592
|
}), {
|
|
587
593
|
inputBindings: Q,
|
|
588
|
-
rootBindings:
|
|
594
|
+
rootBindings: H
|
|
589
595
|
} = xt({
|
|
590
596
|
getDisabled: () => re.value
|
|
591
597
|
}), Y = be(), ae = () => {
|
|
592
|
-
var n, p,
|
|
593
|
-
e.open.value && e.inputElement.value && (t.props.headerSearch && ((n = Y.value) != null && n.input) ? document.activeElement !== ((p = Y.value) == null ? void 0 : p.input) && ((
|
|
598
|
+
var n, p, y, S, V, N, W;
|
|
599
|
+
e.open.value && e.inputElement.value && (t.props.headerSearch && ((n = Y.value) != null && n.input) ? document.activeElement !== ((p = Y.value) == null ? void 0 : p.input) && ((V = (S = (y = Y.value) == null ? void 0 : y.input) == null ? void 0 : S.focus) == null || V.call(S)) : document.activeElement !== e.inputElement.value && ((W = (N = e.inputElement.value) == null ? void 0 : N.focus) == null || W.call(N)));
|
|
594
600
|
}, Z = (n) => {
|
|
595
601
|
e.modelValue.value = n, t.emit("update:modelValue", n);
|
|
596
602
|
}, ee = (n) => n === void 0 ? !1 : Array.isArray(e.modelValue.value) ? !!(n && e.modelValue.value.includes(n)) : e.modelValue.value === n;
|
|
@@ -601,51 +607,51 @@ const Ut = ({
|
|
|
601
607
|
getOptionSingle: m,
|
|
602
608
|
getOptionNoCheckbox: r,
|
|
603
609
|
getOptionDescription: s,
|
|
604
|
-
getOptionDisabled:
|
|
605
|
-
getOptionIcon:
|
|
610
|
+
getOptionDisabled: O,
|
|
611
|
+
getOptionIcon: b,
|
|
606
612
|
getOptionByValue: M,
|
|
607
613
|
isItemSelected: ee,
|
|
608
|
-
getLabelByValue:
|
|
614
|
+
getLabelByValue: $,
|
|
609
615
|
getSingleByValue: me,
|
|
610
616
|
focusOnInput: ae,
|
|
611
617
|
setModelValue: Z,
|
|
612
618
|
headerInputElement: Y,
|
|
613
619
|
getDisabled: re,
|
|
614
620
|
getStatus: pe,
|
|
615
|
-
getSize:
|
|
621
|
+
getSize: I,
|
|
616
622
|
getTagSize: F,
|
|
617
623
|
comboboxInputBinding: Q,
|
|
618
|
-
comboboxTriggerBinding:
|
|
624
|
+
comboboxTriggerBinding: H,
|
|
619
625
|
...e,
|
|
620
626
|
modelValue: e.modelValue
|
|
621
|
-
}),
|
|
627
|
+
}), Ke(() => [t.props.clearOnChangeMultiple, t.props.multiple], () => {
|
|
622
628
|
t.props.clearOnChangeMultiple && Z(void 0);
|
|
623
629
|
});
|
|
624
630
|
const ue = f(() => {
|
|
625
631
|
const n = t.props.scrollContainerProps ?? {};
|
|
626
632
|
return {
|
|
627
633
|
...n,
|
|
628
|
-
areaCls: [
|
|
634
|
+
areaCls: [k(E, "scroll_area"), n == null ? void 0 : n.class, n == null ? void 0 : n.areaCls]
|
|
629
635
|
};
|
|
630
|
-
}), le =
|
|
636
|
+
}), le = k(E, "popup"), ve = xe(le, {
|
|
631
637
|
variants: {
|
|
632
|
-
size:
|
|
638
|
+
size: q($e, le)
|
|
633
639
|
}
|
|
634
640
|
}), te = (n) => {
|
|
635
641
|
if (Number(n) > 0)
|
|
636
642
|
return `${n}px`;
|
|
637
643
|
if (typeof n == "string")
|
|
638
644
|
return n;
|
|
639
|
-
},
|
|
640
|
-
type:
|
|
645
|
+
}, We = f(() => te(t.props.popupWidth)), Ge = f(() => te(t.props.popupHeight)), Oe = f(() => te(t.props.minWidth)), Pe = f(() => ({
|
|
646
|
+
type: I.value === "sm" ? "simple" : "advance",
|
|
641
647
|
...Te(t.props.emptyProps ?? {}, "class")
|
|
642
|
-
})),
|
|
643
|
-
selectValues:
|
|
648
|
+
})), Ue = f(() => Te(t.props.skeletonProps ?? {}, "class")), {
|
|
649
|
+
selectValues: je
|
|
644
650
|
} = Ut({
|
|
645
651
|
getValue: (n) => n == null ? void 0 : n.key,
|
|
646
652
|
getChildren: (n) => n == null ? void 0 : n.children,
|
|
647
653
|
getModel: () => oe(e.modelValue.value),
|
|
648
|
-
getData: () => oe(
|
|
654
|
+
getData: () => oe(j.value ?? [])
|
|
649
655
|
});
|
|
650
656
|
return () => {
|
|
651
657
|
var W, G;
|
|
@@ -655,80 +661,80 @@ const Ut = ({
|
|
|
655
661
|
trailing: o.optionTrailing,
|
|
656
662
|
leading: o.optionLeading
|
|
657
663
|
}), p = [];
|
|
658
|
-
let
|
|
664
|
+
let y;
|
|
659
665
|
if (t.props.tree) {
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
data:
|
|
666
|
+
const B = U(e.modelValue.value) ? e.modelValue.value : e.modelValue.value ? [e.modelValue.value] : [];
|
|
667
|
+
y = l(It, {
|
|
668
|
+
data: j.value ?? [],
|
|
663
669
|
selectable: !0,
|
|
664
670
|
checkbox: t.props.multiple && t.props.checkbox,
|
|
665
671
|
multiple: t.props.multiple,
|
|
666
672
|
defaultExpandAll: !0,
|
|
667
673
|
syncCheckboxAndSelect: t.props.multiple,
|
|
668
674
|
showLine: !0,
|
|
669
|
-
modelValue:
|
|
670
|
-
checkedKeys:
|
|
675
|
+
modelValue: B,
|
|
676
|
+
checkedKeys: B,
|
|
671
677
|
onExpand: ae,
|
|
672
|
-
onSelect: (_, w,
|
|
678
|
+
onSelect: (_, w, D) => {
|
|
673
679
|
if (t.props.multiple) {
|
|
674
|
-
const J =
|
|
675
|
-
Z(
|
|
680
|
+
const J = U(D) ? D : [D];
|
|
681
|
+
Z(je(J, w));
|
|
676
682
|
} else
|
|
677
|
-
Z(
|
|
683
|
+
Z(D);
|
|
678
684
|
},
|
|
679
685
|
class: "w-full"
|
|
680
686
|
}, {
|
|
681
687
|
title: (_) => n(_._option)
|
|
682
|
-
}), p.push(
|
|
688
|
+
}), p.push(y);
|
|
683
689
|
} else {
|
|
684
690
|
let d = !1;
|
|
685
|
-
const
|
|
686
|
-
if ((
|
|
691
|
+
const B = [];
|
|
692
|
+
if ((j.value ?? []).forEach((_) => {
|
|
687
693
|
var w;
|
|
688
694
|
if ((w = _.children) != null && w.length) {
|
|
689
|
-
const
|
|
695
|
+
const D = [];
|
|
690
696
|
_.children.forEach((J) => {
|
|
691
697
|
const se = n(J._option);
|
|
692
|
-
ee(g(J._option)) && t.props.sortSelectedItems ?
|
|
693
|
-
}),
|
|
698
|
+
ee(g(J._option)) && t.props.sortSelectedItems ? B.push(se) : D.push(se);
|
|
699
|
+
}), D.length && ((d || p.length) && (p.push(l(ye)), d = !1), _.groupLabel && p.push(l(Yt, {
|
|
694
700
|
class: t.props.labelCls
|
|
695
|
-
}, () => _.groupLabel)), p.push(...
|
|
701
|
+
}, () => _.groupLabel)), p.push(...D), d = !0);
|
|
696
702
|
} else {
|
|
697
|
-
const
|
|
698
|
-
ee(g(_._option)) && t.props.sortSelectedItems ?
|
|
703
|
+
const D = n(_._option);
|
|
704
|
+
ee(g(_._option)) && t.props.sortSelectedItems ? B.push(D) : (d && (p.push(l(ye)), d = !1), p.push(D));
|
|
699
705
|
}
|
|
700
|
-
}), t.props.sortSelectedItems &&
|
|
706
|
+
}), t.props.sortSelectedItems && B.length) {
|
|
701
707
|
const _ = !!p.length;
|
|
702
|
-
p.splice(0, 0, ...
|
|
708
|
+
p.splice(0, 0, ...B), _ && p.splice(B.length, 0, l(ye));
|
|
703
709
|
}
|
|
704
710
|
}
|
|
705
|
-
const S =
|
|
706
|
-
var
|
|
707
|
-
return
|
|
708
|
-
}),
|
|
709
|
-
var
|
|
711
|
+
const S = Vt(y ? [y] : p, De).filter((d) => {
|
|
712
|
+
var B;
|
|
713
|
+
return Ve(d == null ? void 0 : d.props) && ((B = d == null ? void 0 : d.props) == null ? void 0 : B.option);
|
|
714
|
+
}), V = !!(t.props.tree && ((W = j.value) != null && W.length) || S != null && S.length), N = () => {
|
|
715
|
+
var B, _;
|
|
710
716
|
const d = [];
|
|
711
|
-
if (
|
|
717
|
+
if (V || t.props.loading) {
|
|
712
718
|
const w = [];
|
|
713
|
-
if (
|
|
714
|
-
const
|
|
715
|
-
if (!R(
|
|
719
|
+
if (V && w.push(...p), t.props.loading) {
|
|
720
|
+
const D = (B = o.loading) == null ? void 0 : B.call(o, {});
|
|
721
|
+
if (!R(D)) w.push(D);
|
|
716
722
|
else {
|
|
717
|
-
const J = new Array(
|
|
723
|
+
const J = new Array(V ? 2 : t.props.loadingRowCount).fill(1);
|
|
718
724
|
w.push(...J.map(() => l(ht, {
|
|
719
|
-
size:
|
|
720
|
-
class: [
|
|
721
|
-
...
|
|
725
|
+
size: I.value,
|
|
726
|
+
class: [k(E, "skeleton"), t.props.skeletonCls],
|
|
727
|
+
...Ue.value
|
|
722
728
|
})));
|
|
723
729
|
}
|
|
724
730
|
}
|
|
725
731
|
d.push(l("div", {
|
|
726
|
-
class: [
|
|
732
|
+
class: [k(E, "options"), t.props.optionsCls]
|
|
727
733
|
}, w));
|
|
728
|
-
} else if (!
|
|
734
|
+
} else if (!V) {
|
|
729
735
|
const w = (_ = o.empty) == null ? void 0 : _.call(o, Pe.value);
|
|
730
736
|
R(w) ? d.push(l(vt, {
|
|
731
|
-
class: [
|
|
737
|
+
class: [k(E, "empty"), t.props.emptyCls],
|
|
732
738
|
...Pe.value
|
|
733
739
|
}, {
|
|
734
740
|
title: o.emptyTitle,
|
|
@@ -738,9 +744,9 @@ const Ut = ({
|
|
|
738
744
|
})) : d.push(w);
|
|
739
745
|
}
|
|
740
746
|
return t.props.lazyLoading && d.push(l("div", {
|
|
741
|
-
class:
|
|
747
|
+
class: k(E, "lazy_loading")
|
|
742
748
|
}, l("div", {
|
|
743
|
-
class:
|
|
749
|
+
class: k(E, "lazy_loading_trigger"),
|
|
744
750
|
ref: u
|
|
745
751
|
}))), d;
|
|
746
752
|
};
|
|
@@ -749,37 +755,37 @@ const Ut = ({
|
|
|
749
755
|
...t.attrs,
|
|
750
756
|
style: {
|
|
751
757
|
...((G = t.attrs) == null ? void 0 : G.style) ?? {},
|
|
752
|
-
"--ptc-combobox-trigger-min-w":
|
|
758
|
+
"--ptc-combobox-trigger-min-w": Oe.value
|
|
753
759
|
}
|
|
754
760
|
}, {
|
|
755
761
|
trigger: o.trigger,
|
|
756
762
|
triggerTrailing: o.triggerTrailing
|
|
757
|
-
}), l(rt,
|
|
758
|
-
|
|
763
|
+
}), l(rt, T.value, () => l(at, {
|
|
764
|
+
...A.value,
|
|
759
765
|
vShow: e.open.value,
|
|
760
766
|
class: [ve(t.props), t.props.popupCls],
|
|
761
767
|
style: {
|
|
762
|
-
"--ptc-combobox-popup-width": t.props.samePopupWidth ? void 0 :
|
|
763
|
-
"--ptc-combobox-popup-height":
|
|
764
|
-
"--ptc-combobox-trigger-min-w":
|
|
768
|
+
"--ptc-combobox-popup-width": t.props.samePopupWidth ? void 0 : We.value,
|
|
769
|
+
"--ptc-combobox-popup-height": Ge.value,
|
|
770
|
+
"--ptc-combobox-trigger-min-w": Oe.value
|
|
765
771
|
},
|
|
766
772
|
onClick: ae
|
|
767
773
|
}, () => {
|
|
768
|
-
var
|
|
769
|
-
const d = [],
|
|
774
|
+
var D, J, se;
|
|
775
|
+
const d = [], B = (D = o.header) == null ? void 0 : D.call(o, {}), _ = !R(B);
|
|
770
776
|
if (t.props.headerSearch || _) {
|
|
771
777
|
const he = [];
|
|
772
|
-
_ && he.push(
|
|
773
|
-
class:
|
|
778
|
+
_ && he.push(B), t.props.headerSearch && he.push(l(Fe)), d.push(l("div", {
|
|
779
|
+
class: k(E, "header")
|
|
774
780
|
}, he));
|
|
775
781
|
}
|
|
776
782
|
d.push(l(Pt, ue.value, N));
|
|
777
783
|
const w = (se = o.footer) == null ? void 0 : se.call(o, {
|
|
778
|
-
isEmpty: !((J =
|
|
784
|
+
isEmpty: !((J = j.value) != null && J.length),
|
|
779
785
|
search: t.searchModel.value
|
|
780
786
|
});
|
|
781
787
|
return R(w) || d.push(l("div", {
|
|
782
|
-
class:
|
|
788
|
+
class: k(E, "footer")
|
|
783
789
|
}, w)), d;
|
|
784
790
|
}))];
|
|
785
791
|
};
|
|
@@ -908,22 +914,29 @@ const Ut = ({
|
|
|
908
914
|
},
|
|
909
915
|
ut
|
|
910
916
|
)
|
|
911
|
-
),
|
|
917
|
+
), T = wt(t, "search", e, {
|
|
912
918
|
passive: t.search === void 0
|
|
913
|
-
})
|
|
914
|
-
|
|
915
|
-
|
|
919
|
+
});
|
|
920
|
+
Ke(
|
|
921
|
+
() => t.open,
|
|
922
|
+
(C) => {
|
|
923
|
+
C || (T.value = void 0);
|
|
924
|
+
}
|
|
925
|
+
);
|
|
926
|
+
const z = qe(), x = Ye();
|
|
927
|
+
return $t({
|
|
928
|
+
attrs: x,
|
|
916
929
|
props: t,
|
|
917
930
|
emit: e,
|
|
918
|
-
searchModel:
|
|
931
|
+
searchModel: T,
|
|
919
932
|
emitsAsProps: u
|
|
920
|
-
}), (
|
|
933
|
+
}), (C, K) => (ie(), Ce(L(st), Me(i.value, { class: L(E) }), {
|
|
921
934
|
default: de(() => [
|
|
922
935
|
we(L(Jt), null, Je({ _: 2 }, [
|
|
923
|
-
Qe(Object.keys(
|
|
924
|
-
name:
|
|
936
|
+
Qe(Object.keys(z), (A) => ({
|
|
937
|
+
name: A,
|
|
925
938
|
fn: de((a) => [
|
|
926
|
-
Ee(
|
|
939
|
+
Ee(C.$slots, A, Xe(Ze(a)))
|
|
927
940
|
])
|
|
928
941
|
}))
|
|
929
942
|
]), 1024)
|
|
@@ -936,6 +949,6 @@ export {
|
|
|
936
949
|
$e as C,
|
|
937
950
|
To as _,
|
|
938
951
|
jt as a,
|
|
939
|
-
|
|
952
|
+
Be as i,
|
|
940
953
|
Rt as p
|
|
941
954
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("vue"),$=require("reka-ui"),G=require("./FormItem.vue_vue_type_style_index_0_lang-Bo3o8_6v.js"),ue=require("./options-CWrQ7gsa.js"),c=require("@pantograph/utils"),B=require("./index-DWw7aruo.js"),he=require("class-variance-authority"),ie=require("./omit-CYbreqlf.js"),qe=require("./Empty.vue_vue_type_style_index_0_lang-DidQV2p4.js"),we=require("./Skeleton.vue_vue_type_style_index_0_lang-CWNX_-Jl.js"),fe=require("./Divider.vue_vue_type_style_index_0_lang-DoEWjJx6.js"),D=require("./element-BjE0SVc4.js"),xe=require("./useInputDataStates-D1X-Whwt.js"),Me=require("./useLazyLoading-H6VG5aE-.js"),Ve=require("./Popover.vue_vue_type_style_index_0_lang-txLoIoSw.js"),Ae=require("./ScrollContainer.vue_vue_type_style_index_0_lang-BIoD2_5T.js"),Ne=require("./Tree.vue_vue_type_style_index_0_lang-26mqYWer.js"),Be=require("./uniq-DGkyiyS4.js"),Q=require("./isEmpty-bCllo8T9.js"),Ke=require("./Chip.vue_vue_type_style_index_0_lang-CtgInoR3.js"),Re=require("./ChipGroup.vue_vue_type_style_index_0_lang-BVwWqy-3.js"),_e=require("./Icon.vue_vue_type_style_index_0_lang-D3cRtJNJ.js"),ve=require("./Avatar.vue_vue_type_style_index_0_lang-CLZz5CmG.js"),Fe=require("./GraphicalObjectGroup.vue_vue_type_style_index_0_lang-CDFDVi-0.js"),Ee=require("./GraphicalObject.vue_vue_type_script_setup_true_lang-BZ5qLbnJ.js"),We=require("./Input.vue_vue_type_style_index_0_lang-CWW5TIRh.js"),Oe=require("@vueuse/core"),Ge=require("lodash-es"),je=require("./MenuItem.vue_vue_type_style_index_0_lang-CYOdJYFY.js");require("@iconify/vue");const Ue=require("./Checkbox.vue_vue_type_style_index_0_lang-Bz-fwglK.js");require("@pantograph/tokens");const[pe,Pe]=$.createContext("Combobox"),[$e,He]=$.createContext("_Combobox"),w=c.getBemBlock("combobox");var Ye=1/0;function Je(d){var n=d==null?0:d.length;return n?ie.baseFlatten(d,Ye):[]}const se=d=>G.isNumber(d)||B.isString(d);function Qe({getValue:d,arr:n,getChildren:o}){const e=[],p=(i,I)=>{i.forEach(T=>{const V=d(T);if(se(V)){e.push({...T,_parentKeys:I,_key:V});const b=o(T);b!=null&&b.length&&p(b,[...I??[],V])}})};return p(n),e}const Xe=({getData:d,getModel:n,getValue:o,getChildren:e})=>{const p=t.computed(()=>Qe({arr:t.unref(d()),getChildren:e,getValue:o})),i=(a,m=!1)=>{const l=o(a);return p.value.filter(f=>{var v;if(m){const _=ie.last(f._parentKeys??[]);return _&&_===l}return(v=f._parentKeys)==null?void 0:v.includes(l)})},I=a=>{if(a&&B.isArray(a))return G.cloneDeep(a);const m=t.unref(n());return m&&B.isArray(m)?G.cloneDeep(m):[]},T=(a,m)=>{const l=I(m),f=i(a);if(f!=null&&f.length)return f.some(v=>{var s;const _=v._key;return _&&((s=l==null?void 0:l.includes)==null?void 0:s.call(l,_))})},V=(a,m)=>{const l=I(m),f=i(a);if(f!=null&&f.length)return f.every(v=>{var s;const _=v._key;return _&&((s=l==null?void 0:l.includes)==null?void 0:s.call(l,_))})},b=(a,m)=>{const l=I(m),f=i(a),v=o(a);return f!=null&&f.length?V(a)?!0:T(a)?"intermediate":!1:l.includes(v)},M=a=>se(a)?p.value.find(m=>m._key===a):void 0;return{flattenData:p,getNodeChildren:i,isSomeChildrenSelected:T,isAllChildrenSelected:V,isSelected:b,selectValues:(a,m)=>{if(a.length){let l=I();const f=a.filter(se);m?l.push(...f):l=l.filter(h=>!f.includes(h));const v=l.map(M).filter(h=>h&&h._parentKeys),s=Be.uniq(Je(v.map(h=>h._parentKeys))).filter(se).map(M).filter(Boolean),O=[],P=[];return s.forEach(h=>{const L=o(h);V(h,l)?O.push(L):P.push(L)}),l.push(...O),Be.uniq(l.filter(h=>!P.includes(h)))}}}},ye=["sm","md","lg"],ke=["error","warning","success"],Ze={key:1},Ie=t.defineComponent({__name:"ComboboxInput",setup(d){const n=pe();Oe.whenever(()=>n.open.value&&n.headerInputElement.value,()=>{n.headerInputElement.value&&n.open.value&&n.focusOnInput()});const o=t.computed(()=>!Q.isEmpty(n.modelValue.value)),e=t.computed(()=>o.value?B.isArray(n.modelValue.value)?n.getLabelByValue(Ge.last(n.modelValue.value)):n.getLabelByValue(n.modelValue.value):n.props.placeholder),p=T=>{if(T.key==="Backspace"&&n.props.multiple&&B.isArray(n.modelValue.value)&&Q.isEmpty(n.searchModel.value)&&(n.setModelValue(n.modelValue.value.slice(0,-1)),Q.isEmpty(n.modelValue.value))){const V=setTimeout(()=>{n.focusOnInput(),clearTimeout(V)},2)}},i=c.getBemElement(w,"input"),I=he.cva(i,{variants:{valuePlaceholder:c.generateVariantClassList("value-placeholder",i)}});return(T,V)=>(t.openBlock(),t.createBlock(t.unref($.ComboboxInput),t.mergeProps(t.unref(n).comboboxInputBinding.value,{disabled:t.unref(n).getDisabled.value,placeholder:e.value,"as-child":"",modelValue:t.unref(n).searchModel.value,"onUpdate:modelValue":V[0]||(V[0]=b=>t.unref(n).searchModel.value=b),onKeydown:p,class:t.unref(I)({valuePlaceholder:o.value}),displayValue:()=>""}),{default:t.withCtx(()=>[t.unref(n).props.headerSearch?(t.openBlock(),t.createBlock(We._sfc_main,{key:0,ref:t.unref(n).headerInputElement,placeholder:t.unref(n).props.placeholder},{leading:t.withCtx(({iconSize:b})=>[t.createVNode(_e._sfc_main,{size:b,icon:"tabler:search",flipOnDir:"rtl"},null,8,["size"])]),_:1},8,["placeholder"])):(t.openBlock(),t.createElementBlock("input",Ze))]),_:1},16,["disabled","placeholder","modelValue","class"]))}}),et=t.defineComponent({name:ue.getComponentName("ComboboxTrigger"),props:{},setup(d,{slots:n,attrs:o}){const e=pe(),p=({value:s},O)=>{if(O.stopPropagation(),s&&B.isArray(e.modelValue.value)&&!e.getDisabled.value){const P=e.modelValue.value.filter(h=>h!==s);e.setModelValue(P)}},i=c.getBemElement(w,"trigger"),I=he.cva(i,{variants:{size:c.generateVariantClassList(ye,i),headerSearch:c.generateVariantClassList("header-search",i),status:c.generateVariantClassList(ke,i),bordered:c.generateVariantClassList("bordered",i),multiple:c.generateVariantClassList("multiple",i),contentFit:c.generateVariantClassList("content-fit",i),wrapped:c.generateVariantClassList("wrapped",i),filled:c.generateVariantClassList("filled",i)}}),T=t.computed(()=>{switch(e.getSize.value){case"sm":return"2xsm";case"md":default:return"xsm"}}),V=t.computed(()=>{if(!e.props.multiple&&B.isString(e.modelValue.value)&&!Q.isEmpty(e.modelValue.value))return e.getOptionByValue(e.modelValue.value)}),b=(s=V.value)=>{if(e.props.selectedItemIconAsTrailingIcon&&B.isObject(s)&&"icon"in s)return s.icon},M=t.computed(()=>b()),N=t.computed(()=>{if(!e.props.noTrailing)return e.props.trailingIcon}),a=t.computed(()=>{var P,h;const s=G.cloneDeep(e.modelValue.value),O=B.isArray(e.modelValue.value);return{modelValue:s,open:G.cloneDeep(e.open.value),option:O?void 0:e.getOptionByValue(e.modelValue.value),options:O?(h=(P=e.modelValue.value).map)==null?void 0:h.call(P,e.getOptionByValue).filter(Boolean):void 0}}),m=()=>{e.onOpenChange(!e.open.value)},l=s=>{e.props.headerSearch},f=t.computed(()=>({disabled:e.getDisabled.value,tabindex:e.getDisabled.value||!e.props.headerSearch?-1:0,reference:e.props.reference,"data-disabled":e.getDisabled.value?"":void 0,"aria-disabled":e.getDisabled.value??void 0,"aria-label":"Show popup","aria-haspopup":"listbox","aria-expanded":e.open.value,"aria-controls":e.contentId,"data-state":e.open.value?"open":"closed",class:[I({size:e.getSize.value,status:e.getStatus.value==="success"&&Q.isEmpty(e.modelValue.value)?void 0:e.getStatus.value,bordered:e.props.bordered,multiple:e.props.multiple,contentFit:e.props.contentFit,wrapped:e.props.wrapped,filled:!Q.isEmpty(e.modelValue.value),headerSearch:e.props.headerSearch}),e.props.triggerCls],...o})),v=(s,O=T.value)=>t.h(_e._sfc_main,{icon:s,size:O}),_=()=>{var P;let s;const O=(P=n.triggerTrailing)==null?void 0:P.call(n,a.value);if(D.isEmptyElement(O)?N.value&&(s=v(N.value)):s=O,s)return t.h("div",{class:[c.getBemElement(i,"trailing"),e.props.triggerTrailingCls]},s)};return()=>{var h;const s=(h=n.trigger)==null?void 0:h.call(n,a.value),P=(()=>{if(D.isEmptyElement(s))return!1;const L=D.filterEmpty(s)??null,K=L.length===1?L[0]:L;return K?D.isValidElement(K)&&!D.isFragment(K):!0})();return t.h($.ComboboxAnchor,{...f.value,...e.comboboxTriggerBinding.value,asChild:P,as:P?"template":"button",key:String(P),onKeyUp:l,onClick:m},()=>{if(!D.isEmptyElement(s))return s;const L=k=>{var J,U;const R=e.getOptionByValue(k);return t.h(ve._sfc_main,{...R?((U=(J=e.props).getTagProps)==null?void 0:U.call(J,R))??{}:{},size:e.getTagSize.value})},K=k=>{var J,U;const R=e.getOptionByValue(k);return t.h(Ee._sfc_main,{...R?((U=(J=e.props).getTagProps)==null?void 0:U.call(J,R))??{}:{},size:e.getTagSize.value})},ce=()=>{if(!e.props.multiple&&!B.isArray(e.modelValue.value)&&e.modelValue.value&&(e.props.tagRenderMode&&["avatar","go"].includes(e.props.tagRenderMode)||M.value||e.props.leadingIcon)){let k;if(e.props.tagRenderMode==="avatar"?k=L(e.modelValue.value):e.props.tagRenderMode==="go"?k=K(e.modelValue.value):M.value?k=v(M.value):e.props.leadingIcon&&(k=v(e.props.leadingIcon)),!D.isEmptyElement(k))return t.h("div",{class:[c.getBemElement(i,"leading"),e.props.triggerLeadingCls]},k)}},de=()=>{const k=[],R=[c.getBemElement(i,"tags"),e.props.triggerContentCls,Q.isEmpty(e.modelValue.value)?e.props.triggerContentPlaceholderCls:e.props.triggerContentValueCls],U=(()=>{if(e.props.multiple&&B.isArray(e.modelValue.value)){if(e.props.tagRenderMode==="avatar")return t.h(ve._sfc_main$1,{maxCount:e.props.maxCount,size:e.getTagSize.value,closeable:!e.getDisabled.value,noPopover:!0,noWrap:!e.props.wrapped,class:R},()=>e.modelValue.value.map(L));if(e.props.tagRenderMode==="go")return t.h(Fe._sfc_main,{maxCount:e.props.maxCount,size:e.getTagSize.value,closeable:!e.getDisabled.value,noPopover:!0,noWrap:!e.props.wrapped,class:R},()=>e.modelValue.value.map(K));if(e.props.tagRenderMode==="chip")return t.h(Re._sfc_main,{maxCount:e.props.maxCount,size:e.getTagSize.value,color:"primary",closeable:!e.getDisabled.value,noPopover:!0,noWrap:!e.props.wrapped,class:R,onClose:p},()=>e.modelValue.value.map(H=>{var ae,ne;const oe=()=>e.getLabelByValue(H),X=({size:ge})=>{const ee=b(e.getOptionByValue(H))??e.props.leadingIcon;return ee?v(ee,ge):null},Z=e.getOptionByValue(H);return t.h(Ke._sfc_main,{...Z?((ne=(ae=e.props).getTagProps)==null?void 0:ne.call(ae,Z))??{}:{},value:H,class:[c.getBemElement(i,"tag"),e.props.tagCls],closeIconCls:c.getBemElement(i,"tag__close")},{text:oe,leading:X})}))}})();return U&&k.push(U),e.props.headerSearch||k.push(t.h(Ie)),t.h("div",{class:c.getBemElement(i,"content")},k)},j=[],te=ce();D.isEmptyElement(te)||j.push(te),j.push(de());const le=_();return D.isEmptyElement(le)||j.push(le),j})}}}),tt=t.defineComponent({__name:"ComboboxLabel",setup(d){return(n,o)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(t.unref(c.getBemElement)(t.unref(w),"label"))},[t.renderSlot(n.$slots,"default")],2))}}),Se=t.defineComponent({name:ue.getComponentName("SelectOption"),props:{option:{type:[Object,String],required:!0}},slots:Object,setup(d,{slots:n}){const o=pe(),e=t.computed(()=>{switch(o.getSize.value){case"sm":return"2xsm";case"lg":return"sm";case"md":default:return"xsm"}}),p=t.computed(()=>o.getOptionValue(d.option)),i=t.computed(()=>o.getOptionNoCheckbox(d.option)),I=t.computed(()=>o.getOptionSingle(d.option)),T=t.computed(()=>o.getOptionLabel(d.option)),V=t.computed(()=>o.getOptionIcon(d.option)),b=t.computed(()=>o.props.tree?void 0:o.getOptionDescription(d.option)),M=t.computed(()=>o.getOptionDisabled(d.option)),N=t.computed(()=>o.isItemSelected(p.value)),a=c.getBemElement(w,"option"),m=()=>{if(!(o.props.tree||!p.value||M.value))if(o.props.multiple)if(I.value)o.setModelValue([p.value]),o.emit("select",p.value,!0);else{let l=B.isArray(o.modelValue.value)?o.modelValue.value:[];const f=l.includes(p.value);l.length===1&&o.getSingleByValue(l[0])&&p.value!==l[0]&&(l=[]),f?(o.setModelValue(l.filter(v=>v!==p.value)),o.emit("select",p.value,!0)):(o.setModelValue([...l,p.value]),o.emit("select",p.value,!1))}else o.setModelValue(p.value),o.emit("select",p.value,!0)};if(!d.option)throw new Error("option is required");return()=>{const l=v=>{var O,P,h,L,K;const _=[];!o.props.tree&&o.props.multiple&&o.props.checkbox&&!i.value&&_.push(t.h(Ue._sfc_main,{modelValue:N.value,size:v.checkboxSize,disabled:M.value}));const s=(O=n.leading)==null?void 0:O.call(n,{option:d.option});return D.isEmptyElement(s)?o.props.tagRenderMode==="avatar"?_.push(t.h(ve._sfc_main,{...((h=(P=o.props).getTagProps)==null?void 0:h.call(P,d.option))??{},size:o.getTagSize.value})):o.props.tagRenderMode==="go"?_.push(t.h(Ee._sfc_main,{...((K=(L=o.props).getTagProps)==null?void 0:K.call(L,d.option))??{},size:o.getTagSize.value})):V.value&&_.push(t.h(_e._sfc_main,{icon:V.value,size:e.value})):_.push(s),D.isEmptyElement(_)?null:_};return(()=>{const v=!!b.value;return t.h(je._sfc_main$1,{class:a,description:b.value,title:T.value,key:p.value,selected:N.value,unFocusable:!0,leadingCenter:!v,size:o.getSize.value,disabled:M.value,onClick:m},{leading:l,trailing:()=>{var _;return(_=n.trailing)==null?void 0:_.call(n,{option:d.option})}})})()}}}),ot=t.defineComponent({name:ue.getComponentName("ComboboxWrapper"),setup(d,{slots:n}){const o=$e(),e=$.injectComboboxRootContext(),p=t.ref();Me.useLazyLoading({target:p});const i=t.ref(),I=Ve.getPopoverPortalProps({triggerRef:i,props:o.props}),{getFlipOnDir:T,getDir:V}=B.useConfig(),b=T("reversePlacementOnDir"),M=V(),N=Ve.getPopoverContentProps({props:o.props,flip:b,emitsAsProps:o.emitsAsProps,_dir:M,controlAutoFocus:!1,extraPropNames:["bodyLock","position"]}),a=({key:r,getterKey:u,defaultValue:y,noReturnOption:S})=>C=>{const A=B.isFunction(y)?y(C):y;if(B.isObject(C)){const F=C[r]??A,W=u&&o.props[u];if(W){if(B.isString(W))return C[W]??F;if(B.isFunction(W))return W(C)??F}return F}return B.isString(C)&&!S?C??A:A},m=a({getterKey:"getValue",key:"value"}),l=a({getterKey:"getNoCheckbox",key:"noCheckbox"}),f=a({getterKey:"geSingle",key:"single",noReturnOption:!0}),v=a({getterKey:"getLabel",key:"label",defaultValue:m}),_=a({getterKey:"getIcon",key:"icon",noReturnOption:!0}),s=a({getterKey:"getDescription",key:"description",noReturnOption:!0}),O=a({getterKey:"getDisabled",key:"disabled",defaultValue:!1,noReturnOption:!0}),P=a({getterKey:"getGroupLabel",key:"label",noReturnOption:!0}),h=a({getterKey:"getGroupOptions",key:"options",noReturnOption:!0}),L=r=>{var u;if((u=o.props.options)!=null&&u.length&&r)for(const y of o.props.options){if(m(y)===r)return y;const S=h(y);if(S!=null&&S.length){for(const C of S)if(m(C)===r)return C}}return r},K=r=>{const u=L(r);return u?v(u)??r:r},ce=r=>{const u=L(r);return u?f(u)??!1:!1},{contains:de}=$.useFilter({sensitivity:"base"}),j=t.computed(()=>{const r=u=>u==null?void 0:u.map(y=>{const S=v(y),C=m(y),A=O(y),F=P(y),W=!o.searchModel.value||S&&de(S,o.searchModel.value),g=h(y),E=!o.props.tree||C;if(g&&E){const x=r(g);if(x!=null&&x.length||W)return{groupLabel:F,title:S,key:C,disabled:A,children:x,_option:y}}return W&&E?{title:S,key:C,disabled:A,_option:y}:null}).filter(Boolean);if(o.props.options)return r(o.props.options)}),{getDisabled:te,getStatus:le,getSize:k}=xe.useFormInput({getDisabled:()=>o.props.disabled,getSize:()=>o.props.size,getStatus:()=>o.props.status}),R=t.computed(()=>{switch(k.value){case"sm":return"xsm";case"lg":return"md";case"md":default:return"sm"}}),{inputBindings:J,rootBindings:U}=xe.UseInputDataStates({getDisabled:()=>te.value}),H=t.ref(),oe=()=>{var r,u,y,S,C,A,F;e.open.value&&e.inputElement.value&&(o.props.headerSearch&&((r=H.value)!=null&&r.input)?document.activeElement!==((u=H.value)==null?void 0:u.input)&&((C=(S=(y=H.value)==null?void 0:y.input)==null?void 0:S.focus)==null||C.call(S)):document.activeElement!==e.inputElement.value&&((F=(A=e.inputElement.value)==null?void 0:A.focus)==null||F.call(A)))},X=r=>{e.modelValue.value=r,o.emit("update:modelValue",r)},Z=r=>r===void 0?!1:Array.isArray(e.modelValue.value)?!!(r&&e.modelValue.value.includes(r)):e.modelValue.value===r;Pe({...o,getOptionValue:m,getOptionLabel:v,getOptionSingle:f,getOptionNoCheckbox:l,getOptionDescription:s,getOptionDisabled:O,getOptionIcon:_,getOptionByValue:L,isItemSelected:Z,getLabelByValue:K,getSingleByValue:ce,focusOnInput:oe,setModelValue:X,headerInputElement:H,getDisabled:te,getStatus:le,getSize:k,getTagSize:R,comboboxInputBinding:J,comboboxTriggerBinding:U,...e,modelValue:e.modelValue}),t.watch(()=>[o.props.clearOnChangeMultiple,o.props.multiple],()=>{o.props.clearOnChangeMultiple&&X(void 0)});const ae=t.computed(()=>{const r=o.props.scrollContainerProps??{};return{...r,areaCls:[c.getBemElement(w,"scroll_area"),r==null?void 0:r.class,r==null?void 0:r.areaCls]}}),ne=c.getBemElement(w,"popup"),ge=he.cva(ne,{variants:{size:c.generateVariantClassList(ye,ne)}}),ee=r=>{if(Number(r)>0)return`${r}px`;if(typeof r=="string")return r},Te=t.computed(()=>ee(o.props.popupWidth)),ze=t.computed(()=>ee(o.props.popupHeight)),be=t.computed(()=>ee(o.props.minWidth)),Ce=t.computed(()=>({type:k.value==="sm"?"simple":"advance",...ie.omit(o.props.emptyProps??{},"class")})),Le=t.computed(()=>ie.omit(o.props.skeletonProps??{},"class")),{selectValues:De}=Xe({getValue:r=>r==null?void 0:r.key,getChildren:r=>r==null?void 0:r.children,getModel:()=>G.cloneDeep(e.modelValue.value),getData:()=>G.cloneDeep(j.value??[])});return()=>{var F,W;const r=g=>t.h(Se,{option:g},{trailing:n.optionTrailing,leading:n.optionLeading}),u=[];let y;if(o.props.tree){const E=B.isArray(e.modelValue.value)?e.modelValue.value:e.modelValue.value?[e.modelValue.value]:[];y=t.h(Ne._sfc_main,{data:j.value??[],selectable:!0,checkbox:o.props.multiple&&o.props.checkbox,multiple:o.props.multiple,defaultExpandAll:!0,syncCheckboxAndSelect:o.props.multiple,showLine:!0,modelValue:E,checkedKeys:E,onExpand:oe,onSelect:(x,q,z)=>{if(o.props.multiple){const Y=B.isArray(z)?z:[z];X(De(Y,q))}else X(z)},class:"w-full"},{title:x=>r(x._option)}),u.push(y)}else{let g=!1;const E=[];if((j.value??[]).forEach(x=>{var q;if((q=x.children)!=null&&q.length){const z=[];x.children.forEach(Y=>{const re=r(Y._option);Z(m(Y._option))&&o.props.sortSelectedItems?E.push(re):z.push(re)}),z.length&&((g||u.length)&&(u.push(t.h(fe._sfc_main)),g=!1),x.groupLabel&&u.push(t.h(tt,{class:o.props.labelCls},()=>x.groupLabel)),u.push(...z),g=!0)}else{const z=r(x._option);Z(m(x._option))&&o.props.sortSelectedItems?E.push(z):(g&&(u.push(t.h(fe._sfc_main)),g=!1),u.push(z))}}),o.props.sortSelectedItems&&E.length){const x=!!u.length;u.splice(0,0,...E),x&&u.splice(E.length,0,t.h(fe._sfc_main))}}const S=D.flattenChildrenByType(y?[y]:u,Se).filter(g=>{var E;return B.isObject(g==null?void 0:g.props)&&((E=g==null?void 0:g.props)==null?void 0:E.option)}),C=!!(o.props.tree&&((F=j.value)!=null&&F.length)||S!=null&&S.length),A=()=>{var E,x;const g=[];if(C||o.props.loading){const q=[];if(C&&q.push(...u),o.props.loading){const z=(E=n.loading)==null?void 0:E.call(n,{});if(!D.isEmptyElement(z))q.push(z);else{const Y=new Array(C?2:o.props.loadingRowCount).fill(1);q.push(...Y.map(()=>t.h(we._sfc_main,{size:k.value,class:[c.getBemElement(w,"skeleton"),o.props.skeletonCls],...Le.value})))}}g.push(t.h("div",{class:[c.getBemElement(w,"options"),o.props.optionsCls]},q))}else if(!C){const q=(x=n.empty)==null?void 0:x.call(n,Ce.value);D.isEmptyElement(q)?g.push(t.h(qe._sfc_main,{class:[c.getBemElement(w,"empty"),o.props.emptyCls],...Ce.value},{title:n.emptyTitle,description:n.emptyDescription,actions:n.emptyActions,image:n.emptyImage})):g.push(q)}return o.props.lazyLoading&&g.push(t.h("div",{class:c.getBemElement(w,"lazy_loading")},t.h("div",{class:c.getBemElement(w,"lazy_loading_trigger"),ref:p}))),g};return[t.h(et,{ref:i,...o.attrs,style:{...((W=o.attrs)==null?void 0:W.style)??{},"--ptc-combobox-trigger-min-w":be.value}},{trigger:n.trigger,triggerTrailing:n.triggerTrailing}),t.h($.ComboboxPortal,I.value,()=>t.h($.ComboboxContent,{...N.value,vShow:e.open.value,class:[ge(o.props),o.props.popupCls],style:{"--ptc-combobox-popup-width":o.props.samePopupWidth?void 0:Te.value,"--ptc-combobox-popup-height":ze.value,"--ptc-combobox-trigger-min-w":be.value},onClick:oe},()=>{var z,Y,re;const g=[],E=(z=n.header)==null?void 0:z.call(n,{}),x=!D.isEmptyElement(E);if(o.props.headerSearch||x){const me=[];x&&me.push(E),o.props.headerSearch&&me.push(t.h(Ie)),g.push(t.h("div",{class:c.getBemElement(w,"header")},me))}g.push(t.h(Ae._sfc_main,ae.value,A));const q=(re=n.footer)==null?void 0:re.call(n,{isEmpty:!((Y=j.value)!=null&&Y.length),search:o.searchModel.value});return D.isEmptyElement(q)||g.push(t.h("div",{class:c.getBemElement(w,"footer")},q)),g}))]}}}),nt=t.defineComponent({...ue.getComponentOptions("Combobox"),__name:"Combobox",props:{size:{default:"md"},status:{},multiple:{type:Boolean,default:void 0},checkbox:{type:Boolean,default:!0},tagRenderMode:{default:"chip"},getTagProps:{},tree:{type:Boolean},contentFit:{type:Boolean},wrapped:{type:Boolean},sortSelectedItems:{type:Boolean},noTrailing:{type:Boolean},leadingIcon:{},trailingIcon:{default:"tabler:chevron-down"},selectedItemIconAsTrailingIcon:{type:Boolean,default:!0},maxCount:{},to:{},placeholder:{},indicatorIcon:{default:"tabler:check"},options:{},getDisabled:{},getLabel:{},getDescription:{},getValue:{},getNoCheckbox:{},geSingle:{},getGroupOptions:{},getGroupLabel:{},getIcon:{},placement:{default:"bottom-start"},reversePlacementOnDir:{},loading:{type:Boolean},skeletonProps:{},loadingRowCount:{default:10},lazyLoading:{type:Boolean},bordered:{type:Boolean,default:!0},clearOnChangeMultiple:{type:Boolean,default:!0},triggerCls:{},triggerLeadingCls:{},triggerContentCls:{},triggerContentPlaceholderCls:{},triggerContentValueCls:{},triggerTrailingCls:{},itemLeadingCls:{},optionCls:{},tagCls:{},popupCls:{},labelCls:{},optionsCls:{},optionTextCls:{},optionContentCls:{},emptyCls:{},skeletonCls:{},scrollContainerProps:{},emptyProps:{},samePopupWidth:{type:Boolean,default:!0},popupHeight:{default:384},popupWidth:{},minWidth:{},headerSearch:{type:Boolean},search:{},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:void 0},resetSearchTermOnBlur:{type:Boolean,default:!0},resetSearchTermOnSelect:{type:Boolean,default:!0},modelValue:{},defaultValue:{},dir:{},disabled:{type:Boolean,default:void 0},highlightOnHover:{type:Boolean},by:{},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},reference:{},forceMount:{type:Boolean,default:void 0},position:{default:"popper"},bodyLock:{type:Boolean},side:{},sideOffset:{default:4},align:{},alignOffset:{},avoidCollisions:{type:Boolean,default:void 0},collisionBoundary:{},collisionPadding:{default:4},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean,default:void 0},positionStrategy:{default:"fixed"},updatePositionStrategy:{},disableUpdateOnLayoutShift:{type:Boolean,default:void 0},prioritizePosition:{type:Boolean,default:void 0},disableOutsidePointerEvents:{type:Boolean},defer:{type:Boolean}},emits:["update:search","select","update:modelValue","highlight","update:open","escapeKeyDown","pointerDownOutside","focusOutside","interactOutside"],setup(d,{emit:n}){const o=d,e=n,p=$.useEmitAsProps(e),i=t.computed(()=>G.omitBy({...G.pick(o,"open","defaultOpen","defaultValue","modelValue","by","dir","multiple","disabled"),...G.pick(p,"onUpdate:modelValue","onUpdate:open"),ignoreFilter:!0},G.isUndefined)),I=Oe.useVModel(o,"search",e,{passive:o.search===void 0});t.watch(()=>o.open,b=>{b||(I.value=void 0)});const T=t.useSlots(),V=t.useAttrs();return He({attrs:V,props:o,emit:e,searchModel:I,emitsAsProps:p}),(b,M)=>(t.openBlock(),t.createBlock(t.unref($.ComboboxRoot),t.mergeProps(i.value,{class:t.unref(w)}),{default:t.withCtx(()=>[t.createVNode(t.unref(ot),null,t.createSlots({_:2},[t.renderList(Object.keys(T),N=>({name:N,fn:t.withCtx(a=>[t.renderSlot(b.$slots,N,t.normalizeProps(t.guardReactiveProps(a)))])}))]),1024)]),_:3},16,["class"]))}});exports.ComboboxSizes=ye;exports.ComboboxStatuses=ke;exports._sfc_main=nt;exports.injectComboboxContext=pe;exports.provideComboboxContext=Pe;
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { _ as X, i as Y, p as $ } from "./ColorPicker.vue_vue_type_style_index_0
|
|
|
12
12
|
import { _ as oe, C as ae, a as te } from "./ColorSwatch.vue_vue_type_style_index_0_lang-CdoLi2ow.js";
|
|
13
13
|
import { _ as re } from "./ColorSwatchGroup.vue_vue_type_style_index_0_lang-DyXou_Un.js";
|
|
14
14
|
import { _ as ie, C as ne } from "./ColorTrigger.vue_vue_type_style_index_0_lang-CbOky0vB.js";
|
|
15
|
-
import { _ as me, C as Ce, a as ce, i as Se, p as le } from "./Combobox.vue_vue_type_style_index_0_lang-
|
|
15
|
+
import { _ as me, C as Ce, a as ce, i as Se, p as le } from "./Combobox.vue_vue_type_style_index_0_lang-CfAe6sbQ.js";
|
|
16
16
|
import { C as ue, c as _e, p as de, u as be } from "./index-jwkhq8oW.js";
|
|
17
17
|
import { _ as Te } from "./DataTable.vue_vue_type_style_index_0_lang-BmUHso6v.js";
|
|
18
18
|
import { _ as ve, D as Ie } from "./Divider.vue_vue_type_style_index_0_lang-B6fQsp1Y.js";
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("./BaseBadge.model-Bz8P4acF.js"),n=require("./ButtonGroup.vue_vue_type_script_setup_true_lang-D_6kzAX6.js"),E=require("./ActionButton.vue_vue_type_script_setup_true_lang-B7vGsGcO.js"),q=require("./Alert.vue_vue_type_style_index_0_lang-BgHgn7SC.js"),t=require("./Avatar.vue_vue_type_style_index_0_lang-CLZz5CmG.js"),w=require("./Badge.vue_vue_type_script_setup_true_lang-BIli_mJS.js"),M=require("./Button.vue_vue_type_script_setup_true_lang-8omci6bm.js"),o=require("./Checkbox.vue_vue_type_style_index_0_lang-Bz-fwglK.js"),$=require("./Chip.vue_vue_type_style_index_0_lang-CtgInoR3.js"),s=require("./ChipGroup.vue_vue_type_style_index_0_lang-BVwWqy-3.js"),m=require("./ColorPicker.vue_vue_type_style_index_0_lang-0SIDliS4.js"),C=require("./ColorSwatch.vue_vue_type_style_index_0_lang-BK2Ak9jv.js"),R=require("./ColorSwatchGroup.vue_vue_type_style_index_0_lang-qx6S3kVF.js"),I=require("./ColorTrigger.vue_vue_type_style_index_0_lang-LcImZnD-.js"),a=require("./Combobox.vue_vue_type_style_index_0_lang-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("./BaseBadge.model-Bz8P4acF.js"),n=require("./ButtonGroup.vue_vue_type_script_setup_true_lang-D_6kzAX6.js"),E=require("./ActionButton.vue_vue_type_script_setup_true_lang-B7vGsGcO.js"),q=require("./Alert.vue_vue_type_style_index_0_lang-BgHgn7SC.js"),t=require("./Avatar.vue_vue_type_style_index_0_lang-CLZz5CmG.js"),w=require("./Badge.vue_vue_type_script_setup_true_lang-BIli_mJS.js"),M=require("./Button.vue_vue_type_script_setup_true_lang-8omci6bm.js"),o=require("./Checkbox.vue_vue_type_style_index_0_lang-Bz-fwglK.js"),$=require("./Chip.vue_vue_type_style_index_0_lang-CtgInoR3.js"),s=require("./ChipGroup.vue_vue_type_style_index_0_lang-BVwWqy-3.js"),m=require("./ColorPicker.vue_vue_type_style_index_0_lang-0SIDliS4.js"),C=require("./ColorSwatch.vue_vue_type_style_index_0_lang-BK2Ak9jv.js"),R=require("./ColorSwatchGroup.vue_vue_type_style_index_0_lang-qx6S3kVF.js"),I=require("./ColorTrigger.vue_vue_type_style_index_0_lang-LcImZnD-.js"),a=require("./Combobox.vue_vue_type_style_index_0_lang-nxzc0c0f.js"),p=require("./index-DWw7aruo.js"),Z=require("./DataTable.vue_vue_type_style_index_0_lang-DlCKsldZ.js"),G=require("./Divider.vue_vue_type_style_index_0_lang-DoEWjJx6.js"),S=require("./DropZone.vue_vue_type_style_index_0_lang-gFBvGjz1.js"),j=require("./Empty.vue_vue_type_style_index_0_lang-DidQV2p4.js"),V=require("./FloatButton.vue_vue_type_script_setup_true_lang-CF1FWNxr.js"),e=require("./FormItem.vue_vue_type_style_index_0_lang-Bo3o8_6v.js"),x=require("./getEmojiList-5BGH5AZ_.js"),H=require("./GraphicalObject.vue_vue_type_script_setup_true_lang-BZ5qLbnJ.js"),y=require("./GraphicalObjectGroup.vue_vue_type_style_index_0_lang-CDFDVi-0.js"),B=require("./Icon/index.umd.cjs"),K=require("./IconButton.vue_vue_type_script_setup_true_lang-B7dwj__6.js"),l=require("./Image.vue_vue_type_style_index_0_lang-DCoVuK7u.js"),d=require("./IndentLevel.vue_vue_type_style_index_0_lang-I_4wqG59.js"),U=require("./Indicator.vue_vue_type_script_setup_true_lang-CgN-sjj_.js"),g=require("./Input.vue_vue_type_style_index_0_lang-CWW5TIRh.js"),J=require("./Kbd.vue_vue_type_style_index_0_lang-CjNtLg1e.js"),k=require("./Link.vue_vue_type_style_index_0_lang-C1i1VsGw.js"),_=require("./MenuItem.vue_vue_type_style_index_0_lang-CYOdJYFY.js"),f=require("./Popover.vue_vue_type_style_index_0_lang-txLoIoSw.js"),A=require("./RadioGroup.vue_vue_type_script_setup_true_lang-D6pRyJ0t.js"),b=require("./ScrollContainer.vue_vue_type_style_index_0_lang-BIoD2_5T.js"),P=require("./Segmented.vue_vue_type_style_index_0_lang-m8iNyqtw.js"),i=require("./Select.vue_vue_type_style_index_0_lang-CbJsb6VK.js"),N=require("./Shortcut.vue_vue_type_style_index_0_lang-DOhEtw_i.js"),h=require("./Skeleton.vue_vue_type_style_index_0_lang-CWNX_-Jl.js"),L=require("./Spinner.vue_vue_type_style_index_0_lang-DGxzzl6D.js"),F=require("./Switch.vue_vue_type_style_index_0_lang-aODjQm2H.js"),r=require("./THead.vue_vue_type_style_index_0_lang-oUsIia-h.js"),T=require("./Textarea.vue_vue_type_style_index_0_lang-DtO8cFFA.js"),z=require("./Tooltip.vue_vue_type_script_setup_true_lang-DWMPc3HZ.js"),u=require("./Tree.vue_vue_type_style_index_0_lang-26mqYWer.js"),v=require("./element-BjE0SVc4.js"),O=require("./options-CWrQ7gsa.js"),Q=require("./style-CYb6EX2Q.js"),W=require("./useInputDataStates-D1X-Whwt.js"),D=require("./Icon.vue_vue_type_style_index_0_lang-D3cRtJNJ.js"),X=["3xsm","2xsm","xsm","sm","md","lg","xlg","2xlg"],Y={};exports.BadgeColors=c.BadgeColors;exports.BadgeColorsSubtle=c.BadgeColorsSubtle;exports.BadgeSizes=c.BadgeSizes;exports.BadgeTypes=c.BadgeTypes;exports.ButtonColors=n.ButtonColors;exports.ButtonGroup=n._sfc_main;exports.ButtonSizes=n.ButtonSizes;exports.ButtonTypes=n.ButtonTypes;exports.ButtonVariants=n.ButtonVariants;exports.injectButtonGroupContext=n.injectButtonGroupContext;exports.provideButtonGroupContext=n.provideButtonGroupContext;exports.ActionButton=E._sfc_main;exports.Alert=q._sfc_main;exports.AlertTypes=q.AlertTypes;exports.Avatar=t._sfc_main;exports.AvatarGroup=t._sfc_main$1;exports.AvatarOnlineAlignments=t.AvatarOnlineAlignments;exports.AvatarShapes=t.AvatarShapes;exports.AvatarSizes=t.AvatarSizes;exports.AvatarStrokes=t.AvatarStrokes;exports.injectAvatarGroupContext=t.injectAvatarGroupContext;exports.provideAvatarGroupContext=t.provideAvatarGroupContext;exports.Badge=w._sfc_main;exports.Button=M._sfc_main;exports.Checkbox=o._sfc_main;exports.CheckboxGroup=o._sfc_main$1;exports.CheckboxSizes=o.CheckboxSizes;exports.injectCheckboxGroupContext=o.injectCheckboxGroupContext;exports.provideCheckboxGroupContext=o.provideCheckboxGroupContext;exports.useColoredPantographCheckbox=o.useColoredPantographCheckbox;exports.useColoredPantographCheckboxGroup=o.useColoredPantographCheckboxGroup;exports.Chip=$._sfc_main;exports.ChipColors=s.ChipColors;exports.ChipGroup=s._sfc_main;exports.ChipSizes=s.ChipSizes;exports.injectChipGroupContext=s.injectChipGroupContext;exports.provideChipGroupContext=s.provideChipGroupContext;exports.ColorPicker=m._sfc_main;exports.injectColorPickerContext=m.injectColorPickerContext;exports.provideColorPickerContext=m.provideColorPickerContext;exports.ColorSwatch=C._sfc_main;exports.ColorSwatchSizes=C.ColorSwatchSizes;exports.ColorSwatchTypes=C.ColorSwatchTypes;exports.ColorSwatchGroup=R._sfc_main;exports.ColorTrigger=I._sfc_main;exports.ColorTriggerSizes=I.ColorTriggerSizes;exports.Combobox=a._sfc_main;exports.ComboboxSizes=a.ComboboxSizes;exports.ComboboxStatuses=a.ComboboxStatuses;exports.injectComboboxContext=a.injectComboboxContext;exports.provideComboboxContext=a.provideComboboxContext;exports.ConfigProvider=p.ConfigProvider;exports.injectConfigContext=p.injectConfigContext;exports.provideConfigContext=p.provideConfigContext;exports.useConfig=p.useConfig;exports.DataTable=Z._sfc_main;exports.Divider=G._sfc_main;exports.DividerTypes=G.DividerTypes;exports.DropZone=S._sfc_main;exports.DropZoneSizes=S.DropZoneSizes;exports.DropZoneTypes=S.DropZoneTypes;exports.Empty=j._sfc_main;exports.EmptyTypes=j.EmptyTypes;exports.FloatButton=V._sfc_main;exports.Form=e._sfc_main;exports.FormItem=e._sfc_main$1;exports.FormItemSizes=e.FormItemSizes;exports.FormItemStatuses=e.FormItemStatuses;exports.Label=e._sfc_main$2;exports.LabelSizes=e.LabelSizes;exports.injectFormContext=e.injectFormContext;exports.injectFormItemContext=e.injectFormItemContext;exports.provideFormContext=e.provideFormContext;exports.provideFormItemContext=e.provideFormItemContext;exports.GOPicker=x._sfc_main;exports.emojiList=x.emojiList;exports.getEmojiList=x.getEmojiList;exports.GraphicalObject=H._sfc_main;exports.GraphicalObjectGroup=y._sfc_main;exports.injectGraphicalObjectGroupContext=y.injectGraphicalObjectGroupContext;exports.provideGraphicalObjectGroupContext=y.provideGraphicalObjectGroupContext;exports.defineLocaleIconCollection=B.defineLocaleIconCollection;exports.disableIconCache=B.disableIconCache;exports.IconButton=K._sfc_main;exports.Image=l._sfc_main;exports.ImageAspectRatios=l.ImageAspectRatios;exports.ImageSizeRanges=l.ImageSizeRanges;exports.ImageTypes=l.ImageTypes;exports.IndentLevel=d._sfc_main;exports.IndentLevelShowLines=d.IndentLevelShowLines;exports.IndentLevelSizes=d.IndentLevelSizes;exports.Indicator=U._sfc_main;exports.Input=g._sfc_main;exports.InputSizes=g.InputSizes;exports.InputStatuses=g.InputStatuses;exports.Kbd=J._sfc_main;exports.Link=k._sfc_main;exports.LinkStyles=k.LinkStyles;exports.Menu=_._sfc_main;exports.MenuGaps=_.MenuGaps;exports.MenuItem=_._sfc_main$1;exports.MenuItemSizes=_.MenuItemSizes;exports.SubMenu=_._sfc_main$2;exports.injectMenuContext=_.injectMenuContext;exports.provideMenuContext=_.provideMenuContext;exports.Popover=f._sfc_main;exports.PopoverPlacements=f.PopoverPlacements;exports.PopoverSizes=f.PopoverSizes;exports.RadioGroup=A._sfc_main;exports.RadioGroupItem=A._sfc_main$1;exports.ScrollContainer=b._sfc_main;exports.ScrollContainerSizes=b.ScrollContainerSizes;exports.ScrollContainerTypes=b.ScrollContainerTypes;exports.Segmented=P._sfc_main;exports.SegmentedSizes=P.SegmentedSizes;exports.Select=i._sfc_main;exports.SelectLabel=i._sfc_main$1;exports.SelectOption=i.SelectOption;exports.SelectSizes=i.SelectSizes;exports.SelectStatuses=i.SelectStatuses;exports.injectSelectContext=i.injectSelectContext;exports.provideSelectContext=i.provideSelectContext;exports.Shortcut=N._sfc_main;exports.Skeleton=h._sfc_main;exports.SkeletonSizes=h.SkeletonSizes;exports.SkeletonTypes=h.SkeletonTypes;exports.Spinner=L._sfc_main;exports.SpinnerSizes=L.SpinnerSizes;exports.Switch=F._sfc_main;exports.SwitchSizes=F.SwitchSizes;exports.TBody=r._sfc_main$4;exports.THead=r._sfc_main$5;exports.Table=r._sfc_main;exports.TableSizes=r.TableSizes;exports.Td=r._sfc_main$2;exports.Th=r._sfc_main$1;exports.Tr=r._sfc_main$3;exports.Textarea=T._sfc_main;exports.TextareaSizes=T.TextareaSizes;exports.TextareaStatuses=T.TextareaStatuses;exports.Tooltip=z._sfc_main;exports.importTippyStyles=z.importTippyStyles;exports.registerTippy=z.registerTippy;exports.Tree=u._sfc_main;exports.TreeGaps=u.TreeGaps;exports.TreeSizes=u.TreeSizes;exports.injectTreeContext=u.injectTreeContext;exports.provideTreeContext=u.provideTreeContext;exports.filterEmpty=v.filterEmpty;exports.isEmptyElement=v.isEmptyElement;exports.isFragment=v.isFragment;exports.isValidElement=v.isValidElement;exports.componentPrefix=O.componentPrefix;exports.getComponentOptions=O.getComponentOptions;exports.getStyleObject=Q.getStyleObject;exports.UseInputDataStates=W.UseInputDataStates;exports.Icon=D._sfc_main;exports.IconSizes=D.IconSizes;exports.default=Y;exports.systemSizes=X;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),$=require("reka-ui"),G=require("./FormItem.vue_vue_type_style_index_0_lang-Bo3o8_6v.js"),ue=require("./options-CWrQ7gsa.js"),c=require("@pantograph/utils"),E=require("./index-DWw7aruo.js"),he=require("class-variance-authority"),ie=require("./omit-CYbreqlf.js"),qe=require("./Empty.vue_vue_type_style_index_0_lang-DidQV2p4.js"),we=require("./Skeleton.vue_vue_type_style_index_0_lang-CWNX_-Jl.js"),fe=require("./Divider.vue_vue_type_style_index_0_lang-DoEWjJx6.js"),D=require("./element-BjE0SVc4.js"),xe=require("./useInputDataStates-D1X-Whwt.js"),Me=require("./useLazyLoading-H6VG5aE-.js"),Ve=require("./Popover.vue_vue_type_style_index_0_lang-txLoIoSw.js"),Ae=require("./ScrollContainer.vue_vue_type_style_index_0_lang-BIoD2_5T.js"),Ne=require("./Tree.vue_vue_type_style_index_0_lang-26mqYWer.js"),Be=require("./uniq-DGkyiyS4.js"),Q=require("./isEmpty-bCllo8T9.js"),Ke=require("./Chip.vue_vue_type_style_index_0_lang-CtgInoR3.js"),Re=require("./ChipGroup.vue_vue_type_style_index_0_lang-BVwWqy-3.js"),_e=require("./Icon.vue_vue_type_style_index_0_lang-D3cRtJNJ.js"),ve=require("./Avatar.vue_vue_type_style_index_0_lang-CLZz5CmG.js"),Fe=require("./GraphicalObjectGroup.vue_vue_type_style_index_0_lang-CDFDVi-0.js"),Ee=require("./GraphicalObject.vue_vue_type_script_setup_true_lang-BZ5qLbnJ.js"),We=require("./Input.vue_vue_type_style_index_0_lang-CWW5TIRh.js"),Oe=require("@vueuse/core"),Ge=require("lodash-es"),je=require("./MenuItem.vue_vue_type_style_index_0_lang-CYOdJYFY.js");require("@iconify/vue");const Ue=require("./Checkbox.vue_vue_type_style_index_0_lang-Bz-fwglK.js");require("@pantograph/tokens");const[pe,Pe]=$.createContext("Combobox"),[$e,He]=$.createContext("_Combobox"),w=c.getBemBlock("combobox");var Ye=1/0;function Je(d){var n=d==null?0:d.length;return n?ie.baseFlatten(d,Ye):[]}const ae=d=>G.isNumber(d)||E.isString(d);function Qe({getValue:d,arr:n,getChildren:o}){const e=[],p=(i,P)=>{i.forEach(k=>{const x=d(k);if(ae(x)){e.push({...k,_parentKeys:P,_key:x});const V=o(k);V!=null&&V.length&&p(V,[...P??[],x])}})};return p(n),e}const Xe=({getData:d,getModel:n,getValue:o,getChildren:e})=>{const p=t.computed(()=>Qe({arr:t.unref(d()),getChildren:e,getValue:o})),i=(s,m=!1)=>{const l=o(s);return p.value.filter(f=>{var v;if(m){const h=ie.last(f._parentKeys??[]);return h&&h===l}return(v=f._parentKeys)==null?void 0:v.includes(l)})},P=s=>{if(s&&E.isArray(s))return G.cloneDeep(s);const m=t.unref(n());return m&&E.isArray(m)?G.cloneDeep(m):[]},k=(s,m)=>{const l=P(m),f=i(s);if(f!=null&&f.length)return f.some(v=>{var a;const h=v._key;return h&&((a=l==null?void 0:l.includes)==null?void 0:a.call(l,h))})},x=(s,m)=>{const l=P(m),f=i(s);if(f!=null&&f.length)return f.every(v=>{var a;const h=v._key;return h&&((a=l==null?void 0:l.includes)==null?void 0:a.call(l,h))})},V=(s,m)=>{const l=P(m),f=i(s),v=o(s);return f!=null&&f.length?x(s)?!0:k(s)?"intermediate":!1:l.includes(v)},M=s=>ae(s)?p.value.find(m=>m._key===s):void 0;return{flattenData:p,getNodeChildren:i,isSomeChildrenSelected:k,isAllChildrenSelected:x,isSelected:V,selectValues:(s,m)=>{if(s.length){let l=P();const f=s.filter(ae);m?l.push(...f):l=l.filter(y=>!f.includes(y));const v=l.map(M).filter(y=>y&&y._parentKeys),a=Be.uniq(Je(v.map(y=>y._parentKeys))).filter(ae).map(M).filter(Boolean),T=[],z=[];return a.forEach(y=>{const L=o(y);x(y,l)?T.push(L):z.push(L)}),l.push(...T),Be.uniq(l.filter(y=>!z.includes(y)))}}}},ye=["sm","md","lg"],ke=["error","warning","success"],Ze={key:1},Ie=t.defineComponent({__name:"ComboboxInput",setup(d){const n=pe();Oe.whenever(()=>n.open.value&&n.headerInputElement.value,()=>{n.headerInputElement.value&&n.open.value&&n.focusOnInput()});const o=t.computed(()=>!Q.isEmpty(n.modelValue.value)),e=t.computed(()=>o.value?E.isArray(n.modelValue.value)?n.getLabelByValue(Ge.last(n.modelValue.value)):n.getLabelByValue(n.modelValue.value):n.props.placeholder),p=k=>{if(k.key==="Backspace"&&n.props.multiple&&E.isArray(n.modelValue.value)&&Q.isEmpty(n.searchModel.value)&&(n.setModelValue(n.modelValue.value.slice(0,-1)),Q.isEmpty(n.modelValue.value))){const x=setTimeout(()=>{n.focusOnInput(),clearTimeout(x)},2)}},i=c.getBemElement(w,"input"),P=he.cva(i,{variants:{valuePlaceholder:c.generateVariantClassList("value-placeholder",i)}});return(k,x)=>(t.openBlock(),t.createBlock(t.unref($.ComboboxInput),t.mergeProps(t.unref(n).comboboxInputBinding.value,{disabled:t.unref(n).getDisabled.value,placeholder:e.value,"as-child":"",modelValue:t.unref(n).searchModel.value,"onUpdate:modelValue":x[0]||(x[0]=V=>t.unref(n).searchModel.value=V),onKeydown:p,class:t.unref(P)({valuePlaceholder:o.value}),displayValue:()=>""}),{default:t.withCtx(()=>[t.unref(n).props.headerSearch?(t.openBlock(),t.createBlock(We._sfc_main,{key:0,ref:t.unref(n).headerInputElement,placeholder:t.unref(n).props.placeholder},{leading:t.withCtx(({iconSize:V})=>[t.createVNode(_e._sfc_main,{size:V,icon:"tabler:search",flipOnDir:"rtl"},null,8,["size"])]),_:1},8,["placeholder"])):(t.openBlock(),t.createElementBlock("input",Ze))]),_:1},16,["disabled","placeholder","modelValue","class"]))}}),et=t.defineComponent({name:ue.getComponentName("ComboboxTrigger"),props:{},setup(d,{slots:n,attrs:o}){const e=pe(),p=({value:a},T)=>{if(T.stopPropagation(),a&&E.isArray(e.modelValue.value)&&!e.getDisabled.value){const z=e.modelValue.value.filter(y=>y!==a);e.setModelValue(z)}},i=c.getBemElement(w,"trigger"),P=he.cva(i,{variants:{size:c.generateVariantClassList(ye,i),headerSearch:c.generateVariantClassList("header-search",i),status:c.generateVariantClassList(ke,i),bordered:c.generateVariantClassList("bordered",i),multiple:c.generateVariantClassList("multiple",i),contentFit:c.generateVariantClassList("content-fit",i),wrapped:c.generateVariantClassList("wrapped",i),filled:c.generateVariantClassList("filled",i)}}),k=t.computed(()=>{switch(e.getSize.value){case"sm":return"2xsm";case"md":default:return"xsm"}}),x=t.computed(()=>{if(!e.props.multiple&&E.isString(e.modelValue.value)&&!Q.isEmpty(e.modelValue.value))return e.getOptionByValue(e.modelValue.value)}),V=(a=x.value)=>{if(e.props.selectedItemIconAsTrailingIcon&&E.isObject(a)&&"icon"in a)return a.icon},M=t.computed(()=>V()),N=t.computed(()=>{if(!e.props.noTrailing)return e.props.trailingIcon}),s=t.computed(()=>({modelValue:G.cloneDeep(e.modelValue.value),open:G.cloneDeep(e.open.value)})),m=()=>{e.onOpenChange(!e.open.value)},l=a=>{console.log("event ===>",a),e.props.headerSearch},f=t.computed(()=>({disabled:e.getDisabled.value,tabindex:e.getDisabled.value||!e.props.headerSearch?-1:0,reference:e.props.reference,"data-disabled":e.getDisabled.value?"":void 0,"aria-disabled":e.getDisabled.value??void 0,"aria-label":"Show popup","aria-haspopup":"listbox","aria-expanded":e.open.value,"aria-controls":e.contentId,"data-state":e.open.value?"open":"closed",class:[P({size:e.getSize.value,status:e.getStatus.value==="success"&&Q.isEmpty(e.modelValue.value)?void 0:e.getStatus.value,bordered:e.props.bordered,multiple:e.props.multiple,contentFit:e.props.contentFit,wrapped:e.props.wrapped,filled:!Q.isEmpty(e.modelValue.value),headerSearch:e.props.headerSearch}),e.props.triggerCls],...o})),v=(a,T=k.value)=>t.h(_e._sfc_main,{icon:a,size:T}),h=()=>{var z;let a;const T=(z=n.triggerTrailing)==null?void 0:z.call(n,s.value);if(D.isEmptyElement(T)?N.value&&(a=v(N.value)):a=T,a)return t.h("div",{class:[c.getBemElement(i,"trailing"),e.props.triggerTrailingCls]},a)};return()=>{var y;const a=(y=n.trigger)==null?void 0:y.call(n,s.value),z=(()=>{if(D.isEmptyElement(a))return!1;const L=D.filterEmpty(a)??null,K=L.length===1?L[0]:L;return K?D.isValidElement(K)&&!D.isFragment(K):!0})();return t.h($.ComboboxAnchor,{...f.value,...e.comboboxTriggerBinding.value,asChild:z,as:z?"template":"button",key:String(z),onKeyUp:l,onClick:m},()=>{if(!D.isEmptyElement(a))return a;const L=O=>{var J,U;const R=e.getOptionByValue(O);return t.h(ve._sfc_main,{...R?((U=(J=e.props).getTagProps)==null?void 0:U.call(J,R))??{}:{},size:e.getTagSize.value})},K=O=>{var J,U;const R=e.getOptionByValue(O);return t.h(Ee._sfc_main,{...R?((U=(J=e.props).getTagProps)==null?void 0:U.call(J,R))??{}:{},size:e.getTagSize.value})},ce=()=>{if(!e.props.multiple&&!E.isArray(e.modelValue.value)&&e.modelValue.value&&(e.props.tagRenderMode&&["avatar","go"].includes(e.props.tagRenderMode)||M.value||e.props.leadingIcon)){let O;if(e.props.tagRenderMode==="avatar"?O=L(e.modelValue.value):e.props.tagRenderMode==="go"?O=K(e.modelValue.value):M.value?O=v(M.value):e.props.leadingIcon&&(O=v(e.props.leadingIcon)),!D.isEmptyElement(O))return t.h("div",{class:[c.getBemElement(i,"leading"),e.props.triggerLeadingCls]},O)}},de=()=>{const O=[],R=[c.getBemElement(i,"tags"),e.props.triggerContentCls,Q.isEmpty(e.modelValue.value)?e.props.triggerContentPlaceholderCls:e.props.triggerContentValueCls],U=(()=>{if(e.props.multiple&&E.isArray(e.modelValue.value)){if(e.props.tagRenderMode==="avatar")return t.h(ve._sfc_main$1,{maxCount:e.props.maxCount,size:e.getTagSize.value,closeable:!e.getDisabled.value,noPopover:!0,noWrap:!e.props.wrapped,class:R},()=>e.modelValue.value.map(L));if(e.props.tagRenderMode==="go")return t.h(Fe._sfc_main,{maxCount:e.props.maxCount,size:e.getTagSize.value,closeable:!e.getDisabled.value,noPopover:!0,noWrap:!e.props.wrapped,class:R},()=>e.modelValue.value.map(K));if(e.props.tagRenderMode==="chip")return t.h(Re._sfc_main,{maxCount:e.props.maxCount,size:e.getTagSize.value,color:"primary",closeable:!e.getDisabled.value,noPopover:!0,noWrap:!e.props.wrapped,class:R,onClose:p},()=>e.modelValue.value.map(H=>{var se,ne;const oe=()=>e.getLabelByValue(H),X=({size:ge})=>{const ee=V(e.getOptionByValue(H))??e.props.leadingIcon;return ee?v(ee,ge):null},Z=e.getOptionByValue(H);return t.h(Ke._sfc_main,{...Z?((ne=(se=e.props).getTagProps)==null?void 0:ne.call(se,Z))??{}:{},value:H,class:[c.getBemElement(i,"tag"),e.props.tagCls],closeIconCls:c.getBemElement(i,"tag__close")},{text:oe,leading:X})}))}})();return U&&O.push(U),e.props.headerSearch||O.push(t.h(Ie)),t.h("div",{class:c.getBemElement(i,"content")},O)},j=[],te=ce();D.isEmptyElement(te)||j.push(te),j.push(de());const le=h();return D.isEmptyElement(le)||j.push(le),j})}}}),tt=t.defineComponent({__name:"ComboboxLabel",setup(d){return(n,o)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(t.unref(c.getBemElement)(t.unref(w),"label"))},[t.renderSlot(n.$slots,"default")],2))}}),Se=t.defineComponent({name:ue.getComponentName("SelectOption"),props:{option:{type:[Object,String],required:!0}},slots:Object,setup(d,{slots:n}){const o=pe(),e=t.computed(()=>{switch(o.getSize.value){case"sm":return"2xsm";case"lg":return"sm";case"md":default:return"xsm"}}),p=t.computed(()=>o.getOptionValue(d.option)),i=t.computed(()=>o.getOptionNoCheckbox(d.option)),P=t.computed(()=>o.getOptionSingle(d.option)),k=t.computed(()=>o.getOptionLabel(d.option)),x=t.computed(()=>o.getOptionIcon(d.option)),V=t.computed(()=>o.props.tree?void 0:o.getOptionDescription(d.option)),M=t.computed(()=>o.getOptionDisabled(d.option)),N=t.computed(()=>o.isItemSelected(p.value)),s=c.getBemElement(w,"option"),m=()=>{if(!(o.props.tree||!p.value||M.value))if(o.props.multiple)if(P.value)o.setModelValue([p.value]),o.emit("select",p.value,!0);else{let l=E.isArray(o.modelValue.value)?o.modelValue.value:[];const f=l.includes(p.value);l.length===1&&o.getSingleByValue(l[0])&&p.value!==l[0]&&(l=[]),f?(o.setModelValue(l.filter(v=>v!==p.value)),o.emit("select",p.value,!0)):(o.setModelValue([...l,p.value]),o.emit("select",p.value,!1))}else o.setModelValue(p.value),o.emit("select",p.value,!0)};if(!d.option)throw new Error("option is required");return()=>{const l=v=>{var T,z,y,L,K;const h=[];!o.props.tree&&o.props.multiple&&o.props.checkbox&&!i.value&&h.push(t.h(Ue._sfc_main,{modelValue:N.value,size:v.checkboxSize,disabled:M.value}));const a=(T=n.leading)==null?void 0:T.call(n,{option:d.option});return D.isEmptyElement(a)?o.props.tagRenderMode==="avatar"?h.push(t.h(ve._sfc_main,{...((y=(z=o.props).getTagProps)==null?void 0:y.call(z,d.option))??{},size:o.getTagSize.value})):o.props.tagRenderMode==="go"?h.push(t.h(Ee._sfc_main,{...((K=(L=o.props).getTagProps)==null?void 0:K.call(L,d.option))??{},size:o.getTagSize.value})):x.value&&h.push(t.h(_e._sfc_main,{icon:x.value,size:e.value})):h.push(a),D.isEmptyElement(h)?null:h};return(()=>{const v=!!V.value;return t.h(je._sfc_main$1,{class:s,description:V.value,title:k.value,key:p.value,selected:N.value,unFocusable:!0,leadingCenter:!v,size:o.getSize.value,disabled:M.value,onClick:m},{leading:l,trailing:()=>{var h;return(h=n.trailing)==null?void 0:h.call(n,{option:d.option})}})})()}}}),ot=t.defineComponent({name:ue.getComponentName("ComboboxWrapper"),setup(d,{slots:n}){const o=$e(),e=$.injectComboboxRootContext(),p=t.ref();Me.useLazyLoading({target:p});const i=t.ref(),P=Ve.getPopoverPortalProps({triggerRef:i,props:o.props}),{getFlipOnDir:k,getDir:x}=E.useConfig(),V=k("reversePlacementOnDir"),M=x(),N=Ve.getPopoverContentProps({props:o.props,flip:V,emitsAsProps:o.emitsAsProps,_dir:M,controlAutoFocus:!1,extraPropNames:["bodyLock","position"]}),s=({key:r,getterKey:u,defaultValue:_,noReturnOption:B})=>b=>{const A=E.isFunction(_)?_(b):_;if(E.isObject(b)){const F=b[r]??A,W=u&&o.props[u];if(W){if(E.isString(W))return b[W]??F;if(E.isFunction(W))return W(b)??F}return F}return E.isString(b)&&!B?b??A:A},m=s({getterKey:"getValue",key:"value"}),l=s({getterKey:"getNoCheckbox",key:"noCheckbox"}),f=s({getterKey:"geSingle",key:"single",noReturnOption:!0}),v=s({getterKey:"getLabel",key:"label",defaultValue:m}),h=s({getterKey:"getIcon",key:"icon",noReturnOption:!0}),a=s({getterKey:"getDescription",key:"description",noReturnOption:!0}),T=s({getterKey:"getDisabled",key:"disabled",defaultValue:!1,noReturnOption:!0}),z=s({getterKey:"getGroupLabel",key:"label",noReturnOption:!0}),y=s({getterKey:"getGroupOptions",key:"options",noReturnOption:!0}),L=r=>{var u;if((u=o.props.options)!=null&&u.length)for(const _ of o.props.options){if(m(_)===r)return _;const B=y(_);if(B!=null&&B.length){for(const b of B)if(m(b)===r)return b}}return r},K=r=>{const u=L(r);return u?v(u)??r:r},ce=r=>{const u=L(r);return u?f(u)??!1:!1},{contains:de}=$.useFilter({sensitivity:"base"}),j=t.computed(()=>{const r=u=>u==null?void 0:u.map(_=>{const B=v(_),b=m(_),A=T(_),F=z(_),W=!o.searchModel.value||B&&de(B,o.searchModel.value),g=y(_),S=!o.props.tree||b;if(g&&S){const C=r(g);if(C!=null&&C.length||W)return{groupLabel:F,title:B,key:b,disabled:A,children:C,_option:_}}return W&&S?{title:B,key:b,disabled:A,_option:_}:null}).filter(Boolean);if(o.props.options)return r(o.props.options)}),{getDisabled:te,getStatus:le,getSize:O}=xe.useFormInput({getDisabled:()=>o.props.disabled,getSize:()=>o.props.size,getStatus:()=>o.props.status}),R=t.computed(()=>{switch(O.value){case"sm":return"xsm";case"lg":return"md";case"md":default:return"sm"}}),{inputBindings:J,rootBindings:U}=xe.UseInputDataStates({getDisabled:()=>te.value}),H=t.ref(),oe=()=>{var r,u,_,B,b,A,F;e.open.value&&e.inputElement.value&&(o.props.headerSearch&&((r=H.value)!=null&&r.input)?document.activeElement!==((u=H.value)==null?void 0:u.input)&&((b=(B=(_=H.value)==null?void 0:_.input)==null?void 0:B.focus)==null||b.call(B)):document.activeElement!==e.inputElement.value&&((F=(A=e.inputElement.value)==null?void 0:A.focus)==null||F.call(A)))},X=r=>{e.modelValue.value=r,o.emit("update:modelValue",r)},Z=r=>r===void 0?!1:Array.isArray(e.modelValue.value)?!!(r&&e.modelValue.value.includes(r)):e.modelValue.value===r;Pe({...o,getOptionValue:m,getOptionLabel:v,getOptionSingle:f,getOptionNoCheckbox:l,getOptionDescription:a,getOptionDisabled:T,getOptionIcon:h,getOptionByValue:L,isItemSelected:Z,getLabelByValue:K,getSingleByValue:ce,focusOnInput:oe,setModelValue:X,headerInputElement:H,getDisabled:te,getStatus:le,getSize:O,getTagSize:R,comboboxInputBinding:J,comboboxTriggerBinding:U,...e,modelValue:e.modelValue}),t.watch(()=>[o.props.clearOnChangeMultiple,o.props.multiple],()=>{o.props.clearOnChangeMultiple&&X(void 0)});const se=t.computed(()=>{const r=o.props.scrollContainerProps??{};return{...r,areaCls:[c.getBemElement(w,"scroll_area"),r==null?void 0:r.class,r==null?void 0:r.areaCls]}}),ne=c.getBemElement(w,"popup"),ge=he.cva(ne,{variants:{size:c.generateVariantClassList(ye,ne)}}),ee=r=>{if(Number(r)>0)return`${r}px`;if(typeof r=="string")return r},Te=t.computed(()=>ee(o.props.popupWidth)),ze=t.computed(()=>ee(o.props.popupHeight)),be=t.computed(()=>ee(o.props.minWidth)),Ce=t.computed(()=>({type:O.value==="sm"?"simple":"advance",...ie.omit(o.props.emptyProps??{},"class")})),Le=t.computed(()=>ie.omit(o.props.skeletonProps??{},"class")),{selectValues:De}=Xe({getValue:r=>r==null?void 0:r.key,getChildren:r=>r==null?void 0:r.children,getModel:()=>G.cloneDeep(e.modelValue.value),getData:()=>G.cloneDeep(j.value??[])});return()=>{var F,W;const r=g=>t.h(Se,{option:g},{trailing:n.optionTrailing,leading:n.optionLeading}),u=[];let _;if(o.props.tree){const S=E.isArray(e.modelValue.value)?e.modelValue.value:e.modelValue.value?[e.modelValue.value]:[];_=t.h(Ne._sfc_main,{data:j.value??[],selectable:!0,checkbox:o.props.multiple&&o.props.checkbox,multiple:o.props.multiple,defaultExpandAll:!0,syncCheckboxAndSelect:o.props.multiple,showLine:!0,modelValue:S,checkedKeys:S,onExpand:oe,onSelect:(C,q,I)=>{if(o.props.multiple){const Y=E.isArray(I)?I:[I];X(De(Y,q))}else X(I)},class:"w-full"},{title:C=>r(C._option)}),u.push(_)}else{let g=!1;const S=[];if((j.value??[]).forEach(C=>{var q;if((q=C.children)!=null&&q.length){const I=[];C.children.forEach(Y=>{const re=r(Y._option);Z(m(Y._option))&&o.props.sortSelectedItems?S.push(re):I.push(re)}),I.length&&((g||u.length)&&(u.push(t.h(fe._sfc_main)),g=!1),C.groupLabel&&u.push(t.h(tt,{class:o.props.labelCls},()=>C.groupLabel)),u.push(...I),g=!0)}else{const I=r(C._option);Z(m(C._option))&&o.props.sortSelectedItems?S.push(I):(g&&(u.push(t.h(fe._sfc_main)),g=!1),u.push(I))}}),o.props.sortSelectedItems&&S.length){const C=!!u.length;u.splice(0,0,...S),C&&u.splice(S.length,0,t.h(fe._sfc_main))}}const B=D.flattenChildrenByType(_?[_]:u,Se).filter(g=>{var S;return E.isObject(g==null?void 0:g.props)&&((S=g==null?void 0:g.props)==null?void 0:S.option)}),b=!!(o.props.tree&&((F=j.value)!=null&&F.length)||B!=null&&B.length),A=()=>{var S,C;const g=[];if(b||o.props.loading){const q=[];if(b&&q.push(...u),o.props.loading){const I=(S=n.loading)==null?void 0:S.call(n,{});if(!D.isEmptyElement(I))q.push(I);else{const Y=new Array(b?2:o.props.loadingRowCount).fill(1);q.push(...Y.map(()=>t.h(we._sfc_main,{size:O.value,class:[c.getBemElement(w,"skeleton"),o.props.skeletonCls],...Le.value})))}}g.push(t.h("div",{class:[c.getBemElement(w,"options"),o.props.optionsCls]},q))}else if(!b){const q=(C=n.empty)==null?void 0:C.call(n,Ce.value);D.isEmptyElement(q)?g.push(t.h(qe._sfc_main,{class:[c.getBemElement(w,"empty"),o.props.emptyCls],...Ce.value},{title:n.emptyTitle,description:n.emptyDescription,actions:n.emptyActions,image:n.emptyImage})):g.push(q)}return o.props.lazyLoading&&g.push(t.h("div",{class:c.getBemElement(w,"lazy_loading")},t.h("div",{class:c.getBemElement(w,"lazy_loading_trigger"),ref:p}))),g};return[t.h(et,{ref:i,...o.attrs,style:{...((W=o.attrs)==null?void 0:W.style)??{},"--ptc-combobox-trigger-min-w":be.value}},{trigger:n.trigger,triggerTrailing:n.triggerTrailing}),t.h($.ComboboxPortal,P.value,()=>t.h($.ComboboxContent,{...N.value,vShow:e.open.value,class:[ge(o.props),o.props.popupCls],style:{"--ptc-combobox-popup-width":o.props.samePopupWidth?void 0:Te.value,"--ptc-combobox-popup-height":ze.value,"--ptc-combobox-trigger-min-w":be.value},onClick:oe},()=>{var I,Y,re;const g=[],S=(I=n.header)==null?void 0:I.call(n,{}),C=!D.isEmptyElement(S);if(o.props.headerSearch||C){const me=[];C&&me.push(S),o.props.headerSearch&&me.push(t.h(Ie)),g.push(t.h("div",{class:c.getBemElement(w,"header")},me))}g.push(t.h(Ae._sfc_main,se.value,A));const q=(re=n.footer)==null?void 0:re.call(n,{isEmpty:!((Y=j.value)!=null&&Y.length),search:o.searchModel.value});return D.isEmptyElement(q)||g.push(t.h("div",{class:c.getBemElement(w,"footer")},q)),g}))]}}}),nt=t.defineComponent({...ue.getComponentOptions("Combobox"),__name:"Combobox",props:{size:{default:"md"},status:{},multiple:{type:Boolean,default:void 0},checkbox:{type:Boolean,default:!0},tagRenderMode:{default:"chip"},getTagProps:{},tree:{type:Boolean},contentFit:{type:Boolean},wrapped:{type:Boolean},sortSelectedItems:{type:Boolean},noTrailing:{type:Boolean},leadingIcon:{},trailingIcon:{default:"tabler:chevron-down"},selectedItemIconAsTrailingIcon:{type:Boolean,default:!0},maxCount:{},to:{},placeholder:{},indicatorIcon:{default:"tabler:check"},options:{},getDisabled:{},getLabel:{},getDescription:{},getValue:{},getNoCheckbox:{},geSingle:{},getGroupOptions:{},getGroupLabel:{},getIcon:{},placement:{default:"bottom-start"},reversePlacementOnDir:{},loading:{type:Boolean},skeletonProps:{},loadingRowCount:{default:10},lazyLoading:{type:Boolean},bordered:{type:Boolean,default:!0},clearOnChangeMultiple:{type:Boolean,default:!0},triggerCls:{},triggerLeadingCls:{},triggerContentCls:{},triggerContentPlaceholderCls:{},triggerContentValueCls:{},triggerTrailingCls:{},itemLeadingCls:{},optionCls:{},tagCls:{},popupCls:{},labelCls:{},optionsCls:{},optionTextCls:{},optionContentCls:{},emptyCls:{},skeletonCls:{},scrollContainerProps:{},emptyProps:{},samePopupWidth:{type:Boolean,default:!0},popupHeight:{default:384},popupWidth:{},minWidth:{},headerSearch:{type:Boolean},search:{},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:void 0},resetSearchTermOnBlur:{type:Boolean,default:!0},resetSearchTermOnSelect:{type:Boolean,default:!0},modelValue:{},defaultValue:{},dir:{},disabled:{type:Boolean,default:void 0},highlightOnHover:{type:Boolean},by:{},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},reference:{},forceMount:{type:Boolean,default:void 0},position:{default:"popper"},bodyLock:{type:Boolean},side:{},sideOffset:{default:4},align:{},alignOffset:{},avoidCollisions:{type:Boolean,default:void 0},collisionBoundary:{},collisionPadding:{default:4},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean,default:void 0},positionStrategy:{default:"fixed"},updatePositionStrategy:{},disableUpdateOnLayoutShift:{type:Boolean,default:void 0},prioritizePosition:{type:Boolean,default:void 0},disableOutsidePointerEvents:{type:Boolean},defer:{type:Boolean}},emits:["update:search","select","update:modelValue","highlight","update:open","escapeKeyDown","pointerDownOutside","focusOutside","interactOutside"],setup(d,{emit:n}){const o=d,e=n,p=$.useEmitAsProps(e),i=t.computed(()=>G.omitBy({...G.pick(o,"open","defaultOpen","defaultValue","modelValue","by","dir","multiple","disabled"),...G.pick(p,"onUpdate:modelValue","onUpdate:open"),ignoreFilter:!0},G.isUndefined)),P=Oe.useVModel(o,"search",e,{passive:o.search===void 0}),k=t.useSlots(),x=t.useAttrs();return He({attrs:x,props:o,emit:e,searchModel:P,emitsAsProps:p}),(V,M)=>(t.openBlock(),t.createBlock(t.unref($.ComboboxRoot),t.mergeProps(i.value,{class:t.unref(w)}),{default:t.withCtx(()=>[t.createVNode(t.unref(ot),null,t.createSlots({_:2},[t.renderList(Object.keys(k),N=>({name:N,fn:t.withCtx(s=>[t.renderSlot(V.$slots,N,t.normalizeProps(t.guardReactiveProps(s)))])}))]),1024)]),_:3},16,["class"]))}});exports.ComboboxSizes=ye;exports.ComboboxStatuses=ke;exports._sfc_main=nt;exports.injectComboboxContext=pe;exports.provideComboboxContext=Pe;
|