material-react-table 1.0.0-beta.2 → 1.0.0-beta.5

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,7 +1,7 @@
1
1
  import { FC } from 'react';
2
2
  import { MRT_TableInstance } from '..';
3
3
  interface Props {
4
- stackAlertBanner?: boolean;
4
+ stackAlertBanner: boolean;
5
5
  table: MRT_TableInstance;
6
6
  }
7
7
  export declare const MRT_ToolbarAlertBanner: FC<Props>;
package/dist/index.d.ts CHANGED
@@ -154,6 +154,8 @@ interface MRT_Localization {
154
154
  max: string;
155
155
  min: string;
156
156
  move: string;
157
+ noRecordsToDisplay: string;
158
+ noResultsFound: string;
157
159
  or: string;
158
160
  pinToLeft: string;
159
161
  pinToRight: string;
@@ -517,7 +519,7 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
517
519
  muiExpandAllButtonProps?: IconButtonProps | (({ table }: {
518
520
  table: MRT_TableInstance<TData>;
519
521
  }) => IconButtonProps);
520
- muiExpandButtonProps?: IconButtonProps | (({ table, }: {
522
+ muiExpandButtonProps?: IconButtonProps | (({ row, table, }: {
521
523
  table: MRT_TableInstance<TData>;
522
524
  row: MRT_Row<TData>;
523
525
  }) => IconButtonProps);
@@ -553,9 +555,11 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
553
555
  row: MRT_Row<TData>;
554
556
  table: MRT_TableInstance<TData>;
555
557
  }) => TableCellProps);
556
- muiTableBodyCellSkeletonProps?: SkeletonProps | (({ table, cell, }: {
557
- table: MRT_TableInstance<TData>;
558
+ muiTableBodyCellSkeletonProps?: SkeletonProps | (({ cell, column, row, table, }: {
558
559
  cell: MRT_Cell<TData>;
560
+ column: MRT_Column<TData>;
561
+ row: MRT_Row<TData>;
562
+ table: MRT_TableInstance<TData>;
559
563
  }) => SkeletonProps);
560
564
  muiTableBodyProps?: TableBodyProps | (({ table }: {
561
565
  table: MRT_TableInstance<TData>;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.0-beta.2",
2
+ "version": "1.0.0-beta.5",
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.",
@@ -541,6 +541,7 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
541
541
  muiExpandButtonProps?:
542
542
  | IconButtonProps
543
543
  | (({
544
+ row,
544
545
  table,
545
546
  }: {
546
547
  table: MRT_TableInstance<TData>;
@@ -612,11 +613,15 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
612
613
  muiTableBodyCellSkeletonProps?:
613
614
  | SkeletonProps
614
615
  | (({
615
- table,
616
616
  cell,
617
+ column,
618
+ row,
619
+ table,
617
620
  }: {
618
- table: MRT_TableInstance<TData>;
619
621
  cell: MRT_Cell<TData>;
622
+ column: MRT_Column<TData>;
623
+ row: MRT_Row<TData>;
624
+ table: MRT_TableInstance<TData>;
620
625
  }) => SkeletonProps);
621
626
  muiTableBodyProps?:
622
627
  | TableBodyProps
@@ -1,7 +1,7 @@
1
1
  import React, { FC, useMemo } from 'react';
2
2
  import { useVirtual } from 'react-virtual'; //stuck on v2 for now
3
3
  // import { useVirtualizer, Virtualizer } from '@tanstack/react-virtual';
4
- import { TableBody } from '@mui/material';
4
+ import { Box, TableBody, TableCell, TableRow } from '@mui/material';
5
5
  import { MRT_TableBodyRow } from './MRT_TableBodyRow';
6
6
  import { rankGlobalFuzzy } from '../sortingFns';
7
7
  import type { MRT_Row, MRT_TableInstance } from '..';
@@ -19,6 +19,7 @@ export const MRT_TableBody: FC<Props> = ({ table }) => {
19
19
  enableGlobalFilterRankedResults,
20
20
  enablePagination,
21
21
  enableRowVirtualization,
22
+ localization,
22
23
  manualFiltering,
23
24
  manualSorting,
24
25
  muiTableBodyProps,
@@ -27,7 +28,7 @@ export const MRT_TableBody: FC<Props> = ({ table }) => {
27
28
  },
28
29
  refs: { tableContainerRef },
29
30
  } = table;
30
- const { globalFilter, pagination, sorting } = getState();
31
+ const { columnFilters, globalFilter, pagination, sorting } = getState();
31
32
 
32
33
  const tableBodyProps =
33
34
  muiTableBodyProps instanceof Function
@@ -116,33 +117,54 @@ export const MRT_TableBody: FC<Props> = ({ table }) => {
116
117
 
117
118
  return (
118
119
  <TableBody {...tableBodyProps}>
119
- {enableRowVirtualization && paddingTop > 0 && (
120
- <tr>
121
- <td style={{ height: `${paddingTop}px` }} />
122
- </tr>
123
- )}
124
- {(enableRowVirtualization ? virtualRows : rows).map(
125
- (rowOrVirtualRow: any, rowIndex: number) => {
126
- const row = enableRowVirtualization
127
- ? (rows[rowOrVirtualRow.index] as MRT_Row)
128
- : (rowOrVirtualRow as MRT_Row);
129
- return (
130
- <MRT_TableBodyRow
131
- key={row.id}
132
- row={row}
133
- rowIndex={
134
- enableRowVirtualization ? rowOrVirtualRow.index : rowIndex
135
- }
136
- table={table}
137
- virtualRow={enableRowVirtualization ? rowOrVirtualRow : null}
138
- />
139
- );
140
- },
141
- )}
142
- {enableRowVirtualization && paddingBottom > 0 && (
143
- <tr>
144
- <td style={{ height: `${paddingBottom}px` }} />
145
- </tr>
120
+ {!rows.length ? (
121
+ <TableRow>
122
+ <TableCell colSpan={table.getVisibleLeafColumns().length}>
123
+ <Box
124
+ sx={{
125
+ maxWidth: '100vw',
126
+ py: '2rem',
127
+ textAlign: 'center',
128
+ width: '100%',
129
+ }}
130
+ >
131
+ {globalFilter || columnFilters.length
132
+ ? localization.noResultsFound
133
+ : localization.noRecordsToDisplay}
134
+ </Box>
135
+ </TableCell>
136
+ </TableRow>
137
+ ) : (
138
+ <>
139
+ {enableRowVirtualization && paddingTop > 0 && (
140
+ <tr>
141
+ <td style={{ height: `${paddingTop}px` }} />
142
+ </tr>
143
+ )}
144
+ {(enableRowVirtualization ? virtualRows : rows).map(
145
+ (rowOrVirtualRow: any, rowIndex: number) => {
146
+ const row = enableRowVirtualization
147
+ ? (rows[rowOrVirtualRow.index] as MRT_Row)
148
+ : (rowOrVirtualRow as MRT_Row);
149
+ return (
150
+ <MRT_TableBodyRow
151
+ key={row.id}
152
+ row={row}
153
+ rowIndex={
154
+ enableRowVirtualization ? rowOrVirtualRow.index : rowIndex
155
+ }
156
+ table={table}
157
+ virtualRow={enableRowVirtualization ? rowOrVirtualRow : null}
158
+ />
159
+ );
160
+ },
161
+ )}
162
+ {enableRowVirtualization && paddingBottom > 0 && (
163
+ <tr>
164
+ <td style={{ height: `${paddingBottom}px` }} />
165
+ </tr>
166
+ )}
167
+ </>
146
168
  )}
147
169
  </TableBody>
148
170
  );
@@ -6,19 +6,13 @@ import React, {
6
6
  useEffect,
7
7
  useState,
8
8
  } from 'react';
9
- import {
10
- alpha,
11
- darken,
12
- lighten,
13
- Skeleton,
14
- TableCell,
15
- useTheme,
16
- } from '@mui/material';
9
+ import { darken, lighten, Skeleton, TableCell, useTheme } from '@mui/material';
17
10
  import { MRT_EditCellTextField } from '../inputs/MRT_EditCellTextField';
18
11
  import { MRT_CopyButton } from '../buttons/MRT_CopyButton';
19
- import type { MRT_Cell, MRT_TableInstance } from '..';
20
12
  import { MRT_TableBodyRowGrabHandle } from './MRT_TableBodyRowGrabHandle';
21
13
  import { MRT_TableBodyCellValue } from './MRT_TableBodyCellValue';
14
+ import { getCommonCellStyles } from '../column.utils';
15
+ import type { MRT_Cell, MRT_TableInstance } from '..';
22
16
 
23
17
  interface Props {
24
18
  cell: MRT_Cell;
@@ -82,6 +76,11 @@ export const MRT_TableBodyCell: FC<Props> = ({
82
76
  ...mcTableCellBodyProps,
83
77
  };
84
78
 
79
+ const skeletonProps =
80
+ muiTableBodyCellSkeletonProps instanceof Function
81
+ ? muiTableBodyCellSkeletonProps({ cell, column, row, table })
82
+ : muiTableBodyCellSkeletonProps;
83
+
85
84
  const isEditable =
86
85
  (enableEditing || columnDef.enableEditing) &&
87
86
  columnDef.enableEditing !== false;
@@ -127,23 +126,6 @@ export const MRT_TableBodyCell: FC<Props> = ({
127
126
  }
128
127
  };
129
128
 
130
- const getIsLastLeftPinnedColumn = () => {
131
- return (
132
- column.getIsPinned() === 'left' &&
133
- table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex()
134
- );
135
- };
136
-
137
- const getIsFirstRightPinnedColumn = () => {
138
- return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
139
- };
140
-
141
- const getTotalRight = () => {
142
- return (
143
- (table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 150
144
- );
145
- };
146
-
147
129
  const handleDragEnter = (e: DragEvent<HTMLTableCellElement>) => {
148
130
  tableCellProps?.onDragEnter?.(e);
149
131
  if (enableGrouping && hoveredColumn?.id === 'drop-zone') {
@@ -185,23 +167,7 @@ export const MRT_TableBodyCell: FC<Props> = ({
185
167
  onDragEnter={handleDragEnter}
186
168
  onDoubleClick={handleDoubleClick}
187
169
  sx={(theme) => ({
188
- backgroundColor: column.getIsPinned()
189
- ? alpha(lighten(theme.palette.background.default, 0.04), 0.95)
190
- : undefined,
191
- boxShadow: getIsLastLeftPinnedColumn()
192
- ? `4px 0 4px -2px ${alpha(theme.palette.common.black, 0.1)}`
193
- : getIsFirstRightPinnedColumn()
194
- ? `-4px 0 4px -2px ${alpha(theme.palette.common.black, 0.1)}`
195
- : undefined,
196
170
  cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'text',
197
- left:
198
- column.getIsPinned() === 'left'
199
- ? `${column.getStart('left')}px`
200
- : undefined,
201
- opacity:
202
- draggingColumn?.id === column.id || hoveredColumn?.id === column.id
203
- ? 0.5
204
- : 1,
205
171
  overflow: 'hidden',
206
172
  p:
207
173
  density === 'compact'
@@ -226,18 +192,10 @@ export const MRT_TableBodyCell: FC<Props> = ({
226
192
  : 1.25)
227
193
  }rem`
228
194
  : undefined,
229
- position: column.getIsPinned() ? 'sticky' : 'relative',
230
- right:
231
- column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined,
232
195
  textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined,
233
- transition: 'all 0.2s ease-in-out',
234
196
  whiteSpace: density === 'compact' ? 'nowrap' : 'normal',
235
197
  zIndex:
236
- draggingColumn?.id === column.id
237
- ? 2
238
- : column.getIsPinned()
239
- ? 1
240
- : undefined,
198
+ draggingColumn?.id === column.id ? 2 : column.getIsPinned() ? 1 : 0,
241
199
  '&:hover': {
242
200
  backgroundColor:
243
201
  enableHover &&
@@ -249,13 +207,8 @@ export const MRT_TableBodyCell: FC<Props> = ({
249
207
  : `${darken(theme.palette.background.default, 0.1)} !important`
250
208
  : undefined,
251
209
  },
252
- ...(tableCellProps?.sx instanceof Function
253
- ? tableCellProps.sx(theme)
254
- : (tableCellProps?.sx as any)),
210
+ ...getCommonCellStyles({ column, table, theme, tableCellProps }),
255
211
  ...draggingBorders,
256
- maxWidth: `min(${column.getSize()}px, fit-content)`,
257
- minWidth: `max(${column.getSize()}px, ${columnDef.minSize ?? 30}px)`,
258
- width: column.getSize(),
259
212
  })}
260
213
  >
261
214
  <>
@@ -264,7 +217,7 @@ export const MRT_TableBodyCell: FC<Props> = ({
264
217
  animation="wave"
265
218
  height={20}
266
219
  width={skeletonWidth}
267
- {...muiTableBodyCellSkeletonProps}
220
+ {...skeletonProps}
268
221
  />
269
222
  ) : enableRowNumbers &&
270
223
  rowNumberMode === 'static' &&
@@ -1,4 +1,4 @@
1
- import React, { FC } from 'react';
1
+ import React, { FC, memo } from 'react';
2
2
  import { MRT_Cell, MRT_TableInstance } from '..';
3
3
 
4
4
  interface Props {
@@ -6,7 +6,7 @@ interface Props {
6
6
  table: MRT_TableInstance;
7
7
  }
8
8
 
9
- export const MRT_TableBodyCellValue: FC<Props> = ({ cell, table }) => {
9
+ const _MRT_TableBodyCellValue: FC<Props> = ({ cell, table }) => {
10
10
  const { column, row } = cell;
11
11
  const { columnDef } = column;
12
12
 
@@ -32,3 +32,8 @@ export const MRT_TableBodyCellValue: FC<Props> = ({ cell, table }) => {
32
32
  </>
33
33
  );
34
34
  };
35
+
36
+ export const MRT_TableBodyCellValue = memo(
37
+ _MRT_TableBodyCellValue,
38
+ (prev, next) => prev.cell.getValue() === next.cell.getValue(),
39
+ );
@@ -1,4 +1,5 @@
1
1
  import { ColumnOrderState, GroupingState } from '@tanstack/react-table';
2
+ import { alpha, lighten, TableCellProps, Theme } from '@mui/material';
2
3
  import {
3
4
  MaterialReactTableProps,
4
5
  MRT_Column,
@@ -6,6 +7,8 @@ import {
6
7
  MRT_DefinedColumnDef,
7
8
  MRT_DisplayColumnIds,
8
9
  MRT_FilterOption,
10
+ MRT_Header,
11
+ MRT_TableInstance,
9
12
  } from '.';
10
13
  import { MRT_FilterFns } from './filterFns';
11
14
  import { MRT_SortingFns } from './sortingFns';
@@ -165,3 +168,72 @@ export const getDefaultColumnFilterFn = <
165
168
  if (columnDef.filterVariant === 'range') return 'betweenInclusive';
166
169
  return 'fuzzy';
167
170
  };
171
+
172
+ export const getIsLastLeftPinnedColumn = (
173
+ table: MRT_TableInstance,
174
+ column: MRT_Column,
175
+ ) => {
176
+ return (
177
+ column.getIsPinned() === 'left' &&
178
+ table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex()
179
+ );
180
+ };
181
+
182
+ export const getIsFirstRightPinnedColumn = (column: MRT_Column) => {
183
+ return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
184
+ };
185
+
186
+ export const getTotalRight = (table: MRT_TableInstance, column: MRT_Column) => {
187
+ return (
188
+ (table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 160
189
+ );
190
+ };
191
+
192
+ export const getCommonCellStyles = ({
193
+ column,
194
+ header,
195
+ table,
196
+ tableCellProps,
197
+ theme,
198
+ }: {
199
+ column: MRT_Column;
200
+ header?: MRT_Header;
201
+ table: MRT_TableInstance;
202
+ tableCellProps: TableCellProps;
203
+ theme: Theme;
204
+ }) => ({
205
+ backgroundColor:
206
+ column.getIsPinned() && column.columnDef.columnDefType !== 'group'
207
+ ? alpha(lighten(theme.palette.background.default, 0.04), 0.95)
208
+ : 'inherit',
209
+ backgroundImage: 'inherit',
210
+ boxShadow: getIsLastLeftPinnedColumn(table, column)
211
+ ? `-4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
212
+ : getIsFirstRightPinnedColumn(column)
213
+ ? `4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
214
+ : undefined,
215
+ left:
216
+ column.getIsPinned() === 'left'
217
+ ? `${column.getStart('left')}px`
218
+ : undefined,
219
+ opacity:
220
+ table.getState().draggingColumn?.id === column.id ||
221
+ table.getState().hoveredColumn?.id === column.id
222
+ ? 0.5
223
+ : 1,
224
+ position:
225
+ column.getIsPinned() && column.columnDef.columnDefType !== 'group'
226
+ ? 'sticky'
227
+ : undefined,
228
+ right:
229
+ column.getIsPinned() === 'right'
230
+ ? `${getTotalRight(table, column)}px`
231
+ : undefined,
232
+ transition: `all ${column.getIsResizing() ? 0 : '0.2s'} ease-in-out`,
233
+ ...(tableCellProps?.sx instanceof Function
234
+ ? tableCellProps.sx(theme)
235
+ : (tableCellProps?.sx as any)),
236
+ maxWidth: `min(${column.getSize()}px, fit-content)`,
237
+ minWidth: `max(${column.getSize()}px, ${column.columnDef.minSize ?? 30}px)`,
238
+ width: header?.getSize() ?? column.getSize(),
239
+ });
@@ -1,5 +1,6 @@
1
1
  import React, { FC } from 'react';
2
- import { alpha, TableCell } from '@mui/material';
2
+ import { TableCell } from '@mui/material';
3
+ import { getCommonCellStyles } from '../column.utils';
3
4
  import type { MRT_Header, MRT_TableInstance } from '..';
4
5
 
5
6
  interface Props {
@@ -10,7 +11,7 @@ interface Props {
10
11
  export const MRT_TableFooterCell: FC<Props> = ({ footer, table }) => {
11
12
  const {
12
13
  getState,
13
- options: { muiTableFooterCellProps, enableColumnResizing },
14
+ options: { muiTableFooterCellProps },
14
15
  } = table;
15
16
  const { density } = getState();
16
17
  const { column } = footer;
@@ -39,26 +40,15 @@ export const MRT_TableFooterCell: FC<Props> = ({ footer, table }) => {
39
40
  variant="head"
40
41
  {...tableCellProps}
41
42
  sx={(theme) => ({
42
- backgroundColor: theme.palette.background.default,
43
- backgroundImage: `linear-gradient(${alpha(
44
- theme.palette.common.white,
45
- 0.05,
46
- )},${alpha(theme.palette.common.white, 0.05)})`,
47
43
  fontWeight: 'bold',
48
- maxWidth: `${column.getSize()}px`,
49
- minWidth: `${column.getSize()}px`,
50
44
  p:
51
45
  density === 'compact'
52
46
  ? '0.5rem'
53
47
  : density === 'comfortable'
54
48
  ? '1rem'
55
49
  : '1.5rem',
56
- transition: `all ${enableColumnResizing ? '10ms' : '0.2s'} ease-in-out`,
57
- width: column.getSize(),
58
- verticalAlign: 'text-top',
59
- ...(tableCellProps?.sx instanceof Function
60
- ? tableCellProps.sx(theme)
61
- : (tableCellProps?.sx as any)),
50
+ verticalAlign: 'top',
51
+ ...getCommonCellStyles({ column, table, theme, tableCellProps }),
62
52
  })}
63
53
  >
64
54
  <>
@@ -1,11 +1,12 @@
1
1
  import React, { DragEvent, FC, ReactNode } from 'react';
2
- import { Box, TableCell, Theme, alpha, lighten, useTheme } from '@mui/material';
2
+ import { Box, TableCell, Theme, useTheme } from '@mui/material';
3
3
  import { MRT_TableHeadCellColumnActionsButton } from './MRT_TableHeadCellColumnActionsButton';
4
4
  import { MRT_TableHeadCellFilterContainer } from './MRT_TableHeadCellFilterContainer';
5
5
  import { MRT_TableHeadCellFilterLabel } from './MRT_TableHeadCellFilterLabel';
6
6
  import { MRT_TableHeadCellGrabHandle } from './MRT_TableHeadCellGrabHandle';
7
7
  import { MRT_TableHeadCellResizeHandle } from './MRT_TableHeadCellResizeHandle';
8
8
  import { MRT_TableHeadCellSortLabel } from './MRT_TableHeadCellSortLabel';
9
+ import { getCommonCellStyles } from '../column.utils';
9
10
  import type { MRT_Header, MRT_TableInstance } from '..';
10
11
 
11
12
  interface Props {
@@ -21,7 +22,6 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
21
22
  enableColumnActions,
22
23
  enableColumnDragging,
23
24
  enableColumnOrdering,
24
- enableColumnResizing,
25
25
  enableGrouping,
26
26
  enableMultiSort,
27
27
  muiTableHeadCellProps,
@@ -54,23 +54,6 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
54
54
  ...mcTableHeadCellProps,
55
55
  };
56
56
 
57
- const getIsLastLeftPinnedColumn = () => {
58
- return (
59
- column.getIsPinned() === 'left' &&
60
- table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex()
61
- );
62
- };
63
-
64
- const getIsFirstRightPinnedColumn = () => {
65
- return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
66
- };
67
-
68
- const getTotalRight = () => {
69
- return (
70
- (table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 180
71
- );
72
- };
73
-
74
57
  const handleDragEnter = (_e: DragEvent) => {
75
58
  if (enableGrouping && hoveredColumn?.id === 'drop-zone') {
76
59
  setHoveredColumn(null);
@@ -115,26 +98,8 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
115
98
  ref={tableHeadCellRef}
116
99
  {...tableCellProps}
117
100
  sx={(theme: Theme) => ({
118
- backgroundColor:
119
- column.getIsPinned() && columnDefType !== 'group'
120
- ? alpha(lighten(theme.palette.background.default, 0.04), 0.95)
121
- : 'inherit',
122
- backgroundImage: 'inherit',
123
- boxShadow: getIsLastLeftPinnedColumn()
124
- ? `4px 0 4px -2px ${alpha(theme.palette.common.black, 0.1)}`
125
- : getIsFirstRightPinnedColumn()
126
- ? `-4px 0 4px -2px ${alpha(theme.palette.common.black, 0.1)}`
127
- : undefined,
128
101
  fontWeight: 'bold',
129
- left:
130
- column.getIsPinned() === 'left'
131
- ? `${column.getStart('left')}px`
132
- : undefined,
133
102
  overflow: 'visible',
134
- opacity:
135
- draggingColumn?.id === column.id || hoveredColumn?.id === column.id
136
- ? 0.5
137
- : 1,
138
103
  p:
139
104
  density === 'compact'
140
105
  ? '0.5rem'
@@ -151,19 +116,12 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
151
116
  : showColumnFilters || density === 'compact'
152
117
  ? '0.4rem'
153
118
  : '0.6rem',
154
- position:
155
- column.getIsPinned() && columnDefType !== 'group'
156
- ? 'sticky'
157
- : undefined,
158
119
  pt:
159
120
  columnDefType === 'group' || density === 'compact'
160
121
  ? '0.25rem'
161
122
  : density === 'comfortable'
162
123
  ? '.75rem'
163
124
  : '1.25rem',
164
- right:
165
- column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined,
166
- transition: `all ${enableColumnResizing ? 0 : '0.2s'} ease-in-out`,
167
125
  userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined,
168
126
  verticalAlign: 'top',
169
127
  zIndex:
@@ -172,13 +130,14 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
172
130
  : column.getIsPinned() && columnDefType !== 'group'
173
131
  ? 2
174
132
  : 1,
175
- ...(tableCellProps?.sx instanceof Function
176
- ? tableCellProps.sx(theme)
177
- : (tableCellProps?.sx as any)),
133
+ ...getCommonCellStyles({
134
+ column,
135
+ header,
136
+ table,
137
+ tableCellProps,
138
+ theme,
139
+ }),
178
140
  ...draggingBorders,
179
- maxWidth: `min(${column.getSize()}px, fit-content)`,
180
- minWidth: `max(${column.getSize()}px, ${columnDef.minSize ?? 30}px)`,
181
- width: header.getSize(),
182
141
  })}
183
142
  >
184
143
  {header.isPlaceholder ? null : (
@@ -47,6 +47,8 @@ export interface MRT_Localization {
47
47
  max: string;
48
48
  min: string;
49
49
  move: string;
50
+ noRecordsToDisplay: string;
51
+ noResultsFound: string;
50
52
  or: string;
51
53
  pinToLeft: string;
52
54
  pinToRight: string;
@@ -129,6 +131,8 @@ export const MRT_DefaultLocalization_EN: MRT_Localization = {
129
131
  max: 'Max',
130
132
  min: 'Min',
131
133
  move: 'Move',
134
+ noRecordsToDisplay: 'No records to display',
135
+ noResultsFound: 'No results found',
132
136
  or: 'or',
133
137
  pinToLeft: 'Pin to left',
134
138
  pinToRight: 'Pin to right',
@@ -327,7 +327,9 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
327
327
  >
328
328
  <MRT_TablePaper table={table as any} />
329
329
  </Dialog>
330
- {!table.getState().isFullScreen && <MRT_TablePaper table={table as any} />}
330
+ {!table.getState().isFullScreen && (
331
+ <MRT_TablePaper table={table as any} />
332
+ )}
331
333
  {editingRow && props.editingMode === 'modal' && (
332
334
  <MRT_EditRowModal row={editingRow as any} table={table} open />
333
335
  )}
@@ -62,14 +62,17 @@ export const MRT_BottomToolbar: FC<Props> = ({ table }) => {
62
62
  >
63
63
  <MRT_LinearProgressBar isTopToolbar={false} table={table} />
64
64
  {positionToolbarAlertBanner === 'bottom' && (
65
- <MRT_ToolbarAlertBanner table={table} />
65
+ <MRT_ToolbarAlertBanner
66
+ stackAlertBanner={stackAlertBanner}
67
+ table={table}
68
+ />
66
69
  )}
67
70
  {['both', 'bottom'].includes(positionToolbarDropZone ?? '') && (
68
71
  <MRT_ToolbarDropZone table={table} />
69
72
  )}
70
73
  <Box
71
74
  sx={{
72
- alignItems: 'flex-start',
75
+ alignItems: 'center',
73
76
  boxSizing: 'border-box',
74
77
  display: 'flex',
75
78
  justifyContent: 'space-between',
@@ -3,7 +3,7 @@ import { Alert, AlertTitle, Box, Chip, Collapse } from '@mui/material';
3
3
  import { MRT_TableInstance } from '..';
4
4
 
5
5
  interface Props {
6
- stackAlertBanner?: boolean;
6
+ stackAlertBanner: boolean;
7
7
  table: MRT_TableInstance;
8
8
  }
9
9
 
@@ -19,6 +19,7 @@ export const MRT_ToolbarAlertBanner: FC<Props> = ({
19
19
  localization,
20
20
  muiToolbarAlertBannerProps,
21
21
  muiToolbarAlertBannerChipProps,
22
+ positionToolbarAlertBanner,
22
23
  },
23
24
  } = table;
24
25
  const { grouping, showAlertBanner } = getState();
@@ -78,6 +79,11 @@ export const MRT_ToolbarAlertBanner: FC<Props> = ({
78
79
  left: 0,
79
80
  p: 0,
80
81
  position: 'relative',
82
+ mb: stackAlertBanner
83
+ ? 0
84
+ : positionToolbarAlertBanner === 'bottom'
85
+ ? '-1rem'
86
+ : undefined,
81
87
  right: 0,
82
88
  top: 0,
83
89
  width: '100%',