@@ -10,14 +10,15 @@ import styled, { css } from "styled-components";
1010import { UICompBuilder , withDefault } from "../../generators" ;
1111import { CommonNameConfig , NameConfig , withExposingConfigs } from "../../generators/withExposing" ;
1212import { selectDivRefMethods , } from "./selectInputConstants" ;
13- import { Section , sectionNames } from "lowcoder-design" ;
13+ import { ScrollBar , Section , sectionNames } from "lowcoder-design" ;
1414import { hiddenPropertyView , disabledPropertyView } from "comps/utils/propertyUtils" ;
1515import { trans } from "i18n" ;
1616import { hasIcon } from "comps/utils" ;
1717import { RefControl } from "comps/controls/refControl" ;
1818import { dropdownControl } from "comps/controls/dropdownControl" ;
1919import { useContext , useState , useEffect } from "react" ;
2020import { EditorContext } from "comps/editorState" ;
21+ import { AutoHeightControl } from "@lowcoder-ee/index.sdk" ;
2122
2223const sizeOptions = [
2324 {
@@ -76,6 +77,7 @@ const statusOptions = [
7677]
7778
7879const StepsChildrenMap = {
80+ autoHeight : AutoHeightControl ,
7981 initialValue : numberExposingStateControl ( "1" ) ,
8082 value : stringExposingStateControl ( "value" ) ,
8183 stepStatus : stringExposingStateControl ( "process" ) ,
@@ -92,13 +94,16 @@ const StepsChildrenMap = {
9294 options : StepOptionControl ,
9395 style : styleControl ( StepsStyle , 'style' ) ,
9496 viewRef : RefControl < HTMLDivElement > ,
95- animationStyle : styleControl ( AnimationStyle , 'animationStyle' )
97+ animationStyle : styleControl ( AnimationStyle , 'animationStyle' ) ,
98+ showVerticalScrollbar : withDefault ( BoolControl , false ) ,
9699} ;
97100
98101let StepControlBasicComp = ( function ( ) {
99102 return new UICompBuilder ( StepsChildrenMap , ( props ) => {
100103 const StyledWrapper = styled . div < { style : StepsStyleType , $animationStyle : AnimationStyleType } > `
101104 ${ props => props . $animationStyle }
105+ height: 100%;
106+ overflow-y: scroll;
102107 min-height: 24px;
103108 max-width: ${ widthCalculator ( props . style . margin ) } ;
104109 max-height: ${ heightCalculator ( props . style . margin ) } ;
@@ -168,6 +173,14 @@ let StepControlBasicComp = (function () {
168173 } }
169174 >
170175 < 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 } >
171184 < Steps
172185 initial = { props . initialValue . value - 1 }
173186 current = { current }
@@ -191,6 +204,7 @@ let StepControlBasicComp = (function () {
191204 />
192205 ) ) }
193206 </ Steps >
207+ </ ScrollBar >
194208 </ StyledWrapper >
195209 </ ConfigProvider >
196210 ) ;
@@ -217,6 +231,12 @@ let StepControlBasicComp = (function () {
217231
218232 { [ "layout" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) && (
219233 < Section name = { sectionNames . layout } >
234+ { children . autoHeight . getPropertyView ( ) }
235+ { ! children . autoHeight . getView ( ) && (
236+ children . showVerticalScrollbar . propertyView ( {
237+ label : trans ( "prop.showVerticalScrollbar" ) ,
238+ } )
239+ ) }
220240 { children . size . propertyView ( {
221241 label : trans ( "step.size" ) ,
222242 radioButton : true ,
@@ -260,6 +280,12 @@ let StepControlBasicComp = (function () {
260280 . build ( ) ;
261281} ) ( ) ;
262282
283+ StepControlBasicComp = class extends StepControlBasicComp {
284+ override autoHeight ( ) : boolean {
285+ return this . children . autoHeight . getView ( ) ;
286+ }
287+ } ;
288+
263289export const StepComp = withExposingConfigs ( StepControlBasicComp , [
264290 new NameConfig ( "value" , trans ( "step.valueDesc" ) ) ,
265291 new NameConfig ( "stepStatus" , trans ( "step.status" ) ) ,
0 commit comments