@@ -28,6 +28,10 @@ import { ContainerBodyChildComp } from "./containerBodyChildComp";
28
28
import { trans } from "i18n" ;
29
29
import { ControlNode } from "lowcoder-design" ;
30
30
import { StringControl } from "comps/controls/codeControl" ;
31
+ import { useContext , useEffect } from "react" ;
32
+ import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext" ;
33
+ import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil" ;
34
+ import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext" ;
31
35
32
36
const childrenMap = {
33
37
header : SimpleContainerComp ,
@@ -51,16 +55,35 @@ const childrenMap = {
51
55
autoHeight : AutoHeightControl ,
52
56
siderScrollbars : withDefault ( BoolControl , false ) ,
53
57
contentScrollbars : withDefault ( BoolControl , false ) ,
54
- style : withDefault ( styleControl ( ContainerStyle ) , { borderWidth : '1px' } ) ,
55
- headerStyle : styleControl ( ContainerHeaderStyle ) ,
56
- siderStyle : styleControl ( ContainerSiderStyle ) ,
57
- bodyStyle : styleControl ( ContainerBodyStyle ) ,
58
- footerStyle : styleControl ( ContainerFooterStyle ) ,
58
+ style : styleControl ( ContainerStyle , 'style' ) ,
59
+ headerStyle : styleControl ( ContainerHeaderStyle , 'headerStyle' ) ,
60
+ siderStyle : styleControl ( ContainerSiderStyle , 'siderStyle' ) ,
61
+ bodyStyle : styleControl ( ContainerBodyStyle , 'bodyStyle' ) ,
62
+ footerStyle : styleControl ( ContainerFooterStyle , 'footerStyle' ) ,
59
63
} ;
60
64
61
65
// Compatible with old style data 2022-8-15
62
66
const layoutBaseComp = migrateOldData (
63
67
new MultiCompBuilder ( childrenMap , ( props , dispatch ) => {
68
+
69
+ const theme = useContext ( ThemeContext ) ;
70
+ const compType = useContext ( CompTypeContext ) ;
71
+ console . log ( "compType" , compType )
72
+ const compTheme = theme ?. theme ?. components ?. [ compType ] ;
73
+ const styleProps : Record < string , any > = { } ;
74
+ [ 'style' , 'footerStyle' , 'bodyStyle' , 'siderStyle' , 'headerStyle' ] . forEach ( ( key : string ) => {
75
+ styleProps [ key ] = ( props as any ) [ key ] ;
76
+ } ) ;
77
+
78
+ useEffect ( ( ) => {
79
+ setInitialCompStyles ( {
80
+ dispatch,
81
+ compTheme,
82
+ styleProps,
83
+ } ) ;
84
+ } , [ ] ) ;
85
+
86
+
64
87
return { ...props , dispatch } ;
65
88
} ) . build ( ) ,
66
89
fixOldStyleData
0 commit comments