@nuxt/ui 2.17.0 → 2.18.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 +3 -1988
- package/dist/module.d.ts +3 -1988
- package/dist/module.json +6 -2
- package/dist/module.mjs +6 -71
- package/dist/runtime/components/data/Table.vue +54 -19
- package/dist/runtime/components/data/Table.vue.d.ts +247 -48
- package/dist/runtime/components/elements/Accordion.vue +1 -2
- package/dist/runtime/components/elements/Accordion.vue.d.ts +140 -14
- package/dist/runtime/components/elements/Alert.vue +2 -4
- package/dist/runtime/components/elements/Alert.vue.d.ts +107 -24
- package/dist/runtime/components/elements/Avatar.vue +1 -1
- package/dist/runtime/components/elements/Avatar.vue.d.ts +153 -32
- package/dist/runtime/components/elements/AvatarGroup.d.ts +17 -8
- package/dist/runtime/components/elements/{AvatarGroup.mjs → AvatarGroup.js} +2 -2
- package/dist/runtime/components/elements/Badge.vue.d.ts +55 -18
- package/dist/runtime/components/elements/Button.vue +1 -2
- package/dist/runtime/components/elements/Button.vue.d.ts +259 -96
- package/dist/runtime/components/elements/ButtonGroup.d.ts +110 -6
- package/dist/runtime/components/elements/{ButtonGroup.mjs → ButtonGroup.js} +3 -3
- package/dist/runtime/components/elements/Carousel.vue.d.ts +75 -20
- package/dist/runtime/components/elements/Chip.vue.d.ts +97 -25
- package/dist/runtime/components/elements/Dropdown.vue +4 -9
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +135 -16
- package/dist/runtime/components/elements/Kbd.vue.d.ts +45 -10
- package/dist/runtime/components/elements/Link.vue.d.ts +73 -73
- package/dist/runtime/components/elements/Meter.vue +1 -1
- package/dist/runtime/components/elements/Meter.vue.d.ts +178 -22
- package/dist/runtime/components/elements/MeterGroup.d.ts +70 -13
- package/dist/runtime/components/elements/{MeterGroup.mjs → MeterGroup.js} +3 -3
- package/dist/runtime/components/elements/Progress.vue +7 -2
- package/dist/runtime/components/elements/Progress.vue.d.ts +187 -31
- package/dist/runtime/components/forms/Checkbox.vue +5 -3
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +76 -35
- package/dist/runtime/components/forms/Form.vue +1 -2
- package/dist/runtime/components/forms/Form.vue.d.ts +12 -11
- package/dist/runtime/components/forms/FormGroup.vue +1 -1
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +80 -27
- package/dist/runtime/components/forms/Input.vue +2 -2
- package/dist/runtime/components/forms/Input.vue.d.ts +276 -59
- package/dist/runtime/components/forms/InputMenu.vue +12 -10
- package/dist/runtime/components/forms/InputMenu.vue.d.ts +434 -84
- package/dist/runtime/components/forms/Radio.vue +5 -3
- package/dist/runtime/components/forms/Radio.vue.d.ts +74 -35
- package/dist/runtime/components/forms/RadioGroup.vue +11 -3
- package/dist/runtime/components/forms/RadioGroup.vue.d.ts +85 -27
- package/dist/runtime/components/forms/Range.vue.d.ts +155 -26
- package/dist/runtime/components/forms/Select.vue +2 -2
- package/dist/runtime/components/forms/Select.vue.d.ts +273 -50
- package/dist/runtime/components/forms/SelectMenu.vue +50 -25
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +451 -86
- package/dist/runtime/components/forms/Textarea.vue.d.ts +263 -48
- package/dist/runtime/components/forms/Toggle.vue +1 -1
- package/dist/runtime/components/forms/Toggle.vue.d.ts +153 -26
- package/dist/runtime/components/layout/Card.vue.d.ts +55 -5
- package/dist/runtime/components/layout/Container.vue.d.ts +19 -5
- package/dist/runtime/components/layout/Divider.vue +1 -2
- package/dist/runtime/components/layout/Divider.vue.d.ts +121 -16
- package/dist/runtime/components/layout/Skeleton.vue +5 -1
- package/dist/runtime/components/layout/Skeleton.vue.d.ts +27 -4
- package/dist/runtime/components/navigation/Breadcrumb.vue +1 -2
- package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +52 -9
- package/dist/runtime/components/navigation/CommandPalette.vue +8 -6
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +198 -40
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue +1 -3
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +5 -7
- package/dist/runtime/components/navigation/HorizontalNavigation.vue +1 -4
- package/dist/runtime/components/navigation/HorizontalNavigation.vue.d.ts +64 -9
- package/dist/runtime/components/navigation/Pagination.vue +2 -4
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +84 -12
- package/dist/runtime/components/navigation/Tabs.vue +10 -0
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +86 -15
- package/dist/runtime/components/navigation/VerticalNavigation.vue +1 -5
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +78 -9
- package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +71 -8
- package/dist/runtime/components/overlays/Modal.vue.d.ts +85 -11
- package/dist/runtime/components/overlays/Notification.vue +2 -4
- package/dist/runtime/components/overlays/Notification.vue.d.ts +130 -29
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +31 -16
- package/dist/runtime/components/overlays/Popover.vue +3 -6
- package/dist/runtime/components/overlays/Popover.vue.d.ts +110 -15
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +87 -15
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +90 -15
- package/dist/runtime/composables/{defineShortcuts.mjs → defineShortcuts.js} +1 -1
- package/dist/runtime/composables/{useButtonGroup.mjs → useButtonGroup.js} +8 -9
- package/dist/runtime/composables/useCopyToClipboard.d.ts +1 -1
- package/dist/runtime/composables/{useCopyToClipboard.mjs → useCopyToClipboard.js} +1 -1
- package/dist/runtime/composables/useFormGroup.d.ts +5 -5
- package/dist/runtime/composables/useFormGroup.js +49 -0
- package/dist/runtime/composables/useModal.d.ts +3 -3
- package/dist/runtime/composables/{useModal.mjs → useModal.js} +2 -4
- package/dist/runtime/composables/usePopper.d.ts +91 -55
- package/dist/runtime/composables/useShortcuts.d.ts +4 -4
- package/dist/runtime/composables/useSlideover.d.ts +3 -3
- package/dist/runtime/composables/{useSlideover.mjs → useSlideover.js} +2 -4
- package/dist/runtime/composables/useTimer.d.ts +1 -1
- package/dist/runtime/composables/useToast.d.ts +11 -11
- package/dist/runtime/composables/useUI.d.ts +1 -1
- package/dist/runtime/composables/{useUI.mjs → useUI.js} +1 -1
- package/dist/runtime/plugins/colors.d.ts +1 -1
- package/dist/runtime/plugins/{colors.mjs → colors.js} +1 -1
- package/dist/runtime/plugins/modals.d.ts +1 -1
- package/dist/runtime/plugins/{modals.mjs → modals.js} +1 -1
- package/dist/runtime/plugins/slideovers.d.ts +1 -1
- package/dist/runtime/plugins/{slideovers.mjs → slideovers.js} +1 -1
- package/dist/runtime/types/accordion.d.ts +6 -7
- package/dist/runtime/types/accordion.js +0 -0
- package/dist/runtime/types/alert.d.ts +8 -10
- package/dist/runtime/types/alert.js +0 -0
- package/dist/runtime/types/avatar.d.ts +13 -15
- package/dist/runtime/types/avatar.js +0 -0
- package/dist/runtime/types/badge.d.ts +11 -13
- package/dist/runtime/types/badge.js +0 -0
- package/dist/runtime/types/breadcrumb.d.ts +6 -8
- package/dist/runtime/types/breadcrumb.js +0 -0
- package/dist/runtime/types/button.d.ts +27 -29
- package/dist/runtime/types/button.js +0 -0
- package/dist/runtime/types/chip.d.ts +11 -13
- package/dist/runtime/types/chip.js +0 -0
- package/dist/runtime/types/clipboard.d.ts +7 -1
- package/dist/runtime/types/clipboard.js +0 -0
- package/dist/runtime/types/command-palette.d.ts +23 -24
- package/dist/runtime/types/command-palette.js +0 -0
- package/dist/runtime/types/component.d.ts +17 -14
- package/dist/runtime/types/component.js +0 -0
- package/dist/runtime/types/divider.d.ts +2 -3
- package/dist/runtime/types/divider.js +0 -0
- package/dist/runtime/types/dropdown.d.ts +12 -13
- package/dist/runtime/types/dropdown.js +0 -0
- package/dist/runtime/types/form-group.d.ts +4 -5
- package/dist/runtime/types/form-group.js +0 -0
- package/dist/runtime/types/form.d.ts +29 -28
- package/dist/runtime/types/form.js +0 -0
- package/dist/runtime/types/horizontal-navigation.d.ts +10 -11
- package/dist/runtime/types/horizontal-navigation.js +0 -0
- package/dist/runtime/types/index.d.ts +31 -31
- package/dist/runtime/types/index.js +31 -0
- package/dist/runtime/types/input.d.ts +7 -8
- package/dist/runtime/types/input.js +0 -0
- package/dist/runtime/types/kbd.d.ts +4 -5
- package/dist/runtime/types/kbd.js +0 -0
- package/dist/runtime/types/link.d.ts +9 -10
- package/dist/runtime/types/link.js +0 -0
- package/dist/runtime/types/meter.d.ts +4 -5
- package/dist/runtime/types/meter.js +0 -0
- package/dist/runtime/types/modal.d.ts +13 -15
- package/dist/runtime/types/modal.js +0 -0
- package/dist/runtime/types/notification.d.ts +17 -20
- package/dist/runtime/types/notification.js +0 -0
- package/dist/runtime/types/popper.d.ts +13 -15
- package/dist/runtime/types/popper.js +0 -0
- package/dist/runtime/types/progress.d.ts +5 -6
- package/dist/runtime/types/progress.js +0 -0
- package/dist/runtime/types/range.d.ts +6 -7
- package/dist/runtime/types/range.js +0 -0
- package/dist/runtime/types/select.d.ts +7 -8
- package/dist/runtime/types/select.js +0 -0
- package/dist/runtime/types/slideover.d.ts +10 -12
- package/dist/runtime/types/slideover.js +0 -0
- package/dist/runtime/types/tabs.d.ts +6 -5
- package/dist/runtime/types/tabs.js +0 -0
- package/dist/runtime/types/textarea.d.ts +7 -8
- package/dist/runtime/types/textarea.js +0 -0
- package/dist/runtime/types/toggle.d.ts +6 -7
- package/dist/runtime/types/toggle.js +0 -0
- package/dist/runtime/types/tooltip.d.ts +5 -5
- package/dist/runtime/types/tooltip.js +0 -0
- package/dist/runtime/types/utils.d.ts +15 -27
- package/dist/runtime/types/utils.js +0 -0
- package/dist/runtime/types/vertical-navigation.d.ts +10 -11
- package/dist/runtime/types/vertical-navigation.js +0 -0
- package/dist/runtime/ui.config/data/table.d.ts +10 -0
- package/dist/runtime/ui.config/data/{table.mjs → table.js} +10 -0
- package/dist/runtime/ui.config/elements/accordion.d.ts +1 -0
- package/dist/runtime/ui.config/elements/{accordion.mjs → accordion.js} +3 -2
- package/dist/runtime/ui.config/elements/alert.d.ts +2 -2
- package/dist/runtime/ui.config/elements/avatar.d.ts +2 -2
- package/dist/runtime/ui.config/elements/{carousel.mjs → carousel.js} +1 -1
- package/dist/runtime/ui.config/elements/{dropdown.mjs → dropdown.js} +1 -1
- package/dist/runtime/ui.config/forms/{inputMenu.mjs → inputMenu.js} +1 -1
- package/dist/runtime/ui.config/forms/{select.mjs → select.js} +1 -1
- package/dist/runtime/ui.config/forms/{selectMenu.mjs → selectMenu.js} +2 -2
- package/dist/runtime/ui.config/forms/{textarea.mjs → textarea.js} +1 -1
- package/dist/runtime/ui.config/forms/toggle.d.ts +2 -2
- package/dist/runtime/ui.config/index.d.ts +43 -43
- package/dist/runtime/ui.config/index.js +43 -0
- package/dist/runtime/ui.config/navigation/{breadcrumb.mjs → breadcrumb.js} +2 -2
- package/dist/runtime/ui.config/navigation/commandPalette.d.ts +1 -1
- package/dist/runtime/ui.config/navigation/tabs.d.ts +1 -0
- package/dist/runtime/ui.config/navigation/{tabs.mjs → tabs.js} +2 -1
- package/dist/runtime/ui.config/overlays/{contextMenu.mjs → contextMenu.js} +1 -1
- package/dist/runtime/ui.config/overlays/{modal.mjs → modal.js} +2 -2
- package/dist/runtime/ui.config/overlays/notification.d.ts +1 -1
- package/dist/runtime/ui.config/overlays/{popover.mjs → popover.js} +1 -1
- package/dist/runtime/ui.config/overlays/{slideover.mjs → slideover.js} +2 -2
- package/dist/runtime/ui.config/overlays/{tooltip.mjs → tooltip.js} +1 -1
- package/dist/runtime/utils/colors.d.ts +2 -2
- package/dist/runtime/utils/{colors.mjs → colors.js} +1 -1
- package/dist/runtime/utils/index.d.ts +4 -4
- package/dist/runtime/utils/{index.mjs → index.js} +2 -2
- package/dist/runtime/utils/link.d.ts +26 -24
- package/dist/runtime/utils/{link.mjs → link.js} +1 -1
- package/dist/types.d.mts +1 -16
- package/dist/types.d.ts +1 -16
- package/package.json +20 -21
- package/dist/runtime/components/elements/Icon.vue +0 -29
- package/dist/runtime/components/elements/Icon.vue.d.ts +0 -24
- package/dist/runtime/composables/useFormGroup.mjs +0 -45
- package/dist/runtime/ui.config/index.mjs +0 -43
- /package/dist/runtime/composables/{useCarouselScroll.mjs → useCarouselScroll.js} +0 -0
- /package/dist/runtime/composables/{usePopper.mjs → usePopper.js} +0 -0
- /package/dist/runtime/composables/{useShortcuts.mjs → useShortcuts.js} +0 -0
- /package/dist/runtime/composables/{useTimer.mjs → useTimer.js} +0 -0
- /package/dist/runtime/composables/{useToast.mjs → useToast.js} +0 -0
- /package/dist/runtime/ui.config/elements/{alert.mjs → alert.js} +0 -0
- /package/dist/runtime/ui.config/elements/{avatar.mjs → avatar.js} +0 -0
- /package/dist/runtime/ui.config/elements/{avatarGroup.mjs → avatarGroup.js} +0 -0
- /package/dist/runtime/ui.config/elements/{badge.mjs → badge.js} +0 -0
- /package/dist/runtime/ui.config/elements/{button.mjs → button.js} +0 -0
- /package/dist/runtime/ui.config/elements/{buttonGroup.mjs → buttonGroup.js} +0 -0
- /package/dist/runtime/ui.config/elements/{chip.mjs → chip.js} +0 -0
- /package/dist/runtime/ui.config/elements/{kbd.mjs → kbd.js} +0 -0
- /package/dist/runtime/ui.config/elements/{meter.mjs → meter.js} +0 -0
- /package/dist/runtime/ui.config/elements/{meterGroup.mjs → meterGroup.js} +0 -0
- /package/dist/runtime/ui.config/elements/{progress.mjs → progress.js} +0 -0
- /package/dist/runtime/ui.config/forms/{checkbox.mjs → checkbox.js} +0 -0
- /package/dist/runtime/ui.config/forms/{formGroup.mjs → formGroup.js} +0 -0
- /package/dist/runtime/ui.config/forms/{input.mjs → input.js} +0 -0
- /package/dist/runtime/ui.config/forms/{radio.mjs → radio.js} +0 -0
- /package/dist/runtime/ui.config/forms/{radioGroup.mjs → radioGroup.js} +0 -0
- /package/dist/runtime/ui.config/forms/{range.mjs → range.js} +0 -0
- /package/dist/runtime/ui.config/forms/{toggle.mjs → toggle.js} +0 -0
- /package/dist/runtime/ui.config/layout/{card.mjs → card.js} +0 -0
- /package/dist/runtime/ui.config/layout/{container.mjs → container.js} +0 -0
- /package/dist/runtime/ui.config/layout/{divider.mjs → divider.js} +0 -0
- /package/dist/runtime/ui.config/layout/{skeleton.mjs → skeleton.js} +0 -0
- /package/dist/runtime/ui.config/navigation/{commandPalette.mjs → commandPalette.js} +0 -0
- /package/dist/runtime/ui.config/navigation/{horizontalNavigation.mjs → horizontalNavigation.js} +0 -0
- /package/dist/runtime/ui.config/navigation/{pagination.mjs → pagination.js} +0 -0
- /package/dist/runtime/ui.config/navigation/{verticalNavigation.mjs → verticalNavigation.js} +0 -0
- /package/dist/runtime/ui.config/overlays/{notification.mjs → notification.js} +0 -0
- /package/dist/runtime/ui.config/overlays/{notifications.mjs → notifications.js} +0 -0
- /package/dist/runtime/ui.config/{popper.mjs → popper.js} +0 -0
- /package/dist/runtime/utils/{lodash.mjs → lodash.js} +0 -0
|
@@ -1,21 +1,131 @@
|
|
|
1
1
|
import type { PropType, ComputedRef } from 'vue';
|
|
2
|
-
import type { SelectSize, SelectVariant } from '../../types';
|
|
2
|
+
import type { SelectSize, SelectColor, SelectVariant, Strategy } from '../../types.js';
|
|
3
|
+
declare const config: {
|
|
4
|
+
form: string;
|
|
5
|
+
placeholder: string;
|
|
6
|
+
default: {
|
|
7
|
+
size: string;
|
|
8
|
+
color: string;
|
|
9
|
+
variant: string;
|
|
10
|
+
loadingIcon: string;
|
|
11
|
+
trailingIcon: string;
|
|
12
|
+
};
|
|
13
|
+
wrapper: string;
|
|
14
|
+
base: string;
|
|
15
|
+
rounded: string;
|
|
16
|
+
file: {
|
|
17
|
+
base: string;
|
|
18
|
+
};
|
|
19
|
+
size: {
|
|
20
|
+
'2xs': string;
|
|
21
|
+
xs: string;
|
|
22
|
+
sm: string;
|
|
23
|
+
md: string;
|
|
24
|
+
lg: string;
|
|
25
|
+
xl: string;
|
|
26
|
+
};
|
|
27
|
+
gap: {
|
|
28
|
+
'2xs': string;
|
|
29
|
+
xs: string;
|
|
30
|
+
sm: string;
|
|
31
|
+
md: string;
|
|
32
|
+
lg: string;
|
|
33
|
+
xl: string;
|
|
34
|
+
};
|
|
35
|
+
padding: {
|
|
36
|
+
'2xs': string;
|
|
37
|
+
xs: string;
|
|
38
|
+
sm: string;
|
|
39
|
+
md: string;
|
|
40
|
+
lg: string;
|
|
41
|
+
xl: string;
|
|
42
|
+
};
|
|
43
|
+
leading: {
|
|
44
|
+
padding: {
|
|
45
|
+
'2xs': string;
|
|
46
|
+
xs: string;
|
|
47
|
+
sm: string;
|
|
48
|
+
md: string;
|
|
49
|
+
lg: string;
|
|
50
|
+
xl: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
trailing: {
|
|
54
|
+
padding: {
|
|
55
|
+
'2xs': string;
|
|
56
|
+
xs: string;
|
|
57
|
+
sm: string;
|
|
58
|
+
md: string;
|
|
59
|
+
lg: string;
|
|
60
|
+
xl: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
color: {
|
|
64
|
+
white: {
|
|
65
|
+
outline: string;
|
|
66
|
+
};
|
|
67
|
+
gray: {
|
|
68
|
+
outline: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
variant: {
|
|
72
|
+
outline: string;
|
|
73
|
+
none: string;
|
|
74
|
+
};
|
|
75
|
+
icon: {
|
|
76
|
+
base: string;
|
|
77
|
+
color: string;
|
|
78
|
+
loading: string;
|
|
79
|
+
size: {
|
|
80
|
+
'2xs': string;
|
|
81
|
+
xs: string;
|
|
82
|
+
sm: string;
|
|
83
|
+
md: string;
|
|
84
|
+
lg: string;
|
|
85
|
+
xl: string;
|
|
86
|
+
};
|
|
87
|
+
leading: {
|
|
88
|
+
wrapper: string;
|
|
89
|
+
pointer: string;
|
|
90
|
+
padding: {
|
|
91
|
+
'2xs': string;
|
|
92
|
+
xs: string;
|
|
93
|
+
sm: string;
|
|
94
|
+
md: string;
|
|
95
|
+
lg: string;
|
|
96
|
+
xl: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
trailing: {
|
|
100
|
+
wrapper: string;
|
|
101
|
+
pointer: string;
|
|
102
|
+
padding: {
|
|
103
|
+
'2xs': string;
|
|
104
|
+
xs: string;
|
|
105
|
+
sm: string;
|
|
106
|
+
md: string;
|
|
107
|
+
lg: string;
|
|
108
|
+
xl: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
};
|
|
3
113
|
declare const _default: import("vue").DefineComponent<{
|
|
4
114
|
modelValue: {
|
|
5
|
-
type: (
|
|
115
|
+
type: (ObjectConstructor | NumberConstructor | StringConstructor)[];
|
|
6
116
|
default: string;
|
|
7
117
|
};
|
|
8
118
|
id: {
|
|
9
119
|
type: StringConstructor;
|
|
10
|
-
default:
|
|
120
|
+
default: any;
|
|
11
121
|
};
|
|
12
122
|
name: {
|
|
13
123
|
type: StringConstructor;
|
|
14
|
-
default:
|
|
124
|
+
default: any;
|
|
15
125
|
};
|
|
16
126
|
placeholder: {
|
|
17
127
|
type: StringConstructor;
|
|
18
|
-
default:
|
|
128
|
+
default: any;
|
|
19
129
|
};
|
|
20
130
|
required: {
|
|
21
131
|
type: BooleanConstructor;
|
|
@@ -27,19 +137,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
27
137
|
};
|
|
28
138
|
icon: {
|
|
29
139
|
type: StringConstructor;
|
|
30
|
-
default:
|
|
140
|
+
default: any;
|
|
31
141
|
};
|
|
32
142
|
loadingIcon: {
|
|
33
143
|
type: StringConstructor;
|
|
34
|
-
default: () =>
|
|
144
|
+
default: () => string;
|
|
35
145
|
};
|
|
36
146
|
leadingIcon: {
|
|
37
147
|
type: StringConstructor;
|
|
38
|
-
default:
|
|
148
|
+
default: any;
|
|
39
149
|
};
|
|
40
150
|
trailingIcon: {
|
|
41
151
|
type: StringConstructor;
|
|
42
|
-
default: () =>
|
|
152
|
+
default: () => string;
|
|
43
153
|
};
|
|
44
154
|
trailing: {
|
|
45
155
|
type: BooleanConstructor;
|
|
@@ -59,21 +169,21 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
59
169
|
};
|
|
60
170
|
options: {
|
|
61
171
|
type: ArrayConstructor;
|
|
62
|
-
default: () =>
|
|
172
|
+
default: () => any[];
|
|
63
173
|
};
|
|
64
174
|
size: {
|
|
65
175
|
type: PropType<SelectSize>;
|
|
66
|
-
default:
|
|
176
|
+
default: any;
|
|
67
177
|
validator(value: string): boolean;
|
|
68
178
|
};
|
|
69
179
|
color: {
|
|
70
|
-
type: PropType<
|
|
71
|
-
default: () =>
|
|
180
|
+
type: PropType<SelectColor>;
|
|
181
|
+
default: () => string;
|
|
72
182
|
validator(value: string): boolean;
|
|
73
183
|
};
|
|
74
184
|
variant: {
|
|
75
185
|
type: PropType<SelectVariant>;
|
|
76
|
-
default: () =>
|
|
186
|
+
default: () => string;
|
|
77
187
|
validator(value: string): boolean;
|
|
78
188
|
};
|
|
79
189
|
optionAttribute: {
|
|
@@ -86,57 +196,168 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
86
196
|
};
|
|
87
197
|
selectClass: {
|
|
88
198
|
type: StringConstructor;
|
|
89
|
-
default:
|
|
199
|
+
default: any;
|
|
90
200
|
};
|
|
91
201
|
class: {
|
|
92
202
|
type: PropType<any>;
|
|
93
203
|
default: () => "";
|
|
94
204
|
};
|
|
95
205
|
ui: {
|
|
96
|
-
type: PropType<
|
|
206
|
+
type: PropType<Partial<typeof config> & {
|
|
207
|
+
strategy?: Strategy;
|
|
208
|
+
}>;
|
|
97
209
|
default: () => {};
|
|
98
210
|
};
|
|
99
211
|
}, {
|
|
100
|
-
ui: ComputedRef<
|
|
212
|
+
ui: ComputedRef<{
|
|
213
|
+
form: string;
|
|
214
|
+
placeholder: string;
|
|
215
|
+
default: {
|
|
216
|
+
size: string;
|
|
217
|
+
color: string;
|
|
218
|
+
variant: string;
|
|
219
|
+
loadingIcon: string;
|
|
220
|
+
trailingIcon: string;
|
|
221
|
+
};
|
|
222
|
+
wrapper: string;
|
|
223
|
+
base: string;
|
|
224
|
+
rounded: string;
|
|
225
|
+
file: {
|
|
226
|
+
base: string;
|
|
227
|
+
};
|
|
228
|
+
size: {
|
|
229
|
+
'2xs': string;
|
|
230
|
+
xs: string;
|
|
231
|
+
sm: string;
|
|
232
|
+
md: string;
|
|
233
|
+
lg: string;
|
|
234
|
+
xl: string;
|
|
235
|
+
};
|
|
236
|
+
gap: {
|
|
237
|
+
'2xs': string;
|
|
238
|
+
xs: string;
|
|
239
|
+
sm: string;
|
|
240
|
+
md: string;
|
|
241
|
+
lg: string;
|
|
242
|
+
xl: string;
|
|
243
|
+
};
|
|
244
|
+
padding: {
|
|
245
|
+
'2xs': string;
|
|
246
|
+
xs: string;
|
|
247
|
+
sm: string;
|
|
248
|
+
md: string;
|
|
249
|
+
lg: string;
|
|
250
|
+
xl: string;
|
|
251
|
+
};
|
|
252
|
+
leading: {
|
|
253
|
+
padding: {
|
|
254
|
+
'2xs': string;
|
|
255
|
+
xs: string;
|
|
256
|
+
sm: string;
|
|
257
|
+
md: string;
|
|
258
|
+
lg: string;
|
|
259
|
+
xl: string;
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
trailing: {
|
|
263
|
+
padding: {
|
|
264
|
+
'2xs': string;
|
|
265
|
+
xs: string;
|
|
266
|
+
sm: string;
|
|
267
|
+
md: string;
|
|
268
|
+
lg: string;
|
|
269
|
+
xl: string;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
color: {
|
|
273
|
+
white: {
|
|
274
|
+
outline: string;
|
|
275
|
+
};
|
|
276
|
+
gray: {
|
|
277
|
+
outline: string;
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
variant: {
|
|
281
|
+
outline: string;
|
|
282
|
+
none: string;
|
|
283
|
+
};
|
|
284
|
+
icon: {
|
|
285
|
+
base: string;
|
|
286
|
+
color: string;
|
|
287
|
+
loading: string;
|
|
288
|
+
size: {
|
|
289
|
+
'2xs': string;
|
|
290
|
+
xs: string;
|
|
291
|
+
sm: string;
|
|
292
|
+
md: string;
|
|
293
|
+
lg: string;
|
|
294
|
+
xl: string;
|
|
295
|
+
};
|
|
296
|
+
leading: {
|
|
297
|
+
wrapper: string;
|
|
298
|
+
pointer: string;
|
|
299
|
+
padding: {
|
|
300
|
+
'2xs': string;
|
|
301
|
+
xs: string;
|
|
302
|
+
sm: string;
|
|
303
|
+
md: string;
|
|
304
|
+
lg: string;
|
|
305
|
+
xl: string;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
trailing: {
|
|
309
|
+
wrapper: string;
|
|
310
|
+
pointer: string;
|
|
311
|
+
padding: {
|
|
312
|
+
'2xs': string;
|
|
313
|
+
xs: string;
|
|
314
|
+
sm: string;
|
|
315
|
+
md: string;
|
|
316
|
+
lg: string;
|
|
317
|
+
xl: string;
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
}>;
|
|
101
322
|
attrs: ComputedRef<Pick<{
|
|
102
323
|
[x: string]: unknown;
|
|
103
324
|
}, string>>;
|
|
104
|
-
name: ComputedRef<string
|
|
105
|
-
inputId: ComputedRef<string
|
|
325
|
+
name: ComputedRef<string>;
|
|
326
|
+
inputId: ComputedRef<string>;
|
|
106
327
|
normalizedOptionsWithPlaceholder: ComputedRef<{
|
|
107
|
-
disabled?: boolean
|
|
328
|
+
disabled?: boolean;
|
|
108
329
|
children: {
|
|
109
330
|
disabled?: boolean;
|
|
110
331
|
}[];
|
|
111
332
|
}[]>;
|
|
112
333
|
normalizedValue: ComputedRef<any>;
|
|
113
334
|
isLeading: ComputedRef<string | true>;
|
|
114
|
-
isTrailing: ComputedRef<string | true
|
|
335
|
+
isTrailing: ComputedRef<string | true>;
|
|
115
336
|
selectClass: ComputedRef<string>;
|
|
116
|
-
leadingIconName: ComputedRef<string
|
|
337
|
+
leadingIconName: ComputedRef<string>;
|
|
117
338
|
leadingIconClass: ComputedRef<string>;
|
|
118
339
|
leadingWrapperIconClass: ComputedRef<string>;
|
|
119
|
-
trailingIconName: ComputedRef<string
|
|
340
|
+
trailingIconName: ComputedRef<string>;
|
|
120
341
|
trailingIconClass: ComputedRef<string>;
|
|
121
342
|
trailingWrapperIconClass: ComputedRef<string>;
|
|
122
343
|
onInput: (event: Event) => void;
|
|
123
344
|
onChange: (event: Event) => void;
|
|
124
345
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue")[], "change" | "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
125
346
|
modelValue: {
|
|
126
|
-
type: (
|
|
347
|
+
type: (ObjectConstructor | NumberConstructor | StringConstructor)[];
|
|
127
348
|
default: string;
|
|
128
349
|
};
|
|
129
350
|
id: {
|
|
130
351
|
type: StringConstructor;
|
|
131
|
-
default:
|
|
352
|
+
default: any;
|
|
132
353
|
};
|
|
133
354
|
name: {
|
|
134
355
|
type: StringConstructor;
|
|
135
|
-
default:
|
|
356
|
+
default: any;
|
|
136
357
|
};
|
|
137
358
|
placeholder: {
|
|
138
359
|
type: StringConstructor;
|
|
139
|
-
default:
|
|
360
|
+
default: any;
|
|
140
361
|
};
|
|
141
362
|
required: {
|
|
142
363
|
type: BooleanConstructor;
|
|
@@ -148,19 +369,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
148
369
|
};
|
|
149
370
|
icon: {
|
|
150
371
|
type: StringConstructor;
|
|
151
|
-
default:
|
|
372
|
+
default: any;
|
|
152
373
|
};
|
|
153
374
|
loadingIcon: {
|
|
154
375
|
type: StringConstructor;
|
|
155
|
-
default: () =>
|
|
376
|
+
default: () => string;
|
|
156
377
|
};
|
|
157
378
|
leadingIcon: {
|
|
158
379
|
type: StringConstructor;
|
|
159
|
-
default:
|
|
380
|
+
default: any;
|
|
160
381
|
};
|
|
161
382
|
trailingIcon: {
|
|
162
383
|
type: StringConstructor;
|
|
163
|
-
default: () =>
|
|
384
|
+
default: () => string;
|
|
164
385
|
};
|
|
165
386
|
trailing: {
|
|
166
387
|
type: BooleanConstructor;
|
|
@@ -180,21 +401,21 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
180
401
|
};
|
|
181
402
|
options: {
|
|
182
403
|
type: ArrayConstructor;
|
|
183
|
-
default: () =>
|
|
404
|
+
default: () => any[];
|
|
184
405
|
};
|
|
185
406
|
size: {
|
|
186
407
|
type: PropType<SelectSize>;
|
|
187
|
-
default:
|
|
408
|
+
default: any;
|
|
188
409
|
validator(value: string): boolean;
|
|
189
410
|
};
|
|
190
411
|
color: {
|
|
191
|
-
type: PropType<
|
|
192
|
-
default: () =>
|
|
412
|
+
type: PropType<SelectColor>;
|
|
413
|
+
default: () => string;
|
|
193
414
|
validator(value: string): boolean;
|
|
194
415
|
};
|
|
195
416
|
variant: {
|
|
196
417
|
type: PropType<SelectVariant>;
|
|
197
|
-
default: () =>
|
|
418
|
+
default: () => string;
|
|
198
419
|
validator(value: string): boolean;
|
|
199
420
|
};
|
|
200
421
|
optionAttribute: {
|
|
@@ -207,40 +428,42 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
207
428
|
};
|
|
208
429
|
selectClass: {
|
|
209
430
|
type: StringConstructor;
|
|
210
|
-
default:
|
|
431
|
+
default: any;
|
|
211
432
|
};
|
|
212
433
|
class: {
|
|
213
434
|
type: PropType<any>;
|
|
214
435
|
default: () => "";
|
|
215
436
|
};
|
|
216
437
|
ui: {
|
|
217
|
-
type: PropType<
|
|
438
|
+
type: PropType<Partial<typeof config> & {
|
|
439
|
+
strategy?: Strategy;
|
|
440
|
+
}>;
|
|
218
441
|
default: () => {};
|
|
219
442
|
};
|
|
220
443
|
}>> & {
|
|
221
|
-
onChange?: (
|
|
222
|
-
"onUpdate:modelValue"?: (
|
|
444
|
+
onChange?: (...args: any[]) => any;
|
|
445
|
+
"onUpdate:modelValue"?: (...args: any[]) => any;
|
|
223
446
|
}, {
|
|
224
447
|
size: SelectSize;
|
|
225
|
-
|
|
226
|
-
|
|
448
|
+
ui: {};
|
|
449
|
+
disabled: boolean;
|
|
450
|
+
color: SelectColor;
|
|
451
|
+
variant: SelectVariant;
|
|
452
|
+
icon: string;
|
|
453
|
+
id: string;
|
|
227
454
|
class: any;
|
|
228
455
|
leading: boolean;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
456
|
+
options: unknown[];
|
|
457
|
+
name: string;
|
|
458
|
+
modelValue: string | number | Record<string, any>;
|
|
459
|
+
required: boolean;
|
|
233
460
|
loading: boolean;
|
|
234
461
|
padded: boolean;
|
|
235
|
-
icon: string;
|
|
236
462
|
loadingIcon: string;
|
|
237
463
|
leadingIcon: string;
|
|
238
464
|
trailingIcon: string;
|
|
239
465
|
trailing: boolean;
|
|
240
|
-
id: string;
|
|
241
|
-
modelValue: string | number | Record<string, any>;
|
|
242
466
|
placeholder: string;
|
|
243
|
-
options: unknown[];
|
|
244
467
|
optionAttribute: string;
|
|
245
468
|
valueAttribute: string;
|
|
246
469
|
selectClass: string;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
v-slot="{ open }"
|
|
5
5
|
:by="by"
|
|
6
6
|
:name="name"
|
|
7
|
-
:model-value="modelValue"
|
|
7
|
+
:model-value="multiple ? (Array.isArray(modelValue) ? modelValue : []) : modelValue"
|
|
8
8
|
:multiple="multiple"
|
|
9
9
|
:disabled="disabled"
|
|
10
10
|
as="div"
|
|
@@ -30,18 +30,18 @@
|
|
|
30
30
|
<slot :open="open" :disabled="disabled" :loading="loading">
|
|
31
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
|
-
<slot name="leading" :disabled="disabled" :loading="loading">
|
|
33
|
+
<slot name="leading" :selected="selected" :disabled="disabled" :loading="loading">
|
|
34
34
|
<UIcon :name="leadingIconName" :class="leadingIconClass" />
|
|
35
35
|
</slot>
|
|
36
36
|
</span>
|
|
37
37
|
|
|
38
|
-
<slot name="label">
|
|
38
|
+
<slot name="label" :selected="selected">
|
|
39
39
|
<span v-if="label" :class="uiMenu.label">{{ label }}</span>
|
|
40
40
|
<span v-else :class="uiMenu.label">{{ placeholder || ' ' }}</span>
|
|
41
41
|
</slot>
|
|
42
42
|
|
|
43
43
|
<span v-if="(isTrailing && trailingIconName) || $slots.trailing" :class="trailingWrapperIconClass">
|
|
44
|
-
<slot name="trailing" :disabled="disabled" :loading="loading">
|
|
44
|
+
<slot name="trailing" :selected="selected" :disabled="disabled" :loading="loading">
|
|
45
45
|
<UIcon :name="trailingIconName" :class="trailingIconClass" aria-hidden="true" />
|
|
46
46
|
</slot>
|
|
47
47
|
</span>
|
|
@@ -68,15 +68,15 @@
|
|
|
68
68
|
<component
|
|
69
69
|
:is="searchable ? 'HComboboxOption' : 'HListboxOption'"
|
|
70
70
|
v-for="(option, index) in filteredOptions"
|
|
71
|
-
v-slot="{ active, selected, disabled: optionDisabled }"
|
|
71
|
+
v-slot="{ active, selected: optionSelected, disabled: optionDisabled }"
|
|
72
72
|
:key="index"
|
|
73
73
|
as="template"
|
|
74
74
|
:value="valueAttribute ? option[valueAttribute] : option"
|
|
75
75
|
:disabled="option.disabled"
|
|
76
76
|
>
|
|
77
|
-
<li :class="[uiMenu.option.base, uiMenu.option.rounded, uiMenu.option.padding, uiMenu.option.size, uiMenu.option.color, active ? uiMenu.option.active : uiMenu.option.inactive,
|
|
77
|
+
<li :class="[uiMenu.option.base, uiMenu.option.rounded, uiMenu.option.padding, uiMenu.option.size, uiMenu.option.color, active ? uiMenu.option.active : uiMenu.option.inactive, optionSelected && uiMenu.option.selected, optionDisabled && uiMenu.option.disabled]">
|
|
78
78
|
<div :class="uiMenu.option.container">
|
|
79
|
-
<slot name="option" :option="option" :active="active" :selected="
|
|
79
|
+
<slot name="option" :option="option" :active="active" :selected="optionSelected">
|
|
80
80
|
<UIcon v-if="option.icon" :name="option.icon" :class="[uiMenu.option.icon.base, active ? uiMenu.option.icon.active : uiMenu.option.icon.inactive, option.iconClass]" aria-hidden="true" />
|
|
81
81
|
<UAvatar
|
|
82
82
|
v-else-if="option.avatar"
|
|
@@ -90,16 +90,16 @@
|
|
|
90
90
|
</slot>
|
|
91
91
|
</div>
|
|
92
92
|
|
|
93
|
-
<span v-if="
|
|
93
|
+
<span v-if="optionSelected" :class="[uiMenu.option.selectedIcon.wrapper, uiMenu.option.selectedIcon.padding]">
|
|
94
94
|
<UIcon :name="selectedIcon" :class="uiMenu.option.selectedIcon.base" aria-hidden="true" />
|
|
95
95
|
</span>
|
|
96
96
|
</li>
|
|
97
97
|
</component>
|
|
98
98
|
|
|
99
|
-
<component :is="searchable ? 'HComboboxOption' : 'HListboxOption'" v-if="creatable && createOption" v-slot="{ active, selected }" :value="createOption" as="template">
|
|
99
|
+
<component :is="searchable ? 'HComboboxOption' : 'HListboxOption'" v-if="creatable && createOption" v-slot="{ active, selected: optionSelected }" :value="createOption" as="template">
|
|
100
100
|
<li :class="[uiMenu.option.base, uiMenu.option.rounded, uiMenu.option.padding, uiMenu.option.size, uiMenu.option.color, active ? uiMenu.option.active : uiMenu.option.inactive]">
|
|
101
101
|
<div :class="uiMenu.option.container">
|
|
102
|
-
<slot name="option-create" :option="createOption" :active="active" :selected="
|
|
102
|
+
<slot name="option-create" :option="createOption" :active="active" :selected="optionSelected">
|
|
103
103
|
<span :class="uiMenu.option.create">Create "{{ createOption[optionAttribute] }}"</span>
|
|
104
104
|
</slot>
|
|
105
105
|
</div>
|
|
@@ -139,8 +139,7 @@ import {
|
|
|
139
139
|
import { computedAsync, useDebounceFn } from "@vueuse/core";
|
|
140
140
|
import { defu } from "defu";
|
|
141
141
|
import { twMerge, twJoin } from "tailwind-merge";
|
|
142
|
-
import UIcon from "
|
|
143
|
-
import UAvatar from "../elements/Avatar.vue";
|
|
142
|
+
import { UIcon, UAvatar } from "#components";
|
|
144
143
|
import { useUI } from "../../composables/useUI";
|
|
145
144
|
import { usePopper } from "../../composables/usePopper";
|
|
146
145
|
import { useFormGroup } from "../../composables/useFormGroup";
|
|
@@ -260,7 +259,7 @@ export default defineComponent({
|
|
|
260
259
|
default: false
|
|
261
260
|
},
|
|
262
261
|
showCreateOptionWhen: {
|
|
263
|
-
type: String,
|
|
262
|
+
type: [String, Function],
|
|
264
263
|
default: () => configMenu.default.showCreateOptionWhen
|
|
265
264
|
},
|
|
266
265
|
placeholder: {
|
|
@@ -330,13 +329,16 @@ export default defineComponent({
|
|
|
330
329
|
},
|
|
331
330
|
emits: ["update:modelValue", "update:query", "open", "close", "change"],
|
|
332
331
|
setup(props, { emit, slots }) {
|
|
332
|
+
if (import.meta.dev && props.multiple && !Array.isArray(props.modelValue)) {
|
|
333
|
+
console.warn(`[@nuxt/ui] The USelectMenu components needs to have a modelValue of type Array when using the multiple prop. Got '${typeof props.modelValue}' instead.`, props.modelValue);
|
|
334
|
+
}
|
|
333
335
|
const { ui, attrs } = useUI("select", toRef(props, "ui"), config, toRef(props, "class"));
|
|
334
336
|
const { ui: uiMenu } = useUI("selectMenu", toRef(props, "uiMenu"), configMenu);
|
|
335
337
|
const popper = computed(() => defu({}, props.popper, uiMenu.value.popper));
|
|
336
338
|
const [trigger, container] = usePopper(popper.value);
|
|
337
339
|
const { size: sizeButtonGroup, rounded } = useInjectButtonGroup({ ui, props });
|
|
338
340
|
const { emitFormBlur, emitFormChange, inputId, color, size: sizeFormGroup, name } = useFormGroup(props, config);
|
|
339
|
-
const size = computed(() => sizeButtonGroup.value
|
|
341
|
+
const size = computed(() => sizeButtonGroup.value ?? sizeFormGroup.value);
|
|
340
342
|
const internalQuery = ref("");
|
|
341
343
|
const query = computed({
|
|
342
344
|
get() {
|
|
@@ -347,17 +349,31 @@ export default defineComponent({
|
|
|
347
349
|
emit("update:query", value);
|
|
348
350
|
}
|
|
349
351
|
});
|
|
352
|
+
const selected = computed(() => {
|
|
353
|
+
if (props.multiple) {
|
|
354
|
+
if (!Array.isArray(props.modelValue) || !props.modelValue.length) {
|
|
355
|
+
return [];
|
|
356
|
+
}
|
|
357
|
+
if (props.valueAttribute) {
|
|
358
|
+
return options.value.filter((option) => props.modelValue.includes(option[props.valueAttribute]));
|
|
359
|
+
}
|
|
360
|
+
return options.value.filter((option) => props.modelValue.includes(option));
|
|
361
|
+
}
|
|
362
|
+
if (props.valueAttribute) {
|
|
363
|
+
return options.value.find((option) => option[props.valueAttribute] === props.modelValue);
|
|
364
|
+
}
|
|
365
|
+
return options.value.find((option) => option === props.modelValue);
|
|
366
|
+
});
|
|
350
367
|
const label = computed(() => {
|
|
351
368
|
if (props.multiple) {
|
|
352
369
|
if (Array.isArray(props.modelValue) && props.modelValue.length) {
|
|
353
|
-
return `${
|
|
370
|
+
return `${selected.value.length} selected`;
|
|
354
371
|
} else {
|
|
355
372
|
return null;
|
|
356
373
|
}
|
|
357
374
|
} else if (props.modelValue !== void 0 && props.modelValue !== null) {
|
|
358
375
|
if (props.valueAttribute) {
|
|
359
|
-
|
|
360
|
-
return option ? option[props.optionAttribute] : null;
|
|
376
|
+
return selected.value?.[props.optionAttribute] ?? null;
|
|
361
377
|
} else {
|
|
362
378
|
return ["string", "number"].includes(typeof props.modelValue) ? props.modelValue : props.modelValue[props.optionAttribute];
|
|
363
379
|
}
|
|
@@ -426,15 +442,20 @@ export default defineComponent({
|
|
|
426
442
|
props.loading && !isLeading.value && ui.value.icon.loading
|
|
427
443
|
);
|
|
428
444
|
});
|
|
429
|
-
const debouncedSearch = typeof props.searchable === "function" ? useDebounceFn(props.searchable, props.debounce) : void 0;
|
|
430
|
-
const
|
|
431
|
-
if (
|
|
445
|
+
const debouncedSearch = props.searchable && typeof props.searchable === "function" ? useDebounceFn(props.searchable, props.debounce) : void 0;
|
|
446
|
+
const options = computedAsync(async () => {
|
|
447
|
+
if (debouncedSearch) {
|
|
432
448
|
return await debouncedSearch(query.value);
|
|
433
449
|
}
|
|
434
|
-
|
|
435
|
-
|
|
450
|
+
return props.options || [];
|
|
451
|
+
}, [], {
|
|
452
|
+
lazy: props.searchableLazy
|
|
453
|
+
});
|
|
454
|
+
const filteredOptions = computed(() => {
|
|
455
|
+
if (!query.value || debouncedSearch) {
|
|
456
|
+
return options.value;
|
|
436
457
|
}
|
|
437
|
-
return
|
|
458
|
+
return options.value.filter((option) => {
|
|
438
459
|
return (props.searchAttributes?.length ? props.searchAttributes : [props.optionAttribute]).some((searchAttribute) => {
|
|
439
460
|
if (["string", "number"].includes(typeof option)) {
|
|
440
461
|
return String(option).search(new RegExp(query.value, "i")) !== -1;
|
|
@@ -443,8 +464,6 @@ export default defineComponent({
|
|
|
443
464
|
return child !== null && child !== void 0 && String(child).search(new RegExp(query.value, "i")) !== -1;
|
|
444
465
|
});
|
|
445
466
|
});
|
|
446
|
-
}, [], {
|
|
447
|
-
lazy: props.searchableLazy
|
|
448
467
|
});
|
|
449
468
|
const createOption = computed(() => {
|
|
450
469
|
if (query.value === "") {
|
|
@@ -459,6 +478,11 @@ export default defineComponent({
|
|
|
459
478
|
return null;
|
|
460
479
|
}
|
|
461
480
|
}
|
|
481
|
+
if (typeof props.showCreateOptionWhen === "function") {
|
|
482
|
+
if (!props.showCreateOptionWhen(query.value, filteredOptions.value)) {
|
|
483
|
+
return null;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
462
486
|
return ["string", "number"].includes(typeof props.modelValue) ? query.value : { [props.optionAttribute]: query.value };
|
|
463
487
|
});
|
|
464
488
|
function clearOnClose() {
|
|
@@ -497,6 +521,7 @@ export default defineComponent({
|
|
|
497
521
|
popper,
|
|
498
522
|
trigger,
|
|
499
523
|
container,
|
|
524
|
+
selected,
|
|
500
525
|
label,
|
|
501
526
|
isLeading,
|
|
502
527
|
isTrailing,
|