@@ -36,6 +36,9 @@ import { BaseSelectRef } from "rc-select";
36
36
import { RefControl } from "comps/controls/refControl" ;
37
37
import { useContext } from "react" ;
38
38
import { EditorContext } from "comps/editorState" ;
39
+ import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext" ;
40
+ import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext" ;
41
+ import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil" ;
39
42
40
43
const StyledTreeSelect = styled ( TreeSelect ) < { $style : TreeSelectStyleType } > `
41
44
width: 100%;
@@ -65,9 +68,9 @@ const childrenMap = {
65
68
allowClear : BoolControl ,
66
69
showSearch : BoolControl . DEFAULT_TRUE ,
67
70
inputValue : stateComp < string > ( "" ) , // search value
68
- style :styleControl ( InputFieldStyle ) ,
69
- labelStyle :styleControl ( LabelStyle ) ,
70
- inputFieldStyle : withDefault ( styleControl ( TreeSelectStyle ) , { borderWidth : '1px' } ) ,
71
+ style :styleControl ( InputFieldStyle , 'style' ) ,
72
+ labelStyle :styleControl ( LabelStyle , 'labelStyle' ) ,
73
+ inputFieldStyle : styleControl ( TreeSelectStyle , 'inputFieldStyle' ) ,
71
74
viewRef : RefControl < BaseSelectRef > ,
72
75
} ;
73
76
@@ -145,9 +148,27 @@ const TreeCompView = (
145
148
} ;
146
149
147
150
let TreeBasicComp = ( function ( ) {
148
- return new UICompBuilder ( childrenMap , ( props , dispatch ) => (
151
+ return new UICompBuilder ( childrenMap , ( props , dispatch ) => {
152
+
153
+ const theme = useContext ( ThemeContext ) ;
154
+ const compType = useContext ( CompTypeContext ) ;
155
+ console . log ( "compType" , compType )
156
+ const compTheme = theme ?. theme ?. components ?. [ compType ] ;
157
+ const styleProps : Record < string , any > = { } ;
158
+ [ 'style' , 'labelStyle' , 'inputFieldStyle' ] . forEach ( ( key : string ) => {
159
+ styleProps [ key ] = ( props as any ) [ key ] ;
160
+ } ) ;
161
+
162
+ useEffect ( ( ) => {
163
+ setInitialCompStyles ( {
164
+ dispatch,
165
+ compTheme,
166
+ styleProps,
167
+ } ) ;
168
+ } , [ ] ) ;
169
+ return (
149
170
< TreeCompView { ...props } dispatch = { dispatch } />
150
- ) )
171
+ ) } )
151
172
. setPropertyViewFn ( ( children ) => (
152
173
< >
153
174
< Section name = { sectionNames . basic } >
0 commit comments