@@ -21,7 +21,7 @@ import { NameGenerator } from "comps/utils";
21
21
import { Section , controlItem , sectionNames } from "lowcoder-design" ;
22
22
import { HintPlaceHolder } from "lowcoder-design" ;
23
23
import _ from "lodash" ;
24
- import React from "react" ;
24
+ import React , { useEffect } from "react" ;
25
25
import styled from "styled-components" ;
26
26
import { IContainer } from "../containerBase/iContainer" ;
27
27
import { SimpleContainerComp } from "../containerBase/simpleContainerComp" ;
@@ -42,6 +42,9 @@ import { EditorContext } from "comps/editorState";
42
42
43
43
import { disabledPropertyView , hiddenPropertyView } from "comps/utils/propertyUtils" ;
44
44
import { DisabledContext } from "comps/generators/uiCompBuilder" ;
45
+ import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext" ;
46
+ import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext" ;
47
+ import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil" ;
45
48
46
49
const RowWrapper = styled ( Row ) < {
47
50
$style : ResponsiveLayoutRowStyleType ;
@@ -91,9 +94,9 @@ const childrenMap = {
91
94
autoHeight : AutoHeightControl ,
92
95
rowBreak : withDefault ( BoolControl , false ) ,
93
96
matchColumnsHeight : withDefault ( BoolControl , true ) ,
94
- style : withDefault ( styleControl ( ResponsiveLayoutRowStyle ) , { } ) ,
95
- columnStyle : withDefault ( styleControl ( ResponsiveLayoutColStyle ) , { } ) ,
96
- animationStyle :styleControl ( AnimationStyle ) ,
97
+ style : styleControl ( ResponsiveLayoutRowStyle , 'style' ) ,
98
+ columnStyle : styleControl ( ResponsiveLayoutColStyle , 'columnStyle' ) ,
99
+ animationStyle :styleControl ( AnimationStyle , 'animationStyle' ) ,
97
100
columnPerRowLG : withDefault ( NumberControl , 4 ) ,
98
101
columnPerRowMD : withDefault ( NumberControl , 2 ) ,
99
102
columnPerRowSM : withDefault ( NumberControl , 1 ) ,
@@ -185,6 +188,24 @@ const ResponsiveLayout = (props: ResponsiveLayoutProps) => {
185
188
186
189
export const ResponsiveLayoutBaseComp = ( function ( ) {
187
190
return new UICompBuilder ( childrenMap , ( props , dispatch ) => {
191
+
192
+ const theme = useContext ( ThemeContext ) ;
193
+ const compType = useContext ( CompTypeContext ) ;
194
+ const compTheme = theme ?. theme ?. components ?. [ compType ] ;
195
+ const styleProps : Record < string , any > = { } ;
196
+ [ 'style' , 'animationStyle' , 'columnStyle' ] . forEach ( ( key : string ) => {
197
+ styleProps [ key ] = ( props as any ) [ key ] ;
198
+ } ) ;
199
+
200
+ useEffect ( ( ) => {
201
+ setInitialCompStyles ( {
202
+ dispatch,
203
+ compTheme,
204
+ styleProps,
205
+ } ) ;
206
+ } , [ ] ) ;
207
+
208
+
188
209
return (
189
210
< ResponsiveLayout { ...props } dispatch = { dispatch } />
190
211
) ;
0 commit comments