Skip to content

Commit 80184e4

Browse files
committed
refactor(VDatePickerMonth): remove useless VDefaultsProvider
1 parent e738692 commit 80184e4

File tree

1 file changed

+15
-27
lines changed

1 file changed

+15
-27
lines changed

packages/vuetify/src/components/VDatePicker/VDatePickerMonth.tsx

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import './VDatePickerMonth.sass'
33

44
// Components
55
import { VBtn } from '@/components/VBtn'
6-
import { VDefaultsProvider } from '@/components/VDefaultsProvider'
76

87
// Composables
98
import { makeCalendarProps, useCalendar } from '@/composables/calendar'
@@ -12,7 +11,7 @@ import { MaybeTransition } from '@/composables/transition'
1211

1312
// Utilities
1413
import { computed, ref, shallowRef, watch } from 'vue'
15-
import { genericComponent, omit, propsFactory } from '@/util'
14+
import { genericComponent, omit, propsFactory, useRender } from '@/util'
1615

1716
// Types
1817
import type { PropType } from 'vue'
@@ -152,7 +151,7 @@ export const VDatePickerMonth = genericComponent<VDatePickerMonthSlots>()({
152151
}
153152
}
154153

155-
return () => (
154+
useRender(() => (
156155
<div class="v-date-picker-month">
157156
{ props.showWeek && (
158157
<div key="weeks" class="v-date-picker-month__weeks">
@@ -188,6 +187,17 @@ export const VDatePickerMonth = genericComponent<VDatePickerMonthSlots>()({
188187
{ daysInMonth.value.map((item, i) => {
189188
const slotProps = {
190189
props: {
190+
class: 'v-date-picker-month__day-btn',
191+
color: (item.isSelected || item.isToday) && !item.isDisabled
192+
? props.color
193+
: undefined,
194+
disabled: item.isDisabled,
195+
icon: true,
196+
ripple: false,
197+
text: item.localized,
198+
variant: item.isDisabled
199+
? item.isToday ? 'outlined' : 'text'
200+
: item.isToday && !item.isSelected ? 'outlined' : 'flat',
191201
onClick: () => onClick(item.date),
192202
},
193203
item,
@@ -212,38 +222,16 @@ export const VDatePickerMonth = genericComponent<VDatePickerMonthSlots>()({
212222
]}
213223
data-v-date={ !item.isDisabled ? item.isoDate : undefined }
214224
>
215-
216225
{ (props.showAdjacentMonths || !item.isAdjacent) && (
217-
<VDefaultsProvider
218-
defaults={{
219-
VBtn: {
220-
class: 'v-date-picker-month__day-btn',
221-
color: (item.isSelected || item.isToday) && !item.isDisabled
222-
? props.color
223-
: undefined,
224-
disabled: item.isDisabled,
225-
icon: true,
226-
ripple: false,
227-
text: item.localized,
228-
variant: item.isDisabled
229-
? item.isToday ? 'outlined' : 'text'
230-
: item.isToday && !item.isSelected ? 'outlined' : 'flat',
231-
onClick: () => onClick(item.date),
232-
},
233-
}}
234-
>
235-
{ slots.day?.(slotProps) ?? (
236-
<VBtn { ...slotProps.props } />
237-
)}
238-
</VDefaultsProvider>
226+
slots.day?.(slotProps) ?? (<VBtn { ...slotProps.props } />)
239227
)}
240228
</div>
241229
)
242230
})}
243231
</div>
244232
</MaybeTransition>
245233
</div>
246-
)
234+
))
247235
},
248236
})
249237

0 commit comments

Comments
 (0)