File tree Expand file tree Collapse file tree 5 files changed +43
-15
lines changed
apps/material-react-table-docs/pages
packages/material-react-table Expand file tree Collapse file tree 5 files changed +43
-15
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,11 @@ import Head from 'next/head';
1212
1313### Version 2
1414
15+ #### Version 2.0.4 - 11-09-2023
16+
17+ - Add support for ` 'all' ` rows pagination option
18+ - Added ` muiPaginationProps.SelectProps ` support back to allow for native select
19+
1520#### Version 2.0.3 - 11-06-2023
1621
1722- Locale updates
Original file line number Diff line number Diff line change 11{
2- "version" : " 2.0.3 " ,
2+ "version" : " 2.0.4 " ,
33 "license" : " MIT" ,
44 "name" : " material-react-table" ,
55 "description" : " A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript." ,
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ export const MRT_TablePagination = <TData extends MRT_RowData>({
6060 const lastRowIndex = Math . min ( pageIndex * pageSize + pageSize , totalRowCount ) ;
6161
6262 const {
63+ SelectProps,
6364 rowsPerPageOptions = defaultRowsPerPage ,
6465 showFirstButton = showFirstLastPageButtons ,
6566 showLastButton = showFirstLastPageButtons ,
@@ -98,22 +99,29 @@ export const MRT_TablePagination = <TData extends MRT_RowData>({
9899 id = "mrt-rows-per-page"
99100 inputProps = { { 'aria-label' : localization . rowsPerPage } }
100101 label = { localization . rowsPerPage }
101- onChange = { ( event ) => setPageSize ( + event . target . value ) }
102+ onChange = { ( event ) => setPageSize ( + ( event . target . value as any ) ) }
102103 sx = { { mb : 0 } }
103104 value = { pageSize }
104105 variant = "standard"
106+ { ...SelectProps }
105107 >
106- { rowsPerPageOptions . map ( ( option ) =>
107- typeof option === 'number' ? (
108- < MenuItem key = { option } sx = { { m : 0 } } value = { option } >
109- { option }
110- </ MenuItem >
111- ) : (
112- < MenuItem key = { option . value } sx = { { m : 0 } } value = { option . value } >
113- { option . label }
114- </ MenuItem >
115- ) ,
116- ) }
108+ { rowsPerPageOptions . map ( ( option ) => {
109+ const value = typeof option !== 'number' ? option . value : option ;
110+ const label =
111+ typeof option !== 'number' ? option . label : `${ option } ` ;
112+ return (
113+ SelectProps ?. children ??
114+ ( SelectProps ?. native ? (
115+ < option key = { value } value = { value } >
116+ { label }
117+ </ option >
118+ ) : (
119+ < MenuItem key = { value } sx = { { m : 0 } } value = { value } >
120+ { label }
121+ </ MenuItem >
122+ ) )
123+ ) ;
124+ } ) }
117125 </ Select >
118126 </ Box >
119127 ) }
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ import { type LinearProgressProps } from '@mui/material/LinearProgress';
5454import { type PaginationProps } from '@mui/material/Pagination' ;
5555import { type PaperProps } from '@mui/material/Paper' ;
5656import { type RadioProps } from '@mui/material/Radio' ;
57+ import { type SelectProps } from '@mui/material/Select' ;
5758import { type SkeletonProps } from '@mui/material/Skeleton' ;
5859import { type SliderProps } from '@mui/material/Slider' ;
5960import { type TableProps } from '@mui/material/Table' ;
@@ -904,13 +905,15 @@ export type MRT_TableOptions<TData extends MRT_RowData> = Omit<
904905 muiPaginationProps ?:
905906 | ( ( props : { table : MRT_TableInstance < TData > } ) => Partial <
906907 PaginationProps & {
907- rowsPerPageOptions ?: { label : string ; value : number } [ ] | number [ ] ;
908+ SelectProps ?: Partial < SelectProps > ;
909+ rowsPerPageOptions ?: { label : string ; value : number } [ ] | number [ ] ;
908910 showRowsPerPage ?: boolean ;
909911 }
910912 > )
911913 | Partial <
912914 PaginationProps & {
913- rowsPerPageOptions ?: { label : string ; value : number ; } [ ] | number [ ] ;
915+ SelectProps ?: Partial < SelectProps > ;
916+ rowsPerPageOptions ?: { label : string ; value : number } [ ] | number [ ] ;
914917 showRowsPerPage ?: boolean ;
915918 }
916919 > ;
Original file line number Diff line number Diff line change @@ -88,6 +88,18 @@ export const PaginationEnabledDefaultNoRowsPerPage = () => (
8888 />
8989) ;
9090
91+ export const PaginationEnabledCustomizeRowsPerPage = ( ) => (
92+ < MaterialReactTable
93+ columns = { columns }
94+ data = { data }
95+ muiPaginationProps = { {
96+ SelectProps : {
97+ native : true ,
98+ } ,
99+ } }
100+ />
101+ ) ;
102+
91103export const PaginationPagesDisplayMode = ( ) => (
92104 < MaterialReactTable
93105 columns = { columns }
You can’t perform that action at this time.
0 commit comments