1
1
/* eslint-disable max-statements */
2
2
// Composables
3
3
import { makeElevationProps } from '@/composables/elevation'
4
+ import { useForm } from '@/composables/form'
4
5
import { useRtl } from '@/composables/locale'
5
6
import { makeRoundedProps } from '@/composables/rounded'
6
7
@@ -189,6 +190,7 @@ export const useSlider = ({
189
190
onSliderMove : ( data : SliderData ) => void
190
191
getActiveThumb : ( e : MouseEvent | TouchEvent ) => HTMLElement
191
192
} ) => {
193
+ const form = useForm ( props )
192
194
const { isRtl } = useRtl ( )
193
195
const isReversed = toRef ( ( ) => props . reverse )
194
196
const vertical = computed ( ( ) => props . direction === 'vertical' )
@@ -200,12 +202,11 @@ export const useSlider = ({
200
202
const tickSize = computed ( ( ) => parseInt ( props . tickSize , 10 ) )
201
203
const trackSize = computed ( ( ) => parseInt ( props . trackSize , 10 ) )
202
204
const numTicks = computed ( ( ) => ( max . value - min . value ) / step . value )
203
- const disabled = toRef ( ( ) => props . disabled )
204
205
205
- const thumbColor = computed ( ( ) => props . error || props . disabled ? undefined : props . thumbColor ?? props . color )
206
- const thumbLabelColor = computed ( ( ) => props . error || props . disabled ? undefined : props . thumbColor )
207
- const trackColor = computed ( ( ) => props . error || props . disabled ? undefined : props . trackColor ?? props . color )
208
- const trackFillColor = computed ( ( ) => props . error || props . disabled ? undefined : props . trackFillColor ?? props . color )
206
+ const thumbColor = computed ( ( ) => props . error || form . isDisabled . value ? undefined : props . thumbColor ?? props . color )
207
+ const thumbLabelColor = computed ( ( ) => props . error || form . isDisabled . value ? undefined : props . thumbColor )
208
+ const trackColor = computed ( ( ) => props . error || form . isDisabled . value ? undefined : props . trackColor ?? props . color )
209
+ const trackFillColor = computed ( ( ) => props . error || form . isDisabled . value ? undefined : props . trackFillColor ?? props . color )
209
210
210
211
const mousePressed = shallowRef ( false )
211
212
@@ -346,7 +347,7 @@ export const useSlider = ({
346
347
activeThumbRef,
347
348
color : toRef ( ( ) => props . color ) ,
348
349
decimals,
349
- disabled,
350
+ disabled : form . isDisabled ,
350
351
direction : toRef ( ( ) => props . direction ) ,
351
352
elevation : toRef ( ( ) => props . elevation ) ,
352
353
hasLabels,
@@ -362,7 +363,7 @@ export const useSlider = ({
362
363
parsedTicks,
363
364
parseMouseMove,
364
365
position,
365
- readonly : toRef ( ( ) => props . readonly ) ,
366
+ readonly : form . isReadonly ,
366
367
rounded : toRef ( ( ) => props . rounded ) ,
367
368
roundValue,
368
369
showTicks,
0 commit comments