Skip to content

Commit

Permalink
fix(VSelect): update visible items when eager is set
Browse files Browse the repository at this point in the history
fixes #19765
  • Loading branch information
KaelWD committed Jul 25, 2024
1 parent b9ed79d commit 7d3557a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ export const VAutocomplete = genericComponent<new <
}
}

function onAfterEnter () {
if (props.eager) {
vVirtualScrollRef.value?.calculateVisibleItems()
}
}
function onAfterLeave () {
if (isFocused.value) {
isPristine.value = true
Expand Down Expand Up @@ -466,6 +471,7 @@ export const VAutocomplete = genericComponent<new <
openOnClick={ false }
closeOnContentClick={ false }
transition={ props.transition }
onAfterEnter={ onAfterEnter }
onAfterLeave={ onAfterLeave }
{ ...props.menuProps }
>
Expand Down
6 changes: 6 additions & 0 deletions packages/vuetify/src/components/VCombobox/VCombobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@ export const VCombobox = genericComponent<new <
}
}
}
function onAfterEnter () {
if (props.eager) {
vVirtualScrollRef.value?.calculateVisibleItems()
}
}
function onAfterLeave () {
if (isFocused.value) {
isPristine.value = true
Expand Down Expand Up @@ -510,6 +515,7 @@ export const VCombobox = genericComponent<new <
openOnClick={ false }
closeOnContentClick={ false }
transition={ props.transition }
onAfterEnter={ onAfterEnter }
onAfterLeave={ onAfterLeave }
{ ...props.menuProps }
>
Expand Down
6 changes: 6 additions & 0 deletions packages/vuetify/src/components/VSelect/VSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ export const VSelect = genericComponent<new <
menu.value = false
}
}
function onAfterEnter () {
if (props.eager) {
vVirtualScrollRef.value?.calculateVisibleItems()
}
}
function onAfterLeave () {
if (isFocused.value) {
vTextFieldRef.value?.focus()
Expand Down Expand Up @@ -388,6 +393,7 @@ export const VSelect = genericComponent<new <
openOnClick={ false }
closeOnContentClick={ false }
transition={ props.transition }
onAfterEnter={ onAfterEnter }
onAfterLeave={ onAfterLeave }
{ ...computedMenuProps.value }
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const VVirtualScroll = genericComponent<new <T, Renderless extends boolea
const vm = getCurrentInstance('VVirtualScroll')
const { dimensionStyles } = useDimension(props)
const {
calculateVisibleItems,
containerRef,
markerRef,
handleScroll,
Expand Down Expand Up @@ -138,6 +139,7 @@ export const VVirtualScroll = genericComponent<new <T, Renderless extends boolea
})

return {
calculateVisibleItems,
scrollToIndex,
}
},
Expand Down
1 change: 1 addition & 0 deletions packages/vuetify/src/composables/virtual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ export function useVirtual <T> (props: VirtualProps, items: Ref<readonly T[]>) {
}, { deep: true })

return {
calculateVisibleItems,
containerRef,
markerRef,
computedItems,
Expand Down

0 comments on commit 7d3557a

Please sign in to comment.