material-react-table 0.8.9 → 0.8.12
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 +29 -15
- package/dist/MaterialReactTable.d.ts +15 -12
- package/dist/localization.d.ts +1 -0
- package/dist/material-react-table.cjs.development.js +185 -176
- 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 +186 -177
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/menus/MRT_ShowHideColumnsMenu.d.ts +1 -1
- package/package.json +14 -14
- package/src/MaterialReactTable.tsx +34 -30
- package/src/body/MRT_TableBodyCell.tsx +20 -18
- package/src/buttons/MRT_CopyButton.tsx +10 -3
- package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +5 -3
- package/src/footer/MRT_TableFooterCell.tsx +11 -7
- package/src/footer/MRT_TableFooterRow.tsx +4 -4
- package/src/head/MRT_DraggableTableHeadCell.tsx +16 -9
- package/src/head/MRT_TableHeadCell.tsx +36 -37
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +3 -1
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +3 -2
- package/src/head/MRT_TableHeadCellSortLabel.tsx +4 -8
- package/src/inputs/MRT_EditCellTextField.tsx +15 -9
- package/src/inputs/MRT_FilterTextField.tsx +14 -9
- package/src/localization.ts +2 -0
- package/src/menus/MRT_ColumnActionMenu.tsx +10 -8
- package/src/menus/MRT_FilterOptionMenu.tsx +11 -7
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +25 -39
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +15 -6
- package/src/table/MRT_TableRoot.tsx +29 -28
package/README.md
CHANGED
|
@@ -1,46 +1,60 @@
|
|
|
1
1
|
# Material React Table
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<a href="https://bundlephobia.com/result?p=material-react-table" target="\_parent">
|
|
4
|
+
<img alt="" src="https://badgen.net/bundlephobia/minzip/material-react-table" />
|
|
5
|
+
</a>
|
|
4
6
|
|
|
5
|
-
-
|
|
7
|
+
<a href="https://npmjs.com/package/material-react-table" target="\_parent">
|
|
8
|
+
<img alt="" src="https://img.shields.io/npm/dm/material-react-table.svg" />
|
|
9
|
+
</a>
|
|
10
|
+
|
|
11
|
+
> This Project is based on `@tanstack/react-table` v8, which itself is still in beta, so therefore this package is also still in alpha/beta
|
|
12
|
+
|
|
13
|
+
- A fully featured Material UI V5 implementation of Tanstack React Table v8 (beta)
|
|
6
14
|
- Inspired by material-table and the MUI X DataGrid
|
|
7
15
|
- Written from the ground up in TypeScript, Material UI, and React Table
|
|
8
16
|
- All internal Material UI components are easily customizable
|
|
9
17
|
|
|
10
|
-
## This project is in alpha, but feel free to install and explore
|
|
18
|
+
## This project is in alpha, but will go into beta _soon<sup>TM</sup>_, so feel free to install and explore
|
|
11
19
|
|
|
12
20
|
View the [docs (alpha) site](https://www.material-react-table.com/)
|
|
13
21
|
|
|
22
|
+
View a basic [example](https://codesandbox.io/s/github/KevinVandy/material-react-table/tree/main/material-react-table-docs/examples/basic/sandbox)
|
|
23
|
+
|
|
14
24
|
View additional [storybook examples](https://www.material-react-table.dev/)
|
|
15
25
|
|
|
16
26
|
View the [github source code](https://github.com/KevinVandy/material-react-table) and [github open issues](https://github.com/KevinVandy/material-react-table/issues)
|
|
17
27
|
|
|
18
28
|
Join the [discord](https://discord.gg/5wqyRx6fnm) server to join in on the development discussion or ask questions
|
|
19
29
|
|
|
20
|
-
### Features (Some
|
|
30
|
+
### Features (Some still being polished, but all are functional!)
|
|
21
31
|
|
|
22
32
|
- [x] Click To Copy Cell Values
|
|
23
33
|
- [x] Column Actions
|
|
24
|
-
- [x] Column Hiding
|
|
25
34
|
- [x] Column Grouping (Group By and Aggregates)
|
|
26
|
-
- [x] Column
|
|
35
|
+
- [x] Column Hiding
|
|
36
|
+
- [x] Column Ordering via Drag'n'Drop (react-dnd)
|
|
27
37
|
- [x] Column Pinning
|
|
28
38
|
- [x] Column Resizing (work in progress)
|
|
29
|
-
- [x]
|
|
30
|
-
- [x]
|
|
31
|
-
- [x] Data Editing
|
|
39
|
+
- [x] Customize Icons
|
|
40
|
+
- [x] Customize Styling of internal Mui Components
|
|
41
|
+
- [x] Data Editing (3 different editing modes)
|
|
32
42
|
- [x] Dense Padding Toggle
|
|
43
|
+
- [x] Detail Panels
|
|
33
44
|
- [x] Filtering and multiple built-in filter modes
|
|
34
|
-
- [x] Fullscreen
|
|
35
|
-
- [x] Global Filtering (Search)
|
|
36
|
-
- [x] HeaderGroups
|
|
37
|
-
- [x] Localization i18n
|
|
45
|
+
- [x] Fullscreen mode
|
|
46
|
+
- [x] Global Filtering (Search across all columns, rank by best match)
|
|
47
|
+
- [x] HeaderGroups & Footers
|
|
48
|
+
- [x] Localization (i18n) support
|
|
49
|
+
- [x] Manage your own state
|
|
38
50
|
- [x] Pagination (supports client-side and server-side)
|
|
51
|
+
- [x] Persistent State
|
|
39
52
|
- [x] Row Actions
|
|
40
|
-
- [x] Row Selection
|
|
53
|
+
- [x] Row Selection (checkboxes)
|
|
41
54
|
- [x] SSR compatible
|
|
42
55
|
- [x] Sorting
|
|
43
|
-
- [x]
|
|
56
|
+
- [x] Theming (Respects your Material UI Theme)
|
|
57
|
+
- [x] Toolbars (Add your own action buttons)
|
|
44
58
|
- [x] Tree Data / Expanding Subrows
|
|
45
59
|
- [ ] Virtualization (planned)
|
|
46
60
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChangeEvent, Dispatch, FC, FocusEvent, MouseEvent, ReactNode, SetStateAction } from 'react';
|
|
2
2
|
import { AlertProps, ButtonProps, CheckboxProps, IconButtonProps, LinearProgressProps, PaperProps, SkeletonProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TextFieldProps, ToolbarProps } from '@mui/material';
|
|
3
|
-
import { Cell, Column, ColumnDef, FilterFn, FilterFnOption, Header, HeaderGroup, Overwrite,
|
|
3
|
+
import { Cell, Column, ColumnDef, FilterFn, FilterFnOption, Header, HeaderGroup, Overwrite, ReactTableGenerics, Row, TableGenerics, TableInstance, TableState, UseTableInstanceOptions, VisibilityState } from '@tanstack/react-table';
|
|
4
4
|
import { MRT_Localization } from './localization';
|
|
5
5
|
import { MRT_Icons } from './icons';
|
|
6
6
|
import { MRT_FILTER_OPTION } from './enums';
|
|
@@ -21,11 +21,13 @@ export interface MRT_RowModel<D extends Record<string, any> = {}> {
|
|
|
21
21
|
}
|
|
22
22
|
export declare type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<TableInstance<Overwrite<Partial<TableGenerics>, {
|
|
23
23
|
Row: D;
|
|
24
|
-
}>>, 'getAllColumns' | 'getAllLeafColumns' | 'getColumn' | 'getExpandedRowModel' | 'getPaginationRowModel' | 'getPrePaginationRowModel' | 'getRowModel' | 'getSelectedRowModel' | 'getState' | 'options'> & {
|
|
24
|
+
}>>, 'getAllColumns' | 'getAllFlatColumns' | 'getAllLeafColumns' | 'getColumn' | 'getExpandedRowModel' | 'getFlatHeaders' | 'getPaginationRowModel' | 'getPrePaginationRowModel' | 'getRowModel' | 'getSelectedRowModel' | 'getState' | 'options'> & {
|
|
25
25
|
getAllColumns: () => MRT_Column<D>[];
|
|
26
|
+
getAllFlatColumns: () => MRT_Column<D>[];
|
|
26
27
|
getAllLeafColumns: () => MRT_Column<D>[];
|
|
27
28
|
getColumn: (columnId: string) => MRT_Column<D>;
|
|
28
29
|
getExpandedRowModel: () => MRT_RowModel<D>;
|
|
30
|
+
getFlatHeaders: () => MRT_Header<D>[];
|
|
29
31
|
getPaginationRowModel: () => MRT_RowModel<D>;
|
|
30
32
|
getPrePaginationRowModel: () => MRT_RowModel<D>;
|
|
31
33
|
getRowModel: () => MRT_RowModel<D>;
|
|
@@ -47,7 +49,7 @@ export declare type MRT_TableInstance<D extends Record<string, any> = {}> = Omit
|
|
|
47
49
|
setShowFilters: Dispatch<SetStateAction<boolean>>;
|
|
48
50
|
setShowGlobalFilter: Dispatch<SetStateAction<boolean>>;
|
|
49
51
|
};
|
|
50
|
-
export declare type MRT_TableState<D extends Record<string, any> = {}> =
|
|
52
|
+
export declare type MRT_TableState<D extends Record<string, any> = {}> = TableState & {
|
|
51
53
|
currentEditingCell: MRT_Cell<D> | null;
|
|
52
54
|
currentEditingRow: MRT_Row<D> | null;
|
|
53
55
|
currentFilterFns: Record<string, string | Function>;
|
|
@@ -55,13 +57,12 @@ export declare type MRT_TableState<D extends Record<string, any> = {}> = Omit<Ta
|
|
|
55
57
|
isDensePadding: boolean;
|
|
56
58
|
isLoading: boolean;
|
|
57
59
|
isFullScreen: boolean;
|
|
58
|
-
pagination: Partial<PaginationState>;
|
|
59
60
|
showFilters: boolean;
|
|
60
61
|
showGlobalFilter: boolean;
|
|
61
62
|
showProgressBars: boolean;
|
|
62
63
|
showSkeletons: boolean;
|
|
63
64
|
};
|
|
64
|
-
export declare type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<ColumnDef<D>, 'header' | 'footer' | 'columns' | 'filterFn'> & {
|
|
65
|
+
export declare type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<ColumnDef<D>, 'accessorFN' | 'header' | 'footer' | 'columns' | 'filterFn'> & {
|
|
65
66
|
Edit?: ({ cell, tableInstance, }: {
|
|
66
67
|
cell: MRT_Cell<D>;
|
|
67
68
|
tableInstance: MRT_TableInstance<D>;
|
|
@@ -70,19 +71,19 @@ export declare type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<Col
|
|
|
70
71
|
header: MRT_Header<D>;
|
|
71
72
|
tableInstance: MRT_TableInstance<D>;
|
|
72
73
|
}) => ReactNode;
|
|
73
|
-
Footer?: ({ footer, tableInstance, }: {
|
|
74
|
+
Footer?: ReactNode | (({ footer, tableInstance, }: {
|
|
74
75
|
footer: MRT_Header<D>;
|
|
75
76
|
tableInstance: MRT_TableInstance<D>;
|
|
76
|
-
}) => ReactNode;
|
|
77
|
-
Header?: ({ header, tableInstance, }: {
|
|
77
|
+
}) => ReactNode);
|
|
78
|
+
Header?: ReactNode | (({ header, tableInstance, }: {
|
|
78
79
|
header: MRT_Header<D>;
|
|
79
80
|
tableInstance: MRT_TableInstance<D>;
|
|
80
|
-
}) => ReactNode;
|
|
81
|
+
}) => ReactNode);
|
|
81
82
|
Cell?: ({ cell, tableInstance, }: {
|
|
82
83
|
cell: MRT_Cell<D>;
|
|
83
84
|
tableInstance: MRT_TableInstance<D>;
|
|
84
85
|
}) => ReactNode;
|
|
85
|
-
|
|
86
|
+
accessorFN?: (row: D) => any;
|
|
86
87
|
columns?: MRT_ColumnDef<D>[];
|
|
87
88
|
enableClickToCopy?: boolean;
|
|
88
89
|
enableColumnActions?: boolean;
|
|
@@ -96,6 +97,7 @@ export declare type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<Col
|
|
|
96
97
|
})[];
|
|
97
98
|
footer?: string;
|
|
98
99
|
header: string;
|
|
100
|
+
id: keyof D | string;
|
|
99
101
|
muiTableBodyCellCopyButtonProps?: ButtonProps | (({ tableInstance, cell, }: {
|
|
100
102
|
tableInstance: MRT_TableInstance;
|
|
101
103
|
cell: MRT_Cell<D>;
|
|
@@ -140,7 +142,7 @@ export declare type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<Col
|
|
|
140
142
|
filterValue: any;
|
|
141
143
|
}) => void;
|
|
142
144
|
};
|
|
143
|
-
export declare type MRT_Column<D extends Record<string, any> = {}> = Omit<Column<D>, 'header' | 'footer' | 'columns'> &
|
|
145
|
+
export declare type MRT_Column<D extends Record<string, any> = {}> = Omit<Column<D>, 'header' | 'footer' | 'columns'> & {
|
|
144
146
|
columns?: MRT_Column<D>[];
|
|
145
147
|
columnDef: MRT_ColumnDef<D>;
|
|
146
148
|
header: string;
|
|
@@ -152,11 +154,12 @@ export declare type MRT_Header<D extends Record<string, any> = {}> = Omit<Header
|
|
|
152
154
|
export declare type MRT_HeaderGroup<D extends Record<string, any> = {}> = Omit<HeaderGroup<D>, 'headers'> & {
|
|
153
155
|
headers: MRT_Header<D>[];
|
|
154
156
|
};
|
|
155
|
-
export declare type MRT_Row<D extends Record<string, any> = {}> = Omit<Row<D>, 'getVisibleCells' | 'getAllCells' | 'subRows' | 'original'> & {
|
|
157
|
+
export declare type MRT_Row<D extends Record<string, any> = {}> = Omit<Row<D>, 'getVisibleCells' | 'getAllCells' | 'subRows' | 'original' | '_valuesCache'> & {
|
|
156
158
|
getAllCells: () => MRT_Cell<D>[];
|
|
157
159
|
getVisibleCells: () => MRT_Cell<D>[];
|
|
158
160
|
subRows?: MRT_Row<D>[];
|
|
159
161
|
original: D;
|
|
162
|
+
_valuesCache?: D;
|
|
160
163
|
};
|
|
161
164
|
export declare type MRT_Cell<D extends Record<string, any> = {}> = Omit<Cell<D>, 'column' | 'row'> & {
|
|
162
165
|
column: MRT_Column<D>;
|