material-react-table 2.0.0-alpha.3 → 2.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,8 @@ export interface MRT_Icons {
2
2
  ArrowDownwardIcon: any;
3
3
  ArrowRightIcon: any;
4
4
  CancelIcon: any;
5
+ ChevronLefIcon: any;
6
+ ChevronRightIcon: any;
5
7
  ClearAllIcon: any;
6
8
  CloseIcon: any;
7
9
  DensityLargeIcon: any;
@@ -14,9 +16,11 @@ export interface MRT_Icons {
14
16
  FilterAltIcon: any;
15
17
  FilterListIcon: any;
16
18
  FilterListOffIcon: any;
19
+ FirstPageIcon?: any;
17
20
  FullscreenExitIcon: any;
18
21
  FullscreenIcon: any;
19
22
  KeyboardDoubleArrowDownIcon: any;
23
+ LastPageIcon?: any;
20
24
  MoreHorizIcon: any;
21
25
  MoreVertIcon: any;
22
26
  PushPinIcon: any;
@@ -1,7 +1,7 @@
1
1
  import { type MRT_TableInstance } from '../types';
2
- interface Props<TData extends Record<string, any>> {
2
+ interface Props<TData extends Record<string, any> = {}> {
3
3
  position?: 'bottom' | 'top';
4
4
  table: MRT_TableInstance<TData>;
5
5
  }
6
- export declare const MRT_TablePagination: <TData extends Record<string, any>>({ position, table, }: Props<TData>) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const MRT_TablePagination: <TData extends Record<string, any> = {}>({ position, table, }: Props<TData>) => import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -1,14 +1,15 @@
1
1
  import { type Dispatch, type MutableRefObject, type ReactNode, type RefObject, type SetStateAction } from 'react';
2
2
  import { type AggregationFn, type Cell, type Column, type ColumnDef, type ColumnFiltersState, type ColumnOrderState, type ColumnPinningState, type ColumnSizingInfoState, type ColumnSizingState, type DeepKeys, type ExpandedState, type FilterFn, type GroupingState, type Header, type HeaderGroup, type OnChangeFn, type PaginationState, type Row, type RowSelectionState, type SortingFn, type SortingState, type Table, type TableOptions, type TableState, type Updater, type VisibilityState } from '@tanstack/react-table';
3
3
  import { type VirtualItem, type Virtualizer, type VirtualizerOptions } from '@tanstack/react-virtual';
4
- import { type AutocompleteProps } from '@mui/material';
5
4
  import { type AlertProps } from '@mui/material/Alert';
5
+ import { type AutocompleteProps } from '@mui/material/Autocomplete';
6
6
  import { type ButtonProps } from '@mui/material/Button';
7
7
  import { type CheckboxProps } from '@mui/material/Checkbox';
8
8
  import { type ChipProps } from '@mui/material/Chip';
9
9
  import { type DialogProps } from '@mui/material/Dialog';
10
10
  import { type IconButtonProps } from '@mui/material/IconButton';
11
11
  import { type LinearProgressProps } from '@mui/material/LinearProgress';
12
+ import { type PaginationProps } from '@mui/material/Pagination';
12
13
  import { type PaperProps } from '@mui/material/Paper';
13
14
  import { type RadioProps } from '@mui/material/Radio';
14
15
  import { type SkeletonProps } from '@mui/material/Skeleton';
@@ -19,7 +20,6 @@ import { type TableCellProps } from '@mui/material/TableCell';
19
20
  import { type TableContainerProps } from '@mui/material/TableContainer';
20
21
  import { type TableFooterProps } from '@mui/material/TableFooter';
21
22
  import { type TableHeadProps } from '@mui/material/TableHead';
22
- import { type TablePaginationProps } from '@mui/material/TablePagination';
23
23
  import { type TableRowProps } from '@mui/material/TableRow';
24
24
  import { type TextFieldProps } from '@mui/material/TextField';
25
25
  import { type ToolbarProps } from '@mui/material/Toolbar';
@@ -675,7 +675,13 @@ export type MRT_TableOptions<TData extends Record<string, any>> = Omit<Partial<T
675
675
  }) => TableRowProps) | TableRowProps;
676
676
  muiTablePaginationProps?: ((props: {
677
677
  table: MRT_TableInstance<TData>;
678
- }) => Partial<Omit<TablePaginationProps, 'rowsPerPage'>>) | Partial<Omit<TablePaginationProps, 'rowsPerPage'>>;
678
+ }) => Partial<PaginationProps & {
679
+ rowsPerPageOptions?: number[];
680
+ showRowsPerPage?: boolean;
681
+ }>) | Partial<PaginationProps & {
682
+ rowsPerPageOptions?: number[];
683
+ showRowsPerPage?: boolean;
684
+ }>;
679
685
  muiTablePaperProps?: ((props: {
680
686
  table: MRT_TableInstance<TData>;
681
687
  }) => PaperProps) | PaperProps;
package/dist/index.d.ts CHANGED
@@ -5,14 +5,15 @@ import { Row, Table, TableState, ColumnDef, DeepKeys, Column, Header, HeaderGrou
5
5
  export { ColumnFiltersState as MRT_ColumnFiltersState, ColumnOrderState as MRT_ColumnOrderState, ColumnPinningState as MRT_ColumnPinningState, ColumnSizingInfoState as MRT_ColumnSizingInfoState, ColumnSizingState as MRT_ColumnSizingState, ExpandedState as MRT_ExpandedState, GroupingState as MRT_GroupingState, PaginationState as MRT_PaginationState, RowSelectionState as MRT_RowSelectionState, SortingState as MRT_SortingState, Updater as MRT_Updater, VisibilityState as MRT_VisibilityState } from '@tanstack/react-table';
6
6
  import { Virtualizer, VirtualizerOptions, VirtualItem } from '@tanstack/react-virtual';
7
7
  export { VirtualItem as MRT_VirtualItem, Virtualizer as MRT_Virtualizer, VirtualizerOptions as MRT_VirtualizerOptions } from '@tanstack/react-virtual';
8
- import { AutocompleteProps } from '@mui/material';
9
8
  import { AlertProps } from '@mui/material/Alert';
9
+ import { AutocompleteProps } from '@mui/material/Autocomplete';
10
10
  import { ButtonProps } from '@mui/material/Button';
11
11
  import { CheckboxProps } from '@mui/material/Checkbox';
12
12
  import { ChipProps } from '@mui/material/Chip';
13
13
  import { DialogProps } from '@mui/material/Dialog';
14
14
  import { IconButtonProps } from '@mui/material/IconButton';
15
15
  import { LinearProgressProps } from '@mui/material/LinearProgress';
16
+ import { PaginationProps } from '@mui/material/Pagination';
16
17
  import { PaperProps } from '@mui/material/Paper';
17
18
  import { RadioProps } from '@mui/material/Radio';
18
19
  import { SkeletonProps } from '@mui/material/Skeleton';
@@ -23,7 +24,6 @@ import { TableCellProps } from '@mui/material/TableCell';
23
24
  import { TableContainerProps } from '@mui/material/TableContainer';
24
25
  import { TableFooterProps } from '@mui/material/TableFooter';
25
26
  import { TableHeadProps } from '@mui/material/TableHead';
26
- import { TablePaginationProps } from '@mui/material/TablePagination';
27
27
  import { TableRowProps } from '@mui/material/TableRow';
28
28
  import { TextFieldProps } from '@mui/material/TextField';
29
29
  import { ToolbarProps } from '@mui/material/Toolbar';
@@ -115,6 +115,8 @@ interface MRT_Icons {
115
115
  ArrowDownwardIcon: any;
116
116
  ArrowRightIcon: any;
117
117
  CancelIcon: any;
118
+ ChevronLefIcon: any;
119
+ ChevronRightIcon: any;
118
120
  ClearAllIcon: any;
119
121
  CloseIcon: any;
120
122
  DensityLargeIcon: any;
@@ -127,9 +129,11 @@ interface MRT_Icons {
127
129
  FilterAltIcon: any;
128
130
  FilterListIcon: any;
129
131
  FilterListOffIcon: any;
132
+ FirstPageIcon?: any;
130
133
  FullscreenExitIcon: any;
131
134
  FullscreenIcon: any;
132
135
  KeyboardDoubleArrowDownIcon: any;
136
+ LastPageIcon?: any;
133
137
  MoreHorizIcon: any;
134
138
  MoreVertIcon: any;
135
139
  PushPinIcon: any;
@@ -799,7 +803,13 @@ type MRT_TableOptions<TData extends Record<string, any>> = Omit<Partial<TableOpt
799
803
  }) => TableRowProps) | TableRowProps;
800
804
  muiTablePaginationProps?: ((props: {
801
805
  table: MRT_TableInstance<TData>;
802
- }) => Partial<Omit<TablePaginationProps, 'rowsPerPage'>>) | Partial<Omit<TablePaginationProps, 'rowsPerPage'>>;
806
+ }) => Partial<PaginationProps & {
807
+ rowsPerPageOptions?: number[];
808
+ showRowsPerPage?: boolean;
809
+ }>) | Partial<PaginationProps & {
810
+ rowsPerPageOptions?: number[];
811
+ showRowsPerPage?: boolean;
812
+ }>;
803
813
  muiTablePaperProps?: ((props: {
804
814
  table: MRT_TableInstance<TData>;
805
815
  }) => PaperProps) | PaperProps;
@@ -1440,11 +1450,11 @@ interface Props$5<TData extends Record<string, any>> {
1440
1450
  }
1441
1451
  declare const MRT_LinearProgressBar: <TData extends Record<string, any>>({ isTopToolbar, table, }: Props$5<TData>) => react_jsx_runtime.JSX.Element;
1442
1452
 
1443
- interface Props$4<TData extends Record<string, any>> {
1453
+ interface Props$4<TData extends Record<string, any> = {}> {
1444
1454
  position?: 'bottom' | 'top';
1445
1455
  table: MRT_TableInstance<TData>;
1446
1456
  }
1447
- declare const MRT_TablePagination: <TData extends Record<string, any>>({ position, table, }: Props$4<TData>) => react_jsx_runtime.JSX.Element;
1457
+ declare const MRT_TablePagination: <TData extends Record<string, any> = {}>({ position, table, }: Props$4<TData>) => react_jsx_runtime.JSX.Element;
1448
1458
 
1449
1459
  interface Props$3<TData extends Record<string, any>> {
1450
1460
  stackAlertBanner: boolean;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.0-alpha.3",
2
+ "version": "2.0.0-alpha.4",
3
3
  "license": "MIT",
4
4
  "name": "material-react-table",
5
5
  "description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
@@ -1,4 +1,4 @@
1
- import { useEffect, useRef } from 'react';
1
+ import { useEffect, useReducer, useRef } from 'react';
2
2
  import { getCanRankRows } from '../column.utils';
3
3
  import { type MRT_SortingState, type MRT_TableInstance } from '../types';
4
4
 
@@ -6,10 +6,12 @@ export const useMRT_Effects = <TData extends Record<string, any> = {}>(
6
6
  table: MRT_TableInstance<TData>,
7
7
  ) => {
8
8
  const {
9
+ getIsSomeRowsPinned,
9
10
  getState,
10
- options: { enablePagination, rowCount },
11
+ options: { enablePagination, enableRowPinning, rowCount },
11
12
  } = table;
12
13
  const {
14
+ density,
13
15
  globalFilter,
14
16
  isFullScreen,
15
17
  isLoading,
@@ -18,6 +20,7 @@ export const useMRT_Effects = <TData extends Record<string, any> = {}>(
18
20
  sorting,
19
21
  } = getState();
20
22
 
23
+ const rerender = useReducer(() => ({}), {})[1];
21
24
  const isMounted = useRef(false);
22
25
  const initialBodyHeight = useRef<string>();
23
26
  const previousTop = useRef<number>();
@@ -74,4 +77,12 @@ export const useMRT_Effects = <TData extends Record<string, any> = {}>(
74
77
  table.setSorting(() => appliedSort.current || []);
75
78
  }
76
79
  }, [globalFilter]);
80
+
81
+ useEffect(() => {
82
+ if (enableRowPinning && getIsSomeRowsPinned()) {
83
+ setTimeout(() => {
84
+ rerender();
85
+ }, 150);
86
+ }
87
+ }, [density]);
77
88
  };
package/src/icons.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward';
2
2
  import ArrowRightIcon from '@mui/icons-material/ArrowRight';
3
3
  import CancelIcon from '@mui/icons-material/Cancel';
4
+ import ChevronLefIcon from '@mui/icons-material/ChevronLeft';
5
+ import ChevronRightIcon from '@mui/icons-material/ChevronRight';
4
6
  import ClearAllIcon from '@mui/icons-material/ClearAll';
5
7
  import CloseIcon from '@mui/icons-material/Close';
6
8
  import DensityLargeIcon from '@mui/icons-material/DensityLarge';
@@ -13,9 +15,11 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
13
15
  import FilterAltIcon from '@mui/icons-material/FilterAlt';
14
16
  import FilterListIcon from '@mui/icons-material/FilterList';
15
17
  import FilterListOffIcon from '@mui/icons-material/FilterListOff';
18
+ import FirstPageIcon from '@mui/icons-material/FirstPage';
16
19
  import FullscreenIcon from '@mui/icons-material/Fullscreen';
17
20
  import FullscreenExitIcon from '@mui/icons-material/FullscreenExit';
18
21
  import KeyboardDoubleArrowDownIcon from '@mui/icons-material/KeyboardDoubleArrowDown';
22
+ import LastPageIcon from '@mui/icons-material/LastPage';
19
23
  import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
20
24
  import MoreVertIcon from '@mui/icons-material/MoreVert';
21
25
  import PushPinIcon from '@mui/icons-material/PushPin';
@@ -31,6 +35,8 @@ export interface MRT_Icons {
31
35
  ArrowDownwardIcon: any;
32
36
  ArrowRightIcon: any;
33
37
  CancelIcon: any;
38
+ ChevronLefIcon: any;
39
+ ChevronRightIcon: any;
34
40
  ClearAllIcon: any;
35
41
  CloseIcon: any;
36
42
  DensityLargeIcon: any;
@@ -43,9 +49,11 @@ export interface MRT_Icons {
43
49
  FilterAltIcon: any;
44
50
  FilterListIcon: any;
45
51
  FilterListOffIcon: any;
52
+ FirstPageIcon?: any;
46
53
  FullscreenExitIcon: any;
47
54
  FullscreenIcon: any;
48
55
  KeyboardDoubleArrowDownIcon: any;
56
+ LastPageIcon?: any;
49
57
  MoreHorizIcon: any;
50
58
  MoreVertIcon: any;
51
59
  PushPinIcon: any;
@@ -62,6 +70,8 @@ export const MRT_Default_Icons: MRT_Icons = {
62
70
  ArrowDownwardIcon,
63
71
  ArrowRightIcon,
64
72
  CancelIcon,
73
+ ChevronLefIcon,
74
+ ChevronRightIcon,
65
75
  ClearAllIcon,
66
76
  CloseIcon,
67
77
  DensityLargeIcon,
@@ -74,9 +84,11 @@ export const MRT_Default_Icons: MRT_Icons = {
74
84
  FilterAltIcon,
75
85
  FilterListIcon,
76
86
  FilterListOffIcon,
87
+ FirstPageIcon,
77
88
  FullscreenExitIcon,
78
89
  FullscreenIcon,
79
90
  KeyboardDoubleArrowDownIcon,
91
+ LastPageIcon,
80
92
  MoreHorizIcon,
81
93
  MoreVertIcon,
82
94
  PushPinIcon,
@@ -1,14 +1,22 @@
1
- import { type ChangeEvent } from 'react';
2
- import TablePagination from '@mui/material/TablePagination';
1
+ import Box from '@mui/material/Box';
2
+ import IconButton from '@mui/material/IconButton';
3
+ import InputLabel from '@mui/material/InputLabel';
4
+ import MenuItem from '@mui/material/MenuItem';
5
+ import Pagination, { type PaginationProps } from '@mui/material/Pagination';
6
+ import PaginationItem from '@mui/material/PaginationItem';
7
+ import Select from '@mui/material/Select';
8
+ import Typography from '@mui/material/Typography';
3
9
  import { parseFromValuesOrFunc } from '../column.utils';
4
10
  import { type MRT_TableInstance } from '../types';
5
11
 
6
- interface Props<TData extends Record<string, any>> {
12
+ const defaultPageSizeOptions = [5, 10, 15, 20, 25, 30, 50, 100];
13
+
14
+ interface Props<TData extends Record<string, any> = {}> {
7
15
  position?: 'bottom' | 'top';
8
16
  table: MRT_TableInstance<TData>;
9
17
  }
10
18
 
11
- export const MRT_TablePagination = <TData extends Record<string, any>>({
19
+ export const MRT_TablePagination = <TData extends Record<string, any> = {}>({
12
20
  position = 'bottom',
13
21
  table,
14
22
  }: Props<TData>) => {
@@ -17,8 +25,10 @@ export const MRT_TablePagination = <TData extends Record<string, any>>({
17
25
  getState,
18
26
  options: {
19
27
  enableToolbarInternalActions,
28
+ icons: { ChevronLefIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon },
20
29
  localization,
21
30
  muiTablePaginationProps,
31
+ paginationDisplayMode,
22
32
  rowCount,
23
33
  },
24
34
  setPageIndex,
@@ -29,80 +39,127 @@ export const MRT_TablePagination = <TData extends Record<string, any>>({
29
39
  showGlobalFilter,
30
40
  } = getState();
31
41
 
32
- const totalRowCount = rowCount ?? getPrePaginationRowModel().rows.length;
33
- const showFirstLastPageButtons = totalRowCount / pageSize > 2;
34
-
35
- const tablePaginationProps = parseFromValuesOrFunc(muiTablePaginationProps, {
42
+ const paginationProps = parseFromValuesOrFunc(muiTablePaginationProps, {
36
43
  table,
37
44
  });
38
45
 
39
- const handleChangeRowsPerPage = (event: ChangeEvent<HTMLInputElement>) => {
40
- setPageSize(+event.target.value);
41
- };
46
+ const totalRowCount = rowCount ?? getPrePaginationRowModel().rows.length;
47
+ const numberOfPages = Math.ceil(totalRowCount / pageSize);
48
+ const showFirstLastPageButtons = numberOfPages > 2;
49
+ const showFirstButton =
50
+ showFirstLastPageButtons && paginationProps?.showFirstButton !== false;
51
+ const showLastButton =
52
+ showFirstLastPageButtons && paginationProps?.showLastButton !== false;
53
+ const firstRowIndex = pageIndex * pageSize;
54
+ const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
42
55
 
43
56
  return (
44
- <TablePagination
45
- component="div"
46
- count={totalRowCount}
47
- getItemAriaLabel={(type) =>
48
- type === 'first'
49
- ? localization.goToFirstPage
50
- : type === 'last'
51
- ? localization.goToLastPage
52
- : type === 'next'
53
- ? localization.goToNextPage
54
- : localization.goToPreviousPage
55
- }
56
- labelDisplayedRows={({ count, from, to }) =>
57
- `${from}-${to} ${localization.of} ${count}`
58
- }
59
- labelRowsPerPage={localization.rowsPerPage}
60
- onPageChange={(_: any, newPage: number) => setPageIndex(newPage)}
61
- onRowsPerPageChange={handleChangeRowsPerPage}
62
- page={Math.max(
63
- Math.min(pageIndex, Math.ceil(totalRowCount / pageSize) - 1),
64
- 0,
65
- )}
66
- rowsPerPage={pageSize}
67
- rowsPerPageOptions={[5, 10, 15, 20, 25, 30, 50, 100]}
68
- showFirstButton={showFirstLastPageButtons}
69
- showLastButton={showFirstLastPageButtons}
70
- {...tablePaginationProps}
71
- SelectProps={{
72
- MenuProps: { MenuListProps: { disablePadding: true }, sx: { m: 0 } },
73
- sx: { m: '0 1rem 0 1ch' },
74
- ...tablePaginationProps?.SelectProps,
75
- }}
76
- sx={(theme) => ({
77
- '& . MuiTablePagination-select': {
78
- m: '0 1px',
79
- },
80
- '& .MuiTablePagination-actions': {
81
- m: '0 1px',
82
- },
83
- '& .MuiTablePagination-displayedRows': {
84
- m: '0 1px',
85
- },
86
- '& .MuiTablePagination-selectLabel': {
87
- m: '0 -1px',
88
- },
89
- '& .MuiTablePagination-toolbar': {
90
- alignItems: 'center',
91
- display: 'flex',
92
- },
93
- '&. MuiInputBase-root': {
94
- m: '0 1px',
95
- },
57
+ <Box
58
+ sx={{
59
+ alignItems: 'center',
60
+ display: 'flex',
61
+ gap: '8px',
62
+ justifyContent: 'space-between',
96
63
  mt:
97
64
  position === 'top' &&
98
65
  enableToolbarInternalActions &&
99
66
  !showGlobalFilter
100
- ? '3.5rem'
67
+ ? '3rem'
101
68
  : undefined,
102
69
  position: 'relative',
70
+ px: '4px',
71
+ py: '12px',
103
72
  zIndex: 2,
104
- ...(parseFromValuesOrFunc(tablePaginationProps?.sx, theme) as any),
105
- })}
106
- />
73
+ }}
74
+ >
75
+ {paginationProps?.showRowsPerPage !== false && (
76
+ <Box sx={{ alignItems: 'center', display: 'flex', gap: '8px' }}>
77
+ <InputLabel htmlFor="mrt-rows-per-page" sx={{ mb: 0 }}>
78
+ {localization.rowsPerPage}
79
+ </InputLabel>
80
+ <Select
81
+ id="mrt-rows-per-page"
82
+ label={localization.rowsPerPage}
83
+ onChange={(event) => setPageSize(+event.target.value)}
84
+ sx={{ '&::before': { border: 'none' }, mb: 0 }}
85
+ value={pageSize}
86
+ variant="standard"
87
+ >
88
+ {defaultPageSizeOptions.map((value) => (
89
+ <MenuItem key={value} sx={{ m: 0 }} value={value}>
90
+ {value}
91
+ </MenuItem>
92
+ ))}
93
+ </Select>
94
+ </Box>
95
+ )}
96
+ {paginationDisplayMode === 'pages' ? (
97
+ <Pagination
98
+ count={numberOfPages}
99
+ onChange={(_e, newPageIndex) => setPageIndex(newPageIndex - 1)}
100
+ page={pageIndex + 1}
101
+ renderItem={(item) => (
102
+ <PaginationItem
103
+ slots={{
104
+ first: FirstPageIcon,
105
+ last: LastPageIcon,
106
+ next: ChevronRightIcon,
107
+ previous: ChevronLefIcon,
108
+ }}
109
+ {...item}
110
+ />
111
+ )}
112
+ showFirstButton={showFirstButton}
113
+ showLastButton={showLastButton}
114
+ {...(paginationProps as PaginationProps)}
115
+ />
116
+ ) : paginationDisplayMode === 'default' ? (
117
+ <>
118
+ <Typography mb="0" mx="8px" variant="body2">{`${
119
+ lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()
120
+ }-${lastRowIndex.toLocaleString()} ${
121
+ localization.of
122
+ } ${totalRowCount.toLocaleString()}`}</Typography>
123
+ <Box gap="xs">
124
+ {showFirstButton && (
125
+ <IconButton
126
+ aria-label={localization.goToFirstPage}
127
+ disabled={pageIndex <= 0}
128
+ onClick={() => setPageIndex(0)}
129
+ size="small"
130
+ >
131
+ <FirstPageIcon />
132
+ </IconButton>
133
+ )}
134
+ <IconButton
135
+ aria-label={localization.goToPreviousPage}
136
+ disabled={pageIndex <= 0}
137
+ onClick={() => setPageIndex(pageIndex - 1)}
138
+ size="small"
139
+ >
140
+ <ChevronLefIcon />
141
+ </IconButton>
142
+ <IconButton
143
+ aria-label={localization.goToNextPage}
144
+ disabled={lastRowIndex >= totalRowCount}
145
+ onClick={() => setPageIndex(pageIndex + 1)}
146
+ size="small"
147
+ >
148
+ <ChevronRightIcon />
149
+ </IconButton>
150
+ {showLastButton && (
151
+ <IconButton
152
+ aria-label={localization.goToLastPage}
153
+ disabled={lastRowIndex >= totalRowCount}
154
+ onClick={() => setPageIndex(numberOfPages - 1)}
155
+ size="small"
156
+ >
157
+ <LastPageIcon />
158
+ </IconButton>
159
+ )}
160
+ </Box>
161
+ </>
162
+ ) : null}
163
+ </Box>
107
164
  );
108
165
  };
package/src/types.ts CHANGED
@@ -38,14 +38,15 @@ import {
38
38
  type Virtualizer,
39
39
  type VirtualizerOptions,
40
40
  } from '@tanstack/react-virtual';
41
- import { type AutocompleteProps } from '@mui/material';
42
41
  import { type AlertProps } from '@mui/material/Alert';
42
+ import { type AutocompleteProps } from '@mui/material/Autocomplete';
43
43
  import { type ButtonProps } from '@mui/material/Button';
44
44
  import { type CheckboxProps } from '@mui/material/Checkbox';
45
45
  import { type ChipProps } from '@mui/material/Chip';
46
46
  import { type DialogProps } from '@mui/material/Dialog';
47
47
  import { type IconButtonProps } from '@mui/material/IconButton';
48
48
  import { type LinearProgressProps } from '@mui/material/LinearProgress';
49
+ import { type PaginationProps } from '@mui/material/Pagination';
49
50
  import { type PaperProps } from '@mui/material/Paper';
50
51
  import { type RadioProps } from '@mui/material/Radio';
51
52
  import { type SkeletonProps } from '@mui/material/Skeleton';
@@ -56,7 +57,6 @@ import { type TableCellProps } from '@mui/material/TableCell';
56
57
  import { type TableContainerProps } from '@mui/material/TableContainer';
57
58
  import { type TableFooterProps } from '@mui/material/TableFooter';
58
59
  import { type TableHeadProps } from '@mui/material/TableHead';
59
- import { type TablePaginationProps } from '@mui/material/TablePagination';
60
60
  import { type TableRowProps } from '@mui/material/TableRow';
61
61
  import { type TextFieldProps } from '@mui/material/TextField';
62
62
  import { type ToolbarProps } from '@mui/material/Toolbar';
@@ -917,10 +917,18 @@ export type MRT_TableOptions<TData extends Record<string, any>> = Omit<
917
917
  }) => TableRowProps)
918
918
  | TableRowProps;
919
919
  muiTablePaginationProps?:
920
- | ((props: {
921
- table: MRT_TableInstance<TData>;
922
- }) => Partial<Omit<TablePaginationProps, 'rowsPerPage'>>)
923
- | Partial<Omit<TablePaginationProps, 'rowsPerPage'>>;
920
+ | ((props: { table: MRT_TableInstance<TData> }) => Partial<
921
+ PaginationProps & {
922
+ rowsPerPageOptions?: number[];
923
+ showRowsPerPage?: boolean;
924
+ }
925
+ >)
926
+ | Partial<
927
+ PaginationProps & {
928
+ rowsPerPageOptions?: number[];
929
+ showRowsPerPage?: boolean;
930
+ }
931
+ >;
924
932
  muiTablePaperProps?:
925
933
  | ((props: { table: MRT_TableInstance<TData> }) => PaperProps)
926
934
  | PaperProps;