material-react-table 1.0.0-beta.17 → 1.0.0-beta.18

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.
@@ -1,7 +1,7 @@
1
1
  import { MRT_TableInstance } from '..';
2
2
  interface Props<TData extends Record<string, any> = {}> {
3
- table: MRT_TableInstance<TData>;
4
3
  position: 'top' | 'bottom';
4
+ table: MRT_TableInstance<TData>;
5
5
  }
6
6
  export declare const MRT_TablePagination: <TData extends Record<string, any> = {}>({ table, position, }: Props<TData>) => JSX.Element;
7
7
  export {};
@@ -47,6 +47,10 @@ export interface MRT_Localization {
47
47
  filterStartsWith: string;
48
48
  filterWeakEquals: string;
49
49
  filteringByColumn: string;
50
+ goToFirstPage: string;
51
+ goToLastPage: string;
52
+ goToNextPage: string;
53
+ goToPreviousPage: string;
50
54
  grab: string;
51
55
  groupByColumn: string;
52
56
  groupedBy: string;
@@ -57,6 +61,7 @@ export interface MRT_Localization {
57
61
  move: string;
58
62
  noRecordsToDisplay: string;
59
63
  noResultsFound: string;
64
+ of: string;
60
65
  or: string;
61
66
  pinToLeft: string;
62
67
  pinToRight: string;
@@ -65,6 +70,7 @@ export interface MRT_Localization {
65
70
  rowActions: string;
66
71
  rowNumber: string;
67
72
  rowNumbers: string;
73
+ rowsPerPage: string;
68
74
  save: string;
69
75
  search: string;
70
76
  select: string;
@@ -192,6 +192,10 @@ const MRT_Localization_EN = {
192
192
  filterStartsWith: 'Starts With',
193
193
  filterWeakEquals: 'Equals',
194
194
  filteringByColumn: 'Filtering by {column} - {filterType} {filterValue}',
195
+ goToFirstPage: 'Go to first page',
196
+ goToLastPage: 'Go to last page',
197
+ goToNextPage: 'Go to next page',
198
+ goToPreviousPage: 'Go to previous page',
195
199
  grab: 'Grab',
196
200
  groupByColumn: 'Group by {column}',
197
201
  groupedBy: 'Grouped by ',
@@ -202,6 +206,7 @@ const MRT_Localization_EN = {
202
206
  move: 'Move',
203
207
  noRecordsToDisplay: 'No records to display',
204
208
  noResultsFound: 'No results found',
209
+ of: 'of',
205
210
  or: 'or',
206
211
  pinToLeft: 'Pin to left',
207
212
  pinToRight: 'Pin to right',
@@ -210,6 +215,7 @@ const MRT_Localization_EN = {
210
215
  rowActions: 'Row Actions',
211
216
  rowNumber: '#',
212
217
  rowNumbers: 'Row Numbers',
218
+ rowsPerPage: 'Rows per page',
213
219
  save: 'Save',
214
220
  search: 'Search',
215
221
  selectedCountOfRowCountRowsSelected: '{selectedCount} of {rowCount} row(s) selected',
@@ -1114,7 +1120,7 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table }) => {
1114
1120
  };
1115
1121
 
1116
1122
  const MRT_TablePagination = ({ table, position, }) => {
1117
- const { getPrePaginationRowModel, getState, setPageIndex, setPageSize, options: { muiTablePaginationProps, enableToolbarInternalActions, rowCount, }, } = table;
1123
+ const { getPrePaginationRowModel, getState, setPageIndex, setPageSize, options: { muiTablePaginationProps, enableToolbarInternalActions, localization, rowCount, }, } = table;
1118
1124
  const { pagination: { pageSize = 10, pageIndex = 0 }, showGlobalFilter, } = getState();
1119
1125
  const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
1120
1126
  const showFirstLastPageButtons = totalRowCount / pageSize > 2;
@@ -1124,10 +1130,13 @@ const MRT_TablePagination = ({ table, position, }) => {
1124
1130
  const handleChangeRowsPerPage = (event) => {
1125
1131
  setPageSize(+event.target.value);
1126
1132
  };
1127
- return (React.createElement(TablePagination, Object.assign({ SelectProps: {
1128
- sx: { m: '0 1rem 0 1ch' },
1129
- MenuProps: { MenuListProps: { disablePadding: true } },
1130
- }, component: "div", count: totalRowCount, onPageChange: (_, newPage) => setPageIndex(newPage), onRowsPerPageChange: handleChangeRowsPerPage, page: pageIndex, rowsPerPage: pageSize, rowsPerPageOptions: [5, 10, 15, 20, 25, 30, 50, 100], showFirstButton: showFirstLastPageButtons, showLastButton: showFirstLastPageButtons }, tablePaginationProps, { sx: (theme) => (Object.assign({ '& .MuiTablePagination-toolbar': {
1133
+ return (React.createElement(TablePagination, Object.assign({ component: "div", count: totalRowCount, getItemAriaLabel: (type) => type === 'first'
1134
+ ? localization.goToFirstPage
1135
+ : type === 'last'
1136
+ ? localization.goToLastPage
1137
+ : type === 'next'
1138
+ ? localization.goToNextPage
1139
+ : localization.goToPreviousPage, labelDisplayedRows: ({ from, to, count }) => `${from}-${to} ${localization.of} ${count}`, labelRowsPerPage: localization.rowsPerPage, onPageChange: (_, newPage) => setPageIndex(newPage), onRowsPerPageChange: handleChangeRowsPerPage, page: pageIndex, rowsPerPage: pageSize, rowsPerPageOptions: [5, 10, 15, 20, 25, 30, 50, 100], showFirstButton: showFirstLastPageButtons, showLastButton: showFirstLastPageButtons }, tablePaginationProps, { SelectProps: Object.assign({ sx: { m: '0 1rem 0 1ch' }, MenuProps: { MenuListProps: { disablePadding: true }, sx: { m: 0 } } }, tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.SelectProps), sx: (theme) => (Object.assign({ '& .MuiTablePagination-toolbar': {
1131
1140
  display: 'flex',
1132
1141
  alignItems: 'center',
1133
1142
  }, '& .MuiTablePagination-selectLabel': {