material-react-table 0.40.5 → 0.40.8
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/MaterialReactTable.d.ts +2 -2
- package/dist/cjs/index.js +17 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/MaterialReactTable.d.ts +2 -2
- package/dist/esm/material-react-table.esm.js +18 -10
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/package.json +4 -4
- package/src/MaterialReactTable.tsx +2 -2
- package/src/body/MRT_TableBody.tsx +4 -1
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +1 -3
- package/src/inputs/MRT_EditCellTextField.tsx +1 -6
- package/src/inputs/MRT_FilterTextField.tsx +11 -3
- package/src/menus/MRT_FilterOptionMenu.tsx +3 -3
- package/src/table/MRT_TableRoot.tsx +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -322,7 +322,7 @@ declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<Column
|
|
|
322
322
|
*
|
|
323
323
|
* @example accessorFn: (row) => row.username
|
|
324
324
|
*/
|
|
325
|
-
accessorFn?: (
|
|
325
|
+
accessorFn?: (originalRow: TData) => any;
|
|
326
326
|
/**
|
|
327
327
|
* Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
|
|
328
328
|
* Specify which key in the row this column should use to access the correct data.
|
|
@@ -503,7 +503,7 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
|
|
|
503
503
|
enableTableHead?: boolean;
|
|
504
504
|
enableToolbarInternalActions?: boolean;
|
|
505
505
|
enableTopToolbar?: boolean;
|
|
506
|
-
|
|
506
|
+
globalFilterModeOptions?: (MRT_FilterOption | string)[] | null;
|
|
507
507
|
expandRowsFn?: (dataRow: TData) => TData[];
|
|
508
508
|
icons?: Partial<MRT_Icons>;
|
|
509
509
|
initialState?: Partial<MRT_TableState<TData>>;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.40.
|
|
2
|
+
"version": "0.40.8",
|
|
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.",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@mui/material": "^5.10.2",
|
|
59
59
|
"@rollup/plugin-babel": "^5.3.1",
|
|
60
60
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
61
|
-
"@rollup/plugin-typescript": "^8.
|
|
61
|
+
"@rollup/plugin-typescript": "^8.4.0",
|
|
62
62
|
"@size-limit/preset-small-lib": "^8.0.1",
|
|
63
63
|
"@storybook/addon-a11y": "^6.5.10",
|
|
64
64
|
"@storybook/addon-actions": "^6.5.10",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@types/react": "^18.0.17",
|
|
72
72
|
"@types/react-dom": "^18.0.6",
|
|
73
73
|
"babel-loader": "^8.2.5",
|
|
74
|
-
"eslint": "^8.
|
|
74
|
+
"eslint": "^8.23.0",
|
|
75
75
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
76
76
|
"husky": "^8.0.1",
|
|
77
77
|
"prettier": "^2.7.1",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"size-limit": "^8.0.1",
|
|
85
85
|
"storybook-dark-mode": "^1.1.0",
|
|
86
86
|
"tslib": "^2.4.0",
|
|
87
|
-
"typescript": "^4.
|
|
87
|
+
"typescript": "^4.8.2"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"@emotion/react": ">=11",
|
|
@@ -236,7 +236,7 @@ export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<
|
|
|
236
236
|
*
|
|
237
237
|
* @example accessorFn: (row) => row.username
|
|
238
238
|
*/
|
|
239
|
-
accessorFn?: (
|
|
239
|
+
accessorFn?: (originalRow: TData) => any;
|
|
240
240
|
/**
|
|
241
241
|
* Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
|
|
242
242
|
* Specify which key in the row this column should use to access the correct data.
|
|
@@ -521,7 +521,7 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
|
521
521
|
enableTableHead?: boolean;
|
|
522
522
|
enableToolbarInternalActions?: boolean;
|
|
523
523
|
enableTopToolbar?: boolean;
|
|
524
|
-
|
|
524
|
+
globalFilterModeOptions?: (MRT_FilterOption | string)[] | null;
|
|
525
525
|
expandRowsFn?: (dataRow: TData) => TData[];
|
|
526
526
|
icons?: Partial<MRT_Icons>;
|
|
527
527
|
initialState?: Partial<MRT_TableState<TData>>;
|
|
@@ -51,7 +51,8 @@ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
|
|
|
51
51
|
rankGlobalFuzzy(a, b),
|
|
52
52
|
);
|
|
53
53
|
if (enablePagination) {
|
|
54
|
-
|
|
54
|
+
const start = pagination.pageIndex * pagination.pageSize;
|
|
55
|
+
return rankedRows.slice(start, start + pagination.pageSize);
|
|
55
56
|
}
|
|
56
57
|
return rankedRows;
|
|
57
58
|
}
|
|
@@ -65,6 +66,8 @@ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
|
|
|
65
66
|
? getPrePaginationRowModel().rows
|
|
66
67
|
: getRowModel().rows,
|
|
67
68
|
globalFilter,
|
|
69
|
+
pagination.pageIndex,
|
|
70
|
+
pagination.pageSize,
|
|
68
71
|
]);
|
|
69
72
|
|
|
70
73
|
const virtualizer = enableRowVirtualization
|
|
@@ -9,13 +9,11 @@ interface Props {
|
|
|
9
9
|
|
|
10
10
|
export const MRT_TableHeadCellFilterLabel: FC<Props> = ({ header, table }) => {
|
|
11
11
|
const {
|
|
12
|
-
getState,
|
|
13
12
|
options: {
|
|
14
13
|
icons: { FilterAltIcon },
|
|
15
14
|
localization,
|
|
16
15
|
},
|
|
17
16
|
} = table;
|
|
18
|
-
const { columnFilterFns } = getState();
|
|
19
17
|
const { column } = header;
|
|
20
18
|
const { columnDef } = column;
|
|
21
19
|
|
|
@@ -24,7 +22,7 @@ export const MRT_TableHeadCellFilterLabel: FC<Props> = ({ header, table }) => {
|
|
|
24
22
|
'betweenInclusive',
|
|
25
23
|
'inNumberRange',
|
|
26
24
|
].includes(columnDef._filterFn);
|
|
27
|
-
const currentFilterOption =
|
|
25
|
+
const currentFilterOption = columnDef._filterFn;
|
|
28
26
|
const filterTooltip = localization.filteringByColumn
|
|
29
27
|
.replace('{column}', String(columnDef.header))
|
|
30
28
|
.replace(
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
ChangeEvent,
|
|
3
|
-
FocusEvent,
|
|
4
|
-
KeyboardEvent,
|
|
5
|
-
useState,
|
|
6
|
-
} from 'react';
|
|
1
|
+
import React, { ChangeEvent, FocusEvent, KeyboardEvent, useState } from 'react';
|
|
7
2
|
import { TextField, TextFieldProps } from '@mui/material';
|
|
8
3
|
import type { MRT_Cell, MRT_TableInstance } from '..';
|
|
9
4
|
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
debounce,
|
|
13
13
|
IconButton,
|
|
14
14
|
InputAdornment,
|
|
15
|
-
ListItemText,
|
|
16
15
|
MenuItem,
|
|
17
16
|
TextField,
|
|
18
17
|
TextFieldProps,
|
|
@@ -323,7 +322,16 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
|
323
322
|
text = option.text;
|
|
324
323
|
}
|
|
325
324
|
return (
|
|
326
|
-
<MenuItem
|
|
325
|
+
<MenuItem
|
|
326
|
+
key={value}
|
|
327
|
+
sx={{
|
|
328
|
+
display: 'flex',
|
|
329
|
+
m: 0,
|
|
330
|
+
alignItems: 'center',
|
|
331
|
+
gap: '0.5rem',
|
|
332
|
+
}}
|
|
333
|
+
value={value}
|
|
334
|
+
>
|
|
327
335
|
{isMultiSelectFilter && (
|
|
328
336
|
<Checkbox
|
|
329
337
|
checked={(
|
|
@@ -332,7 +340,7 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
|
332
340
|
sx={{ mr: '0.5rem' }}
|
|
333
341
|
/>
|
|
334
342
|
)}
|
|
335
|
-
|
|
343
|
+
{text}
|
|
336
344
|
</MenuItem>
|
|
337
345
|
);
|
|
338
346
|
},
|
|
@@ -115,8 +115,8 @@ export const MRT_FilterOptionMenu = <TData extends Record<string, any> = {}>({
|
|
|
115
115
|
const {
|
|
116
116
|
getState,
|
|
117
117
|
options: {
|
|
118
|
-
enabledGlobalFilterOptions,
|
|
119
118
|
columnFilterModeOptions,
|
|
119
|
+
globalFilterModeOptions,
|
|
120
120
|
localization,
|
|
121
121
|
renderColumnFilterModeMenuItems,
|
|
122
122
|
renderGlobalFilterModeMenuItems,
|
|
@@ -137,8 +137,8 @@ export const MRT_FilterOptionMenu = <TData extends Record<string, any> = {}>({
|
|
|
137
137
|
columnDef
|
|
138
138
|
? allowedColumnFilterOptions === undefined ||
|
|
139
139
|
allowedColumnFilterOptions?.includes(filterOption.option)
|
|
140
|
-
: (!
|
|
141
|
-
|
|
140
|
+
: (!globalFilterModeOptions ||
|
|
141
|
+
globalFilterModeOptions.includes(filterOption.option)) &&
|
|
142
142
|
['fuzzy', 'contains', 'startsWith'].includes(filterOption.option),
|
|
143
143
|
),
|
|
144
144
|
[],
|
|
@@ -189,6 +189,7 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
189
189
|
props.displayColumnDefOptions,
|
|
190
190
|
props.editingMode,
|
|
191
191
|
props.enableColumnDragging,
|
|
192
|
+
props.enableColumnFilterModes,
|
|
192
193
|
props.enableColumnOrdering,
|
|
193
194
|
props.enableEditing,
|
|
194
195
|
props.enableExpandAll,
|