@@ -5,7 +5,7 @@ import { ChangeEventHandlerControl } from "../../controls/eventHandlerControl";
5
5
import { Section , lightenColor , sectionNames } from "lowcoder-design" ;
6
6
import { RecordConstructorToComp } from "lowcoder-core" ;
7
7
import { 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" ;
9
9
import styled , { css } from "styled-components" ;
10
10
import { default as Slider } from "antd/es/slider" ;
11
11
import { darkenColor , fadeColor } from "lowcoder-design" ;
@@ -15,7 +15,7 @@ import { trans } from "i18n";
15
15
import { memo , useCallback , useContext } from "react" ;
16
16
import { EditorContext } from "comps/editorState" ;
17
17
18
- const getStyle = ( style :SliderStyleType , vertical :boolean ) => {
18
+ const getStyle = ( style :SliderStyleType , vertical :boolean , disabledStyle ?: DisabledSliderStyleType ) => {
19
19
return css `
20
20
& .ant-slider : not (.ant-slider-disabled ) {
21
21
& ,
@@ -56,11 +56,35 @@ const getStyle = (style: SliderStyleType, vertical: boolean) => {
56
56
margin : ${ style . margin } auto!important ;
57
57
` }
58
58
}
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
+ }
59
79
` ;
60
80
} ;
61
81
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 ) }
64
88
` ;
65
89
66
90
export const SliderWrapper = styled . div < { $vertical :boolean } > `
@@ -88,6 +112,7 @@ export const SliderChildren = {
88
112
prefixIcon :IconControl ,
89
113
suffixIcon :IconControl ,
90
114
inputFieldStyle :styleControl ( SliderStyle , 'inputFieldStyle' ) ,
115
+ disabledSliderStyle :styleControl ( DisabledSliderStyle , 'disabledSliderStyle' ) ,
91
116
animationStyle :styleControl ( AnimationStyle , 'animationStyle' )
92
117
} ;
93
118
@@ -132,6 +157,9 @@ const LayoutSection = memo(({ children }: { children: RecordConstructorToComp<ty
132
157
< Section name = { sectionNames . inputFieldStyle } >
133
158
{ children . inputFieldStyle . getPropertyView ( ) }
134
159
</ Section >
160
+ < Section name = { "Disabled Slider Style" } >
161
+ { children . disabledSliderStyle . getPropertyView ( ) }
162
+ </ Section >
135
163
< Section name = { sectionNames . animationStyle } hasTooltip = { true } >
136
164
{ children . animationStyle . getPropertyView ( ) }
137
165
</ Section >