@@ -7,6 +7,10 @@ import { UICompBuilder, withDefault } from "../../generators";
7
7
import { CommonNameConfig , NameConfig , withExposingConfigs } from "../../generators/withExposing" ;
8
8
import { CascaderChildren , CascaderPropertyView , defaultDataSource } from "./cascaderContants" ;
9
9
import { refMethods } from "comps/generators/withMethodExposing" ;
10
+ import { useContext , useEffect } from "react" ;
11
+ import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext" ;
12
+ import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil" ;
13
+ import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext" ;
10
14
11
15
const CascaderStyle = styled ( Cascader ) < { $style : CascaderStyleType , $childrenInputFieldStyle :ChildrenMultiSelectStyleType } > `
12
16
width: 100%;
@@ -37,7 +41,24 @@ const DropdownRenderStyle = styled.div<{ $childrenInputFieldStyle: ChildrenMulti
37
41
let CascaderBasicComp = ( function ( ) {
38
42
const childrenMap = CascaderChildren ;
39
43
40
- return new UICompBuilder ( childrenMap , ( props ) => {
44
+ return new UICompBuilder ( childrenMap , ( props , dispatch ) => {
45
+
46
+ const theme = useContext ( ThemeContext ) ;
47
+ const compType = useContext ( CompTypeContext ) ;
48
+ const compTheme = theme ?. theme ?. components ?. [ compType ] ;
49
+ const styleProps : Record < string , any > = { } ;
50
+ [ 'style' , 'inputFieldStyle' , 'labelStyle' , 'animationStyle' ] . forEach ( ( key : string ) => {
51
+ styleProps [ key ] = ( props as any ) [ key ] ;
52
+ } ) ;
53
+
54
+ useEffect ( ( ) => {
55
+ setInitialCompStyles ( {
56
+ dispatch,
57
+ compTheme,
58
+ styleProps,
59
+ } ) ;
60
+ } , [ ] ) ;
61
+
41
62
return props . label ( {
42
63
style : props . style ,
43
64
labelStyle : props . labelStyle ,
0 commit comments