material-react-table 1.12.1 → 1.13.1
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 +130 -12
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/MaterialReactTable.d.ts +1 -1
- package/dist/cjs/types/inputs/MRT_FilterRangeSlider.d.ts +7 -0
- package/dist/cjs/types/types.d.ts +12 -2
- package/dist/esm/material-react-table.esm.js +133 -15
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/MaterialReactTable.d.ts +1 -1
- package/dist/esm/types/inputs/MRT_FilterRangeSlider.d.ts +7 -0
- package/dist/esm/types/types.d.ts +12 -2
- package/dist/index.d.ts +13 -3
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +2 -0
- package/src/column.utils.ts +5 -1
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +4 -1
- package/src/inputs/MRT_FilterRangeFields.tsx +1 -1
- package/src/inputs/MRT_FilterRangeSlider.tsx +145 -0
- package/src/inputs/MRT_FilterTextField.tsx +24 -3
- package/src/menus/MRT_FilterOptionMenu.tsx +8 -1
- package/src/table/MRT_TableRoot.tsx +28 -6
- package/src/types.ts +22 -2
@@ -3,7 +3,7 @@ import { MRT_FilterFns } from './filterFns';
|
|
3
3
|
import { MRT_SortingFns } from './sortingFns';
|
4
4
|
import { type MaterialReactTableProps } from './types';
|
5
5
|
export { MRT_AggregationFns, MRT_FilterFns, MRT_SortingFns };
|
6
|
-
export declare const MaterialReactTable: <TData extends Record<string, any> = {}>({ aggregationFns, autoResetExpanded, columnResizeMode, defaultColumn, defaultDisplayColumn, editingMode, enableBottomToolbar, enableColumnActions, enableColumnFilters, enableColumnOrdering, enableColumnResizing, enableDensityToggle, enableExpandAll, enableFilterMatchHighlighting, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableGlobalFilterRankedResults, enableGrouping, enableHiding, enableMultiRowSelection, enableMultiSort, enablePagination, enablePinning, enableRowSelection, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarInternalActions, enableTopToolbar, filterFns, icons, layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, positionActionsColumn, positionExpandColumn, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, rowNumberMode, selectAllMode, sortingFns, ...rest }: MaterialReactTableProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
6
|
+
export declare const MaterialReactTable: <TData extends Record<string, any> = {}>({ aggregationFns, autoResetExpanded, columnResizeMode, defaultColumn, defaultDisplayColumn, editingMode, enableBottomToolbar, enableColumnActions, enableColumnFilters, enableColumnOrdering, enableColumnResizing, enableDensityToggle, enableExpandAll, enableExpanding, enableFilterMatchHighlighting, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableGlobalFilterRankedResults, enableGrouping, enableHiding, enableMultiRowSelection, enableMultiSort, enablePagination, enablePinning, enableRowSelection, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarInternalActions, enableTopToolbar, filterFns, icons, layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, positionActionsColumn, positionExpandColumn, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, rowNumberMode, selectAllMode, sortingFns, ...rest }: MaterialReactTableProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
7
7
|
/**
|
8
8
|
* @deprecated Use named exports instead of default export (will be removed in v2)
|
9
9
|
* @example import { MaterialReactTable } from 'material-react-table';
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { type MRT_TableInstance, type MRT_Header } from '../types';
|
2
|
+
interface Props {
|
3
|
+
header: MRT_Header;
|
4
|
+
table: MRT_TableInstance;
|
5
|
+
}
|
6
|
+
export declare const MRT_FilterRangeSlider: ({ header, table }: Props) => import("react/jsx-runtime").JSX.Element;
|
7
|
+
export {};
|
@@ -8,13 +8,14 @@ import { type LinearProgressProps } from '@mui/material/LinearProgress';
|
|
8
8
|
import { type PaperProps } from '@mui/material/Paper';
|
9
9
|
import { type RadioProps } from '@mui/material/Radio';
|
10
10
|
import { type SkeletonProps } from '@mui/material/Skeleton';
|
11
|
-
import { type
|
11
|
+
import { type SliderProps } from '@mui/material';
|
12
12
|
import { type TableBodyProps } from '@mui/material/TableBody';
|
13
13
|
import { type TableCellProps } from '@mui/material/TableCell';
|
14
14
|
import { type TableContainerProps } from '@mui/material/TableContainer';
|
15
15
|
import { type TableFooterProps } from '@mui/material/TableFooter';
|
16
16
|
import { type TableHeadProps } from '@mui/material/TableHead';
|
17
17
|
import { type TablePaginationProps } from '@mui/material/TablePagination';
|
18
|
+
import { type TableProps } from '@mui/material/Table';
|
18
19
|
import { type TableRowProps } from '@mui/material/TableRow';
|
19
20
|
import { type TextFieldProps } from '@mui/material/TextField';
|
20
21
|
import { type ToolbarProps } from '@mui/material/Toolbar';
|
@@ -295,7 +296,7 @@ export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<ColumnD
|
|
295
296
|
text: string;
|
296
297
|
value: any;
|
297
298
|
})[];
|
298
|
-
filterVariant?: '
|
299
|
+
filterVariant?: 'checkbox' | 'multi-select' | 'range' | 'range-slider' | 'select' | 'text';
|
299
300
|
/**
|
300
301
|
* footer must be a string. If you want custom JSX to render the footer, you can also specify a `Footer` option. (Capital F)
|
301
302
|
*/
|
@@ -353,6 +354,10 @@ export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<ColumnD
|
|
353
354
|
column: MRT_Column<TData>;
|
354
355
|
rangeFilterIndex?: number;
|
355
356
|
}) => TextFieldProps);
|
357
|
+
muiTableHeadCellFilterSliderProps?: SliderProps | ((props: {
|
358
|
+
table: MRT_TableInstance<TData>;
|
359
|
+
column: MRT_Column<TData>;
|
360
|
+
}) => TextFieldProps);
|
356
361
|
muiTableHeadCellProps?: TableCellProps | ((props: {
|
357
362
|
table: MRT_TableInstance<TData>;
|
358
363
|
column: MRT_Column<TData>;
|
@@ -463,6 +468,7 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> = Pr
|
|
463
468
|
enableDensityToggle?: boolean;
|
464
469
|
enableEditing?: boolean | ((row: MRT_Row<TData>) => boolean);
|
465
470
|
enableExpandAll?: boolean;
|
471
|
+
enableFacetedValues?: boolean;
|
466
472
|
enableFilterMatchHighlighting?: boolean;
|
467
473
|
enableFullScreenToggle?: boolean;
|
468
474
|
enableGlobalFilterModes?: boolean;
|
@@ -601,6 +607,10 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> = Pr
|
|
601
607
|
column: MRT_Column<TData>;
|
602
608
|
rangeFilterIndex?: number;
|
603
609
|
}) => TextFieldProps);
|
610
|
+
muiTableHeadCellFilterSliderProps?: SliderProps | ((props: {
|
611
|
+
table: MRT_TableInstance<TData>;
|
612
|
+
column: MRT_Column<TData>;
|
613
|
+
}) => TextFieldProps);
|
604
614
|
muiTableHeadCellProps?: TableCellProps | ((props: {
|
605
615
|
table: MRT_TableInstance<TData>;
|
606
616
|
column: MRT_Column<TData>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
2
2
|
import { useMemo, useState, useRef, useCallback, useEffect, Fragment as Fragment$1, memo, useLayoutEffect } from 'react';
|
3
|
-
import { aggregationFns, filterFns, sortingFns, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedRowModel, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
|
3
|
+
import { aggregationFns, filterFns, sortingFns, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
|
4
4
|
import { rankItem, rankings, compareItems } from '@tanstack/match-sorter-utils';
|
5
5
|
import { alpha, lighten, useTheme, darken } from '@mui/material/styles';
|
6
6
|
import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward';
|
@@ -65,6 +65,7 @@ import Table from '@mui/material/Table';
|
|
65
65
|
import TableHead from '@mui/material/TableHead';
|
66
66
|
import TableRow from '@mui/material/TableRow';
|
67
67
|
import TableCell from '@mui/material/TableCell';
|
68
|
+
import { Stack, Slider, FormHelperText } from '@mui/material';
|
68
69
|
import Badge from '@mui/material/Badge';
|
69
70
|
import TableSortLabel from '@mui/material/TableSortLabel';
|
70
71
|
import TableBody from '@mui/material/TableBody';
|
@@ -74,7 +75,7 @@ import TableFooter from '@mui/material/TableFooter';
|
|
74
75
|
import DialogActions from '@mui/material/DialogActions';
|
75
76
|
import DialogContent from '@mui/material/DialogContent';
|
76
77
|
import DialogTitle from '@mui/material/DialogTitle';
|
77
|
-
import Stack from '@mui/material/Stack';
|
78
|
+
import Stack$1 from '@mui/material/Stack';
|
78
79
|
|
79
80
|
/******************************************************************************
|
80
81
|
Copyright (c) Microsoft Corporation.
|
@@ -314,7 +315,8 @@ const getDefaultColumnOrderIds = (props) => {
|
|
314
315
|
const getDefaultColumnFilterFn = (columnDef) => {
|
315
316
|
if (columnDef.filterVariant === 'multi-select')
|
316
317
|
return 'arrIncludesSome';
|
317
|
-
if (columnDef.filterVariant === 'range'
|
318
|
+
if (columnDef.filterVariant === 'range' ||
|
319
|
+
columnDef.filterVariant === 'range-slider')
|
318
320
|
return 'betweenInclusive';
|
319
321
|
if (columnDef.filterVariant === 'select' ||
|
320
322
|
columnDef.filterVariant === 'checkbox')
|
@@ -665,7 +667,13 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
|
|
665
667
|
const { column } = header !== null && header !== void 0 ? header : {};
|
666
668
|
const { columnDef } = column !== null && column !== void 0 ? column : {};
|
667
669
|
const currentFilterValue = column === null || column === void 0 ? void 0 : column.getFilterValue();
|
668
|
-
|
670
|
+
let allowedColumnFilterOptions = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _a !== void 0 ? _a : columnFilterModeOptions;
|
671
|
+
if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'range-slider') {
|
672
|
+
allowedColumnFilterOptions = [
|
673
|
+
...rangeModes,
|
674
|
+
...(allowedColumnFilterOptions !== null && allowedColumnFilterOptions !== void 0 ? allowedColumnFilterOptions : []),
|
675
|
+
].filter((option) => rangeModes.includes(option));
|
676
|
+
}
|
669
677
|
const internalFilterOptions = useMemo(() => mrtFilterOptions(localization).filter((filterOption) => columnDef
|
670
678
|
? allowedColumnFilterOptions === undefined ||
|
671
679
|
(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.includes(filterOption.option))
|
@@ -1459,7 +1467,7 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
1459
1467
|
};
|
1460
1468
|
|
1461
1469
|
const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
1462
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
1470
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
1463
1471
|
const { options: { enableColumnFilterModes, columnFilterModeOptions, icons: { FilterListIcon, CloseIcon }, localization, manualFiltering, muiTableHeadCellFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
|
1464
1472
|
const { column } = header;
|
1465
1473
|
const { columnDef } = column;
|
@@ -1502,6 +1510,18 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1502
1510
|
!rangeFilterIndex &&
|
1503
1511
|
(allowedColumnFilterOptions === undefined ||
|
1504
1512
|
!!(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.length));
|
1513
|
+
const facetedUniqueValues = column.getFacetedUniqueValues();
|
1514
|
+
const filterSelectOptions = useMemo(() => {
|
1515
|
+
var _a;
|
1516
|
+
return (_a = columnDef.filterSelectOptions) !== null && _a !== void 0 ? _a : ((isSelectFilter || isMultiSelectFilter) && facetedUniqueValues
|
1517
|
+
? Array.from(facetedUniqueValues.keys()).sort((a, b) => a.localeCompare(b))
|
1518
|
+
: undefined);
|
1519
|
+
}, [
|
1520
|
+
columnDef.filterSelectOptions,
|
1521
|
+
facetedUniqueValues,
|
1522
|
+
isMultiSelectFilter,
|
1523
|
+
isSelectFilter,
|
1524
|
+
]);
|
1505
1525
|
const [anchorEl, setAnchorEl] = useState(null);
|
1506
1526
|
const [filterValue, setFilterValue] = useState(() => {
|
1507
1527
|
var _a, _b;
|
@@ -1609,8 +1629,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1609
1629
|
multiple: isMultiSelectFilter,
|
1610
1630
|
renderValue: isMultiSelectFilter
|
1611
1631
|
? (selected) => !(selected === null || selected === void 0 ? void 0 : selected.length) ? (jsx(Box, { sx: { opacity: 0.5 }, children: filterPlaceholder })) : (jsx(Box, { sx: { display: 'flex', flexWrap: 'wrap', gap: '2px' }, children: selected === null || selected === void 0 ? void 0 : selected.map((value) => {
|
1612
|
-
|
1613
|
-
const selectedValue = (_a = columnDef.filterSelectOptions) === null || _a === void 0 ? void 0 : _a.find((option) => option instanceof Object
|
1632
|
+
const selectedValue = filterSelectOptions === null || filterSelectOptions === void 0 ? void 0 : filterSelectOptions.find((option) => option instanceof Object
|
1614
1633
|
? option.value === value
|
1615
1634
|
: option === value);
|
1616
1635
|
return (jsx(Chip, { label: selectedValue instanceof Object
|
@@ -1632,7 +1651,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1632
1651
|
mr: '1.5rem',
|
1633
1652
|
} }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
|
1634
1653
|
? textFieldProps.sx(theme)
|
1635
|
-
: textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx))), children: [(isSelectFilter || isMultiSelectFilter) && (jsx(MenuItem, { divider: true, disabled: true, hidden: true, value: "", children: jsx(Box, { sx: { opacity: 0.5 }, children: filterPlaceholder }) })), (_k = textFieldProps.children) !== null && _k !== void 0 ? _k :
|
1654
|
+
: textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx))), children: [(isSelectFilter || isMultiSelectFilter) && (jsx(MenuItem, { divider: true, disabled: true, hidden: true, value: "", children: jsx(Box, { sx: { opacity: 0.5 }, children: filterPlaceholder }) })), (_k = textFieldProps.children) !== null && _k !== void 0 ? _k : filterSelectOptions === null || filterSelectOptions === void 0 ? void 0 : filterSelectOptions.map((option) => {
|
1636
1655
|
var _a;
|
1637
1656
|
let value;
|
1638
1657
|
let text;
|
@@ -1649,12 +1668,13 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1649
1668
|
m: 0,
|
1650
1669
|
alignItems: 'center',
|
1651
1670
|
gap: '0.5rem',
|
1652
|
-
}, value: value, children: [isMultiSelectFilter && (jsx(Checkbox, { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })), text
|
1671
|
+
}, value: value, children: [isMultiSelectFilter && (jsx(Checkbox, { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })), text, ' ', !columnDef.filterSelectOptions &&
|
1672
|
+
`(${facetedUniqueValues.get(value)})`] }, value));
|
1653
1673
|
})] })), jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table, setFilterValue: setFilterValue })] }));
|
1654
1674
|
};
|
1655
1675
|
|
1656
1676
|
const MRT_FilterRangeFields = ({ header, table }) => {
|
1657
|
-
return (jsxs(Box, { sx: { display: 'grid', gridTemplateColumns: '
|
1677
|
+
return (jsxs(Box, { sx: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1rem' }, children: [jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 0, table: table }), jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })] }));
|
1658
1678
|
};
|
1659
1679
|
|
1660
1680
|
const MRT_FilterCheckbox = ({ column, table }) => {
|
@@ -1693,12 +1713,94 @@ const MRT_FilterCheckbox = ({ column, table }) => {
|
|
1693
1713
|
: checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx))) })), disableTypography: true, label: (_c = checkboxProps.title) !== null && _c !== void 0 ? _c : filterLabel, sx: { color: 'text.secondary', mt: '-4px', fontWeight: 'normal' }, title: undefined }) }));
|
1694
1714
|
};
|
1695
1715
|
|
1716
|
+
const MRT_FilterRangeSlider = ({ header, table }) => {
|
1717
|
+
var _a, _b;
|
1718
|
+
const { options: { localization, muiTableHeadCellFilterSliderProps, enableColumnFilterModes, }, refs: { filterInputRefs }, } = table;
|
1719
|
+
const { column } = header;
|
1720
|
+
const { columnDef } = column;
|
1721
|
+
const currentFilterOption = columnDef._filterFn;
|
1722
|
+
const showChangeModeButton = enableColumnFilterModes && columnDef.enableColumnFilterModes !== false;
|
1723
|
+
const mTableHeadCellFilterTextFieldProps = muiTableHeadCellFilterSliderProps instanceof Function
|
1724
|
+
? muiTableHeadCellFilterSliderProps({
|
1725
|
+
column,
|
1726
|
+
table,
|
1727
|
+
})
|
1728
|
+
: muiTableHeadCellFilterSliderProps;
|
1729
|
+
const mcTableHeadCellFilterTextFieldProps = columnDef.muiTableHeadCellFilterSliderProps instanceof Function
|
1730
|
+
? columnDef.muiTableHeadCellFilterSliderProps({
|
1731
|
+
column,
|
1732
|
+
table,
|
1733
|
+
})
|
1734
|
+
: columnDef.muiTableHeadCellFilterSliderProps;
|
1735
|
+
const sliderProps = Object.assign(Object.assign({}, mTableHeadCellFilterTextFieldProps), mcTableHeadCellFilterTextFieldProps);
|
1736
|
+
let [min, max] = sliderProps.min !== undefined && sliderProps.max !== undefined
|
1737
|
+
? [sliderProps.min, sliderProps.max]
|
1738
|
+
: (_a = column.getFacetedMinMaxValues()) !== null && _a !== void 0 ? _a : [0, 0];
|
1739
|
+
// column.getFacetedMinMaxValues() seems to return an array of arrays for the min value
|
1740
|
+
// under some conditions, so check for that and take the first array value if that happens.
|
1741
|
+
// To be a bit defensive, implement the same check for max, just in case.
|
1742
|
+
if (Array.isArray(min)) {
|
1743
|
+
min = min[0];
|
1744
|
+
}
|
1745
|
+
if (Array.isArray(max)) {
|
1746
|
+
max = max[0];
|
1747
|
+
}
|
1748
|
+
const [filterValues, setFilterValues] = useState([min, max]);
|
1749
|
+
const columnFilterValue = column.getFilterValue();
|
1750
|
+
const isMounted = useRef(false);
|
1751
|
+
useEffect(() => {
|
1752
|
+
if (isMounted.current) {
|
1753
|
+
if (columnFilterValue === undefined) {
|
1754
|
+
setFilterValues([min, max]);
|
1755
|
+
}
|
1756
|
+
else if (Array.isArray(columnFilterValue)) {
|
1757
|
+
if (columnFilterValue[0] <= min && columnFilterValue[1] >= max) {
|
1758
|
+
column.setFilterValue(undefined);
|
1759
|
+
}
|
1760
|
+
else {
|
1761
|
+
setFilterValues(columnFilterValue);
|
1762
|
+
}
|
1763
|
+
}
|
1764
|
+
}
|
1765
|
+
isMounted.current = true;
|
1766
|
+
}, [column.getFilterValue()]);
|
1767
|
+
return (jsxs(Stack, { children: [jsx(Slider, Object.assign({ disableSwap: true, min: min, max: max, onChange: (_event, value) => {
|
1768
|
+
setFilterValues(value);
|
1769
|
+
}, onChangeCommitted: (_event, value) => {
|
1770
|
+
column.setFilterValue(value);
|
1771
|
+
}, value: filterValues, valueLabelDisplay: "auto" }, sliderProps, { slotProps: {
|
1772
|
+
input: {
|
1773
|
+
ref: (node) => {
|
1774
|
+
var _a, _b;
|
1775
|
+
if (node) {
|
1776
|
+
filterInputRefs.current[`${column.id}-0`] = node;
|
1777
|
+
// @ts-ignore
|
1778
|
+
if ((_b = (_a = sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.slotProps) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.ref) {
|
1779
|
+
//@ts-ignore
|
1780
|
+
sliderProps.slotProps.input.ref = node;
|
1781
|
+
}
|
1782
|
+
}
|
1783
|
+
},
|
1784
|
+
},
|
1785
|
+
}, sx: (theme) => (Object.assign({ m: 'auto', mt: !showChangeModeButton ? '10px' : '6px', px: '4px', width: 'calc(100% - 8px)' }, ((sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.sx) instanceof Function
|
1786
|
+
? sliderProps.sx(theme)
|
1787
|
+
: sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.sx))) })), showChangeModeButton ? (jsx(FormHelperText, { sx: {
|
1788
|
+
m: '-3px -6px',
|
1789
|
+
fontSize: '0.75rem',
|
1790
|
+
lineHeight: '0.8rem',
|
1791
|
+
whiteSpace: 'nowrap',
|
1792
|
+
}, children: localization.filterMode.replace('{filterType}',
|
1793
|
+
// @ts-ignore
|
1794
|
+
localization[`filter${((_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) +
|
1795
|
+
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null] }));
|
1796
|
+
};
|
1797
|
+
|
1696
1798
|
const MRT_TableHeadCellFilterContainer = ({ header, table }) => {
|
1697
1799
|
const { getState } = table;
|
1698
1800
|
const { showColumnFilters } = getState();
|
1699
1801
|
const { column } = header;
|
1700
1802
|
const { columnDef } = column;
|
1701
|
-
return (jsx(Collapse, { in: showColumnFilters, mountOnEnter: true, unmountOnExit: true, children: columnDef.filterVariant === 'checkbox' ? (jsx(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range' ||
|
1803
|
+
return (jsx(Collapse, { in: showColumnFilters, mountOnEnter: true, unmountOnExit: true, children: columnDef.filterVariant === 'checkbox' ? (jsx(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range-slider' ? (jsx(MRT_FilterRangeSlider, { header: header, table: table })) : columnDef.filterVariant === 'range' ||
|
1702
1804
|
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (jsx(MRT_FilterRangeFields, { header: header, table: table })) : (jsx(MRT_FilterTextField, { header: header, table: table })) }));
|
1703
1805
|
};
|
1704
1806
|
|
@@ -2726,7 +2828,7 @@ const MRT_TablePaper = ({ table }) => {
|
|
2726
2828
|
|
2727
2829
|
const MRT_EditRowModal = ({ open, row, table, }) => {
|
2728
2830
|
const { options: { localization }, } = table;
|
2729
|
-
return (jsxs(Dialog, { open: open, children: [jsx(DialogTitle, { textAlign: "center", children: localization.edit }), jsx(DialogContent, { children: jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsx(Stack, { sx: {
|
2831
|
+
return (jsxs(Dialog, { open: open, children: [jsx(DialogTitle, { textAlign: "center", children: localization.edit }), jsx(DialogContent, { children: jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsx(Stack$1, { sx: {
|
2730
2832
|
gap: '1.5rem',
|
2731
2833
|
minWidth: { xs: '300px', sm: '360px', md: '400px' },
|
2732
2834
|
pt: '1rem',
|
@@ -2848,7 +2950,23 @@ const MRT_TableRoot = (props) => {
|
|
2848
2950
|
: props.data;
|
2849
2951
|
}, [props.data, (_v = props.state) === null || _v === void 0 ? void 0 : _v.isLoading, (_w = props.state) === null || _w === void 0 ? void 0 : _w.showSkeletons]);
|
2850
2952
|
//@ts-ignore
|
2851
|
-
const table = Object.assign(Object.assign({}, useReactTable(Object.assign(Object.assign({ getCoreRowModel: getCoreRowModel(), getExpandedRowModel:
|
2953
|
+
const table = Object.assign(Object.assign({}, useReactTable(Object.assign(Object.assign({ getCoreRowModel: getCoreRowModel(), getExpandedRowModel: props.enableExpanding || props.enableGrouping
|
2954
|
+
? getExpandedRowModel()
|
2955
|
+
: undefined, getFacetedMinMaxValues: props.enableFacetedValues
|
2956
|
+
? getFacetedMinMaxValues()
|
2957
|
+
: undefined, getFacetedRowModel: props.enableFacetedValues
|
2958
|
+
? getFacetedRowModel()
|
2959
|
+
: undefined, getFacetedUniqueValues: props.enableFacetedValues
|
2960
|
+
? getFacetedUniqueValues()
|
2961
|
+
: undefined, getFilteredRowModel: props.enableColumnFilters ||
|
2962
|
+
props.enableGlobalFilter ||
|
2963
|
+
props.enableFilters
|
2964
|
+
? getFilteredRowModel()
|
2965
|
+
: undefined, getGroupedRowModel: props.enableGrouping
|
2966
|
+
? getGroupedRowModel()
|
2967
|
+
: undefined, getPaginationRowModel: props.enablePagination
|
2968
|
+
? getPaginationRowModel()
|
2969
|
+
: undefined, getSortedRowModel: props.enableSorting ? getSortedRowModel() : undefined, onColumnOrderChange: setColumnOrder, onGroupingChange: setGrouping, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows }, props), {
|
2852
2970
|
//@ts-ignore
|
2853
2971
|
columns: columnDefs, data, globalFilterFn: (_y = (_x = props.filterFns) === null || _x === void 0 ? void 0 : _x[globalFilterFn]) !== null && _y !== void 0 ? _y : (_z = props.filterFns) === null || _z === void 0 ? void 0 : _z.fuzzy, initialState, state: Object.assign({ columnFilterFns,
|
2854
2972
|
columnOrder,
|
@@ -2914,7 +3032,7 @@ const MRT_TableRoot = (props) => {
|
|
2914
3032
|
|
2915
3033
|
const MaterialReactTable = (_a) => {
|
2916
3034
|
var _b;
|
2917
|
-
var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onChange', defaultColumn, defaultDisplayColumn, editingMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enablePinning = false, enableRowSelection = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode = 'semantic', localization, manualFiltering, manualGrouping, manualPagination, manualSorting, positionActionsColumn = 'first', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberMode = 'original', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnResizeMode", "defaultColumn", "defaultDisplayColumn", "editingMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enablePinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberMode", "selectAllMode", "sortingFns"]);
|
3035
|
+
var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onChange', defaultColumn, defaultDisplayColumn, editingMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enablePinning = false, enableRowSelection = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode = 'semantic', localization, manualFiltering, manualGrouping, manualPagination, manualSorting, positionActionsColumn = 'first', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberMode = 'original', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnResizeMode", "defaultColumn", "defaultDisplayColumn", "editingMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enablePinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberMode", "selectAllMode", "sortingFns"]);
|
2918
3036
|
const _icons = useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
|
2919
3037
|
const _localization = useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
|
2920
3038
|
const _aggregationFns = useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
|
@@ -2937,7 +3055,7 @@ const MaterialReactTable = (_a) => {
|
|
2937
3055
|
manualPagination = true;
|
2938
3056
|
manualSorting = true;
|
2939
3057
|
}
|
2940
|
-
return (jsx(MRT_TableRoot, Object.assign({ aggregationFns: _aggregationFns, autoResetExpanded: autoResetExpanded, columnResizeMode: columnResizeMode, defaultColumn: _defaultColumn, defaultDisplayColumn: _defaultDisplayColumn, editingMode: editingMode, enableBottomToolbar: enableBottomToolbar, enableColumnActions: enableColumnActions, enableColumnFilters: enableColumnFilters, enableColumnOrdering: enableColumnOrdering, enableColumnResizing: enableColumnResizing, enableDensityToggle: enableDensityToggle, enableExpandAll: enableExpandAll, enableFilterMatchHighlighting: enableFilterMatchHighlighting, enableFilters: enableFilters, enableFullScreenToggle: enableFullScreenToggle, enableGlobalFilter: enableGlobalFilter, enableGlobalFilterRankedResults: enableGlobalFilterRankedResults, enableGrouping: enableGrouping, enableHiding: enableHiding, enableMultiRowSelection: enableMultiRowSelection, enableMultiSort: enableMultiSort, enablePagination: enablePagination, enablePinning: enablePinning, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, enableSorting: enableSorting, enableStickyHeader: enableStickyHeader, enableTableFooter: enableTableFooter, enableTableHead: enableTableHead, enableToolbarInternalActions: enableToolbarInternalActions, enableTopToolbar: enableTopToolbar, filterFns: _filterFns, icons: _icons, layoutMode: layoutMode, localization: _localization, manualFiltering: manualFiltering, manualGrouping: manualGrouping, manualPagination: manualPagination, manualSorting: manualSorting, positionActionsColumn: positionActionsColumn, positionExpandColumn: positionExpandColumn, positionGlobalFilter: positionGlobalFilter, positionPagination: positionPagination, positionToolbarAlertBanner: positionToolbarAlertBanner, positionToolbarDropZone: positionToolbarDropZone, rowNumberMode: rowNumberMode, selectAllMode: selectAllMode, sortingFns: _sortingFns }, rest)));
|
3058
|
+
return (jsx(MRT_TableRoot, Object.assign({ aggregationFns: _aggregationFns, autoResetExpanded: autoResetExpanded, columnResizeMode: columnResizeMode, defaultColumn: _defaultColumn, defaultDisplayColumn: _defaultDisplayColumn, editingMode: editingMode, enableBottomToolbar: enableBottomToolbar, enableColumnActions: enableColumnActions, enableColumnFilters: enableColumnFilters, enableColumnOrdering: enableColumnOrdering, enableColumnResizing: enableColumnResizing, enableDensityToggle: enableDensityToggle, enableExpandAll: enableExpandAll, enableExpanding: enableExpanding, enableFilterMatchHighlighting: enableFilterMatchHighlighting, enableFilters: enableFilters, enableFullScreenToggle: enableFullScreenToggle, enableGlobalFilter: enableGlobalFilter, enableGlobalFilterRankedResults: enableGlobalFilterRankedResults, enableGrouping: enableGrouping, enableHiding: enableHiding, enableMultiRowSelection: enableMultiRowSelection, enableMultiSort: enableMultiSort, enablePagination: enablePagination, enablePinning: enablePinning, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, enableSorting: enableSorting, enableStickyHeader: enableStickyHeader, enableTableFooter: enableTableFooter, enableTableHead: enableTableHead, enableToolbarInternalActions: enableToolbarInternalActions, enableTopToolbar: enableTopToolbar, filterFns: _filterFns, icons: _icons, layoutMode: layoutMode, localization: _localization, manualFiltering: manualFiltering, manualGrouping: manualGrouping, manualPagination: manualPagination, manualSorting: manualSorting, positionActionsColumn: positionActionsColumn, positionExpandColumn: positionExpandColumn, positionGlobalFilter: positionGlobalFilter, positionPagination: positionPagination, positionToolbarAlertBanner: positionToolbarAlertBanner, positionToolbarDropZone: positionToolbarDropZone, rowNumberMode: rowNumberMode, selectAllMode: selectAllMode, sortingFns: _sortingFns }, rest)));
|
2941
3059
|
};
|
2942
3060
|
|
2943
3061
|
export { MRT_AggregationFns, MRT_BottomToolbar, MRT_CopyButton, MRT_EditActionButtons, MRT_ExpandButton, MRT_FilterFns, MRT_FilterOptionMenu, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_GrabHandleButton, MRT_ShowHideColumnsButton, MRT_SortingFns, MRT_TableHeadCellFilterContainer, MRT_TablePagination, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactTable, MaterialReactTable as default };
|