Skip to content

Commit d57085e

Browse files
committed
stepControl fixed
1 parent 0a7dfb8 commit d57085e

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

client/packages/lowcoder/src/comps/comps/selectInputComp/stepControl.tsx

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ import styled, { css } from "styled-components";
1010
import { UICompBuilder, withDefault } from "../../generators";
1111
import { CommonNameConfig, NameConfig, withExposingConfigs } from "../../generators/withExposing";
1212
import { selectDivRefMethods, } from "./selectInputConstants";
13-
import { Section, sectionNames } from "lowcoder-design";
13+
import { ScrollBar, Section, sectionNames } from "lowcoder-design";
1414
import { hiddenPropertyView, disabledPropertyView } from "comps/utils/propertyUtils";
1515
import { trans } from "i18n";
1616
import { hasIcon } from "comps/utils";
1717
import { RefControl } from "comps/controls/refControl";
1818
import { dropdownControl } from "comps/controls/dropdownControl";
1919
import { useContext, useState, useEffect } from "react";
2020
import { EditorContext } from "comps/editorState";
21+
import { AutoHeightControl } from "@lowcoder-ee/index.sdk";
2122

2223
const sizeOptions = [
2324
{
@@ -76,6 +77,7 @@ const statusOptions = [
7677
]
7778

7879
const 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

98101
let 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+
263289
export const StepComp = withExposingConfigs(StepControlBasicComp, [
264290
new NameConfig("value", trans("step.valueDesc")),
265291
new NameConfig("stepStatus", trans("step.status") ),

0 commit comments

Comments
 (0)