@@ -43,34 +43,20 @@ import { DisabledContext } from "comps/generators/uiCompBuilder";
4343import { SliderControl } from "@lowcoder-ee/comps/controls/sliderControl" ;
4444import { getBackgroundStyle } from "@lowcoder-ee/util/styleUtils" ;
4545
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-
5646const 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 ;
5954} > `
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 } ;
7460
7561 border-radius: ${ ( props ) => props . $style ?. radius } ;
7662 border-width: ${ ( props ) => props . $style ?. borderWidth } ;
@@ -81,29 +67,12 @@ const ContainWrapper = styled.div<{
8167 ${ props => props . $style && getBackgroundStyle ( props . $style ) }
8268` ;
8369
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 ) < {
9571 $style : ResponsiveLayoutColStyleType | undefined ,
96- $width : string ,
72+ $minWidth ? : string ,
9773 $matchColumnsHeight : boolean ,
98- $useFlexLayout : boolean ,
99- $hasExplicitWidth : boolean ,
10074} > `
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' } ;
10776 > div {
10877 height: ${ ( props ) => props . $matchColumnsHeight ? `calc(100% - ${ props . $style ?. padding || 0 } - ${ props . $style ?. padding || 0 } )` : 'auto' } ;
10978 border-radius: ${ ( props ) => props . $style ?. radius } ;
@@ -127,13 +96,12 @@ const childrenMap = {
12796 autoHeight : AutoHeightControl ,
12897 matchColumnsHeight : withDefault ( BoolControl , true ) ,
12998 templateRows : withDefault ( StringControl , "1fr" ) ,
130- rowGap : withDefault ( StringControl , "0 " ) ,
99+ rowGap : withDefault ( StringControl , "20px " ) ,
131100 templateColumns : withDefault ( StringControl , "1fr 1fr" ) ,
132101 mainScrollbar : withDefault ( BoolControl , false ) ,
133- columnGap : withDefault ( StringControl , "0 " ) ,
102+ columnGap : withDefault ( StringControl , "20px " ) ,
134103 style : styleControl ( ContainerStyle , 'style' ) ,
135- columnStyle : styleControl ( ResponsiveLayoutColStyle , 'columnStyle' ) ,
136- useFlexLayout : withDefault ( BoolControl , false ) ,
104+ columnStyle : styleControl ( ResponsiveLayoutColStyle , 'columnStyle' )
137105} ;
138106
139107type ViewProps = RecordConstructorToView < typeof childrenMap > ;
@@ -155,6 +123,7 @@ const ColumnContainer = (props: ColumnContainerProps) => {
155123 ) ;
156124} ;
157125
126+
158127const ColumnLayout = ( props : ColumnLayoutProps ) => {
159128 let {
160129 columns,
@@ -167,42 +136,35 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
167136 columnGap,
168137 columnStyle,
169138 horizontalGridCells,
170- mainScrollbar,
171- useFlexLayout,
139+ mainScrollbar
172140 } = props ;
173141
174142 return (
175143 < BackgroundColorContext . Provider value = { props . style . background } >
176144 < DisabledContext . Provider value = { props . disabled } >
177145 < div style = { { height : "inherit" , overflow : "auto" } } >
178146 < 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+ } } >
190155 { columns . map ( column => {
191156 const id = String ( column . id ) ;
192157 const childDispatch = wrapDispatch ( wrapDispatch ( dispatch , "containers" ) , id ) ;
193158 if ( ! containers [ id ] ) return null
194159 const containerProps = containers [ id ] . children ;
195- const columnWidth = getColumnWidth ( column ) ;
196- const hasExplicitWidth = ! ! column . width ;
197-
160+ const noOfColumns = columns . length ;
198161 return (
199- < BackgroundColorContext . Provider key = { id } value = { props . columnStyle . background } >
162+ < BackgroundColorContext . Provider value = { props . columnStyle . background } >
200163 < ColWrapper
164+ key = { id }
201165 $style = { props . columnStyle }
202- $width = { columnWidth }
166+ $minWidth = { column . minWidth }
203167 $matchColumnsHeight = { matchColumnsHeight }
204- $useFlexLayout = { useFlexLayout }
205- $hasExplicitWidth = { hasExplicitWidth }
206168 >
207169 < ColumnContainer
208170 layout = { containerProps . layout . getView ( ) }
@@ -239,7 +201,6 @@ export const ResponsiveLayoutBaseComp = (function () {
239201 { children . columns . propertyView ( {
240202 title : trans ( "responsiveLayout.column" ) ,
241203 newOptionLabel : trans ( "responsiveLayout.addColumn" ) ,
242- useFlexLayout : children . useFlexLayout . getView ( ) ,
243204 } ) }
244205 </ Section >
245206
@@ -260,25 +221,15 @@ export const ResponsiveLayoutBaseComp = (function () {
260221 { children . horizontalGridCells . propertyView ( {
261222 label : trans ( 'prop.horizontalGridCells' ) ,
262223 } ) }
263- { children . useFlexLayout . propertyView ( {
264- label : trans ( "responsiveLayout.useFlexLayout" ) ,
265- tooltip : trans ( "responsiveLayout.useFlexLayoutTooltip" )
266- } ) }
267224 </ Section >
268225 < Section name = { trans ( "responsiveLayout.columnsLayout" ) } >
269226 { children . matchColumnsHeight . propertyView ( { label : trans ( "responsiveLayout.matchColumnsHeight" )
270227 } ) }
271228 { controlItem ( { } , (
272229 < div style = { { marginTop : '8px' } } > { trans ( "responsiveLayout.columnsSpacing" ) } </ div >
273230 ) ) }
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" ) } ) }
282233 { children . columnGap . propertyView ( { label : trans ( "responsiveLayout.columnGap" ) } ) }
283234 { children . rowGap . propertyView ( { label : trans ( "responsiveLayout.rowGap" ) } ) }
284235 </ Section >
0 commit comments