material-react-table 1.0.0-beta.4 → 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.
package/dist/cjs/index.js CHANGED
@@ -208,6 +208,8 @@ const MRT_DefaultLocalization_EN = {
208
208
  max: 'Max',
209
209
  min: 'Min',
210
210
  move: 'Move',
211
+ noRecordsToDisplay: 'No records to display',
212
+ noResultsFound: 'No results found',
211
213
  or: 'or',
212
214
  pinToLeft: 'Pin to left',
213
215
  pinToRight: 'Pin to right',
@@ -2163,8 +2165,8 @@ const MRT_TableBodyRow = ({ row, rowIndex, table, virtualRow, }) => {
2163
2165
  };
2164
2166
 
2165
2167
  const MRT_TableBody = ({ table }) => {
2166
- const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, manualFiltering, manualSorting, muiTableBodyProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef }, } = table;
2167
- const { globalFilter, pagination, sorting } = getState();
2168
+ const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, localization, manualFiltering, manualSorting, muiTableBodyProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef }, } = table;
2169
+ const { columnFilters, globalFilter, pagination, sorting } = getState();
2168
2170
  const tableBodyProps = muiTableBodyProps instanceof Function
2169
2171
  ? muiTableBodyProps({ table })
2170
2172
  : muiTableBodyProps;
@@ -2229,7 +2231,16 @@ const MRT_TableBody = ({ table }) => {
2229
2231
  // ? virtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end
2230
2232
  // : 0;
2231
2233
  // }
2232
- return (React__default["default"].createElement(material.TableBody, Object.assign({}, tableBodyProps),
2234
+ return (React__default["default"].createElement(material.TableBody, Object.assign({}, tableBodyProps), !rows.length ? (React__default["default"].createElement(material.TableRow, null,
2235
+ React__default["default"].createElement(material.TableCell, { colSpan: table.getVisibleLeafColumns().length },
2236
+ React__default["default"].createElement(material.Box, { sx: {
2237
+ maxWidth: '100vw',
2238
+ py: '2rem',
2239
+ textAlign: 'center',
2240
+ width: '100%',
2241
+ } }, globalFilter || columnFilters.length
2242
+ ? localization.noResultsFound
2243
+ : localization.noRecordsToDisplay)))) : (React__default["default"].createElement(React__default["default"].Fragment, null,
2233
2244
  enableRowVirtualization && paddingTop > 0 && (React__default["default"].createElement("tr", null,
2234
2245
  React__default["default"].createElement("td", { style: { height: `${paddingTop}px` } }))),
2235
2246
  (enableRowVirtualization ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
@@ -2239,7 +2250,7 @@ const MRT_TableBody = ({ table }) => {
2239
2250
  return (React__default["default"].createElement(MRT_TableBodyRow, { key: row.id, row: row, rowIndex: enableRowVirtualization ? rowOrVirtualRow.index : rowIndex, table: table, virtualRow: enableRowVirtualization ? rowOrVirtualRow : null }));
2240
2251
  }),
2241
2252
  enableRowVirtualization && paddingBottom > 0 && (React__default["default"].createElement("tr", null,
2242
- React__default["default"].createElement("td", { style: { height: `${paddingBottom}px` } })))));
2253
+ React__default["default"].createElement("td", { style: { height: `${paddingBottom}px` } })))))));
2243
2254
  };
2244
2255
 
2245
2256
  const MRT_TableFooterCell = ({ footer, table }) => {