Skip to content

Commit

Permalink
Merge pull request #611 from ValentinJS/main
Browse files Browse the repository at this point in the history
Add new 'paginationWithControls' prop
  • Loading branch information
icflorescu authored Jun 30, 2024
2 parents 4c757fc + 6979596 commit 5b88a1e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions package/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export function DataTable<T>({
recordsPerPageOptions,
recordsPerPageLabel = 'Records per page',
paginationWithEdges,
paginationWithControls,
paginationActiveTextColor,
paginationActiveBackgroundColor,
paginationSize = 'sm',
Expand Down Expand Up @@ -459,6 +460,7 @@ export function DataTable<T>({
recordsPerPageOptions={recordsPerPageOptions}
recordsPerPageLabel={recordsPerPageLabel}
paginationWithEdges={paginationWithEdges}
paginationWithControls={paginationWithControls}
paginationActiveTextColor={paginationActiveTextColor}
paginationActiveBackgroundColor={paginationActiveBackgroundColor}
paginationSize={paginationSize}
Expand Down
2 changes: 2 additions & 0 deletions package/DataTablePagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const DataTablePagination = forwardRef(function DataTablePagination(
page,
onPageChange,
paginationWithEdges,
paginationWithControls,
paginationActiveTextColor,
paginationActiveBackgroundColor,
paginationSize,
Expand Down Expand Up @@ -104,6 +105,7 @@ export const DataTablePagination = forwardRef(function DataTablePagination(
: undefined
}
withEdges={paginationWithEdges}
withControls={paginationWithControls}
value={page}
onChange={onPageChange}
size={paginationSize}
Expand Down
8 changes: 7 additions & 1 deletion package/types/DataTablePaginationProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { DataTablePageSizeSelectorProps } from './DataTablePageSizeSelector
export type DataTablePaginationProps = (
| {
paginationWithEdges?: never;
paginationWithControls?: never;
page?: never;
onPageChange?: never;
totalRecords?: never;
Expand All @@ -18,10 +19,15 @@ export type DataTablePaginationProps = (
}
| {
/**
* Whenther to show first and last page navigation buttons.
* Whether to show first and last page navigation buttons.
*/
paginationWithEdges?: boolean;

/**
* Whether to show next and previous page navigation buttons.
*/
paginationWithControls?: boolean;

/**
* Current page number (1-based).
* If provided, a pagination component is shown.
Expand Down

0 comments on commit 5b88a1e

Please sign in to comment.