@nuxt/ui 2.11.1 → 2.12.0
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/module.d.mts +100 -28
- package/dist/module.d.ts +100 -28
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/data/Table.vue +26 -18
- package/dist/runtime/components/data/Table.vue.d.ts +21 -12
- package/dist/runtime/components/elements/Accordion.vue +8 -4
- package/dist/runtime/components/elements/Accordion.vue.d.ts +4 -4
- package/dist/runtime/components/elements/Alert.vue +8 -2
- package/dist/runtime/components/elements/Alert.vue.d.ts +5 -10
- package/dist/runtime/components/elements/Button.vue.d.ts +1 -1
- package/dist/runtime/components/elements/Chip.vue.d.ts +2 -2
- package/dist/runtime/components/elements/Dropdown.vue +64 -15
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +30 -2
- package/dist/runtime/components/elements/Link.vue +2 -2
- package/dist/runtime/components/forms/Form.vue +16 -7
- package/dist/runtime/components/forms/Form.vue.d.ts +1 -1
- package/dist/runtime/components/forms/Input.vue +1 -1
- package/dist/runtime/components/forms/Input.vue.d.ts +1 -1
- package/dist/runtime/components/forms/InputMenu.vue +410 -0
- package/dist/runtime/components/forms/InputMenu.vue.d.ts +331 -0
- package/dist/runtime/components/forms/RadioGroup.vue +1 -1
- package/dist/runtime/components/forms/Select.vue +1 -1
- package/dist/runtime/components/forms/Select.vue.d.ts +1 -1
- package/dist/runtime/components/forms/SelectMenu.vue +52 -19
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +28 -8
- package/dist/runtime/components/forms/Toggle.vue +1 -1
- package/dist/runtime/components/forms/Toggle.vue.d.ts +2 -1
- package/dist/runtime/components/navigation/Breadcrumb.vue +7 -4
- package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +3 -0
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/Pagination.vue +9 -4
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +9 -0
- package/dist/runtime/components/navigation/VerticalNavigation.vue +54 -37
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +7 -3
- package/dist/runtime/components/overlays/Modal.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Popover.vue +49 -13
- package/dist/runtime/components/overlays/Popover.vue.d.ts +14 -4
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +1 -1
- package/dist/runtime/composables/useShortcuts.mjs +3 -1
- package/dist/runtime/types/alert.d.ts +5 -0
- package/dist/runtime/types/breadcrumb.d.ts +1 -0
- package/dist/runtime/types/dropdown.d.ts +2 -0
- package/dist/runtime/types/form.d.ts +1 -0
- package/dist/runtime/types/vertical-navigation.d.ts +1 -0
- package/dist/runtime/ui.config/forms/input.mjs +12 -12
- package/dist/runtime/ui.config/forms/inputMenu.d.ts +64 -0
- package/dist/runtime/ui.config/forms/inputMenu.mjs +62 -0
- package/dist/runtime/ui.config/forms/selectMenu.d.ts +14 -12
- package/dist/runtime/ui.config/forms/selectMenu.mjs +7 -41
- package/dist/runtime/ui.config/index.d.ts +1 -0
- package/dist/runtime/ui.config/index.mjs +1 -0
- package/dist/runtime/ui.config/layout/card.mjs +1 -1
- package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +1 -0
- package/dist/runtime/ui.config/navigation/breadcrumb.mjs +1 -0
- package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +5 -0
- package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +5 -0
- package/dist/runtime/ui.config/popper.mjs +2 -1
- package/dist/runtime/utils/index.mjs +11 -3
- package/dist/runtime/utils/uid.mjs +2 -1
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +1 -1
- package/package.json +27 -24
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
import type { InputSize, InputVariant, PopperOptions } from '../../types';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
modelValue: {
|
|
5
|
+
type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
query: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
default: null;
|
|
11
|
+
};
|
|
12
|
+
by: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: undefined;
|
|
15
|
+
};
|
|
16
|
+
options: {
|
|
17
|
+
type: PropType<string[] | {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
disabled?: boolean | undefined;
|
|
20
|
+
}[]>;
|
|
21
|
+
default: () => never[];
|
|
22
|
+
};
|
|
23
|
+
id: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: null;
|
|
26
|
+
};
|
|
27
|
+
name: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
default: null;
|
|
30
|
+
};
|
|
31
|
+
required: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
icon: {
|
|
36
|
+
type: StringConstructor;
|
|
37
|
+
default: null;
|
|
38
|
+
};
|
|
39
|
+
loadingIcon: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
default: () => any;
|
|
42
|
+
};
|
|
43
|
+
leadingIcon: {
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
default: null;
|
|
46
|
+
};
|
|
47
|
+
trailingIcon: {
|
|
48
|
+
type: StringConstructor;
|
|
49
|
+
default: () => any;
|
|
50
|
+
};
|
|
51
|
+
trailing: {
|
|
52
|
+
type: BooleanConstructor;
|
|
53
|
+
default: boolean;
|
|
54
|
+
};
|
|
55
|
+
leading: {
|
|
56
|
+
type: BooleanConstructor;
|
|
57
|
+
default: boolean;
|
|
58
|
+
};
|
|
59
|
+
loading: {
|
|
60
|
+
type: BooleanConstructor;
|
|
61
|
+
default: boolean;
|
|
62
|
+
};
|
|
63
|
+
selectedIcon: {
|
|
64
|
+
type: StringConstructor;
|
|
65
|
+
default: () => any;
|
|
66
|
+
};
|
|
67
|
+
disabled: {
|
|
68
|
+
type: BooleanConstructor;
|
|
69
|
+
default: boolean;
|
|
70
|
+
};
|
|
71
|
+
placeholder: {
|
|
72
|
+
type: StringConstructor;
|
|
73
|
+
default: null;
|
|
74
|
+
};
|
|
75
|
+
padded: {
|
|
76
|
+
type: BooleanConstructor;
|
|
77
|
+
default: boolean;
|
|
78
|
+
};
|
|
79
|
+
size: {
|
|
80
|
+
type: PropType<InputSize>;
|
|
81
|
+
default: null;
|
|
82
|
+
validator(value: string): boolean;
|
|
83
|
+
};
|
|
84
|
+
color: {
|
|
85
|
+
type: PropType<any>;
|
|
86
|
+
default: () => any;
|
|
87
|
+
validator(value: string): boolean;
|
|
88
|
+
};
|
|
89
|
+
variant: {
|
|
90
|
+
type: PropType<InputVariant>;
|
|
91
|
+
default: () => any;
|
|
92
|
+
validator(value: string): boolean;
|
|
93
|
+
};
|
|
94
|
+
optionAttribute: {
|
|
95
|
+
type: StringConstructor;
|
|
96
|
+
default: string;
|
|
97
|
+
};
|
|
98
|
+
valueAttribute: {
|
|
99
|
+
type: StringConstructor;
|
|
100
|
+
default: null;
|
|
101
|
+
};
|
|
102
|
+
search: {
|
|
103
|
+
type: PropType<(query: string) => Promise<any[]> | any[]>;
|
|
104
|
+
default: undefined;
|
|
105
|
+
};
|
|
106
|
+
searchAttributes: {
|
|
107
|
+
type: ArrayConstructor;
|
|
108
|
+
default: null;
|
|
109
|
+
};
|
|
110
|
+
debounce: {
|
|
111
|
+
type: NumberConstructor;
|
|
112
|
+
default: number;
|
|
113
|
+
};
|
|
114
|
+
popper: {
|
|
115
|
+
type: PropType<PopperOptions>;
|
|
116
|
+
default: () => {};
|
|
117
|
+
};
|
|
118
|
+
inputClass: {
|
|
119
|
+
type: StringConstructor;
|
|
120
|
+
default: null;
|
|
121
|
+
};
|
|
122
|
+
class: {
|
|
123
|
+
type: PropType<any>;
|
|
124
|
+
default: () => "";
|
|
125
|
+
};
|
|
126
|
+
ui: {
|
|
127
|
+
type: PropType<any>;
|
|
128
|
+
default: () => {};
|
|
129
|
+
};
|
|
130
|
+
uiMenu: {
|
|
131
|
+
type: PropType<any>;
|
|
132
|
+
default: () => {};
|
|
133
|
+
};
|
|
134
|
+
}, {
|
|
135
|
+
ui: import("vue").ComputedRef<any>;
|
|
136
|
+
uiMenu: import("vue").ComputedRef<any>;
|
|
137
|
+
attrs: import("vue").ComputedRef<Pick<{
|
|
138
|
+
[x: string]: unknown;
|
|
139
|
+
}, string>>;
|
|
140
|
+
name: import("vue").ComputedRef<string | undefined>;
|
|
141
|
+
inputId: import("vue").Ref<string | undefined>;
|
|
142
|
+
popper: import("vue").ComputedRef<PopperOptions>;
|
|
143
|
+
trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
144
|
+
container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
145
|
+
isLeading: import("vue").ComputedRef<string | true>;
|
|
146
|
+
isTrailing: import("vue").ComputedRef<string | true | undefined>;
|
|
147
|
+
inputClass: import("vue").ComputedRef<string>;
|
|
148
|
+
leadingIconName: import("vue").ComputedRef<string | undefined>;
|
|
149
|
+
leadingIconClass: import("vue").ComputedRef<string>;
|
|
150
|
+
leadingWrapperIconClass: import("vue").ComputedRef<string>;
|
|
151
|
+
trailingIconName: import("vue").ComputedRef<string | undefined>;
|
|
152
|
+
trailingIconClass: import("vue").ComputedRef<string>;
|
|
153
|
+
trailingWrapperIconClass: import("vue").ComputedRef<string>;
|
|
154
|
+
filteredOptions: import("vue").Ref<any[]>;
|
|
155
|
+
query: import("vue").WritableComputedRef<string>;
|
|
156
|
+
onUpdate: (event: any) => void;
|
|
157
|
+
onChange: (event: any) => void;
|
|
158
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "update:modelValue" | "open" | "update:query")[], "change" | "close" | "update:modelValue" | "open" | "update:query", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
159
|
+
modelValue: {
|
|
160
|
+
type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
|
|
161
|
+
default: string;
|
|
162
|
+
};
|
|
163
|
+
query: {
|
|
164
|
+
type: StringConstructor;
|
|
165
|
+
default: null;
|
|
166
|
+
};
|
|
167
|
+
by: {
|
|
168
|
+
type: StringConstructor;
|
|
169
|
+
default: undefined;
|
|
170
|
+
};
|
|
171
|
+
options: {
|
|
172
|
+
type: PropType<string[] | {
|
|
173
|
+
[key: string]: any;
|
|
174
|
+
disabled?: boolean | undefined;
|
|
175
|
+
}[]>;
|
|
176
|
+
default: () => never[];
|
|
177
|
+
};
|
|
178
|
+
id: {
|
|
179
|
+
type: StringConstructor;
|
|
180
|
+
default: null;
|
|
181
|
+
};
|
|
182
|
+
name: {
|
|
183
|
+
type: StringConstructor;
|
|
184
|
+
default: null;
|
|
185
|
+
};
|
|
186
|
+
required: {
|
|
187
|
+
type: BooleanConstructor;
|
|
188
|
+
default: boolean;
|
|
189
|
+
};
|
|
190
|
+
icon: {
|
|
191
|
+
type: StringConstructor;
|
|
192
|
+
default: null;
|
|
193
|
+
};
|
|
194
|
+
loadingIcon: {
|
|
195
|
+
type: StringConstructor;
|
|
196
|
+
default: () => any;
|
|
197
|
+
};
|
|
198
|
+
leadingIcon: {
|
|
199
|
+
type: StringConstructor;
|
|
200
|
+
default: null;
|
|
201
|
+
};
|
|
202
|
+
trailingIcon: {
|
|
203
|
+
type: StringConstructor;
|
|
204
|
+
default: () => any;
|
|
205
|
+
};
|
|
206
|
+
trailing: {
|
|
207
|
+
type: BooleanConstructor;
|
|
208
|
+
default: boolean;
|
|
209
|
+
};
|
|
210
|
+
leading: {
|
|
211
|
+
type: BooleanConstructor;
|
|
212
|
+
default: boolean;
|
|
213
|
+
};
|
|
214
|
+
loading: {
|
|
215
|
+
type: BooleanConstructor;
|
|
216
|
+
default: boolean;
|
|
217
|
+
};
|
|
218
|
+
selectedIcon: {
|
|
219
|
+
type: StringConstructor;
|
|
220
|
+
default: () => any;
|
|
221
|
+
};
|
|
222
|
+
disabled: {
|
|
223
|
+
type: BooleanConstructor;
|
|
224
|
+
default: boolean;
|
|
225
|
+
};
|
|
226
|
+
placeholder: {
|
|
227
|
+
type: StringConstructor;
|
|
228
|
+
default: null;
|
|
229
|
+
};
|
|
230
|
+
padded: {
|
|
231
|
+
type: BooleanConstructor;
|
|
232
|
+
default: boolean;
|
|
233
|
+
};
|
|
234
|
+
size: {
|
|
235
|
+
type: PropType<InputSize>;
|
|
236
|
+
default: null;
|
|
237
|
+
validator(value: string): boolean;
|
|
238
|
+
};
|
|
239
|
+
color: {
|
|
240
|
+
type: PropType<any>;
|
|
241
|
+
default: () => any;
|
|
242
|
+
validator(value: string): boolean;
|
|
243
|
+
};
|
|
244
|
+
variant: {
|
|
245
|
+
type: PropType<InputVariant>;
|
|
246
|
+
default: () => any;
|
|
247
|
+
validator(value: string): boolean;
|
|
248
|
+
};
|
|
249
|
+
optionAttribute: {
|
|
250
|
+
type: StringConstructor;
|
|
251
|
+
default: string;
|
|
252
|
+
};
|
|
253
|
+
valueAttribute: {
|
|
254
|
+
type: StringConstructor;
|
|
255
|
+
default: null;
|
|
256
|
+
};
|
|
257
|
+
search: {
|
|
258
|
+
type: PropType<(query: string) => Promise<any[]> | any[]>;
|
|
259
|
+
default: undefined;
|
|
260
|
+
};
|
|
261
|
+
searchAttributes: {
|
|
262
|
+
type: ArrayConstructor;
|
|
263
|
+
default: null;
|
|
264
|
+
};
|
|
265
|
+
debounce: {
|
|
266
|
+
type: NumberConstructor;
|
|
267
|
+
default: number;
|
|
268
|
+
};
|
|
269
|
+
popper: {
|
|
270
|
+
type: PropType<PopperOptions>;
|
|
271
|
+
default: () => {};
|
|
272
|
+
};
|
|
273
|
+
inputClass: {
|
|
274
|
+
type: StringConstructor;
|
|
275
|
+
default: null;
|
|
276
|
+
};
|
|
277
|
+
class: {
|
|
278
|
+
type: PropType<any>;
|
|
279
|
+
default: () => "";
|
|
280
|
+
};
|
|
281
|
+
ui: {
|
|
282
|
+
type: PropType<any>;
|
|
283
|
+
default: () => {};
|
|
284
|
+
};
|
|
285
|
+
uiMenu: {
|
|
286
|
+
type: PropType<any>;
|
|
287
|
+
default: () => {};
|
|
288
|
+
};
|
|
289
|
+
}>> & {
|
|
290
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
291
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
292
|
+
onClose?: ((...args: any[]) => any) | undefined;
|
|
293
|
+
onOpen?: ((...args: any[]) => any) | undefined;
|
|
294
|
+
"onUpdate:query"?: ((...args: any[]) => any) | undefined;
|
|
295
|
+
}, {
|
|
296
|
+
size: InputSize;
|
|
297
|
+
ui: any;
|
|
298
|
+
id: string;
|
|
299
|
+
icon: string;
|
|
300
|
+
color: any;
|
|
301
|
+
options: string[] | {
|
|
302
|
+
[key: string]: any;
|
|
303
|
+
disabled?: boolean | undefined;
|
|
304
|
+
}[];
|
|
305
|
+
popper: PopperOptions;
|
|
306
|
+
name: string;
|
|
307
|
+
leading: boolean;
|
|
308
|
+
search: (query: string) => Promise<any[]> | any[];
|
|
309
|
+
class: any;
|
|
310
|
+
modelValue: string | number | unknown[] | Record<string, any>;
|
|
311
|
+
by: string;
|
|
312
|
+
loading: boolean;
|
|
313
|
+
disabled: boolean;
|
|
314
|
+
variant: InputVariant;
|
|
315
|
+
required: boolean;
|
|
316
|
+
placeholder: string;
|
|
317
|
+
padded: boolean;
|
|
318
|
+
loadingIcon: string;
|
|
319
|
+
leadingIcon: string;
|
|
320
|
+
trailingIcon: string;
|
|
321
|
+
trailing: boolean;
|
|
322
|
+
inputClass: string;
|
|
323
|
+
query: string;
|
|
324
|
+
selectedIcon: string;
|
|
325
|
+
optionAttribute: string;
|
|
326
|
+
valueAttribute: string;
|
|
327
|
+
searchAttributes: unknown[];
|
|
328
|
+
debounce: number;
|
|
329
|
+
uiMenu: any;
|
|
330
|
+
}, {}>;
|
|
331
|
+
export default _default;
|
|
@@ -228,6 +228,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
228
228
|
color: any;
|
|
229
229
|
options: unknown[];
|
|
230
230
|
name: string;
|
|
231
|
+
leading: boolean;
|
|
231
232
|
class: any;
|
|
232
233
|
modelValue: string | number | Record<string, any>;
|
|
233
234
|
loading: boolean;
|
|
@@ -240,7 +241,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
240
241
|
leadingIcon: string;
|
|
241
242
|
trailingIcon: string;
|
|
242
243
|
trailing: boolean;
|
|
243
|
-
leading: boolean;
|
|
244
244
|
optionAttribute: string;
|
|
245
245
|
valueAttribute: string;
|
|
246
246
|
selectClass: string;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:name="name"
|
|
7
7
|
:model-value="modelValue"
|
|
8
8
|
:multiple="multiple"
|
|
9
|
-
:disabled="disabled
|
|
9
|
+
:disabled="disabled"
|
|
10
10
|
as="div"
|
|
11
11
|
:class="ui.wrapper"
|
|
12
12
|
@update:model-value="onUpdate"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
:class="uiMenu.trigger"
|
|
29
29
|
>
|
|
30
30
|
<slot :open="open" :disabled="disabled" :loading="loading">
|
|
31
|
-
<button :id="inputId" :class="selectClass" :disabled="disabled
|
|
31
|
+
<button :id="inputId" :class="selectClass" :disabled="disabled" type="button" v-bind="attrs">
|
|
32
32
|
<span v-if="(isLeading && leadingIconName) || $slots.leading" :class="leadingWrapperIconClass">
|
|
33
33
|
<slot name="leading" :disabled="disabled" :loading="loading">
|
|
34
34
|
<UIcon :name="leadingIconName" :class="leadingIconClass" />
|
|
@@ -58,14 +58,13 @@
|
|
|
58
58
|
<component :is="searchable ? 'HComboboxOptions' : 'HListboxOptions'" static :class="[uiMenu.base, uiMenu.ring, uiMenu.rounded, uiMenu.shadow, uiMenu.background, uiMenu.padding, uiMenu.height]">
|
|
59
59
|
<HComboboxInput
|
|
60
60
|
v-if="searchable"
|
|
61
|
-
ref="searchInput"
|
|
62
61
|
:display-value="() => query"
|
|
63
62
|
name="q"
|
|
64
63
|
:placeholder="searchablePlaceholder"
|
|
65
64
|
autofocus
|
|
66
65
|
autocomplete="off"
|
|
67
66
|
:class="uiMenu.input"
|
|
68
|
-
@change="
|
|
67
|
+
@change="onChange"
|
|
69
68
|
/>
|
|
70
69
|
<component
|
|
71
70
|
:is="searchable ? 'HComboboxOption' : 'HListboxOption'"
|
|
@@ -98,11 +97,11 @@
|
|
|
98
97
|
</li>
|
|
99
98
|
</component>
|
|
100
99
|
|
|
101
|
-
<component :is="searchable ? 'HComboboxOption' : 'HListboxOption'" v-if="creatable &&
|
|
100
|
+
<component :is="searchable ? 'HComboboxOption' : 'HListboxOption'" v-if="creatable && createOption" v-slot="{ active, selected }" :value="createOption" as="template">
|
|
102
101
|
<li :class="[uiMenu.option.base, uiMenu.option.rounded, uiMenu.option.padding, uiMenu.option.size, uiMenu.option.color, active ? uiMenu.option.active : uiMenu.option.inactive]">
|
|
103
102
|
<div :class="uiMenu.option.container">
|
|
104
|
-
<slot name="option-create" :option="
|
|
105
|
-
<span :class="uiMenu.option.create">Create "{{
|
|
103
|
+
<slot name="option-create" :option="createOption" :active="active" :selected="selected">
|
|
104
|
+
<span :class="uiMenu.option.create">Create "{{ createOption[optionAttribute] }}"</span>
|
|
106
105
|
</slot>
|
|
107
106
|
</div>
|
|
108
107
|
</li>
|
|
@@ -112,6 +111,11 @@
|
|
|
112
111
|
No results for "{{ query }}".
|
|
113
112
|
</slot>
|
|
114
113
|
</p>
|
|
114
|
+
<p v-else-if="!filteredOptions.length" :class="uiMenu.empty">
|
|
115
|
+
<slot name="empty" :query="query">
|
|
116
|
+
No options.
|
|
117
|
+
</slot>
|
|
118
|
+
</p>
|
|
115
119
|
</component>
|
|
116
120
|
</div>
|
|
117
121
|
</Transition>
|
|
@@ -166,6 +170,10 @@ export default defineComponent({
|
|
|
166
170
|
type: [String, Number, Object, Array],
|
|
167
171
|
default: ""
|
|
168
172
|
},
|
|
173
|
+
query: {
|
|
174
|
+
type: String,
|
|
175
|
+
default: null
|
|
176
|
+
},
|
|
169
177
|
by: {
|
|
170
178
|
type: String,
|
|
171
179
|
default: void 0
|
|
@@ -236,7 +244,7 @@ export default defineComponent({
|
|
|
236
244
|
},
|
|
237
245
|
clearSearchOnClose: {
|
|
238
246
|
type: Boolean,
|
|
239
|
-
default: () => configMenu.default.
|
|
247
|
+
default: () => configMenu.default.clearSearchOnClose
|
|
240
248
|
},
|
|
241
249
|
debounce: {
|
|
242
250
|
type: Number,
|
|
@@ -246,6 +254,10 @@ export default defineComponent({
|
|
|
246
254
|
type: Boolean,
|
|
247
255
|
default: false
|
|
248
256
|
},
|
|
257
|
+
showCreateOptionWhen: {
|
|
258
|
+
type: String,
|
|
259
|
+
default: () => configMenu.default.showCreateOptionWhen
|
|
260
|
+
},
|
|
249
261
|
placeholder: {
|
|
250
262
|
type: String,
|
|
251
263
|
default: null
|
|
@@ -311,7 +323,7 @@ export default defineComponent({
|
|
|
311
323
|
default: () => ({})
|
|
312
324
|
}
|
|
313
325
|
},
|
|
314
|
-
emits: ["update:modelValue", "open", "close", "change"],
|
|
326
|
+
emits: ["update:modelValue", "update:query", "open", "close", "change"],
|
|
315
327
|
setup(props, { emit, slots }) {
|
|
316
328
|
const { ui, attrs } = useUI("select", toRef(props, "ui"), config, toRef(props, "class"));
|
|
317
329
|
const { ui: uiMenu } = useUI("selectMenu", toRef(props, "uiMenu"), configMenu);
|
|
@@ -320,8 +332,16 @@ export default defineComponent({
|
|
|
320
332
|
const { size: sizeButtonGroup, rounded } = useInjectButtonGroup({ ui, props });
|
|
321
333
|
const { emitFormBlur, emitFormChange, inputId, color, size: sizeFormGroup, name } = useFormGroup(props, config);
|
|
322
334
|
const size = computed(() => sizeButtonGroup.value || sizeFormGroup.value);
|
|
323
|
-
const
|
|
324
|
-
const
|
|
335
|
+
const internalQuery = ref("");
|
|
336
|
+
const query = computed({
|
|
337
|
+
get() {
|
|
338
|
+
return props.query ?? internalQuery.value;
|
|
339
|
+
},
|
|
340
|
+
set(value) {
|
|
341
|
+
internalQuery.value = value;
|
|
342
|
+
emit("update:query", value);
|
|
343
|
+
}
|
|
344
|
+
});
|
|
325
345
|
const selectClass = computed(() => {
|
|
326
346
|
const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
|
|
327
347
|
return twMerge(twJoin(
|
|
@@ -402,8 +422,20 @@ export default defineComponent({
|
|
|
402
422
|
});
|
|
403
423
|
});
|
|
404
424
|
});
|
|
405
|
-
const
|
|
406
|
-
|
|
425
|
+
const createOption = computed(() => {
|
|
426
|
+
if (query.value === "") {
|
|
427
|
+
return null;
|
|
428
|
+
}
|
|
429
|
+
if (props.showCreateOptionWhen === "empty" && filteredOptions.value.length) {
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
if (props.showCreateOptionWhen === "always") {
|
|
433
|
+
const existingOption = filteredOptions.value.find((option) => ["string", "number"].includes(typeof option) ? option === query.value : option[props.optionAttribute] === query.value);
|
|
434
|
+
if (existingOption) {
|
|
435
|
+
return null;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return ["string", "number"].includes(typeof props.modelValue) ? query.value : { [props.optionAttribute]: query.value };
|
|
407
439
|
});
|
|
408
440
|
function clearOnClose() {
|
|
409
441
|
if (props.clearSearchOnClose) {
|
|
@@ -420,14 +452,13 @@ export default defineComponent({
|
|
|
420
452
|
}
|
|
421
453
|
});
|
|
422
454
|
function onUpdate(event) {
|
|
423
|
-
if (query.value && searchInput.value?.$el) {
|
|
424
|
-
query.value = "";
|
|
425
|
-
searchInput.value.$el.value = "";
|
|
426
|
-
}
|
|
427
455
|
emit("update:modelValue", event);
|
|
428
456
|
emit("change", event);
|
|
429
457
|
emitFormChange();
|
|
430
458
|
}
|
|
459
|
+
function onChange(event) {
|
|
460
|
+
query.value = event.target.value;
|
|
461
|
+
}
|
|
431
462
|
return {
|
|
432
463
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
433
464
|
ui,
|
|
@@ -452,9 +483,11 @@ export default defineComponent({
|
|
|
452
483
|
trailingIconClass,
|
|
453
484
|
trailingWrapperIconClass,
|
|
454
485
|
filteredOptions,
|
|
455
|
-
|
|
486
|
+
createOption,
|
|
487
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
456
488
|
query,
|
|
457
|
-
onUpdate
|
|
489
|
+
onUpdate,
|
|
490
|
+
onChange
|
|
458
491
|
};
|
|
459
492
|
}
|
|
460
493
|
});
|
|
@@ -5,6 +5,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
5
5
|
type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
|
|
6
6
|
default: string;
|
|
7
7
|
};
|
|
8
|
+
query: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
default: null;
|
|
11
|
+
};
|
|
8
12
|
by: {
|
|
9
13
|
type: StringConstructor;
|
|
10
14
|
default: undefined;
|
|
@@ -88,6 +92,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
88
92
|
type: BooleanConstructor;
|
|
89
93
|
default: boolean;
|
|
90
94
|
};
|
|
95
|
+
showCreateOptionWhen: {
|
|
96
|
+
type: PropType<"empty" | "always">;
|
|
97
|
+
default: () => any;
|
|
98
|
+
};
|
|
91
99
|
placeholder: {
|
|
92
100
|
type: StringConstructor;
|
|
93
101
|
default: null;
|
|
@@ -164,16 +172,21 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
164
172
|
trailingIconClass: import("vue").ComputedRef<string>;
|
|
165
173
|
trailingWrapperIconClass: import("vue").ComputedRef<string>;
|
|
166
174
|
filteredOptions: import("vue").Ref<any[]>;
|
|
167
|
-
|
|
175
|
+
createOption: import("vue").ComputedRef<string | {
|
|
168
176
|
[x: string]: string;
|
|
169
177
|
} | null>;
|
|
170
|
-
query: import("vue").
|
|
178
|
+
query: import("vue").WritableComputedRef<string>;
|
|
171
179
|
onUpdate: (event: any) => void;
|
|
172
|
-
|
|
180
|
+
onChange: (event: any) => void;
|
|
181
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "update:modelValue" | "open" | "update:query")[], "change" | "close" | "update:modelValue" | "open" | "update:query", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
173
182
|
modelValue: {
|
|
174
183
|
type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
|
|
175
184
|
default: string;
|
|
176
185
|
};
|
|
186
|
+
query: {
|
|
187
|
+
type: StringConstructor;
|
|
188
|
+
default: null;
|
|
189
|
+
};
|
|
177
190
|
by: {
|
|
178
191
|
type: StringConstructor;
|
|
179
192
|
default: undefined;
|
|
@@ -257,6 +270,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
257
270
|
type: BooleanConstructor;
|
|
258
271
|
default: boolean;
|
|
259
272
|
};
|
|
273
|
+
showCreateOptionWhen: {
|
|
274
|
+
type: PropType<"empty" | "always">;
|
|
275
|
+
default: () => any;
|
|
276
|
+
};
|
|
260
277
|
placeholder: {
|
|
261
278
|
type: StringConstructor;
|
|
262
279
|
default: null;
|
|
@@ -317,6 +334,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
317
334
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
318
335
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
319
336
|
onOpen?: ((...args: any[]) => any) | undefined;
|
|
337
|
+
"onUpdate:query"?: ((...args: any[]) => any) | undefined;
|
|
320
338
|
}, {
|
|
321
339
|
size: SelectSize;
|
|
322
340
|
ui: any;
|
|
@@ -329,6 +347,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
329
347
|
}[];
|
|
330
348
|
popper: PopperOptions;
|
|
331
349
|
name: string;
|
|
350
|
+
leading: boolean;
|
|
332
351
|
class: any;
|
|
333
352
|
modelValue: string | number | unknown[] | Record<string, any>;
|
|
334
353
|
by: string;
|
|
@@ -343,17 +362,18 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
343
362
|
leadingIcon: string;
|
|
344
363
|
trailingIcon: string;
|
|
345
364
|
trailing: boolean;
|
|
346
|
-
|
|
365
|
+
query: string;
|
|
366
|
+
selectedIcon: string;
|
|
347
367
|
optionAttribute: string;
|
|
348
368
|
valueAttribute: string;
|
|
369
|
+
searchAttributes: unknown[];
|
|
370
|
+
debounce: number;
|
|
371
|
+
uiMenu: any;
|
|
349
372
|
selectClass: string;
|
|
350
|
-
selectedIcon: string;
|
|
351
373
|
searchable: boolean | ((query: string) => Promise<any[]> | any[]);
|
|
352
374
|
searchablePlaceholder: string;
|
|
353
375
|
clearSearchOnClose: boolean;
|
|
354
|
-
debounce: number;
|
|
355
376
|
creatable: boolean;
|
|
356
|
-
|
|
357
|
-
uiMenu: any;
|
|
377
|
+
showCreateOptionWhen: "empty" | "always";
|
|
358
378
|
}, {}>;
|
|
359
379
|
export default _default;
|
|
@@ -83,7 +83,7 @@ export default defineComponent({
|
|
|
83
83
|
default: () => ({})
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
|
-
emits: ["update:modelValue"],
|
|
86
|
+
emits: ["update:modelValue", "change"],
|
|
87
87
|
setup(props, { emit }) {
|
|
88
88
|
const { ui, attrs } = useUI("toggle", toRef(props, "ui"), config);
|
|
89
89
|
const { emitFormChange, color, inputId, name } = useFormGroup(props);
|
|
@@ -55,7 +55,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
55
55
|
containerClass: import("vue").ComputedRef<string>;
|
|
56
56
|
onIconClass: import("vue").ComputedRef<string>;
|
|
57
57
|
offIconClass: import("vue").ComputedRef<string>;
|
|
58
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
58
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue")[], "change" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
59
59
|
id: {
|
|
60
60
|
type: StringConstructor;
|
|
61
61
|
default: null;
|
|
@@ -100,6 +100,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
100
100
|
};
|
|
101
101
|
}>> & {
|
|
102
102
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
103
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
103
104
|
}, {
|
|
104
105
|
size: ToggleSize;
|
|
105
106
|
ui: any;
|