material-react-table 0.37.1 → 0.38.1

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import { MutableRefObject, Dispatch, SetStateAction, ReactNode, DragEvent } from 'react';
2
- import { ButtonProps, TextFieldProps, TableCellProps, IconButtonProps, LinearProgressProps, CheckboxProps, SkeletonProps, TableBodyProps, TableRowProps, ToolbarProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, PaperProps, TableProps, AlertProps } from '@mui/material';
2
+ import { ButtonProps, TextFieldProps, TableCellProps, IconButtonProps, ToolbarProps, LinearProgressProps, CheckboxProps, SkeletonProps, TableBodyProps, TableRowProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, PaperProps, TableProps, ChipProps, AlertProps } from '@mui/material';
3
3
  import { Row, Table, TableState, ColumnDef, DeepKeys, Column, Header, HeaderGroup, Cell, SortingFn, FilterFn, TableOptions, OnChangeFn } from '@tanstack/react-table';
4
4
  import { Options } from 'react-virtual';
5
5
  import * as _tanstack_table_core from '@tanstack/table-core';
@@ -239,8 +239,8 @@ declare type MRT_TableInstance<TData extends Record<string, any> = {}> = Omit<Ta
239
239
  setDensity: Dispatch<SetStateAction<'comfortable' | 'compact' | 'spacious'>>;
240
240
  setDraggingColumn: Dispatch<SetStateAction<MRT_Column<TData> | null>>;
241
241
  setDraggingRow: Dispatch<SetStateAction<MRT_Row<TData> | null>>;
242
- setEditingCell: Dispatch<SetStateAction<MRT_Cell | null>>;
243
- setEditingRow: Dispatch<SetStateAction<MRT_Row | null>>;
242
+ setEditingCell: Dispatch<SetStateAction<MRT_Cell<TData> | null>>;
243
+ setEditingRow: Dispatch<SetStateAction<MRT_Row<TData> | null>>;
244
244
  setGlobalFilterFn: Dispatch<SetStateAction<MRT_FilterOption>>;
245
245
  setHoveredColumn: Dispatch<SetStateAction<MRT_Column<TData> | {
246
246
  id: string;
@@ -304,6 +304,12 @@ declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<Column
304
304
  footer: MRT_Header<TData>;
305
305
  table: MRT_TableInstance<TData>;
306
306
  }) => ReactNode);
307
+ GroupedCell?: ({ cell, column, row, table, }: {
308
+ cell: MRT_Cell<TData>;
309
+ column: MRT_Column<TData>;
310
+ row: MRT_Row<TData>;
311
+ table: MRT_TableInstance<TData>;
312
+ }) => ReactNode;
307
313
  Header?: ReactNode | (({ column, header, table, }: {
308
314
  column: MRT_Column<TData>;
309
315
  header: MRT_Header<TData>;
@@ -483,6 +489,9 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
483
489
  icons?: Partial<MRT_Icons>;
484
490
  initialState?: Partial<MRT_TableState<TData>>;
485
491
  localization?: Partial<MRT_Localization>;
492
+ muiBottomToolbarProps?: ToolbarProps | (({ table }: {
493
+ table: MRT_TableInstance<TData>;
494
+ }) => ToolbarProps);
486
495
  muiExpandAllButtonProps?: IconButtonProps | (({ table }: {
487
496
  table: MRT_TableInstance<TData>;
488
497
  }) => IconButtonProps);
@@ -537,9 +546,6 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
537
546
  table: MRT_TableInstance<TData>;
538
547
  row: MRT_Row<TData>;
539
548
  }) => TableRowProps);
540
- muiTableBottomToolbarProps?: ToolbarProps | (({ table }: {
541
- table: MRT_TableInstance<TData>;
542
- }) => ToolbarProps);
543
549
  muiTableContainerProps?: TableContainerProps | (({ table, }: {
544
550
  table: MRT_TableInstance<TData>;
545
551
  }) => TableContainerProps);
@@ -591,10 +597,13 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
591
597
  muiTableProps?: TableProps | (({ table }: {
592
598
  table: MRT_TableInstance<TData>;
593
599
  }) => TableProps);
594
- muiTableToolbarAlertBannerProps?: AlertProps | (({ table }: {
600
+ muiToolbarAlertBannerChipProps?: ChipProps | (({ table }: {
601
+ table: MRT_TableInstance<TData>;
602
+ }) => ChipProps);
603
+ muiToolbarAlertBannerProps?: AlertProps | (({ table }: {
595
604
  table: MRT_TableInstance<TData>;
596
605
  }) => AlertProps);
597
- muiTableTopToolbarProps?: ToolbarProps | (({ table }: {
606
+ muiTopToolbarProps?: ToolbarProps | (({ table }: {
598
607
  table: MRT_TableInstance<TData>;
599
608
  }) => ToolbarProps);
600
609
  onColumnDrop?: ({ event, draggedColumn, targetColumn, }: {
@@ -607,13 +616,13 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
607
616
  onDensityChange?: OnChangeFn<boolean>;
608
617
  onDraggingColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
609
618
  onDraggingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
619
+ onEditingCellChange?: OnChangeFn<MRT_Cell<TData> | null>;
610
620
  onEditingRowSave?: ({ exitEditingMode, row, table, values, }: {
611
621
  exitEditingMode: () => void;
612
622
  row: MRT_Row<TData>;
613
623
  table: MRT_TableInstance<TData>;
614
624
  values: Record<LiteralUnion<string & DeepKeys<TData>>, any>;
615
625
  }) => Promise<void> | void;
616
- onEditingCellChange?: OnChangeFn<MRT_Cell<TData> | null>;
617
626
  onEditingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
618
627
  onFilterFnsChange?: OnChangeFn<{
619
628
  [key: string]: MRT_FilterOption;
@@ -650,7 +659,8 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
650
659
  row: MRT_Row<TData>;
651
660
  table: MRT_TableInstance<TData>;
652
661
  }) => ReactNode[];
653
- renderRowActions?: ({ row, table, }: {
662
+ renderRowActions?: ({ cell, row, table, }: {
663
+ cell: MRT_Cell<TData>;
654
664
  row: MRT_Row<TData>;
655
665
  table: MRT_TableInstance<TData>;
656
666
  }) => ReactNode;
@@ -670,6 +680,13 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
670
680
  };
671
681
  declare const _default: <TData extends Record<string, any> = {}>({ aggregationFns, autoResetExpanded, columnResizeMode, defaultColumn, editingMode, enableBottomToolbar, enableColumnActions, enableColumnFilterChangeMode, enableColumnFilters, enableColumnOrdering, enableColumnResizing, enableDensityToggle, enableExpandAll, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableGlobalFilterChangeMode, enableGlobalFilterRankedResults, enableGrouping, enableHiding, enableMultiRowSelection, enableMultiSort, enablePagination, enablePinning, enableRowSelection, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarInternalActions, enableTopToolbar, filterFns, icons, localization, positionActionsColumn, positionExpandColumn, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, rowNumberMode, selectAllMode, sortingFns, ...rest }: MaterialReactTableProps<TData>) => JSX.Element;
672
682
 
683
+ interface Props$6<TData extends Record<string, any> = {}> {
684
+ cell: MRT_Cell<TData>;
685
+ children: ReactNode;
686
+ table: MRT_TableInstance<TData>;
687
+ }
688
+ declare const MRT_CopyButton: <TData extends Record<string, any> = {}>({ cell, children, table, }: Props$6<TData>) => JSX.Element;
689
+
673
690
  interface Props$5<TData extends Record<string, any> = {}> extends IconButtonProps {
674
691
  table: MRT_TableInstance<TData>;
675
692
  }
@@ -700,4 +717,4 @@ interface Props<TData extends Record<string, any> = {}> extends IconButtonProps
700
717
  }
701
718
  declare const MRT_ToggleGlobalFilterButton: <TData extends Record<string, any> = {}>({ table, ...rest }: Props<TData>) => JSX.Element;
702
719
 
703
- export { MRT_Cell, MRT_Column, MRT_ColumnDef, MRT_DefinedColumnDef, MRT_DisplayColumnIds, MRT_FilterFn, MRT_FilterOption, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_Header, MRT_HeaderGroup, MRT_Icons, MRT_Localization, MRT_Row, MRT_RowModel, MRT_ShowHideColumnsButton, MRT_SortingFn, MRT_SortingOption, MRT_TableInstance, MRT_TableState, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MaterialReactTableProps, _default as default };
720
+ export { MRT_Cell, MRT_Column, MRT_ColumnDef, MRT_CopyButton, MRT_DefinedColumnDef, MRT_DisplayColumnIds, MRT_FilterFn, MRT_FilterOption, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_Header, MRT_HeaderGroup, MRT_Icons, MRT_Localization, MRT_Row, MRT_RowModel, MRT_ShowHideColumnsButton, MRT_SortingFn, MRT_SortingOption, MRT_TableInstance, MRT_TableState, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MaterialReactTableProps, _default as default };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.37.1",
2
+ "version": "0.38.1",
3
3
  "license": "MIT",
4
4
  "name": "material-react-table",
5
5
  "description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
@@ -9,6 +9,7 @@ import type {
9
9
  AlertProps,
10
10
  ButtonProps,
11
11
  CheckboxProps,
12
+ ChipProps,
12
13
  IconButtonProps,
13
14
  LinearProgressProps,
14
15
  PaperProps,
@@ -108,8 +109,8 @@ export type MRT_TableInstance<TData extends Record<string, any> = {}> = Omit<
108
109
  setDensity: Dispatch<SetStateAction<'comfortable' | 'compact' | 'spacious'>>;
109
110
  setDraggingColumn: Dispatch<SetStateAction<MRT_Column<TData> | null>>;
110
111
  setDraggingRow: Dispatch<SetStateAction<MRT_Row<TData> | null>>;
111
- setEditingCell: Dispatch<SetStateAction<MRT_Cell | null>>;
112
- setEditingRow: Dispatch<SetStateAction<MRT_Row | null>>;
112
+ setEditingCell: Dispatch<SetStateAction<MRT_Cell<TData> | null>>;
113
+ setEditingRow: Dispatch<SetStateAction<MRT_Row<TData> | null>>;
113
114
  setGlobalFilterFn: Dispatch<SetStateAction<MRT_FilterOption>>;
114
115
  setHoveredColumn: Dispatch<
115
116
  SetStateAction<MRT_Column<TData> | { id: string } | null>
@@ -207,6 +208,17 @@ export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<
207
208
  footer: MRT_Header<TData>;
208
209
  table: MRT_TableInstance<TData>;
209
210
  }) => ReactNode);
211
+ GroupedCell?: ({
212
+ cell,
213
+ column,
214
+ row,
215
+ table,
216
+ }: {
217
+ cell: MRT_Cell<TData>;
218
+ column: MRT_Column<TData>;
219
+ row: MRT_Row<TData>;
220
+ table: MRT_TableInstance<TData>;
221
+ }) => ReactNode;
210
222
  Header?:
211
223
  | ReactNode
212
224
  | (({
@@ -486,6 +498,9 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
486
498
  icons?: Partial<MRT_Icons>;
487
499
  initialState?: Partial<MRT_TableState<TData>>;
488
500
  localization?: Partial<MRT_Localization>;
501
+ muiBottomToolbarProps?:
502
+ | ToolbarProps
503
+ | (({ table }: { table: MRT_TableInstance<TData> }) => ToolbarProps);
489
504
  muiExpandAllButtonProps?:
490
505
  | IconButtonProps
491
506
  | (({ table }: { table: MRT_TableInstance<TData> }) => IconButtonProps);
@@ -590,9 +605,6 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
590
605
  table: MRT_TableInstance<TData>;
591
606
  row: MRT_Row<TData>;
592
607
  }) => TableRowProps);
593
- muiTableBottomToolbarProps?:
594
- | ToolbarProps
595
- | (({ table }: { table: MRT_TableInstance<TData> }) => ToolbarProps);
596
608
  muiTableContainerProps?:
597
609
  | TableContainerProps
598
610
  | (({
@@ -693,10 +705,13 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
693
705
  muiTableProps?:
694
706
  | TableProps
695
707
  | (({ table }: { table: MRT_TableInstance<TData> }) => TableProps);
696
- muiTableToolbarAlertBannerProps?:
708
+ muiToolbarAlertBannerChipProps?:
709
+ | ChipProps
710
+ | (({ table }: { table: MRT_TableInstance<TData> }) => ChipProps);
711
+ muiToolbarAlertBannerProps?:
697
712
  | AlertProps
698
713
  | (({ table }: { table: MRT_TableInstance<TData> }) => AlertProps);
699
- muiTableTopToolbarProps?:
714
+ muiTopToolbarProps?:
700
715
  | ToolbarProps
701
716
  | (({ table }: { table: MRT_TableInstance<TData> }) => ToolbarProps);
702
717
  onColumnDrop?: ({
@@ -711,6 +726,7 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
711
726
  onDensityChange?: OnChangeFn<boolean>;
712
727
  onDraggingColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
713
728
  onDraggingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
729
+ onEditingCellChange?: OnChangeFn<MRT_Cell<TData> | null>;
714
730
  onEditingRowSave?: ({
715
731
  exitEditingMode,
716
732
  row,
@@ -722,7 +738,6 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
722
738
  table: MRT_TableInstance<TData>;
723
739
  values: Record<LiteralUnion<string & DeepKeys<TData>>, any>;
724
740
  }) => Promise<void> | void;
725
- onEditingCellChange?: OnChangeFn<MRT_Cell<TData> | null>;
726
741
  onEditingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
727
742
  onFilterFnsChange?: OnChangeFn<{ [key: string]: MRT_FilterOption }>;
728
743
  onGlobalFilterFnChange?: OnChangeFn<MRT_FilterOption>;
@@ -769,9 +784,11 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
769
784
  table: MRT_TableInstance<TData>;
770
785
  }) => ReactNode[];
771
786
  renderRowActions?: ({
787
+ cell,
772
788
  row,
773
789
  table,
774
790
  }: {
791
+ cell: MRT_Cell<TData>;
775
792
  row: MRT_Row<TData>;
776
793
  table: MRT_TableInstance<TData>;
777
794
  }) => ReactNode;
@@ -18,6 +18,7 @@ import { MRT_EditCellTextField } from '../inputs/MRT_EditCellTextField';
18
18
  import { MRT_CopyButton } from '../buttons/MRT_CopyButton';
19
19
  import type { MRT_Cell, MRT_TableInstance } from '..';
20
20
  import { MRT_TableBodyRowGrabHandle } from './MRT_TableBodyRowGrabHandle';
21
+ import { MRT_TableBodyCellValue } from './MRT_TableBodyCellValue';
21
22
 
22
23
  interface Props {
23
24
  cell: MRT_Cell;
@@ -282,27 +283,16 @@ export const MRT_TableBodyCell: FC<Props> = ({
282
283
  <MRT_EditCellTextField cell={cell} table={table} />
283
284
  ) : (enableClickToCopy || columnDef.enableClickToCopy) &&
284
285
  columnDef.enableClickToCopy !== false ? (
285
- <>
286
- <MRT_CopyButton cell={cell} table={table}>
287
- <>
288
- {row.getIsGrouped() && !cell.getIsGrouped()
289
- ? null
290
- : columnDef?.Cell?.({ cell, column, row, table }) ??
291
- cell.renderValue()}
292
- </>
293
- </MRT_CopyButton>
294
- {cell.getIsGrouped() && <> ({row.subRows?.length})</>}
295
- </>
286
+ <MRT_CopyButton cell={cell} table={table}>
287
+ <MRT_TableBodyCellValue cell={cell} table={table} />
288
+ </MRT_CopyButton>
296
289
  ) : (
297
- <>
298
- {row.getIsGrouped() && !cell.getIsGrouped()
299
- ? null
300
- : columnDef?.Cell?.({ cell, column, row, table }) ??
301
- cell.renderValue()}
302
- {cell.getIsGrouped() && <> ({row.subRows?.length ?? ''})</>}
303
- </>
290
+ <MRT_TableBodyCellValue cell={cell} table={table} />
304
291
  )}
305
292
  </>
293
+ {cell.getIsGrouped() && !columnDef.GroupedCell && (
294
+ <> ({row.subRows?.length})</>
295
+ )}
306
296
  </TableCell>
307
297
  );
308
298
  };
@@ -0,0 +1,35 @@
1
+ import React, { FC } from 'react';
2
+ import { MRT_Cell, MRT_TableInstance } from '..';
3
+
4
+ interface Props {
5
+ cell: MRT_Cell;
6
+ table: MRT_TableInstance;
7
+ }
8
+
9
+ export const MRT_TableBodyCellValue: FC<Props> = ({ cell, table }) => {
10
+ const { column, row } = cell;
11
+ const { columnDef } = column;
12
+
13
+ return (
14
+ <>
15
+ {cell.getIsAggregated() && column.columnDef.aggregationFn
16
+ ? columnDef.AggregatedCell?.({
17
+ cell,
18
+ column,
19
+ row,
20
+ table,
21
+ })
22
+ : row.getIsGrouped() && !cell.getIsGrouped()
23
+ ? null
24
+ : (cell.getIsGrouped() &&
25
+ columnDef.GroupedCell?.({
26
+ cell,
27
+ column,
28
+ row,
29
+ table,
30
+ })) ||
31
+ (columnDef?.Cell?.({ cell, column, row, table }) ??
32
+ cell.renderValue())}
33
+ </>
34
+ );
35
+ };
@@ -1,14 +1,18 @@
1
- import React, { FC, ReactNode, useState } from 'react';
1
+ import React, { ReactNode, useState } from 'react';
2
2
  import { Button, Tooltip } from '@mui/material';
3
3
  import { MRT_Cell, MRT_TableInstance } from '..';
4
4
 
5
- interface Props {
6
- cell: MRT_Cell;
5
+ interface Props<TData extends Record<string, any> = {}> {
6
+ cell: MRT_Cell<TData>;
7
7
  children: ReactNode;
8
- table: MRT_TableInstance;
8
+ table: MRT_TableInstance<TData>;
9
9
  }
10
10
 
11
- export const MRT_CopyButton: FC<Props> = ({ cell, children, table }) => {
11
+ export const MRT_CopyButton = <TData extends Record<string, any> = {}>({
12
+ cell,
13
+ children,
14
+ table,
15
+ }: Props<TData>) => {
12
16
  const {
13
17
  options: { localization, muiTableBodyCellCopyButtonProps },
14
18
  } = table;
@@ -2,7 +2,7 @@ import React, { FC, MouseEvent, useState } from 'react';
2
2
  import { IconButton, Tooltip } from '@mui/material';
3
3
  import { MRT_RowActionMenu } from '../menus/MRT_RowActionMenu';
4
4
  import { MRT_EditActionButtons } from './MRT_EditActionButtons';
5
- import type { MRT_Row, MRT_TableInstance } from '..';
5
+ import type { MRT_Cell, MRT_Row, MRT_TableInstance } from '..';
6
6
 
7
7
  const commonIconButtonStyles = {
8
8
  height: '2rem',
@@ -16,11 +16,12 @@ const commonIconButtonStyles = {
16
16
  };
17
17
 
18
18
  interface Props {
19
+ cell: MRT_Cell
19
20
  row: MRT_Row;
20
21
  table: MRT_TableInstance;
21
22
  }
22
23
 
23
- export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ row, table }) => {
24
+ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ cell, row, table }) => {
24
25
  const {
25
26
  getState,
26
27
  options: {
@@ -52,12 +53,16 @@ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ row, table }) => {
52
53
  return (
53
54
  <>
54
55
  {renderRowActions ? (
55
- <>{renderRowActions({ row, table })}</>
56
+ <>{renderRowActions({ cell, row, table })}</>
56
57
  ) : row.id === editingRow?.id && editingMode === 'row' ? (
57
58
  <MRT_EditActionButtons row={row} table={table} />
58
59
  ) : !renderRowActionMenuItems && enableEditing ? (
59
60
  <Tooltip placement="right" arrow title={localization.edit}>
60
- <IconButton sx={commonIconButtonStyles} onClick={handleStartEditMode}>
61
+ <IconButton
62
+ aria-label={localization.edit}
63
+ sx={commonIconButtonStyles}
64
+ onClick={handleStartEditMode}
65
+ >
61
66
  <EditIcon />
62
67
  </IconButton>
63
68
  </Tooltip>
@@ -70,7 +70,7 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
70
70
  if (enableGrouping && hoveredColumn?.id === 'drop-zone') {
71
71
  setHoveredColumn(null);
72
72
  }
73
- if (enableColumnOrdering && draggingColumn) {
73
+ if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
74
74
  setHoveredColumn(
75
75
  columnDef.enableColumnOrdering !== false ? column : null,
76
76
  );
@@ -151,10 +151,8 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
151
151
  ? 'sticky'
152
152
  : undefined,
153
153
  pt:
154
- columnDefType === 'group'
155
- ? 0
156
- : density === 'compact'
157
- ? '0.25'
154
+ columnDefType === 'group' || density === 'compact'
155
+ ? '0.25rem'
158
156
  : density === 'comfortable'
159
157
  ? '.75rem'
160
158
  : '1.25rem',
package/src/index.tsx CHANGED
@@ -6,6 +6,7 @@ import type { MRT_Icons } from './icons';
6
6
  import type { MRT_Localization } from './localization';
7
7
  export type { MRT_Localization, MRT_Icons };
8
8
 
9
+ import { MRT_CopyButton } from './buttons/MRT_CopyButton';
9
10
  import { MRT_FullScreenToggleButton } from './buttons/MRT_FullScreenToggleButton';
10
11
  import { MRT_GlobalFilterTextField } from './inputs/MRT_GlobalFilterTextField';
11
12
  import { MRT_ShowHideColumnsButton } from './buttons/MRT_ShowHideColumnsButton';
@@ -20,4 +21,5 @@ export {
20
21
  MRT_ToggleDensePaddingButton,
21
22
  MRT_ToggleFiltersButton,
22
23
  MRT_ToggleGlobalFilterButton,
24
+ MRT_CopyButton,
23
25
  };
@@ -49,6 +49,15 @@ export const MRT_EditCellTextField = <TData extends Record<string, any> = {}>({
49
49
  const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
50
50
  textFieldProps.onChange?.(event);
51
51
  setValue(event.target.value);
52
+ if (textFieldProps?.select && editingRow) {
53
+ setEditingRow({
54
+ ...editingRow,
55
+ _valuesCache: {
56
+ ...editingRow._valuesCache,
57
+ [column.id]: event.target.value,
58
+ },
59
+ });
60
+ }
52
61
  };
53
62
 
54
63
  const handleBlur = (event: FocusEvent<HTMLInputElement>) => {
@@ -57,7 +66,7 @@ export const MRT_EditCellTextField = <TData extends Record<string, any> = {}>({
57
66
  setEditingRow({
58
67
  ...editingRow,
59
68
  _valuesCache: { ...editingRow._valuesCache, [column.id]: value },
60
- } as any);
69
+ });
61
70
  }
62
71
  setEditingCell(null);
63
72
  };
@@ -72,7 +81,7 @@ export const MRT_EditCellTextField = <TData extends Record<string, any> = {}>({
72
81
  fullWidth
73
82
  label={showLabel ? column.columnDef.header : undefined}
74
83
  margin="none"
75
- name={cell.id}
84
+ name={column.id}
76
85
  onClick={(e: MouseEvent<HTMLInputElement>) => e.stopPropagation()}
77
86
  placeholder={columnDef.header}
78
87
  value={value}
@@ -299,7 +299,7 @@ export const MRT_FilterTextField: FC<Props> = ({
299
299
  }}
300
300
  sx={(theme) => ({
301
301
  p: 0,
302
- minWidth: !filterChipLabel ? '6rem' : 'auto',
302
+ minWidth: !filterChipLabel ? '150px' : 'auto',
303
303
  width: '100%',
304
304
  '& .MuiSelect-icon': {
305
305
  mr: '1.5rem',
@@ -131,8 +131,12 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
131
131
  id: 'mrt-row-drag',
132
132
  },
133
133
  columnOrder.includes('mrt-row-actions') && {
134
- Cell: ({ row }) => (
135
- <MRT_ToggleRowActionMenuButton row={row as any} table={table} />
134
+ Cell: ({ cell, row }) => (
135
+ <MRT_ToggleRowActionMenuButton
136
+ cell={cell as any}
137
+ row={row as any}
138
+ table={table}
139
+ />
136
140
  ),
137
141
  header: props.localization?.actions,
138
142
  size: 70,
@@ -16,7 +16,7 @@ export const MRT_BottomToolbar: FC<Props> = ({ table }) => {
16
16
  getState,
17
17
  options: {
18
18
  enablePagination,
19
- muiTableBottomToolbarProps,
19
+ muiBottomToolbarProps,
20
20
  positionPagination,
21
21
  positionToolbarAlertBanner,
22
22
  positionToolbarDropZone,
@@ -29,9 +29,9 @@ export const MRT_BottomToolbar: FC<Props> = ({ table }) => {
29
29
  const isMobile = useMediaQuery('(max-width:720px)');
30
30
 
31
31
  const toolbarProps =
32
- muiTableBottomToolbarProps instanceof Function
33
- ? muiTableBottomToolbarProps({ table })
34
- : muiTableBottomToolbarProps;
32
+ muiBottomToolbarProps instanceof Function
33
+ ? muiBottomToolbarProps({ table })
34
+ : muiBottomToolbarProps;
35
35
 
36
36
  const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions;
37
37
 
@@ -75,9 +75,7 @@ export const MRT_BottomToolbar: FC<Props> = ({ table }) => {
75
75
  }}
76
76
  >
77
77
  {renderBottomToolbarCustomActions ? (
78
- <Box sx={{ p: '0.5rem' }}>
79
- {renderBottomToolbarCustomActions({ table })}
80
- </Box>
78
+ renderBottomToolbarCustomActions({ table })
81
79
  ) : (
82
80
  <span />
83
81
  )}
@@ -15,14 +15,23 @@ export const MRT_ToolbarAlertBanner: FC<Props> = ({
15
15
  getPrePaginationRowModel,
16
16
  getSelectedRowModel,
17
17
  getState,
18
- options: { localization, muiTableToolbarAlertBannerProps },
18
+ options: {
19
+ localization,
20
+ muiToolbarAlertBannerProps,
21
+ muiToolbarAlertBannerChipProps,
22
+ },
19
23
  } = table;
20
24
  const { grouping, showAlertBanner } = getState();
21
25
 
22
26
  const alertProps =
23
- muiTableToolbarAlertBannerProps instanceof Function
24
- ? muiTableToolbarAlertBannerProps({ table })
25
- : muiTableToolbarAlertBannerProps;
27
+ muiToolbarAlertBannerProps instanceof Function
28
+ ? muiToolbarAlertBannerProps({ table })
29
+ : muiToolbarAlertBannerProps;
30
+
31
+ const chipProps =
32
+ muiToolbarAlertBannerChipProps instanceof Function
33
+ ? muiToolbarAlertBannerChipProps({ table })
34
+ : muiToolbarAlertBannerChipProps;
26
35
 
27
36
  const selectMessage =
28
37
  getSelectedRowModel().rows.length > 0
@@ -45,9 +54,9 @@ export const MRT_ToolbarAlertBanner: FC<Props> = ({
45
54
  <Fragment key={`${index}-${columnId}`}>
46
55
  {index > 0 ? localization.thenBy : ''}
47
56
  <Chip
48
- color="secondary"
49
57
  label={table.getColumn(columnId).columnDef.header}
50
58
  onDelete={() => table.getColumn(columnId).toggleGrouping()}
59
+ {...chipProps}
51
60
  />
52
61
  </Fragment>
53
62
  ))}
@@ -31,7 +31,7 @@ export const MRT_TopToolbar: FC<Props> = ({ table }) => {
31
31
  enableGlobalFilter,
32
32
  enablePagination,
33
33
  enableToolbarInternalActions,
34
- muiTableTopToolbarProps,
34
+ muiTopToolbarProps,
35
35
  positionGlobalFilter,
36
36
  positionPagination,
37
37
  positionToolbarAlertBanner,
@@ -46,9 +46,9 @@ export const MRT_TopToolbar: FC<Props> = ({ table }) => {
46
46
  const isMobile = useMediaQuery('(max-width:720px)');
47
47
 
48
48
  const toolbarProps =
49
- muiTableTopToolbarProps instanceof Function
50
- ? muiTableTopToolbarProps({ table })
51
- : muiTableTopToolbarProps;
49
+ muiTopToolbarProps instanceof Function
50
+ ? muiTopToolbarProps({ table })
51
+ : muiTopToolbarProps;
52
52
 
53
53
  const stackAlertBanner =
54
54
  isMobile || !!renderTopToolbarCustomActions || showGlobalFilter;