material-react-table 2.0.0-alpha.2 → 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.
- package/dist/cjs/index.js +208 -144
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/icons.d.ts +4 -0
- package/dist/cjs/types/locales/np.d.ts +2 -0
- package/dist/cjs/types/toolbar/MRT_TablePagination.d.ts +2 -2
- package/dist/cjs/types/types.d.ts +29 -3
- package/dist/esm/material-react-table.esm.js +200 -144
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/icons.d.ts +4 -0
- package/dist/esm/types/locales/np.d.ts +2 -0
- package/dist/esm/types/toolbar/MRT_TablePagination.d.ts +2 -2
- package/dist/esm/types/types.d.ts +29 -3
- package/dist/index.d.ts +35 -5
- package/locales/np.d.ts +2 -0
- package/locales/np.esm.d.ts +2 -0
- package/locales/np.esm.js +94 -0
- package/locales/np.esm.js.map +1 -0
- package/locales/np.js +98 -0
- package/locales/np.js.map +1 -0
- package/package.json +26 -26
- package/src/column.utils.ts +1 -5
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +1 -1
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +6 -6
- package/src/hooks/useMRT_Effects.ts +13 -2
- package/src/icons.ts +12 -0
- package/src/inputs/MRT_FilterTextField.tsx +302 -223
- package/src/locales/np.ts +94 -0
- package/src/menus/MRT_ColumnActionMenu.tsx +34 -31
- package/src/menus/MRT_FilterOptionMenu.tsx +1 -1
- package/src/toolbar/MRT_TablePagination.tsx +124 -67
- package/src/types.ts +44 -5
@@ -0,0 +1,94 @@
|
|
1
|
+
import { type MRT_Localization } from '..';
|
2
|
+
|
3
|
+
export const MRT_Localization_NP: MRT_Localization = {
|
4
|
+
actions: 'कार्यहरू',
|
5
|
+
and: 'तथा',
|
6
|
+
cancel: 'रद्द गर्नुहोस्',
|
7
|
+
changeFilterMode: 'फिल्टर प्रणाली परिवर्तन गर्नुहोस्',
|
8
|
+
changeSearchMode: 'खोज प्रणाली परिवर्तन गर्नुहोस्',
|
9
|
+
clearFilter: 'फिल्टर हटाउनुहोस्',
|
10
|
+
clearSearch: 'खोजिएको शब्द मेट्नुहोस्',
|
11
|
+
clearSort: 'क्रम हटाउनुहोस्',
|
12
|
+
clickToCopy: 'प्रतिलिपि बनाउन क्लिक गर्नुहोस्',
|
13
|
+
collapse: 'संकुचित गर्नुहोस्',
|
14
|
+
collapseAll: 'सबै संकुचित गर्नुहोस्',
|
15
|
+
columnActions: 'यस स्तम्भका कार्यहरू',
|
16
|
+
copiedToClipboard: 'क्लिपबोर्डमा प्रतिलिपि गरियो',
|
17
|
+
dropToGroupBy: '{column} का आधारमा समूह बनाउनुहोस्',
|
18
|
+
edit: 'सम्पादन गर्नुहोस्',
|
19
|
+
expand: 'विस्तार गर्नुहोस्',
|
20
|
+
expandAll: 'सबै विस्तार गर्नुहोस्',
|
21
|
+
filterArrIncludes: 'समावेश भएको',
|
22
|
+
filterArrIncludesAll: 'सबै समावेश भएको',
|
23
|
+
filterArrIncludesSome: 'केही समावेश भएको',
|
24
|
+
filterBetween: 'बीचको',
|
25
|
+
filterBetweenInclusive: 'बीचमा समावेश गरिएको',
|
26
|
+
filterByColumn: '{column} का आधारमा फिल्टर गर्नुहोस्',
|
27
|
+
filterContains: 'समावेश गरिएको',
|
28
|
+
filterEmpty: 'खाली भएको',
|
29
|
+
filterEndsWith: 'अन्तमा समावेश गरिएको',
|
30
|
+
filterEquals: 'समान',
|
31
|
+
filterEqualsString: 'समान',
|
32
|
+
filterFuzzy: 'अस्पष्ट',
|
33
|
+
filterGreaterThan: 'ठुलो भएको',
|
34
|
+
filterGreaterThanOrEqualTo: 'ठुलो वा समान',
|
35
|
+
filterInNumberRange: 'संख्या दायरामा',
|
36
|
+
filterIncludesString: 'समावेश गरिएको',
|
37
|
+
filterIncludesStringSensitive: 'समावेश गरिएको (संवेदनशील)',
|
38
|
+
filterLessThan: 'सानो भएको',
|
39
|
+
filterLessThanOrEqualTo: 'सानो वा समान',
|
40
|
+
filterMode: 'फिल्टर प्रणाली: {filterType}',
|
41
|
+
filterNotEmpty: 'खाली नभएको',
|
42
|
+
filterNotEquals: 'असमान',
|
43
|
+
filterStartsWith: 'सुरुमा समावेश गरिएको',
|
44
|
+
filterWeakEquals: 'असमान',
|
45
|
+
filteringByColumn: '{column} द्वारा फिल्टर गर्दै - {filterType} {filterValue}',
|
46
|
+
goToFirstPage: 'पहिलो पृष्ठमा जानुहोस्',
|
47
|
+
goToLastPage: 'अन्तिम पृष्ठमा जानुहोस्',
|
48
|
+
goToNextPage: 'अर्को पृष्ठमा जानुहोस्',
|
49
|
+
goToPreviousPage: 'अघिल्लो पृष्ठमा जानुहोस्',
|
50
|
+
grab: 'ग्र्याब गर्नुहोस',
|
51
|
+
groupByColumn: '{column} का आधारमा समूह बनाउनुहोस्',
|
52
|
+
groupedBy: 'समूह बनाईएको आधार',
|
53
|
+
hideAll: 'सबै लुकाउनुहोस्',
|
54
|
+
hideColumn: '{column} स्तम्भ लुकाउनुहोस्',
|
55
|
+
max: 'अधिकतम',
|
56
|
+
min: 'न्यूनतम',
|
57
|
+
move: 'सार्नुहोस्',
|
58
|
+
noRecordsToDisplay: 'केही रेकर्ड छैन',
|
59
|
+
noResultsFound: 'कुनै परिणाम फेला परेन',
|
60
|
+
of: ', कुल संख्या: ',
|
61
|
+
or: 'वा',
|
62
|
+
pin: 'पिन गर्नुहोस्',
|
63
|
+
pinToLeft: 'बायाँतर्फ पिन गर्नुहोस्',
|
64
|
+
pinToRight: 'दायाँतर्फ पिन गर्नुहोस्',
|
65
|
+
resetColumnSize: 'स्तम्भ आकार रिसेट गर्नुहोस्',
|
66
|
+
resetOrder: 'क्रम रिसेट गर्नुहोस्',
|
67
|
+
rowActions: 'पंक्तिका कार्यहरू',
|
68
|
+
rowNumber: 'क्र.सं.',
|
69
|
+
rowNumbers: 'क्रमाङ्क',
|
70
|
+
rowsPerPage: 'प्रति पृष्ठ',
|
71
|
+
save: 'सुरक्षित गर्नुहोस्',
|
72
|
+
search: 'खोज्नुहोस्',
|
73
|
+
selectedCountOfRowCountRowsSelected:
|
74
|
+
'{rowCount} पंक्ति(हरू)बाट {selectedCount} चयनित',
|
75
|
+
select: 'चयन गर्नुहोस्',
|
76
|
+
showAll: 'सबै देखाउनुहोस्',
|
77
|
+
showAllColumns: 'सबै स्तम्भ देखाउनुहोस्',
|
78
|
+
showHideColumns: 'स्तम्भ देखाउनुहोस्/लुकाउनुहोस्',
|
79
|
+
showHideFilters: 'फिल्टर देखाउनुहोस्/लुकाउनुहोस्',
|
80
|
+
showHideSearch: 'खोज-क्षेत्र देखाउनुहोस्/लुकाउनुहोस्',
|
81
|
+
sortByColumnAsc: '{column}का आधारमा बढ्दो क्रममा क्रमबद्ध गर्नुहोस्',
|
82
|
+
sortByColumnDesc: '{column}का आधारमा घट्दो क्रममा क्रमबद्ध गर्नुहोस्',
|
83
|
+
sortedByColumnAsc: '{column}का आधारमा बढ्दो क्रममा क्रमबद्ध गरिएको',
|
84
|
+
sortedByColumnDesc: '{column}का आधारमा घट्दो क्रममा क्रमबद्ध गरिएको',
|
85
|
+
thenBy: ', त्यसपछि ',
|
86
|
+
toggleDensity: 'घनत्व परिवर्तन गर्नुहोस्',
|
87
|
+
toggleFullScreen: 'पूर्ण स्क्रिनमा लग्नुहोस्/हटाउनुहोस्',
|
88
|
+
toggleSelectAll: 'सबै चयन गर्नुहोस्/हटाउनुहोस्',
|
89
|
+
toggleSelectRow: 'पंक्ति चयन गर्नुहोस्/हटाउनुहोस्',
|
90
|
+
toggleVisibility: 'दृश्यता परिवर्तन गर्नुहोस्',
|
91
|
+
ungroupByColumn: '{column} का आधारमा समूह हटाउनुहोस्',
|
92
|
+
unpin: 'अनपिन गर्नुहोस्',
|
93
|
+
unpinAll: 'सबै अनपिन गर्नुहोस्'
|
94
|
+
};
|
@@ -36,6 +36,7 @@ export const MRT_ColumnActionMenu = <TData extends Record<string, any>>({
|
|
36
36
|
const {
|
37
37
|
getState,
|
38
38
|
options: {
|
39
|
+
columnFilterDisplayMode,
|
39
40
|
columnFilterModeOptions,
|
40
41
|
enableColumnFilterModes,
|
41
42
|
enableColumnFilters,
|
@@ -217,37 +218,39 @@ export const MRT_ColumnActionMenu = <TData extends Record<string, any>>({
|
|
217
218
|
{localization.clearFilter}
|
218
219
|
</Box>
|
219
220
|
</MenuItem>,
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
<
|
233
|
-
<
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
221
|
+
columnFilterDisplayMode === 'subheader' && (
|
222
|
+
<MenuItem
|
223
|
+
disabled={showColumnFilters && !enableColumnFilterModes}
|
224
|
+
divider={enableGrouping || enableHiding}
|
225
|
+
key={4}
|
226
|
+
onClick={
|
227
|
+
showColumnFilters
|
228
|
+
? handleOpenFilterModeMenu
|
229
|
+
: handleFilterByColumn
|
230
|
+
}
|
231
|
+
sx={commonMenuItemStyles}
|
232
|
+
>
|
233
|
+
<Box sx={commonListItemStyles}>
|
234
|
+
<ListItemIcon>
|
235
|
+
<FilterListIcon />
|
236
|
+
</ListItemIcon>
|
237
|
+
{localization.filterByColumn?.replace(
|
238
|
+
'{column}',
|
239
|
+
String(columnDef.header),
|
240
|
+
)}
|
241
|
+
</Box>
|
242
|
+
{showFilterModeSubMenu && (
|
243
|
+
<IconButton
|
244
|
+
onClick={handleOpenFilterModeMenu}
|
245
|
+
onMouseEnter={handleOpenFilterModeMenu}
|
246
|
+
size="small"
|
247
|
+
sx={{ p: 0 }}
|
248
|
+
>
|
249
|
+
<ArrowRightIcon />
|
250
|
+
</IconButton>
|
238
251
|
)}
|
239
|
-
</
|
240
|
-
|
241
|
-
<IconButton
|
242
|
-
onClick={handleOpenFilterModeMenu}
|
243
|
-
onMouseEnter={handleOpenFilterModeMenu}
|
244
|
-
size="small"
|
245
|
-
sx={{ p: 0 }}
|
246
|
-
>
|
247
|
-
<ArrowRightIcon />
|
248
|
-
</IconButton>
|
249
|
-
)}
|
250
|
-
</MenuItem>,
|
252
|
+
</MenuItem>
|
253
|
+
),
|
251
254
|
showFilterModeSubMenu && (
|
252
255
|
<MRT_FilterOptionMenu
|
253
256
|
anchorEl={filterMenuAnchorEl}
|
@@ -258,7 +261,7 @@ export const MRT_ColumnActionMenu = <TData extends Record<string, any>>({
|
|
258
261
|
table={table}
|
259
262
|
/>
|
260
263
|
),
|
261
|
-
]
|
264
|
+
].filter(Boolean)
|
262
265
|
: []),
|
263
266
|
...(enableGrouping && column.getCanGroup()
|
264
267
|
? [
|
@@ -199,7 +199,7 @@ export const MRT_FilterOptionMenu = <TData extends Record<string, any>>({
|
|
199
199
|
column.setFilterValue(currentFilterValue); // perform new filter render
|
200
200
|
}
|
201
201
|
} else if (
|
202
|
-
columnDef?.filterVariant
|
202
|
+
columnDef?.filterVariant?.includes('range') ||
|
203
203
|
rangeModes.includes(option as MRT_FilterOption)
|
204
204
|
) {
|
205
205
|
// will now be range filter mode
|
@@ -1,14 +1,22 @@
|
|
1
|
-
import
|
2
|
-
import
|
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
|
-
|
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
|
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
|
40
|
-
|
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
|
-
<
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
-
? '
|
67
|
+
? '3rem'
|
101
68
|
: undefined,
|
102
69
|
position: 'relative',
|
70
|
+
px: '4px',
|
71
|
+
py: '12px',
|
103
72
|
zIndex: 2,
|
104
|
-
|
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
@@ -39,12 +39,14 @@ import {
|
|
39
39
|
type VirtualizerOptions,
|
40
40
|
} from '@tanstack/react-virtual';
|
41
41
|
import { type AlertProps } from '@mui/material/Alert';
|
42
|
+
import { type AutocompleteProps } from '@mui/material/Autocomplete';
|
42
43
|
import { type ButtonProps } from '@mui/material/Button';
|
43
44
|
import { type CheckboxProps } from '@mui/material/Checkbox';
|
44
45
|
import { type ChipProps } from '@mui/material/Chip';
|
45
46
|
import { type DialogProps } from '@mui/material/Dialog';
|
46
47
|
import { type IconButtonProps } from '@mui/material/IconButton';
|
47
48
|
import { type LinearProgressProps } from '@mui/material/LinearProgress';
|
49
|
+
import { type PaginationProps } from '@mui/material/Pagination';
|
48
50
|
import { type PaperProps } from '@mui/material/Paper';
|
49
51
|
import { type RadioProps } from '@mui/material/Radio';
|
50
52
|
import { type SkeletonProps } from '@mui/material/Skeleton';
|
@@ -55,10 +57,10 @@ import { type TableCellProps } from '@mui/material/TableCell';
|
|
55
57
|
import { type TableContainerProps } from '@mui/material/TableContainer';
|
56
58
|
import { type TableFooterProps } from '@mui/material/TableFooter';
|
57
59
|
import { type TableHeadProps } from '@mui/material/TableHead';
|
58
|
-
import { type TablePaginationProps } from '@mui/material/TablePagination';
|
59
60
|
import { type TableRowProps } from '@mui/material/TableRow';
|
60
61
|
import { type TextFieldProps } from '@mui/material/TextField';
|
61
62
|
import { type ToolbarProps } from '@mui/material/Toolbar';
|
63
|
+
import { type DatePickerProps } from '@mui/x-date-pickers';
|
62
64
|
import { type MRT_AggregationFns } from './aggregationFns';
|
63
65
|
import { type MRT_FilterFns } from './filterFns';
|
64
66
|
import { type MRT_Icons } from './icons';
|
@@ -406,7 +408,10 @@ export type MRT_ColumnDef<TData extends Record<string, any>> = Omit<
|
|
406
408
|
filterFn?: MRT_FilterFn<TData>;
|
407
409
|
filterSelectOptions?: ({ text: string; value: any } | string)[];
|
408
410
|
filterVariant?:
|
411
|
+
| 'autocomplete'
|
409
412
|
| 'checkbox'
|
413
|
+
| 'date'
|
414
|
+
| 'date-range'
|
410
415
|
| 'multi-select'
|
411
416
|
| 'range'
|
412
417
|
| 'range-slider'
|
@@ -458,12 +463,25 @@ export type MRT_ColumnDef<TData extends Record<string, any>> = Omit<
|
|
458
463
|
table: MRT_TableInstance<TData>;
|
459
464
|
}) => TextFieldProps)
|
460
465
|
| TextFieldProps;
|
466
|
+
muiFilterAutocompleteProps?:
|
467
|
+
| ((props: {
|
468
|
+
column: MRT_Column<TData>;
|
469
|
+
table: MRT_TableInstance<TData>;
|
470
|
+
}) => AutocompleteProps<any, any, any, any>)
|
471
|
+
| AutocompleteProps<any, any, any, any>;
|
461
472
|
muiFilterCheckboxProps?:
|
462
473
|
| ((props: {
|
463
474
|
column: MRT_Column<TData>;
|
464
475
|
table: MRT_TableInstance<TData>;
|
465
476
|
}) => CheckboxProps)
|
466
477
|
| CheckboxProps;
|
478
|
+
muiFilterDatePickerProps?:
|
479
|
+
| ((props: {
|
480
|
+
column: MRT_Column<TData>;
|
481
|
+
rangeFilterIndex?: number;
|
482
|
+
table: MRT_TableInstance<TData>;
|
483
|
+
}) => DatePickerProps<any>)
|
484
|
+
| DatePickerProps<any>;
|
467
485
|
muiFilterSliderProps?:
|
468
486
|
| ((props: {
|
469
487
|
column: MRT_Column<TData>;
|
@@ -782,12 +800,25 @@ export type MRT_TableOptions<TData extends Record<string, any>> = Omit<
|
|
782
800
|
table: MRT_TableInstance<TData>;
|
783
801
|
}) => IconButtonProps)
|
784
802
|
| IconButtonProps;
|
803
|
+
muiFilterAutocompleteProps?:
|
804
|
+
| ((props: {
|
805
|
+
column: MRT_Column<TData>;
|
806
|
+
table: MRT_TableInstance<TData>;
|
807
|
+
}) => AutocompleteProps<any, any, any, any>)
|
808
|
+
| AutocompleteProps<any, any, any, any>;
|
785
809
|
muiFilterCheckboxProps?:
|
786
810
|
| ((props: {
|
787
811
|
column: MRT_Column<TData>;
|
788
812
|
table: MRT_TableInstance<TData>;
|
789
813
|
}) => CheckboxProps)
|
790
814
|
| CheckboxProps;
|
815
|
+
muiFilterDatePickerProps?:
|
816
|
+
| ((props: {
|
817
|
+
column: MRT_Column<TData>;
|
818
|
+
rangeFilterIndex?: number;
|
819
|
+
table: MRT_TableInstance<TData>;
|
820
|
+
}) => DatePickerProps<any>)
|
821
|
+
| DatePickerProps<any>;
|
791
822
|
muiFilterSliderProps?:
|
792
823
|
| ((props: {
|
793
824
|
column: MRT_Column<TData>;
|
@@ -886,10 +917,18 @@ export type MRT_TableOptions<TData extends Record<string, any>> = Omit<
|
|
886
917
|
}) => TableRowProps)
|
887
918
|
| TableRowProps;
|
888
919
|
muiTablePaginationProps?:
|
889
|
-
| ((props: {
|
890
|
-
|
891
|
-
|
892
|
-
|
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
|
+
>;
|
893
932
|
muiTablePaperProps?:
|
894
933
|
| ((props: { table: MRT_TableInstance<TData> }) => PaperProps)
|
895
934
|
| PaperProps;
|