mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Table: Fix scrollbar is hidden by pagination (#51501)
* Table: Pagination fix centering * Table: Fix scrollbar is hidden by pagination Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
This commit is contained in:
parent
d85df0a560
commit
506e63f4e1
@ -257,13 +257,14 @@ export const Table: FC<Props> = memo((props: Props) => {
|
|||||||
if (enablePagination) {
|
if (enablePagination) {
|
||||||
const itemsRangeStart = state.pageIndex * state.pageSize + 1;
|
const itemsRangeStart = state.pageIndex * state.pageSize + 1;
|
||||||
let itemsRangeEnd = itemsRangeStart + state.pageSize - 1;
|
let itemsRangeEnd = itemsRangeStart + state.pageSize - 1;
|
||||||
const isSmall = width < 500;
|
const isSmall = width < 550;
|
||||||
if (itemsRangeEnd > data.length) {
|
if (itemsRangeEnd > data.length) {
|
||||||
itemsRangeEnd = data.length;
|
itemsRangeEnd = data.length;
|
||||||
}
|
}
|
||||||
paginationEl = (
|
paginationEl = (
|
||||||
<div className={tableStyles.paginationWrapper}>
|
<div className={tableStyles.paginationWrapper}>
|
||||||
<div>
|
{isSmall ? null : <div className={tableStyles.paginationItem} />}
|
||||||
|
<div className={tableStyles.paginationCenterItem}>
|
||||||
<Pagination
|
<Pagination
|
||||||
currentPage={state.pageIndex + 1}
|
currentPage={state.pageIndex + 1}
|
||||||
numberOfPages={pageOptions.length}
|
numberOfPages={pageOptions.length}
|
||||||
|
@ -106,6 +106,7 @@ export const getTableStyles = (theme: GrafanaTheme2) => {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
`,
|
`,
|
||||||
thead: css`
|
thead: css`
|
||||||
label: thead;
|
label: thead;
|
||||||
@ -182,17 +183,22 @@ export const getTableStyles = (theme: GrafanaTheme2) => {
|
|||||||
li {
|
li {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
div:not(:only-child):first-child {
|
`,
|
||||||
flex-grow: 0.6;
|
paginationItem: css`
|
||||||
}
|
flex: 20%;
|
||||||
position: absolute;
|
`,
|
||||||
bottom: 0;
|
paginationCenterItem: css`
|
||||||
left: 0;
|
flex: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
`,
|
`,
|
||||||
paginationSummary: css`
|
paginationSummary: css`
|
||||||
color: ${theme.colors.text.secondary};
|
color: ${theme.colors.text.secondary};
|
||||||
font-size: ${theme.typography.bodySmall.fontSize};
|
font-size: ${theme.typography.bodySmall.fontSize};
|
||||||
margin-left: auto;
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
flex: 20%;
|
||||||
|
padding-right: ${theme.spacing(1)};
|
||||||
`,
|
`,
|
||||||
|
|
||||||
tableContentWrapper: (totalColumnsWidth: number) => {
|
tableContentWrapper: (totalColumnsWidth: number) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user