Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(VDataIterator): loading prop fix and add new slot "loader" #18811

Prev Previous commit
Next Next commit
refactor(VDataIterator): remove built in loader
this should probably always be implemented by the user
  • Loading branch information
johnleider committed Apr 11, 2024
commit 6f8a8997c83f3db6ce1f73c2336f7269cfc8c9b2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
@use '../../styles/tools'
@use './variables' as *

.v-data-iterator
position: relative

.v-data-iterator__loader
display: flex
align-items: center
Expand Down
22 changes: 5 additions & 17 deletions packages/vuetify/src/components/VDataIterator/VDataIterator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import './VDataIterator.sass'

// Components
import { VSlideYTransition } from '@/components/transitions'
import { VFadeTransition } from '@/components/transitions'
import { makeDataTableExpandProps, provideExpanded } from '@/components/VDataTable/composables/expand'
import { makeDataTableGroupProps, provideGroupBy, useGroupedItems } from '@/components/VDataTable/composables/group'
import { useOptions } from '@/components/VDataTable/composables/options'
Expand All @@ -14,7 +14,6 @@ import {
} from '@/components/VDataTable/composables/paginate'
import { makeDataTableSelectProps, provideSelection } from '@/components/VDataTable/composables/select'
import { createSort, makeDataTableSortProps, provideSort, useSortedItems } from '@/components/VDataTable/composables/sort'
import { VProgressCircular } from '@/components/VProgressCircular'

// Composables
import { makeDataIteratorItemsProps, useDataIteratorItems } from './composables/items'
Expand Down Expand Up @@ -82,7 +81,7 @@ export const makeVDataIteratorProps = propsFactory({
...makeTagProps(),
...makeTransitionProps({
transition: {
johnleider marked this conversation as resolved.
Show resolved Hide resolved
component: VSlideYTransition as Component,
component: VFadeTransition as Component,
hideOnLeave: true,
},
}),
Expand Down Expand Up @@ -193,22 +192,11 @@ export const VDataIterator = genericComponent<new <T> (

<MaybeTransition transition={ props.transition }>
{ props.loading ? (
<LoaderSlot name="v-data-iterator" active>
{ slotProps => (
slots.loader
? slots.loader?.(slotProps)
: (
<VProgressCircular
color={ typeof props.loading === 'boolean' ? undefined : props.loading }
indeterminate
size="36"
width="2"
/>
)
)}
<LoaderSlot key="loader" name="v-data-iterator" active>
{ slotProps => slots.loader?.(slotProps) }
</LoaderSlot>
) : (
<div>
<div key="items">
{ !paginatedItems.value.length
? slots['no-data']?.()
: slots.default?.(slotProps.value)
Expand Down
Loading