@@ -43,34 +43,20 @@ import { DisabledContext } from "comps/generators/uiCompBuilder";
43
43
import { SliderControl } from "@lowcoder-ee/comps/controls/sliderControl" ;
44
44
import { getBackgroundStyle } from "@lowcoder-ee/util/styleUtils" ;
45
45
46
- // Extended ContainerStyleType for our specific needs
47
- interface ExtendedContainerStyleType extends ContainerStyleType {
48
- display ?: string ;
49
- gridTemplateColumns ?: string ;
50
- gridTemplateRows ?: string ;
51
- columnGap ?: string ;
52
- rowGap ?: string ;
53
- [ key : string ] : string | undefined ;
54
- }
55
-
56
46
const ContainWrapper = styled . div < {
57
- $style : ExtendedContainerStyleType | undefined ;
58
- $useFlexLayout : boolean ;
47
+ $style : ContainerStyleType & {
48
+ display : string ,
49
+ gridTemplateColumns : string ,
50
+ columnGap : string ,
51
+ gridTemplateRows : string ,
52
+ rowGap : string ,
53
+ } | undefined ;
59
54
} > `
60
- display: ${ ( props ) => props . $useFlexLayout ? 'flex' : props . $style ?. display } ;
61
- flex-wrap: ${ ( props ) => props . $useFlexLayout ? 'wrap' : 'nowrap' } ;
62
-
63
- ${ ( props ) => ! props . $useFlexLayout && `
64
- grid-template-columns: ${ props . $style ?. gridTemplateColumns } ;
65
- grid-template-rows: ${ props . $style ?. gridTemplateRows } ;
66
- column-gap: ${ props . $style ?. columnGap } ;
67
- row-gap: ${ props . $style ?. rowGap } ;
68
- ` }
69
-
70
- ${ ( props ) => props . $useFlexLayout && `
71
- column-gap: ${ props . $style ?. columnGap || '0' } ;
72
- row-gap: ${ props . $style ?. rowGap || '0' } ;
73
- ` }
55
+ 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 } ;
74
60
75
61
border-radius: ${ ( props ) => props . $style ?. radius } ;
76
62
border-width: ${ ( props ) => props . $style ?. borderWidth } ;
@@ -81,29 +67,12 @@ const ContainWrapper = styled.div<{
81
67
${ props => props . $style && getBackgroundStyle ( props . $style ) }
82
68
` ;
83
69
84
- const getColumnWidth = ( column : any ) : string => {
85
- // Use explicit width if available
86
- if ( column . width ) {
87
- return column . width ;
88
- }
89
-
90
- // No explicit width - return auto to let flex handle it
91
- return 'auto' ;
92
- } ;
93
-
94
- const ColWrapper = styled . div < {
70
+ const ColWrapper = styled ( Col ) < {
95
71
$style : ResponsiveLayoutColStyleType | undefined ,
96
- $width : string ,
72
+ $minWidth ? : string ,
97
73
$matchColumnsHeight : boolean ,
98
- $useFlexLayout : boolean ,
99
- $hasExplicitWidth : boolean ,
100
74
} > `
101
- ${ props => props . $useFlexLayout ? `
102
- ${ props . $hasExplicitWidth
103
- ? `flex: 0 0 ${ props . $width } ; max-width: ${ props . $width } ;`
104
- : 'flex: 1 1 0%; min-width: 0;' }
105
- ` : '' }
106
-
75
+ min-width: ${ ( props ) => props . $minWidth || 'auto' } ;
107
76
> div {
108
77
height: ${ ( props ) => props . $matchColumnsHeight ? `calc(100% - ${ props . $style ?. padding || 0 } - ${ props . $style ?. padding || 0 } )` : 'auto' } ;
109
78
border-radius: ${ ( props ) => props . $style ?. radius } ;
@@ -127,13 +96,12 @@ const childrenMap = {
127
96
autoHeight : AutoHeightControl ,
128
97
matchColumnsHeight : withDefault ( BoolControl , true ) ,
129
98
templateRows : withDefault ( StringControl , "1fr" ) ,
130
- rowGap : withDefault ( StringControl , "0 " ) ,
99
+ rowGap : withDefault ( StringControl , "20px " ) ,
131
100
templateColumns : withDefault ( StringControl , "1fr 1fr" ) ,
132
101
mainScrollbar : withDefault ( BoolControl , false ) ,
133
- columnGap : withDefault ( StringControl , "0 " ) ,
102
+ columnGap : withDefault ( StringControl , "20px " ) ,
134
103
style : styleControl ( ContainerStyle , 'style' ) ,
135
- columnStyle : styleControl ( ResponsiveLayoutColStyle , 'columnStyle' ) ,
136
- useFlexLayout : withDefault ( BoolControl , false ) ,
104
+ columnStyle : styleControl ( ResponsiveLayoutColStyle , 'columnStyle' )
137
105
} ;
138
106
139
107
type ViewProps = RecordConstructorToView < typeof childrenMap > ;
@@ -155,6 +123,7 @@ const ColumnContainer = (props: ColumnContainerProps) => {
155
123
) ;
156
124
} ;
157
125
126
+
158
127
const ColumnLayout = ( props : ColumnLayoutProps ) => {
159
128
let {
160
129
columns,
@@ -167,42 +136,35 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
167
136
columnGap,
168
137
columnStyle,
169
138
horizontalGridCells,
170
- mainScrollbar,
171
- useFlexLayout,
139
+ mainScrollbar
172
140
} = props ;
173
141
174
142
return (
175
143
< BackgroundColorContext . Provider value = { props . style . background } >
176
144
< DisabledContext . Provider value = { props . disabled } >
177
145
< div style = { { height : "inherit" , overflow : "auto" } } >
178
146
< ScrollBar style = { { margin : "0px" , padding : "0px" } } overflow = "scroll" hideScrollbar = { ! mainScrollbar } >
179
- < ContainWrapper
180
- $style = { {
181
- ...props . style ,
182
- display : "grid" ,
183
- gridTemplateColumns : templateColumns ,
184
- columnGap,
185
- gridTemplateRows : templateRows ,
186
- rowGap,
187
- } }
188
- $useFlexLayout = { useFlexLayout }
189
- >
147
+ < ContainWrapper $style = { {
148
+ ...props . style ,
149
+ display : "grid" ,
150
+ gridTemplateColumns : templateColumns ,
151
+ columnGap,
152
+ gridTemplateRows : templateRows ,
153
+ rowGap,
154
+ } } >
190
155
{ columns . map ( column => {
191
156
const id = String ( column . id ) ;
192
157
const childDispatch = wrapDispatch ( wrapDispatch ( dispatch , "containers" ) , id ) ;
193
158
if ( ! containers [ id ] ) return null
194
159
const containerProps = containers [ id ] . children ;
195
- const columnWidth = getColumnWidth ( column ) ;
196
- const hasExplicitWidth = ! ! column . width ;
197
-
160
+ const noOfColumns = columns . length ;
198
161
return (
199
- < BackgroundColorContext . Provider key = { id } value = { props . columnStyle . background } >
162
+ < BackgroundColorContext . Provider value = { props . columnStyle . background } >
200
163
< ColWrapper
164
+ key = { id }
201
165
$style = { props . columnStyle }
202
- $width = { columnWidth }
166
+ $minWidth = { column . minWidth }
203
167
$matchColumnsHeight = { matchColumnsHeight }
204
- $useFlexLayout = { useFlexLayout }
205
- $hasExplicitWidth = { hasExplicitWidth }
206
168
>
207
169
< ColumnContainer
208
170
layout = { containerProps . layout . getView ( ) }
@@ -239,7 +201,6 @@ export const ResponsiveLayoutBaseComp = (function () {
239
201
{ children . columns . propertyView ( {
240
202
title : trans ( "responsiveLayout.column" ) ,
241
203
newOptionLabel : trans ( "responsiveLayout.addColumn" ) ,
242
- useFlexLayout : children . useFlexLayout . getView ( ) ,
243
204
} ) }
244
205
</ Section >
245
206
@@ -260,25 +221,15 @@ export const ResponsiveLayoutBaseComp = (function () {
260
221
{ children . horizontalGridCells . propertyView ( {
261
222
label : trans ( 'prop.horizontalGridCells' ) ,
262
223
} ) }
263
- { children . useFlexLayout . propertyView ( {
264
- label : trans ( "responsiveLayout.useFlexLayout" ) ,
265
- tooltip : trans ( "responsiveLayout.useFlexLayoutTooltip" )
266
- } ) }
267
224
</ Section >
268
225
< Section name = { trans ( "responsiveLayout.columnsLayout" ) } >
269
226
{ children . matchColumnsHeight . propertyView ( { label : trans ( "responsiveLayout.matchColumnsHeight" )
270
227
} ) }
271
228
{ controlItem ( { } , (
272
229
< div style = { { marginTop : '8px' } } > { trans ( "responsiveLayout.columnsSpacing" ) } </ div >
273
230
) ) }
274
- { ! children . useFlexLayout . getView ( ) && children . templateColumns . propertyView ( {
275
- label : trans ( "responsiveLayout.columnDefinition" ) ,
276
- tooltip : trans ( "responsiveLayout.columnsDefinitionTooltip" )
277
- } ) }
278
- { ! children . useFlexLayout . getView ( ) && children . templateRows . propertyView ( {
279
- label : trans ( "responsiveLayout.rowDefinition" ) ,
280
- tooltip : trans ( "responsiveLayout.rowsDefinitionTooltip" )
281
- } ) }
231
+ { children . templateColumns . propertyView ( { label : trans ( "responsiveLayout.columnDefinition" ) , tooltip : trans ( "responsiveLayout.columnsDefinitionTooltip" ) } ) }
232
+ { children . templateRows . propertyView ( { label : trans ( "responsiveLayout.rowDefinition" ) , tooltip : trans ( "responsiveLayout.rowsDefinitionTooltip" ) } ) }
282
233
{ children . columnGap . propertyView ( { label : trans ( "responsiveLayout.columnGap" ) } ) }
283
234
{ children . rowGap . propertyView ( { label : trans ( "responsiveLayout.rowGap" ) } ) }
284
235
</ Section >
0 commit comments