@bitrix24/b24ui-nuxt 0.5.8 → 0.5.10
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/.nuxt/b24ui/navigation-menu.ts +0 -2
- package/.nuxt/b24ui/popover.ts +1 -1
- package/.nuxt/b24ui/textarea.ts +43 -0
- package/dist/meta.d.mts +5090 -4900
- package/dist/meta.mjs +5090 -4900
- package/dist/module.json +5 -5
- package/dist/module.mjs +11 -7
- package/dist/runtime/components/Advice.vue +47 -54
- package/dist/runtime/components/Advice.vue.d.ts +170 -0
- package/dist/runtime/components/Alert.vue +71 -96
- package/dist/runtime/components/Alert.vue.d.ts +464 -0
- package/dist/runtime/components/App.vue +37 -34
- package/dist/runtime/components/App.vue.d.ts +23 -0
- package/dist/runtime/components/Avatar.vue +69 -81
- package/dist/runtime/components/Avatar.vue.d.ts +281 -0
- package/dist/runtime/components/AvatarGroup.vue +53 -76
- package/dist/runtime/components/AvatarGroup.vue.d.ts +204 -0
- package/dist/runtime/components/Badge.vue +83 -83
- package/dist/runtime/components/Badge.vue.d.ts +517 -0
- package/dist/runtime/components/Button.vue +219 -149
- package/dist/runtime/components/Button.vue.d.ts +640 -0
- package/dist/runtime/components/ButtonGroup.vue +35 -51
- package/dist/runtime/components/ButtonGroup.vue.d.ts +116 -0
- package/dist/runtime/components/Calendar.vue +186 -152
- package/dist/runtime/components/Calendar.vue.d.ts +437 -0
- package/dist/runtime/components/Checkbox.vue +84 -73
- package/dist/runtime/components/Checkbox.vue.d.ts +354 -0
- package/dist/runtime/components/Chip.vue +59 -74
- package/dist/runtime/components/Chip.vue.d.ts +271 -0
- package/dist/runtime/components/Collapsible.vue +44 -41
- package/dist/runtime/components/Collapsible.vue.d.ts +118 -0
- package/dist/runtime/components/Container.vue +18 -27
- package/dist/runtime/components/Container.vue.d.ts +27 -0
- package/dist/runtime/components/Countdown.vue +198 -378
- package/dist/runtime/components/Countdown.vue.d.ts +356 -0
- package/dist/runtime/components/DescriptionList.vue +102 -149
- package/dist/runtime/components/DescriptionList.vue.d.ts +379 -0
- package/dist/runtime/components/DropdownMenu.vue +83 -139
- package/dist/runtime/components/DropdownMenu.vue.d.ts +533 -0
- package/dist/runtime/components/DropdownMenuContent.vue +137 -81
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +228 -0
- package/dist/runtime/components/Form.vue +162 -216
- package/dist/runtime/components/Form.vue.d.ts +55 -0
- package/dist/runtime/components/FormField.vue +76 -80
- package/dist/runtime/components/FormField.vue.d.ts +282 -0
- package/dist/runtime/components/Input.vue +166 -185
- package/dist/runtime/components/Input.vue.d.ts +755 -0
- package/dist/runtime/components/InputMenu.vue +300 -381
- package/dist/runtime/components/InputMenu.vue.d.ts +1504 -0
- package/dist/runtime/components/InputNumber.vue +180 -177
- package/dist/runtime/components/InputNumber.vue.d.ts +658 -0
- package/dist/runtime/components/Kbd.vue +33 -45
- package/dist/runtime/components/Kbd.vue.d.ts +109 -0
- package/dist/runtime/components/Link.vue +179 -173
- package/dist/runtime/components/Link.vue.d.ts +129 -0
- package/dist/runtime/components/LinkBase.vue +64 -42
- package/dist/runtime/components/LinkBase.vue.d.ts +48 -0
- package/dist/runtime/components/Modal.vue +105 -127
- package/dist/runtime/components/Modal.vue.d.ts +327 -0
- package/dist/runtime/components/ModalDialogClose.vue +4 -8
- package/dist/runtime/components/ModalDialogClose.vue.d.ts +10 -0
- package/dist/runtime/components/Navbar.vue +24 -33
- package/dist/runtime/components/Navbar.vue.d.ts +101 -0
- package/dist/runtime/components/NavbarDivider.vue +24 -33
- package/dist/runtime/components/NavbarDivider.vue.d.ts +101 -0
- package/dist/runtime/components/NavbarSection.vue +24 -33
- package/dist/runtime/components/NavbarSection.vue.d.ts +101 -0
- package/dist/runtime/components/NavbarSpacer.vue +24 -33
- package/dist/runtime/components/NavbarSpacer.vue.d.ts +101 -0
- package/dist/runtime/components/NavigationMenu.vue +152 -216
- package/dist/runtime/components/NavigationMenu.vue.d.ts +824 -0
- package/dist/runtime/components/OverlayProvider.vue +13 -17
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
- package/dist/runtime/components/Popover.vue +81 -81
- package/dist/runtime/components/Popover.vue.d.ts +147 -0
- package/dist/runtime/components/Progress.vue +109 -136
- package/dist/runtime/components/Progress.vue.d.ts +592 -0
- package/dist/runtime/components/RadioGroup.vue +120 -134
- package/dist/runtime/components/RadioGroup.vue.d.ts +723 -0
- package/dist/runtime/components/Range.vue +94 -85
- package/dist/runtime/components/Range.vue.d.ts +417 -0
- package/dist/runtime/components/Select.vue +212 -260
- package/dist/runtime/components/Select.vue.d.ts +1200 -0
- package/dist/runtime/components/SelectMenu.vue +272 -366
- package/dist/runtime/components/SelectMenu.vue.d.ts +1298 -0
- package/dist/runtime/components/Separator.vue +61 -71
- package/dist/runtime/components/Separator.vue.d.ts +400 -0
- package/dist/runtime/components/Sidebar.vue +24 -33
- package/dist/runtime/components/Sidebar.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarBody.vue +30 -38
- package/dist/runtime/components/SidebarBody.vue.d.ts +90 -0
- package/dist/runtime/components/SidebarFooter.vue +24 -33
- package/dist/runtime/components/SidebarFooter.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarHeader.vue +24 -33
- package/dist/runtime/components/SidebarHeader.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarHeading.vue +24 -33
- package/dist/runtime/components/SidebarHeading.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarLayout.vue +40 -70
- package/dist/runtime/components/SidebarLayout.vue.d.ts +222 -0
- package/dist/runtime/components/SidebarSection.vue +24 -33
- package/dist/runtime/components/SidebarSection.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarSpacer.vue +24 -33
- package/dist/runtime/components/SidebarSpacer.vue.d.ts +101 -0
- package/dist/runtime/components/Skeleton.vue +17 -22
- package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
- package/dist/runtime/components/Slideover.vue +108 -131
- package/dist/runtime/components/Slideover.vue.d.ts +360 -0
- package/dist/runtime/components/StackedLayout.vue +40 -73
- package/dist/runtime/components/StackedLayout.vue.d.ts +192 -0
- package/dist/runtime/components/Switch.vue +100 -95
- package/dist/runtime/components/Switch.vue.d.ts +587 -0
- package/dist/runtime/components/Tabs.vue +83 -105
- package/dist/runtime/components/Tabs.vue.d.ts +453 -0
- package/dist/runtime/components/Textarea.vue +215 -203
- package/dist/runtime/components/Textarea.vue.d.ts +601 -0
- package/dist/runtime/components/Toast.vue +94 -105
- package/dist/runtime/components/Toast.vue.d.ts +438 -0
- package/dist/runtime/components/Toaster.vue +94 -111
- package/dist/runtime/components/Toaster.vue.d.ts +219 -0
- package/dist/runtime/components/Tooltip.vue +78 -64
- package/dist/runtime/components/Tooltip.vue.d.ts +186 -0
- package/dist/runtime/components/content/TableWrapper.vue +58 -70
- package/dist/runtime/components/content/TableWrapper.vue.d.ts +237 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useComponentIcons.d.ts +3 -3
- package/dist/runtime/composables/useFormField.d.ts +1 -1
- package/dist/runtime/prose/A.vue +18 -23
- package/dist/runtime/prose/A.vue.d.ts +84 -0
- package/dist/runtime/prose/Blockquote.vue +18 -23
- package/dist/runtime/prose/Blockquote.vue.d.ts +84 -0
- package/dist/runtime/prose/Code.vue +23 -31
- package/dist/runtime/prose/Code.vue.d.ts +97 -0
- package/dist/runtime/prose/Em.vue +18 -23
- package/dist/runtime/prose/Em.vue.d.ts +84 -0
- package/dist/runtime/prose/H1.vue +18 -23
- package/dist/runtime/prose/H1.vue.d.ts +97 -0
- package/dist/runtime/prose/H2.vue +18 -23
- package/dist/runtime/prose/H2.vue.d.ts +123 -0
- package/dist/runtime/prose/H3.vue +18 -23
- package/dist/runtime/prose/H3.vue.d.ts +123 -0
- package/dist/runtime/prose/H4.vue +18 -23
- package/dist/runtime/prose/H4.vue.d.ts +123 -0
- package/dist/runtime/prose/H5.vue +18 -23
- package/dist/runtime/prose/H5.vue.d.ts +123 -0
- package/dist/runtime/prose/H6.vue +18 -23
- package/dist/runtime/prose/H6.vue.d.ts +123 -0
- package/dist/runtime/prose/Hr.vue +18 -19
- package/dist/runtime/prose/Hr.vue.d.ts +74 -0
- package/dist/runtime/prose/Img.vue +18 -23
- package/dist/runtime/prose/Img.vue.d.ts +77 -0
- package/dist/runtime/prose/Li.vue +18 -23
- package/dist/runtime/prose/Li.vue.d.ts +84 -0
- package/dist/runtime/prose/Ol.vue +18 -23
- package/dist/runtime/prose/Ol.vue.d.ts +84 -0
- package/dist/runtime/prose/P.vue +18 -23
- package/dist/runtime/prose/P.vue.d.ts +84 -0
- package/dist/runtime/prose/Pre.vue +28 -33
- package/dist/runtime/prose/Pre.vue.d.ts +117 -0
- package/dist/runtime/prose/Strong.vue +18 -23
- package/dist/runtime/prose/Strong.vue.d.ts +84 -0
- package/dist/runtime/prose/Table.vue +44 -54
- package/dist/runtime/prose/Table.vue.d.ts +144 -0
- package/dist/runtime/prose/Tbody.vue +18 -23
- package/dist/runtime/prose/Tbody.vue.d.ts +84 -0
- package/dist/runtime/prose/Td.vue +18 -23
- package/dist/runtime/prose/Td.vue.d.ts +84 -0
- package/dist/runtime/prose/Th.vue +18 -23
- package/dist/runtime/prose/Th.vue.d.ts +84 -0
- package/dist/runtime/prose/Thead.vue +18 -23
- package/dist/runtime/prose/Thead.vue.d.ts +84 -0
- package/dist/runtime/prose/Tr.vue +18 -23
- package/dist/runtime/prose/Tr.vue.d.ts +84 -0
- package/dist/runtime/prose/Ul.vue +18 -23
- package/dist/runtime/prose/Ul.vue.d.ts +84 -0
- package/dist/runtime/vue/components/Link.vue +201 -202
- package/dist/runtime/vue/components/Link.vue.d.ts +129 -0
- package/dist/runtime/vue/stubs.d.ts +2 -2
- package/dist/shared/{b24ui-nuxt.DBFS6LH7.mjs → b24ui-nuxt.CS9Lf0os.mjs} +54 -4
- package/dist/types.d.mts +3 -5
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +62 -35
- package/dist/meta.cjs +0 -71922
- package/dist/meta.d.cts +0 -71920
- package/dist/meta.d.ts +0 -71920
- package/dist/module.cjs +0 -59
- package/dist/module.d.cts +0 -15
- package/dist/module.d.ts +0 -15
- package/dist/shared/b24ui-nuxt.B9fPD5yO.cjs +0 -7671
- package/dist/types.d.ts +0 -7
- package/dist/unplugin.cjs +0 -236
- package/dist/unplugin.d.cts +0 -33
- package/dist/unplugin.d.ts +0 -33
- package/dist/vite.cjs +0 -21
- package/dist/vite.d.cts +0 -14
- package/dist/vite.d.ts +0 -14
|
@@ -1,274 +1,223 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import theme from '#build/b24ui/input-menu'
|
|
8
|
-
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
9
|
-
import { tv } from '../utils/tv'
|
|
10
|
-
import type { AvatarProps, ChipProps, InputProps, IconComponent } from '../types'
|
|
11
|
-
import type {
|
|
12
|
-
AcceptableValue,
|
|
13
|
-
ArrayOrNested,
|
|
14
|
-
GetItemKeys,
|
|
15
|
-
GetModelValue,
|
|
16
|
-
GetModelValueEmits,
|
|
17
|
-
NestedItem,
|
|
18
|
-
PartialString,
|
|
19
|
-
EmitsToProps
|
|
20
|
-
} from '../types/utils'
|
|
21
|
-
|
|
22
|
-
const appConfigInputMenu = _appConfig as AppConfig & { b24ui: { inputMenu: Partial<typeof theme> } }
|
|
23
|
-
|
|
24
|
-
const inputMenu = tv({ extend: tv(theme), ...(appConfigInputMenu.b24ui?.inputMenu || {}) })
|
|
25
|
-
|
|
26
|
-
type InputMenuVariants = VariantProps<typeof inputMenu>
|
|
27
|
-
|
|
28
|
-
interface _InputMenuItem {
|
|
29
|
-
label?: string
|
|
30
|
-
/**
|
|
31
|
-
* Display an icon on the left side.
|
|
32
|
-
* @IconComponent
|
|
33
|
-
*/
|
|
34
|
-
icon?: IconComponent
|
|
35
|
-
avatar?: AvatarProps
|
|
36
|
-
color?: InputMenuVariants['color']
|
|
37
|
-
chip?: ChipProps
|
|
38
|
-
/**
|
|
39
|
-
* The item type.
|
|
40
|
-
* @defaultValue 'item'
|
|
41
|
-
*/
|
|
42
|
-
type?: 'label' | 'separator' | 'item'
|
|
43
|
-
value?: string | number
|
|
44
|
-
disabled?: boolean
|
|
45
|
-
onSelect?(e?: Event): void
|
|
46
|
-
[key: string]: any
|
|
47
|
-
}
|
|
48
|
-
export type InputMenuItem = _InputMenuItem | AcceptableValue | boolean
|
|
49
|
-
|
|
50
|
-
export interface InputMenuProps<T extends ArrayOrNested<InputMenuItem> = ArrayOrNested<InputMenuItem>, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false> extends Pick<ComboboxRootProps<T>, 'open' | 'defaultOpen' | 'disabled' | 'name' | 'resetSearchTermOnBlur' | 'highlightOnHover'>, UseComponentIconsProps {
|
|
51
|
-
/**
|
|
52
|
-
* The element or component this component should render as.
|
|
53
|
-
* @defaultValue 'div'
|
|
54
|
-
*/
|
|
55
|
-
as?: any
|
|
56
|
-
id?: string
|
|
57
|
-
/**
|
|
58
|
-
* @defaultValue 'text'
|
|
59
|
-
*/
|
|
60
|
-
type?: InputHTMLAttributes['type']
|
|
61
|
-
/**
|
|
62
|
-
* The placeholder text when the input is empty
|
|
63
|
-
*/
|
|
64
|
-
placeholder?: string
|
|
65
|
-
/**
|
|
66
|
-
* @defaultValue 'primary'
|
|
67
|
-
*/
|
|
68
|
-
color?: InputMenuVariants['color']
|
|
69
|
-
/**
|
|
70
|
-
* @defaultValue 'md'
|
|
71
|
-
*/
|
|
72
|
-
size?: InputMenuVariants['size']
|
|
73
|
-
/**
|
|
74
|
-
* Removes padding from input
|
|
75
|
-
* @defaultValue false
|
|
76
|
-
*/
|
|
77
|
-
noPadding?: boolean
|
|
78
|
-
/**
|
|
79
|
-
* Removes all borders (rings)
|
|
80
|
-
* @defaultValue false
|
|
81
|
-
*/
|
|
82
|
-
noBorder?: boolean
|
|
83
|
-
/**
|
|
84
|
-
* Removes all borders (rings) except the bottom one
|
|
85
|
-
* @defaultValue false
|
|
86
|
-
*/
|
|
87
|
-
underline?: boolean
|
|
88
|
-
/**
|
|
89
|
-
* Rounds the corners of the button
|
|
90
|
-
* @defaultValue false
|
|
91
|
-
*/
|
|
92
|
-
rounded?: boolean
|
|
93
|
-
/**
|
|
94
|
-
* @defaultValue false
|
|
95
|
-
*/
|
|
96
|
-
required?: boolean
|
|
97
|
-
/**
|
|
98
|
-
* @defaultValue false
|
|
99
|
-
*/
|
|
100
|
-
autofocus?: boolean
|
|
101
|
-
/**
|
|
102
|
-
* @defaultValue 0
|
|
103
|
-
*/
|
|
104
|
-
autofocusDelay?: number
|
|
105
|
-
/**
|
|
106
|
-
* The icon displayed to open the menu.
|
|
107
|
-
* @defaultValue icons.chevronDown
|
|
108
|
-
* @IconComponent
|
|
109
|
-
*/
|
|
110
|
-
trailingIcon?: IconComponent
|
|
111
|
-
/**
|
|
112
|
-
* The icon displayed when an item is selected.
|
|
113
|
-
* @defaultValue icons.check
|
|
114
|
-
* @IconComponent
|
|
115
|
-
*/
|
|
116
|
-
selectedIcon?: IconComponent
|
|
117
|
-
/**
|
|
118
|
-
* The icon displayed to delete a tag.
|
|
119
|
-
* Works only when `multiple` is `true`.
|
|
120
|
-
* @defaultValue icons.close
|
|
121
|
-
* @IconComponent
|
|
122
|
-
*/
|
|
123
|
-
deleteIcon?: IconComponent
|
|
124
|
-
/**
|
|
125
|
-
* The content of the menu.
|
|
126
|
-
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
|
127
|
-
*/
|
|
128
|
-
content?: Omit<ComboboxContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<ComboboxContentEmits>>
|
|
129
|
-
/**
|
|
130
|
-
* Display an arrow alongside the menu.
|
|
131
|
-
* @defaultValue false
|
|
132
|
-
*/
|
|
133
|
-
arrow?: boolean | Omit<ComboboxArrowProps, 'as' | 'asChild'>
|
|
134
|
-
/**
|
|
135
|
-
* Render the menu in a portal.
|
|
136
|
-
* @defaultValue true
|
|
137
|
-
*/
|
|
138
|
-
portal?: boolean
|
|
139
|
-
/**
|
|
140
|
-
* When `items` is an array of objects, select the field to use as the value instead of the object itself.
|
|
141
|
-
* @defaultValue undefined
|
|
142
|
-
*/
|
|
143
|
-
valueKey?: VK
|
|
144
|
-
/**
|
|
145
|
-
* When `items` is an array of objects, select the field to use as the label.
|
|
146
|
-
* @defaultValue 'label'
|
|
147
|
-
*/
|
|
148
|
-
labelKey?: keyof NestedItem<T>
|
|
149
|
-
items?: T
|
|
150
|
-
/**
|
|
151
|
-
* The value of the InputMenu when initially rendered. Use when you do not need to control the state of the InputMenu
|
|
152
|
-
*/
|
|
153
|
-
defaultValue?: GetModelValue<T, VK, M>
|
|
154
|
-
/**
|
|
155
|
-
* The controlled value of the InputMenu. Can be binded-with with `v-model`
|
|
156
|
-
*/
|
|
157
|
-
modelValue?: GetModelValue<T, VK, M>
|
|
158
|
-
/**
|
|
159
|
-
* Whether multiple options can be selected or not
|
|
160
|
-
* @defaultValue false
|
|
161
|
-
*/
|
|
162
|
-
multiple?: M & boolean
|
|
163
|
-
tag?: string
|
|
164
|
-
/**
|
|
165
|
-
* @defaultValue 'primary'
|
|
166
|
-
*/
|
|
167
|
-
tagColor?: InputMenuVariants['tagColor']
|
|
168
|
-
/**
|
|
169
|
-
* Highlight the ring color like a focus state
|
|
170
|
-
* @defaultValue false
|
|
171
|
-
*/
|
|
172
|
-
highlight?: boolean
|
|
173
|
-
/**
|
|
174
|
-
* Determines if custom user input that does not exist in options can be added.
|
|
175
|
-
* @defaultValue false
|
|
176
|
-
*/
|
|
177
|
-
createItem?: boolean | 'always' | { position?: 'top' | 'bottom', when?: 'empty' | 'always' }
|
|
178
|
-
/**
|
|
179
|
-
* Fields to filter items by.
|
|
180
|
-
* @defaultValue [labelKey]
|
|
181
|
-
*/
|
|
182
|
-
filterFields?: string[]
|
|
183
|
-
/**
|
|
184
|
-
* When `true`, disable the default filters, useful for custom filtering (useAsyncData, useFetch, etc.).
|
|
185
|
-
* @defaultValue false
|
|
186
|
-
*/
|
|
187
|
-
ignoreFilter?: boolean
|
|
188
|
-
class?: any
|
|
189
|
-
b24ui?: PartialString<typeof inputMenu.slots>
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export type InputMenuEmits<A extends ArrayOrNested<InputMenuItem>, VK extends GetItemKeys<A> | undefined, M extends boolean> = Pick<ComboboxRootEmits, 'update:open'> & {
|
|
193
|
-
change: [payload: Event]
|
|
194
|
-
blur: [payload: FocusEvent]
|
|
195
|
-
focus: [payload: FocusEvent]
|
|
196
|
-
create: [item: string]
|
|
197
|
-
/** Event handler when highlighted element changes. */
|
|
198
|
-
highlight: [payload: {
|
|
199
|
-
ref: HTMLElement
|
|
200
|
-
value: GetModelValue<A, VK, M>
|
|
201
|
-
} | undefined]
|
|
202
|
-
} & GetModelValueEmits<A, VK, M>
|
|
203
|
-
|
|
204
|
-
type SlotProps<T extends InputMenuItem> = (props: { item: T, index: number }) => any
|
|
205
|
-
|
|
206
|
-
export interface InputMenuSlots<
|
|
207
|
-
A extends ArrayOrNested<InputMenuItem> = ArrayOrNested<InputMenuItem>,
|
|
208
|
-
VK extends GetItemKeys<A> | undefined = undefined,
|
|
209
|
-
M extends boolean = false,
|
|
210
|
-
T extends NestedItem<A> = NestedItem<A>
|
|
211
|
-
> {
|
|
212
|
-
'leading'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean, b24ui: ReturnType<typeof inputMenu> }): any
|
|
213
|
-
'trailing'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean, b24ui: ReturnType<typeof inputMenu> }): any
|
|
214
|
-
'empty'(props: { searchTerm?: string }): any
|
|
215
|
-
'item': SlotProps<T>
|
|
216
|
-
'item-leading': SlotProps<T>
|
|
217
|
-
'item-label': SlotProps<T>
|
|
218
|
-
'item-trailing': SlotProps<T>
|
|
219
|
-
'tags-item-text': SlotProps<T>
|
|
220
|
-
'tags-item-delete': SlotProps<T>
|
|
221
|
-
'create-item-label'(props: { item: string }): any
|
|
222
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import _appConfig from "#build/app.config";
|
|
3
|
+
import theme from "#build/b24ui/input-menu";
|
|
4
|
+
import { tv } from "../utils/tv";
|
|
5
|
+
const appConfigInputMenu = _appConfig;
|
|
6
|
+
const inputMenu = tv({ extend: tv(theme), ...appConfigInputMenu.b24ui?.inputMenu || {} });
|
|
223
7
|
</script>
|
|
224
8
|
|
|
225
|
-
<script setup
|
|
226
|
-
import { computed, ref, toRef, onMounted, toRaw, nextTick } from
|
|
227
|
-
import {
|
|
228
|
-
import { defu } from
|
|
229
|
-
import { isEqual } from
|
|
230
|
-
import { reactivePick, createReusableTemplate } from
|
|
231
|
-
import { useButtonGroup } from
|
|
232
|
-
import { useComponentIcons } from
|
|
233
|
-
import { useFormField } from
|
|
234
|
-
import { useLocale } from
|
|
235
|
-
import { compare, get, isArrayOfArray } from
|
|
236
|
-
import icons from
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
9
|
+
<script setup>
|
|
10
|
+
import { computed, ref, toRef, onMounted, toRaw, nextTick } from "vue";
|
|
11
|
+
import { useForwardPropsEmits, useFilter } from "reka-ui";
|
|
12
|
+
import { defu } from "defu";
|
|
13
|
+
import { isEqual } from "ohash/utils";
|
|
14
|
+
import { reactivePick, createReusableTemplate } from "@vueuse/core";
|
|
15
|
+
import { useButtonGroup } from "../composables/useButtonGroup";
|
|
16
|
+
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
17
|
+
import { useFormField } from "../composables/useFormField";
|
|
18
|
+
import { useLocale } from "../composables/useLocale";
|
|
19
|
+
import { compare, get, isArrayOfArray } from "../utils";
|
|
20
|
+
import icons from "../dictionary/icons";
|
|
21
|
+
defineOptions({ inheritAttrs: false });
|
|
22
|
+
const props = defineProps({
|
|
23
|
+
as: {
|
|
24
|
+
type: null,
|
|
25
|
+
required: false
|
|
26
|
+
},
|
|
27
|
+
id: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: false
|
|
30
|
+
},
|
|
31
|
+
type: {
|
|
32
|
+
type: null,
|
|
33
|
+
required: false,
|
|
34
|
+
default: "text"
|
|
35
|
+
},
|
|
36
|
+
placeholder: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: false
|
|
39
|
+
},
|
|
40
|
+
color: {
|
|
41
|
+
type: null,
|
|
42
|
+
required: false
|
|
43
|
+
},
|
|
44
|
+
size: {
|
|
45
|
+
type: null,
|
|
46
|
+
required: false
|
|
47
|
+
},
|
|
48
|
+
noPadding: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
required: false
|
|
51
|
+
},
|
|
52
|
+
noBorder: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
required: false
|
|
55
|
+
},
|
|
56
|
+
underline: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
required: false
|
|
59
|
+
},
|
|
60
|
+
rounded: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
required: false
|
|
63
|
+
},
|
|
64
|
+
required: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
required: false
|
|
67
|
+
},
|
|
68
|
+
autofocus: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
required: false
|
|
71
|
+
},
|
|
72
|
+
autofocusDelay: {
|
|
73
|
+
type: Number,
|
|
74
|
+
required: false,
|
|
75
|
+
default: 0
|
|
76
|
+
},
|
|
77
|
+
trailingIcon: {
|
|
78
|
+
type: [Function, Object],
|
|
79
|
+
required: false
|
|
80
|
+
},
|
|
81
|
+
selectedIcon: {
|
|
82
|
+
type: [Function, Object],
|
|
83
|
+
required: false
|
|
84
|
+
},
|
|
85
|
+
deleteIcon: {
|
|
86
|
+
type: [Function, Object],
|
|
87
|
+
required: false
|
|
88
|
+
},
|
|
89
|
+
content: {
|
|
90
|
+
type: Object,
|
|
91
|
+
required: false
|
|
92
|
+
},
|
|
93
|
+
arrow: {
|
|
94
|
+
type: [Boolean, Object],
|
|
95
|
+
required: false
|
|
96
|
+
},
|
|
97
|
+
portal: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
required: false,
|
|
100
|
+
default: true
|
|
101
|
+
},
|
|
102
|
+
valueKey: {
|
|
103
|
+
type: null,
|
|
104
|
+
required: false
|
|
105
|
+
},
|
|
106
|
+
labelKey: {
|
|
107
|
+
type: null,
|
|
108
|
+
required: false,
|
|
109
|
+
default: "label"
|
|
110
|
+
},
|
|
111
|
+
items: {
|
|
112
|
+
type: null,
|
|
113
|
+
required: false
|
|
114
|
+
},
|
|
115
|
+
defaultValue: {
|
|
116
|
+
type: null,
|
|
117
|
+
required: false
|
|
118
|
+
},
|
|
119
|
+
modelValue: {
|
|
120
|
+
type: null,
|
|
121
|
+
required: false
|
|
122
|
+
},
|
|
123
|
+
multiple: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
required: false
|
|
126
|
+
},
|
|
127
|
+
tag: {
|
|
128
|
+
type: String,
|
|
129
|
+
required: false
|
|
130
|
+
},
|
|
131
|
+
tagColor: {
|
|
132
|
+
type: null,
|
|
133
|
+
required: false
|
|
134
|
+
},
|
|
135
|
+
highlight: {
|
|
136
|
+
type: Boolean,
|
|
137
|
+
required: false
|
|
138
|
+
},
|
|
139
|
+
createItem: {
|
|
140
|
+
type: [Boolean, String, Object],
|
|
141
|
+
required: false
|
|
142
|
+
},
|
|
143
|
+
filterFields: {
|
|
144
|
+
type: Array,
|
|
145
|
+
required: false
|
|
146
|
+
},
|
|
147
|
+
ignoreFilter: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
required: false
|
|
150
|
+
},
|
|
151
|
+
class: {
|
|
152
|
+
type: null,
|
|
153
|
+
required: false
|
|
154
|
+
},
|
|
155
|
+
b24ui: {
|
|
156
|
+
type: null,
|
|
157
|
+
required: false
|
|
158
|
+
},
|
|
159
|
+
open: {
|
|
160
|
+
type: Boolean,
|
|
161
|
+
required: false
|
|
162
|
+
},
|
|
163
|
+
defaultOpen: {
|
|
164
|
+
type: Boolean,
|
|
165
|
+
required: false
|
|
166
|
+
},
|
|
167
|
+
disabled: {
|
|
168
|
+
type: Boolean,
|
|
169
|
+
required: false
|
|
170
|
+
},
|
|
171
|
+
name: {
|
|
172
|
+
type: String,
|
|
173
|
+
required: false
|
|
174
|
+
},
|
|
175
|
+
resetSearchTermOnBlur: {
|
|
176
|
+
type: Boolean,
|
|
177
|
+
required: false
|
|
178
|
+
},
|
|
179
|
+
highlightOnHover: {
|
|
180
|
+
type: Boolean,
|
|
181
|
+
required: false
|
|
182
|
+
},
|
|
183
|
+
icon: {
|
|
184
|
+
type: [Function, Object],
|
|
185
|
+
required: false
|
|
186
|
+
},
|
|
187
|
+
avatar: {
|
|
188
|
+
type: Object,
|
|
189
|
+
required: false
|
|
190
|
+
},
|
|
191
|
+
loading: {
|
|
192
|
+
type: Boolean,
|
|
193
|
+
required: false
|
|
194
|
+
},
|
|
195
|
+
trailing: {
|
|
196
|
+
type: Boolean,
|
|
197
|
+
required: false
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
const emits = defineEmits(["update:open", "change", "blur", "focus", "create", "highlight", "update:modelValue"]);
|
|
201
|
+
const slots = defineSlots();
|
|
202
|
+
const searchTerm = defineModel("searchTerm", {
|
|
203
|
+
"type": String,
|
|
204
|
+
...{
|
|
205
|
+
default: ""
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
const { t } = useLocale();
|
|
209
|
+
const { contains } = useFilter({ sensitivity: "base" });
|
|
210
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "open", "defaultOpen", "required", "multiple", "resetSearchTermOnBlur", "highlightOnHover", "ignoreFilter"), emits);
|
|
211
|
+
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: "popper" }));
|
|
212
|
+
const arrowProps = toRef(() => props.arrow);
|
|
213
|
+
const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
214
|
+
const { orientation, size: buttonGroupSize } = useButtonGroup(props);
|
|
215
|
+
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, { trailingIcon: icons.chevronDown })));
|
|
216
|
+
const inputSize = computed(() => buttonGroupSize.value || formGroupSize.value);
|
|
266
217
|
const isTag = computed(() => {
|
|
267
|
-
return props.tag
|
|
268
|
-
})
|
|
269
|
-
|
|
270
|
-
const [DefineCreateItemTemplate, ReuseCreateItemTemplate] = createReusableTemplate()
|
|
271
|
-
|
|
218
|
+
return props.tag;
|
|
219
|
+
});
|
|
220
|
+
const [DefineCreateItemTemplate, ReuseCreateItemTemplate] = createReusableTemplate();
|
|
272
221
|
const b24ui = computed(() => inputMenu({
|
|
273
222
|
color: color.value,
|
|
274
223
|
size: inputSize?.value,
|
|
@@ -283,134 +232,104 @@ const b24ui = computed(() => inputMenu({
|
|
|
283
232
|
trailing: Boolean(isTrailing.value || !!slots.trailing),
|
|
284
233
|
multiple: props.multiple,
|
|
285
234
|
buttonGroup: orientation.value
|
|
286
|
-
}))
|
|
287
|
-
|
|
288
|
-
function displayValue(value: T): string {
|
|
235
|
+
}));
|
|
236
|
+
function displayValue(value) {
|
|
289
237
|
if (!props.valueKey) {
|
|
290
|
-
return value && (typeof value ===
|
|
238
|
+
return value && (typeof value === "object" ? get(value, props.labelKey) : value);
|
|
291
239
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
return item && (typeof item === 'object' ? get(item, props.labelKey as string) : item)
|
|
240
|
+
const item = items.value.find((item2) => compare(typeof item2 === "object" ? get(item2, props.valueKey) : item2, value));
|
|
241
|
+
return item && (typeof item === "object" ? get(item, props.labelKey) : item);
|
|
295
242
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
? props.items
|
|
301
|
-
: [props.items]
|
|
302
|
-
: []
|
|
303
|
-
)
|
|
304
|
-
// eslint-disable-next-line vue/no-dupe-keys
|
|
305
|
-
const items = computed(() => groups.value.flatMap(group => group))
|
|
306
|
-
|
|
243
|
+
const groups = computed(
|
|
244
|
+
() => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
|
|
245
|
+
);
|
|
246
|
+
const items = computed(() => groups.value.flatMap((group) => group));
|
|
307
247
|
const filteredGroups = computed(() => {
|
|
308
248
|
if (props.ignoreFilter || !searchTerm.value) {
|
|
309
|
-
return groups.value
|
|
249
|
+
return groups.value;
|
|
310
250
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
if (typeof item !== 'object' || item === null) {
|
|
316
|
-
return contains(String(item), searchTerm.value)
|
|
251
|
+
const fields = Array.isArray(props.filterFields) ? props.filterFields : [props.labelKey];
|
|
252
|
+
return groups.value.map((group) => group.filter((item) => {
|
|
253
|
+
if (typeof item !== "object" || item === null) {
|
|
254
|
+
return contains(String(item), searchTerm.value);
|
|
317
255
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
return true
|
|
256
|
+
if (item.type && ["label", "separator"].includes(item.type)) {
|
|
257
|
+
return true;
|
|
321
258
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
const filteredItems = computed(() => filteredGroups.value.flatMap(group => group))
|
|
329
|
-
|
|
259
|
+
return fields.some((field) => contains(get(item, field), searchTerm.value));
|
|
260
|
+
})).filter((group) => group.filter(
|
|
261
|
+
(item) => !isInputItem(item) || isInputItem(item) && (!item.type || !["label", "separator"].includes(item.type))
|
|
262
|
+
).length > 0);
|
|
263
|
+
});
|
|
264
|
+
const filteredItems = computed(() => filteredGroups.value.flatMap((group) => group));
|
|
330
265
|
const createItem = computed(() => {
|
|
331
266
|
if (!props.createItem || !searchTerm.value) {
|
|
332
|
-
return false
|
|
267
|
+
return false;
|
|
333
268
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
if ((typeof props.createItem === 'object' && props.createItem.when === 'always') || props.createItem === 'always') {
|
|
338
|
-
return !filteredItems.value.find(item => compare(item, newItem, String(props.valueKey)))
|
|
269
|
+
const newItem = props.valueKey ? { [props.valueKey]: searchTerm.value } : searchTerm.value;
|
|
270
|
+
if (typeof props.createItem === "object" && props.createItem.when === "always" || props.createItem === "always") {
|
|
271
|
+
return !filteredItems.value.find((item) => compare(item, newItem, String(props.valueKey)));
|
|
339
272
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
const inputRef = ref<InstanceType<typeof ComboboxInput> | null>(null)
|
|
346
|
-
|
|
273
|
+
return !filteredItems.value.length;
|
|
274
|
+
});
|
|
275
|
+
const createItemPosition = computed(() => typeof props.createItem === "object" ? props.createItem.position : "bottom");
|
|
276
|
+
const inputRef = ref(null);
|
|
347
277
|
function autoFocus() {
|
|
348
278
|
if (props.autofocus) {
|
|
349
|
-
inputRef.value?.$el?.focus()
|
|
279
|
+
inputRef.value?.$el?.focus();
|
|
350
280
|
}
|
|
351
281
|
}
|
|
352
|
-
|
|
353
282
|
onMounted(() => {
|
|
354
283
|
setTimeout(() => {
|
|
355
|
-
autoFocus()
|
|
356
|
-
}, props.autofocusDelay)
|
|
357
|
-
})
|
|
358
|
-
|
|
359
|
-
function onUpdate(value: any) {
|
|
284
|
+
autoFocus();
|
|
285
|
+
}, props.autofocusDelay);
|
|
286
|
+
});
|
|
287
|
+
function onUpdate(value) {
|
|
360
288
|
if (toRaw(props.modelValue) === value) {
|
|
361
|
-
return
|
|
289
|
+
return;
|
|
362
290
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
emitFormInput()
|
|
291
|
+
const event = new Event("change", { target: { value } });
|
|
292
|
+
emits("change", event);
|
|
293
|
+
emitFormChange();
|
|
294
|
+
emitFormInput();
|
|
368
295
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
emitFormBlur()
|
|
296
|
+
function onBlur(event) {
|
|
297
|
+
emits("blur", event);
|
|
298
|
+
emitFormBlur();
|
|
373
299
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
emitFormFocus()
|
|
300
|
+
function onFocus(event) {
|
|
301
|
+
emits("focus", event);
|
|
302
|
+
emitFormFocus();
|
|
378
303
|
}
|
|
379
|
-
|
|
380
|
-
function onUpdateOpen(value: boolean) {
|
|
304
|
+
function onUpdateOpen(value) {
|
|
381
305
|
if (!value) {
|
|
382
|
-
const event = new FocusEvent(
|
|
383
|
-
emits(
|
|
384
|
-
emitFormBlur()
|
|
306
|
+
const event = new FocusEvent("blur");
|
|
307
|
+
emits("blur", event);
|
|
308
|
+
emitFormBlur();
|
|
385
309
|
} else {
|
|
386
|
-
const event = new FocusEvent(
|
|
387
|
-
emits(
|
|
310
|
+
const event = new FocusEvent("focus");
|
|
311
|
+
emits("focus", event);
|
|
388
312
|
}
|
|
389
|
-
|
|
390
313
|
nextTick(() => {
|
|
391
|
-
searchTerm.value =
|
|
392
|
-
})
|
|
314
|
+
searchTerm.value = "";
|
|
315
|
+
});
|
|
393
316
|
}
|
|
394
|
-
|
|
395
|
-
function onRemoveTag(event: any) {
|
|
317
|
+
function onRemoveTag(event) {
|
|
396
318
|
if (props.multiple) {
|
|
397
|
-
const modelValue = props.modelValue
|
|
398
|
-
const filteredValue = modelValue.filter(value => !isEqual(value, event))
|
|
399
|
-
emits(
|
|
400
|
-
onUpdate(filteredValue)
|
|
319
|
+
const modelValue = props.modelValue;
|
|
320
|
+
const filteredValue = modelValue.filter((value) => !isEqual(value, event));
|
|
321
|
+
emits("update:modelValue", filteredValue);
|
|
322
|
+
onUpdate(filteredValue);
|
|
401
323
|
}
|
|
402
324
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
return typeof item === 'object' && item !== null
|
|
325
|
+
function isInputItem(item) {
|
|
326
|
+
return typeof item === "object" && item !== null;
|
|
406
327
|
}
|
|
407
|
-
|
|
408
328
|
defineExpose({
|
|
409
329
|
inputRef
|
|
410
|
-
})
|
|
330
|
+
});
|
|
411
331
|
</script>
|
|
412
332
|
|
|
413
|
-
<!-- eslint-disable vue/no-template-shadow -->
|
|
414
333
|
<template>
|
|
415
334
|
<DefineCreateItemTemplate>
|
|
416
335
|
<ComboboxGroup :class="b24ui.group({ addNew: true, class: props.b24ui?.group })">
|
|
@@ -425,7 +344,7 @@ defineExpose({
|
|
|
425
344
|
:is="icons.plus"
|
|
426
345
|
:class="b24ui.itemLeadingIcon({ addNew: true, class: props.b24ui?.itemLeadingIcon })"
|
|
427
346
|
/>
|
|
428
|
-
{{ t(
|
|
347
|
+
{{ t("inputMenu.create", { label: searchTerm }) }}
|
|
429
348
|
</slot>
|
|
430
349
|
</span>
|
|
431
350
|
</ComboboxItem>
|
|
@@ -452,7 +371,7 @@ defineExpose({
|
|
|
452
371
|
<TagsInputRoot
|
|
453
372
|
v-if="multiple"
|
|
454
373
|
v-slot="{ modelValue: tags }"
|
|
455
|
-
:model-value="
|
|
374
|
+
:model-value="modelValue"
|
|
456
375
|
:disabled="disabled"
|
|
457
376
|
:required="required"
|
|
458
377
|
delimiter=""
|
|
@@ -461,15 +380,15 @@ defineExpose({
|
|
|
461
380
|
@focus="onFocus"
|
|
462
381
|
@remove-tag="onRemoveTag"
|
|
463
382
|
>
|
|
464
|
-
<TagsInputItem v-for="(item, index) in tags" :key="index" :value="
|
|
383
|
+
<TagsInputItem v-for="(item, index) in tags" :key="index" :value="item" :class="b24ui.tagsItem({ class: props.b24ui?.tagsItem })">
|
|
465
384
|
<TagsInputItemText :class="b24ui.tagsItemText({ class: props.b24ui?.tagsItemText })">
|
|
466
|
-
<slot name="tags-item-text" :item="
|
|
467
|
-
{{ displayValue(item
|
|
385
|
+
<slot name="tags-item-text" :item="item" :index="index">
|
|
386
|
+
{{ displayValue(item) }}
|
|
468
387
|
</slot>
|
|
469
388
|
</TagsInputItemText>
|
|
470
389
|
|
|
471
390
|
<TagsInputItemDelete :class="b24ui.tagsItemDelete({ class: props.b24ui?.tagsItemDelete })" :disabled="disabled">
|
|
472
|
-
<slot name="tags-item-delete" :item="
|
|
391
|
+
<slot name="tags-item-delete" :item="item" :index="index">
|
|
473
392
|
<Component
|
|
474
393
|
:is="deleteIcon || icons.close"
|
|
475
394
|
:class="b24ui.tagsItemDeleteIcon({ class: props.b24ui?.tagsItemDeleteIcon })"
|
|
@@ -503,18 +422,18 @@ defineExpose({
|
|
|
503
422
|
/>
|
|
504
423
|
|
|
505
424
|
<span v-if="isLeading || !!avatar || !!slots.leading" :class="b24ui.leading({ class: props.b24ui?.leading })">
|
|
506
|
-
<slot name="leading" :model-value="
|
|
425
|
+
<slot name="leading" :model-value="modelValue" :open="open" :b24ui="b24ui">
|
|
507
426
|
<Component
|
|
508
427
|
:is="leadingIconName"
|
|
509
428
|
v-if="isLeading && leadingIconName"
|
|
510
429
|
:class="b24ui.leadingIcon({ class: props.b24ui?.leadingIcon })"
|
|
511
430
|
/>
|
|
512
|
-
<B24Avatar v-else-if="!!avatar" :size="
|
|
431
|
+
<B24Avatar v-else-if="!!avatar" :size="props.b24ui?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()" v-bind="avatar" :class="b24ui.itemLeadingAvatar({ class: props.b24ui?.itemLeadingAvatar })" />
|
|
513
432
|
</slot>
|
|
514
433
|
</span>
|
|
515
434
|
|
|
516
435
|
<ComboboxTrigger v-if="isTrailing || !!slots.trailing" :class="b24ui.trailing({ class: props.b24ui?.trailing })">
|
|
517
|
-
<slot name="trailing" :model-value="
|
|
436
|
+
<slot name="trailing" :model-value="modelValue" :open="open" :b24ui="b24ui">
|
|
518
437
|
<Component
|
|
519
438
|
:is="trailingIconName"
|
|
520
439
|
v-if="trailingIconName"
|
|
@@ -528,7 +447,7 @@ defineExpose({
|
|
|
528
447
|
<ComboboxContent :class="b24ui.content({ class: props.b24ui?.content })" v-bind="contentProps">
|
|
529
448
|
<ComboboxEmpty :class="b24ui.empty({ class: props.b24ui?.empty })">
|
|
530
449
|
<slot name="empty" :search-term="searchTerm">
|
|
531
|
-
{{ searchTerm ? t(
|
|
450
|
+
{{ searchTerm ? t("inputMenu.noMatch", { searchTerm }) : t("inputMenu.noData") }}
|
|
532
451
|
</slot>
|
|
533
452
|
</ComboboxEmpty>
|
|
534
453
|
|
|
@@ -538,29 +457,29 @@ defineExpose({
|
|
|
538
457
|
<ComboboxGroup v-for="(group, groupIndex) in filteredGroups" :key="`group-${groupIndex}`" :class="b24ui.group({ class: props.b24ui?.group })">
|
|
539
458
|
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
540
459
|
<ComboboxLabel v-if="isInputItem(item) && item.type === 'label'" :class="b24ui.label({ class: props.b24ui?.label })">
|
|
541
|
-
{{ get(item, props.labelKey
|
|
460
|
+
{{ get(item, props.labelKey) }}
|
|
542
461
|
</ComboboxLabel>
|
|
543
462
|
|
|
544
463
|
<ComboboxSeparator v-else-if="isInputItem(item) && item.type === 'separator'" :class="b24ui.separator({ class: props.b24ui?.separator })" />
|
|
545
464
|
|
|
546
465
|
<ComboboxItem
|
|
547
466
|
v-else
|
|
548
|
-
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isInputItem(item) ? item?.color :
|
|
467
|
+
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isInputItem(item) ? item?.color : void 0 })"
|
|
549
468
|
:disabled="isInputItem(item) && item.disabled"
|
|
550
469
|
:value="props.valueKey && isInputItem(item) ? get(item, String(props.valueKey)) : item"
|
|
551
470
|
@select="isInputItem(item) && item.onSelect?.($event)"
|
|
552
471
|
>
|
|
553
|
-
<slot name="item" :item="
|
|
554
|
-
<slot name="item-leading" :item="
|
|
472
|
+
<slot name="item" :item="item" :index="index">
|
|
473
|
+
<slot name="item-leading" :item="item" :index="index">
|
|
555
474
|
<Component
|
|
556
475
|
:is="item.icon"
|
|
557
476
|
v-if="isInputItem(item) && item.icon"
|
|
558
477
|
:class="b24ui.itemLeadingIcon({ class: props.b24ui?.itemLeadingIcon, colorItem: item?.color })"
|
|
559
478
|
/>
|
|
560
|
-
<B24Avatar v-else-if="isInputItem(item) && item.avatar" :size="
|
|
479
|
+
<B24Avatar v-else-if="isInputItem(item) && item.avatar" :size="props.b24ui?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="b24ui.itemLeadingAvatar({ class: props.b24ui?.itemLeadingAvatar, colorItem: item?.color })" />
|
|
561
480
|
<B24Chip
|
|
562
481
|
v-else-if="isInputItem(item) && item.chip"
|
|
563
|
-
:size="
|
|
482
|
+
:size="props.b24ui?.itemLeadingChipSize || b24ui.itemLeadingChipSize()"
|
|
564
483
|
inset
|
|
565
484
|
standalone
|
|
566
485
|
v-bind="item.chip"
|
|
@@ -569,18 +488,18 @@ defineExpose({
|
|
|
569
488
|
</slot>
|
|
570
489
|
|
|
571
490
|
<span :class="b24ui.itemLabel({ class: props.b24ui?.itemLabel })">
|
|
572
|
-
<slot name="item-label" :item="
|
|
573
|
-
{{ isInputItem(item) ? get(item, props.labelKey
|
|
491
|
+
<slot name="item-label" :item="item" :index="index">
|
|
492
|
+
{{ isInputItem(item) ? get(item, props.labelKey) : item }}
|
|
574
493
|
</slot>
|
|
575
494
|
</span>
|
|
576
495
|
|
|
577
|
-
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isInputItem(item) ? item?.color :
|
|
578
|
-
<slot name="item-trailing" :item="
|
|
496
|
+
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isInputItem(item) ? item?.color : void 0 })">
|
|
497
|
+
<slot name="item-trailing" :item="item" :index="index" />
|
|
579
498
|
|
|
580
499
|
<ComboboxItemIndicator as-child>
|
|
581
500
|
<Component
|
|
582
501
|
:is="selectedIcon || icons.check"
|
|
583
|
-
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isInputItem(item) ? item?.color :
|
|
502
|
+
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isInputItem(item) ? item?.color : void 0 })"
|
|
584
503
|
/>
|
|
585
504
|
</ComboboxItemIndicator>
|
|
586
505
|
</span>
|