Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/vuetify/src/components/VList/VList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const makeVListProps = propsFactory({
...makeElevationProps(),
...makeItemsProps(),
...makeRoundedProps(),
...makeTagProps(),
...makeTagProps({ tag: 'ul' }),
...makeThemeProps(),
...makeVariantProps({ variant: 'text' } as const),
}, 'VList')
Expand Down Expand Up @@ -288,6 +288,7 @@ export const VList = genericComponent<new <
onMousedown={ onMousedown }
>
<VListChildren
groupTag={ props.tag }
items={ items.value }
returnObject={ props.returnObject }
v-slots={ slots }
Expand Down
11 changes: 10 additions & 1 deletion packages/vuetify/src/components/VList/VListChildren.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import { VListSubheader } from './VListSubheader'
import { VDivider } from '@/components/VDivider'

// Utilities
import { mergeProps } from 'vue'
import { mergeProps, toRef } from 'vue'
import { createList } from './list'
import { genericComponent, propsFactory } from '@/util'

// Types
import type { PropType } from 'vue'
import type { InternalListItem } from './VList'
import type { VListItemSlots } from './VListItem'
import type { TagProps } from '@/composables/tag'
import type { GenericProps } from '@/util'

export type VListChildrenSlots<T> = {
Expand All @@ -26,12 +27,14 @@ export type VListChildrenSlots<T> = {
}

export const makeVListChildrenProps = propsFactory({
groupTag: [String, Object, Function] as PropType<TagProps['tag']>,
items: Array as PropType<readonly InternalListItem[]>,
returnObject: Boolean,
}, 'VListChildren')

export const VListChildren = genericComponent<new <T extends InternalListItem>(
props: {
groupTag?: TagProps['tag']
items?: readonly T[]
returnObject?: boolean
},
Expand Down Expand Up @@ -64,10 +67,14 @@ export const VListChildren = genericComponent<new <T extends InternalListItem>(
title: slots.title ? (slotProps: any) => slots.title?.({ ...slotProps, item }) : undefined,
}

const childrenTag = toRef(() => props.groupTag === 'ol' || props.groupTag === 'ul' ? 'li' : undefined)

const listGroupProps = VListGroup.filterProps(itemProps)

return children ? (
<VListGroup
tag={ childrenTag.value }
groupTag={ props.groupTag }
{ ...listGroupProps }
value={ props.returnObject ? item : itemProps?.value }
rawId={ itemProps?.value }
Expand All @@ -88,6 +95,7 @@ export const VListChildren = genericComponent<new <T extends InternalListItem>(
},
default: () => (
<VListChildren
groupTag={ props.groupTag }
items={ children }
returnObject={ props.returnObject }
v-slots={ slots }
Expand All @@ -98,6 +106,7 @@ export const VListChildren = genericComponent<new <T extends InternalListItem>(
) : (
slots.item ? slots.item({ props: itemProps }) : (
<VListItem
tag={ childrenTag.value }
{ ...itemProps }
value={ props.returnObject ? item : itemProps.value }
v-slots={ slotsWithItem }
Expand Down
12 changes: 10 additions & 2 deletions packages/vuetify/src/components/VList/VListGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import { MaybeTransition } from '@/composables/transition'
import { computed } from 'vue'
import { defineComponent, genericComponent, propsFactory, useRender } from '@/util'

// Types
import type { PropType } from 'vue'
import type { TagProps } from '@/composables/tag'

export type VListGroupSlots = {
default: never
activator: { isOpen: boolean, props: Record<string, unknown> }
Expand All @@ -31,6 +35,10 @@ const VListGroupActivator = defineComponent({
})

export const makeVListGroupProps = propsFactory({
groupTag: {
type: [String, Object, Function] as PropType<TagProps['tag']>,
default: 'div',
},
/* @deprecated */
activeColor: String,
baseColor: String,
Expand Down Expand Up @@ -114,9 +122,9 @@ export const VListGroup = genericComponent<VListGroupSlots>()({
)}

<MaybeTransition transition={{ component: VExpandTransition }} disabled={ !isBooted.value }>
<div class="v-list-group__items" role="group" aria-labelledby={ id.value } v-show={ isOpen.value }>
<props.groupTag class="v-list-group__items" role="group" aria-labelledby={ id.value } v-show={ isOpen.value }>
{ slots.default?.() }
</div>
</props.groupTag>
</MaybeTransition>
</props.tag>
))
Expand Down
1 change: 1 addition & 0 deletions packages/vuetify/src/components/VTreeview/VTreeview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export const VTreeview = genericComponent<new <T>(
<VList
ref={ vListRef }
{ ...listProps }
tag="div"
class={[
'v-treeview',
{
Expand Down
Loading