Skip to content

Commit fba6a02

Browse files
fix: fixed issues related to column height
1 parent 41c491c commit fba6a02

File tree

2 files changed

+54
-58
lines changed

2 files changed

+54
-58
lines changed

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

Lines changed: 52 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { NameGenerator } from "comps/utils";
1414
import { Section, sectionNames } from "lowcoder-design";
1515
import { HintPlaceHolder } from "lowcoder-design";
1616
import _ from "lodash";
17-
import React, { useContext } from "react";
17+
import React from "react";
1818
import styled from "styled-components";
1919
import { IContainer } from "../containerBase/iContainer";
2020
import { SimpleContainerComp } from "../containerBase/simpleContainerComp";
@@ -26,8 +26,6 @@ import {
2626
} from "../containerComp/containerView";
2727
import { BackgroundColorContext } from "comps/utils/backgroundColorContext";
2828
import { trans } from "i18n";
29-
import { EditorContext } from "comps/editorState";
30-
import { checkIsMobile } from "util/commonUtils";
3129
import { messageInstance } from "lowcoder-design";
3230
import { BoolControl } from "comps/controls/boolControl";
3331
import { NumberControl } from "comps/controls/codeControl";
@@ -44,14 +42,10 @@ const RowWrapper = styled(Row)<{$style: ResponsiveLayoutRowStyleType}>`
4442
const ColWrapper = styled(Col)<{
4543
$style: ResponsiveLayoutColStyleType,
4644
$minWidth?: string,
47-
$backgroundImage?: string,
4845
}>`
49-
height: 100%;
5046
min-width: ${(props) => props.$minWidth};
51-
5247
> div {
53-
background: ${(props) => `center / cover url(${props.$backgroundImage}) no-repeat, ${props.$style.background} !important`};
54-
border: 1px solid ${(props) => props.$style.border} !important;
48+
height: 100%;
5549
}
5650
`;
5751

@@ -76,7 +70,7 @@ const childrenMap = {
7670
type ViewProps = RecordConstructorToView<typeof childrenMap>;
7771
type ResponsiveLayoutProps = ViewProps & { dispatch: DispatchType };
7872
type ColumnContainerProps = Omit<ContainerBaseProps, 'style'> & {
79-
style: ResponsiveLayoutColStyleType
73+
style: ResponsiveLayoutColStyleType,
8074
}
8175

8276
const ColumnContainer = (props: ColumnContainerProps) => {
@@ -106,57 +100,59 @@ const ResponsiveLayout = (props: ResponsiveLayoutProps) => {
106100
horizontalSpacing,
107101
} = props;
108102

109-
const editorState = useContext(EditorContext);
110-
const maxWidth = editorState.getAppSettings().maxWidth;
111-
const isMobile = checkIsMobile(maxWidth);
112-
const paddingWidth = isMobile ? 8 : 20;
113-
114103
return (
115104
<BackgroundColorContext.Provider value={props.rowStyle.background}>
116-
<RowWrapper
117-
$style={rowStyle}
118-
wrap={rowBreak}
119-
gutter={[horizontalSpacing, verticalSpacing]}
120-
>
121-
{columns.map(column => {
122-
const id = String(column.id);
123-
const childDispatch = wrapDispatch(wrapDispatch(dispatch, "containers"), id);
124-
if(!containers[id]) return null
125-
const containerProps = containers[id].children;
105+
<div style={{padding: rowStyle.margin, height: '100%'}}>
106+
<RowWrapper
107+
$style={rowStyle}
108+
wrap={rowBreak}
109+
gutter={[horizontalSpacing, verticalSpacing]}
110+
>
111+
{columns.map(column => {
112+
const id = String(column.id);
113+
const childDispatch = wrapDispatch(wrapDispatch(dispatch, "containers"), id);
114+
if(!containers[id]) return null
115+
const containerProps = containers[id].children;
126116

127-
const columnCustomStyle = {
128-
margin: !_.isEmpty(column.margin) ? column.margin : columnStyle.margin,
129-
padding: !_.isEmpty(column.padding) ? column.padding : columnStyle.padding,
130-
radius: !_.isEmpty(column.radius) ? column.radius : columnStyle.radius,
131-
border: !_.isEmpty(column.border) ? column.border : columnStyle.border,
132-
background: !_.isEmpty(column.background) ? column.background : columnStyle.background,
117+
const columnCustomStyle = {
118+
margin: !_.isEmpty(column.margin) ? column.margin : columnStyle.margin,
119+
padding: !_.isEmpty(column.padding) ? column.padding : columnStyle.padding,
120+
radius: !_.isEmpty(column.radius) ? column.radius : columnStyle.radius,
121+
border: !_.isEmpty(column.border) ? column.border : columnStyle.border,
122+
background: !_.isEmpty(column.background) ? column.background : columnStyle.background,
123+
}
124+
const noOfColumns = columns.length;
125+
let backgroundStyle = columnCustomStyle.background;
126+
if(!_.isEmpty(column.backgroundImage)) {
127+
backgroundStyle = `center / cover url('${column.backgroundImage}') no-repeat, ${backgroundStyle}`;
128+
}
129+
return (
130+
<ColWrapper
131+
key={id}
132+
lg={24/(noOfColumns < columnPerRowLG ? noOfColumns : columnPerRowLG)}
133+
md={24/(noOfColumns < columnPerRowMD ? noOfColumns : columnPerRowMD)}
134+
sm={24/(noOfColumns < columnPerRowSM ? noOfColumns : columnPerRowSM)}
135+
xs={24/(noOfColumns < columnPerRowSM ? noOfColumns : columnPerRowSM)}
136+
$style={columnCustomStyle}
137+
$minWidth={column.minWidth}
138+
>
139+
<ColumnContainer
140+
layout={containerProps.layout.getView()}
141+
items={gridItemCompToGridItems(containerProps.items.getView())}
142+
positionParams={containerProps.positionParams.getView()}
143+
dispatch={childDispatch}
144+
autoHeight={props.autoHeight}
145+
style={{
146+
...columnCustomStyle,
147+
background: backgroundStyle,
148+
}}
149+
/>
150+
</ColWrapper>
151+
)
152+
})
133153
}
134-
const noOfColumns = columns.length;
135-
return (
136-
<ColWrapper
137-
key={id}
138-
lg={24/(noOfColumns < columnPerRowLG ? noOfColumns : columnPerRowLG)}
139-
md={24/(noOfColumns < columnPerRowMD ? noOfColumns : columnPerRowMD)}
140-
sm={24/(noOfColumns < columnPerRowSM ? noOfColumns : columnPerRowSM)}
141-
$style={columnCustomStyle}
142-
$minWidth={column.minWidth}
143-
$backgroundImage={
144-
!_.isEmpty(column.backgroundImage) && column.backgroundImage
145-
}
146-
>
147-
<ColumnContainer
148-
layout={containerProps.layout.getView()}
149-
items={gridItemCompToGridItems(containerProps.items.getView())}
150-
positionParams={containerProps.positionParams.getView()}
151-
dispatch={childDispatch}
152-
autoHeight={props.autoHeight}
153-
style={columnCustomStyle}
154-
/>
155-
</ColWrapper>
156-
)
157-
})
158-
}
159-
</RowWrapper>
154+
</RowWrapper>
155+
</div>
160156
</BackgroundColorContext.Provider>
161157
);
162158
};

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,8 @@ const ColumnOption = new MultiCompBuilder(
573573
backgroundImage: withDefault(StringControl, ""),
574574
border: withDefault(ColorControl, ""),
575575
radius: withDefault(RadiusControl, ""),
576-
margin: withDefault(StringControl, ""),
577-
padding: withDefault(StringControl, ""),
576+
margin: withDefault(StringControl, "0px"),
577+
padding: withDefault(StringControl, "0px"),
578578
},
579579
(props) => props
580580
)

0 commit comments

Comments
 (0)