Skip to content

Added Switch to show/hide scrollBar #1080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
minor tweaks
  • Loading branch information
MenamAfzal committed Sep 16, 2024
commit e88c25e1052a9d45b537155969a47fb3b8021ae5
14 changes: 10 additions & 4 deletions client/packages/lowcoder/src/comps/comps/listViewComp/listView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,20 @@ import {
import { ContextContainerComp } from "./contextContainerComp";
import { ListViewImplComp } from "./listViewComp";
import { getCurrentItemParams, getData } from "./listViewUtils";
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";
import { childrenToProps } from "@lowcoder-ee/comps/generators/multi";
import { AnimationStyleType } from "@lowcoder-ee/comps/controls/styleControlConstants";

const ListViewWrapper = styled.div<{ $style: any; $paddingWidth: string,$animationStyle:AnimationStyleType }>`
const ListViewWrapper = styled.div<{ $style: any; $paddingWidth: string,$animationStyle:AnimationStyleType, $autoHeight: boolean }>`
height: 100%;
overflow: ${(props) => (!props.$autoHeight ? "scroll" : "hidden")};
border: 1px solid ${(props) => props.$style.border};
border-radius: ${(props) => props.$style.radius};
padding: 3px ${(props) => props.$paddingWidth};
rotate: ${(props) => props.$style.rotation};
background-color: ${(props) => props.$style.background};
${props=>props.$animationStyle}

`;

const FooterWrapper = styled.div`
Expand Down Expand Up @@ -190,7 +193,7 @@ export function ListView(props: Props) {
const horizontalGridCells = useMemo(() => children.horizontalGridCells.getView(), [children.horizontalGridCells]);
const autoHeight = useMemo(() => children.autoHeight.getView(), [children.autoHeight]);
const showHorizontalScrollbar = useMemo(() => children.showHorizontalScrollbar.getView(), [children.showHorizontalScrollbar]);
const showVerticalScrollbar = useMemo(() => children.showVerticalScrollbar.getView(), [children.showVerticalScrollbar]);
const showVerticalScrollbar = useMemo(() => children.showVerticalScrollbar.getView(), [children.showVerticalScrollbar])
const horizontal = useMemo(() => children.horizontal.getView(), [children.horizontal]);
const minHorizontalWidth = useMemo(() => children.minHorizontalWidth.getView(), [children.minHorizontalWidth]);
const noOfColumns = useMemo(
Expand Down Expand Up @@ -284,12 +287,14 @@ export function ListView(props: Props) {

const childrenProps = childrenToProps(comp.children);

useMergeCompStyles(childrenProps, comp.dispatch);

// log.debug("renders: ", renders);
return (
<BackgroundColorContext.Provider value={style.background}>
<ListViewWrapper $style={style} $paddingWidth={paddingWidth} $animationStyle={animationStyle}>
<ListViewWrapper $style={style} $paddingWidth={paddingWidth} $animationStyle={animationStyle} $autoHeight={autoHeight}>
<BodyWrapper ref={ref} $autoHeight={autoHeight}>
<ScrollBar style={{ height: autoHeight ? "auto" : "100%", margin: "0px", padding: "0px" }} hideScrollbar={horizontal?!showHorizontalScrollbar:!showVerticalScrollbar} overflow={autoHeight?horizontal?'scroll':'hidden':'scroll'}>
<ScrollBar style={{ height: autoHeight ? "auto" : "100%", margin: "0px", padding: "0px" }} hideScrollbar={horizontal ? !showHorizontalScrollbar : !showVerticalScrollbar} overflow={autoHeight ? horizontal ? 'scroll' : 'hidden' : 'scroll'}>
<ReactResizeDetector
onResize={(width?: number, height?: number) => {
if (height) setListHeight(height);
Expand All @@ -315,3 +320,4 @@ export function ListView(props: Props) {
</BackgroundColorContext.Provider>
);
}

Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@ const TableWrapper = styled.div<{
border-left: unset;
border-top: none !important;
border-inline-start: none !important;
overflow-y:scroll;
height:300px;

&::after {
box-shadow: none !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const TabbedContainer = (props: TabbedContainerProps) => {
);
return {
label,
key: tab.key,
key: tab.key,
forceRender: true,
children: (
<BackgroundColorContext.Provider value={bodyStyle.background}>
Expand All @@ -259,7 +259,6 @@ const TabbedContainer = (props: TabbedContainerProps) => {
})

return (
<ScrollBar style={{ height: props.autoHeight ? "auto" : "100%", margin: "0px", padding: "0px" }} hideScrollbar={!props.showVerticalScrollbar} >
<div style={{padding: props.style.margin, height: props.autoHeight ? "auto" : "100%"}}>
<BackgroundColorContext.Provider value={headerStyle.headerBackground}>
<StyledTabs
Expand All @@ -286,7 +285,6 @@ const TabbedContainer = (props: TabbedContainerProps) => {
</StyledTabs>
</BackgroundColorContext.Provider>
</div>
</ScrollBar>
);
};

Expand Down Expand Up @@ -466,3 +464,4 @@ export const TabbedContainerComp = withExposingConfigs(TabbedContainerImplComp,
new NameConfig("selectedTabKey", trans("tabbedContainer.selectedTabKeyDesc")),
NameConfigHidden,
]);