@@ -81,15 +81,27 @@ const ContainWrapper = styled.div<{
81
81
${ props => props . $style && getBackgroundStyle ( props . $style ) }
82
82
` ;
83
83
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
+
84
94
const ColWrapper = styled . div < {
85
95
$style : ResponsiveLayoutColStyleType | undefined ,
86
96
$width : string ,
87
97
$matchColumnsHeight : boolean ,
88
98
$useFlexLayout : boolean ,
99
+ $hasExplicitWidth : boolean ,
89
100
} > `
90
101
${ props => props . $useFlexLayout ? `
91
- flex: ${ props . $width === '100%' ? '1 0 100%' : `0 0 ${ props . $width } ` } ;
92
- max-width: ${ props . $width } ;
102
+ ${ props . $hasExplicitWidth
103
+ ? `flex: 0 0 ${ props . $width } ; max-width: ${ props . $width } ;`
104
+ : 'flex: 1 1 0%; min-width: 0;' }
93
105
` : '' }
94
106
95
107
> div {
@@ -143,20 +155,6 @@ const ColumnContainer = (props: ColumnContainerProps) => {
143
155
) ;
144
156
} ;
145
157
146
- const getColumnWidth = ( column : any ) : string => {
147
- // Use explicit width if available
148
- if ( column . width ) {
149
- // For percentage values, calculate precisely to accommodate gaps
150
- if ( column . width . endsWith ( '%' ) ) {
151
- return column . width ;
152
- }
153
- return column . width ;
154
- }
155
-
156
- // If minWidth is set, use it or default to equal distribution
157
- return column . minWidth || 'auto' ;
158
- } ;
159
-
160
158
const ColumnLayout = ( props : ColumnLayoutProps ) => {
161
159
let {
162
160
columns,
@@ -195,6 +193,7 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
195
193
if ( ! containers [ id ] ) return null
196
194
const containerProps = containers [ id ] . children ;
197
195
const columnWidth = getColumnWidth ( column ) ;
196
+ const hasExplicitWidth = ! ! column . width ;
198
197
199
198
return (
200
199
< BackgroundColorContext . Provider key = { id } value = { props . columnStyle . background } >
@@ -203,6 +202,7 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
203
202
$width = { columnWidth }
204
203
$matchColumnsHeight = { matchColumnsHeight }
205
204
$useFlexLayout = { useFlexLayout }
205
+ $hasExplicitWidth = { hasExplicitWidth }
206
206
>
207
207
< ColumnContainer
208
208
layout = { containerProps . layout . getView ( ) }
0 commit comments