mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
Move pagination outside of table (#16232)
This commit is contained in:
@@ -63,7 +63,7 @@ const TableViewStyles = styled.div<{
|
||||
${({ scrollTable, theme }) =>
|
||||
scrollTable &&
|
||||
`
|
||||
height: 380px;
|
||||
height: 300px;
|
||||
margin-bottom: ${theme.gridUnit * 4}px;
|
||||
overflow: auto;
|
||||
`}
|
||||
@@ -88,22 +88,24 @@ const TableViewStyles = styled.div<{
|
||||
`${theme.gridUnit - 2}px solid ${theme.colors.grayscale.light2}`};
|
||||
${({ small }) => small && `padding-bottom: 0;`}
|
||||
}
|
||||
`;
|
||||
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: ${({ theme }) => theme.colors.grayscale.light5};
|
||||
const PaginationStyles = styled.div<{
|
||||
isPaginationSticky?: boolean;
|
||||
}>`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: ${({ theme }) => theme.colors.grayscale.light5};
|
||||
|
||||
${({ isPaginationSticky }) =>
|
||||
isPaginationSticky &&
|
||||
`
|
||||
${({ isPaginationSticky }) =>
|
||||
isPaginationSticky &&
|
||||
`
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
`};
|
||||
}
|
||||
|
||||
.row-count-container {
|
||||
margin-top: ${({ theme }) => theme.gridUnit * 2}px;
|
||||
@@ -191,30 +193,35 @@ const TableView = ({
|
||||
const isEmpty = !loading && content.length === 0;
|
||||
|
||||
return (
|
||||
<TableViewStyles {...props}>
|
||||
<TableCollection
|
||||
getTableProps={getTableProps}
|
||||
getTableBodyProps={getTableBodyProps}
|
||||
prepareRow={prepareRow}
|
||||
headerGroups={headerGroups}
|
||||
rows={content}
|
||||
columns={columns}
|
||||
loading={loading}
|
||||
/>
|
||||
{isEmpty && (
|
||||
<EmptyWrapperComponent>
|
||||
{noDataText ? (
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={noDataText}
|
||||
/>
|
||||
) : (
|
||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||
)}
|
||||
</EmptyWrapperComponent>
|
||||
)}
|
||||
<>
|
||||
<TableViewStyles {...props}>
|
||||
<TableCollection
|
||||
getTableProps={getTableProps}
|
||||
getTableBodyProps={getTableBodyProps}
|
||||
prepareRow={prepareRow}
|
||||
headerGroups={headerGroups}
|
||||
rows={content}
|
||||
columns={columns}
|
||||
loading={loading}
|
||||
/>
|
||||
{isEmpty && (
|
||||
<EmptyWrapperComponent>
|
||||
{noDataText ? (
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={noDataText}
|
||||
/>
|
||||
) : (
|
||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||
)}
|
||||
</EmptyWrapperComponent>
|
||||
)}
|
||||
</TableViewStyles>
|
||||
{pageCount > 1 && withPagination && (
|
||||
<div className="pagination-container">
|
||||
<PaginationStyles
|
||||
className="pagination-container"
|
||||
isPaginationSticky={props.isPaginationSticky}
|
||||
>
|
||||
<Pagination
|
||||
totalPages={pageCount || 0}
|
||||
currentPage={pageCount ? pageIndex + 1 : 0}
|
||||
@@ -232,9 +239,9 @@ const TableView = ({
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</PaginationStyles>
|
||||
)}
|
||||
</TableViewStyles>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user