material-react-table 0.26.4 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +7 -8
- package/dist/MaterialReactTable.d.ts +3 -3
- package/dist/material-react-table.cjs.development.js +243 -241
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +244 -242
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/toolbar/MRT_ToolbarTop.d.ts +1 -0
- package/package.json +3 -3
- package/src/MaterialReactTable.tsx +5 -5
- package/src/body/MRT_TableBodyCell.tsx +7 -1
- package/src/buttons/MRT_ExpandAllButton.tsx +1 -0
- package/src/head/MRT_TableHeadCell.tsx +2 -4
- package/src/inputs/MRT_FilterTextField.tsx +2 -3
- package/src/inputs/MRT_SelectCheckbox.tsx +3 -3
- package/src/menus/MRT_ColumnActionMenu.tsx +2 -2
- package/src/menus/MRT_FilterOptionMenu.tsx +2 -2
- package/src/toolbar/MRT_ToolbarBottom.tsx +1 -4
- package/src/toolbar/MRT_ToolbarTop.tsx +6 -7
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "0.
|
2
|
+
"version": "0.27.0",
|
3
3
|
"license": "MIT",
|
4
4
|
"name": "material-react-table",
|
5
5
|
"description": "A fully featured Material UI implementation of TanStack React Table, inspired by material-table and the MUI X DataGrid, written from the ground up in TypeScript.",
|
@@ -57,12 +57,12 @@
|
|
57
57
|
}
|
58
58
|
],
|
59
59
|
"devDependencies": {
|
60
|
-
"@babel/core": "^7.18.
|
60
|
+
"@babel/core": "^7.18.9",
|
61
61
|
"@emotion/react": "^11.9.3",
|
62
62
|
"@emotion/styled": "^11.9.3",
|
63
63
|
"@faker-js/faker": "^7.3.0",
|
64
64
|
"@mui/icons-material": "^5.8.4",
|
65
|
-
"@mui/material": "^5.9.
|
65
|
+
"@mui/material": "^5.9.1",
|
66
66
|
"@size-limit/preset-small-lib": "^7.0.8",
|
67
67
|
"@storybook/addon-a11y": "^6.5.9",
|
68
68
|
"@storybook/addon-actions": "^6.5.9",
|
@@ -134,7 +134,7 @@ export type MRT_TableState<TData extends Record<string, any> = {}> =
|
|
134
134
|
};
|
135
135
|
|
136
136
|
export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<
|
137
|
-
ColumnDef<TData>,
|
137
|
+
ColumnDef<TData, unknown>,
|
138
138
|
| 'accessorFn'
|
139
139
|
| 'accessorKey'
|
140
140
|
| 'aggregatedCell'
|
@@ -215,6 +215,7 @@ export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<
|
|
215
215
|
* @example columnDefType: 'display'
|
216
216
|
*/
|
217
217
|
columnDefType?: 'data' | 'display' | 'group';
|
218
|
+
columnFilterModeOptions?: MRT_FilterOption[] | null;
|
218
219
|
columns?: MRT_ColumnDef<TData>[];
|
219
220
|
enableClickToCopy?: boolean;
|
220
221
|
enableColumnActions?: boolean;
|
@@ -222,7 +223,6 @@ export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<
|
|
222
223
|
enableColumnFilterChangeMode?: boolean;
|
223
224
|
enableColumnOrdering?: boolean;
|
224
225
|
enableEditing?: boolean;
|
225
|
-
enabledColumnFilterOptions?: MRT_FilterOption[] | null;
|
226
226
|
filterFn?: MRT_FilterFn<TData>;
|
227
227
|
filterSelectOptions?: (string | { text: string; value: string })[];
|
228
228
|
/**
|
@@ -422,6 +422,7 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
422
422
|
displayColumnDefOptions?: Partial<{
|
423
423
|
[key in MRT_DisplayColumnIds]: Partial<MRT_ColumnDef>;
|
424
424
|
}>;
|
425
|
+
columnFilterModeOptions?: (MRT_FilterOption | string)[] | null;
|
425
426
|
columns: MRT_ColumnDef<TData>[];
|
426
427
|
data: TData[];
|
427
428
|
editingMode?: 'table' | 'row' | 'cell';
|
@@ -449,7 +450,6 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
449
450
|
enableToolbarBottom?: boolean;
|
450
451
|
enableToolbarInternalActions?: boolean;
|
451
452
|
enableToolbarTop?: boolean;
|
452
|
-
enabledColumnFilterOptions?: (MRT_FilterOption | string)[] | null;
|
453
453
|
enabledGlobalFilterOptions?: (MRT_FilterOption | string)[] | null;
|
454
454
|
expandRowsFn?: (dataRow: TData) => TData[];
|
455
455
|
icons?: Partial<MRT_Icons>;
|
@@ -788,7 +788,7 @@ export default <TData extends Record<string, any> = {}>({
|
|
788
788
|
defaultColumn = { minSize: 40, maxSize: 1000, size: 180 },
|
789
789
|
editingMode = 'row',
|
790
790
|
enableColumnActions = true,
|
791
|
-
enableColumnFilterChangeMode =
|
791
|
+
enableColumnFilterChangeMode = false,
|
792
792
|
enableColumnFilters = true,
|
793
793
|
enableColumnOrdering = false,
|
794
794
|
enableColumnResizing = false,
|
@@ -797,7 +797,7 @@ export default <TData extends Record<string, any> = {}>({
|
|
797
797
|
enableFilters = true,
|
798
798
|
enableFullScreenToggle = true,
|
799
799
|
enableGlobalFilter = true,
|
800
|
-
enableGlobalFilterChangeMode =
|
800
|
+
enableGlobalFilterChangeMode = false,
|
801
801
|
enableGlobalFilterRankedResults = true,
|
802
802
|
enableGrouping = false,
|
803
803
|
enableHiding = true,
|
@@ -35,6 +35,7 @@ export const MRT_TableBodyCell: FC<Props> = ({
|
|
35
35
|
enableClickToCopy,
|
36
36
|
enableColumnOrdering,
|
37
37
|
enableEditing,
|
38
|
+
enablePagination,
|
38
39
|
enableRowNumbers,
|
39
40
|
muiTableBodyCellProps,
|
40
41
|
muiTableBodyCellSkeletonProps,
|
@@ -147,7 +148,12 @@ export const MRT_TableBodyCell: FC<Props> = ({
|
|
147
148
|
borderLeft: draggingBorder,
|
148
149
|
borderRight: draggingBorder,
|
149
150
|
borderBottom:
|
150
|
-
row.index ===
|
151
|
+
row.index ===
|
152
|
+
(enablePagination
|
153
|
+
? table.getRowModel()
|
154
|
+
: table.getPrePaginationRowModel()
|
155
|
+
).rows.length -
|
156
|
+
1
|
151
157
|
? draggingBorder
|
152
158
|
: undefined,
|
153
159
|
}
|
@@ -43,6 +43,7 @@ export const MRT_ExpandAllButton: FC<Props> = ({ table }) => {
|
|
43
43
|
sx={{
|
44
44
|
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
45
45
|
width: density === 'compact' ? '1.75rem' : '2.25rem',
|
46
|
+
mt: density !== 'compact' ? '-0.25rem' : undefined,
|
46
47
|
...iconButtonProps?.sx,
|
47
48
|
}}
|
48
49
|
>
|
@@ -128,12 +128,10 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
|
|
128
128
|
: 1,
|
129
129
|
p:
|
130
130
|
density === 'compact'
|
131
|
-
?
|
132
|
-
? '0 0.5rem'
|
133
|
-
: '0.5rem'
|
131
|
+
? '0.5rem'
|
134
132
|
: density === 'comfortable'
|
135
133
|
? columnDefType === 'display'
|
136
|
-
? '0.
|
134
|
+
? '0.75rem'
|
137
135
|
: '1rem'
|
138
136
|
: columnDefType === 'display'
|
139
137
|
? '1rem 1.25rem'
|
@@ -33,7 +33,7 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
33
33
|
getState,
|
34
34
|
options: {
|
35
35
|
enableColumnFilterChangeMode,
|
36
|
-
|
36
|
+
columnFilterModeOptions,
|
37
37
|
icons: { FilterListIcon, CloseIcon },
|
38
38
|
localization,
|
39
39
|
muiTableHeadCellFilterTextFieldProps,
|
@@ -152,7 +152,7 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
152
152
|
: '';
|
153
153
|
|
154
154
|
const allowedColumnFilterOptions =
|
155
|
-
columnDef?.
|
155
|
+
columnDef?.columnFilterModeOptions ?? columnFilterModeOptions;
|
156
156
|
|
157
157
|
const showChangeModeButton =
|
158
158
|
enableColumnFilterChangeMode &&
|
@@ -260,7 +260,6 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
260
260
|
}}
|
261
261
|
{...textFieldProps}
|
262
262
|
sx={(theme) => ({
|
263
|
-
m: '-0.25rem',
|
264
263
|
p: 0,
|
265
264
|
minWidth: !filterChipLabel ? '8rem' : 'auto',
|
266
265
|
width: 'calc(100% + 0.5rem)',
|
@@ -59,9 +59,9 @@ export const MRT_SelectCheckbox: FC<Props> = ({ row, selectAll, table }) => {
|
|
59
59
|
size={density === 'compact' ? 'small' : 'medium'}
|
60
60
|
{...checkboxProps}
|
61
61
|
sx={(theme) => ({
|
62
|
-
height: density === 'compact' ? '1.
|
63
|
-
width: density === 'compact' ? '1.
|
64
|
-
m: '-
|
62
|
+
height: density === 'compact' ? '1.75rem' : '2.5rem',
|
63
|
+
width: density === 'compact' ? '1.75rem' : '2.5rem',
|
64
|
+
m: density !== 'compact' ? '-0.4rem' : undefined,
|
65
65
|
...(checkboxProps?.sx instanceof Function
|
66
66
|
? checkboxProps.sx(theme)
|
67
67
|
: (checkboxProps?.sx as any)),
|
@@ -41,7 +41,7 @@ export const MRT_ColumnActionMenu: FC<Props> = ({
|
|
41
41
|
enableHiding,
|
42
42
|
enablePinning,
|
43
43
|
enableSorting,
|
44
|
-
|
44
|
+
columnFilterModeOptions,
|
45
45
|
icons: {
|
46
46
|
ArrowRightIcon,
|
47
47
|
ClearAllIcon,
|
@@ -145,7 +145,7 @@ export const MRT_ColumnActionMenu: FC<Props> = ({
|
|
145
145
|
const isSelectFilter = !!columnDef.filterSelectOptions;
|
146
146
|
|
147
147
|
const allowedColumnFilterOptions =
|
148
|
-
columnDef?.
|
148
|
+
columnDef?.columnFilterModeOptions ?? columnFilterModeOptions;
|
149
149
|
|
150
150
|
const showFilterModeSubMenu =
|
151
151
|
enableColumnFilterChangeMode &&
|
@@ -21,7 +21,7 @@ export const MRT_FilterOptionMenu: FC<Props> = ({
|
|
21
21
|
getState,
|
22
22
|
options: {
|
23
23
|
enabledGlobalFilterOptions,
|
24
|
-
|
24
|
+
columnFilterModeOptions,
|
25
25
|
localization,
|
26
26
|
},
|
27
27
|
setCurrentFilterFns,
|
@@ -32,7 +32,7 @@ export const MRT_FilterOptionMenu: FC<Props> = ({
|
|
32
32
|
const { columnDef } = column ?? {};
|
33
33
|
|
34
34
|
const allowedColumnFilterOptions =
|
35
|
-
columnDef?.
|
35
|
+
columnDef?.columnFilterModeOptions ?? columnFilterModeOptions;
|
36
36
|
|
37
37
|
const filterOptions = useMemo(
|
38
38
|
() =>
|
@@ -31,10 +31,7 @@ export const MRT_ToolbarBottom: FC<Props> = ({ table }) => {
|
|
31
31
|
? muiTableToolbarBottomProps({ table })
|
32
32
|
: muiTableToolbarBottomProps;
|
33
33
|
|
34
|
-
const stackAlertBanner =
|
35
|
-
isMobile ||
|
36
|
-
(positionToolbarAlertBanner === 'bottom' &&
|
37
|
-
!!renderToolbarBottomCustomActions);
|
34
|
+
const stackAlertBanner = isMobile || !!renderToolbarBottomCustomActions;
|
38
35
|
|
39
36
|
return (
|
40
37
|
<Toolbar
|
@@ -1,13 +1,14 @@
|
|
1
1
|
import React, { FC } from 'react';
|
2
2
|
import { Box, lighten, Theme, Toolbar, useMediaQuery } from '@mui/material';
|
3
|
-
import {
|
4
|
-
import { MRT_TablePagination } from './MRT_TablePagination';
|
5
|
-
import { MRT_ToolbarAlertBanner } from './MRT_ToolbarAlertBanner';
|
3
|
+
import { MRT_GlobalFilterTextField } from '../inputs/MRT_GlobalFilterTextField';
|
6
4
|
import { MRT_LinearProgressBar } from './MRT_LinearProgressBar';
|
7
5
|
import { MRT_TableInstance } from '..';
|
8
|
-
import {
|
6
|
+
import { MRT_TablePagination } from './MRT_TablePagination';
|
7
|
+
import { MRT_ToolbarAlertBanner } from './MRT_ToolbarAlertBanner';
|
8
|
+
import { MRT_ToolbarInternalButtons } from './MRT_ToolbarInternalButtons';
|
9
9
|
|
10
10
|
export const commonToolbarStyles = ({ theme }: { theme: Theme }) => ({
|
11
|
+
alignItems: 'flex-start',
|
11
12
|
backgroundColor: lighten(theme.palette.background.default, 0.04),
|
12
13
|
backgroundImage: 'none',
|
13
14
|
display: 'grid',
|
@@ -48,9 +49,7 @@ export const MRT_ToolbarTop: FC<Props> = ({ table }) => {
|
|
48
49
|
: muiTableToolbarTopProps;
|
49
50
|
|
50
51
|
const stackAlertBanner =
|
51
|
-
isMobile ||
|
52
|
-
(positionToolbarAlertBanner === 'top' &&
|
53
|
-
(!!renderToolbarTopCustomActions || showGlobalFilter));
|
52
|
+
isMobile || !!renderToolbarTopCustomActions || showGlobalFilter;
|
54
53
|
|
55
54
|
return (
|
56
55
|
<Toolbar
|