material-react-table 2.13.0 → 2.13.2
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/index.d.ts +70 -63
- package/dist/index.esm.js +30 -21
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +30 -21
- package/dist/index.js.map +1 -1
- package/package.json +36 -36
- package/src/components/body/MRT_TableBodyCell.tsx +3 -1
- package/src/components/body/MRT_TableBodyCellValue.tsx +4 -0
- package/src/components/footer/MRT_TableFooterCell.tsx +2 -2
- package/src/components/head/MRT_TableHeadCell.tsx +11 -2
- package/src/components/inputs/MRT_EditCellTextField.tsx +5 -1
- package/src/components/inputs/MRT_FilterRangeSlider.tsx +1 -1
- package/src/components/inputs/MRT_FilterTextField.tsx +6 -3
- package/src/components/menus/MRT_FilterOptionMenu.tsx +2 -2
- package/src/components/table/MRT_TableContainer.tsx +2 -2
- package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +1 -1
- package/src/hooks/useMRT_ColumnVirtualizer.ts +1 -1
- package/src/hooks/useMRT_RowVirtualizer.ts +1 -1
- package/src/hooks/useMRT_TableInstance.ts +3 -3
- package/src/types.ts +34 -28
- package/locales/am/index.d.ts +0 -3
- package/locales/am/index.esm.d.ts +0 -3
- package/locales/am/index.esm.js +0 -93
- package/locales/am/index.js +0 -97
- package/locales/am/package.json +0 -6
package/dist/index.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
/// <reference types="react" />
|
2
1
|
import * as react from 'react';
|
3
2
|
import { MutableRefObject, Dispatch, SetStateAction, ReactNode, RefObject, ChangeEvent, MouseEvent, DragEventHandler } from 'react';
|
4
3
|
import * as _tanstack_react_table from '@tanstack/react-table';
|
@@ -59,55 +58,55 @@ declare const MRT_FilterFns: {
|
|
59
58
|
autoRemove(val: any): boolean;
|
60
59
|
};
|
61
60
|
betweenInclusive: {
|
62
|
-
<
|
61
|
+
<TData extends MRT_RowData>(row: Row<TData>, id: string, filterValues: [number | string, number | string]): boolean;
|
63
62
|
autoRemove(val: any): boolean;
|
64
63
|
};
|
65
64
|
contains: {
|
66
|
-
<
|
65
|
+
<TData extends MRT_RowData>(row: Row<TData>, id: string, filterValue: number | string): boolean;
|
67
66
|
autoRemove(val: any): boolean;
|
68
67
|
};
|
69
68
|
empty: {
|
70
|
-
<
|
69
|
+
<TData extends MRT_RowData>(row: Row<TData>, id: string, _filterValue: number | string): boolean;
|
71
70
|
autoRemove(val: any): boolean;
|
72
71
|
};
|
73
72
|
endsWith: {
|
74
|
-
<
|
73
|
+
<TData extends MRT_RowData>(row: Row<TData>, id: string, filterValue: number | string): boolean;
|
75
74
|
autoRemove(val: any): boolean;
|
76
75
|
};
|
77
76
|
equals: {
|
78
|
-
<
|
77
|
+
<TData extends MRT_RowData>(row: Row<TData>, id: string, filterValue: number | string): boolean;
|
79
78
|
autoRemove(val: any): boolean;
|
80
79
|
};
|
81
80
|
fuzzy: {
|
82
|
-
<
|
81
|
+
<TData extends MRT_RowData>(row: Row<TData>, columnId: string, filterValue: number | string, addMeta: (item: RankingInfo) => void): boolean;
|
83
82
|
autoRemove(val: any): boolean;
|
84
83
|
};
|
85
84
|
greaterThan: {
|
86
|
-
<
|
85
|
+
<TData extends MRT_RowData>(row: Row<TData>, id: string, filterValue: number | string): boolean;
|
87
86
|
autoRemove(val: any): boolean;
|
88
87
|
};
|
89
88
|
greaterThanOrEqualTo: {
|
90
|
-
<
|
89
|
+
<TData extends MRT_RowData>(row: Row<TData>, id: string, filterValue: number | string): boolean;
|
91
90
|
autoRemove(val: any): boolean;
|
92
91
|
};
|
93
92
|
lessThan: {
|
94
|
-
<
|
93
|
+
<TData extends MRT_RowData>(row: Row<TData>, id: string, filterValue: number | string): boolean;
|
95
94
|
autoRemove(val: any): boolean;
|
96
95
|
};
|
97
96
|
lessThanOrEqualTo: {
|
98
|
-
<
|
97
|
+
<TData extends MRT_RowData>(row: Row<TData>, id: string, filterValue: number | string): boolean;
|
99
98
|
autoRemove(val: any): boolean;
|
100
99
|
};
|
101
100
|
notEmpty: {
|
102
|
-
<
|
101
|
+
<TData extends MRT_RowData>(row: Row<TData>, id: string, _filterValue: number | string): boolean;
|
103
102
|
autoRemove(val: any): boolean;
|
104
103
|
};
|
105
104
|
notEquals: {
|
106
|
-
<
|
105
|
+
<TData extends MRT_RowData>(row: Row<TData>, id: string, filterValue: number | string): boolean;
|
107
106
|
autoRemove(val: any): boolean;
|
108
107
|
};
|
109
108
|
startsWith: {
|
110
|
-
<
|
109
|
+
<TData extends MRT_RowData>(row: Row<TData>, id: string, filterValue: number | string): boolean;
|
111
110
|
autoRemove(val: any): boolean;
|
112
111
|
};
|
113
112
|
includesString: _tanstack_react_table.FilterFn<any>;
|
@@ -480,12 +479,14 @@ interface MRT_TableState<TData extends MRT_RowData> extends TableState {
|
|
480
479
|
showSkeletons: boolean;
|
481
480
|
showToolbarDropZone: boolean;
|
482
481
|
}
|
483
|
-
|
482
|
+
interface MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> extends Omit<ColumnDef<TData, TValue>, 'accessorKey' | 'aggregatedCell' | 'aggregationFn' | 'cell' | 'columns' | 'filterFn' | 'footer' | 'header' | 'id' | 'sortingFn'> {
|
484
483
|
AggregatedCell?: (props: {
|
485
484
|
cell: MRT_Cell<TData, TValue>;
|
486
485
|
column: MRT_Column<TData, TValue>;
|
487
486
|
row: MRT_Row<TData>;
|
488
487
|
table: MRT_TableInstance<TData>;
|
488
|
+
staticColumnIndex?: number;
|
489
|
+
staticRowIndex?: number;
|
489
490
|
}) => ReactNode;
|
490
491
|
Cell?: (props: {
|
491
492
|
cell: MRT_Cell<TData, TValue>;
|
@@ -519,6 +520,8 @@ type MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> = Omit<ColumnDef
|
|
519
520
|
column: MRT_Column<TData, TValue>;
|
520
521
|
row: MRT_Row<TData>;
|
521
522
|
table: MRT_TableInstance<TData>;
|
523
|
+
staticColumnIndex?: number;
|
524
|
+
staticRowIndex?: number;
|
522
525
|
}) => ReactNode;
|
523
526
|
Header?: ((props: {
|
524
527
|
column: MRT_Column<TData, TValue>;
|
@@ -688,7 +691,7 @@ type MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> = Omit<ColumnDef
|
|
688
691
|
}) => ReactNode[];
|
689
692
|
sortingFn?: MRT_SortingFn<TData>;
|
690
693
|
visibleInShowHideMenu?: boolean;
|
691
|
-
}
|
694
|
+
}
|
692
695
|
type MRT_DisplayColumnDef<TData extends MRT_RowData, TValue = unknown> = Omit<MRT_ColumnDef<TData, TValue>, 'accessorFn' | 'accessorKey'>;
|
693
696
|
type MRT_GroupColumnDef<TData extends MRT_RowData> = MRT_DisplayColumnDef<TData, any> & {
|
694
697
|
columns: MRT_ColumnDef<TData>[];
|
@@ -746,7 +749,7 @@ type MRT_DisplayColumnIds = 'mrt-row-actions' | 'mrt-row-drag' | 'mrt-row-expand
|
|
746
749
|
* See the full props list on the official docs site:
|
747
750
|
* @link https://www.material-react-table.com/docs/api/props
|
748
751
|
*/
|
749
|
-
|
752
|
+
interface MRT_TableOptions<TData extends MRT_RowData> extends Omit<Partial<TableOptions<TData>>, 'columns' | 'data' | 'defaultColumn' | 'enableRowSelection' | 'expandRowsFn' | 'getRowId' | 'globalFilterFn' | 'initialState' | 'onStateChange' | 'state'> {
|
750
753
|
columnFilterDisplayMode?: 'custom' | 'popover' | 'subheader';
|
751
754
|
columnFilterModeOptions?: Array<LiteralUnion<string & MRT_FilterOption>> | null;
|
752
755
|
columnVirtualizerInstanceRef?: MutableRefObject<MRT_ColumnVirtualizer | MRT_Virtualizer | null>;
|
@@ -1157,7 +1160,7 @@ type MRT_TableOptions<TData extends MRT_RowData> = Omit<Partial<TableOptions<TDa
|
|
1157
1160
|
* Manage state externally any way you want, then pass it back into MRT.
|
1158
1161
|
*/
|
1159
1162
|
state?: Partial<MRT_TableState<TData>>;
|
1160
|
-
}
|
1163
|
+
}
|
1161
1164
|
|
1162
1165
|
declare const flexRender: (Comp: Renderable<any>, props: any) => JSX.Element | ReactNode;
|
1163
1166
|
declare function createMRTColumnHelper<TData extends MRT_RowData>(): MRT_ColumnHelper<TData>;
|
@@ -1178,7 +1181,7 @@ declare const prepareColumns: <TData extends MRT_RowData>({ columnDefs, tableOpt
|
|
1178
1181
|
columnDefs: MRT_ColumnDef<TData>[];
|
1179
1182
|
tableOptions: MRT_DefinedTableOptions<TData>;
|
1180
1183
|
}) => MRT_DefinedColumnDef<TData>[];
|
1181
|
-
declare const reorderColumn: <TData extends MRT_RowData>(draggedColumn: MRT_Column<TData>, targetColumn: MRT_Column<TData>, columnOrder:
|
1184
|
+
declare const reorderColumn: <TData extends MRT_RowData>(draggedColumn: MRT_Column<TData>, targetColumn: MRT_Column<TData>, columnOrder: MRT_ColumnOrderState) => MRT_ColumnOrderState;
|
1182
1185
|
declare const getDefaultColumnFilterFn: <TData extends MRT_RowData>(columnDef: MRT_ColumnDef<TData>) => MRT_FilterOption;
|
1183
1186
|
declare const getColumnFilterInfo: <TData extends MRT_RowData>({ header, table, }: {
|
1184
1187
|
header: MRT_Header<TData>;
|
@@ -1212,37 +1215,39 @@ declare function defaultDisplayColumnProps<TData extends MRT_RowData>({ header,
|
|
1212
1215
|
readonly aggregationFn?: MRT_AggregationFn<TData> | MRT_AggregationFn<TData>[] | undefined;
|
1213
1216
|
readonly columns?: MRT_ColumnDef<TData, unknown>[] | undefined;
|
1214
1217
|
readonly filterFn?: MRT_FilterFn<TData> | undefined;
|
1215
|
-
readonly footer?: string
|
1218
|
+
readonly footer?: string;
|
1216
1219
|
readonly sortingFn?: MRT_SortingFn<TData> | undefined;
|
1217
1220
|
readonly meta?: _tanstack_react_table.ColumnMeta<TData, unknown> | undefined;
|
1218
|
-
readonly enableHiding?: boolean
|
1219
|
-
readonly enablePinning?: boolean
|
1220
|
-
readonly enableColumnFilter?: boolean
|
1221
|
-
readonly enableGlobalFilter?: boolean
|
1222
|
-
readonly enableMultiSort?: boolean
|
1223
|
-
readonly enableSorting?: boolean
|
1224
|
-
readonly invertSorting?: boolean
|
1225
|
-
readonly sortDescFirst?: boolean
|
1226
|
-
readonly sortUndefined?: false | 1 |
|
1227
|
-
readonly enableGrouping?: boolean
|
1228
|
-
readonly enableResizing?: boolean
|
1229
|
-
readonly maxSize?: number
|
1230
|
-
readonly minSize?: number
|
1221
|
+
readonly enableHiding?: boolean;
|
1222
|
+
readonly enablePinning?: boolean;
|
1223
|
+
readonly enableColumnFilter?: boolean;
|
1224
|
+
readonly enableGlobalFilter?: boolean;
|
1225
|
+
readonly enableMultiSort?: boolean;
|
1226
|
+
readonly enableSorting?: boolean;
|
1227
|
+
readonly invertSorting?: boolean;
|
1228
|
+
readonly sortDescFirst?: boolean;
|
1229
|
+
readonly sortUndefined?: false | -1 | 1 | "first" | "last";
|
1230
|
+
readonly enableGrouping?: boolean;
|
1231
|
+
readonly enableResizing?: boolean;
|
1232
|
+
readonly maxSize?: number;
|
1233
|
+
readonly minSize?: number;
|
1231
1234
|
readonly size: number;
|
1232
1235
|
readonly AggregatedCell?: ((props: {
|
1233
1236
|
cell: MRT_Cell<TData, unknown>;
|
1234
1237
|
column: MRT_Column<TData, unknown>;
|
1235
1238
|
row: MRT_Row<TData>;
|
1236
1239
|
table: MRT_TableInstance<TData>;
|
1240
|
+
staticColumnIndex?: number;
|
1241
|
+
staticRowIndex?: number;
|
1237
1242
|
}) => react.ReactNode) | undefined;
|
1238
1243
|
readonly Cell?: ((props: {
|
1239
1244
|
cell: MRT_Cell<TData, unknown>;
|
1240
1245
|
column: MRT_Column<TData, unknown>;
|
1241
1246
|
renderedCellValue: react.ReactNode;
|
1242
1247
|
row: MRT_Row<TData>;
|
1243
|
-
rowRef?: react.RefObject<HTMLTableRowElement
|
1244
|
-
staticColumnIndex?: number
|
1245
|
-
staticRowIndex?: number
|
1248
|
+
rowRef?: react.RefObject<HTMLTableRowElement>;
|
1249
|
+
staticColumnIndex?: number;
|
1250
|
+
staticRowIndex?: number;
|
1246
1251
|
table: MRT_TableInstance<TData>;
|
1247
1252
|
}) => react.ReactNode) | undefined;
|
1248
1253
|
readonly Edit?: ((props: {
|
@@ -1254,7 +1259,7 @@ declare function defaultDisplayColumnProps<TData extends MRT_RowData>({ header,
|
|
1254
1259
|
readonly Filter?: ((props: {
|
1255
1260
|
column: MRT_Column<TData, unknown>;
|
1256
1261
|
header: MRT_Header<TData>;
|
1257
|
-
rangeFilterIndex?: number
|
1262
|
+
rangeFilterIndex?: number;
|
1258
1263
|
table: MRT_TableInstance<TData>;
|
1259
1264
|
}) => react.ReactNode) | undefined;
|
1260
1265
|
readonly Footer?: react.ReactNode | ((props: {
|
@@ -1267,6 +1272,8 @@ declare function defaultDisplayColumnProps<TData extends MRT_RowData>({ header,
|
|
1267
1272
|
column: MRT_Column<TData, unknown>;
|
1268
1273
|
row: MRT_Row<TData>;
|
1269
1274
|
table: MRT_TableInstance<TData>;
|
1275
|
+
staticColumnIndex?: number;
|
1276
|
+
staticRowIndex?: number;
|
1270
1277
|
}) => react.ReactNode) | undefined;
|
1271
1278
|
readonly Header?: react.ReactNode | ((props: {
|
1272
1279
|
column: MRT_Column<TData, unknown>;
|
@@ -1279,25 +1286,25 @@ declare function defaultDisplayColumnProps<TData extends MRT_RowData>({ header,
|
|
1279
1286
|
row: MRT_Row<TData>;
|
1280
1287
|
table: MRT_TableInstance<TData>;
|
1281
1288
|
}) => react.ReactNode) | undefined;
|
1282
|
-
readonly columnDefType?: "data" | "display" | "group"
|
1283
|
-
readonly columnFilterModeOptions?: LiteralUnion<string & MRT_FilterOption
|
1289
|
+
readonly columnDefType?: "data" | "display" | "group";
|
1290
|
+
readonly columnFilterModeOptions?: Array<LiteralUnion<string & MRT_FilterOption>> | null;
|
1284
1291
|
readonly editSelectOptions?: DropdownOption[] | ((props: {
|
1285
1292
|
cell: MRT_Cell<TData, unknown>;
|
1286
1293
|
column: MRT_Column<TData, unknown>;
|
1287
1294
|
row: MRT_Row<TData>;
|
1288
1295
|
table: MRT_TableInstance<TData>;
|
1289
1296
|
}) => DropdownOption[]) | undefined;
|
1290
|
-
readonly editVariant?: "
|
1291
|
-
readonly enableClickToCopy?: boolean | "context-menu" | ((cell: MRT_Cell<TData, unknown>) =>
|
1292
|
-
readonly enableColumnActions?: boolean
|
1293
|
-
readonly enableColumnDragging?: boolean
|
1294
|
-
readonly enableColumnFilterModes?: boolean
|
1295
|
-
readonly enableColumnOrdering?: boolean
|
1297
|
+
readonly editVariant?: "select" | "text";
|
1298
|
+
readonly enableClickToCopy?: boolean | "context-menu" | ((cell: MRT_Cell<TData, unknown>) => "context-menu" | boolean) | undefined;
|
1299
|
+
readonly enableColumnActions?: boolean;
|
1300
|
+
readonly enableColumnDragging?: boolean;
|
1301
|
+
readonly enableColumnFilterModes?: boolean;
|
1302
|
+
readonly enableColumnOrdering?: boolean;
|
1296
1303
|
readonly enableEditing?: boolean | ((row: MRT_Row<TData>) => boolean) | undefined;
|
1297
|
-
readonly enableFilterMatchHighlighting?: boolean
|
1298
|
-
readonly filterSelectOptions?: DropdownOption[]
|
1299
|
-
readonly filterVariant?: "
|
1300
|
-
readonly grow?:
|
1304
|
+
readonly enableFilterMatchHighlighting?: boolean;
|
1305
|
+
readonly filterSelectOptions?: DropdownOption[];
|
1306
|
+
readonly filterVariant?: "autocomplete" | "checkbox" | "date" | "date-range" | "datetime" | "datetime-range" | "multi-select" | "range" | "range-slider" | "select" | "text" | "time" | "time-range";
|
1307
|
+
readonly grow?: boolean | number;
|
1301
1308
|
readonly muiColumnActionsButtonProps?: _mui_material.IconButtonProps | ((props: {
|
1302
1309
|
column: MRT_Column<TData, unknown>;
|
1303
1310
|
table: MRT_TableInstance<TData>;
|
@@ -1321,35 +1328,35 @@ declare function defaultDisplayColumnProps<TData extends MRT_RowData>({ header,
|
|
1321
1328
|
readonly muiFilterAutocompleteProps?: _mui_material.AutocompleteProps<any, any, any, any, "div"> | ((props: {
|
1322
1329
|
column: MRT_Column<TData, unknown>;
|
1323
1330
|
table: MRT_TableInstance<TData>;
|
1324
|
-
}) => _mui_material.AutocompleteProps<any, any, any, any
|
1331
|
+
}) => _mui_material.AutocompleteProps<any, any, any, any>) | undefined;
|
1325
1332
|
readonly muiFilterCheckboxProps?: _mui_material.CheckboxProps | ((props: {
|
1326
1333
|
column: MRT_Column<TData, unknown>;
|
1327
1334
|
table: MRT_TableInstance<TData>;
|
1328
1335
|
}) => _mui_material.CheckboxProps) | undefined;
|
1329
1336
|
readonly muiFilterDatePickerProps?: _mui_x_date_pickers.DatePickerProps<never, false> | ((props: {
|
1330
1337
|
column: MRT_Column<TData, unknown>;
|
1331
|
-
rangeFilterIndex?: number
|
1338
|
+
rangeFilterIndex?: number;
|
1332
1339
|
table: MRT_TableInstance<TData>;
|
1333
|
-
}) => _mui_x_date_pickers.DatePickerProps<never
|
1340
|
+
}) => _mui_x_date_pickers.DatePickerProps<never>) | undefined;
|
1334
1341
|
readonly muiFilterDateTimePickerProps?: _mui_x_date_pickers.DateTimePickerProps<never, false> | ((props: {
|
1335
1342
|
column: MRT_Column<TData, unknown>;
|
1336
|
-
rangeFilterIndex?: number
|
1343
|
+
rangeFilterIndex?: number;
|
1337
1344
|
table: MRT_TableInstance<TData>;
|
1338
|
-
}) => _mui_x_date_pickers.DateTimePickerProps<never
|
1345
|
+
}) => _mui_x_date_pickers.DateTimePickerProps<never>) | undefined;
|
1339
1346
|
readonly muiFilterSliderProps?: _mui_material.SliderProps | ((props: {
|
1340
1347
|
column: MRT_Column<TData, unknown>;
|
1341
1348
|
table: MRT_TableInstance<TData>;
|
1342
1349
|
}) => _mui_material.SliderProps) | undefined;
|
1343
1350
|
readonly muiFilterTextFieldProps?: _mui_material.TextFieldProps | ((props: {
|
1344
1351
|
column: MRT_Column<TData, unknown>;
|
1345
|
-
rangeFilterIndex?: number
|
1352
|
+
rangeFilterIndex?: number;
|
1346
1353
|
table: MRT_TableInstance<TData>;
|
1347
1354
|
}) => _mui_material.TextFieldProps) | undefined;
|
1348
1355
|
readonly muiFilterTimePickerProps?: _mui_x_date_pickers.TimePickerProps<never, false> | ((props: {
|
1349
1356
|
column: MRT_Column<TData, unknown>;
|
1350
|
-
rangeFilterIndex?: number
|
1357
|
+
rangeFilterIndex?: number;
|
1351
1358
|
table: MRT_TableInstance<TData>;
|
1352
|
-
}) => _mui_x_date_pickers.TimePickerProps<never
|
1359
|
+
}) => _mui_x_date_pickers.TimePickerProps<never>) | undefined;
|
1353
1360
|
readonly muiTableBodyCellProps?: _mui_material.TableCellProps | ((props: {
|
1354
1361
|
cell: MRT_Cell<TData, unknown>;
|
1355
1362
|
column: MRT_Column<TData, unknown>;
|
@@ -1370,8 +1377,8 @@ declare function defaultDisplayColumnProps<TData extends MRT_RowData>({ header,
|
|
1370
1377
|
column: MRT_Column<TData, unknown>;
|
1371
1378
|
internalMenuItems: react.ReactNode[];
|
1372
1379
|
row: MRT_Row<TData>;
|
1373
|
-
staticColumnIndex?: number
|
1374
|
-
staticRowIndex?: number
|
1380
|
+
staticColumnIndex?: number;
|
1381
|
+
staticRowIndex?: number;
|
1375
1382
|
table: MRT_TableInstance<TData>;
|
1376
1383
|
}) => react.ReactNode[]) | undefined;
|
1377
1384
|
readonly renderColumnActionsMenuItems?: ((props: {
|
@@ -1386,7 +1393,7 @@ declare function defaultDisplayColumnProps<TData extends MRT_RowData>({ header,
|
|
1386
1393
|
onSelectFilterMode: (filterMode: MRT_FilterOption) => void;
|
1387
1394
|
table: MRT_TableInstance<TData>;
|
1388
1395
|
}) => react.ReactNode[]) | undefined;
|
1389
|
-
readonly visibleInShowHideMenu?: boolean
|
1396
|
+
readonly visibleInShowHideMenu?: boolean;
|
1390
1397
|
};
|
1391
1398
|
declare const showRowPinningColumn: <TData extends MRT_RowData>(tableOptions: MRT_StatefulTableOptions<TData>) => boolean;
|
1392
1399
|
declare const showRowDragColumn: <TData extends MRT_RowData>(tableOptions: MRT_StatefulTableOptions<TData>) => boolean;
|
@@ -1465,7 +1472,7 @@ interface MRT_TableBodyProps<TData extends MRT_RowData> extends TableBodyProps {
|
|
1465
1472
|
table: MRT_TableInstance<TData>;
|
1466
1473
|
}
|
1467
1474
|
declare const MRT_TableBody: <TData extends MRT_RowData>({ columnVirtualizer, table, ...rest }: MRT_TableBodyProps<TData>) => react_jsx_runtime.JSX.Element;
|
1468
|
-
declare const Memo_MRT_TableBody:
|
1475
|
+
declare const Memo_MRT_TableBody: typeof MRT_TableBody;
|
1469
1476
|
|
1470
1477
|
interface MRT_TableBodyCellProps<TData extends MRT_RowData> extends TableCellProps {
|
1471
1478
|
cell: MRT_Cell<TData>;
|
@@ -1476,7 +1483,7 @@ interface MRT_TableBodyCellProps<TData extends MRT_RowData> extends TableCellPro
|
|
1476
1483
|
table: MRT_TableInstance<TData>;
|
1477
1484
|
}
|
1478
1485
|
declare const MRT_TableBodyCell: <TData extends MRT_RowData>({ cell, numRows, rowRef, staticColumnIndex, staticRowIndex, table, ...rest }: MRT_TableBodyCellProps<TData>) => react_jsx_runtime.JSX.Element;
|
1479
|
-
declare const Memo_MRT_TableBodyCell:
|
1486
|
+
declare const Memo_MRT_TableBodyCell: typeof MRT_TableBodyCell;
|
1480
1487
|
|
1481
1488
|
interface MRT_TableBodyCellValueProps<TData extends MRT_RowData> {
|
1482
1489
|
cell: MRT_Cell<TData>;
|
@@ -1498,7 +1505,7 @@ interface MRT_TableBodyRowProps<TData extends MRT_RowData> extends TableRowProps
|
|
1498
1505
|
virtualRow?: VirtualItem;
|
1499
1506
|
}
|
1500
1507
|
declare const MRT_TableBodyRow: <TData extends MRT_RowData>({ columnVirtualizer, numRows, pinnedRowIds, row, rowVirtualizer, staticRowIndex, table, virtualRow, ...rest }: MRT_TableBodyRowProps<TData>) => react_jsx_runtime.JSX.Element;
|
1501
|
-
declare const Memo_MRT_TableBodyRow:
|
1508
|
+
declare const Memo_MRT_TableBodyRow: typeof MRT_TableBodyRow;
|
1502
1509
|
|
1503
1510
|
interface MRT_TableBodyRowGrabHandleProps<TData extends MRT_RowData> extends IconButtonProps {
|
1504
1511
|
row: MRT_Row<TData>;
|
package/dist/index.esm.js
CHANGED
@@ -962,7 +962,7 @@ const getMRT_RowExpandColumnDef = (tableOptions) => {
|
|
962
962
|
header: 'expand',
|
963
963
|
id: 'mrt-row-expand',
|
964
964
|
size: groupedColumnMode === 'remove'
|
965
|
-
? (_a = defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.size) !== null && _a !== void 0 ? _a : 180
|
965
|
+
? ((_a = defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.size) !== null && _a !== void 0 ? _a : 180)
|
966
966
|
: renderDetailPanel
|
967
967
|
? enableExpandAll
|
968
968
|
? 60
|
@@ -1480,8 +1480,8 @@ const useMRT_TableInstance = (definedTableOptions) => {
|
|
1480
1480
|
var _a, _b, _c, _d;
|
1481
1481
|
return ({
|
1482
1482
|
[getColumnId(col)]: col.filterFn instanceof Function
|
1483
|
-
? (_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom'
|
1484
|
-
: (_d = (_b = col.filterFn) !== null && _b !== void 0 ? _b : (_c = initialState === null || initialState === void 0 ? void 0 : initialState.columnFilterFns) === null || _c === void 0 ? void 0 : _c[getColumnId(col)]) !== null && _d !== void 0 ? _d : getDefaultColumnFilterFn(col),
|
1483
|
+
? ((_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom')
|
1484
|
+
: ((_d = (_b = col.filterFn) !== null && _b !== void 0 ? _b : (_c = initialState === null || initialState === void 0 ? void 0 : initialState.columnFilterFns) === null || _c === void 0 ? void 0 : _c[getColumnId(col)]) !== null && _d !== void 0 ? _d : getDefaultColumnFilterFn(col)),
|
1485
1485
|
});
|
1486
1486
|
})));
|
1487
1487
|
const [columnOrder, onColumnOrderChange] = useState((_c = initialState.columnOrder) !== null && _c !== void 0 ? _c : []);
|
@@ -1768,6 +1768,8 @@ const MRT_TableBodyCellValue = ({ cell, rowRef, staticColumnIndex, staticRowInde
|
|
1768
1768
|
column,
|
1769
1769
|
row,
|
1770
1770
|
table,
|
1771
|
+
staticColumnIndex,
|
1772
|
+
staticRowIndex,
|
1771
1773
|
})
|
1772
1774
|
: row.getIsGrouped() && !cell.getIsGrouped()
|
1773
1775
|
? null
|
@@ -1777,6 +1779,8 @@ const MRT_TableBodyCellValue = ({ cell, rowRef, staticColumnIndex, staticRowInde
|
|
1777
1779
|
column,
|
1778
1780
|
row,
|
1779
1781
|
table,
|
1782
|
+
staticColumnIndex,
|
1783
|
+
staticRowIndex,
|
1780
1784
|
})
|
1781
1785
|
: undefined;
|
1782
1786
|
const isGroupedValue = renderedCellValue !== undefined;
|
@@ -1864,6 +1868,7 @@ const MRT_EditCellTextField = (_a) => {
|
|
1864
1868
|
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
1865
1869
|
const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
|
1866
1870
|
const [value, setValue] = useState(() => cell.getValue());
|
1871
|
+
const [completesComposition, setCompletesComposition] = useState(true);
|
1867
1872
|
const textFieldProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditTextFieldProps, {
|
1868
1873
|
cell,
|
1869
1874
|
column,
|
@@ -1909,7 +1914,7 @@ const MRT_EditCellTextField = (_a) => {
|
|
1909
1914
|
const handleEnterKeyDown = (event) => {
|
1910
1915
|
var _a, _b;
|
1911
1916
|
(_a = textFieldProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
|
1912
|
-
if (event.key === 'Enter' && !event.shiftKey) {
|
1917
|
+
if (event.key === 'Enter' && !event.shiftKey && completesComposition) {
|
1913
1918
|
(_b = editInputRefs.current[column.id]) === null || _b === void 0 ? void 0 : _b.blur();
|
1914
1919
|
}
|
1915
1920
|
};
|
@@ -1932,13 +1937,11 @@ const MRT_EditCellTextField = (_a) => {
|
|
1932
1937
|
: {})), textFieldProps.InputProps), { sx: (theme) => {
|
1933
1938
|
var _a;
|
1934
1939
|
return (Object.assign({ mb: 0 }, parseFromValuesOrFunc((_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.InputProps) === null || _a === void 0 ? void 0 : _a.sx, theme)));
|
1935
|
-
} }), SelectProps: {
|
1936
|
-
MenuProps: { disableScrollLock: true },
|
1937
|
-
}, inputProps: Object.assign({ autoComplete: 'new-password' }, textFieldProps.inputProps), onBlur: handleBlur, onChange: handleChange, onClick: (e) => {
|
1940
|
+
} }), SelectProps: Object.assign({ MenuProps: { disableScrollLock: true } }, textFieldProps.SelectProps), inputProps: Object.assign({ autoComplete: 'new-password' }, textFieldProps.inputProps), onBlur: handleBlur, onChange: handleChange, onClick: (e) => {
|
1938
1941
|
var _a;
|
1939
1942
|
e.stopPropagation();
|
1940
1943
|
(_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
|
1941
|
-
}, onKeyDown: handleEnterKeyDown, children: (_c = textFieldProps.children) !== null && _c !== void 0 ? _c : selectOptions === null || selectOptions === void 0 ? void 0 : selectOptions.map((option) => {
|
1944
|
+
}, onKeyDown: handleEnterKeyDown, onCompositionStart: () => setCompletesComposition(false), onCompositionEnd: () => setCompletesComposition(true), children: (_c = textFieldProps.children) !== null && _c !== void 0 ? _c : selectOptions === null || selectOptions === void 0 ? void 0 : selectOptions.map((option) => {
|
1942
1945
|
const { label, value } = getValueAndLabel(option);
|
1943
1946
|
return (jsx(MenuItem, { sx: {
|
1944
1947
|
alignItems: 'center',
|
@@ -2043,6 +2046,8 @@ const MRT_TableBodyCell = (_a) => {
|
|
2043
2046
|
const cellValueProps = {
|
2044
2047
|
cell,
|
2045
2048
|
table,
|
2049
|
+
staticColumnIndex,
|
2050
|
+
staticRowIndex,
|
2046
2051
|
};
|
2047
2052
|
const handleDoubleClick = (event) => {
|
2048
2053
|
var _a;
|
@@ -2101,7 +2106,7 @@ const MRT_TableBodyCell = (_a) => {
|
|
2101
2106
|
table,
|
2102
2107
|
tableCellProps,
|
2103
2108
|
theme,
|
2104
|
-
})), draggingBorders)), children: (_b = tableCellProps.children) !== null && _b !== void 0 ? _b : (jsxs(Fragment, { children: [cell.getIsPlaceholder() ? ((_d = (_c = columnDef.PlaceholderCell) === null || _c === void 0 ? void 0 : _c.call(columnDef, { cell, column, row, table })) !== null && _d !== void 0 ? _d : null) : showSkeletons !== false && (isLoading || showSkeletons) ? (jsx(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : columnDefType === 'display' &&
|
2109
|
+
})), draggingBorders)), children: (_b = tableCellProps.children) !== null && _b !== void 0 ? _b : (jsxs(Fragment, { children: [cell.getIsPlaceholder() ? (((_d = (_c = columnDef.PlaceholderCell) === null || _c === void 0 ? void 0 : _c.call(columnDef, { cell, column, row, table })) !== null && _d !== void 0 ? _d : null)) : showSkeletons !== false && (isLoading || showSkeletons) ? (jsx(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : columnDefType === 'display' &&
|
2105
2110
|
(['mrt-row-expand', 'mrt-row-numbers', 'mrt-row-select'].includes(column.id) ||
|
2106
2111
|
!row.getIsGrouped()) ? ((_e = columnDef.Cell) === null || _e === void 0 ? void 0 : _e.call(columnDef, {
|
2107
2112
|
cell,
|
@@ -2359,11 +2364,11 @@ const MRT_TableFooterCell = (_a) => {
|
|
2359
2364
|
theme,
|
2360
2365
|
})), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: (_b = tableCellProps.children) !== null && _b !== void 0 ? _b : (footer.isPlaceholder
|
2361
2366
|
? null
|
2362
|
-
: (_d = (_c = parseFromValuesOrFunc(columnDef.Footer, {
|
2367
|
+
: ((_d = (_c = parseFromValuesOrFunc(columnDef.Footer, {
|
2363
2368
|
column,
|
2364
2369
|
footer,
|
2365
2370
|
table,
|
2366
|
-
})) !== null && _c !== void 0 ? _c : columnDef.footer) !== null && _d !== void 0 ? _d : null) })));
|
2371
|
+
})) !== null && _c !== void 0 ? _c : columnDef.footer) !== null && _d !== void 0 ? _d : null)) })));
|
2367
2372
|
};
|
2368
2373
|
|
2369
2374
|
const MRT_TableFooterRow = (_a) => {
|
@@ -2595,7 +2600,7 @@ const MRT_FilterOptionMenu = (_a) => {
|
|
2595
2600
|
backgroundColor: menuBackgroundColor,
|
2596
2601
|
},
|
2597
2602
|
}, anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'center' }, disableScrollLock: true, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_e = (header && column && columnDef
|
2598
|
-
? (_d = (_c = columnDef.renderColumnFilterModeMenuItems) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
|
2603
|
+
? ((_d = (_c = columnDef.renderColumnFilterModeMenuItems) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
|
2599
2604
|
column: column,
|
2600
2605
|
internalFilterOptions,
|
2601
2606
|
onSelectFilterMode: handleSelectFilterMode,
|
@@ -2605,7 +2610,7 @@ const MRT_FilterOptionMenu = (_a) => {
|
|
2605
2610
|
internalFilterOptions,
|
2606
2611
|
onSelectFilterMode: handleSelectFilterMode,
|
2607
2612
|
table,
|
2608
|
-
})
|
2613
|
+
}))
|
2609
2614
|
: renderGlobalFilterModeMenuItems === null || renderGlobalFilterModeMenuItems === void 0 ? void 0 : renderGlobalFilterModeMenuItems({
|
2610
2615
|
internalFilterOptions,
|
2611
2616
|
onSelectFilterMode: handleSelectFilterMode,
|
@@ -2820,7 +2825,7 @@ const MRT_FilterTextField = (_a) => {
|
|
2820
2825
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]
|
2821
2826
|
: '';
|
2822
2827
|
const filterPlaceholder = !isRangeFilter
|
2823
|
-
? (_d = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.placeholder) !== null && _d !== void 0 ? _d : (_f = localization.filterByColumn) === null || _f === void 0 ? void 0 : _f.replace('{column}', String(columnDef.header))
|
2828
|
+
? ((_d = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.placeholder) !== null && _d !== void 0 ? _d : (_f = localization.filterByColumn) === null || _f === void 0 ? void 0 : _f.replace('{column}', String(columnDef.header)))
|
2824
2829
|
: rangeFilterIndex === 0
|
2825
2830
|
? localization.min
|
2826
2831
|
: rangeFilterIndex === 1
|
@@ -2838,7 +2843,7 @@ const MRT_FilterTextField = (_a) => {
|
|
2838
2843
|
? column.getFilterValue() || []
|
2839
2844
|
: isRangeFilter
|
2840
2845
|
? ((_a = column.getFilterValue()) === null || _a === void 0 ? void 0 : _a[rangeFilterIndex]) || ''
|
2841
|
-
: (_b = column.getFilterValue()) !== null && _b !== void 0 ? _b : '';
|
2846
|
+
: ((_b = column.getFilterValue()) !== null && _b !== void 0 ? _b : '');
|
2842
2847
|
});
|
2843
2848
|
const [autocompleteValue, setAutocompleteValue] = useState(isAutocompleteFilter ? filterValue : null);
|
2844
2849
|
const handleChangeDebounced = useCallback(debounce((newValue) => {
|
@@ -3019,7 +3024,7 @@ const MRT_FilterRangeSlider = (_a) => {
|
|
3019
3024
|
const sliderProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterSliderProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterSliderProps, { column, table })), rest);
|
3020
3025
|
let [min, max] = sliderProps.min !== undefined && sliderProps.max !== undefined
|
3021
3026
|
? [sliderProps.min, sliderProps.max]
|
3022
|
-
: (_b = column.getFacetedMinMaxValues()) !== null && _b !== void 0 ? _b : [0, 1];
|
3027
|
+
: ((_b = column.getFacetedMinMaxValues()) !== null && _b !== void 0 ? _b : [0, 1]);
|
3023
3028
|
//fix potential TanStack Table bugs where min or max is an array
|
3024
3029
|
if (Array.isArray(min))
|
3025
3030
|
min = min[0];
|
@@ -3341,7 +3346,11 @@ const MRT_TableHeadCell = (_a) => {
|
|
3341
3346
|
? 'center'
|
3342
3347
|
: theme.direction === 'rtl'
|
3343
3348
|
? 'right'
|
3344
|
-
: 'left',
|
3349
|
+
: 'left', "aria-sort": column.getIsSorted()
|
3350
|
+
? column.getIsSorted() === 'asc'
|
3351
|
+
? 'ascending'
|
3352
|
+
: 'descending'
|
3353
|
+
: 'none', colSpan: header.colSpan, "data-can-sort": column.getCanSort() || undefined, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, "data-sort": column.getIsSorted() || undefined, onDragEnter: handleDragEnter, onDragOver: handleDragOver, ref: (node) => {
|
3345
3354
|
var _a;
|
3346
3355
|
if (node) {
|
3347
3356
|
tableHeadCellRefs.current[column.id] = node;
|
@@ -3377,7 +3386,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
3377
3386
|
theme,
|
3378
3387
|
})), draggingBorders)), children: [header.isPlaceholder
|
3379
3388
|
? null
|
3380
|
-
: (_c = tableCellProps.children) !== null && _c !== void 0 ? _c : (jsxs(Box, { className: "Mui-TableHeadCell-Content", sx: {
|
3389
|
+
: ((_c = tableCellProps.children) !== null && _c !== void 0 ? _c : (jsxs(Box, { className: "Mui-TableHeadCell-Content", sx: {
|
3381
3390
|
alignItems: 'center',
|
3382
3391
|
display: 'flex',
|
3383
3392
|
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
@@ -3414,7 +3423,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
3414
3423
|
whiteSpace: 'nowrap',
|
3415
3424
|
}, children: [showDragHandle && (jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
|
3416
3425
|
current: tableHeadCellRefs.current[column.id],
|
3417
|
-
} })), showColumnActions && (jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] })), column.getCanResize() && (jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] })), columnFilterDisplayMode === 'subheader' && column.getCanFilter() && (jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
|
3426
|
+
} })), showColumnActions && (jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] })), column.getCanResize() && (jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] }))), columnFilterDisplayMode === 'subheader' && column.getCanFilter() && (jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
|
3418
3427
|
};
|
3419
3428
|
|
3420
3429
|
const MRT_TableHeadRow = (_a) => {
|
@@ -3649,10 +3658,10 @@ const MRT_TableContainer = (_a) => {
|
|
3649
3658
|
useIsomorphicLayoutEffect(() => {
|
3650
3659
|
var _a, _b, _c, _d;
|
3651
3660
|
const topToolbarHeight = typeof document !== 'undefined'
|
3652
|
-
? (_b = (_a = topToolbarRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0
|
3661
|
+
? ((_b = (_a = topToolbarRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0)
|
3653
3662
|
: 0;
|
3654
3663
|
const bottomToolbarHeight = typeof document !== 'undefined'
|
3655
|
-
? (_d = (_c = bottomToolbarRef === null || bottomToolbarRef === void 0 ? void 0 : bottomToolbarRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0
|
3664
|
+
? ((_d = (_c = bottomToolbarRef === null || bottomToolbarRef === void 0 ? void 0 : bottomToolbarRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0)
|
3656
3665
|
: 0;
|
3657
3666
|
setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
|
3658
3667
|
});
|