Skip to content

Commit

Permalink
refactor(VList): make itemType optional in useListItems
Browse files Browse the repository at this point in the history
fixes #19476
  • Loading branch information
yuwu9145 committed Aug 11, 2024
1 parent 3ee87ac commit f20636a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/vuetify/src/components/VList/VList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function isPrimitive (value: unknown): value is string | number | boolean {
return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean'
}

function transformItem (props: ItemProps & { itemType: string }, item: any): InternalListItem {
function transformItem (props: ItemProps & { itemType?: string }, item: any): InternalListItem {
const type = getPropertyFromItem(item, props.itemType, 'item')
const title = isPrimitive(item) ? item : getPropertyFromItem(item, props.itemTitle)
const value = getPropertyFromItem(item, props.itemValue, undefined)
Expand All @@ -63,7 +63,7 @@ function transformItem (props: ItemProps & { itemType: string }, item: any): Int
}
}

function transformItems (props: ItemProps & { itemType: string }, items: (string | object)[]) {
function transformItems (props: ItemProps & { itemType?: string }, items: (string | object)[]) {
const array: InternalListItem[] = []

for (const item of items) {
Expand All @@ -73,7 +73,7 @@ function transformItems (props: ItemProps & { itemType: string }, items: (string
return array
}

export function useListItems (props: ItemProps & { itemType: string }) {
export function useListItems (props: ItemProps & { itemType?: string }) {
const items = computed(() => transformItems(props, props.items))

return { items }
Expand Down
2 changes: 1 addition & 1 deletion packages/vuetify/src/labs/VTreeview/VTreeview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const makeVTreeviewProps = propsFactory({
collapseIcon: '$treeviewCollapse',
expandIcon: '$treeviewExpand',
slim: true,
}), ['nav']),
}), ['itemType', 'nav']),
}, 'VTreeview')

export const VTreeview = genericComponent<new <T>(
Expand Down

0 comments on commit f20636a

Please sign in to comment.