@@ -35,11 +35,14 @@ import { messageInstance } from "lowcoder-design/src/components/GlobalInstances"
35
35
import { BoolControl } from "comps/controls/boolControl" ;
36
36
import { BoolCodeControl , NumberControl , StringControl } from "comps/controls/codeControl" ;
37
37
38
- import { useContext } from "react" ;
38
+ import { useContext , useEffect } from "react" ;
39
39
import { EditorContext } from "comps/editorState" ;
40
40
41
41
import { disabledPropertyView , hiddenPropertyView } from "comps/utils/propertyUtils" ;
42
42
import { DisabledContext } from "comps/generators/uiCompBuilder" ;
43
+ import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext" ;
44
+ import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext" ;
45
+ import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil" ;
43
46
44
47
const ContainWrapper = styled . div < {
45
48
$style : ContainerStyleType & {
@@ -95,8 +98,8 @@ const childrenMap = {
95
98
rowGap : withDefault ( StringControl , "20px" ) ,
96
99
templateColumns : withDefault ( StringControl , "1fr 1fr" ) ,
97
100
columnGap : withDefault ( StringControl , "20px" ) ,
98
- style : withDefault ( styleControl ( ContainerStyle ) , { } ) ,
99
- columnStyle : withDefault ( styleControl ( ResponsiveLayoutColStyle ) , { borderWidth : '1px' } )
101
+ style : styleControl ( ContainerStyle , 'style' ) ,
102
+ columnStyle : styleControl ( ResponsiveLayoutColStyle , 'columnStyle' )
100
103
} ;
101
104
102
105
type ViewProps = RecordConstructorToView < typeof childrenMap > ;
@@ -178,6 +181,23 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
178
181
179
182
export const ResponsiveLayoutBaseComp = ( function ( ) {
180
183
return new UICompBuilder ( childrenMap , ( props , dispatch ) => {
184
+
185
+ const theme = useContext ( ThemeContext ) ;
186
+ const compType = useContext ( CompTypeContext ) ;
187
+ const compTheme = theme ?. theme ?. components ?. [ compType ] ;
188
+ const styleProps : Record < string , any > = { } ;
189
+ [ 'style' , 'columnStyle' ] . forEach ( ( key : string ) => {
190
+ styleProps [ key ] = ( props as any ) [ key ] ;
191
+ } ) ;
192
+
193
+ useEffect ( ( ) => {
194
+ setInitialCompStyles ( {
195
+ dispatch,
196
+ compTheme,
197
+ styleProps,
198
+ } ) ;
199
+ } , [ ] ) ;
200
+
181
201
return (
182
202
< ColumnLayout { ...props } dispatch = { dispatch } />
183
203
) ;
0 commit comments