material-react-table 0.37.0 → 0.38.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.
@@ -1,5 +1,5 @@
1
1
  import { Dispatch, DragEvent, MutableRefObject, ReactNode, SetStateAction } from 'react';
2
- import type { AlertProps, ButtonProps, CheckboxProps, IconButtonProps, LinearProgressProps, PaperProps, SkeletonProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TextFieldProps, ToolbarProps } from '@mui/material';
2
+ import type { AlertProps, ButtonProps, CheckboxProps, ChipProps, IconButtonProps, LinearProgressProps, PaperProps, SkeletonProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TextFieldProps, ToolbarProps } from '@mui/material';
3
3
  import type { Cell, Column, ColumnDef, DeepKeys, FilterFn, Header, HeaderGroup, OnChangeFn, Row, SortingFn, Table, TableOptions, TableState } from '@tanstack/react-table';
4
4
  import type { Options as VirtualizerOptions } from 'react-virtual';
5
5
  import { MRT_Icons } from './icons';
@@ -113,6 +113,12 @@ export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit
113
113
  footer: MRT_Header<TData>;
114
114
  table: MRT_TableInstance<TData>;
115
115
  }) => ReactNode);
116
+ GroupedCell?: ({ cell, column, row, table, }: {
117
+ cell: MRT_Cell<TData>;
118
+ column: MRT_Column<TData>;
119
+ row: MRT_Row<TData>;
120
+ table: MRT_TableInstance<TData>;
121
+ }) => ReactNode;
116
122
  Header?: ReactNode | (({ column, header, table, }: {
117
123
  column: MRT_Column<TData>;
118
124
  header: MRT_Header<TData>;
@@ -292,6 +298,9 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
292
298
  icons?: Partial<MRT_Icons>;
293
299
  initialState?: Partial<MRT_TableState<TData>>;
294
300
  localization?: Partial<MRT_Localization>;
301
+ muiBottomToolbarProps?: ToolbarProps | (({ table }: {
302
+ table: MRT_TableInstance<TData>;
303
+ }) => ToolbarProps);
295
304
  muiExpandAllButtonProps?: IconButtonProps | (({ table }: {
296
305
  table: MRT_TableInstance<TData>;
297
306
  }) => IconButtonProps);
@@ -346,9 +355,6 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
346
355
  table: MRT_TableInstance<TData>;
347
356
  row: MRT_Row<TData>;
348
357
  }) => TableRowProps);
349
- muiTableBottomToolbarProps?: ToolbarProps | (({ table }: {
350
- table: MRT_TableInstance<TData>;
351
- }) => ToolbarProps);
352
358
  muiTableContainerProps?: TableContainerProps | (({ table, }: {
353
359
  table: MRT_TableInstance<TData>;
354
360
  }) => TableContainerProps);
@@ -400,10 +406,13 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
400
406
  muiTableProps?: TableProps | (({ table }: {
401
407
  table: MRT_TableInstance<TData>;
402
408
  }) => TableProps);
403
- muiTableToolbarAlertBannerProps?: AlertProps | (({ table }: {
409
+ muiToolbarAlertBannerChipProps?: ChipProps | (({ table }: {
410
+ table: MRT_TableInstance<TData>;
411
+ }) => ChipProps);
412
+ muiToolbarAlertBannerProps?: AlertProps | (({ table }: {
404
413
  table: MRT_TableInstance<TData>;
405
414
  }) => AlertProps);
406
- muiTableTopToolbarProps?: ToolbarProps | (({ table }: {
415
+ muiTopToolbarProps?: ToolbarProps | (({ table }: {
407
416
  table: MRT_TableInstance<TData>;
408
417
  }) => ToolbarProps);
409
418
  onColumnDrop?: ({ event, draggedColumn, targetColumn, }: {
@@ -416,13 +425,13 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
416
425
  onDensityChange?: OnChangeFn<boolean>;
417
426
  onDraggingColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
418
427
  onDraggingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
428
+ onEditingCellChange?: OnChangeFn<MRT_Cell<TData> | null>;
419
429
  onEditingRowSave?: ({ exitEditingMode, row, table, values, }: {
420
430
  exitEditingMode: () => void;
421
431
  row: MRT_Row<TData>;
422
432
  table: MRT_TableInstance<TData>;
423
433
  values: Record<LiteralUnion<string & DeepKeys<TData>>, any>;
424
434
  }) => Promise<void> | void;
425
- onEditingCellChange?: OnChangeFn<MRT_Cell<TData> | null>;
426
435
  onEditingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
427
436
  onFilterFnsChange?: OnChangeFn<{
428
437
  [key: string]: MRT_FilterOption;
@@ -459,7 +468,8 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
459
468
  row: MRT_Row<TData>;
460
469
  table: MRT_TableInstance<TData>;
461
470
  }) => ReactNode[];
462
- renderRowActions?: ({ row, table, }: {
471
+ renderRowActions?: ({ cell, row, table, }: {
472
+ cell: MRT_Cell<TData>;
463
473
  row: MRT_Row<TData>;
464
474
  table: MRT_TableInstance<TData>;
465
475
  }) => ReactNode;
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { MRT_Cell, MRT_TableInstance } from '..';
3
+ interface Props {
4
+ cell: MRT_Cell;
5
+ table: MRT_TableInstance;
6
+ }
7
+ export declare const MRT_TableBodyCellValue: FC<Props>;
8
+ export {};
@@ -1,9 +1,9 @@
1
- import { FC, ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import { MRT_Cell, MRT_TableInstance } from '..';
3
- interface Props {
4
- cell: MRT_Cell;
3
+ interface Props<TData extends Record<string, any> = {}> {
4
+ cell: MRT_Cell<TData>;
5
5
  children: ReactNode;
6
- table: MRT_TableInstance;
6
+ table: MRT_TableInstance<TData>;
7
7
  }
8
- export declare const MRT_CopyButton: FC<Props>;
8
+ export declare const MRT_CopyButton: <TData extends Record<string, any> = {}>({ cell, children, table, }: Props<TData>) => JSX.Element;
9
9
  export {};
@@ -1,6 +1,7 @@
1
1
  import { FC } from 'react';
2
- import type { MRT_Row, MRT_TableInstance } from '..';
2
+ import type { MRT_Cell, MRT_Row, MRT_TableInstance } from '..';
3
3
  interface Props {
4
+ cell: MRT_Cell;
4
5
  row: MRT_Row;
5
6
  table: MRT_TableInstance;
6
7
  }
@@ -1,4 +1,4 @@
1
- import { ColumnOrderState } from '@tanstack/react-table';
1
+ import { ColumnOrderState, GroupingState } from '@tanstack/react-table';
2
2
  import { MaterialReactTableProps, MRT_Column, MRT_ColumnDef, MRT_DefinedColumnDef, MRT_DisplayColumnIds, MRT_FilterOption } from '.';
3
3
  import { MRT_FilterFns } from './filterFns';
4
4
  import { MRT_SortingFns } from './sortingFns';
@@ -81,6 +81,7 @@ export declare const prepareColumns: <TData extends Record<string, any> = {}>(co
81
81
  basic: import("@tanstack/table-core").SortingFn<any>;
82
82
  } & Record<string, import("@tanstack/table-core").SortingFn<any>>) => MRT_DefinedColumnDef<TData>[];
83
83
  export declare const reorderColumn: <TData extends Record<string, any> = {}>(draggedColumn: MRT_Column<TData>, targetColumn: MRT_Column<TData>, columnOrder: ColumnOrderState) => ColumnOrderState;
84
+ export declare const showExpandColumn: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>, grouping?: GroupingState) => boolean;
84
85
  export declare const getLeadingDisplayColumnIds: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>) => MRT_DisplayColumnIds[];
85
86
  export declare const getTrailingDisplayColumnIds: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>) => (string | false | undefined)[];
86
87
  export declare const getDefaultColumnOrderIds: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>) => string[];
@@ -4,10 +4,11 @@ export * from './MaterialReactTable';
4
4
  import type { MRT_Icons } from './icons';
5
5
  import type { MRT_Localization } from './localization';
6
6
  export type { MRT_Localization, MRT_Icons };
7
+ import { MRT_CopyButton } from './buttons/MRT_CopyButton';
7
8
  import { MRT_FullScreenToggleButton } from './buttons/MRT_FullScreenToggleButton';
8
9
  import { MRT_GlobalFilterTextField } from './inputs/MRT_GlobalFilterTextField';
9
10
  import { MRT_ShowHideColumnsButton } from './buttons/MRT_ShowHideColumnsButton';
10
11
  import { MRT_ToggleDensePaddingButton } from './buttons/MRT_ToggleDensePaddingButton';
11
12
  import { MRT_ToggleFiltersButton } from './buttons/MRT_ToggleFiltersButton';
12
13
  import { MRT_ToggleGlobalFilterButton } from './buttons/MRT_ToggleGlobalFilterButton';
13
- export { MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, };
14
+ export { MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MRT_CopyButton, };
@@ -521,6 +521,9 @@ const reorderColumn = (draggedColumn, targetColumn, columnOrder) => {
521
521
  columnOrder.splice(columnOrder.indexOf(targetColumn.id), 0, columnOrder.splice(columnOrder.indexOf(draggedColumn.id), 1)[0]);
522
522
  return [...columnOrder];
523
523
  };
524
+ const showExpandColumn = (props, grouping) => !!(props.enableExpanding ||
525
+ (props.enableGrouping && (grouping === undefined || (grouping === null || grouping === void 0 ? void 0 : grouping.length))) ||
526
+ props.renderDetailPanel);
524
527
  const getLeadingDisplayColumnIds = (props) => {
525
528
  var _a;
526
529
  return [
@@ -530,9 +533,7 @@ const getLeadingDisplayColumnIds = (props) => {
530
533
  ['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
531
534
  'mrt-row-actions',
532
535
  props.positionExpandColumn === 'first' &&
533
- (props.enableExpanding ||
534
- props.enableGrouping ||
535
- props.renderDetailPanel) &&
536
+ showExpandColumn(props) &&
536
537
  'mrt-row-expand',
537
538
  props.enableRowSelection && 'mrt-row-select',
538
539
  props.enableRowNumbers && 'mrt-row-numbers',
@@ -546,9 +547,7 @@ const getTrailingDisplayColumnIds = (props) => {
546
547
  ['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
547
548
  'mrt-row-actions',
548
549
  props.positionExpandColumn === 'last' &&
549
- (props.enableExpanding ||
550
- props.enableGrouping ||
551
- props.renderDetailPanel) &&
550
+ showExpandColumn(props) &&
552
551
  'mrt-row-expand',
553
552
  ];
554
553
  };
@@ -916,7 +915,7 @@ const commonIconButtonStyles = {
916
915
  opacity: 1,
917
916
  },
918
917
  };
919
- const MRT_ToggleRowActionMenuButton = ({ row, table }) => {
918
+ const MRT_ToggleRowActionMenuButton = ({ cell, row, table }) => {
920
919
  const { getState, options: { editingMode, enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
921
920
  const { editingRow } = getState();
922
921
  const [anchorEl, setAnchorEl] = useState(null);
@@ -929,8 +928,8 @@ const MRT_ToggleRowActionMenuButton = ({ row, table }) => {
929
928
  setEditingRow(Object.assign({}, row));
930
929
  setAnchorEl(null);
931
930
  };
932
- return (React.createElement(React.Fragment, null, renderRowActions ? (React.createElement(React.Fragment, null, renderRowActions({ row, table }))) : row.id === (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) && editingMode === 'row' ? (React.createElement(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems && enableEditing ? (React.createElement(Tooltip, { placement: "right", arrow: true, title: localization.edit },
933
- React.createElement(IconButton, { sx: commonIconButtonStyles, onClick: handleStartEditMode },
931
+ return (React.createElement(React.Fragment, null, renderRowActions ? (React.createElement(React.Fragment, null, renderRowActions({ cell, row, table }))) : row.id === (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) && editingMode === 'row' ? (React.createElement(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems && enableEditing ? (React.createElement(Tooltip, { placement: "right", arrow: true, title: localization.edit },
932
+ React.createElement(IconButton, { "aria-label": localization.edit, sx: commonIconButtonStyles, onClick: handleStartEditMode },
934
933
  React.createElement(EditIcon, null)))) : renderRowActionMenuItems ? (React.createElement(React.Fragment, null,
935
934
  React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions },
936
935
  React.createElement(IconButton, { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles },
@@ -1046,11 +1045,14 @@ const MRT_TablePagination = ({ table, position }) => {
1046
1045
 
1047
1046
  const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
1048
1047
  var _a, _b;
1049
- const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiTableToolbarAlertBannerProps }, } = table;
1048
+ const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, }, } = table;
1050
1049
  const { grouping, showAlertBanner } = getState();
1051
- const alertProps = muiTableToolbarAlertBannerProps instanceof Function
1052
- ? muiTableToolbarAlertBannerProps({ table })
1053
- : muiTableToolbarAlertBannerProps;
1050
+ const alertProps = muiToolbarAlertBannerProps instanceof Function
1051
+ ? muiToolbarAlertBannerProps({ table })
1052
+ : muiToolbarAlertBannerProps;
1053
+ const chipProps = muiToolbarAlertBannerChipProps instanceof Function
1054
+ ? muiToolbarAlertBannerChipProps({ table })
1055
+ : muiToolbarAlertBannerChipProps;
1054
1056
  const selectMessage = getSelectedRowModel().rows.length > 0
1055
1057
  ? (_b = (_a = localization.selectedCountOfRowCountRowsSelected) === null || _a === void 0 ? void 0 : _a.replace('{selectedCount}', getSelectedRowModel().rows.length.toString())) === null || _b === void 0 ? void 0 : _b.replace('{rowCount}', getPrePaginationRowModel().rows.length.toString())
1056
1058
  : null;
@@ -1059,7 +1061,7 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
1059
1061
  ' ',
1060
1062
  grouping.map((columnId, index) => (React.createElement(Fragment, { key: `${index}-${columnId}` },
1061
1063
  index > 0 ? localization.thenBy : '',
1062
- React.createElement(Chip, { color: "secondary", label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() })))))) : null;
1064
+ React.createElement(Chip, Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))))))) : null;
1063
1065
  return (React.createElement(Collapse, { in: showAlertBanner || !!selectMessage || !!groupedByMessage, timeout: stackAlertBanner ? 200 : 0 },
1064
1066
  React.createElement(Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => (Object.assign({ borderRadius: 0, fontSize: '1rem', left: 0, p: 0, position: 'relative', right: 0, top: 0, width: '100%', zIndex: 2 }, ((alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx) instanceof Function
1065
1067
  ? alertProps.sx(theme)
@@ -1190,12 +1192,12 @@ const commonToolbarStyles = ({ theme }) => ({
1190
1192
  });
1191
1193
  const MRT_TopToolbar = ({ table }) => {
1192
1194
  var _a;
1193
- const { getState, options: { enableGlobalFilter, enablePagination, enableToolbarInternalActions, muiTableTopToolbarProps, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderTopToolbarCustomActions, }, refs: { topToolbarRef }, } = table;
1195
+ const { getState, options: { enableGlobalFilter, enablePagination, enableToolbarInternalActions, muiTopToolbarProps, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderTopToolbarCustomActions, }, refs: { topToolbarRef }, } = table;
1194
1196
  const { isFullScreen, showGlobalFilter } = getState();
1195
1197
  const isMobile = useMediaQuery('(max-width:720px)');
1196
- const toolbarProps = muiTableTopToolbarProps instanceof Function
1197
- ? muiTableTopToolbarProps({ table })
1198
- : muiTableTopToolbarProps;
1198
+ const toolbarProps = muiTopToolbarProps instanceof Function
1199
+ ? muiTopToolbarProps({ table })
1200
+ : muiTopToolbarProps;
1199
1201
  const stackAlertBanner = isMobile || !!renderTopToolbarCustomActions || showGlobalFilter;
1200
1202
  return (React.createElement(Toolbar, Object.assign({ variant: "dense" }, toolbarProps, { ref: (ref) => {
1201
1203
  topToolbarRef.current = ref;
@@ -1228,12 +1230,12 @@ const MRT_TopToolbar = ({ table }) => {
1228
1230
  };
1229
1231
 
1230
1232
  const MRT_BottomToolbar = ({ table }) => {
1231
- const { getState, options: { enablePagination, muiTableBottomToolbarProps, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderBottomToolbarCustomActions, }, refs: { bottomToolbarRef }, } = table;
1233
+ const { getState, options: { enablePagination, muiBottomToolbarProps, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderBottomToolbarCustomActions, }, refs: { bottomToolbarRef }, } = table;
1232
1234
  const { isFullScreen } = getState();
1233
1235
  const isMobile = useMediaQuery('(max-width:720px)');
1234
- const toolbarProps = muiTableBottomToolbarProps instanceof Function
1235
- ? muiTableBottomToolbarProps({ table })
1236
- : muiTableBottomToolbarProps;
1236
+ const toolbarProps = muiBottomToolbarProps instanceof Function
1237
+ ? muiBottomToolbarProps({ table })
1238
+ : muiBottomToolbarProps;
1237
1239
  const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions;
1238
1240
  return (React.createElement(Toolbar, Object.assign({ variant: "dense" }, toolbarProps, { ref: (ref) => {
1239
1241
  bottomToolbarRef.current = ref;
@@ -1252,7 +1254,7 @@ const MRT_BottomToolbar = ({ table }) => {
1252
1254
  justifyContent: 'space-between',
1253
1255
  width: '100%',
1254
1256
  } },
1255
- renderBottomToolbarCustomActions ? (React.createElement(Box, { sx: { p: '0.5rem' } }, renderBottomToolbarCustomActions({ table }))) : (React.createElement("span", null)),
1257
+ renderBottomToolbarCustomActions ? (renderBottomToolbarCustomActions({ table })) : (React.createElement("span", null)),
1256
1258
  React.createElement(Box, { sx: {
1257
1259
  display: 'flex',
1258
1260
  justifyContent: 'flex-end',
@@ -1634,7 +1636,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
1634
1636
  if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
1635
1637
  setHoveredColumn(null);
1636
1638
  }
1637
- if (enableColumnOrdering && draggingColumn) {
1639
+ if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
1638
1640
  setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
1639
1641
  }
1640
1642
  };
@@ -1684,13 +1686,11 @@ const MRT_TableHeadCell = ({ header, table }) => {
1684
1686
  ? '0.4rem'
1685
1687
  : '0.6rem', position: column.getIsPinned() && columnDefType !== 'group'
1686
1688
  ? 'sticky'
1687
- : undefined, pt: columnDefType === 'group'
1688
- ? 0
1689
- : density === 'compact'
1690
- ? '0.25'
1691
- : density === 'comfortable'
1692
- ? '.75rem'
1693
- : '1.25rem', right: column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined, transition: `all ${enableColumnResizing ? 0 : '0.2s'} ease-in-out`, userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
1689
+ : undefined, pt: columnDefType === 'group' || density === 'compact'
1690
+ ? '0.25rem'
1691
+ : density === 'comfortable'
1692
+ ? '.75rem'
1693
+ : '1.25rem', right: column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined, transition: `all ${enableColumnResizing ? 0 : '0.2s'} ease-in-out`, userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
1694
1694
  ? 3
1695
1695
  : column.getIsPinned() && columnDefType !== 'group'
1696
1696
  ? 2
@@ -1799,7 +1799,7 @@ const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
1799
1799
  }, onBlur: handleBlur, onChange: handleChange })));
1800
1800
  };
1801
1801
 
1802
- const MRT_CopyButton = ({ cell, children, table }) => {
1802
+ const MRT_CopyButton = ({ cell, children, table, }) => {
1803
1803
  const { options: { localization, muiTableBodyCellCopyButtonProps }, } = table;
1804
1804
  const { column, row } = cell;
1805
1805
  const { columnDef } = column;
@@ -1847,8 +1847,31 @@ const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
1847
1847
  return (React.createElement(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
1848
1848
  };
1849
1849
 
1850
+ const MRT_TableBodyCellValue = ({ cell, table }) => {
1851
+ var _a, _b, _c, _d;
1852
+ const { column, row } = cell;
1853
+ const { columnDef } = column;
1854
+ return (React.createElement(React.Fragment, null, cell.getIsAggregated() && column.columnDef.aggregationFn
1855
+ ? (_a = columnDef.AggregatedCell) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
1856
+ cell,
1857
+ column,
1858
+ row,
1859
+ table,
1860
+ })
1861
+ : row.getIsGrouped() && !cell.getIsGrouped()
1862
+ ? null
1863
+ : (cell.getIsGrouped() &&
1864
+ ((_b = columnDef.GroupedCell) === null || _b === void 0 ? void 0 : _b.call(columnDef, {
1865
+ cell,
1866
+ column,
1867
+ row,
1868
+ table,
1869
+ }))) ||
1870
+ ((_d = (_c = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _c === void 0 ? void 0 : _c.call(columnDef, { cell, column, row, table })) !== null && _d !== void 0 ? _d : cell.renderValue())));
1871
+ };
1872
+
1850
1873
  const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
1851
- var _a, _b, _c, _d, _f, _g, _h, _j;
1874
+ var _a, _b;
1852
1875
  const theme = useTheme();
1853
1876
  const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enablePagination, enableRowNumbers, muiTableBodyCellProps, muiTableBodyCellSkeletonProps, rowNumberMode, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
1854
1877
  const { draggingColumn, editingCell, editingRow, hoveredColumn, density, isLoading, showSkeletons, } = getState();
@@ -1978,21 +2001,12 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
1978
2001
  (column.id === 'mrt-row-select' ||
1979
2002
  column.id === 'mrt-row-expand' ||
1980
2003
  !row.getIsGrouped()) ? ((_a = columnDef.Cell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) : isEditing ? (React.createElement(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
1981
- columnDef.enableClickToCopy !== false ? (React.createElement(React.Fragment, null,
1982
- React.createElement(MRT_CopyButton, { cell: cell, table: table },
1983
- React.createElement(React.Fragment, null, row.getIsGrouped() && !cell.getIsGrouped()
1984
- ? null
1985
- : (_c = (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _b === void 0 ? void 0 : _b.call(columnDef, { cell, column, row, table })) !== null && _c !== void 0 ? _c : cell.renderValue())),
1986
- cell.getIsGrouped() && React.createElement(React.Fragment, null,
1987
- " (", (_d = row.subRows) === null || _d === void 0 ? void 0 :
1988
- _d.length,
1989
- ")"))) : (React.createElement(React.Fragment, null,
1990
- row.getIsGrouped() && !cell.getIsGrouped()
1991
- ? null
1992
- : (_g = (_f = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _f === void 0 ? void 0 : _f.call(columnDef, { cell, column, row, table })) !== null && _g !== void 0 ? _g : cell.renderValue(),
1993
- cell.getIsGrouped() && React.createElement(React.Fragment, null,
1994
- " (", (_j = (_h = row.subRows) === null || _h === void 0 ? void 0 : _h.length) !== null && _j !== void 0 ? _j : '',
1995
- ")"))))));
2004
+ columnDef.enableClickToCopy !== false ? (React.createElement(MRT_CopyButton, { cell: cell, table: table },
2005
+ React.createElement(MRT_TableBodyCellValue, { cell: cell, table: table }))) : (React.createElement(MRT_TableBodyCellValue, { cell: cell, table: table }))),
2006
+ cell.getIsGrouped() && !columnDef.GroupedCell && (React.createElement(React.Fragment, null,
2007
+ " (", (_b = row.subRows) === null || _b === void 0 ? void 0 :
2008
+ _b.length,
2009
+ ")"))));
1996
2010
  };
1997
2011
 
1998
2012
  const MRT_TableDetailPanel = ({ row, table }) => {
@@ -2263,7 +2277,7 @@ const MRT_EditRowModal = ({ open, row, table, }) => {
2263
2277
  };
2264
2278
 
2265
2279
  const MRT_TableRoot = (props) => {
2266
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
2280
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
2267
2281
  const bottomToolbarRef = useRef(null);
2268
2282
  const editInputRefs = useRef({});
2269
2283
  const filterInputRefs = useRef({});
@@ -2296,23 +2310,26 @@ const MRT_TableRoot = (props) => {
2296
2310
  const [editingCell, setEditingCell] = useState((_e = initialState.editingCell) !== null && _e !== void 0 ? _e : null);
2297
2311
  const [editingRow, setEditingRow] = useState((_f = initialState.editingRow) !== null && _f !== void 0 ? _f : null);
2298
2312
  const [globalFilterFn, setGlobalFilterFn] = useState((_g = initialState.globalFilterFn) !== null && _g !== void 0 ? _g : 'fuzzy');
2299
- const [hoveredColumn, setHoveredColumn] = useState((_h = initialState.hoveredColumn) !== null && _h !== void 0 ? _h : null);
2300
- const [hoveredRow, setHoveredRow] = useState((_j = initialState.hoveredRow) !== null && _j !== void 0 ? _j : null);
2301
- const [isFullScreen, setIsFullScreen] = useState((_k = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _k !== void 0 ? _k : false);
2302
- const [showAlertBanner, setShowAlertBanner] = useState((_m = (_l = props.initialState) === null || _l === void 0 ? void 0 : _l.showAlertBanner) !== null && _m !== void 0 ? _m : false);
2303
- const [showColumnFilters, setShowFilters] = useState((_o = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _o !== void 0 ? _o : false);
2304
- const [showGlobalFilter, setShowGlobalFilter] = useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _p !== void 0 ? _p : false);
2313
+ const [grouping, setGrouping] = useState((_h = initialState.grouping) !== null && _h !== void 0 ? _h : []);
2314
+ const [hoveredColumn, setHoveredColumn] = useState((_j = initialState.hoveredColumn) !== null && _j !== void 0 ? _j : null);
2315
+ const [hoveredRow, setHoveredRow] = useState((_k = initialState.hoveredRow) !== null && _k !== void 0 ? _k : null);
2316
+ const [isFullScreen, setIsFullScreen] = useState((_l = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _l !== void 0 ? _l : false);
2317
+ const [showAlertBanner, setShowAlertBanner] = useState((_o = (_m = props.initialState) === null || _m === void 0 ? void 0 : _m.showAlertBanner) !== null && _o !== void 0 ? _o : false);
2318
+ const [showColumnFilters, setShowFilters] = useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _p !== void 0 ? _p : false);
2319
+ const [showGlobalFilter, setShowGlobalFilter] = useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _q !== void 0 ? _q : false);
2305
2320
  const displayColumns = useMemo(() => {
2306
2321
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2307
2322
  return [
2308
2323
  columnOrder.includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header: (_a = props.localization) === null || _a === void 0 ? void 0 : _a.move, size: 60 }, defaultDisplayColumnDefOptions), (_b = props.displayColumnDefOptions) === null || _b === void 0 ? void 0 : _b['mrt-row-drag']), { id: 'mrt-row-drag' }),
2309
- columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_ToggleRowActionMenuButton, { row: row, table: table })), header: (_c = props.localization) === null || _c === void 0 ? void 0 : _c.actions, size: 70 }, defaultDisplayColumnDefOptions), (_d = props.displayColumnDefOptions) === null || _d === void 0 ? void 0 : _d['mrt-row-actions']), { id: 'mrt-row-actions' }),
2310
- columnOrder.includes('mrt-row-expand') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_ExpandButton, { row: row, table: table })), Header: () => props.enableExpandAll ? (React.createElement(MRT_ExpandAllButton, { table: table })) : null, header: (_e = props.localization) === null || _e === void 0 ? void 0 : _e.expand, size: 60 }, defaultDisplayColumnDefOptions), (_f = props.displayColumnDefOptions) === null || _f === void 0 ? void 0 : _f['mrt-row-expand']), { id: 'mrt-row-expand' }),
2324
+ columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (React.createElement(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: (_c = props.localization) === null || _c === void 0 ? void 0 : _c.actions, size: 70 }, defaultDisplayColumnDefOptions), (_d = props.displayColumnDefOptions) === null || _d === void 0 ? void 0 : _d['mrt-row-actions']), { id: 'mrt-row-actions' }),
2325
+ columnOrder.includes('mrt-row-expand') &&
2326
+ showExpandColumn(props, grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_ExpandButton, { row: row, table: table })), Header: () => props.enableExpandAll ? (React.createElement(MRT_ExpandAllButton, { table: table })) : null, header: (_e = props.localization) === null || _e === void 0 ? void 0 : _e.expand, size: 60 }, defaultDisplayColumnDefOptions), (_f = props.displayColumnDefOptions) === null || _f === void 0 ? void 0 : _f['mrt-row-expand']), { id: 'mrt-row-expand' }),
2311
2327
  columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_SelectCheckbox, { row: row, table: table })), Header: () => props.enableSelectAll ? (React.createElement(MRT_SelectCheckbox, { selectAll: true, table: table })) : null, header: (_g = props.localization) === null || _g === void 0 ? void 0 : _g.select, size: 60 }, defaultDisplayColumnDefOptions), (_h = props.displayColumnDefOptions) === null || _h === void 0 ? void 0 : _h['mrt-row-select']), { id: 'mrt-row-select' }),
2312
2328
  columnOrder.includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => { var _a; return (_a = props.localization) === null || _a === void 0 ? void 0 : _a.rowNumber; }, header: (_j = props.localization) === null || _j === void 0 ? void 0 : _j.rowNumbers, size: 60 }, defaultDisplayColumnDefOptions), (_k = props.displayColumnDefOptions) === null || _k === void 0 ? void 0 : _k['mrt-row-numbers']), { id: 'mrt-row-numbers' }),
2313
2329
  ].filter(Boolean);
2314
2330
  }, [
2315
2331
  columnOrder,
2332
+ grouping,
2316
2333
  props.displayColumnDefOptions,
2317
2334
  props.editingMode,
2318
2335
  props.enableColumnDragging,
@@ -2329,6 +2346,7 @@ const MRT_TableRoot = (props) => {
2329
2346
  props.enableSelectAll,
2330
2347
  props.localization,
2331
2348
  props.positionActionsColumn,
2349
+ props.renderDetailPanel,
2332
2350
  ]);
2333
2351
  const columnDefs = useMemo(() => prepareColumns([...displayColumns, ...props.columns], columnFilterFns, props.filterFns, props.sortingFns), [columnFilterFns, displayColumns, props.columns]);
2334
2352
  const data = useMemo(() => {
@@ -2346,11 +2364,11 @@ const MRT_TableRoot = (props) => {
2346
2364
  });
2347
2365
  })))
2348
2366
  : props.data;
2349
- }, [props.data, (_q = props.state) === null || _q === void 0 ? void 0 : _q.isLoading, (_r = props.state) === null || _r === void 0 ? void 0 : _r.showSkeletons]);
2367
+ }, [props.data, (_r = props.state) === null || _r === void 0 ? void 0 : _r.isLoading, (_s = props.state) === null || _s === void 0 ? void 0 : _s.showSkeletons]);
2350
2368
  //@ts-ignore
2351
- const table = Object.assign(Object.assign({}, useReactTable(Object.assign(Object.assign({ getCoreRowModel: getCoreRowModel(), getExpandedRowModel: getExpandedRowModel(), getFacetedRowModel: getFacetedRowModel(), getFilteredRowModel: getFilteredRowModel(), getGroupedRowModel: getGroupedRowModel(), getPaginationRowModel: getPaginationRowModel(), getSortedRowModel: getSortedRowModel(), onColumnOrderChange: setColumnOrder, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows }, props), {
2369
+ const table = Object.assign(Object.assign({}, useReactTable(Object.assign(Object.assign({ getCoreRowModel: getCoreRowModel(), getExpandedRowModel: getExpandedRowModel(), getFacetedRowModel: getFacetedRowModel(), getFilteredRowModel: getFilteredRowModel(), getGroupedRowModel: getGroupedRowModel(), getPaginationRowModel: getPaginationRowModel(), getSortedRowModel: getSortedRowModel(), onColumnOrderChange: setColumnOrder, onGroupingChange: setGrouping, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows }, props), {
2352
2370
  //@ts-ignore
2353
- columns: columnDefs, data, globalFilterFn: (_t = (_s = props.filterFns) === null || _s === void 0 ? void 0 : _s[globalFilterFn]) !== null && _t !== void 0 ? _t : (_u = props.filterFns) === null || _u === void 0 ? void 0 : _u.fuzzy, initialState, state: Object.assign({ columnFilterFns,
2371
+ columns: columnDefs, data, globalFilterFn: (_u = (_t = props.filterFns) === null || _t === void 0 ? void 0 : _t[globalFilterFn]) !== null && _u !== void 0 ? _u : (_v = props.filterFns) === null || _v === void 0 ? void 0 : _v.fuzzy, initialState, state: Object.assign({ columnFilterFns,
2354
2372
  columnOrder,
2355
2373
  density,
2356
2374
  draggingColumn,
@@ -2358,6 +2376,7 @@ const MRT_TableRoot = (props) => {
2358
2376
  editingCell,
2359
2377
  editingRow,
2360
2378
  globalFilterFn,
2379
+ grouping,
2361
2380
  hoveredColumn,
2362
2381
  hoveredRow,
2363
2382
  isFullScreen,
@@ -2370,7 +2389,7 @@ const MRT_TableRoot = (props) => {
2370
2389
  searchInputRef,
2371
2390
  tableContainerRef,
2372
2391
  topToolbarRef,
2373
- }, setColumnFilterFns: (_v = props.onFilterFnsChange) !== null && _v !== void 0 ? _v : setColumnFilterFns, setDensity: (_w = props.onDensityChange) !== null && _w !== void 0 ? _w : setDensity, setDraggingColumn: (_x = props.onDraggingColumnChange) !== null && _x !== void 0 ? _x : setDraggingColumn, setDraggingRow: (_y = props.onDraggingRowChange) !== null && _y !== void 0 ? _y : setDraggingRow, setEditingCell: (_z = props.onEditingCellChange) !== null && _z !== void 0 ? _z : setEditingCell, setEditingRow: (_0 = props.onEditingRowChange) !== null && _0 !== void 0 ? _0 : setEditingRow, setGlobalFilterFn: (_1 = props.onGlobalFilterFnChange) !== null && _1 !== void 0 ? _1 : setGlobalFilterFn, setHoveredColumn: (_2 = props.onHoveredColumnChange) !== null && _2 !== void 0 ? _2 : setHoveredColumn, setHoveredRow: (_3 = props.onHoveredRowChange) !== null && _3 !== void 0 ? _3 : setHoveredRow, setIsFullScreen: (_4 = props.onIsFullScreenChange) !== null && _4 !== void 0 ? _4 : setIsFullScreen, setShowAlertBanner: (_5 = props.onShowAlertBannerChange) !== null && _5 !== void 0 ? _5 : setShowAlertBanner, setShowFilters: (_6 = props.onShowFiltersChange) !== null && _6 !== void 0 ? _6 : setShowFilters, setShowGlobalFilter: (_7 = props.onShowGlobalFilterChange) !== null && _7 !== void 0 ? _7 : setShowGlobalFilter });
2392
+ }, setColumnFilterFns: (_w = props.onFilterFnsChange) !== null && _w !== void 0 ? _w : setColumnFilterFns, setDensity: (_x = props.onDensityChange) !== null && _x !== void 0 ? _x : setDensity, setDraggingColumn: (_y = props.onDraggingColumnChange) !== null && _y !== void 0 ? _y : setDraggingColumn, setDraggingRow: (_z = props.onDraggingRowChange) !== null && _z !== void 0 ? _z : setDraggingRow, setEditingCell: (_0 = props.onEditingCellChange) !== null && _0 !== void 0 ? _0 : setEditingCell, setEditingRow: (_1 = props.onEditingRowChange) !== null && _1 !== void 0 ? _1 : setEditingRow, setGlobalFilterFn: (_2 = props.onGlobalFilterFnChange) !== null && _2 !== void 0 ? _2 : setGlobalFilterFn, setHoveredColumn: (_3 = props.onHoveredColumnChange) !== null && _3 !== void 0 ? _3 : setHoveredColumn, setHoveredRow: (_4 = props.onHoveredRowChange) !== null && _4 !== void 0 ? _4 : setHoveredRow, setIsFullScreen: (_5 = props.onIsFullScreenChange) !== null && _5 !== void 0 ? _5 : setIsFullScreen, setShowAlertBanner: (_6 = props.onShowAlertBannerChange) !== null && _6 !== void 0 ? _6 : setShowAlertBanner, setShowFilters: (_7 = props.onShowFiltersChange) !== null && _7 !== void 0 ? _7 : setShowFilters, setShowGlobalFilter: (_8 = props.onShowGlobalFilterChange) !== null && _8 !== void 0 ? _8 : setShowGlobalFilter });
2374
2393
  return (React.createElement(React.Fragment, null,
2375
2394
  React.createElement(Dialog, { PaperComponent: Box, TransitionComponent: Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => setIsFullScreen(false), open: isFullScreen, transitionDuration: 400 },
2376
2395
  React.createElement(MRT_TablePaper, { table: table })),
@@ -2383,5 +2402,5 @@ var MaterialReactTable = (_a) => {
2383
2402
  return (React.createElement(MRT_TableRoot, Object.assign({ aggregationFns: Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns), autoResetExpanded: autoResetExpanded, columnResizeMode: columnResizeMode, defaultColumn: defaultColumn, editingMode: editingMode, enableBottomToolbar: enableBottomToolbar, enableColumnActions: enableColumnActions, enableColumnFilterChangeMode: enableColumnFilterChangeMode, enableColumnFilters: enableColumnFilters, enableColumnOrdering: enableColumnOrdering, enableColumnResizing: enableColumnResizing, enableDensityToggle: enableDensityToggle, enableExpandAll: enableExpandAll, enableFilters: enableFilters, enableFullScreenToggle: enableFullScreenToggle, enableGlobalFilter: enableGlobalFilter, enableGlobalFilterChangeMode: enableGlobalFilterChangeMode, enableGlobalFilterRankedResults: enableGlobalFilterRankedResults, enableGrouping: enableGrouping, enableHiding: enableHiding, enableMultiRowSelection: enableMultiRowSelection, enableMultiSort: enableMultiSort, enablePagination: enablePagination, enablePinning: enablePinning, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, enableSorting: enableSorting, enableStickyHeader: enableStickyHeader, enableTableFooter: enableTableFooter, enableTableHead: enableTableHead, enableToolbarInternalActions: enableToolbarInternalActions, enableTopToolbar: enableTopToolbar, filterFns: Object.assign(Object.assign({}, MRT_FilterFns), filterFns), icons: Object.assign(Object.assign({}, MRT_Default_Icons), icons), localization: Object.assign(Object.assign({}, MRT_DefaultLocalization_EN), localization), positionActionsColumn: positionActionsColumn, positionExpandColumn: positionExpandColumn, positionGlobalFilter: positionGlobalFilter, positionPagination: positionPagination, positionToolbarAlertBanner: positionToolbarAlertBanner, positionToolbarDropZone: positionToolbarDropZone, rowNumberMode: rowNumberMode, selectAllMode: selectAllMode, sortingFns: Object.assign(Object.assign({}, MRT_SortingFns), sortingFns) }, rest)));
2384
2403
  };
2385
2404
 
2386
- export { MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MaterialReactTable as default };
2405
+ export { MRT_CopyButton, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MaterialReactTable as default };
2387
2406
  //# sourceMappingURL=material-react-table.esm.js.map