@@ -42,7 +42,9 @@ import { messageInstance } from "lowcoder-design/src/components/GlobalInstances"
42
42
43
43
import React , { useContext } from "react" ;
44
44
import { EditorContext } from "comps/editorState" ;
45
-
45
+ import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext" ;
46
+ import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil" ;
47
+ import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext" ;
46
48
const FileSizeControl = codeControl ( ( value ) => {
47
49
if ( typeof value === "number" ) {
48
50
return value ;
@@ -100,8 +102,8 @@ const commonChildren = {
100
102
showUploadList : BoolControl . DEFAULT_TRUE ,
101
103
disabled : BoolCodeControl ,
102
104
onEvent : eventHandlerControl ( EventOptions ) ,
103
- style : styleControl ( FileStyle ) ,
104
- animationStyle : styleControl ( AnimationStyle ) ,
105
+ style : styleControl ( FileStyle , 'style' ) ,
106
+ animationStyle : styleControl ( AnimationStyle , 'animationStyle' ) ,
105
107
parseFiles : BoolPureControl ,
106
108
parsedValue : stateComp < Array < JSONValue | null > > ( [ ] ) ,
107
109
prefixIcon : withDefault ( IconControl , "/icon:solid/arrow-up-from-bracket" ) ,
@@ -379,9 +381,27 @@ const childrenMap = {
379
381
...formDataChildren ,
380
382
} ;
381
383
382
- let FileTmpComp = new UICompBuilder ( childrenMap , ( props , dispatch ) => (
384
+ let FileTmpComp = new UICompBuilder ( childrenMap , ( props , dispatch ) => {
385
+
386
+ const theme = useContext ( ThemeContext ) ;
387
+ const compType = useContext ( CompTypeContext ) ;
388
+ const compTheme = theme ?. theme ?. components ?. [ compType ] ;
389
+ const styleProps : Record < string , any > = { } ;
390
+ [ 'style' , 'animationStyle' ] . forEach ( ( key : string ) => {
391
+ styleProps [ key ] = ( props as any ) [ key ] ;
392
+ } ) ;
393
+
394
+ useEffect ( ( ) => {
395
+ setInitialCompStyles ( {
396
+ dispatch,
397
+ compTheme,
398
+ styleProps,
399
+ } ) ;
400
+ } , [ ] ) ;
401
+ return (
402
+
383
403
< Upload { ...props } dispatch = { dispatch } />
384
- ) )
404
+ ) } )
385
405
. setPropertyViewFn ( ( children ) => (
386
406
< >
387
407
< Section name = { sectionNames . basic } >
0 commit comments