@@ -16,6 +16,10 @@ import { IconControl } from "comps/controls/iconControl";
16
16
import styled from "styled-components" ;
17
17
import { ButtonEventHandlerControl } from "comps/controls/eventHandlerControl" ;
18
18
import { manualOptionsControl } from "comps/controls/optionsControl" ;
19
+ import { useContext , useEffect } from "react" ;
20
+ import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext" ;
21
+ import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext" ;
22
+ import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil" ;
19
23
20
24
const StyledFloatButton = styled ( FloatButton ) < {
21
25
$animationStyle : AnimationStyleType ;
@@ -83,8 +87,8 @@ const childrenMap = {
83
87
image : StringControl ,
84
88
icon : withDefault ( IconControl , '/icon:antd/questioncircleoutlined' ) ,
85
89
badgeStyle : styleControl ( BadgeStyle ) ,
86
- style : styleControl ( FloatButtonStyle ) ,
87
- animationStyle : styleControl ( AnimationStyle ) ,
90
+ style : styleControl ( FloatButtonStyle , 'style' ) ,
91
+ animationStyle : styleControl ( AnimationStyle , 'animationStyle' ) ,
88
92
buttons : manualOptionsControl ( buttonGroupOption , {
89
93
initOptions : [
90
94
{ id : 0 , label : trans ( "optionsControl.optionI" , { i : '1' } ) , icon : "/icon:antd/filetextoutlined" , badge : '1' } ,
@@ -131,9 +135,26 @@ const FloatButtonView = (props: RecordConstructorToView<typeof childrenMap>) =>
131
135
} ;
132
136
133
137
let FloatButtonBasicComp = ( function ( ) {
134
- return new UICompBuilder ( childrenMap , ( props ) => (
138
+ return new UICompBuilder ( childrenMap , ( props , dispatch ) => {
139
+ const theme = useContext ( ThemeContext ) ;
140
+ const compType = useContext ( CompTypeContext ) ;
141
+ const compTheme = theme ?. theme ?. components ?. [ compType ] ;
142
+ const styleProps : Record < string , any > = { } ;
143
+ [ 'style' , 'animationStyle' ] . forEach ( ( key : string ) => {
144
+ styleProps [ key ] = ( props as any ) [ key ] ;
145
+ } ) ;
146
+
147
+ useEffect ( ( ) => {
148
+ setInitialCompStyles ( {
149
+ dispatch,
150
+ compTheme,
151
+ styleProps,
152
+ } ) ;
153
+ } , [ ] ) ;
154
+
155
+ return (
135
156
< FloatButtonView { ...props } />
136
- ) )
157
+ ) } )
137
158
. setPropertyViewFn ( ( children ) => (
138
159
< >
139
160
< Section name = { sectionNames . basic } >
0 commit comments