material-react-table 1.4.1 → 1.4.3

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.1",
2
+ "version": "1.4.3",
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.",
@@ -57,17 +57,17 @@
57
57
  "@babel/preset-react": "^7.18.6",
58
58
  "@emotion/react": "^11.10.5",
59
59
  "@emotion/styled": "^11.10.5",
60
- "@mui/icons-material": "^5.10.16",
61
- "@mui/material": "^5.10.17",
60
+ "@mui/icons-material": "^5.11.0",
61
+ "@mui/material": "^5.11.0",
62
62
  "@rollup/plugin-babel": "^6.0.3",
63
63
  "@rollup/plugin-node-resolve": "^15.0.1",
64
64
  "@rollup/plugin-typescript": "^10.0.1",
65
65
  "@size-limit/preset-small-lib": "^8.1.0",
66
- "@types/node": "^18.11.11",
66
+ "@types/node": "^18.11.15",
67
67
  "@types/react": "^18.0.26",
68
68
  "@types/react-dom": "^18.0.9",
69
- "@typescript-eslint/eslint-plugin": "^5.46.0",
70
- "@typescript-eslint/parser": "^5.46.0",
69
+ "@typescript-eslint/eslint-plugin": "^5.46.1",
70
+ "@typescript-eslint/parser": "^5.46.1",
71
71
  "eslint": "^8.29.0",
72
72
  "eslint-plugin-mui-path-imports": "^0.0.7",
73
73
  "react": "^18.2.0",
@@ -104,63 +104,65 @@ export const MRT_TableBody: FC<Props> = ({ table }) => {
104
104
  sx={(theme) => ({
105
105
  display: layoutMode === 'grid' ? 'grid' : 'table-row-group',
106
106
  height: virtualizer ? `${virtualizer.getTotalSize()}px` : 'inherit',
107
+ minHeight: !rows.length ? '100px' : undefined,
107
108
  position: 'relative',
108
109
  ...(tableBodyProps?.sx instanceof Function
109
110
  ? tableBodyProps?.sx(theme)
110
111
  : (tableBodyProps?.sx as any)),
111
112
  })}
112
113
  >
113
- {tableBodyProps?.children ?? !rows.length ? (
114
- <tr style={{ display: layoutMode === 'grid' ? 'grid' : 'table-row' }}>
115
- <td
116
- colSpan={table.getVisibleLeafColumns().length}
117
- style={{ display: layoutMode === 'grid' ? 'grid' : 'table-cell' }}
118
- >
119
- <Typography
120
- sx={{
121
- color: 'text.secondary',
122
- fontStyle: 'italic',
123
- maxWidth: `min(100vw, ${
124
- tablePaperRef.current?.clientWidth ?? 360
125
- }px)`,
126
- py: '2rem',
127
- textAlign: 'center',
128
- width: '100%',
129
- }}
114
+ {tableBodyProps?.children ??
115
+ (!rows.length ? (
116
+ <tr style={{ display: layoutMode === 'grid' ? 'grid' : 'table-row' }}>
117
+ <td
118
+ colSpan={table.getVisibleLeafColumns().length}
119
+ style={{ display: layoutMode === 'grid' ? 'grid' : 'table-cell' }}
130
120
  >
131
- {globalFilter || columnFilters.length
132
- ? localization.noResultsFound
133
- : localization.noRecordsToDisplay}
134
- </Typography>
135
- </td>
136
- </tr>
137
- ) : (
138
- <>
139
- {(virtualRows ?? rows).map((rowOrVirtualRow, rowIndex) => {
140
- const row = virtualizer
141
- ? rows[rowOrVirtualRow.index]
142
- : (rowOrVirtualRow as MRT_Row);
143
- const props = {
144
- key: row.id,
145
- measureElement: virtualizer
146
- ? virtualizer.measureElement
147
- : undefined,
148
- numRows: rows.length,
149
- row,
150
- rowIndex: virtualizer ? rowOrVirtualRow.index : rowIndex,
151
- table,
152
- virtualRow: virtualizer
153
- ? (rowOrVirtualRow as VirtualItem)
154
- : undefined,
155
- };
156
- return memoMode === 'rows' ? (
157
- <Memo_MRT_TableBodyRow {...props} />
158
- ) : (
159
- <MRT_TableBodyRow {...props} />
160
- );
161
- })}
162
- </>
163
- )}
121
+ <Typography
122
+ sx={{
123
+ color: 'text.secondary',
124
+ fontStyle: 'italic',
125
+ maxWidth: `min(100vw, ${
126
+ tablePaperRef.current?.clientWidth ?? 360
127
+ }px)`,
128
+ py: '2rem',
129
+ textAlign: 'center',
130
+ width: '100%',
131
+ }}
132
+ >
133
+ {globalFilter || columnFilters.length
134
+ ? localization.noResultsFound
135
+ : localization.noRecordsToDisplay}
136
+ </Typography>
137
+ </td>
138
+ </tr>
139
+ ) : (
140
+ <>
141
+ {(virtualRows ?? rows).map((rowOrVirtualRow, rowIndex) => {
142
+ const row = virtualizer
143
+ ? rows[rowOrVirtualRow.index]
144
+ : (rowOrVirtualRow as MRT_Row);
145
+ const props = {
146
+ key: row.id,
147
+ measureElement: virtualizer
148
+ ? virtualizer.measureElement
149
+ : undefined,
150
+ numRows: rows.length,
151
+ row,
152
+ rowIndex: virtualizer ? rowOrVirtualRow.index : rowIndex,
153
+ table,
154
+ virtualRow: virtualizer
155
+ ? (rowOrVirtualRow as VirtualItem)
156
+ : undefined,
157
+ };
158
+ return memoMode === 'rows' ? (
159
+ <Memo_MRT_TableBodyRow {...props} />
160
+ ) : (
161
+ <MRT_TableBodyRow {...props} />
162
+ );
163
+ })}
164
+ </>
165
+ ))}
164
166
  </TableBody>
165
167
  );
166
168
  };
@@ -15,7 +15,7 @@ import InputAdornment from '@mui/material/InputAdornment';
15
15
  import MenuItem from '@mui/material/MenuItem';
16
16
  import TextField from '@mui/material/TextField';
17
17
  import Tooltip from '@mui/material/Tooltip';
18
- import debounce from '@mui/material/utils/debounce';
18
+ import { debounce } from '@mui/material/utils';
19
19
  import type { TextFieldProps } from '@mui/material/TextField';
20
20
  import type { MRT_Header, MRT_TableInstance } from '..';
21
21
  import { MRT_FilterOptionMenu } from '../menus/MRT_FilterOptionMenu';
@@ -87,7 +87,8 @@ export const MRT_FilterTextField: FC<Props> = ({
87
87
  ]
88
88
  : '';
89
89
  const filterPlaceholder = !isRangeFilter
90
- ? localization.filterByColumn?.replace('{column}', String(columnDef.header))
90
+ ? textFieldProps?.placeholder ??
91
+ localization.filterByColumn?.replace('{column}', String(columnDef.header))
91
92
  : rangeFilterIndex === 0
92
93
  ? localization.min
93
94
  : rangeFilterIndex === 1
@@ -10,7 +10,7 @@ import IconButton from '@mui/material/IconButton';
10
10
  import InputAdornment from '@mui/material/InputAdornment';
11
11
  import TextField from '@mui/material/TextField';
12
12
  import Tooltip from '@mui/material/Tooltip';
13
- import debounce from '@mui/material/utils/debounce';
13
+ import { debounce } from '@mui/material/utils';
14
14
  import { MRT_FilterOptionMenu } from '../menus/MRT_FilterOptionMenu';
15
15
  import { MRT_TableInstance } from '..';
16
16