material-react-table 0.7.0 → 0.7.3

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 CHANGED
@@ -30,9 +30,9 @@ Join the [discord](https://discord.gg/5wqyRx6fnm) server to join in on the devel
30
30
  - [x] Custom Styling and internal Mui Components
31
31
  - [x] Data Editing
32
32
  - [x] Dense Padding Toggle
33
- - [x] Filtering
33
+ - [x] Filtering and multiple built-in filter modes
34
34
  - [x] Fullscreen
35
- - [ ] Global Search (broken in react-table v8 :( ))
35
+ - [x] Global Filtering (Search)
36
36
  - [x] HeaderGroups
37
37
  - [x] Localization i18n
38
38
  - [x] Pagination (supports client-side and server-side)
@@ -5,7 +5,7 @@ import { MRT_Localization } from './localization';
5
5
  import { MRT_Icons } from './icons';
6
6
  import { MRT_FILTER_TYPE } from './enums';
7
7
  export declare type MRT_TableOptions<D extends Record<string, any> = {}> = Partial<Omit<Options<D>, 'columns' | 'data' | 'initialState' | 'state' | 'expandRowsFn'>> & {
8
- columns: MRT_ColumnInterface<D>[];
8
+ columns: MRT_ColumnDef<D>[];
9
9
  data: D[];
10
10
  initialState?: Partial<MRT_TableState<D>>;
11
11
  state?: Partial<MRT_TableState<D>>;
@@ -21,8 +21,8 @@ export interface MRT_RowModel<D extends Record<string, any> = {}> {
21
21
  export declare type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<TableInstance<Overwrite<Partial<DefaultGenerics>, {
22
22
  Row: D;
23
23
  }>>, 'getAllColumns' | 'getAllLeafColumns' | 'getExpandedRowModel' | 'getPaginationRowModel' | 'getPrePaginationRowModel' | 'getRowModel' | 'getSelectedRowModel' | 'getState' | 'options'> & {
24
- getAllColumns: () => MRT_ColumnInstance<D>[];
25
- getAllLeafColumns: () => MRT_ColumnInstance<D>[];
24
+ getAllColumns: () => MRT_Column<D>[];
25
+ getAllLeafColumns: () => MRT_Column<D>[];
26
26
  getExpandedRowModel: () => MRT_RowModel<D>;
27
27
  getPaginationRowModel: () => MRT_RowModel<D>;
28
28
  getPrePaginationRowModel: () => MRT_RowModel<D>;
@@ -37,6 +37,7 @@ export declare type MRT_TableInstance<D extends Record<string, any> = {}> = Omit
37
37
  };
38
38
  localization: MRT_Localization;
39
39
  };
40
+ setCurrentEditingCell: Dispatch<SetStateAction<MRT_Cell<D> | null>>;
40
41
  setCurrentEditingRow: Dispatch<SetStateAction<MRT_Row<D> | null>>;
41
42
  setCurrentFilterTypes: Dispatch<SetStateAction<{
42
43
  [key: string]: MRT_FilterType;
@@ -48,6 +49,7 @@ export declare type MRT_TableInstance<D extends Record<string, any> = {}> = Omit
48
49
  setShowGlobalFilter: Dispatch<SetStateAction<boolean>>;
49
50
  };
50
51
  export declare type MRT_TableState<D extends Record<string, any> = {}> = Omit<TableState, 'pagination'> & {
52
+ currentEditingCell: MRT_Cell<D> | null;
51
53
  currentEditingRow: MRT_Row<D> | null;
52
54
  currentFilterTypes: Record<string, string | Function>;
53
55
  currentGlobalFilterType: Record<string, string | Function>;
@@ -57,7 +59,7 @@ export declare type MRT_TableState<D extends Record<string, any> = {}> = Omit<Ta
57
59
  showGlobalFilter: boolean;
58
60
  pagination: Partial<PaginationState>;
59
61
  };
60
- export declare type MRT_ColumnInterface<D extends Record<string, any> = {}> = Omit<ColumnDef<D>, 'header' | 'footer' | 'columns'> & {
62
+ export declare type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<ColumnDef<D>, 'header' | 'footer' | 'columns'> & {
61
63
  Edit?: ({ cell, tableInstance, }: {
62
64
  cell: MRT_Cell<D>;
63
65
  tableInstance: MRT_TableInstance<D>;
@@ -79,11 +81,11 @@ export declare type MRT_ColumnInterface<D extends Record<string, any> = {}> = Om
79
81
  tableInstance: MRT_TableInstance<D>;
80
82
  }) => ReactNode;
81
83
  id: keyof D | string;
82
- columns?: MRT_ColumnInterface<D>[];
84
+ columns?: MRT_ColumnDef<D>[];
83
85
  enableClickToCopy?: boolean;
84
86
  enableColumnActions?: boolean;
85
87
  enableEditing?: boolean;
86
- enabledFilterTypes?: (MRT_FILTER_TYPE | string)[];
88
+ enabledColumnFilterTypes?: (MRT_FILTER_TYPE | string)[];
87
89
  filter?: MRT_FilterType | string | FilterType<D>;
88
90
  filterSelectOptions?: (string | {
89
91
  text: string;
@@ -105,19 +107,19 @@ export declare type MRT_ColumnInterface<D extends Record<string, any> = {}> = Om
105
107
  }) => TableCellProps);
106
108
  muiTableFooterCellProps?: TableCellProps | (({ tableInstance, column, }: {
107
109
  tableInstance: MRT_TableInstance;
108
- column: MRT_ColumnInstance<D>;
110
+ column: MRT_Column<D>;
109
111
  }) => TableCellProps);
110
112
  muiTableHeadCellColumnActionsButtonProps?: IconButtonProps | (({ tableInstance, column, }: {
111
113
  tableInstance: MRT_TableInstance;
112
- column: MRT_ColumnInstance<D>;
114
+ column: MRT_Column<D>;
113
115
  }) => IconButtonProps);
114
116
  muiTableHeadCellFilterTextFieldProps?: TextFieldProps | (({ tableInstance, column, }: {
115
117
  tableInstance: MRT_TableInstance;
116
- column: MRT_ColumnInstance<D>;
118
+ column: MRT_Column<D>;
117
119
  }) => TextFieldProps);
118
120
  muiTableHeadCellProps?: TableCellProps | (({ tableInstance, column, }: {
119
121
  tableInstance: MRT_TableInstance;
120
- column: MRT_ColumnInstance<D>;
122
+ column: MRT_Column<D>;
121
123
  }) => TableCellProps);
122
124
  onCellEditBlur?: ({ cell, event, tableInstance, }: {
123
125
  event: FocusEvent<HTMLInputElement>;
@@ -129,16 +131,17 @@ export declare type MRT_ColumnInterface<D extends Record<string, any> = {}> = Om
129
131
  cell: MRT_Cell<D>;
130
132
  tableInstance: MRT_TableInstance<D>;
131
133
  }) => void;
132
- onColumnFilterValueChange?: ({ event, filterValue, }: {
134
+ onColumnFilterValueChange?: ({ column, event, filterValue, }: {
135
+ column: MRT_Column<D>;
133
136
  event: ChangeEvent<HTMLInputElement>;
134
137
  filterValue: any;
135
138
  }) => void;
136
139
  };
137
- export declare type MRT_ColumnInstance<D extends Record<string, any> = {}> = Omit<Column<D>, 'header' | 'footer' | 'columns'> & MRT_ColumnInterface<D> & {
138
- columns?: MRT_ColumnInstance<D>[];
140
+ export declare type MRT_Column<D extends Record<string, any> = {}> = Omit<Column<D>, 'header' | 'footer' | 'columns'> & MRT_ColumnDef<D> & {
141
+ columns?: MRT_Column<D>[];
139
142
  };
140
143
  export declare type MRT_Header<D extends Record<string, any> = {}> = Omit<Header<D>, 'column'> & {
141
- column: MRT_ColumnInstance<D>;
144
+ column: MRT_Column<D>;
142
145
  };
143
146
  export declare type MRT_HeaderGroup<D extends Record<string, any> = {}> = Omit<HeaderGroup<D>, 'headers'> & {
144
147
  headers: MRT_Header<D>[];
@@ -153,11 +156,12 @@ export declare type MRT_Row<D extends Record<string, any> = {}> = Omit<Row<D>, '
153
156
  original: D;
154
157
  };
155
158
  export declare type MRT_Cell<D extends Record<string, any> = {}> = Omit<Cell<D>, 'column' | 'row'> & {
156
- column: MRT_ColumnInstance<D>;
159
+ column: MRT_Column<D>;
157
160
  row: MRT_Row<D>;
158
161
  };
159
162
  export declare type MRT_FilterType = MRT_FILTER_TYPE | Function;
160
163
  export declare type MaterialReactTableProps<D extends Record<string, any> = {}> = MRT_TableOptions<D> & {
164
+ editingMode?: 'table' | 'row' | 'cell';
161
165
  enableClickToCopy?: boolean;
162
166
  enableColumnActions?: boolean;
163
167
  enableDensePaddingToggle?: boolean;
@@ -169,15 +173,15 @@ export declare type MaterialReactTableProps<D extends Record<string, any> = {}>
169
173
  enableRowNumbers?: boolean;
170
174
  enableSelectAll?: boolean;
171
175
  enableStickyHeader?: boolean;
176
+ enableTableFooter?: boolean;
177
+ enableTableHead?: boolean;
178
+ enableToolbarBottom?: boolean;
179
+ enableToolbarInternalActions?: boolean;
180
+ enableToolbarTop?: boolean;
172
181
  enabledGlobalFilterTypes?: (MRT_FILTER_TYPE | string)[];
173
182
  filterTypes?: {
174
183
  [key in MRT_FILTER_TYPE]: any;
175
184
  };
176
- hideTableFooter?: boolean;
177
- hideTableHead?: boolean;
178
- hideToolbarBottom?: boolean;
179
- hideToolbarInternalActions?: boolean;
180
- hideToolbarTop?: boolean;
181
185
  icons?: Partial<MRT_Icons>;
182
186
  idPrefix?: string;
183
187
  isLoading?: boolean;
@@ -226,7 +230,7 @@ export declare type MaterialReactTableProps<D extends Record<string, any> = {}>
226
230
  }) => TableCellProps);
227
231
  muiTableFooterCellProps?: TableCellProps | (({ tableInstance, column, }: {
228
232
  tableInstance: MRT_TableInstance;
229
- column: MRT_ColumnInstance<D>;
233
+ column: MRT_Column<D>;
230
234
  }) => TableCellProps);
231
235
  muiTableFooterProps?: TableFooterProps | (({ tableInstance, }: {
232
236
  tableInstance: MRT_TableInstance;
@@ -237,15 +241,15 @@ export declare type MaterialReactTableProps<D extends Record<string, any> = {}>
237
241
  }) => TableRowProps);
238
242
  muiTableHeadCellColumnActionsButtonProps?: IconButtonProps | (({ tableInstance, column, }: {
239
243
  tableInstance: MRT_TableInstance;
240
- column: MRT_ColumnInstance<D>;
244
+ column: MRT_Column<D>;
241
245
  }) => IconButtonProps);
242
246
  muiTableHeadCellFilterTextFieldProps?: TextFieldProps | (({ tableInstance, column, }: {
243
247
  tableInstance: MRT_TableInstance;
244
- column: MRT_ColumnInstance<D>;
248
+ column: MRT_Column<D>;
245
249
  }) => TextFieldProps);
246
250
  muiTableHeadCellProps?: TableCellProps | (({ tableInstance, column, }: {
247
251
  tableInstance: MRT_TableInstance;
248
- column: MRT_ColumnInstance<D>;
252
+ column: MRT_Column<D>;
249
253
  }) => TableCellProps);
250
254
  muiTableHeadProps?: TableHeadProps | (({ tableInstance, }: {
251
255
  tableInstance: MRT_TableInstance;
@@ -277,6 +281,21 @@ export declare type MaterialReactTableProps<D extends Record<string, any> = {}>
277
281
  tableInstance: MRT_TableInstance<D>;
278
282
  event: MouseEvent<HTMLTableCellElement>;
279
283
  }) => void;
284
+ onCellEditBlur?: ({ cell, event, tableInstance, }: {
285
+ event: FocusEvent<HTMLInputElement>;
286
+ cell: MRT_Cell<D>;
287
+ tableInstance: MRT_TableInstance<D>;
288
+ }) => void;
289
+ onCellEditChange?: ({ cell, event, tableInstance, }: {
290
+ event: ChangeEvent<HTMLInputElement>;
291
+ cell: MRT_Cell<D>;
292
+ tableInstance: MRT_TableInstance<D>;
293
+ }) => void;
294
+ onColumnFilterValueChange?: ({ column, event, filterValue, }: {
295
+ column: MRT_Column<D>;
296
+ event: ChangeEvent<HTMLInputElement>;
297
+ filterValue: any;
298
+ }) => void;
280
299
  onDetailPanelClick?: ({ event, row, tableInstance, }: {
281
300
  event: MouseEvent<HTMLTableCellElement>;
282
301
  row: MRT_Row<D>;
@@ -312,7 +331,7 @@ export declare type MaterialReactTableProps<D extends Record<string, any> = {}>
312
331
  tableInstance: MRT_TableInstance<D>;
313
332
  }) => void;
314
333
  onToggleColumnVisibility?: ({ column, columnVisibility, tableInstance, }: {
315
- column: MRT_ColumnInstance<D>;
334
+ column: MRT_Column<D>;
316
335
  columnVisibility: VisibilityState;
317
336
  tableInstance: MRT_TableInstance<D>;
318
337
  }) => void;
@@ -375,5 +394,5 @@ export declare type MaterialReactTableProps<D extends Record<string, any> = {}>
375
394
  }>;
376
395
  }) => ReactNode;
377
396
  };
378
- declare const _default: <D extends Record<string, any> = {}>({ autoResetExpanded, enableColumnActions, enableColumnFilters, enableDensePaddingToggle, enableExpandAll, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enableMultiRowSelection, enablePagination, enableSelectAll, enableSorting, enableStickyHeader, icons, localization, positionActionsColumn, positionPagination, positionToolbarActions, positionToolbarAlertBanner, ...rest }: MaterialReactTableProps<D>) => JSX.Element;
397
+ declare const _default: <D extends Record<string, any> = {}>({ autoResetExpanded, columnResizeMode, editingMode, enableColumnActions, enableColumnFilters, enableColumnResizing, enableDensePaddingToggle, enableExpandAll, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enableMultiRowSelection, enablePagination, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarBottom, enableToolbarInternalActions, enableToolbarTop, icons, localization, positionActionsColumn, positionPagination, positionToolbarActions, positionToolbarAlertBanner, ...rest }: MaterialReactTableProps<D>) => JSX.Element;
379
398
  export default _default;
package/dist/icons.d.ts CHANGED
@@ -20,6 +20,7 @@ export interface MRT_Icons {
20
20
  MoreHorizIcon: any;
21
21
  MoreVertIcon: any;
22
22
  PushPinIcon: any;
23
+ RestartAltIcon: any;
23
24
  SaveIcon: any;
24
25
  SearchIcon: any;
25
26
  SearchOffIcon: any;
@@ -32,6 +32,7 @@ export interface MRT_Localization {
32
32
  hideColumn: string;
33
33
  pinToLeft: string;
34
34
  pinToRight: string;
35
+ resetColumnSize: string;
35
36
  rowActions: string;
36
37
  rowNumber: string;
37
38
  rowNumbers: string;