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

fix(VTimePicker): fix disabled props #19964

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/vuetify/src/labs/VTimePicker/VTimePickerClock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ export const VTimePickerClock = genericComponent()({
}

function wheel (e: WheelEvent) {
if (!props.scrollable || props.disabled) return

e.preventDefault()

const delta = Math.sign(-e.deltaY || 1)
Expand Down Expand Up @@ -196,6 +198,8 @@ export const VTimePickerClock = genericComponent()({
}

function onMouseDown (e: MouseEvent | TouchEvent) {
if (props.disabled) return

e.preventDefault()

window.addEventListener('mousemove', onDragMove)
Expand Down Expand Up @@ -233,7 +237,7 @@ export const VTimePickerClock = genericComponent()({
]}
onMousedown={ onMouseDown }
onTouchstart={ onMouseDown }
onWheel={ (e: WheelEvent) => (props.scrollable && wheel(e)) }
onWheel={ wheel }
ref={ clockRef }
>
<div class="v-time-picker-clock__inner" ref={ innerClockRef }>
Expand Down
9 changes: 7 additions & 2 deletions packages/vuetify/src/labs/VTimePicker/VTimePickerControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const VTimePickerControls = genericComponent()({
<VBtn
active={ props.selecting === 1 }
color={ props.selecting === 1 ? props.color : undefined }
disabled={ props.disabled }
variant="tonal"
class={{
'v-time-picker-controls__time__btn': true,
Expand All @@ -85,6 +86,7 @@ export const VTimePickerControls = genericComponent()({
'v-time-picker-controls__time--with-ampm__btn': props.ampm,
'v-time-picker-controls__time--with-seconds__btn': props.useSeconds,
}}
disabled={ props.disabled }
variant="tonal"
text={ props.minute == null ? '--' : pad(props.minute) }
onClick={ () => emit('update:selecting', SelectingTimes.Minute) }
Expand Down Expand Up @@ -113,6 +115,7 @@ export const VTimePickerControls = genericComponent()({
'v-time-picker-controls__time__btn__active': props.selecting === 3,
'v-time-picker-controls__time--with-seconds__btn': props.useSeconds,
}}
disabled={ props.disabled }
text={ props.second == null ? '--' : pad(props.second) }
/>
)
Expand All @@ -133,8 +136,9 @@ export const VTimePickerControls = genericComponent()({
'v-time-picker-controls__ampm__btn': true,
'v-time-picker-controls__ampm__btn__active': props.period === 'am',
}}
disabled={ props.disabled }
text={ t('$vuetify.timePicker.am') }
variant="tonal"
variant={ props.disabled && props.period === 'am' ? 'elevated' : 'tonal' }
onClick={ () => props.period !== 'am' ? emit('update:period', 'am') : null }
/>

Expand All @@ -146,8 +150,9 @@ export const VTimePickerControls = genericComponent()({
'v-time-picker-controls__ampm__btn': true,
'v-time-picker-controls__ampm__btn__active': props.period === 'pm',
}}
disabled={ props.disabled }
text={ t('$vuetify.timePicker.pm') }
variant="tonal"
variant={ props.disabled && props.period === 'pm' ? 'elevated' : 'tonal' }
onClick={ () => props.period !== 'pm' ? emit('update:period', 'pm') : null }
/>
</div>
Expand Down
Loading