@@ -7,11 +7,12 @@ import { AutoHeightControl } from "comps/controls/autoHeightControl";
7
7
import { ColumnOptionControl } from "comps/controls/optionsControl" ;
8
8
import { styleControl } from "comps/controls/styleControl" ;
9
9
import {
10
- ResponsiveLayoutRowStyle ,
11
- ResponsiveLayoutRowStyleType ,
10
+ ContainerStyle ,
11
+ ContainerStyleType ,
12
12
ResponsiveLayoutColStyleType ,
13
13
ResponsiveLayoutColStyle
14
14
} from "comps/controls/styleControlConstants" ;
15
+
15
16
import { sameTypeMap , UICompBuilder , withDefault } from "comps/generators" ;
16
17
import { addMapChildAction } from "comps/generators/sameTypeMap" ;
17
18
import { NameConfigHidden , withExposingConfigs } from "comps/generators/withExposing" ;
@@ -40,14 +41,33 @@ import { EditorContext } from "comps/editorState";
40
41
import { disabledPropertyView , hiddenPropertyView } from "comps/utils/propertyUtils" ;
41
42
import { DisabledContext } from "comps/generators/uiCompBuilder" ;
42
43
44
+ const ContainWrapper = styled . div < {
45
+ $style : ContainerStyleType | undefined ;
46
+ } > `
47
+ background-color: ${ ( props ) => props . $style ?. background } !important;
48
+ border-radius: ${ ( props ) => props . $style ?. radius } ;
49
+ border-width: ${ ( props ) => props . $style ?. borderWidth } ;
50
+ border-color: ${ ( props ) => props . $style ?. border } ;
51
+ border-style: ${ ( props ) => props . $style ?. borderStyle } ;
52
+ rotate: ${ ( props ) => props . $style ?. rotation } ;
53
+ margin: ${ ( props ) => props . $style ?. margin } ;
54
+ padding: ${ ( props ) => props . $style ?. padding } ;
55
+ ` ;
43
56
44
57
const ColWrapper = styled ( Col ) < {
45
- $style : ResponsiveLayoutColStyleType ,
58
+ $style : ResponsiveLayoutColStyleType | undefined ,
46
59
$minWidth ?: string ,
47
60
$matchColumnsHeight : boolean ,
48
61
} > `
49
62
> div {
50
63
height: ${ ( props ) => props . $matchColumnsHeight ? '100%' : 'auto' } ;
64
+ background-color: ${ ( props ) => props . $style ?. background } !important;
65
+ border-radius: ${ ( props ) => props . $style ?. radius } ;
66
+ border-width: ${ ( props ) => props . $style ?. borderWidth } ;
67
+ border-color: ${ ( props ) => props . $style ?. border } ;
68
+ border-style: ${ ( props ) => props . $style ?. borderStyle } ;
69
+ margin: ${ ( props ) => props . $style ?. margin } ;
70
+ padding: ${ ( props ) => props . $style ?. padding } ;
51
71
}
52
72
` ;
53
73
@@ -64,7 +84,8 @@ const childrenMap = {
64
84
rowGap : withDefault ( StringControl , "20px" ) ,
65
85
templateColumns : withDefault ( StringControl , "1fr 1fr" ) ,
66
86
columnGap : withDefault ( StringControl , "20px" ) ,
67
- columnStyle : withDefault ( styleControl ( ResponsiveLayoutColStyle ) , { } )
87
+ style : withDefault ( styleControl ( ContainerStyle ) , { } ) ,
88
+ columnStyle : withDefault ( styleControl ( ResponsiveLayoutColStyle ) , { borderWidth :'1px' } )
68
89
} ;
69
90
70
91
type ViewProps = RecordConstructorToView < typeof childrenMap > ;
@@ -89,7 +110,7 @@ const ColumnContainer = (props: ColumnContainerProps) => {
89
110
90
111
const ColumnLayout = ( props : ColumnLayoutProps ) => {
91
112
let {
92
- columns,
113
+ columns,
93
114
containers,
94
115
dispatch,
95
116
matchColumnsHeight,
@@ -103,15 +124,15 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
103
124
return (
104
125
< BackgroundColorContext . Provider value = { "none" } >
105
126
< DisabledContext . Provider value = { props . disabled } >
106
- < div style = { { height : '100%' , backgroundColor : "pink" } } >
127
+ < ContainWrapper $ style= { props . style } >
107
128
< div style = { { display : "grid" , gridTemplateColumns : templateColumns , columnGap, gridTemplateRows : templateRows , rowGap} } >
108
129
{ columns . map ( column => {
109
130
const id = String ( column . id ) ;
110
131
const childDispatch = wrapDispatch ( wrapDispatch ( dispatch , "containers" ) , id ) ;
111
132
if ( ! containers [ id ] ) return null
112
133
const containerProps = containers [ id ] . children ;
113
134
114
- const columnCustomStyle = {
135
+ /* const columnCustomStyle = {
115
136
margin: "0",
116
137
padding: !_.isEmpty(column.padding) ? column.padding : "0",
117
138
radius: "0",
@@ -121,16 +142,16 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
121
142
backgroundImage: "linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 1) 100%), linear-gradient(to bottom, rgba(253, 246, 199, 1) 0%, rgba(253, 246, 199, 1) 100%)",
122
143
backgroundClip: "content-box, padding-box",
123
144
124
- }
145
+ } */
125
146
const noOfColumns = columns . length ;
126
- let backgroundStyle = columnCustomStyle . background ;
147
+ /* let backgroundStyle = columnCustomStyle.background;
127
148
if(!_.isEmpty(column.backgroundImage)) {
128
149
backgroundStyle = `center / cover url('${column.backgroundImage}') no-repeat, ${backgroundStyle}`;
129
- }
150
+ } */
130
151
return (
131
152
< ColWrapper
132
153
key = { id }
133
- $style = { columnCustomStyle }
154
+ $style = { props . columnStyle }
134
155
$minWidth = { column . minWidth }
135
156
$matchColumnsHeight = { matchColumnsHeight }
136
157
>
@@ -140,17 +161,14 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
140
161
positionParams = { containerProps . positionParams . getView ( ) }
141
162
dispatch = { childDispatch }
142
163
autoHeight = { props . autoHeight }
143
- style = { {
144
- ...columnCustomStyle ,
145
- background : backgroundStyle ,
146
- } }
164
+ style = { columnStyle }
147
165
/>
148
166
</ ColWrapper >
149
167
)
150
168
} )
151
169
}
152
170
</ div >
153
- </ div >
171
+ </ ContainWrapper >
154
172
</ DisabledContext . Provider >
155
173
</ BackgroundColorContext . Provider >
156
174
) ;
@@ -170,8 +188,6 @@ export const ResponsiveLayoutBaseComp = (function () {
170
188
title : trans ( "responsiveLayout.column" ) ,
171
189
newOptionLabel : "Column" ,
172
190
} ) }
173
- { children . templateColumns . propertyView ( { label : "Column Definition" } ) }
174
- { children . templateRows . propertyView ( { label : "Row Definition" } ) }
175
191
</ Section >
176
192
177
193
{ ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
@@ -187,19 +203,29 @@ export const ResponsiveLayoutBaseComp = (function () {
187
203
{ children . autoHeight . getPropertyView ( ) }
188
204
</ Section >
189
205
< Section name = { trans ( "responsiveLayout.columnsLayout" ) } >
190
- { children . matchColumnsHeight . propertyView ( {
191
- label : trans ( "responsiveLayout.matchColumnsHeight" )
206
+ { children . matchColumnsHeight . propertyView ( { label : trans ( "responsiveLayout.matchColumnsHeight" )
192
207
} ) }
193
208
{ controlItem ( { } , (
194
- < div style = { { marginTop : '8px' } } >
195
- { trans ( "responsiveLayout.columnsSpacing" ) }
196
- </ div >
209
+ < div style = { { marginTop : '8px' } } > { trans ( "responsiveLayout.columnsSpacing" ) } </ div >
197
210
) ) }
211
+ { children . templateColumns . propertyView ( { label : "Column Definition" } ) }
212
+ { children . templateRows . propertyView ( { label : "Row Definition" } ) }
198
213
{ children . columnGap . propertyView ( { label : "Column Gap" } ) }
199
214
{ children . rowGap . propertyView ( { label : "Row Gap" } ) }
200
215
</ Section >
201
216
</ >
202
217
) }
218
+
219
+ { ( useContext ( EditorContext ) . editorModeStatus === "layout" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
220
+ < >
221
+ < Section name = { sectionNames . style } >
222
+ { children . style . getPropertyView ( ) }
223
+ </ Section >
224
+ < Section name = { sectionNames . columnStyle } >
225
+ { children . columnStyle . getPropertyView ( ) }
226
+ </ Section >
227
+ </ >
228
+ ) }
203
229
</ >
204
230
) ;
205
231
} )
0 commit comments