Skip to content

Commit 8fd052a

Browse files
committed
scrollbar added
1 parent bcbc6c1 commit 8fd052a

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ import { DebouncedFunc } from 'lodash'; // Assuming you're using lodash's Deboun
55

66
// import 'simplebar-react/dist/simplebar.min.css';
77

8-
const ScrollBarWrapper = styled.div<{ $hideplaceholder?: boolean }>`
8+
const ScrollBarWrapper = styled.div<{
9+
$hideplaceholder?: boolean;
10+
$overflow?: string;
11+
}>`
912
min-height: 0;
10-
height: 100%;
13+
height: ${props => props.$overflow? props.$overflow === 'scroll' ? '300px' : '100%':'100%'
14+
};
1115
width: 100%;
16+
overflow:${props=>props.$overflow};
1217
1318
.simplebar-scrollbar::before {
1419
background: rgba(139, 143, 163, 0.5) !important;
@@ -37,7 +42,9 @@ const ScrollBarWrapper = styled.div<{ $hideplaceholder?: boolean }>`
3742
bottom: 10px;
3843
}
3944
40-
${props => Boolean(props.$hideplaceholder) && `
45+
${(props) =>
46+
Boolean(props.$hideplaceholder) &&
47+
`
4148
.simplebar-placeholder {
4249
display: none !important;
4350
}
@@ -50,6 +57,7 @@ interface IProps {
5057
children: React.ReactNode;
5158
className?: string;
5259
height?: string;
60+
overflow?:string,
5361
style?: React.CSSProperties; // Add this line to include a style prop
5462
scrollableNodeProps?: {
5563
onScroll: DebouncedFunc<(e: any) => void>;
@@ -62,6 +70,7 @@ export const ScrollBar = ({
6270
className,
6371
children,
6472
style,
73+
overflow,
6574
scrollableNodeProps,
6675
hideScrollbar = false,
6776
$hideplaceholder = false,
@@ -72,12 +81,16 @@ export const ScrollBar = ({
7281
const combinedStyle = { ...style, height }; // Example of combining height with passed style
7382

7483
return hideScrollbar ? (
75-
<ScrollBarWrapper className={className}>
84+
<ScrollBarWrapper className={className} $overflow={overflow}>
7685
{children}
7786
</ScrollBarWrapper>
7887
) : (
79-
<ScrollBarWrapper className={className}>
80-
<SimpleBar style={combinedStyle} scrollableNodeProps={scrollableNodeProps} {...otherProps}>
88+
<ScrollBarWrapper className={className} $overflow={overflow}>
89+
<SimpleBar
90+
style={combinedStyle}
91+
scrollableNodeProps={scrollableNodeProps}
92+
{...otherProps}
93+
>
8194
{children}
8295
</SimpleBar>
8396
</ScrollBarWrapper>

client/packages/lowcoder/src/comps/comps/listViewComp/listView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ export function ListView(props: Props) {
286286
<BackgroundColorContext.Provider value={style.background}>
287287
<ListViewWrapper $style={style} $paddingWidth={paddingWidth} $animationStyle={animationStyle}>
288288
<BodyWrapper ref={ref} $autoHeight={autoHeight}>
289-
<ScrollBar style={{ height: autoHeight ? "auto" : "100%", margin: "0px", padding: "0px" }} hideScrollbar={!scrollbars}>
289+
<ScrollBar style={{ height: autoHeight ? "auto" : "100%", margin: "0px", padding: "0px" }} hideScrollbar={!scrollbars} overflow={autoHeight?'hidden':'scroll'}>
290290
<ReactResizeDetector
291291
onResize={(width?: number, height?: number) => {
292292
if (height) setListHeight(height);

0 commit comments

Comments
 (0)