Skip to content

Commit ac9cb31

Browse files
committed
ColumnLayout: Added Main Content Scrollbar
1 parent b59560a commit ac9cb31

File tree

2 files changed

+48
-39
lines changed

2 files changed

+48
-39
lines changed

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

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { sameTypeMap, UICompBuilder, withDefault } from "comps/generators";
1717
import { addMapChildAction } from "comps/generators/sameTypeMap";
1818
import { NameConfigHidden, withExposingConfigs } from "comps/generators/withExposing";
1919
import { NameGenerator } from "comps/utils";
20-
import { Section, controlItem, sectionNames } from "lowcoder-design";
20+
import { ScrollBar, Section, controlItem, sectionNames } from "lowcoder-design";
2121
import { HintPlaceHolder } from "lowcoder-design";
2222
import _ from "lodash";
2323
import styled from "styled-components";
@@ -96,6 +96,7 @@ const childrenMap = {
9696
templateRows: withDefault(StringControl, "1fr"),
9797
rowGap: withDefault(StringControl, "20px"),
9898
templateColumns: withDefault(StringControl, "1fr 1fr"),
99+
mainScrollbar: withDefault(BoolControl, false),
99100
columnGap: withDefault(StringControl, "20px"),
100101
style: styleControl(ContainerStyle, 'style'),
101102
columnStyle: styleControl(ResponsiveLayoutColStyle , 'columnStyle')
@@ -133,48 +134,53 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
133134
columnGap,
134135
columnStyle,
135136
horizontalGridCells,
137+
mainScrollbar
136138
} = props;
137139

138140
return (
139141
<BackgroundColorContext.Provider value={props.style.background}>
140142
<DisabledContext.Provider value={props.disabled}>
141-
<ContainWrapper $style={{
142-
...props.style,
143-
display: "grid",
144-
gridTemplateColumns: templateColumns,
145-
columnGap,
146-
gridTemplateRows: templateRows,
147-
rowGap,
148-
}}>
149-
{columns.map(column => {
150-
const id = String(column.id);
151-
const childDispatch = wrapDispatch(wrapDispatch(dispatch, "containers"), id);
152-
if(!containers[id]) return null
153-
const containerProps = containers[id].children;
154-
const noOfColumns = columns.length;
155-
return (
156-
<BackgroundColorContext.Provider value={props.columnStyle.background}>
157-
<ColWrapper
158-
key={id}
159-
$style={props.columnStyle}
160-
$minWidth={column.minWidth}
161-
$matchColumnsHeight={matchColumnsHeight}
162-
>
163-
<ColumnContainer
164-
layout={containerProps.layout.getView()}
165-
items={gridItemCompToGridItems(containerProps.items.getView())}
166-
horizontalGridCells={horizontalGridCells}
167-
positionParams={containerProps.positionParams.getView()}
168-
dispatch={childDispatch}
169-
autoHeight={props.autoHeight}
170-
style={columnStyle}
171-
/>
172-
</ColWrapper>
173-
</BackgroundColorContext.Provider>
174-
)
175-
})
176-
}
177-
</ContainWrapper>
143+
<div style={{ height: "inherit", overflow: "auto"}}>
144+
<ScrollBar style={{ margin: "0px", padding: "0px" }} overflow="scroll" hideScrollbar={!mainScrollbar}>
145+
<ContainWrapper $style={{
146+
...props.style,
147+
display: "grid",
148+
gridTemplateColumns: templateColumns,
149+
columnGap,
150+
gridTemplateRows: templateRows,
151+
rowGap,
152+
}}>
153+
{columns.map(column => {
154+
const id = String(column.id);
155+
const childDispatch = wrapDispatch(wrapDispatch(dispatch, "containers"), id);
156+
if(!containers[id]) return null
157+
const containerProps = containers[id].children;
158+
const noOfColumns = columns.length;
159+
return (
160+
<BackgroundColorContext.Provider value={props.columnStyle.background}>
161+
<ColWrapper
162+
key={id}
163+
$style={props.columnStyle}
164+
$minWidth={column.minWidth}
165+
$matchColumnsHeight={matchColumnsHeight}
166+
>
167+
<ColumnContainer
168+
layout={containerProps.layout.getView()}
169+
items={gridItemCompToGridItems(containerProps.items.getView())}
170+
horizontalGridCells={horizontalGridCells}
171+
positionParams={containerProps.positionParams.getView()}
172+
dispatch={childDispatch}
173+
autoHeight={props.autoHeight}
174+
style={columnStyle}
175+
/>
176+
</ColWrapper>
177+
</BackgroundColorContext.Provider>
178+
)
179+
})
180+
}
181+
</ContainWrapper>
182+
</ScrollBar>
183+
</div>
178184
</DisabledContext.Provider>
179185
</BackgroundColorContext.Provider>
180186
);
@@ -207,6 +213,9 @@ export const ResponsiveLayoutBaseComp = (function () {
207213
<>
208214
<Section name={sectionNames.layout}>
209215
{children.autoHeight.getPropertyView()}
216+
{(!children.autoHeight.getView()) && children.mainScrollbar.propertyView({
217+
label: trans("prop.mainScrollbar")
218+
})}
210219
{children.horizontalGridCells.propertyView({
211220
label: trans('prop.horizontalGridCells'),
212221
})}

client/packages/lowcoder/src/comps/comps/pageLayoutComp/pageLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
157157
}}
158158
>
159159
<Wrapper $style={style} $animationStyle={animationStyle}>
160-
<Layout style={{padding: "0px", overflow: container.mainScrollbars ? "scroll" : "inherit"}} hasSider={showSider && !container.innerSider}>
160+
<Layout style={{padding: "0px", overflow: container.mainScrollbars ? "scroll" : "visible"}} hasSider={showSider && !container.innerSider}>
161161
{showSider && !container.innerSider && !container.siderRight && (
162162
<><BackgroundColorContext.Provider value={siderStyle?.siderBackground}>
163163
<Sider

0 commit comments

Comments
 (0)