@@ -46,17 +46,13 @@ import { getBackgroundStyle } from "@lowcoder-ee/util/styleUtils";
46
46
const ContainWrapper = styled . div < {
47
47
$style : ContainerStyleType & {
48
48
display : string ,
49
- gridTemplateColumns : string ,
50
- columnGap : string ,
51
- gridTemplateRows : string ,
52
- rowGap : string ,
49
+ flexWrap : string ,
50
+ gap : string ,
53
51
} | undefined ;
54
52
} > `
55
53
display: ${ ( props ) => props . $style ?. display } ;
56
- grid-template-columns: ${ ( props ) => props . $style ?. gridTemplateColumns } ;
57
- grid-template-rows: ${ ( props ) => props . $style ?. gridTemplateRows } ;
58
- column-gap: ${ ( props ) => props . $style ?. columnGap } ;
59
- row-gap: ${ ( props ) => props . $style ?. rowGap } ;
54
+ flex-wrap: ${ ( props ) => props . $style ?. flexWrap } ;
55
+ gap: ${ ( props ) => props . $style ?. gap } ;
60
56
61
57
border-radius: ${ ( props ) => props . $style ?. radius } ;
62
58
border-width: ${ ( props ) => props . $style ?. borderWidth } ;
@@ -67,11 +63,14 @@ const ContainWrapper = styled.div<{
67
63
${ props => props . $style && getBackgroundStyle ( props . $style ) }
68
64
` ;
69
65
70
- const ColWrapper = styled ( Col ) < {
66
+ const ColWrapper = styled . div < {
71
67
$style : ResponsiveLayoutColStyleType | undefined ,
72
- $minWidth ?: string ,
68
+ $width ?: string ,
73
69
$matchColumnsHeight : boolean ,
74
70
} > `
71
+ flex: ${ props => props . $width ? "0 0 " + props . $width : "1 1 0" } ;
72
+ min-width: 0; /* Prevent flex items from overflowing */
73
+
75
74
> div {
76
75
height: ${ ( props ) => props . $matchColumnsHeight ? `calc(100% - ${ props . $style ?. padding || 0 } - ${ props . $style ?. padding || 0 } )` : 'auto' } ;
77
76
border-radius: ${ ( props ) => props . $style ?. radius } ;
@@ -94,11 +93,8 @@ const childrenMap = {
94
93
horizontalGridCells : SliderControl ,
95
94
autoHeight : AutoHeightControl ,
96
95
matchColumnsHeight : withDefault ( BoolControl , true ) ,
97
- templateRows : withDefault ( StringControl , "1fr" ) ,
98
- rowGap : withDefault ( StringControl , "20px" ) ,
99
- templateColumns : withDefault ( StringControl , "1fr 1fr" ) ,
96
+ gap : withDefault ( StringControl , "20px" ) ,
100
97
mainScrollbar : withDefault ( BoolControl , false ) ,
101
- columnGap : withDefault ( StringControl , "20px" ) ,
102
98
style : styleControl ( ContainerStyle , 'style' ) ,
103
99
columnStyle : styleControl ( ResponsiveLayoutColStyle , 'columnStyle' )
104
100
} ;
@@ -129,10 +125,7 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
129
125
containers,
130
126
dispatch,
131
127
matchColumnsHeight,
132
- templateRows,
133
- rowGap,
134
- templateColumns,
135
- columnGap,
128
+ gap,
136
129
columnStyle,
137
130
horizontalGridCells,
138
131
mainScrollbar
@@ -145,24 +138,21 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
145
138
< ScrollBar style = { { margin : "0px" , padding : "0px" } } overflow = "scroll" hideScrollbar = { ! mainScrollbar } >
146
139
< ContainWrapper $style = { {
147
140
...props . style ,
148
- display : "grid" ,
149
- gridTemplateColumns : templateColumns ,
150
- columnGap,
151
- gridTemplateRows : templateRows ,
152
- rowGap,
141
+ display : "flex" ,
142
+ flexWrap : "wrap" ,
143
+ gap : gap ,
153
144
} } >
154
145
{ columns . map ( column => {
155
146
const id = String ( column . id ) ;
156
147
const childDispatch = wrapDispatch ( wrapDispatch ( dispatch , "containers" ) , id ) ;
157
148
if ( ! containers [ id ] ) return null
158
149
const containerProps = containers [ id ] . children ;
159
- const noOfColumns = columns . length ;
150
+
160
151
return (
161
- < BackgroundColorContext . Provider value = { props . columnStyle . background } >
152
+ < BackgroundColorContext . Provider value = { props . columnStyle . background } key = { id } >
162
153
< ColWrapper
163
- key = { id }
164
154
$style = { props . columnStyle }
165
- $minWidth = { column . minWidth }
155
+ $width = { column . minWidth }
166
156
$matchColumnsHeight = { matchColumnsHeight }
167
157
>
168
158
< ColumnContainer
@@ -227,10 +217,7 @@ export const ResponsiveLayoutBaseComp = (function () {
227
217
{ controlItem ( { } , (
228
218
< div style = { { marginTop : '8px' } } > { trans ( "responsiveLayout.columnsSpacing" ) } </ div >
229
219
) ) }
230
- { children . templateColumns . propertyView ( { label : trans ( "responsiveLayout.columnDefinition" ) , tooltip : trans ( "responsiveLayout.columnsDefinitionTooltip" ) } ) }
231
- { children . templateRows . propertyView ( { label : trans ( "responsiveLayout.rowDefinition" ) , tooltip : trans ( "responsiveLayout.rowsDefinitionTooltip" ) } ) }
232
- { children . columnGap . propertyView ( { label : trans ( "responsiveLayout.columnGap" ) } ) }
233
- { children . rowGap . propertyView ( { label : trans ( "responsiveLayout.rowGap" ) } ) }
220
+ { children . gap . propertyView ( { label : trans ( "responsiveLayout.gap" ) } ) }
234
221
</ Section >
235
222
</ >
236
223
) }
0 commit comments