@@ -5,7 +5,7 @@ import { ChangeEventHandlerControl } from "../../controls/eventHandlerControl";
55import { Section , lightenColor , sectionNames } from "lowcoder-design" ;
66import { RecordConstructorToComp } from "lowcoder-core" ;
77import { styleControl } from "comps/controls/styleControl" ;
8- import { AnimationStyle , InputFieldStyle , LabelStyle , SliderStyle , SliderStyleType , heightCalculator , widthCalculator } from "comps/controls/styleControlConstants" ;
8+ import { AnimationStyle , InputFieldStyle , LabelStyle , SliderStyle , SliderStyleType , DisabledSliderStyle , DisabledSliderStyleType , heightCalculator , widthCalculator } from "comps/controls/styleControlConstants" ;
99import styled , { css } from "styled-components" ;
1010import { default as Slider } from "antd/es/slider" ;
1111import { darkenColor , fadeColor } from "lowcoder-design" ;
@@ -15,7 +15,7 @@ import { trans } from "i18n";
1515import { memo , useCallback , useContext } from "react" ;
1616import { EditorContext } from "comps/editorState" ;
1717
18- const getStyle = ( style : SliderStyleType , vertical : boolean ) => {
18+ const getStyle = ( style : SliderStyleType , vertical : boolean , disabledStyle ?: DisabledSliderStyleType ) => {
1919 return css `
2020 & .ant-slider : not (.ant-slider-disabled ) {
2121 & ,
@@ -56,11 +56,35 @@ const getStyle = (style: SliderStyleType, vertical: boolean) => {
5656 margin : ${ style . margin } auto !important ;
5757 ` }
5858 }
59+
60+ /* Disabled state styling */
61+ & .ant-slider-disabled {
62+ .ant-slider-rail {
63+ background-color : ${ disabledStyle ?. disabledTrack || lightenColor ( style . track , 0.2 ) } !important ;
64+ }
65+ .ant-slider-track {
66+ background-color : ${ disabledStyle ?. disabledFill || lightenColor ( style . fill , 0.3 ) } !important ;
67+ }
68+ .ant-slider-handle {
69+ background-color : ${ disabledStyle ?. disabledThumb || lightenColor ( style . thumb , 0.25 ) } !important ;
70+ border-color : ${ disabledStyle ?. disabledThumbBorder || lightenColor ( style . thumbBorder , 0.25 ) } !important ;
71+ cursor : not-allowed !important ;
72+ }
73+ ${ vertical && css `
74+ width : auto;
75+ min-height : calc (300px - ${ style . margin } );
76+ margin : ${ style . margin } auto !important ;
77+ ` }
78+ }
5979 ` ;
6080} ;
6181
62- export const SliderStyled = styled ( Slider ) < { $style : SliderStyleType , $vertical : boolean } > `
63- ${ ( props ) => props . $style && getStyle ( props . $style , props . $vertical ) }
82+ export const SliderStyled = styled ( Slider ) < {
83+ $style : SliderStyleType ,
84+ $vertical : boolean ,
85+ $disabledStyle ?: DisabledSliderStyleType
86+ } > `
87+ ${ ( props ) => props . $style && getStyle ( props . $style , props . $vertical , props . $disabledStyle ) }
6488` ;
6589
6690export const SliderWrapper = styled . div < { $vertical : boolean } > `
@@ -88,6 +112,7 @@ export const SliderChildren = {
88112 prefixIcon : IconControl ,
89113 suffixIcon : IconControl ,
90114 inputFieldStyle : styleControl ( SliderStyle , 'inputFieldStyle' ) ,
115+ disabledSliderStyle : styleControl ( DisabledSliderStyle , 'disabledSliderStyle' ) ,
91116 animationStyle : styleControl ( AnimationStyle , 'animationStyle' )
92117} ;
93118
@@ -132,6 +157,9 @@ const LayoutSection = memo(({ children }: { children: RecordConstructorToComp<ty
132157 < Section name = { sectionNames . inputFieldStyle } >
133158 { children . inputFieldStyle . getPropertyView ( ) }
134159 </ Section >
160+ < Section name = { "Disabled Slider Style" } >
161+ { children . disabledSliderStyle . getPropertyView ( ) }
162+ </ Section >
135163 < Section name = { sectionNames . animationStyle } hasTooltip = { true } >
136164 { children . animationStyle . getPropertyView ( ) }
137165 </ Section >
0 commit comments