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/dist/cjs/index.js +14 -15
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/material-react-table.esm.js +12 -12
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/package.json +6 -6
- package/src/body/MRT_TableBody.tsx +52 -50
- package/src/inputs/MRT_FilterTextField.tsx +3 -2
- package/src/inputs/MRT_GlobalFilterTextField.tsx +1 -1
@@ -54,7 +54,7 @@ import useMediaQuery from '@mui/material/useMediaQuery';
|
|
54
54
|
import Collapse from '@mui/material/Collapse';
|
55
55
|
import InputAdornment from '@mui/material/InputAdornment';
|
56
56
|
import TextField from '@mui/material/TextField';
|
57
|
-
import debounce from '@mui/material/utils
|
57
|
+
import { debounce } from '@mui/material/utils';
|
58
58
|
import LinearProgress from '@mui/material/LinearProgress';
|
59
59
|
import TablePagination from '@mui/material/TablePagination';
|
60
60
|
import Alert from '@mui/material/Alert';
|
@@ -1447,7 +1447,7 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
1447
1447
|
};
|
1448
1448
|
|
1449
1449
|
const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
1450
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
1450
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
1451
1451
|
const { options: { enableColumnFilterModes, columnFilterModeOptions, icons: { FilterListIcon, CloseIcon }, localization, manualFiltering, muiTableHeadCellFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
|
1452
1452
|
const { column } = header;
|
1453
1453
|
const { columnDef } = column;
|
@@ -1478,13 +1478,13 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1478
1478
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]
|
1479
1479
|
: '';
|
1480
1480
|
const filterPlaceholder = !isRangeFilter
|
1481
|
-
? (_c = localization.filterByColumn) === null ||
|
1481
|
+
? (_c = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.placeholder) !== null && _c !== void 0 ? _c : (_d = localization.filterByColumn) === null || _d === void 0 ? void 0 : _d.replace('{column}', String(columnDef.header))
|
1482
1482
|
: rangeFilterIndex === 0
|
1483
1483
|
? localization.min
|
1484
1484
|
: rangeFilterIndex === 1
|
1485
1485
|
? localization.max
|
1486
1486
|
: '';
|
1487
|
-
const allowedColumnFilterOptions = (
|
1487
|
+
const allowedColumnFilterOptions = (_e = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _e !== void 0 ? _e : columnFilterModeOptions;
|
1488
1488
|
const showChangeModeButton = enableColumnFilterModes &&
|
1489
1489
|
columnDef.enableColumnFilterModes !== false &&
|
1490
1490
|
!rangeFilterIndex &&
|
@@ -1554,7 +1554,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1554
1554
|
isMounted.current = true;
|
1555
1555
|
}, [column.getFilterValue()]);
|
1556
1556
|
if (columnDef.Filter) {
|
1557
|
-
return (React.createElement(React.Fragment, null, (
|
1557
|
+
return (React.createElement(React.Fragment, null, (_f = columnDef.Filter) === null || _f === void 0 ? void 0 : _f.call(columnDef, { column, header, rangeFilterIndex, table })));
|
1558
1558
|
}
|
1559
1559
|
return (React.createElement(React.Fragment, null,
|
1560
1560
|
React.createElement(TextField, Object.assign({ fullWidth: true, inputProps: {
|
@@ -1566,7 +1566,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1566
1566
|
title: filterPlaceholder,
|
1567
1567
|
}, helperText: showChangeModeButton ? (React.createElement("label", null, localization.filterMode.replace('{filterType}',
|
1568
1568
|
// @ts-ignore
|
1569
|
-
localization[`filter${((
|
1569
|
+
localization[`filter${((_g = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _g === void 0 ? void 0 : _g.toUpperCase()) +
|
1570
1570
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]))) : null, FormHelperTextProps: {
|
1571
1571
|
sx: {
|
1572
1572
|
fontSize: '0.75rem',
|
@@ -1583,7 +1583,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1583
1583
|
React.createElement(FilterListIcon, null)))),
|
1584
1584
|
filterChipLabel && (React.createElement(Chip, { onDelete: handleClearEmptyFilterChip, label: filterChipLabel })))) : null,
|
1585
1585
|
endAdornment: !filterChipLabel && (React.createElement(InputAdornment, { position: "end" },
|
1586
|
-
React.createElement(Tooltip, { arrow: true, placement: "right", title: (
|
1586
|
+
React.createElement(Tooltip, { arrow: true, placement: "right", title: (_h = localization.clearFilter) !== null && _h !== void 0 ? _h : '' },
|
1587
1587
|
React.createElement("span", null,
|
1588
1588
|
React.createElement(IconButton, { "aria-label": localization.clearFilter, disabled: !(filterValue === null || filterValue === void 0 ? void 0 : filterValue.length), onClick: handleClear, size: "small", sx: {
|
1589
1589
|
height: '1.75rem',
|
@@ -1620,8 +1620,8 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1620
1620
|
? textFieldProps.sx(theme)
|
1621
1621
|
: textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx))) }),
|
1622
1622
|
(isSelectFilter || isMultiSelectFilter) && (React.createElement(MenuItem, { divider: true, disabled: true, hidden: true, value: "" },
|
1623
|
-
React.createElement(Box, { sx: { opacity: 0.5 } }, filterPlaceholder))), (
|
1624
|
-
|
1623
|
+
React.createElement(Box, { sx: { opacity: 0.5 } }, filterPlaceholder))), (_j = columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterSelectOptions) === null || _j === void 0 ? void 0 :
|
1624
|
+
_j.map((option) => {
|
1625
1625
|
var _a;
|
1626
1626
|
let value;
|
1627
1627
|
let text;
|
@@ -2362,9 +2362,9 @@ const MRT_TableBody = ({ table }) => {
|
|
2362
2362
|
virtualizerInstanceRef.current = virtualizer;
|
2363
2363
|
}
|
2364
2364
|
const virtualRows = virtualizer ? virtualizer.getVirtualItems() : undefined;
|
2365
|
-
return (React.createElement(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', height: virtualizer ? `${virtualizer.getTotalSize()}px` : 'inherit', position: 'relative' }, ((tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx) instanceof Function
|
2365
|
+
return (React.createElement(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', height: virtualizer ? `${virtualizer.getTotalSize()}px` : 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, ((tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx) instanceof Function
|
2366
2366
|
? tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx(theme)
|
2367
|
-
: tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx))) }), (
|
2367
|
+
: tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx))) }), (_a = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _a !== void 0 ? _a : (!rows.length ? (React.createElement("tr", { style: { display: layoutMode === 'grid' ? 'grid' : 'table-row' } },
|
2368
2368
|
React.createElement("td", { colSpan: table.getVisibleLeafColumns().length, style: { display: layoutMode === 'grid' ? 'grid' : 'table-cell' } },
|
2369
2369
|
React.createElement(Typography, { sx: {
|
2370
2370
|
color: 'text.secondary',
|
@@ -2393,7 +2393,7 @@ const MRT_TableBody = ({ table }) => {
|
|
2393
2393
|
: undefined,
|
2394
2394
|
};
|
2395
2395
|
return memoMode === 'rows' ? (React.createElement(Memo_MRT_TableBodyRow, Object.assign({}, props))) : (React.createElement(MRT_TableBodyRow, Object.assign({}, props)));
|
2396
|
-
})))));
|
2396
|
+
}))))));
|
2397
2397
|
};
|
2398
2398
|
const Memo_MRT_TableBody = memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
|
2399
2399
|
|