@bitrix24/b24ui-nuxt 0.5.3 → 0.5.5
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/button.ts +10 -10
- package/.nuxt/b24ui/container.ts +1 -1
- package/.nuxt/b24ui/navigation-menu.ts +2 -2
- package/.nuxt/b24ui/switch.ts +1 -1
- package/.nuxt/b24ui/tabs.ts +1 -1
- package/dist/meta.cjs +47928 -45201
- package/dist/meta.d.cts +47928 -45201
- package/dist/meta.d.mts +47928 -45201
- package/dist/meta.d.ts +47928 -45201
- package/dist/meta.mjs +47928 -45201
- package/dist/module.cjs +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Alert.vue +1 -1
- package/dist/runtime/components/App.vue +1 -1
- package/dist/runtime/components/Button.vue +1 -1
- package/dist/runtime/components/Calendar.vue +40 -12
- package/dist/runtime/components/DescriptionList.vue +99 -85
- package/dist/runtime/components/DropdownMenu.vue +23 -12
- package/dist/runtime/components/DropdownMenuContent.vue +22 -15
- package/dist/runtime/components/Form.vue +1 -0
- package/dist/runtime/components/FormField.vue +1 -0
- package/dist/runtime/components/InputMenu.vue +91 -53
- package/dist/runtime/components/Link.vue +3 -0
- package/dist/runtime/components/LinkBase.vue +1 -0
- package/dist/runtime/components/Modal.vue +1 -1
- package/dist/runtime/components/NavigationMenu.vue +49 -25
- package/dist/runtime/components/RadioGroup.vue +23 -12
- package/dist/runtime/components/Select.vue +74 -47
- package/dist/runtime/components/SelectMenu.vue +95 -56
- package/dist/runtime/components/Slideover.vue +1 -1
- package/dist/runtime/components/Tabs.vue +6 -5
- package/dist/runtime/components/Toast.vue +1 -1
- package/dist/runtime/composables/defineLocale.js +1 -0
- package/dist/runtime/composables/useFormField.js +1 -1
- package/dist/runtime/types/form.d.ts +1 -0
- package/dist/runtime/types/utils.d.ts +28 -7
- package/dist/runtime/utils/index.d.ts +1 -0
- package/dist/runtime/utils/index.js +3 -0
- package/dist/runtime/utils/link.d.ts +2 -25
- package/dist/runtime/utils/link.js +31 -1
- package/dist/runtime/vue/components/Link.vue +3 -0
- package/dist/runtime/vue/stubs.d.ts +2 -2
- package/dist/shared/{b24ui-nuxt.Bh_5o1_9.cjs → b24ui-nuxt.BGKKwlPY.cjs} +17 -15
- package/dist/shared/{b24ui-nuxt.BIuy4yic.mjs → b24ui-nuxt.DWwKgFlo.mjs} +17 -15
- package/dist/unplugin.cjs +1 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +32 -17
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { VariantProps } from 'tailwind-variants'
|
|
3
|
-
import type { RadioGroupRootProps, RadioGroupRootEmits
|
|
3
|
+
import type { RadioGroupRootProps, RadioGroupRootEmits } from 'reka-ui'
|
|
4
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
5
|
import _appConfig from '#build/app.config'
|
|
6
6
|
import theme from '#build/b24ui/radio-group'
|
|
7
7
|
import { tv } from '../utils/tv'
|
|
8
|
+
import type { AcceptableValue } from '../types/utils'
|
|
8
9
|
|
|
9
10
|
const appConfigRadioGroup = _appConfig as AppConfig & { b24ui: { radioGroup: Partial<typeof theme> } }
|
|
10
11
|
|
|
@@ -12,14 +13,16 @@ const radioGroup = tv({ extend: tv(theme), ...(appConfigRadioGroup.b24ui?.radioG
|
|
|
12
13
|
|
|
13
14
|
type RadioGroupVariants = VariantProps<typeof radioGroup>
|
|
14
15
|
|
|
15
|
-
export
|
|
16
|
+
export type RadioGroupValue = AcceptableValue
|
|
17
|
+
export type RadioGroupItem = {
|
|
16
18
|
label?: string
|
|
17
19
|
description?: string
|
|
18
20
|
disabled?: boolean
|
|
19
21
|
value?: string
|
|
20
|
-
|
|
22
|
+
[key: string]: any
|
|
23
|
+
} | RadioGroupValue
|
|
21
24
|
|
|
22
|
-
export interface RadioGroupProps<T> extends Pick<RadioGroupRootProps, 'defaultValue' | 'disabled' | 'loop' | 'modelValue' | 'name' | 'required'> {
|
|
25
|
+
export interface RadioGroupProps<T extends RadioGroupItem = RadioGroupItem> extends Pick<RadioGroupRootProps, 'defaultValue' | 'disabled' | 'loop' | 'modelValue' | 'name' | 'required'> {
|
|
23
26
|
/**
|
|
24
27
|
* The element or component this component should render as.
|
|
25
28
|
* @defaultValue 'div'
|
|
@@ -63,16 +66,16 @@ export type RadioGroupEmits = RadioGroupRootEmits & {
|
|
|
63
66
|
change: [payload: Event]
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
type SlotProps<T> = (props: { item: T, modelValue?:
|
|
69
|
+
type SlotProps<T extends RadioGroupItem> = (props: { item: T & { id: string }, modelValue?: RadioGroupValue }) => any
|
|
67
70
|
|
|
68
|
-
export interface RadioGroupSlots<T> {
|
|
71
|
+
export interface RadioGroupSlots<T extends RadioGroupItem = RadioGroupItem> {
|
|
69
72
|
legend(props?: {}): any
|
|
70
73
|
label: SlotProps<T>
|
|
71
74
|
description: SlotProps<T>
|
|
72
75
|
}
|
|
73
76
|
</script>
|
|
74
77
|
|
|
75
|
-
<script setup lang="ts" generic="T extends RadioGroupItem
|
|
78
|
+
<script setup lang="ts" generic="T extends RadioGroupItem">
|
|
76
79
|
import { computed, useId } from 'vue'
|
|
77
80
|
import { RadioGroupRoot, RadioGroupItem, RadioGroupIndicator, Label, useForwardPropsEmits } from 'reka-ui'
|
|
78
81
|
import { reactivePick } from '@vueuse/core'
|
|
@@ -102,11 +105,19 @@ const b24ui = computed(() => radioGroup({
|
|
|
102
105
|
}))
|
|
103
106
|
|
|
104
107
|
function normalizeItem(item: any) {
|
|
105
|
-
if (
|
|
108
|
+
if (item === null) {
|
|
109
|
+
return {
|
|
110
|
+
id: `${id}:null`,
|
|
111
|
+
value: undefined,
|
|
112
|
+
label: undefined
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (typeof item === 'string' || typeof item === 'number') {
|
|
106
117
|
return {
|
|
107
118
|
id: `${id}:${item}`,
|
|
108
|
-
value: item,
|
|
109
|
-
label: item
|
|
119
|
+
value: String(item),
|
|
120
|
+
label: String(item)
|
|
110
121
|
}
|
|
111
122
|
}
|
|
112
123
|
|
|
@@ -170,12 +181,12 @@ function onUpdate(value: any) {
|
|
|
170
181
|
|
|
171
182
|
<div :class="b24ui.wrapper({ class: props.b24ui?.wrapper })">
|
|
172
183
|
<Label :class="b24ui.label({ class: props.b24ui?.label })" :for="item.id">
|
|
173
|
-
<slot name="label" :item="item" :model-value="modelValue">
|
|
184
|
+
<slot name="label" :item="item" :model-value="(modelValue as RadioGroupValue)">
|
|
174
185
|
{{ item.label }}
|
|
175
186
|
</slot>
|
|
176
187
|
</Label>
|
|
177
188
|
<p v-if="item.description || !!slots.description" :class="b24ui.description({ class: props.b24ui?.description })">
|
|
178
|
-
<slot name="description" :item="item" :model-value="modelValue">
|
|
189
|
+
<slot name="description" :item="item" :model-value="(modelValue as RadioGroupValue)">
|
|
179
190
|
{{ item.description }}
|
|
180
191
|
</slot>
|
|
181
192
|
</p>
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { VariantProps } from 'tailwind-variants'
|
|
3
|
-
import type { SelectRootProps, SelectRootEmits, SelectContentProps, SelectContentEmits, SelectArrowProps
|
|
3
|
+
import type { SelectRootProps, SelectRootEmits, SelectContentProps, SelectContentEmits, SelectArrowProps } from 'reka-ui'
|
|
4
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
5
|
import _appConfig from '#build/app.config'
|
|
6
6
|
import theme from '#build/b24ui/select'
|
|
7
7
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
8
8
|
import { tv } from '../utils/tv'
|
|
9
9
|
import type { AvatarProps, ChipProps, InputProps, IconComponent } from '../types'
|
|
10
|
-
import type {
|
|
10
|
+
import type {
|
|
11
|
+
AcceptableValue,
|
|
12
|
+
ArrayOrNested,
|
|
13
|
+
GetItemKeys,
|
|
14
|
+
GetItemValue,
|
|
15
|
+
GetModelValue,
|
|
16
|
+
GetModelValueEmits,
|
|
17
|
+
NestedItem,
|
|
18
|
+
PartialString,
|
|
19
|
+
EmitsToProps
|
|
20
|
+
} from '../types/utils'
|
|
11
21
|
|
|
12
22
|
const appConfigSelect = _appConfig as AppConfig & { b24ui: { select: Partial<typeof theme> } }
|
|
13
23
|
|
|
@@ -15,7 +25,7 @@ const select = tv({ extend: tv(theme), ...(appConfigSelect.b24ui?.select || {})
|
|
|
15
25
|
|
|
16
26
|
type SelectVariants = VariantProps<typeof select>
|
|
17
27
|
|
|
18
|
-
|
|
28
|
+
interface SelectItemBase {
|
|
19
29
|
label?: string
|
|
20
30
|
/**
|
|
21
31
|
* Display an icon on the left side.
|
|
@@ -30,11 +40,13 @@ export interface SelectItem {
|
|
|
30
40
|
* @defaultValue 'item'
|
|
31
41
|
*/
|
|
32
42
|
type?: 'label' | 'separator' | 'item'
|
|
33
|
-
value?: string
|
|
43
|
+
value?: string | number
|
|
34
44
|
disabled?: boolean
|
|
45
|
+
[key: string]: any
|
|
35
46
|
}
|
|
47
|
+
export type SelectItem = SelectItemBase | AcceptableValue | boolean
|
|
36
48
|
|
|
37
|
-
export interface SelectProps<T extends
|
|
49
|
+
export interface SelectProps<T extends ArrayOrNested<SelectItem> = ArrayOrNested<SelectItem>, VK extends GetItemKeys<T> = 'value', M extends boolean = false> extends Omit<SelectRootProps<T>, 'dir' | 'multiple' | 'modelValue' | 'defaultValue' | 'by'>, UseComponentIconsProps {
|
|
38
50
|
id?: string
|
|
39
51
|
/** The placeholder text when the select is empty. */
|
|
40
52
|
placeholder?: string
|
|
@@ -102,21 +114,21 @@ export interface SelectProps<T extends MaybeArrayOfArrayItem<I>, I extends Maybe
|
|
|
102
114
|
* When `items` is an array of objects, select the field to use as the value.
|
|
103
115
|
* @defaultValue 'value'
|
|
104
116
|
*/
|
|
105
|
-
valueKey?:
|
|
117
|
+
valueKey?: VK
|
|
106
118
|
/**
|
|
107
119
|
* When `items` is an array of objects, select the field to use as the label.
|
|
108
120
|
* @defaultValue 'label'
|
|
109
121
|
*/
|
|
110
|
-
labelKey?:
|
|
111
|
-
items?:
|
|
122
|
+
labelKey?: keyof NestedItem<T>
|
|
123
|
+
items?: T
|
|
112
124
|
/**
|
|
113
125
|
* The value of the Select when initially rendered. Use when you do not need to control the state of the Select
|
|
114
126
|
*/
|
|
115
|
-
defaultValue?:
|
|
127
|
+
defaultValue?: GetModelValue<T, VK, M>
|
|
116
128
|
/**
|
|
117
129
|
* The controlled value of the Select. Can be bind as `v-model`
|
|
118
130
|
*/
|
|
119
|
-
modelValue?:
|
|
131
|
+
modelValue?: GetModelValue<T, VK, M>
|
|
120
132
|
/**
|
|
121
133
|
* Whether multiple options can be selected or not
|
|
122
134
|
* @defaultValue false
|
|
@@ -131,18 +143,23 @@ export interface SelectProps<T extends MaybeArrayOfArrayItem<I>, I extends Maybe
|
|
|
131
143
|
b24ui?: PartialString<typeof select.slots>
|
|
132
144
|
}
|
|
133
145
|
|
|
134
|
-
export type SelectEmits<
|
|
146
|
+
export type SelectEmits<A extends ArrayOrNested<SelectItem>, VK extends GetItemKeys<A> | undefined, M extends boolean> = Omit<SelectRootEmits, 'update:modelValue'> & {
|
|
135
147
|
change: [payload: Event]
|
|
136
148
|
blur: [payload: FocusEvent]
|
|
137
149
|
focus: [payload: FocusEvent]
|
|
138
|
-
} &
|
|
139
|
-
|
|
140
|
-
type SlotProps<T> = (props: { item: T, index: number }) => any
|
|
141
|
-
|
|
142
|
-
export interface SelectSlots<
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
150
|
+
} & GetModelValueEmits<A, VK, M>
|
|
151
|
+
|
|
152
|
+
type SlotProps<T extends SelectItem> = (props: { item: T, index: number }) => any
|
|
153
|
+
|
|
154
|
+
export interface SelectSlots<
|
|
155
|
+
A extends ArrayOrNested<SelectItem> = ArrayOrNested<SelectItem>,
|
|
156
|
+
VK extends GetItemKeys<A> | undefined = undefined,
|
|
157
|
+
M extends boolean = false,
|
|
158
|
+
T extends NestedItem<A> = NestedItem<A>
|
|
159
|
+
> {
|
|
160
|
+
'leading'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean, b24ui: ReturnType<typeof select> }): any
|
|
161
|
+
'default'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean }): any
|
|
162
|
+
'trailing'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean, b24ui: ReturnType<typeof select> }): any
|
|
146
163
|
'item': SlotProps<T>
|
|
147
164
|
'item-leading': SlotProps<T>
|
|
148
165
|
'item-label': SlotProps<T>
|
|
@@ -150,7 +167,7 @@ export interface SelectSlots<T, M extends boolean> {
|
|
|
150
167
|
}
|
|
151
168
|
</script>
|
|
152
169
|
|
|
153
|
-
<script setup lang="ts" generic="T extends
|
|
170
|
+
<script setup lang="ts" generic="T extends ArrayOrNested<SelectItem>, VK extends GetItemKeys<T> = 'value', M extends boolean = false">
|
|
154
171
|
import { computed, toRef } from 'vue'
|
|
155
172
|
import { Primitive, SelectRoot, SelectArrow, SelectTrigger, SelectPortal, SelectContent, SelectViewport, SelectScrollUpButton, SelectScrollDownButton, SelectLabel, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectSeparator, useForwardPropsEmits } from 'reka-ui'
|
|
156
173
|
import { defu } from 'defu'
|
|
@@ -158,20 +175,20 @@ import { reactivePick } from '@vueuse/core'
|
|
|
158
175
|
import { useButtonGroup } from '../composables/useButtonGroup'
|
|
159
176
|
import { useComponentIcons } from '../composables/useComponentIcons'
|
|
160
177
|
import { useFormField } from '../composables/useFormField'
|
|
161
|
-
import { get,
|
|
178
|
+
import { compare, get, isArrayOfArray } from '../utils'
|
|
162
179
|
import icons from '../dictionary/icons'
|
|
163
180
|
import B24Avatar from './Avatar.vue'
|
|
164
181
|
import B24Chip from './Chip.vue'
|
|
165
182
|
|
|
166
183
|
defineOptions({ inheritAttrs: false })
|
|
167
184
|
|
|
168
|
-
const props = withDefaults(defineProps<SelectProps<T,
|
|
185
|
+
const props = withDefaults(defineProps<SelectProps<T, VK, M>>(), {
|
|
169
186
|
valueKey: 'value' as never,
|
|
170
187
|
labelKey: 'label' as never,
|
|
171
188
|
portal: true
|
|
172
189
|
})
|
|
173
|
-
const emits = defineEmits<SelectEmits<T,
|
|
174
|
-
const slots = defineSlots<SelectSlots<T, M>>()
|
|
190
|
+
const emits = defineEmits<SelectEmits<T, VK, M>>()
|
|
191
|
+
const slots = defineSlots<SelectSlots<T, VK, M>>()
|
|
175
192
|
|
|
176
193
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'disabled', 'autocomplete', 'required', 'multiple'), emits)
|
|
177
194
|
const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }) as SelectContentProps)
|
|
@@ -205,11 +222,17 @@ const b24ui = computed(() => select({
|
|
|
205
222
|
buttonGroup: orientation.value
|
|
206
223
|
}))
|
|
207
224
|
|
|
208
|
-
const groups = computed
|
|
225
|
+
const groups = computed<SelectItem[][]>(() =>
|
|
226
|
+
props.items?.length
|
|
227
|
+
? isArrayOfArray(props.items)
|
|
228
|
+
? props.items
|
|
229
|
+
: [props.items]
|
|
230
|
+
: []
|
|
231
|
+
)
|
|
209
232
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
210
233
|
const items = computed(() => groups.value.flatMap(group => group) as T[])
|
|
211
234
|
|
|
212
|
-
function displayValue(value?:
|
|
235
|
+
function displayValue(value?: GetItemValue<T, VK> | GetItemValue<T, VK>[]): string {
|
|
213
236
|
if (props.multiple && Array.isArray(value)) {
|
|
214
237
|
return value.map(v => displayValue(v)).filter(Boolean).join(', ')
|
|
215
238
|
}
|
|
@@ -238,6 +261,10 @@ function onUpdateOpen(value: boolean) {
|
|
|
238
261
|
emitFormFocus()
|
|
239
262
|
}
|
|
240
263
|
}
|
|
264
|
+
|
|
265
|
+
function isSelectItem(item: SelectItem): item is SelectItemBase {
|
|
266
|
+
return typeof item === 'object' && item !== null
|
|
267
|
+
}
|
|
241
268
|
</script>
|
|
242
269
|
|
|
243
270
|
<!-- eslint-disable vue/no-template-shadow -->
|
|
@@ -249,8 +276,8 @@ function onUpdateOpen(value: boolean) {
|
|
|
249
276
|
v-bind="rootProps"
|
|
250
277
|
:autocomplete="autocomplete"
|
|
251
278
|
:disabled="disabled"
|
|
252
|
-
:default-value="(defaultValue as (AcceptableValue | AcceptableValue[]
|
|
253
|
-
:model-value="(modelValue as (AcceptableValue | AcceptableValue[]
|
|
279
|
+
:default-value="(defaultValue as (AcceptableValue | AcceptableValue[]))"
|
|
280
|
+
:model-value="(modelValue as (AcceptableValue | AcceptableValue[]))"
|
|
254
281
|
@update:model-value="onUpdate"
|
|
255
282
|
@update:open="onUpdateOpen"
|
|
256
283
|
>
|
|
@@ -260,7 +287,7 @@ function onUpdateOpen(value: boolean) {
|
|
|
260
287
|
</div>
|
|
261
288
|
|
|
262
289
|
<span v-if="isLeading || !!avatar || !!slots.leading" :class="b24ui.leading({ class: props.b24ui?.leading })">
|
|
263
|
-
<slot name="leading" :model-value="(modelValue as
|
|
290
|
+
<slot name="leading" :model-value="(modelValue as GetModelValue<T, VK, M>)" :open="open" :b24ui="b24ui">
|
|
264
291
|
<Component
|
|
265
292
|
:is="leadingIconName"
|
|
266
293
|
v-if="isLeading && leadingIconName"
|
|
@@ -270,8 +297,8 @@ function onUpdateOpen(value: boolean) {
|
|
|
270
297
|
</slot>
|
|
271
298
|
</span>
|
|
272
299
|
|
|
273
|
-
<slot :model-value="(modelValue as
|
|
274
|
-
<template v-for="displayedModelValue in [displayValue(modelValue)]" :key="displayedModelValue">
|
|
300
|
+
<slot :model-value="(modelValue as GetModelValue<T, VK, M>)" :open="open">
|
|
301
|
+
<template v-for="displayedModelValue in [displayValue(modelValue as GetModelValue<T, VK, M>)]" :key="displayedModelValue">
|
|
275
302
|
<span v-if="displayedModelValue" :class="b24ui.value({ class: props.b24ui?.value })">
|
|
276
303
|
{{ displayedModelValue }}
|
|
277
304
|
</span>
|
|
@@ -282,7 +309,7 @@ function onUpdateOpen(value: boolean) {
|
|
|
282
309
|
</slot>
|
|
283
310
|
|
|
284
311
|
<span v-if="isTrailing || !!slots.trailing" :class="b24ui.trailing({ class: props.b24ui?.trailing })">
|
|
285
|
-
<slot name="trailing" :model-value="(modelValue as
|
|
312
|
+
<slot name="trailing" :model-value="(modelValue as GetModelValue<T, VK, M>)" :open="open" :b24ui="b24ui">
|
|
286
313
|
<Component
|
|
287
314
|
:is="trailingIconName"
|
|
288
315
|
v-if="trailingIconName"
|
|
@@ -303,28 +330,28 @@ function onUpdateOpen(value: boolean) {
|
|
|
303
330
|
<SelectViewport :class="b24ui.viewport({ class: props.b24ui?.viewport })">
|
|
304
331
|
<SelectGroup v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="b24ui.group({ class: props.b24ui?.group })">
|
|
305
332
|
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
306
|
-
<SelectLabel v-if="item
|
|
333
|
+
<SelectLabel v-if="isSelectItem(item) && item.type === 'label'" :class="b24ui.label({ class: props.b24ui?.label })">
|
|
307
334
|
{{ get(item, props.labelKey as string) }}
|
|
308
335
|
</SelectLabel>
|
|
309
336
|
|
|
310
|
-
<SelectSeparator v-else-if="item
|
|
337
|
+
<SelectSeparator v-else-if="isSelectItem(item) && item.type === 'separator'" :class="b24ui.separator({ class: props.b24ui?.separator })" />
|
|
311
338
|
|
|
312
339
|
<SelectItem
|
|
313
340
|
v-else
|
|
314
|
-
:class="b24ui.item({ class: props.b24ui?.item, colorItem: item?.color })"
|
|
315
|
-
:disabled="item.disabled"
|
|
316
|
-
:value="
|
|
341
|
+
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isSelectItem(item) ? item?.color : undefined })"
|
|
342
|
+
:disabled="isSelectItem(item) && item.disabled"
|
|
343
|
+
:value="isSelectItem(item) ? get(item, props.valueKey as string) : item"
|
|
317
344
|
>
|
|
318
|
-
<slot name="item" :item="(item as T)" :index="index">
|
|
319
|
-
<slot name="item-leading" :item="(item as T)" :index="index">
|
|
345
|
+
<slot name="item" :item="(item as NestedItem<T>)" :index="index">
|
|
346
|
+
<slot name="item-leading" :item="(item as NestedItem<T>)" :index="index">
|
|
320
347
|
<Component
|
|
321
348
|
:is="item.icon"
|
|
322
|
-
v-if="item.icon"
|
|
349
|
+
v-if="isSelectItem(item) && item.icon"
|
|
323
350
|
:class="b24ui.itemLeadingIcon({ class: props.b24ui?.itemLeadingIcon, colorItem: item?.color })"
|
|
324
351
|
/>
|
|
325
|
-
<B24Avatar v-else-if="item.avatar" :size="((props.b24ui?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="b24ui.itemLeadingAvatar({ class: props.b24ui?.itemLeadingAvatar, colorItem: item?.color })" />
|
|
352
|
+
<B24Avatar v-else-if="isSelectItem(item) && item.avatar" :size="((props.b24ui?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="b24ui.itemLeadingAvatar({ class: props.b24ui?.itemLeadingAvatar, colorItem: item?.color })" />
|
|
326
353
|
<B24Chip
|
|
327
|
-
v-else-if="item.chip"
|
|
354
|
+
v-else-if="isSelectItem(item) && item.chip"
|
|
328
355
|
:size="((props.b24ui?.itemLeadingChipSize || b24ui.itemLeadingChipSize()) as ChipProps['size'])"
|
|
329
356
|
inset
|
|
330
357
|
standalone
|
|
@@ -334,18 +361,18 @@ function onUpdateOpen(value: boolean) {
|
|
|
334
361
|
</slot>
|
|
335
362
|
|
|
336
363
|
<SelectItemText :class="b24ui.itemLabel({ class: props.b24ui?.itemLabel })">
|
|
337
|
-
<slot name="item-label" :item="(item as T)" :index="index">
|
|
338
|
-
{{
|
|
364
|
+
<slot name="item-label" :item="(item as NestedItem<T>)" :index="index">
|
|
365
|
+
{{ isSelectItem(item) ? get(item, props.labelKey as string) : item }}
|
|
339
366
|
</slot>
|
|
340
367
|
</SelectItemText>
|
|
341
368
|
|
|
342
|
-
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: item?.color })">
|
|
343
|
-
<slot name="item-trailing" :item="(item as T)" :index="index" />
|
|
369
|
+
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isSelectItem(item) ? item?.color : undefined })">
|
|
370
|
+
<slot name="item-trailing" :item="(item as NestedItem<T>)" :index="index" />
|
|
344
371
|
|
|
345
372
|
<SelectItemIndicator as-child>
|
|
346
373
|
<Component
|
|
347
374
|
:is="selectedIcon || icons.check"
|
|
348
|
-
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: item?.color })"
|
|
375
|
+
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isSelectItem(item) ? item?.color : undefined })"
|
|
349
376
|
/>
|
|
350
377
|
</SelectItemIndicator>
|
|
351
378
|
</span>
|