@@ -22,6 +22,7 @@ import { isValidColor, isValidGradient, ScrollBar } from "lowcoder-design";
2222import { defaultTheme } from "@lowcoder-ee/constants/themeConstants" ;
2323import { isEqual } from "lodash" ;
2424import { DEFAULT_GRID_COLUMNS , DEFAULT_ROW_COUNT , DEFAULT_ROW_HEIGHT } from "@lowcoder-ee/layout/calculateUtils" ;
25+ import { getBackgroundStyle } from "@lowcoder-ee/util/styleUtils" ;
2526
2627const UICompContainer = styled . div < {
2728 $maxWidth ?: number ;
@@ -36,15 +37,15 @@ const UICompContainer = styled.div<{
3637 height: auto;
3738 margin: 0 auto;
3839 max-width: ${ ( props ) => props . $maxWidth || 1600 } px;
39- ${ ( props ) => isValidColor ( props . $bgColor ) && `background-color: ${ props . $bgColor } ;` } ;
40- ${ ( props ) => isValidGradient ( props . $bgColor ) && ! Boolean ( props . $bgImage ) && `background-image: ${ props . $bgColor } ` } ;
41- ${ ( props ) => isValidGradient ( props . $bgColor ) && Boolean ( props . $bgImage ) && ` background-image: url( ${ props . $bgImage } ), ${ props . $ bgColor} ` } ;
42- ${ ( props ) => ! isValidGradient ( props . $bgColor ) && Boolean ( props . $bgImage ) && `background-image: ${ props . $bgColor } ` } ;
43- // ${ ( props ) => props . $bgImage && `background-image: url( ${ props . $bgImage } );` } ;
44- ${ ( props ) => props . $bgImageRepeat && `background-repeat: ${ props . $bgImageRepeat } ;` } ;
45- ${ ( props ) => props . $bgImageSize && `background-size: ${ props . $bgImageSize } ;` } ;
46- ${ ( props ) => props . $bgImageOrigin && `background-origin: ${ props . $bgImageOrigin } ;` } ;
47- ${ ( props ) => props . $bgImagePosition && `background-position: ${ props . $bgImagePosition } ;` } ;
40+
41+ ${ props => getBackgroundStyle ( {
42+ background : props . $bgColor ,
43+ backgroundImage : props . $bgImage ,
44+ backgroundImageSize : props . $bgImageSize ,
45+ backgroundImageRepeat : props . $bgImageRepeat ,
46+ backgroundImageOrigin : props . $bgImageOrigin ,
47+ backgroundImagePosition : props . $bgImagePosition ,
48+ } ) }
4849` ;
4950
5051// modal/drawer container
@@ -122,8 +123,11 @@ export const CanvasView = React.memo((props: ContainerBaseProps) => {
122123 const isModule = appType === AppTypeEnum . Module ;
123124
124125 const bgColor = useMemo (
125- ( ) => ( currentTheme || defaultTheme ) . canvas ,
126- [ currentTheme , defaultTheme ]
126+ ( ) => {
127+ const themeGridBgColor = preventStylesOverwriting ? undefined : currentTheme ?. canvas ;
128+ return themeGridBgColor || appSettings . gridBg || defaultTheme . canvas ;
129+ } ,
130+ [ preventStylesOverwriting , appSettings , currentTheme , defaultTheme ]
127131 ) ;
128132
129133 const bgImage = useMemo (
0 commit comments