File tree Expand file tree Collapse file tree 4 files changed +31
-12
lines changed
client/packages/lowcoder/src Expand file tree Collapse file tree 4 files changed +31
-12
lines changed Original file line number Diff line number Diff line change @@ -910,10 +910,6 @@ export function styleControl<T extends readonly SingleColorConfig[]>(
910910 ...defaultTheme . components ?. [ compType ] ?. [ styleKey ] as unknown as Record < string , string > ,
911911 ...( omit ( theme ?. theme , 'components' , 'chart' ) ) ,
912912 ...theme ?. theme ?. components ?. [ compType ] ?. [ styleKey ] as unknown as Record < string , string > ,
913- // ...(
914- // theme?.theme?.components?.[compType]?.[styleKey]
915- // // || defaultTheme.components?.[compType]?.[styleKey]
916- // ) as unknown as Record<string, string>
917913 }
918914 : defaultTheme . components ?. [ compType ] ?. [ styleKey ] ;
919915 const styleProps = ( ! comp && ! compType ) || preventStyleOverwriting || preventAppStylesOverwriting || appliedThemeId === themeId
Original file line number Diff line number Diff line change @@ -290,7 +290,7 @@ const UIView = React.memo((props: {
290290 }
291291
292292 useMergeCompStyles (
293- childrenJsonProps as Record < string , any > ,
293+ childrenProps as Record < string , any > ,
294294 comp . dispatch
295295 ) ;
296296
Original file line number Diff line number Diff line change @@ -38,10 +38,11 @@ export function setInitialCompStyles({
3838 const actions : Record < string , any > = {
3939 appliedThemeId : changeValueAction ( themeId || '' , true ) ,
4040 } ;
41+
4142 styleKeys . forEach ( styleKey => {
4243 actions [ styleKey ] = changeValueAction ( {
4344 ...( compTheme ?. [ styleKey ] as object || { } ) ,
44- // ...styleProps[styleKey],
45+ ...styleProps [ styleKey ] ,
4546 } , true ) ;
4647 } )
4748
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { AppPathParams } from "constants/applicationConstants";
22import React , {
33 Dispatch ,
44 SetStateAction ,
5+ useCallback ,
56 useContext ,
67 useEffect ,
78 useMemo ,
@@ -179,28 +180,49 @@ export function useMergeCompStyles(
179180 const themeId = theme ?. themeId ;
180181 const appSettingsComp = editorState ?. getAppSettingsComp ( ) ;
181182 const preventAppStylesOverwriting = appSettingsComp ?. getView ( ) ?. preventAppStylesOverwriting ;
182- const { preventStyleOverwriting } = props ;
183+ const { preventStyleOverwriting, appliedThemeId } = props ;
183184
184185 const styleKeys = Object . keys ( props ) . filter ( key => key . toLowerCase ( ) . endsWith ( 'style' || 'styles' ) ) ;
185186 const styleProps : Record < string , any > = { } ;
186187 styleKeys . forEach ( ( key : string ) => {
187188 styleProps [ key ] = ( props as any ) [ key ] ;
188189 } ) ;
189190
191+ const mergeStyles = useCallback (
192+ ( {
193+ dispatch,
194+ compTheme,
195+ styleProps,
196+ themeId
197+ } : any ) => {
198+ setInitialCompStyles ( {
199+ dispatch,
200+ compTheme,
201+ styleProps,
202+ themeId,
203+ } )
204+ } ,
205+ [ ]
206+ ) ;
207+
190208 useEffect ( ( ) => {
191- if ( preventAppStylesOverwriting || preventStyleOverwriting ) return ;
192- setInitialCompStyles ( {
209+ if (
210+ preventAppStylesOverwriting
211+ || preventStyleOverwriting
212+ || themeId === appliedThemeId
213+ ) return ;
214+ mergeStyles ( {
193215 dispatch,
194216 compTheme,
195217 styleProps,
196218 themeId,
197- } ) ;
219+ } )
198220 } , [
199221 themeId ,
200222 JSON . stringify ( styleProps ) ,
201223 JSON . stringify ( compTheme ) ,
202- setInitialCompStyles ,
224+ mergeStyles ,
203225 preventAppStylesOverwriting ,
204226 preventStyleOverwriting ,
205227 ] ) ;
206- }
228+ }
You can’t perform that action at this time.
0 commit comments