Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,33 @@ const StyledTable = styled(AntTable as FC<AntTableProps>)<{ height?: number }>(
.ant-table-body {
overflow: auto;
height: ${height ? `${height}px` : undefined};

/* Chrome/Safari/Edge webkit scrollbar styling */
&::-webkit-scrollbar {
width: 8px;
height: 8px;
}

&::-webkit-scrollbar-track {
background: ${theme.colorFillQuaternary};
}

&::-webkit-scrollbar-thumb {
background: ${theme.colorFillSecondary};
border-radius: ${theme.borderRadiusSM}px;

&:hover {
background: ${theme.colorFillTertiary};
}
}

&::-webkit-scrollbar-corner {
background: ${theme.colorFillQuaternary};
}

/* Firefox scrollbar styling */
scrollbar-width: thin;
scrollbar-color: ${theme.colorFillSecondary} ${theme.colorFillQuaternary};
}

.ant-spin-nested-loading .ant-spin .ant-spin-dot {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,38 @@ const Styles = styled.div<PivotTableStylesProps>`
`;

const PivotTableWrapper = styled.div`
height: 100%;
max-width: inherit;
overflow: auto;
${({ theme }) => `
height: 100%;
max-width: inherit;
overflow: auto;

/* Chrome/Safari/Edge webkit scrollbar styling */
&::-webkit-scrollbar {
width: 8px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use theme.sizeUnit instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion from Diego on doing this #35338 (comment)

height: 8px;
}

&::-webkit-scrollbar-track {
background: ${theme.colorFillQuaternary};
}

&::-webkit-scrollbar-thumb {
background: ${theme.colorFillSecondary};
border-radius: ${theme.borderRadiusSM}px;

&:hover {
background: ${theme.colorFillTertiary};
}
}

&::-webkit-scrollbar-corner {
background: ${theme.colorFillQuaternary};
}

/* Firefox scrollbar styling */
scrollbar-width: thin;
scrollbar-color: ${theme.colorFillSecondary} ${theme.colorFillQuaternary};
`}
`;

const METRIC_KEY = t('Metric');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
UIEventHandler,
} from 'react';
import { TableInstance, Hooks } from 'react-table';
import { useTheme, css } from '@superset-ui/core';
import getScrollBarSize from '../utils/getScrollBarSize';
import needScrollBar from '../utils/needScrollBar';
import useMountedMemo from '../utils/useMountedMemo';
Expand Down Expand Up @@ -125,6 +126,8 @@ function StickyWrap({
children: Table;
sticky?: StickyState; // current sticky element sizes
}) {
const theme = useTheme();

if (!table || table.type !== 'table') {
throw new Error('<StickyWrap> must have only one <table> element as child');
}
Expand Down Expand Up @@ -221,6 +224,26 @@ function StickyWrap({
let footerTable: ReactElement | undefined;
let bodyTable: ReactElement | undefined;

const scrollBarStyles = css`
&::-webkit-scrollbar {
width: 8px;
height: 8px;
}
&::-webkit-scrollbar-track {
background: ${theme.colorFillQuaternary};
}
&::-webkit-scrollbar-thumb {
background: ${theme.colorFillSecondary};
border-radius: ${theme.borderRadiusSM}px;
&:hover {
background: ${theme.colorFillTertiary};
}
}
&::-webkit-scrollbar-corner {
background: ${theme.colorFillQuaternary};
}
`;

if (needSizer) {
const theadWithRef = cloneElement(thead, { ref: theadRef });
const tfootWithRef = tfoot && cloneElement(tfoot, { ref: tfootRef });
Expand All @@ -233,6 +256,7 @@ function StickyWrap({
visibility: 'hidden',
scrollbarGutter: 'stable',
}}
css={scrollBarStyles}
role="presentation"
>
{cloneElement(
Expand Down Expand Up @@ -316,6 +340,7 @@ function StickyWrap({
overflow: 'auto',
scrollbarGutter: 'stable',
}}
css={scrollBarStyles}
onScroll={sticky.hasHorizontalScroll ? onScroll : undefined}
role="presentation"
>
Expand Down
Loading