material-react-table 0.26.6 → 0.29.0
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/README.md +7 -8
- package/dist/MaterialReactTable.d.ts +11 -7
- package/dist/column.utils.d.ts +1 -0
- package/dist/inputs/MRT_FilterTextField.d.ts +1 -1
- package/dist/localization.d.ts +9 -0
- package/dist/material-react-table.cjs.development.js +214 -146
- 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 +215 -147
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/menus/MRT_FilterOptionMenu.d.ts +7 -0
- package/package.json +5 -5
- package/src/MaterialReactTable.tsx +15 -7
- package/src/body/MRT_TableBody.tsx +12 -12
- package/src/body/MRT_TableBodyCell.tsx +7 -1
- package/src/buttons/MRT_ExpandAllButton.tsx +1 -0
- package/src/column.utils.ts +13 -0
- package/src/head/MRT_TableHeadCell.tsx +2 -4
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +3 -1
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +8 -3
- package/src/inputs/MRT_FilterRangeFields.tsx +2 -2
- package/src/inputs/MRT_FilterTextField.tsx +124 -84
- package/src/inputs/MRT_SelectCheckbox.tsx +3 -3
- package/src/localization.ts +18 -0
- package/src/menus/MRT_ColumnActionMenu.tsx +2 -2
- package/src/menus/MRT_FilterOptionMenu.tsx +103 -101
- package/src/table/MRT_TableRoot.tsx +2 -1
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# Material React Table
|
|
2
2
|
|
|
3
|
-
<a href="https://npmjs.com/package/material-react-table" target="
|
|
3
|
+
<a href="https://npmjs.com/package/material-react-table" target="_blank">
|
|
4
4
|
<img alt="" src="https://badgen.net/npm/v/material-react-table" />
|
|
5
5
|
</a>
|
|
6
|
-
<a href="https://npmjs.com/package/material-react-table" target="
|
|
6
|
+
<a href="https://npmjs.com/package/material-react-table" target="_blank">
|
|
7
7
|
<img alt="" src="https://img.shields.io/npm/dm/material-react-table.svg" />
|
|
8
8
|
</a>
|
|
9
|
-
<a href="https://bundlephobia.com/result?p=material-react-table" target="
|
|
9
|
+
<a href="https://bundlephobia.com/result?p=material-react-table" target="_blank">
|
|
10
10
|
<img alt="" src="https://badgen.net/bundlephobia/minzip/material-react-table@latest" />
|
|
11
11
|
</a>
|
|
12
|
-
<a href="https://github.com/KevinVandy/material-react-table" target="
|
|
12
|
+
<a href="https://github.com/KevinVandy/material-react-table" target="_blank">
|
|
13
13
|
<img alt="" src="https://img.shields.io/github/stars/KevinVandy/material-react-table.svg?style=social&label=Star" />
|
|
14
14
|
</a>
|
|
15
|
-
<a href="http://makeapullrequest.com" target="
|
|
15
|
+
<a href="http://makeapullrequest.com" target="_blank">
|
|
16
16
|
<img alt="" src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" />
|
|
17
17
|
</a>
|
|
18
18
|
|
|
@@ -40,6 +40,7 @@ See all [Props and Options](https://www.material-react-table.com/docs/api)
|
|
|
40
40
|
- [Basic Table](https://www.material-react-table.com/docs/examples/basic/) (See Default Features)
|
|
41
41
|
- [Minimal Table](https://www.material-react-table.com/docs/examples/minimal/) (Turn off Features)
|
|
42
42
|
- [Advanced Table](https://www.material-react-table.com/docs/examples/advanced/) (See some of the Advanced Features)
|
|
43
|
+
- [Data Export Table](https://www.material-react-table.com/docs/examples/data-export/) (Export to CSV, Excel, etc.)
|
|
43
44
|
- [Remote Data](https://www.material-react-table.com/docs/examples/remote/) (Server-side Pagination, Sorting, and Filtering)
|
|
44
45
|
- [React Query](https://www.material-react-table.com/docs/examples/react-query/) (Server-side Pagination, Sorting, and Filtering)
|
|
45
46
|
- [Virtualized Rows](https://www.material-react-table.com/docs/examples/virtualized/) (20,000 rows at once!)
|
|
@@ -52,7 +53,7 @@ View additional [storybook examples](https://www.material-react-table.dev/)
|
|
|
52
53
|
|
|
53
54
|
_All features can easily be enabled/disabled_
|
|
54
55
|
|
|
55
|
-
- [x] <
|
|
56
|
+
- [x] < 36kb gzipped - [Bundlephobia](https://bundlephobia.com/package/material-react-table)
|
|
56
57
|
- [x] Advanced TypeScript Generics Support (TypeScript Optional)
|
|
57
58
|
- [x] Click To Copy Cell Values
|
|
58
59
|
- [x] Column Action Dropdown Menu
|
|
@@ -134,8 +135,6 @@ export default function App() {
|
|
|
134
135
|
[],
|
|
135
136
|
);
|
|
136
137
|
|
|
137
|
-
//simple data example
|
|
138
|
-
//Check out https://www.material-react-table.com/docs/examples/remote for a more realistic example
|
|
139
138
|
const data = useMemo(
|
|
140
139
|
() => [
|
|
141
140
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChangeEvent, Dispatch, DragEvent, FC, FocusEvent, ReactNode, SetStateAction } from 'react';
|
|
2
2
|
import type { AlertProps, ButtonProps, CheckboxProps, IconButtonProps, LinearProgressProps, PaperProps, SkeletonProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TextFieldProps, ToolbarProps } from '@mui/material';
|
|
3
3
|
import type { Cell, Column, ColumnDef, FilterFn, Header, HeaderGroup, OnChangeFn, Row, SortingFn, Table, TableOptions, TableState } from '@tanstack/react-table';
|
|
4
|
-
import type {
|
|
4
|
+
import type { VirtualizerOptions } from '@tanstack/react-virtual';
|
|
5
5
|
import { MRT_Localization } from './localization';
|
|
6
6
|
import { MRT_Icons } from './icons';
|
|
7
7
|
import { MRT_FilterFns } from './filtersFns';
|
|
@@ -69,7 +69,7 @@ export declare type MRT_TableState<TData extends Record<string, any> = {}> = Tab
|
|
|
69
69
|
showProgressBars: boolean;
|
|
70
70
|
showSkeletons: boolean;
|
|
71
71
|
};
|
|
72
|
-
export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<ColumnDef<TData>, 'accessorFn' | 'accessorKey' | 'aggregatedCell' | 'cell' | 'columns' | 'filterFn' | 'footer' | 'header' | 'id' | 'sortingFn'> & {
|
|
72
|
+
export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<ColumnDef<TData, unknown>, 'accessorFn' | 'accessorKey' | 'aggregatedCell' | 'cell' | 'columns' | 'filterFn' | 'footer' | 'header' | 'id' | 'sortingFn'> & {
|
|
73
73
|
AggregatedCell?: ({ cell, table, }: {
|
|
74
74
|
cell: MRT_Cell<TData>;
|
|
75
75
|
table: MRT_TableInstance<TData>;
|
|
@@ -117,6 +117,7 @@ export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit
|
|
|
117
117
|
* @example columnDefType: 'display'
|
|
118
118
|
*/
|
|
119
119
|
columnDefType?: 'data' | 'display' | 'group';
|
|
120
|
+
columnFilterModeOptions?: MRT_FilterOption[] | null;
|
|
120
121
|
columns?: MRT_ColumnDef<TData>[];
|
|
121
122
|
enableClickToCopy?: boolean;
|
|
122
123
|
enableColumnActions?: boolean;
|
|
@@ -124,12 +125,12 @@ export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit
|
|
|
124
125
|
enableColumnFilterChangeMode?: boolean;
|
|
125
126
|
enableColumnOrdering?: boolean;
|
|
126
127
|
enableEditing?: boolean;
|
|
127
|
-
enabledColumnFilterOptions?: MRT_FilterOption[] | null;
|
|
128
128
|
filterFn?: MRT_FilterFn<TData>;
|
|
129
129
|
filterSelectOptions?: (string | {
|
|
130
130
|
text: string;
|
|
131
131
|
value: string;
|
|
132
132
|
})[];
|
|
133
|
+
filterVariant?: 'text' | 'select' | 'multiSelect' | 'range';
|
|
133
134
|
/**
|
|
134
135
|
* footer must be a string. If you want custom JSX to render the footer, you can also specify a `Footer` option. (Capital F)
|
|
135
136
|
*/
|
|
@@ -172,9 +173,10 @@ export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit
|
|
|
172
173
|
table: MRT_TableInstance<TData>;
|
|
173
174
|
column: MRT_Column<TData>;
|
|
174
175
|
}) => IconButtonProps);
|
|
175
|
-
muiTableHeadCellFilterTextFieldProps?: TextFieldProps | (({ table, column, }: {
|
|
176
|
+
muiTableHeadCellFilterTextFieldProps?: TextFieldProps | (({ table, column, rangeFilterIndex, }: {
|
|
176
177
|
table: MRT_TableInstance<TData>;
|
|
177
178
|
column: MRT_Column<TData>;
|
|
179
|
+
rangeFilterIndex?: number;
|
|
178
180
|
}) => TextFieldProps);
|
|
179
181
|
muiTableHeadCellProps?: TableCellProps | (({ table, column, }: {
|
|
180
182
|
table: MRT_TableInstance<TData>;
|
|
@@ -194,6 +196,7 @@ export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit
|
|
|
194
196
|
};
|
|
195
197
|
export declare type MRT_DefinedColumnDef<TData extends Record<string, any> = {}> = Omit<MRT_ColumnDef<TData>, 'id'> & {
|
|
196
198
|
id: string;
|
|
199
|
+
_filterFn: MRT_FilterOption;
|
|
197
200
|
};
|
|
198
201
|
export declare type MRT_Column<TData extends Record<string, any> = {}> = Omit<Column<TData, unknown>, 'header' | 'footer' | 'columns' | 'columnDef' | 'filterFn'> & {
|
|
199
202
|
columnDef: MRT_DefinedColumnDef<TData>;
|
|
@@ -236,6 +239,7 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
|
236
239
|
displayColumnDefOptions?: Partial<{
|
|
237
240
|
[key in MRT_DisplayColumnIds]: Partial<MRT_ColumnDef>;
|
|
238
241
|
}>;
|
|
242
|
+
columnFilterModeOptions?: (MRT_FilterOption | string)[] | null;
|
|
239
243
|
columns: MRT_ColumnDef<TData>[];
|
|
240
244
|
data: TData[];
|
|
241
245
|
editingMode?: 'table' | 'row' | 'cell';
|
|
@@ -263,7 +267,6 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
|
263
267
|
enableToolbarBottom?: boolean;
|
|
264
268
|
enableToolbarInternalActions?: boolean;
|
|
265
269
|
enableToolbarTop?: boolean;
|
|
266
|
-
enabledColumnFilterOptions?: (MRT_FilterOption | string)[] | null;
|
|
267
270
|
enabledGlobalFilterOptions?: (MRT_FilterOption | string)[] | null;
|
|
268
271
|
expandRowsFn?: (dataRow: TData) => TData[];
|
|
269
272
|
icons?: Partial<MRT_Icons>;
|
|
@@ -343,9 +346,10 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
|
343
346
|
table: MRT_TableInstance<TData>;
|
|
344
347
|
column: MRT_Column<TData>;
|
|
345
348
|
}) => IconButtonProps);
|
|
346
|
-
muiTableHeadCellFilterTextFieldProps?: TextFieldProps | (({ table, column, }: {
|
|
349
|
+
muiTableHeadCellFilterTextFieldProps?: TextFieldProps | (({ table, column, rangeFilterIndex, }: {
|
|
347
350
|
table: MRT_TableInstance<TData>;
|
|
348
351
|
column: MRT_Column<TData>;
|
|
352
|
+
rangeFilterIndex?: number;
|
|
349
353
|
}) => TextFieldProps);
|
|
350
354
|
muiTableHeadCellProps?: TableCellProps | (({ table, column, }: {
|
|
351
355
|
table: MRT_TableInstance<TData>;
|
|
@@ -463,7 +467,7 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
|
463
467
|
selectAllMode?: 'all' | 'page';
|
|
464
468
|
state?: Partial<MRT_TableState<TData>>;
|
|
465
469
|
tableId?: string;
|
|
466
|
-
virtualizerProps?: Partial<VirtualizerOptions<HTMLDivElement>>;
|
|
470
|
+
virtualizerProps?: Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>;
|
|
467
471
|
};
|
|
468
472
|
declare const _default: <TData extends Record<string, any> = {}>({ autoResetExpanded, columnResizeMode, defaultColumn, editingMode, enableColumnActions, enableColumnFilterChangeMode, enableColumnFilters, enableColumnOrdering, enableColumnResizing, enableDensityToggle, enableExpandAll, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableGlobalFilterChangeMode, enableGlobalFilterRankedResults, enableGrouping, enableHiding, enableMultiRowSelection, enableMultiSort, enablePagination, enablePinning, enableRowSelection, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarBottom, enableToolbarInternalActions, enableToolbarTop, icons, localization, positionActionsColumn, positionExpandColumn, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, rowNumberMode, selectAllMode, ...rest }: MaterialReactTableProps<TData>) => JSX.Element;
|
|
469
473
|
export default _default;
|
package/dist/column.utils.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export declare const reorderColumn: <TData extends Record<string, any> = {}>(dra
|
|
|
8
8
|
export declare const getLeadingDisplayColumnIds: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>) => MRT_DisplayColumnIds[];
|
|
9
9
|
export declare const getTrailingDisplayColumnIds: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>) => (string | false | undefined)[];
|
|
10
10
|
export declare const getDefaultColumnOrderIds: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>) => string[];
|
|
11
|
+
export declare const getDefaultColumnFilterFn: <TData extends Record<string, any> = {}>(columnDef: MRT_ColumnDef<TData>) => MRT_FilterOption;
|
package/dist/localization.d.ts
CHANGED
|
@@ -13,6 +13,9 @@ export interface MRT_Localization {
|
|
|
13
13
|
edit: string;
|
|
14
14
|
expand: string;
|
|
15
15
|
expandAll: string;
|
|
16
|
+
filterArrIncludes: string;
|
|
17
|
+
filterArrIncludesAll: string;
|
|
18
|
+
filterArrIncludesSome: string;
|
|
16
19
|
filterBetween: string;
|
|
17
20
|
filterBetweenInclusive: string;
|
|
18
21
|
filterByColumn: string;
|
|
@@ -20,15 +23,20 @@ export interface MRT_Localization {
|
|
|
20
23
|
filterEmpty: string;
|
|
21
24
|
filterEndsWith: string;
|
|
22
25
|
filterEquals: string;
|
|
26
|
+
filterEqualsString: string;
|
|
23
27
|
filterFuzzy: string;
|
|
24
28
|
filterGreaterThan: string;
|
|
25
29
|
filterGreaterThanOrEqualTo: string;
|
|
30
|
+
filterInNumberRange: string;
|
|
31
|
+
filterIncludesString: string;
|
|
32
|
+
filterIncludesStringSensitive: string;
|
|
26
33
|
filterLessThan: string;
|
|
27
34
|
filterLessThanOrEqualTo: string;
|
|
28
35
|
filterMode: string;
|
|
29
36
|
filterNotEmpty: string;
|
|
30
37
|
filterNotEquals: string;
|
|
31
38
|
filterStartsWith: string;
|
|
39
|
+
filterWeakEquals: string;
|
|
32
40
|
filteringByColumn: string;
|
|
33
41
|
grab: string;
|
|
34
42
|
groupByColumn: string;
|
|
@@ -38,6 +46,7 @@ export interface MRT_Localization {
|
|
|
38
46
|
max: string;
|
|
39
47
|
min: string;
|
|
40
48
|
move: string;
|
|
49
|
+
or: string;
|
|
41
50
|
pinToLeft: string;
|
|
42
51
|
pinToRight: string;
|
|
43
52
|
resetColumnSize: string;
|