material-react-table 0.7.4 → 0.8.0-alpha.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.
Files changed (57) hide show
  1. package/dist/MaterialReactTable.d.ts +25 -31
  2. package/dist/body/MRT_TableBody.d.ts +0 -1
  3. package/dist/body/MRT_TableBodyCell.d.ts +1 -0
  4. package/dist/body/MRT_TableBodyRow.d.ts +0 -1
  5. package/dist/buttons/MRT_ColumnPinningButtons.d.ts +8 -0
  6. package/dist/buttons/MRT_CopyButton.d.ts +2 -1
  7. package/dist/enums.d.ts +3 -3
  8. package/dist/filtersFNs.d.ts +31 -30
  9. package/dist/footer/MRT_TableFooter.d.ts +0 -1
  10. package/dist/head/MRT_TableHead.d.ts +0 -1
  11. package/dist/inputs/MRT_FilterRangeFields.d.ts +8 -0
  12. package/dist/inputs/MRT_FilterTextField.d.ts +1 -0
  13. package/dist/localization.d.ts +7 -2
  14. package/dist/material-react-table.cjs.development.js +489 -448
  15. package/dist/material-react-table.cjs.development.js.map +1 -1
  16. package/dist/material-react-table.cjs.production.min.js +1 -1
  17. package/dist/material-react-table.cjs.production.min.js.map +1 -1
  18. package/dist/material-react-table.esm.js +492 -451
  19. package/dist/material-react-table.esm.js.map +1 -1
  20. package/dist/menus/{MRT_FilterTypeMenu.d.ts → MRT_FilterOptionMenu.d.ts} +1 -1
  21. package/dist/table/MRT_Table.d.ts +0 -1
  22. package/dist/toolbar/MRT_ToolbarTop.d.ts +1 -0
  23. package/dist/utils.d.ts +6 -6
  24. package/package.json +24 -24
  25. package/src/MaterialReactTable.tsx +39 -41
  26. package/src/body/MRT_TableBody.tsx +3 -11
  27. package/src/body/MRT_TableBodyCell.tsx +102 -51
  28. package/src/body/MRT_TableBodyRow.tsx +21 -30
  29. package/src/buttons/MRT_ColumnPinningButtons.tsx +57 -0
  30. package/src/buttons/MRT_CopyButton.tsx +3 -2
  31. package/src/buttons/MRT_EditActionButtons.tsx +1 -2
  32. package/src/buttons/MRT_ExpandAllButton.tsx +1 -2
  33. package/src/enums.ts +3 -3
  34. package/src/filtersFNs.ts +71 -81
  35. package/src/footer/MRT_TableFooter.tsx +6 -16
  36. package/src/footer/MRT_TableFooterCell.tsx +5 -7
  37. package/src/footer/MRT_TableFooterRow.tsx +5 -8
  38. package/src/head/MRT_TableHead.tsx +5 -16
  39. package/src/head/MRT_TableHeadCell.tsx +101 -44
  40. package/src/head/MRT_TableHeadRow.tsx +8 -15
  41. package/src/inputs/MRT_EditCellTextField.tsx +2 -2
  42. package/src/inputs/MRT_FilterRangeFields.tsx +41 -0
  43. package/src/inputs/MRT_FilterTextField.tsx +84 -52
  44. package/src/inputs/MRT_SearchTextField.tsx +2 -2
  45. package/src/inputs/MRT_SelectCheckbox.tsx +16 -17
  46. package/src/localization.ts +15 -5
  47. package/src/menus/MRT_ColumnActionMenu.tsx +9 -8
  48. package/src/menus/{MRT_FilterTypeMenu.tsx → MRT_FilterOptionMenu.tsx} +54 -49
  49. package/src/menus/MRT_ShowHideColumnsMenu.tsx +25 -11
  50. package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +15 -5
  51. package/src/table/MRT_Table.tsx +8 -19
  52. package/src/table/MRT_TableContainer.tsx +8 -69
  53. package/src/table/MRT_TableRoot.tsx +70 -70
  54. package/src/toolbar/MRT_LinearProgressBar.tsx +5 -2
  55. package/src/toolbar/MRT_ToolbarAlertBanner.tsx +3 -2
  56. package/src/toolbar/MRT_ToolbarTop.tsx +4 -6
  57. package/src/utils.ts +10 -10
@@ -1,47 +1,24 @@
1
1
  import React, { FC, MouseEvent } from 'react';
2
- import { TableRow } from '@mui/material';
2
+ import { darken, lighten, TableRow } from '@mui/material';
3
3
  import { MRT_TableBodyCell } from './MRT_TableBodyCell';
4
4
  import { MRT_TableDetailPanel } from './MRT_TableDetailPanel';
5
5
  import type { MRT_Row, MRT_TableInstance } from '..';
6
6
 
7
7
  interface Props {
8
- pinned: 'left' | 'center' | 'right' | 'none';
9
8
  row: MRT_Row;
10
9
  tableInstance: MRT_TableInstance;
11
10
  }
12
11
 
13
- export const MRT_TableBodyRow: FC<Props> = ({ pinned, row, tableInstance }) => {
12
+ export const MRT_TableBodyRow: FC<Props> = ({ row, tableInstance }) => {
14
13
  const {
15
14
  options: { muiTableBodyRowProps, onRowClick, renderDetailPanel },
16
15
  } = tableInstance;
17
16
 
18
- const {
19
- getCenterVisibleCells,
20
- getIsGrouped,
21
- getIsSelected,
22
- getLeftVisibleCells,
23
- getRightVisibleCells,
24
- getRowProps,
25
- getVisibleCells,
26
- } = row;
27
-
28
- const mTableBodyRowProps =
17
+ const tableRowProps =
29
18
  muiTableBodyRowProps instanceof Function
30
19
  ? muiTableBodyRowProps({ row, tableInstance })
31
20
  : muiTableBodyRowProps;
32
21
 
33
- const tableRowProps = {
34
- ...getRowProps(),
35
- ...mTableBodyRowProps,
36
- };
37
-
38
- const getVisibleCellsMap = {
39
- center: getCenterVisibleCells,
40
- left: getLeftVisibleCells,
41
- none: getVisibleCells,
42
- right: getRightVisibleCells,
43
- };
44
-
45
22
  return (
46
23
  <>
47
24
  <TableRow
@@ -49,18 +26,32 @@ export const MRT_TableBodyRow: FC<Props> = ({ pinned, row, tableInstance }) => {
49
26
  onClick={(event: MouseEvent<HTMLTableRowElement>) =>
50
27
  onRowClick?.({ event, row, tableInstance })
51
28
  }
52
- selected={getIsSelected()}
29
+ selected={row.getIsSelected()}
53
30
  {...tableRowProps}
31
+ sx={(theme) => ({
32
+ backgroundColor: lighten(theme.palette.background.default, 0.06),
33
+ transition: 'all 0.2s ease-in-out',
34
+ '&:hover td': {
35
+ backgroundColor:
36
+ tableRowProps?.hover !== false
37
+ ? theme.palette.mode === 'dark'
38
+ ? `${lighten(theme.palette.background.default, 0.12)}`
39
+ : `${darken(theme.palette.background.default, 0.05)}`
40
+ : undefined,
41
+ },
42
+ ...(tableRowProps?.sx as any),
43
+ })}
54
44
  >
55
- {getVisibleCellsMap[pinned]().map((cell) => (
45
+ {row.getVisibleCells().map((cell) => (
56
46
  <MRT_TableBodyCell
57
47
  cell={cell}
58
- key={cell.getCellProps().key}
48
+ key={cell.id}
49
+ enableHover={tableRowProps?.hover !== false}
59
50
  tableInstance={tableInstance}
60
51
  />
61
52
  ))}
62
53
  </TableRow>
63
- {renderDetailPanel && !getIsGrouped() && (
54
+ {renderDetailPanel && !row.getIsGrouped() && (
64
55
  <MRT_TableDetailPanel row={row} tableInstance={tableInstance} />
65
56
  )}
66
57
  </>
@@ -0,0 +1,57 @@
1
+ import React, { FC } from 'react';
2
+ import { Box, IconButton, Tooltip } from '@mui/material';
3
+ import type { MRT_Column, MRT_TableInstance } from '..';
4
+
5
+ interface Props {
6
+ column: MRT_Column;
7
+ tableInstance: MRT_TableInstance;
8
+ }
9
+
10
+ export const MRT_ColumnPinningButtons: FC<Props> = ({
11
+ column,
12
+ tableInstance,
13
+ }) => {
14
+ const {
15
+ options: {
16
+ icons: { PushPinIcon },
17
+ localization,
18
+ },
19
+ } = tableInstance;
20
+
21
+ const handlePinColumn = (pinDirection: 'left' | 'right' | false) => {
22
+ column.pin(pinDirection);
23
+ };
24
+
25
+ return (
26
+ <Box sx={{ mr: '8px' }}>
27
+ {column.getIsPinned() ? (
28
+ <Tooltip arrow title={localization.unpin}>
29
+ <IconButton onClick={() => handlePinColumn(false)} size="small">
30
+ <PushPinIcon />
31
+ </IconButton>
32
+ </Tooltip>
33
+ ) : (
34
+ <>
35
+ <Tooltip arrow title={localization.pinToLeft}>
36
+ <IconButton onClick={() => handlePinColumn('left')} size="small">
37
+ <PushPinIcon
38
+ style={{
39
+ transform: 'rotate(90deg)',
40
+ }}
41
+ />
42
+ </IconButton>
43
+ </Tooltip>
44
+ <Tooltip arrow title={localization.pinToRight}>
45
+ <IconButton onClick={() => handlePinColumn('right')} size="small">
46
+ <PushPinIcon
47
+ style={{
48
+ transform: 'rotate(-90deg)',
49
+ }}
50
+ />
51
+ </IconButton>
52
+ </Tooltip>
53
+ </>
54
+ )}
55
+ </Box>
56
+ );
57
+ };
@@ -1,9 +1,10 @@
1
- import React, { FC, useState } from 'react';
1
+ import React, { FC, ReactNode, useState } from 'react';
2
2
  import { Button, Tooltip } from '@mui/material';
3
3
  import { MRT_Cell, MRT_TableInstance } from '..';
4
4
 
5
5
  interface Props {
6
6
  cell: MRT_Cell;
7
+ children: ReactNode
7
8
  tableInstance: MRT_TableInstance;
8
9
  }
9
10
 
@@ -49,7 +50,7 @@ export const MRT_CopyButton: FC<Props> = ({
49
50
  >
50
51
  <Button
51
52
  aria-label={localization.clickToCopy}
52
- onClick={() => handleCopy(cell.value)}
53
+ onClick={() => handleCopy(cell.getValue())}
53
54
  size="small"
54
55
  {...buttonProps}
55
56
  sx={{
@@ -1,7 +1,6 @@
1
1
  import React, { FC } from 'react';
2
2
  import { Box, IconButton, Tooltip } from '@mui/material';
3
3
  import type { MRT_Row, MRT_TableInstance } from '..';
4
- import { RowValues } from '@tanstack/react-table';
5
4
 
6
5
  interface Props {
7
6
  row: MRT_Row;
@@ -22,7 +21,7 @@ export const MRT_EditActionButtons: FC<Props> = ({ row, tableInstance }) => {
22
21
  const { currentEditingRow } = getState();
23
22
 
24
23
  const handleCancel = () => {
25
- row.values = (row.original as RowValues) ?? {};
24
+ row._valuesCache = row.original ?? {};
26
25
  setCurrentEditingRow(null);
27
26
  };
28
27
 
@@ -13,13 +13,12 @@ export const MRT_ExpandAllButton: FC<Props> = ({ tableInstance }) => {
13
13
  getState,
14
14
  options: {
15
15
  icons: { DoubleArrowDownIcon },
16
- isLoading,
17
16
  localization,
18
17
  },
19
18
  toggleAllRowsExpanded,
20
19
  } = tableInstance;
21
20
 
22
- const { isDensePadding } = getState();
21
+ const { isDensePadding, isLoading } = getState();
23
22
 
24
23
  return (
25
24
  <IconButton
package/src/enums.ts CHANGED
@@ -1,10 +1,10 @@
1
- export enum MRT_FILTER_TYPE {
2
- BEST_MATCH = 'bestMatch',
3
- BEST_MATCH_FIRST = 'bestMatchFirst',
1
+ export enum MRT_FILTER_OPTION {
2
+ BETWEEN = 'between',
4
3
  CONTAINS = 'contains',
5
4
  EMPTY = 'empty',
6
5
  ENDS_WITH = 'endsWith',
7
6
  EQUALS = 'equals',
7
+ FUZZY = 'fuzzy',
8
8
  GREATER_THAN = 'greaterThan',
9
9
  LESS_THAN = 'lessThan',
10
10
  NOT_EMPTY = 'notEmpty',
package/src/filtersFNs.ts CHANGED
@@ -1,155 +1,145 @@
1
- import { matchSorter } from 'match-sorter';
1
+ import { rankItem, rankings, RankingInfo } from '@tanstack/match-sorter-utils';
2
2
  import { MRT_Row } from '.';
3
3
 
4
- export const bestMatchFirst = (
5
- rows: MRT_Row[],
6
- columnIds: string[] | string,
7
- filterValue: string | number,
8
- ) =>
9
- matchSorter(rows, filterValue.toString().trim(), {
10
- keys: Array.isArray(columnIds)
11
- ? columnIds.map((c) => `values.${c}`)
12
- : [`values.${columnIds}`],
13
- });
14
-
15
- bestMatchFirst.autoRemove = (val: any) => !val;
16
-
17
- export const bestMatch = (
18
- rows: MRT_Row[],
19
- columnIds: string[] | string,
20
- filterValue: string | number,
21
- ) =>
22
- matchSorter(rows, filterValue.toString().trim(), {
23
- keys: Array.isArray(columnIds)
24
- ? columnIds.map((c) => `values.${c}`)
25
- : [`values.${columnIds}`],
26
- sorter: (rankedItems) => rankedItems,
4
+ export const fuzzy = (
5
+ row: MRT_Row,
6
+ columnId: string,
7
+ value: string,
8
+ addMeta: (item: RankingInfo) => void,
9
+ ) => {
10
+ const itemRank = rankItem(row.getValue(columnId), value, {
11
+ threshold: rankings.MATCHES,
27
12
  });
13
+ addMeta(itemRank);
14
+ return itemRank.passed;
15
+ };
28
16
 
29
- bestMatch.autoRemove = (val: any) => !val;
17
+ fuzzy.autoRemove = (val: any) => !val;
30
18
 
31
19
  export const contains = (
32
- rows: MRT_Row[],
20
+ row: MRT_Row,
33
21
  id: string,
34
22
  filterValue: string | number,
35
23
  ) =>
36
- rows.filter((row) =>
37
- row.values[id]
38
- .toString()
39
- .toLowerCase()
40
- .trim()
41
- .includes(filterValue.toString().toLowerCase().trim()),
42
- );
24
+ row
25
+ .getValue(id)
26
+ .toString()
27
+ .toLowerCase()
28
+ .trim()
29
+ .includes(filterValue.toString().toLowerCase().trim());
43
30
 
44
31
  contains.autoRemove = (val: any) => !val;
45
32
 
46
33
  export const startsWith = (
47
- rows: MRT_Row[],
34
+ row: MRT_Row,
48
35
  id: string,
49
36
  filterValue: string | number,
50
37
  ) =>
51
- rows.filter((row) =>
52
- row.values[id]
53
- .toString()
54
- .toLowerCase()
55
- .trim()
56
- .startsWith(filterValue.toString().toLowerCase().trim()),
57
- );
38
+ row
39
+ .getValue(id)
40
+ .toString()
41
+ .toLowerCase()
42
+ .trim()
43
+ .startsWith(filterValue.toString().toLowerCase().trim());
58
44
 
59
45
  startsWith.autoRemove = (val: any) => !val;
60
46
 
61
47
  export const endsWith = (
62
- rows: MRT_Row[],
48
+ row: MRT_Row,
63
49
  id: string,
64
50
  filterValue: string | number,
65
51
  ) =>
66
- rows.filter((row) =>
67
- row.values[id]
68
- .toString()
69
- .toLowerCase()
70
- .trim()
71
- .endsWith(filterValue.toString().toLowerCase().trim()),
72
- );
52
+ row
53
+ .getValue(id)
54
+ .toString()
55
+ .toLowerCase()
56
+ .trim()
57
+ .endsWith(filterValue.toString().toLowerCase().trim());
73
58
 
74
59
  endsWith.autoRemove = (val: any) => !val;
75
60
 
76
61
  export const equals = (
77
- rows: MRT_Row[],
62
+ row: MRT_Row,
78
63
  id: string,
79
64
  filterValue: string | number,
80
65
  ) =>
81
- rows.filter(
82
- (row) =>
83
- row.values[id].toString().toLowerCase().trim() ===
84
- filterValue.toString().toLowerCase().trim(),
85
- );
66
+ row.getValue(id).toString().toLowerCase().trim() ===
67
+ filterValue.toString().toLowerCase().trim();
86
68
 
87
69
  equals.autoRemove = (val: any) => !val;
88
70
 
89
71
  export const notEquals = (
90
- rows: MRT_Row[],
72
+ row: MRT_Row,
91
73
  id: string,
92
74
  filterValue: string | number,
93
75
  ) =>
94
- rows.filter(
95
- (row) =>
96
- row.values[id].toString().toLowerCase().trim() !==
97
- filterValue.toString().toLowerCase().trim(),
98
- );
76
+ row.getValue(id).toString().toLowerCase().trim() !==
77
+ filterValue.toString().toLowerCase().trim();
99
78
 
100
79
  notEquals.autoRemove = (val: any) => !val;
101
80
 
102
81
  export const greaterThan = (
103
- rows: MRT_Row[],
82
+ row: MRT_Row,
104
83
  id: string,
105
84
  filterValue: string | number,
106
85
  ) =>
107
- rows.filter((row) =>
108
- !isNaN(+filterValue) && !isNaN(+row.values[id])
109
- ? +row.values[id] > +filterValue
110
- : row.values[id].toString().toLowerCase().trim() >
111
- filterValue.toString().toLowerCase().trim(),
112
- );
86
+ !isNaN(+filterValue) && !isNaN(+row.getValue(id))
87
+ ? +row.getValue(id) >= +filterValue
88
+ : row.getValue(id).toString().toLowerCase().trim() >
89
+ filterValue.toString().toLowerCase().trim();
113
90
 
114
91
  greaterThan.autoRemove = (val: any) => !val;
115
92
 
116
93
  export const lessThan = (
117
- rows: MRT_Row[],
94
+ row: MRT_Row,
118
95
  id: string,
119
96
  filterValue: string | number,
120
97
  ) =>
121
- rows.filter((row) =>
122
- !isNaN(+filterValue) && !isNaN(+row.values[id])
123
- ? +row.values[id] < +filterValue
124
- : row.values[id].toString().toLowerCase().trim() <
125
- filterValue.toString().toLowerCase().trim(),
126
- );
98
+ !isNaN(+filterValue) && !isNaN(+row.getValue(id))
99
+ ? +row.getValue(id) <= +filterValue
100
+ : row.getValue(id).toString().toLowerCase().trim() <
101
+ filterValue.toString().toLowerCase().trim();
127
102
 
128
103
  lessThan.autoRemove = (val: any) => !val;
129
104
 
105
+ export const between = (
106
+ row: MRT_Row,
107
+ id: string,
108
+ filterValues: [string | number, string | number],
109
+ ) =>
110
+ ((['', undefined] as any[]).includes(filterValues[0]) ||
111
+ greaterThan(row, id, filterValues[0])) &&
112
+ ((!isNaN(+filterValues[0]) &&
113
+ !isNaN(+filterValues[1]) &&
114
+ +filterValues[0] > +filterValues[1]) ||
115
+ (['', undefined] as any[]).includes(filterValues[1]) ||
116
+ lessThan(row, id, filterValues[1]));
117
+
118
+ between.autoRemove = (val: any) => !val;
119
+
130
120
  export const empty = (
131
- rows: MRT_Row[],
121
+ row: MRT_Row,
132
122
  id: string,
133
123
  _filterValue: string | number,
134
- ) => rows.filter((row) => !row.values[id].toString().toLowerCase().trim());
124
+ ) => !row.getValue(id).toString().trim();
135
125
 
136
126
  empty.autoRemove = (val: any) => !val;
137
127
 
138
128
  export const notEmpty = (
139
- rows: MRT_Row[],
129
+ row: MRT_Row,
140
130
  id: string,
141
131
  _filterValue: string | number,
142
- ) => rows.filter((row) => !!row.values[id].toString().toLowerCase().trim());
132
+ ) => !!row.getValue(id).toString().trim();
143
133
 
144
134
  notEmpty.autoRemove = (val: any) => !val;
145
135
 
146
136
  export const defaultFilterFNs = {
147
- bestMatch,
148
- bestMatchFirst,
137
+ between,
149
138
  contains,
150
139
  empty,
151
140
  endsWith,
152
141
  equals,
142
+ fuzzy,
153
143
  greaterThan,
154
144
  lessThan,
155
145
  notEmpty,
@@ -1,19 +1,16 @@
1
1
  import React, { FC } from 'react';
2
2
  import { TableFooter } from '@mui/material';
3
3
  import { MRT_TableFooterRow } from './MRT_TableFooterRow';
4
- import type { MRT_HeaderGroup, MRT_TableInstance } from '..';
4
+ import type { MRT_TableInstance } from '..';
5
5
 
6
6
  interface Props {
7
- pinned: 'left' | 'center' | 'right' | 'none';
8
7
  tableInstance: MRT_TableInstance;
9
8
  }
10
9
 
11
- export const MRT_TableFooter: FC<Props> = ({ pinned, tableInstance }) => {
10
+ export const MRT_TableFooter: FC<Props> = ({ tableInstance }) => {
12
11
  const {
13
- getCenterFooterGroups,
14
12
  getFooterGroups,
15
- getLeftFooterGroups,
16
- getRightFooterGroups,
13
+
17
14
  options: { muiTableFooterProps },
18
15
  } = tableInstance;
19
16
 
@@ -22,19 +19,12 @@ export const MRT_TableFooter: FC<Props> = ({ pinned, tableInstance }) => {
22
19
  ? muiTableFooterProps({ tableInstance })
23
20
  : muiTableFooterProps;
24
21
 
25
- const getFooterGroupsMap = {
26
- center: getCenterFooterGroups,
27
- left: getLeftFooterGroups,
28
- none: getFooterGroups,
29
- right: getRightFooterGroups,
30
- };
31
-
32
22
  return (
33
23
  <TableFooter {...tableFooterProps}>
34
- {getFooterGroupsMap[pinned]().map((footerGroup) => (
24
+ {getFooterGroups().map((footerGroup) => (
35
25
  <MRT_TableFooterRow
36
- footerGroup={footerGroup as MRT_HeaderGroup}
37
- key={footerGroup.getFooterGroupProps().key}
26
+ footerGroup={footerGroup as any}
27
+ key={footerGroup.id}
38
28
  tableInstance={tableInstance}
39
29
  />
40
30
  ))}
@@ -28,7 +28,6 @@ export const MRT_TableFooterCell: FC<Props> = ({ footer, tableInstance }) => {
28
28
  : column.muiTableFooterCellProps;
29
29
 
30
30
  const tableCellProps = {
31
- ...footer.getFooterProps(),
32
31
  ...mTableFooterCellProps,
33
32
  ...mcTableFooterCellProps,
34
33
  };
@@ -36,9 +35,9 @@ export const MRT_TableFooterCell: FC<Props> = ({ footer, tableInstance }) => {
36
35
  return (
37
36
  <TableCell
38
37
  align={column.columnDefType === 'group' ? 'center' : 'left'}
38
+ colSpan={footer.colSpan}
39
39
  variant="head"
40
40
  {...tableCellProps}
41
- //@ts-ignore
42
41
  sx={(theme) => ({
43
42
  backgroundColor: theme.palette.background.default,
44
43
  backgroundImage: `linear-gradient(${alpha(
@@ -46,14 +45,13 @@ export const MRT_TableFooterCell: FC<Props> = ({ footer, tableInstance }) => {
46
45
  0.05,
47
46
  )},${alpha(theme.palette.common.white, 0.05)})`,
48
47
  fontWeight: 'bold',
49
- maxWidth: `min(${column.getWidth()}px, ${column.maxWidth}px)`,
50
- minWidth: `max(${column.getWidth()}px, ${column.minWidth}px)`,
48
+ maxWidth: `${column.getSize()}px`,
49
+ minWidth: `${column.getSize()}px`,
51
50
  p: isDensePadding ? '0.5rem' : '1rem',
52
51
  transition: `all ${enableColumnResizing ? '10ms' : '0.2s'} ease-in-out`,
53
- width: column.getWidth(),
52
+ width: column.getSize(),
54
53
  verticalAlign: 'text-top',
55
- //@ts-ignore
56
- ...tableCellProps?.sx,
54
+ ...(tableCellProps?.sx as any),
57
55
  })}
58
56
  >
59
57
  {footer.isPlaceholder
@@ -19,27 +19,24 @@ export const MRT_TableFooterRow: FC<Props> = ({
19
19
  // if no content in row, skip row
20
20
  if (
21
21
  !footerGroup.headers?.some(
22
- (h) => h.column.columnDef.footer || h.column.Footer,
22
+ (h) =>
23
+ (typeof h.column.footer === 'string' && !!h.column.footer) ||
24
+ h.column.Footer,
23
25
  )
24
26
  )
25
27
  return null;
26
28
 
27
- const mTableFooterRowProps =
29
+ const tableRowProps =
28
30
  muiTableFooterRowProps instanceof Function
29
31
  ? muiTableFooterRowProps({ footerGroup, tableInstance })
30
32
  : muiTableFooterRowProps;
31
33
 
32
- const tableRowProps = {
33
- ...footerGroup.getFooterGroupProps(),
34
- ...mTableFooterRowProps,
35
- };
36
-
37
34
  return (
38
35
  <TableRow {...tableRowProps}>
39
36
  {footerGroup.headers.map((footer: MRT_Header) => (
40
37
  <MRT_TableFooterCell
41
38
  footer={footer}
42
- key={footer.getFooterProps().key}
39
+ key={footer.id}
43
40
  tableInstance={tableInstance}
44
41
  />
45
42
  ))}
@@ -1,19 +1,15 @@
1
1
  import React, { FC } from 'react';
2
2
  import { TableHead } from '@mui/material';
3
3
  import { MRT_TableHeadRow } from './MRT_TableHeadRow';
4
- import type { MRT_HeaderGroup, MRT_TableInstance } from '..';
4
+ import type { MRT_TableInstance } from '..';
5
5
 
6
6
  interface Props {
7
- pinned: 'left' | 'center' | 'right' | 'none';
8
7
  tableInstance: MRT_TableInstance;
9
8
  }
10
9
 
11
- export const MRT_TableHead: FC<Props> = ({ pinned, tableInstance }) => {
10
+ export const MRT_TableHead: FC<Props> = ({ tableInstance }) => {
12
11
  const {
13
- getCenterHeaderGroups,
14
12
  getHeaderGroups,
15
- getLeftHeaderGroups,
16
- getRightHeaderGroups,
17
13
  options: { muiTableHeadProps },
18
14
  } = tableInstance;
19
15
 
@@ -22,19 +18,12 @@ export const MRT_TableHead: FC<Props> = ({ pinned, tableInstance }) => {
22
18
  ? muiTableHeadProps({ tableInstance })
23
19
  : muiTableHeadProps;
24
20
 
25
- const getHeaderGroupsMap = {
26
- center: getCenterHeaderGroups,
27
- left: getLeftHeaderGroups,
28
- none: getHeaderGroups,
29
- right: getRightHeaderGroups,
30
- };
31
-
32
21
  return (
33
22
  <TableHead {...tableHeadProps}>
34
- {getHeaderGroupsMap[pinned]().map((headerGroup) => (
23
+ {getHeaderGroups().map((headerGroup) => (
35
24
  <MRT_TableHeadRow
36
- headerGroup={headerGroup as MRT_HeaderGroup}
37
- key={headerGroup.getHeaderGroupProps().key}
25
+ headerGroup={headerGroup as any}
26
+ key={headerGroup.id}
38
27
  tableInstance={tableInstance}
39
28
  />
40
29
  ))}