Skip to content

Commit 90679f9

Browse files
author
FalkWolsky
committed
Fixing Scrollbars for Modules Editor View
1 parent 565bb46 commit 90679f9

File tree

2 files changed

+38
-31
lines changed

2 files changed

+38
-31
lines changed

client/packages/lowcoder-design/src/components/ScrollBar.tsx

+15-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import styled from "styled-components";
55
import { DebouncedFunc } from 'lodash'; // Assuming you're using lodash's DebouncedFunc type
66

77

8-
const ScrollBarWrapper = styled.div`
8+
const ScrollBarWrapper = styled.div<{ hidePlaceholder?: boolean }>`
99
min-height: 0;
1010
height: 100%;
1111
width: 100%;
@@ -37,11 +37,11 @@ const ScrollBarWrapper = styled.div`
3737
bottom: 10px;
3838
}
3939
40-
// added by Falk Wolsky to hide the placeholder - as it doubles the vertical space of a Module on a page
41-
.simplebar-placeholder {
42-
display: none !important;
43-
}
44-
40+
${props => props.hidePlaceholder && `
41+
.simplebar-placeholder {
42+
display: none !important;
43+
}
44+
`}
4545
`;
4646

4747
// .simplebar-placeholder { added by Falk Wolsky to hide the placeholder - as it doubles the vertical space of a Module on a page
@@ -54,17 +54,24 @@ interface IProps {
5454
scrollableNodeProps?: {
5555
onScroll: DebouncedFunc<(e: any) => void>;
5656
};
57+
hidePlaceholder?: boolean;
58+
hideScrollbar?: boolean;
5759
}
5860

59-
export const ScrollBar = ({ height = "100%", className, children, style, scrollableNodeProps, ...otherProps }: IProps) => {
61+
export const ScrollBar = ({ height = "100%", className, children, style, scrollableNodeProps, hideScrollbar, ...otherProps }: IProps) => {
6062
// You can now use the style prop directly or pass it to SimpleBar
6163
const combinedStyle = { ...style, height }; // Example of combining height with passed style
6264

63-
return (
65+
return (hideScrollbar ?? false) ? (
6466
<ScrollBarWrapper className={className}>
6567
<SimpleBar style={combinedStyle} scrollableNodeProps={scrollableNodeProps} {...otherProps}>
6668
{children}
6769
</SimpleBar>
6870
</ScrollBarWrapper>
71+
)
72+
: (
73+
<ScrollBarWrapper className={className}>
74+
{children}
75+
</ScrollBarWrapper>
6976
);
7077
};

client/packages/lowcoder/src/comps/comps/moduleContainerComp/moduleLayoutComp.tsx

+23-23
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ function ModuleLayoutView(props: IProps) {
9696
};
9797

9898
return (
99-
<ScrollBar style={{ height: "100%", margin: "0px", padding: "0px" }}>
100-
<CanvasView
99+
<CanvasView
101100
layout={layout}
102101
items={items}
103102
positionParams={{ ...positionParams, cols: parseInt(defaultGrid) }}
@@ -106,7 +105,6 @@ function ModuleLayoutView(props: IProps) {
106105
onLayoutChange={onLayoutChange}
107106
extraHeight="0px"
108107
/>
109-
</ScrollBar>
110108
);
111109
}
112110

@@ -118,26 +116,28 @@ export class ModuleLayoutComp extends ModuleLayoutCompBase implements IContainer
118116
const rowCount = this.children.containerRowCount.getView();
119117
return (
120118
<div>
121-
<ModuleLayoutView
122-
positionParams={this.children.positionParams.getView()}
123-
containerSize={this.children.containerSize.getView()}
124-
containerView={this.children.container.containerView({
125-
rowCount,
126-
isRowCountLocked,
127-
onRowCountChange: (rowCount) => {
128-
this.children.containerRowCount.dispatchChangeValueAction(rowCount);
129-
},
130-
})}
131-
onPositionParamsChange={(params) => {
132-
setTimeout(() => this.children.positionParams.dispatchChangeValueAction(params));
133-
}}
134-
onLayoutChange={(layout) => {
135-
this.children.containerSize.dispatchChangeValueAction({
136-
height: layout[moduleContainerId].h,
137-
width: layout[moduleContainerId].w,
138-
});
139-
}}
140-
/>
119+
<ScrollBar style={{ height: "100%", margin: "0px", padding: "0px" }} hidePlaceholder={false}>
120+
<ModuleLayoutView
121+
positionParams={this.children.positionParams.getView()}
122+
containerSize={this.children.containerSize.getView()}
123+
containerView={this.children.container.containerView({
124+
rowCount,
125+
isRowCountLocked,
126+
onRowCountChange: (rowCount) => {
127+
this.children.containerRowCount.dispatchChangeValueAction(rowCount);
128+
},
129+
})}
130+
onPositionParamsChange={(params) => {
131+
setTimeout(() => this.children.positionParams.dispatchChangeValueAction(params));
132+
}}
133+
onLayoutChange={(layout) => {
134+
this.children.containerSize.dispatchChangeValueAction({
135+
height: layout[moduleContainerId].h,
136+
width: layout[moduleContainerId].w,
137+
});
138+
}}
139+
/>
140+
</ScrollBar>
141141
</div>
142142
);
143143
}

0 commit comments

Comments
 (0)