Skip to content

Commit 6fb2336

Browse files
committed
Revert "refactor(VDatePickerMonth): remove useless VDefaultsProvider"
This reverts commit 80184e4.
1 parent 74df3ac commit 6fb2336

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

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

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

44
// Components
55
import { VBtn } from '@/components/VBtn'
6+
import { VDefaultsProvider } from '@/components/VDefaultsProvider'
67

78
// Composables
89
import { makeCalendarProps, useCalendar } from '@/composables/calendar'
@@ -11,7 +12,7 @@ import { MaybeTransition } from '@/composables/transition'
1112

1213
// Utilities
1314
import { computed, ref, shallowRef, watch } from 'vue'
14-
import { genericComponent, omit, propsFactory, useRender } from '@/util'
15+
import { genericComponent, omit, propsFactory } from '@/util'
1516

1617
// Types
1718
import type { PropType } from 'vue'
@@ -151,7 +152,7 @@ export const VDatePickerMonth = genericComponent<VDatePickerMonthSlots>()({
151152
}
152153
}
153154

154-
useRender(() => (
155+
return () => (
155156
<div class="v-date-picker-month">
156157
{ props.showWeek && (
157158
<div key="weeks" class="v-date-picker-month__weeks">
@@ -187,17 +188,6 @@ export const VDatePickerMonth = genericComponent<VDatePickerMonthSlots>()({
187188
{ daysInMonth.value.map((item, i) => {
188189
const slotProps = {
189190
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',
201191
onClick: () => onClick(item.date),
202192
},
203193
item,
@@ -222,16 +212,38 @@ export const VDatePickerMonth = genericComponent<VDatePickerMonthSlots>()({
222212
]}
223213
data-v-date={ !item.isDisabled ? item.isoDate : undefined }
224214
>
215+
225216
{ (props.showAdjacentMonths || !item.isAdjacent) && (
226-
slots.day?.(slotProps) ?? (<VBtn { ...slotProps.props } />)
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>
227239
)}
228240
</div>
229241
)
230242
})}
231243
</div>
232244
</MaybeTransition>
233245
</div>
234-
))
246+
)
235247
},
236248
})
237249

0 commit comments

Comments
 (0)