material-react-table 0.24.1 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/MaterialReactTable.d.ts +18 -16
- package/dist/material-react-table.cjs.development.js +68 -75
- 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 +68 -75
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/utils.d.ts +2 -2
- package/package.json +3 -3
- package/src/MaterialReactTable.tsx +29 -24
- package/src/body/MRT_TableBodyCell.tsx +3 -1
- package/src/head/MRT_TableHeadCell.tsx +29 -29
- package/src/inputs/MRT_FilterTextField.tsx +4 -3
- package/src/inputs/MRT_SelectCheckbox.tsx +13 -18
- package/src/menus/MRT_ColumnActionMenu.tsx +16 -15
- package/src/table/MRT_TableRoot.tsx +45 -28
- package/src/utils.ts +2 -1
@@ -7,13 +7,6 @@ import { MRT_Icons } from './icons';
|
|
7
7
|
import { MRT_FilterFns } from './filtersFns';
|
8
8
|
import { MRT_SortingFns } from './sortingFns';
|
9
9
|
declare type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>);
|
10
|
-
export declare type MRT_TableOptions<TData extends Record<string, any> = {}> = Partial<Omit<TableOptions<TData>, 'columns' | 'data' | 'initialState' | 'state' | 'expandRowsFn'>> & {
|
11
|
-
columns: MRT_ColumnDef<TData>[];
|
12
|
-
data: TData[];
|
13
|
-
expandRowsFn?: (dataRow: TData) => TData[];
|
14
|
-
initialState?: Partial<MRT_TableState<TData>>;
|
15
|
-
state?: Partial<MRT_TableState<TData>>;
|
16
|
-
};
|
17
10
|
export interface MRT_RowModel<TData extends Record<string, any> = {}> {
|
18
11
|
flatRows: MRT_Row<TData>[];
|
19
12
|
rows: MRT_Row<TData>[];
|
@@ -114,7 +107,7 @@ export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit
|
|
114
107
|
*
|
115
108
|
* @example accessorKey: 'username'
|
116
109
|
*/
|
117
|
-
accessorKey?:
|
110
|
+
accessorKey?: string & keyof TData;
|
118
111
|
/**
|
119
112
|
* Specify what type of column this is. Either `data`, `display`, or `group`. Defaults to `data`.
|
120
113
|
* Leave this blank if you are just creating a normal data column.
|
@@ -229,6 +222,7 @@ export declare type MRT_SortingOption = keyof typeof MRT_SortingFns;
|
|
229
222
|
export declare type MRT_SortingFn<TData extends Record<string, any> = {}> = SortingFn<TData> | MRT_SortingOption;
|
230
223
|
export declare type MRT_FilterOption = keyof typeof MRT_FilterFns;
|
231
224
|
export declare type MRT_FilterFn<TData extends Record<string, any> = {}> = FilterFn<TData> | MRT_FilterOption;
|
225
|
+
export declare type MRT_DisplayColumnIds = 'mrt-row-drag' | 'mrt-row-actions' | 'mrt-row-expand' | 'mrt-row-select' | 'mrt-row-numbers';
|
232
226
|
/**
|
233
227
|
* `columns` and `data` props are the only required props, but there are over 150 other optional props.
|
234
228
|
*
|
@@ -238,7 +232,12 @@ export declare type MRT_FilterFn<TData extends Record<string, any> = {}> = Filte
|
|
238
232
|
* See the full props list on the official docs site:
|
239
233
|
* @link https://www.material-react-table.com/docs/api/props
|
240
234
|
*/
|
241
|
-
export declare type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
235
|
+
export declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = Omit<Partial<TableOptions<TData>>, 'columns' | 'data' | 'initialState' | 'state' | 'expandRowsFn'> & {
|
236
|
+
displayColumnDefOptions?: Partial<{
|
237
|
+
[key in MRT_DisplayColumnIds]: Partial<MRT_ColumnDef>;
|
238
|
+
}>;
|
239
|
+
columns: MRT_ColumnDef<TData>[];
|
240
|
+
data: TData[];
|
242
241
|
editingMode?: 'table' | 'row' | 'cell';
|
243
242
|
enableClickToCopy?: boolean;
|
244
243
|
enableColumnActions?: boolean;
|
@@ -266,7 +265,9 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
266
265
|
enableToolbarTop?: boolean;
|
267
266
|
enabledColumnFilterOptions?: (MRT_FilterOption | string)[] | null;
|
268
267
|
enabledGlobalFilterOptions?: (MRT_FilterOption | string)[] | null;
|
268
|
+
expandRowsFn?: (dataRow: TData) => TData[];
|
269
269
|
icons?: Partial<MRT_Icons>;
|
270
|
+
initialState?: Partial<MRT_TableState<TData>>;
|
270
271
|
localization?: Partial<MRT_Localization>;
|
271
272
|
muiExpandAllButtonProps?: IconButtonProps | (({ table }: {
|
272
273
|
table: MRT_TableInstance<TData>;
|
@@ -305,13 +306,13 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
305
306
|
table: MRT_TableInstance<TData>;
|
306
307
|
cell: MRT_Cell<TData>;
|
307
308
|
}) => SkeletonProps);
|
309
|
+
muiTableBodyProps?: TableBodyProps | (({ table }: {
|
310
|
+
table: MRT_TableInstance<TData>;
|
311
|
+
}) => TableBodyProps);
|
308
312
|
muiTableBodyRowDragHandleProps?: IconButtonProps | (({ table, row, }: {
|
309
313
|
table: MRT_TableInstance<TData>;
|
310
314
|
row: MRT_Row<TData>;
|
311
315
|
}) => IconButtonProps);
|
312
|
-
muiTableBodyProps?: TableBodyProps | (({ table }: {
|
313
|
-
table: MRT_TableInstance<TData>;
|
314
|
-
}) => TableBodyProps);
|
315
316
|
muiTableBodyRowProps?: TableRowProps | (({ table, row, }: {
|
316
317
|
table: MRT_TableInstance<TData>;
|
317
318
|
row: MRT_Row<TData>;
|
@@ -400,11 +401,11 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
400
401
|
onCurrentGlobalFilterFnChange?: OnChangeFn<MRT_FilterOption>;
|
401
402
|
onCurrentHoveredColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
|
402
403
|
onCurrentHoveredRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
404
|
+
onDensityChange?: OnChangeFn<boolean>;
|
403
405
|
onEditRowSubmit?: ({ row, table, }: {
|
404
406
|
row: MRT_Row<TData>;
|
405
407
|
table: MRT_TableInstance<TData>;
|
406
408
|
}) => Promise<void> | void;
|
407
|
-
onDensityChange?: OnChangeFn<boolean>;
|
408
409
|
onIsFullScreenChange?: OnChangeFn<boolean>;
|
409
410
|
onRowDrop?: ({ event, draggedRow, targetRow, }: {
|
410
411
|
event: DragEvent<HTMLButtonElement>;
|
@@ -434,9 +435,6 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
434
435
|
renderToolbarBottomCustomActions?: ({ table, }: {
|
435
436
|
table: MRT_TableInstance<TData>;
|
436
437
|
}) => ReactNode;
|
437
|
-
renderToolbarTopCustomActions?: ({ table, }: {
|
438
|
-
table: MRT_TableInstance<TData>;
|
439
|
-
}) => ReactNode;
|
440
438
|
renderToolbarInternalActions?: ({ table, MRT_ToggleGlobalFilterButton, MRT_ToggleFiltersButton, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_FullScreenToggleButton, }: {
|
441
439
|
table: MRT_TableInstance<TData>;
|
442
440
|
MRT_ToggleGlobalFilterButton: FC<IconButtonProps & {
|
@@ -455,9 +453,13 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
455
453
|
table: MRT_TableInstance<TData>;
|
456
454
|
}>;
|
457
455
|
}) => ReactNode;
|
456
|
+
renderToolbarTopCustomActions?: ({ table, }: {
|
457
|
+
table: MRT_TableInstance<TData>;
|
458
|
+
}) => ReactNode;
|
458
459
|
rowCount?: number;
|
459
460
|
rowNumberMode?: 'original' | 'static';
|
460
461
|
selectAllMode?: 'all' | 'page';
|
462
|
+
state?: Partial<MRT_TableState<TData>>;
|
461
463
|
tableId?: string;
|
462
464
|
virtualizerProps?: Partial<VirtualizerOptions<HTMLDivElement>>;
|
463
465
|
};
|
@@ -1148,8 +1148,8 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1148
1148
|
sx: commonMenuItemStyles$1
|
1149
1149
|
}, React__default.createElement(material.Box, {
|
1150
1150
|
sx: commonListItemStyles
|
1151
|
-
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(PushPinIcon, null)), localization.unpin))], enableColumnResizing && [React__default.createElement(material.MenuItem, {
|
1152
|
-
disabled: !
|
1151
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(PushPinIcon, null)), localization.unpin))], enableColumnResizing && column.getCanResize() && [React__default.createElement(material.MenuItem, {
|
1152
|
+
disabled: !columnSizing[column.id],
|
1153
1153
|
key: 0,
|
1154
1154
|
onClick: handleResetColumnSize,
|
1155
1155
|
sx: commonMenuItemStyles$1
|
@@ -1365,19 +1365,7 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
1365
1365
|
var _getState = getState(),
|
1366
1366
|
density = _getState.density;
|
1367
1367
|
|
1368
|
-
var
|
1369
|
-
if (selectAll) {
|
1370
|
-
if (selectAllMode === 'all') {
|
1371
|
-
table.getToggleAllRowsSelectedHandler()(event);
|
1372
|
-
} else if (selectAllMode === 'page') {
|
1373
|
-
table.getToggleAllPageRowsSelectedHandler()(event);
|
1374
|
-
}
|
1375
|
-
} else if (row) {
|
1376
|
-
row == null ? void 0 : row.getToggleSelectedHandler()(event);
|
1377
|
-
}
|
1378
|
-
};
|
1379
|
-
|
1380
|
-
var checkboxProps = selectAll ? muiSelectAllCheckboxProps instanceof Function ? muiSelectAllCheckboxProps({
|
1368
|
+
var checkboxProps = !row ? muiSelectAllCheckboxProps instanceof Function ? muiSelectAllCheckboxProps({
|
1381
1369
|
table: table
|
1382
1370
|
}) : muiSelectAllCheckboxProps : muiSelectCheckboxProps instanceof Function ? muiSelectCheckboxProps({
|
1383
1371
|
row: row,
|
@@ -1394,12 +1382,13 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
1394
1382
|
inputProps: {
|
1395
1383
|
'aria-label': selectAll ? localization.toggleSelectAll : localization.toggleSelectRow
|
1396
1384
|
},
|
1397
|
-
onChange:
|
1385
|
+
onChange: !row ? selectAllMode === 'all' ? table.getToggleAllRowsSelectedHandler() : table.getToggleAllPageRowsSelectedHandler() : row.getToggleSelectedHandler(),
|
1398
1386
|
size: density === 'compact' ? 'small' : 'medium'
|
1399
1387
|
}, checkboxProps, {
|
1400
1388
|
sx: _extends({
|
1401
|
-
height: density === 'compact' ? '1.
|
1402
|
-
width: density === 'compact' ? '1.
|
1389
|
+
height: density === 'compact' ? '1.5rem' : '2rem',
|
1390
|
+
width: density === 'compact' ? '1.5rem' : '2rem',
|
1391
|
+
m: '-1re.m'
|
1403
1392
|
}, checkboxProps == null ? void 0 : checkboxProps.sx)
|
1404
1393
|
})));
|
1405
1394
|
};
|
@@ -2103,16 +2092,16 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
2103
2092
|
setFilterValue = _useState2[1];
|
2104
2093
|
|
2105
2094
|
var handleChangeDebounced = React.useCallback(material.debounce(function (event) {
|
2095
|
+
var value = textFieldProps.type === 'date' ? new Date(event.target.value) : event.target.value;
|
2096
|
+
|
2106
2097
|
if (inputIndex !== undefined) {
|
2107
2098
|
column.setFilterValue(function (old) {
|
2108
2099
|
var newFilterValues = old != null ? old : ['', ''];
|
2109
|
-
newFilterValues[inputIndex] =
|
2100
|
+
newFilterValues[inputIndex] = value;
|
2110
2101
|
return newFilterValues;
|
2111
2102
|
});
|
2112
2103
|
} else {
|
2113
|
-
|
2114
|
-
|
2115
|
-
column.setFilterValue((_event$target$value = event.target.value) != null ? _event$target$value : undefined);
|
2104
|
+
column.setFilterValue(value != null ? value : undefined);
|
2116
2105
|
}
|
2117
2106
|
}, 200), []);
|
2118
2107
|
|
@@ -2519,11 +2508,6 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
2519
2508
|
|
2520
2509
|
var tableCellProps = _extends({}, mTableHeadCellProps, mcTableHeadCellProps);
|
2521
2510
|
|
2522
|
-
var headerElement = (_ref2 = (columnDef == null ? void 0 : columnDef.Header) instanceof Function ? columnDef == null ? void 0 : columnDef.Header == null ? void 0 : columnDef.Header({
|
2523
|
-
header: header,
|
2524
|
-
table: table
|
2525
|
-
}) : columnDef == null ? void 0 : columnDef.Header) != null ? _ref2 : columnDef.header;
|
2526
|
-
|
2527
2511
|
var getIsLastLeftPinnedColumn = function getIsLastLeftPinnedColumn() {
|
2528
2512
|
return column.getIsPinned() === 'left' && table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex();
|
2529
2513
|
};
|
@@ -2538,17 +2522,21 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
2538
2522
|
|
2539
2523
|
var handleDragEnter = function handleDragEnter(_e) {
|
2540
2524
|
if (enableColumnOrdering && currentDraggingColumn) {
|
2541
|
-
setCurrentHoveredColumn(
|
2525
|
+
setCurrentHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
2542
2526
|
}
|
2543
2527
|
};
|
2544
2528
|
|
2545
|
-
var tableHeadCellRef = React__default.useRef(null);
|
2546
2529
|
var draggingBorder = (currentDraggingColumn == null ? void 0 : currentDraggingColumn.id) === column.id ? "1px dashed " + theme.palette.divider : (currentHoveredColumn == null ? void 0 : currentHoveredColumn.id) === column.id ? "2px dashed " + theme.palette.primary.main : undefined;
|
2547
2530
|
var draggingBorders = draggingBorder ? {
|
2548
2531
|
borderLeft: draggingBorder,
|
2549
2532
|
borderRight: draggingBorder,
|
2550
2533
|
borderTop: draggingBorder
|
2551
2534
|
} : undefined;
|
2535
|
+
var headerElement = (_ref2 = (columnDef == null ? void 0 : columnDef.Header) instanceof Function ? columnDef == null ? void 0 : columnDef.Header == null ? void 0 : columnDef.Header({
|
2536
|
+
header: header,
|
2537
|
+
table: table
|
2538
|
+
}) : columnDef == null ? void 0 : columnDef.Header) != null ? _ref2 : columnDef.header;
|
2539
|
+
var tableHeadCellRef = React__default.useRef(null);
|
2552
2540
|
return React__default.createElement(material.TableCell, Object.assign({
|
2553
2541
|
align: columnDefType === 'group' ? 'center' : 'left',
|
2554
2542
|
colSpan: header.colSpan,
|
@@ -2573,7 +2561,7 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
2573
2561
|
right: column.getIsPinned() === 'right' ? getTotalRight() + "px" : undefined,
|
2574
2562
|
transition: "all " + (enableColumnResizing ? 0 : '0.2s') + " ease-in-out",
|
2575
2563
|
userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined,
|
2576
|
-
verticalAlign: '
|
2564
|
+
verticalAlign: 'top',
|
2577
2565
|
zIndex: column.getIsResizing() || (currentDraggingColumn == null ? void 0 : currentDraggingColumn.id) === column.id ? 3 : column.getIsPinned() && columnDefType !== 'group' ? 2 : 1
|
2578
2566
|
}, tableCellProps == null ? void 0 : tableCellProps.sx, draggingBorders, {
|
2579
2567
|
maxWidth: "min(" + column.getSize() + "px, fit-content)",
|
@@ -2581,7 +2569,7 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
2581
2569
|
width: header.getSize()
|
2582
2570
|
});
|
2583
2571
|
}
|
2584
|
-
}), header.isPlaceholder ? null :
|
2572
|
+
}), header.isPlaceholder ? null : React__default.createElement(material.Box, {
|
2585
2573
|
sx: {
|
2586
2574
|
alignItems: 'flex-start',
|
2587
2575
|
display: 'flex',
|
@@ -2598,27 +2586,27 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
2598
2586
|
flexWrap: 'nowrap',
|
2599
2587
|
whiteSpace: ((_columnDef$header$len = (_columnDef$header = columnDef.header) == null ? void 0 : _columnDef$header.length) != null ? _columnDef$header$len : 0) < 24 ? 'nowrap' : 'normal'
|
2600
2588
|
}
|
2601
|
-
}, headerElement,
|
2589
|
+
}, headerElement, column.getCanSort() && React__default.createElement(MRT_TableHeadCellSortLabel, {
|
2602
2590
|
header: header,
|
2603
2591
|
table: table
|
2604
|
-
}),
|
2592
|
+
}), column.getCanFilter() && React__default.createElement(MRT_TableHeadCellFilterLabel, {
|
2605
2593
|
header: header,
|
2606
2594
|
table: table
|
2607
|
-
})), React__default.createElement(material.Box, {
|
2595
|
+
})), columnDefType !== 'group' && React__default.createElement(material.Box, {
|
2608
2596
|
sx: {
|
2609
2597
|
whiteSpace: 'nowrap'
|
2610
2598
|
}
|
2611
|
-
},
|
2599
|
+
}, (enableColumnDragging && columnDef.enableColumnDragging !== false || enableColumnOrdering && columnDef.enableColumnOrdering !== false || enableGrouping && columnDef.enableGrouping !== false) && React__default.createElement(MRT_TableHeadCellGrabHandle, {
|
2612
2600
|
column: column,
|
2613
2601
|
table: table,
|
2614
2602
|
tableHeadCellRef: tableHeadCellRef
|
2615
|
-
}), (enableColumnActions || columnDef.enableColumnActions) && columnDef.enableColumnActions !== false &&
|
2603
|
+
}), (enableColumnActions || columnDef.enableColumnActions) && columnDef.enableColumnActions !== false && React__default.createElement(MRT_TableHeadCellColumnActionsButton, {
|
2616
2604
|
header: header,
|
2617
2605
|
table: table
|
2618
2606
|
})), column.getCanResize() && React__default.createElement(MRT_TableHeadCellResizeHandle, {
|
2619
2607
|
header: header,
|
2620
2608
|
table: table
|
2621
|
-
})),
|
2609
|
+
})), column.getCanFilter() && React__default.createElement(MRT_TableHeadCellFilterContainer, {
|
2622
2610
|
header: header,
|
2623
2611
|
table: table
|
2624
2612
|
}));
|
@@ -2929,7 +2917,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
2929
2917
|
|
2930
2918
|
var handleDragEnter = function handleDragEnter(_e) {
|
2931
2919
|
if (enableColumnOrdering && currentDraggingColumn) {
|
2932
|
-
setCurrentHoveredColumn(
|
2920
|
+
setCurrentHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
2933
2921
|
}
|
2934
2922
|
};
|
2935
2923
|
|
@@ -3387,8 +3375,23 @@ var MRT_TablePaper = function MRT_TablePaper(_ref) {
|
|
3387
3375
|
}));
|
3388
3376
|
};
|
3389
3377
|
|
3378
|
+
var defaultDisplayColumnDefOptions = {
|
3379
|
+
columnDefType: 'display',
|
3380
|
+
enableClickToCopy: false,
|
3381
|
+
enableColumnActions: false,
|
3382
|
+
enableColumnDragging: false,
|
3383
|
+
enableColumnFilter: false,
|
3384
|
+
enableColumnOrdering: false,
|
3385
|
+
enableEditing: false,
|
3386
|
+
enableGlobalFilter: false,
|
3387
|
+
enableGrouping: false,
|
3388
|
+
enableHiding: false,
|
3389
|
+
enablePinning: false,
|
3390
|
+
enableResizing: false,
|
3391
|
+
enableSorting: false
|
3392
|
+
};
|
3390
3393
|
var MRT_TableRoot = function MRT_TableRoot(props) {
|
3391
|
-
var _initialState$columnO, _initialState$current, _initialState$current2, _initialState$density, _initialState$isFullS, _props$initialState$s, _props$initialState2, _initialState$showCol, _initialState$showGlo, _props$state3, _props$state4, _MRT_FilterFns$curren, _props$onCurrentDragg, _props$onCurrentDragg2, _props$onCurrentEditi, _props$onCurrentEditi2, _props$onCurrentFilte, _props$onCurrentGloba, _props$onCurrentHover, _props$onCurrentHover2, _props$onDensityChang, _props$onIsFullScreen, _props$onShowAlertBan, _props$onShowFiltersC, _props$onShowGlobalFi;
|
3394
|
+
var _initialState$columnO, _initialState$current, _initialState$current2, _initialState$current3, _initialState$current4, _initialState$current5, _initialState$current6, _initialState$density, _initialState$isFullS, _props$initialState$s, _props$initialState2, _initialState$showCol, _initialState$showGlo, _props$state3, _props$state4, _MRT_FilterFns$curren, _props$onCurrentDragg, _props$onCurrentDragg2, _props$onCurrentEditi, _props$onCurrentEditi2, _props$onCurrentFilte, _props$onCurrentGloba, _props$onCurrentHover, _props$onCurrentHover2, _props$onDensityChang, _props$onIsFullScreen, _props$onShowAlertBan, _props$onShowFiltersC, _props$onShowGlobalFi;
|
3392
3395
|
|
3393
3396
|
var _useState = React.useState(props.tableId),
|
3394
3397
|
tableId = _useState[0],
|
@@ -3411,27 +3414,27 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3411
3414
|
columnOrder = _useState2[0],
|
3412
3415
|
setColumnOrder = _useState2[1];
|
3413
3416
|
|
3414
|
-
var _useState3 = React.useState(null),
|
3417
|
+
var _useState3 = React.useState((_initialState$current = initialState.currentDraggingColumn) != null ? _initialState$current : null),
|
3415
3418
|
currentDraggingColumn = _useState3[0],
|
3416
3419
|
setCurrentDraggingColumn = _useState3[1];
|
3417
3420
|
|
3418
|
-
var _useState4 = React.useState(null),
|
3421
|
+
var _useState4 = React.useState((_initialState$current2 = initialState.currentDraggingRow) != null ? _initialState$current2 : null),
|
3419
3422
|
currentDraggingRow = _useState4[0],
|
3420
3423
|
setCurrentDraggingRow = _useState4[1];
|
3421
3424
|
|
3422
|
-
var _useState5 = React.useState((_initialState$
|
3425
|
+
var _useState5 = React.useState((_initialState$current3 = initialState.currentEditingCell) != null ? _initialState$current3 : null),
|
3423
3426
|
currentEditingCell = _useState5[0],
|
3424
3427
|
setCurrentEditingCell = _useState5[1];
|
3425
3428
|
|
3426
|
-
var _useState6 = React.useState((_initialState$
|
3429
|
+
var _useState6 = React.useState((_initialState$current4 = initialState.currentEditingRow) != null ? _initialState$current4 : null),
|
3427
3430
|
currentEditingRow = _useState6[0],
|
3428
3431
|
setCurrentEditingRow = _useState6[1];
|
3429
3432
|
|
3430
|
-
var _useState7 = React.useState(null),
|
3433
|
+
var _useState7 = React.useState((_initialState$current5 = initialState.currentHoveredColumn) != null ? _initialState$current5 : null),
|
3431
3434
|
currentHoveredColumn = _useState7[0],
|
3432
3435
|
setCurrentHoveredColumn = _useState7[1];
|
3433
3436
|
|
3434
|
-
var _useState8 = React.useState(null),
|
3437
|
+
var _useState8 = React.useState((_initialState$current6 = initialState.currentHoveredRow) != null ? _initialState$current6 : null),
|
3435
3438
|
currentHoveredRow = _useState8[0],
|
3436
3439
|
setCurrentHoveredRow = _useState8[1];
|
3437
3440
|
|
@@ -3457,9 +3460,9 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3457
3460
|
|
3458
3461
|
var _useState14 = React.useState(function () {
|
3459
3462
|
return Object.assign.apply(Object, [{}].concat(getAllLeafColumnDefs(props.columns).map(function (col) {
|
3460
|
-
var _ref, _col$id$toString, _col$id, _col$accessorKey, _col$filterFn$name, _ref2, _col$filterFn, _initialState$
|
3463
|
+
var _ref, _col$id$toString, _col$id, _col$accessorKey, _col$filterFn$name, _ref2, _col$filterFn, _initialState$current7, _ref3, _col$id$toString2, _col$id2, _col$accessorKey2, _col$filterSelectOpti, _ref4;
|
3461
3464
|
|
3462
|
-
return _ref4 = {}, _ref4[(_ref = (_col$id$toString = (_col$id = col.id) == null ? void 0 : _col$id.toString()) != null ? _col$id$toString : (_col$accessorKey = col.accessorKey) == null ? void 0 : _col$accessorKey.toString()) != null ? _ref : ''] = col.filterFn instanceof Function ? (_col$filterFn$name = col.filterFn.name) != null ? _col$filterFn$name : 'custom' : (_ref2 = (_col$filterFn = col.filterFn) != null ? _col$filterFn : initialState == null ? void 0 : (_initialState$
|
3465
|
+
return _ref4 = {}, _ref4[(_ref = (_col$id$toString = (_col$id = col.id) == null ? void 0 : _col$id.toString()) != null ? _col$id$toString : (_col$accessorKey = col.accessorKey) == null ? void 0 : _col$accessorKey.toString()) != null ? _ref : ''] = col.filterFn instanceof Function ? (_col$filterFn$name = col.filterFn.name) != null ? _col$filterFn$name : 'custom' : (_ref2 = (_col$filterFn = col.filterFn) != null ? _col$filterFn : initialState == null ? void 0 : (_initialState$current7 = initialState.currentFilterFns) == null ? void 0 : _initialState$current7[(_ref3 = (_col$id$toString2 = (_col$id2 = col.id) == null ? void 0 : _col$id2.toString()) != null ? _col$id$toString2 : (_col$accessorKey2 = col.accessorKey) == null ? void 0 : _col$accessorKey2.toString()) != null ? _ref3 : '']) != null ? _ref2 : !!((_col$filterSelectOpti = col.filterSelectOptions) != null && _col$filterSelectOpti.length) ? 'equals' : 'fuzzy', _ref4;
|
3463
3466
|
})));
|
3464
3467
|
}),
|
3465
3468
|
currentFilterFns = _useState14[0],
|
@@ -3470,16 +3473,14 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3470
3473
|
setCurrentGlobalFilterFn = _useState15[1];
|
3471
3474
|
|
3472
3475
|
var displayColumns = React.useMemo(function () {
|
3473
|
-
var _props$localization, _props$localization2, _props$localization3, _props$localization4, _props$localization6;
|
3476
|
+
var _props$localization, _props$displayColumnD, _props$localization2, _props$displayColumnD2, _props$localization3, _props$displayColumnD3, _props$localization4, _props$displayColumnD4, _props$localization6, _props$displayColumnD5;
|
3474
3477
|
|
3475
|
-
return [columnOrder.includes('mrt-row-drag') && {
|
3476
|
-
columnDefType: 'display',
|
3478
|
+
return [columnOrder.includes('mrt-row-drag') && _extends({
|
3477
3479
|
header: (_props$localization = props.localization) == null ? void 0 : _props$localization.move,
|
3478
|
-
id: 'mrt-row-drag',
|
3479
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3480
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3481
3480
|
size: 60
|
3482
|
-
},
|
3481
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD['mrt-row-drag'], {
|
3482
|
+
id: 'mrt-row-drag'
|
3483
|
+
}), columnOrder.includes('mrt-row-actions') && _extends({
|
3483
3484
|
Cell: function Cell(_ref5) {
|
3484
3485
|
var cell = _ref5.cell;
|
3485
3486
|
return React__default.createElement(MRT_ToggleRowActionMenuButton, {
|
@@ -3487,13 +3488,11 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3487
3488
|
table: table
|
3488
3489
|
});
|
3489
3490
|
},
|
3490
|
-
columnDefType: 'display',
|
3491
3491
|
header: (_props$localization2 = props.localization) == null ? void 0 : _props$localization2.actions,
|
3492
|
-
id: 'mrt-row-actions',
|
3493
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3494
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3495
3492
|
size: 70
|
3496
|
-
},
|
3493
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD2 = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD2['mrt-row-actions'], {
|
3494
|
+
id: 'mrt-row-actions'
|
3495
|
+
}), columnOrder.includes('mrt-row-expand') && _extends({
|
3497
3496
|
Cell: function Cell(_ref6) {
|
3498
3497
|
var cell = _ref6.cell;
|
3499
3498
|
return React__default.createElement(MRT_ExpandButton, {
|
@@ -3506,13 +3505,11 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3506
3505
|
table: table
|
3507
3506
|
}) : null;
|
3508
3507
|
},
|
3509
|
-
columnDefType: 'display',
|
3510
3508
|
header: (_props$localization3 = props.localization) == null ? void 0 : _props$localization3.expand,
|
3511
|
-
id: 'mrt-row-expand',
|
3512
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3513
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3514
3509
|
size: 60
|
3515
|
-
},
|
3510
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD3 = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD3['mrt-row-expand'], {
|
3511
|
+
id: 'mrt-row-expand'
|
3512
|
+
}), columnOrder.includes('mrt-row-select') && _extends({
|
3516
3513
|
Cell: function Cell(_ref7) {
|
3517
3514
|
var cell = _ref7.cell;
|
3518
3515
|
return React__default.createElement(MRT_SelectCheckbox, {
|
@@ -3526,13 +3523,11 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3526
3523
|
table: table
|
3527
3524
|
}) : null;
|
3528
3525
|
},
|
3529
|
-
columnDefType: 'display',
|
3530
3526
|
header: (_props$localization4 = props.localization) == null ? void 0 : _props$localization4.select,
|
3531
|
-
id: 'mrt-row-select',
|
3532
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3533
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3534
3527
|
size: 60
|
3535
|
-
},
|
3528
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD4 = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD4['mrt-row-select'], {
|
3529
|
+
id: 'mrt-row-select'
|
3530
|
+
}), columnOrder.includes('mrt-row-numbers') && _extends({
|
3536
3531
|
Cell: function Cell(_ref8) {
|
3537
3532
|
var cell = _ref8.cell;
|
3538
3533
|
return cell.row.index + 1;
|
@@ -3542,14 +3537,12 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3542
3537
|
|
3543
3538
|
return (_props$localization5 = props.localization) == null ? void 0 : _props$localization5.rowNumber;
|
3544
3539
|
},
|
3545
|
-
columnDefType: 'display',
|
3546
3540
|
header: (_props$localization6 = props.localization) == null ? void 0 : _props$localization6.rowNumbers,
|
3547
|
-
id: 'mrt-row-numbers',
|
3548
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3549
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3550
3541
|
size: 60
|
3551
|
-
}
|
3552
|
-
|
3542
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD5 = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD5['mrt-row-numbers'], {
|
3543
|
+
id: 'mrt-row-numbers'
|
3544
|
+
})].filter(Boolean);
|
3545
|
+
}, [columnOrder, props.displayColumnDefOptions, props.editingMode, props.enableColumnDragging, props.enableColumnOrdering, props.enableEditing, props.enableExpandAll, props.enableExpanding, props.enableGrouping, props.enableRowActions, props.enableRowDragging, props.enableRowNumbers, props.enableRowOrdering, props.enableRowSelection, props.enableSelectAll, props.localization, props.muiTableBodyCellProps, props.muiTableHeadCellProps, props.positionActionsColumn]);
|
3553
3546
|
var columnDefs = React.useMemo(function () {
|
3554
3547
|
return prepareColumns([].concat(displayColumns, props.columns), currentFilterFns);
|
3555
3548
|
}, [currentFilterFns, displayColumns, props.columns]);
|