@@ -14,7 +14,7 @@ import { NameGenerator } from "comps/utils";
14
14
import { Section , sectionNames } from "lowcoder-design" ;
15
15
import { HintPlaceHolder } from "lowcoder-design" ;
16
16
import _ from "lodash" ;
17
- import React , { useContext } from "react" ;
17
+ import React from "react" ;
18
18
import styled from "styled-components" ;
19
19
import { IContainer } from "../containerBase/iContainer" ;
20
20
import { SimpleContainerComp } from "../containerBase/simpleContainerComp" ;
@@ -26,8 +26,6 @@ import {
26
26
} from "../containerComp/containerView" ;
27
27
import { BackgroundColorContext } from "comps/utils/backgroundColorContext" ;
28
28
import { trans } from "i18n" ;
29
- import { EditorContext } from "comps/editorState" ;
30
- import { checkIsMobile } from "util/commonUtils" ;
31
29
import { messageInstance } from "lowcoder-design" ;
32
30
import { BoolControl } from "comps/controls/boolControl" ;
33
31
import { NumberControl } from "comps/controls/codeControl" ;
@@ -44,14 +42,10 @@ const RowWrapper = styled(Row)<{$style: ResponsiveLayoutRowStyleType}>`
44
42
const ColWrapper = styled ( Col ) < {
45
43
$style : ResponsiveLayoutColStyleType ,
46
44
$minWidth ?: string ,
47
- $backgroundImage ?: string ,
48
45
} > `
49
- height: 100%;
50
46
min-width: ${ ( props ) => props . $minWidth } ;
51
-
52
47
> div {
53
- background: ${ ( props ) => `center / cover url(${ props . $backgroundImage } ) no-repeat, ${ props . $style . background } !important` } ;
54
- border: 1px solid ${ ( props ) => props . $style . border } !important;
48
+ height: 100%;
55
49
}
56
50
` ;
57
51
@@ -76,7 +70,7 @@ const childrenMap = {
76
70
type ViewProps = RecordConstructorToView < typeof childrenMap > ;
77
71
type ResponsiveLayoutProps = ViewProps & { dispatch : DispatchType } ;
78
72
type ColumnContainerProps = Omit < ContainerBaseProps , 'style' > & {
79
- style : ResponsiveLayoutColStyleType
73
+ style : ResponsiveLayoutColStyleType ,
80
74
}
81
75
82
76
const ColumnContainer = ( props : ColumnContainerProps ) => {
@@ -106,57 +100,59 @@ const ResponsiveLayout = (props: ResponsiveLayoutProps) => {
106
100
horizontalSpacing,
107
101
} = props ;
108
102
109
- const editorState = useContext ( EditorContext ) ;
110
- const maxWidth = editorState . getAppSettings ( ) . maxWidth ;
111
- const isMobile = checkIsMobile ( maxWidth ) ;
112
- const paddingWidth = isMobile ? 8 : 20 ;
113
-
114
103
return (
115
104
< BackgroundColorContext . Provider value = { props . rowStyle . background } >
116
- < RowWrapper
117
- $style = { rowStyle }
118
- wrap = { rowBreak }
119
- gutter = { [ horizontalSpacing , verticalSpacing ] }
120
- >
121
- { columns . map ( column => {
122
- const id = String ( column . id ) ;
123
- const childDispatch = wrapDispatch ( wrapDispatch ( dispatch , "containers" ) , id ) ;
124
- if ( ! containers [ id ] ) return null
125
- const containerProps = containers [ id ] . children ;
105
+ < div style = { { padding : rowStyle . margin , height : '100%' } } >
106
+ < RowWrapper
107
+ $style = { rowStyle }
108
+ wrap = { rowBreak }
109
+ gutter = { [ horizontalSpacing , verticalSpacing ] }
110
+ >
111
+ { columns . map ( column => {
112
+ const id = String ( column . id ) ;
113
+ const childDispatch = wrapDispatch ( wrapDispatch ( dispatch , "containers" ) , id ) ;
114
+ if ( ! containers [ id ] ) return null
115
+ const containerProps = containers [ id ] . children ;
126
116
127
- const columnCustomStyle = {
128
- margin : ! _ . isEmpty ( column . margin ) ? column . margin : columnStyle . margin ,
129
- padding : ! _ . isEmpty ( column . padding ) ? column . padding : columnStyle . padding ,
130
- radius : ! _ . isEmpty ( column . radius ) ? column . radius : columnStyle . radius ,
131
- border : ! _ . isEmpty ( column . border ) ? column . border : columnStyle . border ,
132
- background : ! _ . isEmpty ( column . background ) ? column . background : columnStyle . background ,
117
+ const columnCustomStyle = {
118
+ margin : ! _ . isEmpty ( column . margin ) ? column . margin : columnStyle . margin ,
119
+ padding : ! _ . isEmpty ( column . padding ) ? column . padding : columnStyle . padding ,
120
+ radius : ! _ . isEmpty ( column . radius ) ? column . radius : columnStyle . radius ,
121
+ border : ! _ . isEmpty ( column . border ) ? column . border : columnStyle . border ,
122
+ background : ! _ . isEmpty ( column . background ) ? column . background : columnStyle . background ,
123
+ }
124
+ const noOfColumns = columns . length ;
125
+ let backgroundStyle = columnCustomStyle . background ;
126
+ if ( ! _ . isEmpty ( column . backgroundImage ) ) {
127
+ backgroundStyle = `center / cover url('${ column . backgroundImage } ') no-repeat, ${ backgroundStyle } ` ;
128
+ }
129
+ return (
130
+ < ColWrapper
131
+ key = { id }
132
+ lg = { 24 / ( noOfColumns < columnPerRowLG ? noOfColumns : columnPerRowLG ) }
133
+ md = { 24 / ( noOfColumns < columnPerRowMD ? noOfColumns : columnPerRowMD ) }
134
+ sm = { 24 / ( noOfColumns < columnPerRowSM ? noOfColumns : columnPerRowSM ) }
135
+ xs = { 24 / ( noOfColumns < columnPerRowSM ? noOfColumns : columnPerRowSM ) }
136
+ $style = { columnCustomStyle }
137
+ $minWidth = { column . minWidth }
138
+ >
139
+ < ColumnContainer
140
+ layout = { containerProps . layout . getView ( ) }
141
+ items = { gridItemCompToGridItems ( containerProps . items . getView ( ) ) }
142
+ positionParams = { containerProps . positionParams . getView ( ) }
143
+ dispatch = { childDispatch }
144
+ autoHeight = { props . autoHeight }
145
+ style = { {
146
+ ...columnCustomStyle ,
147
+ background : backgroundStyle ,
148
+ } }
149
+ />
150
+ </ ColWrapper >
151
+ )
152
+ } )
133
153
}
134
- const noOfColumns = columns . length ;
135
- return (
136
- < ColWrapper
137
- key = { id }
138
- lg = { 24 / ( noOfColumns < columnPerRowLG ? noOfColumns : columnPerRowLG ) }
139
- md = { 24 / ( noOfColumns < columnPerRowMD ? noOfColumns : columnPerRowMD ) }
140
- sm = { 24 / ( noOfColumns < columnPerRowSM ? noOfColumns : columnPerRowSM ) }
141
- $style = { columnCustomStyle }
142
- $minWidth = { column . minWidth }
143
- $backgroundImage = {
144
- ! _ . isEmpty ( column . backgroundImage ) && column . backgroundImage
145
- }
146
- >
147
- < ColumnContainer
148
- layout = { containerProps . layout . getView ( ) }
149
- items = { gridItemCompToGridItems ( containerProps . items . getView ( ) ) }
150
- positionParams = { containerProps . positionParams . getView ( ) }
151
- dispatch = { childDispatch }
152
- autoHeight = { props . autoHeight }
153
- style = { columnCustomStyle }
154
- />
155
- </ ColWrapper >
156
- )
157
- } )
158
- }
159
- </ RowWrapper >
154
+ </ RowWrapper >
155
+ </ div >
160
156
</ BackgroundColorContext . Provider >
161
157
) ;
162
158
} ;
0 commit comments