Skip to content

Commit 22ae427

Browse files
Macraheeliftikhar5
Mac
authored andcommitted
step control
1 parent a5ec696 commit 22ae427

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ 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 { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
22+
import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil";
23+
import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext";
2124

2225

2326
const sizeOptions = [
@@ -91,13 +94,29 @@ const StepsChildrenMap = {
9194
disabled: BoolCodeControl,
9295
onEvent: ChangeEventHandlerControl,
9396
options: StepOptionControl,
94-
style: withDefault( styleControl(StepsStyle), {text:'#D7D9E0'}),
97+
style: styleControl(StepsStyle , 'style'),
9598
viewRef: RefControl<HTMLDivElement>,
96-
animationStyle: styleControl(AnimationStyle)
99+
animationStyle: styleControl(AnimationStyle ,'animationStyle' )
97100
};
98101

99102
let StepControlBasicComp = (function () {
100-
return new UICompBuilder(StepsChildrenMap, (props) => {
103+
return new UICompBuilder(StepsChildrenMap, (props , dispatch) => {
104+
105+
const theme = useContext(ThemeContext);
106+
const compType = useContext(CompTypeContext);
107+
const compTheme = theme?.theme?.components?.[compType];
108+
const styleProps: Record<string, any> = {};
109+
['style', 'animationStyle'].forEach((key: string) => {
110+
styleProps[key] = (props as any)[key];
111+
});
112+
113+
useEffect(() => {
114+
setInitialCompStyles({
115+
dispatch,
116+
compTheme,
117+
styleProps,
118+
});
119+
}, []);
101120

102121
const StyledWrapper = styled.div<{ style: StepsStyleType, $animationStyle: AnimationStyleType }>`
103122
${props=>props.$animationStyle}

0 commit comments

Comments
 (0)