@@ -10,14 +10,15 @@ import styled, { css } from "styled-components";
10
10
import { UICompBuilder , withDefault } from "../../generators" ;
11
11
import { CommonNameConfig , NameConfig , withExposingConfigs } from "../../generators/withExposing" ;
12
12
import { selectDivRefMethods , } from "./selectInputConstants" ;
13
- import { Section , sectionNames } from "lowcoder-design" ;
13
+ import { ScrollBar , Section , sectionNames } from "lowcoder-design" ;
14
14
import { hiddenPropertyView , disabledPropertyView } from "comps/utils/propertyUtils" ;
15
15
import { trans } from "i18n" ;
16
16
import { hasIcon } from "comps/utils" ;
17
17
import { RefControl } from "comps/controls/refControl" ;
18
18
import { dropdownControl } from "comps/controls/dropdownControl" ;
19
19
import { useContext , useState , useEffect } from "react" ;
20
20
import { EditorContext } from "comps/editorState" ;
21
+ import { AutoHeightControl } from "@lowcoder-ee/index.sdk" ;
21
22
22
23
const sizeOptions = [
23
24
{
@@ -76,6 +77,7 @@ const statusOptions = [
76
77
]
77
78
78
79
const StepsChildrenMap = {
80
+ autoHeight : AutoHeightControl ,
79
81
initialValue : numberExposingStateControl ( "1" ) ,
80
82
value : stringExposingStateControl ( "value" ) ,
81
83
stepStatus : stringExposingStateControl ( "process" ) ,
@@ -92,13 +94,16 @@ const StepsChildrenMap = {
92
94
options : StepOptionControl ,
93
95
style : styleControl ( StepsStyle , 'style' ) ,
94
96
viewRef : RefControl < HTMLDivElement > ,
95
- animationStyle : styleControl ( AnimationStyle , 'animationStyle' )
97
+ animationStyle : styleControl ( AnimationStyle , 'animationStyle' ) ,
98
+ showVerticalScrollbar : withDefault ( BoolControl , false ) ,
96
99
} ;
97
100
98
101
let StepControlBasicComp = ( function ( ) {
99
102
return new UICompBuilder ( StepsChildrenMap , ( props ) => {
100
103
const StyledWrapper = styled . div < { style : StepsStyleType , $animationStyle : AnimationStyleType } > `
101
104
${ props => props . $animationStyle }
105
+ height: 100%;
106
+ overflow-y: scroll;
102
107
min-height: 24px;
103
108
max-width: ${ widthCalculator ( props . style . margin ) } ;
104
109
max-height: ${ heightCalculator ( props . style . margin ) } ;
@@ -168,6 +173,14 @@ let StepControlBasicComp = (function () {
168
173
} }
169
174
>
170
175
< StyledWrapper style = { props . style } $animationStyle = { props . animationStyle } >
176
+ < ScrollBar
177
+ style = { {
178
+ height : props . autoHeight ? "auto" : "100%" ,
179
+ margin : "0px" ,
180
+ padding : "0px" ,
181
+ } }
182
+ overflow = "scroll"
183
+ hideScrollbar = { ! props . showVerticalScrollbar } >
171
184
< Steps
172
185
initial = { props . initialValue . value - 1 }
173
186
current = { current }
@@ -191,6 +204,7 @@ let StepControlBasicComp = (function () {
191
204
/>
192
205
) ) }
193
206
</ Steps >
207
+ </ ScrollBar >
194
208
</ StyledWrapper >
195
209
</ ConfigProvider >
196
210
) ;
@@ -217,6 +231,12 @@ let StepControlBasicComp = (function () {
217
231
218
232
{ [ "layout" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) && (
219
233
< Section name = { sectionNames . layout } >
234
+ { children . autoHeight . getPropertyView ( ) }
235
+ { ! children . autoHeight . getView ( ) && (
236
+ children . showVerticalScrollbar . propertyView ( {
237
+ label : trans ( "prop.showVerticalScrollbar" ) ,
238
+ } )
239
+ ) }
220
240
{ children . size . propertyView ( {
221
241
label : trans ( "step.size" ) ,
222
242
radioButton : true ,
@@ -260,6 +280,12 @@ let StepControlBasicComp = (function () {
260
280
. build ( ) ;
261
281
} ) ( ) ;
262
282
283
+ StepControlBasicComp = class extends StepControlBasicComp {
284
+ override autoHeight ( ) : boolean {
285
+ return this . children . autoHeight . getView ( ) ;
286
+ }
287
+ } ;
288
+
263
289
export const StepComp = withExposingConfigs ( StepControlBasicComp , [
264
290
new NameConfig ( "value" , trans ( "step.valueDesc" ) ) ,
265
291
new NameConfig ( "stepStatus" , trans ( "step.status" ) ) ,
0 commit comments