Skip to content

Commit 0e04061

Browse files
fixed table scrollbar issues
1 parent 1a887bb commit 0e04061

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

client/packages/lowcoder/src/comps/comps/tableComp/tableCompView.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ const BackgroundWrapper = styled.div<{
144144
$tableAutoHeight: boolean;
145145
$showHorizontalScrollbar: boolean;
146146
$showVerticalScrollbar: boolean;
147+
$fixedToolbar: boolean;
147148
}>`
148149
display: flex;
149150
flex-direction: column;
@@ -158,8 +159,15 @@ const BackgroundWrapper = styled.div<{
158159
overflow: hidden;
159160
160161
> div.table-scrollbar-wrapper {
161-
height: auto;
162162
overflow: auto;
163+
${(props) => props.$fixedToolbar && `height: auto`};
164+
165+
${(props) => (props.$showHorizontalScrollbar || props.$showVerticalScrollbar) && `
166+
.simplebar-content-wrapper {
167+
overflow: auto !important;
168+
}
169+
`}
170+
163171
${(props) => !props.$showHorizontalScrollbar && `
164172
div.simplebar-horizontal {
165173
visibility: hidden !important;
@@ -847,6 +855,7 @@ export function TableCompView(props: {
847855
return <EmptyContent text={trans("table.emptyColumns")} />;
848856
}
849857

858+
const hideScrollbar = !showHorizontalScrollbar && !showVerticalScrollbar;
850859
return (
851860
<BackgroundColorContext.Provider value={style.background} >
852861
<BackgroundWrapper
@@ -855,14 +864,15 @@ export function TableCompView(props: {
855864
$tableAutoHeight={tableAutoHeight}
856865
$showHorizontalScrollbar={showHorizontalScrollbar}
857866
$showVerticalScrollbar={showVerticalScrollbar}
867+
$fixedToolbar={toolbar.fixedToolbar}
858868
>
859-
{toolbar.position === "above" && toolbar.fixedToolbar && toolbarView}
869+
{toolbar.position === "above" && (toolbar.fixedToolbar || (tableAutoHeight && showHorizontalScrollbar)) && toolbarView}
860870
<ScrollBar
861871
className="table-scrollbar-wrapper"
862872
style={{ height: "100%", margin: "0px", padding: "0px" }}
863-
hideScrollbar={!showHorizontalScrollbar && !showVerticalScrollbar}
864-
prefixNode={toolbar.position === "above" && !toolbar.fixedToolbar && toolbarView}
865-
suffixNode={toolbar.position === "below" && !toolbar.fixedToolbar && toolbarView}
873+
hideScrollbar={hideScrollbar}
874+
prefixNode={toolbar.position === "above" && !toolbar.fixedToolbar && !(tableAutoHeight && showHorizontalScrollbar) && toolbarView}
875+
suffixNode={toolbar.position === "below" && !toolbar.fixedToolbar && !(tableAutoHeight && showHorizontalScrollbar) && toolbarView}
866876
>
867877
<TableWrapper
868878
$style={style}
@@ -926,7 +936,7 @@ export function TableCompView(props: {
926936
</SlotConfigContext.Provider>
927937
</TableWrapper>
928938
</ScrollBar>
929-
{toolbar.position === "below" && toolbar.fixedToolbar && toolbarView}
939+
{toolbar.position === "below" && (toolbar.fixedToolbar || (tableAutoHeight && showHorizontalScrollbar)) && toolbarView}
930940
</BackgroundWrapper>
931941

932942
</BackgroundColorContext.Provider>

0 commit comments

Comments
 (0)