material-react-table 1.5.2 → 1.5.4
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 +19 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/buttons/MRT_ExpandAllButton.d.ts +1 -1
- package/dist/cjs/types/buttons/MRT_FullScreenToggleButton.d.ts +1 -1
- package/dist/cjs/types/buttons/MRT_GrabHandleButton.d.ts +1 -1
- package/dist/cjs/types/buttons/MRT_ShowHideColumnsButton.d.ts +1 -1
- package/dist/cjs/types/buttons/MRT_ToggleDensePaddingButton.d.ts +1 -1
- package/dist/cjs/types/buttons/MRT_ToggleFiltersButton.d.ts +1 -1
- package/dist/cjs/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +1 -1
- package/dist/cjs/types/icons.d.ts +0 -2
- package/dist/cjs/types/inputs/MRT_GlobalFilterTextField.d.ts +1 -1
- package/dist/cjs/types/table/MRT_Table.d.ts +1 -1
- package/dist/cjs/types/toolbar/MRT_BottomToolbar.d.ts +1 -1
- package/dist/cjs/types/toolbar/MRT_LinearProgressBar.d.ts +1 -1
- package/dist/cjs/types/toolbar/MRT_TablePagination.d.ts +1 -1
- package/dist/cjs/types/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
- package/dist/cjs/types/toolbar/MRT_ToolbarDropZone.d.ts +1 -1
- package/dist/cjs/types/toolbar/MRT_TopToolbar.d.ts +1 -1
- package/dist/esm/material-react-table.esm.js +19 -11
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/buttons/MRT_ExpandAllButton.d.ts +1 -1
- package/dist/esm/types/buttons/MRT_FullScreenToggleButton.d.ts +1 -1
- package/dist/esm/types/buttons/MRT_GrabHandleButton.d.ts +1 -1
- package/dist/esm/types/buttons/MRT_ShowHideColumnsButton.d.ts +1 -1
- package/dist/esm/types/buttons/MRT_ToggleDensePaddingButton.d.ts +1 -1
- package/dist/esm/types/buttons/MRT_ToggleFiltersButton.d.ts +1 -1
- package/dist/esm/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +1 -1
- package/dist/esm/types/icons.d.ts +0 -2
- package/dist/esm/types/inputs/MRT_GlobalFilterTextField.d.ts +1 -1
- package/dist/esm/types/table/MRT_Table.d.ts +1 -1
- package/dist/esm/types/toolbar/MRT_BottomToolbar.d.ts +1 -1
- package/dist/esm/types/toolbar/MRT_LinearProgressBar.d.ts +1 -1
- package/dist/esm/types/toolbar/MRT_TablePagination.d.ts +1 -1
- package/dist/esm/types/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
- package/dist/esm/types/toolbar/MRT_ToolbarDropZone.d.ts +1 -1
- package/dist/esm/types/toolbar/MRT_TopToolbar.d.ts +1 -1
- package/dist/index.d.ts +0 -2
- package/package.json +1 -1
- package/src/buttons/MRT_ExpandAllButton.tsx +1 -1
- package/src/buttons/MRT_FullScreenToggleButton.tsx +1 -1
- package/src/buttons/MRT_GrabHandleButton.tsx +1 -1
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +1 -1
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +1 -1
- package/src/buttons/MRT_ToggleFiltersButton.tsx +1 -1
- package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +1 -1
- package/src/icons.ts +0 -6
- package/src/inputs/MRT_FilterTextField.tsx +16 -5
- package/src/inputs/MRT_GlobalFilterTextField.tsx +1 -1
- package/src/table/MRT_Table.tsx +1 -1
- package/src/toolbar/MRT_BottomToolbar.tsx +2 -2
- package/src/toolbar/MRT_LinearProgressBar.tsx +1 -1
- package/src/toolbar/MRT_TablePagination.tsx +1 -1
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +1 -1
- package/src/toolbar/MRT_ToolbarDropZone.tsx +1 -1
- package/src/toolbar/MRT_TopToolbar.tsx +1 -1
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import type { IconButtonProps } from '@mui/material/IconButton';
|
3
|
-
import { MRT_TableInstance } from '..';
|
3
|
+
import type { MRT_TableInstance } from '..';
|
4
4
|
interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
|
5
5
|
table: MRT_TableInstance<TData>;
|
6
6
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { DragEventHandler } from 'react';
|
2
2
|
import type { IconButtonProps } from '@mui/material/IconButton';
|
3
|
-
import { MRT_TableInstance } from '..';
|
3
|
+
import type { MRT_TableInstance } from '..';
|
4
4
|
interface Props<TData extends Record<string, any> = {}> {
|
5
5
|
iconButtonProps?: IconButtonProps;
|
6
6
|
onDragStart: DragEventHandler<HTMLButtonElement>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import type { IconButtonProps } from '@mui/material/IconButton';
|
3
|
-
import { MRT_TableInstance } from '..';
|
3
|
+
import type { MRT_TableInstance } from '..';
|
4
4
|
interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
|
5
5
|
table: MRT_TableInstance<TData>;
|
6
6
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import type { IconButtonProps } from '@mui/material/IconButton';
|
3
|
-
import { MRT_TableInstance } from '..';
|
3
|
+
import type { MRT_TableInstance } from '..';
|
4
4
|
interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
|
5
5
|
table: MRT_TableInstance<TData>;
|
6
6
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import type { IconButtonProps } from '@mui/material/IconButton';
|
3
|
-
import { MRT_TableInstance } from '..';
|
3
|
+
import type { MRT_TableInstance } from '..';
|
4
4
|
interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
|
5
5
|
table: MRT_TableInstance<TData>;
|
6
6
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import type { IconButtonProps } from '@mui/material/IconButton';
|
3
|
-
import { MRT_TableInstance } from '..';
|
3
|
+
import type { MRT_TableInstance } from '..';
|
4
4
|
interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
|
5
5
|
table: MRT_TableInstance<TData>;
|
6
6
|
}
|
@@ -2,7 +2,6 @@ export interface MRT_Icons {
|
|
2
2
|
ArrowDownwardIcon: any;
|
3
3
|
ArrowRightIcon: any;
|
4
4
|
CancelIcon: any;
|
5
|
-
CheckBoxIcon: any;
|
6
5
|
ClearAllIcon: any;
|
7
6
|
CloseIcon: any;
|
8
7
|
DensityLargeIcon: any;
|
@@ -15,7 +14,6 @@ export interface MRT_Icons {
|
|
15
14
|
ExpandLessIcon: any;
|
16
15
|
ExpandMoreIcon: any;
|
17
16
|
FilterAltIcon: any;
|
18
|
-
FilterAltOffIcon: any;
|
19
17
|
FilterListIcon: any;
|
20
18
|
FilterListOffIcon: any;
|
21
19
|
FullscreenExitIcon: any;
|
@@ -5,7 +5,6 @@ import { rankItem, rankings, compareItems } from '@tanstack/match-sorter-utils';
|
|
5
5
|
import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward';
|
6
6
|
import ArrowRightIcon from '@mui/icons-material/ArrowRight';
|
7
7
|
import CancelIcon from '@mui/icons-material/Cancel';
|
8
|
-
import CheckBoxIcon from '@mui/icons-material/CheckBox';
|
9
8
|
import ClearAllIcon from '@mui/icons-material/ClearAll';
|
10
9
|
import CloseIcon from '@mui/icons-material/Close';
|
11
10
|
import DensityLargeIcon from '@mui/icons-material/DensityLarge';
|
@@ -17,7 +16,6 @@ import EditIcon from '@mui/icons-material/Edit';
|
|
17
16
|
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
|
18
17
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
19
18
|
import FilterAltIcon from '@mui/icons-material/FilterAlt';
|
20
|
-
import FilterAltOffIcon from '@mui/icons-material/FilterAltOff';
|
21
19
|
import FilterListIcon from '@mui/icons-material/FilterList';
|
22
20
|
import FilterListOffIcon from '@mui/icons-material/FilterListOff';
|
23
21
|
import FullscreenExitIcon from '@mui/icons-material/FullscreenExit';
|
@@ -371,7 +369,6 @@ const MRT_Default_Icons = {
|
|
371
369
|
ArrowDownwardIcon,
|
372
370
|
ArrowRightIcon,
|
373
371
|
CancelIcon,
|
374
|
-
CheckBoxIcon,
|
375
372
|
ClearAllIcon,
|
376
373
|
CloseIcon,
|
377
374
|
DensityLargeIcon,
|
@@ -383,7 +380,6 @@ const MRT_Default_Icons = {
|
|
383
380
|
ExpandLessIcon,
|
384
381
|
ExpandMoreIcon,
|
385
382
|
FilterAltIcon,
|
386
|
-
FilterAltOffIcon,
|
387
383
|
FilterListIcon,
|
388
384
|
FilterListOffIcon,
|
389
385
|
FullscreenExitIcon,
|
@@ -1465,7 +1461,7 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
1465
1461
|
};
|
1466
1462
|
|
1467
1463
|
const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
1468
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
1464
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
1469
1465
|
const { options: { enableColumnFilterModes, columnFilterModeOptions, icons: { FilterListIcon, CloseIcon }, localization, manualFiltering, muiTableHeadCellFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
|
1470
1466
|
const { column } = header;
|
1471
1467
|
const { columnDef } = column;
|
@@ -1559,15 +1555,27 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1559
1555
|
const handleClearEmptyFilterChip = () => {
|
1560
1556
|
setFilterValue('');
|
1561
1557
|
column.setFilterValue(undefined);
|
1562
|
-
setColumnFilterFns((prev) =>
|
1558
|
+
setColumnFilterFns((prev) => {
|
1559
|
+
var _a, _b, _c;
|
1560
|
+
return (Object.assign(Object.assign({}, prev), { [header.id]: (_c = (_b = (_a = columnDef.columnFilterModeOptions) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : columnFilterModeOptions === null || columnFilterModeOptions === void 0 ? void 0 : columnFilterModeOptions[0]) !== null && _c !== void 0 ? _c : 'fuzzy' }));
|
1561
|
+
});
|
1563
1562
|
};
|
1564
1563
|
const handleFilterMenuOpen = (event) => {
|
1565
1564
|
setAnchorEl(event.currentTarget);
|
1566
1565
|
};
|
1567
1566
|
const isMounted = useRef(false);
|
1568
1567
|
useEffect(() => {
|
1569
|
-
if (isMounted.current
|
1570
|
-
|
1568
|
+
if (isMounted.current) {
|
1569
|
+
const filterValue = column.getFilterValue();
|
1570
|
+
if (filterValue === undefined) {
|
1571
|
+
handleClear();
|
1572
|
+
}
|
1573
|
+
else if (isRangeFilter && rangeFilterIndex !== undefined) {
|
1574
|
+
setFilterValue(filterValue[rangeFilterIndex]);
|
1575
|
+
}
|
1576
|
+
else {
|
1577
|
+
setFilterValue(filterValue);
|
1578
|
+
}
|
1571
1579
|
}
|
1572
1580
|
isMounted.current = true;
|
1573
1581
|
}, [column.getFilterValue()]);
|
@@ -1603,7 +1611,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1603
1611
|
endAdornment: !filterChipLabel && (React.createElement(InputAdornment, { position: "end" },
|
1604
1612
|
React.createElement(Tooltip, { arrow: true, placement: "right", title: (_h = localization.clearFilter) !== null && _h !== void 0 ? _h : '' },
|
1605
1613
|
React.createElement("span", null,
|
1606
|
-
React.createElement(IconButton, { "aria-label": localization.clearFilter, disabled: !(filterValue === null || filterValue === void 0 ? void 0 : filterValue.length), onClick: handleClear, size: "small", sx: {
|
1614
|
+
React.createElement(IconButton, { "aria-label": localization.clearFilter, disabled: !((_j = filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString()) === null || _j === void 0 ? void 0 : _j.length), onClick: handleClear, size: "small", sx: {
|
1607
1615
|
height: '1.75rem',
|
1608
1616
|
width: '1.75rem',
|
1609
1617
|
} },
|
@@ -1638,8 +1646,8 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1638
1646
|
? textFieldProps.sx(theme)
|
1639
1647
|
: textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx))) }),
|
1640
1648
|
(isSelectFilter || isMultiSelectFilter) && (React.createElement(MenuItem, { divider: true, disabled: true, hidden: true, value: "" },
|
1641
|
-
React.createElement(Box, { sx: { opacity: 0.5 } }, filterPlaceholder))), (
|
1642
|
-
|
1649
|
+
React.createElement(Box, { sx: { opacity: 0.5 } }, filterPlaceholder))), (_k = columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterSelectOptions) === null || _k === void 0 ? void 0 :
|
1650
|
+
_k.map((option) => {
|
1643
1651
|
var _a;
|
1644
1652
|
let value;
|
1645
1653
|
let text;
|