Table panel: Fix horizontal scrolling when pagination is enabled (#47776)

* Table panel: Fix horizontal scrolling when pagination is enabled

* Fix failing test
This commit is contained in:
Dominik Prokop
2022-04-14 09:35:37 -07:00
committed by GitHub
parent 41012af997
commit 6a8f9b7ebc
3 changed files with 2697 additions and 6 deletions
File diff suppressed because one or more lines are too long
@@ -304,9 +304,9 @@ export const Table: FC<Props> = memo((props: Props) => {
totalColumnsWidth={totalColumnsWidth} totalColumnsWidth={totalColumnsWidth}
/> />
)} )}
{paginationEl}
</div> </div>
</CustomScrollbar> </CustomScrollbar>
{paginationEl}
</div> </div>
); );
}); });
@@ -184,6 +184,9 @@ export const getTableStyles = (theme: GrafanaTheme2) => {
div:not(:only-child):first-child { div:not(:only-child):first-child {
flex-grow: 0.6; flex-grow: 0.6;
} }
position: absolute;
bottom: 0;
left: 0;
`, `,
paginationSummary: css` paginationSummary: css`
color: ${theme.colors.text.secondary}; color: ${theme.colors.text.secondary};
@@ -191,11 +194,16 @@ export const getTableStyles = (theme: GrafanaTheme2) => {
margin-left: auto; margin-left: auto;
`, `,
tableContentWrapper: (totalColumnsWidth: number) => css` tableContentWrapper: (totalColumnsWidth: number) => {
width: ${totalColumnsWidth ?? '100%'}; const width = totalColumnsWidth !== undefined ? `${totalColumnsWidth}px` : '100%';
display: flex;
flex-direction: column; return css`
`, label: tableContentWrapper;
width: ${width};
display: flex;
flex-direction: column;
`;
},
row: css` row: css`
label: row; label: row;
border-bottom: 1px solid ${borderColor}; border-bottom: 1px solid ${borderColor};