Skip to content

Commit 112a7f1

Browse files
committed
[Fix]: #1626 fill available space issue
1 parent 55157a8 commit 112a7f1

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

client/packages/lowcoder/src/comps/comps/columnLayout/columnLayout.tsx

+16-16
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,27 @@ const ContainWrapper = styled.div<{
8181
${props => props.$style && getBackgroundStyle(props.$style)}
8282
`;
8383

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+
8494
const ColWrapper = styled.div<{
8595
$style: ResponsiveLayoutColStyleType | undefined,
8696
$width: string,
8797
$matchColumnsHeight: boolean,
8898
$useFlexLayout: boolean,
99+
$hasExplicitWidth: boolean,
89100
}>`
90101
${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;'}
93105
` : ''}
94106
95107
> div {
@@ -143,20 +155,6 @@ const ColumnContainer = (props: ColumnContainerProps) => {
143155
);
144156
};
145157

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-
160158
const ColumnLayout = (props: ColumnLayoutProps) => {
161159
let {
162160
columns,
@@ -195,6 +193,7 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
195193
if(!containers[id]) return null
196194
const containerProps = containers[id].children;
197195
const columnWidth = getColumnWidth(column);
196+
const hasExplicitWidth = !!column.width;
198197

199198
return (
200199
<BackgroundColorContext.Provider key={id} value={props.columnStyle.background}>
@@ -203,6 +202,7 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
203202
$width={columnWidth}
204203
$matchColumnsHeight={matchColumnsHeight}
205204
$useFlexLayout={useFlexLayout}
205+
$hasExplicitWidth={hasExplicitWidth}
206206
>
207207
<ColumnContainer
208208
layout={containerProps.layout.getView()}

client/packages/lowcoder/src/comps/controls/optionsControl.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,8 @@ ColumnOption = class extends ColumnOption implements OptionCompProperty {
647647

648648
export const ColumnOptionControl = manualOptionsControl(ColumnOption, {
649649
initOptions: [
650-
{ id: 0, key: "Column1", label: "Column1", width: "50%" },
651-
{ id: 1, key: "Column2", label: "Column2", width: "50%" },
650+
{ id: 0, key: "Column1", label: "Column1", width: "" },
651+
{ id: 1, key: "Column2", label: "Column2", width: "" },
652652
],
653653
uniqField: "key",
654654
autoIncField: "id",

0 commit comments

Comments
 (0)