material-react-table 0.38.4 → 0.39.0
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/MaterialReactTable.d.ts +25 -4
- package/dist/cjs/column.utils.d.ts +1 -0
- package/dist/cjs/index.js +41 -30
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/menus/MRT_FilterOptionMenu.d.ts +2 -7
- package/dist/esm/MaterialReactTable.d.ts +25 -4
- package/dist/esm/column.utils.d.ts +1 -0
- package/dist/esm/material-react-table.esm.js +41 -30
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/menus/MRT_FilterOptionMenu.d.ts +2 -7
- package/dist/index.d.ts +26 -5
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +41 -7
- package/src/column.utils.ts +1 -1
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +3 -2
- package/src/inputs/MRT_FilterTextField.tsx +5 -8
- package/src/inputs/MRT_GlobalFilterTextField.tsx +2 -2
- package/src/menus/MRT_ColumnActionMenu.tsx +3 -3
- package/src/menus/MRT_FilterOptionMenu.tsx +50 -33
- package/src/table/MRT_TableRoot.tsx +3 -4
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { MRT_Header, MRT_TableInstance } from '..';
|
|
2
|
+
import type { MRT_Header, MRT_InternalFilterOption, MRT_TableInstance } from '..';
|
|
3
3
|
import { MRT_Localization } from '../localization';
|
|
4
|
-
export declare const
|
|
5
|
-
option: string;
|
|
6
|
-
symbol: string;
|
|
7
|
-
label: string;
|
|
8
|
-
divider: boolean;
|
|
9
|
-
}[];
|
|
4
|
+
export declare const mrtFilterOptions: (localization: MRT_Localization) => MRT_InternalFilterOption[];
|
|
10
5
|
interface Props<TData extends Record<string, any> = {}> {
|
|
11
6
|
anchorEl: HTMLElement | null;
|
|
12
7
|
header?: MRT_Header;
|
|
@@ -154,7 +154,7 @@ export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit
|
|
|
154
154
|
enableClickToCopy?: boolean;
|
|
155
155
|
enableColumnActions?: boolean;
|
|
156
156
|
enableColumnDragging?: boolean;
|
|
157
|
-
|
|
157
|
+
enableColumnFilterModes?: boolean;
|
|
158
158
|
enableColumnOrdering?: boolean;
|
|
159
159
|
enableEditing?: boolean;
|
|
160
160
|
filterFn?: MRT_FilterFn<TData>;
|
|
@@ -216,6 +216,10 @@ export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit
|
|
|
216
216
|
table: MRT_TableInstance<TData>;
|
|
217
217
|
column: MRT_Column<TData>;
|
|
218
218
|
}) => TableCellProps);
|
|
219
|
+
renderColumnFilterModeMenuItems?: ({ table, column, }: {
|
|
220
|
+
table: MRT_TableInstance<TData>;
|
|
221
|
+
column: MRT_Column<TData>;
|
|
222
|
+
}) => ReactNode[];
|
|
219
223
|
sortingFn?: MRT_SortingFn;
|
|
220
224
|
};
|
|
221
225
|
export declare type MRT_DefinedColumnDef<TData extends Record<string, any> = {}> = Omit<MRT_ColumnDef<TData>, 'id'> & {
|
|
@@ -249,6 +253,12 @@ export declare type MRT_SortingOption = LiteralUnion<string & keyof typeof MRT_S
|
|
|
249
253
|
export declare type MRT_SortingFn<TData extends Record<string, any> = {}> = SortingFn<TData> | MRT_SortingOption;
|
|
250
254
|
export declare type MRT_FilterOption = LiteralUnion<string & keyof typeof MRT_FilterFns>;
|
|
251
255
|
export declare type MRT_FilterFn<TData extends Record<string, any> = {}> = FilterFn<TData> | MRT_FilterOption;
|
|
256
|
+
export declare type MRT_InternalFilterOption = {
|
|
257
|
+
option: string;
|
|
258
|
+
symbol: string;
|
|
259
|
+
label: string;
|
|
260
|
+
divider: boolean;
|
|
261
|
+
};
|
|
252
262
|
export declare type MRT_DisplayColumnIds = 'mrt-row-actions' | 'mrt-row-drag' | 'mrt-row-expand' | 'mrt-row-numbers' | 'mrt-row-select';
|
|
253
263
|
/**
|
|
254
264
|
* `columns` and `data` props are the only required props, but there are over 150 other optional props.
|
|
@@ -272,13 +282,13 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
|
272
282
|
enableClickToCopy?: boolean;
|
|
273
283
|
enableColumnActions?: boolean;
|
|
274
284
|
enableColumnDragging?: boolean;
|
|
275
|
-
|
|
285
|
+
enableColumnFilterModes?: boolean;
|
|
276
286
|
enableColumnOrdering?: boolean;
|
|
277
287
|
enableDensityToggle?: boolean;
|
|
278
288
|
enableEditing?: boolean;
|
|
279
289
|
enableExpandAll?: boolean;
|
|
280
290
|
enableFullScreenToggle?: boolean;
|
|
281
|
-
|
|
291
|
+
enableGlobalFilterModes?: boolean;
|
|
282
292
|
enableGlobalFilterRankedResults?: boolean;
|
|
283
293
|
enablePagination?: boolean;
|
|
284
294
|
enableRowActions?: boolean;
|
|
@@ -460,10 +470,21 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
|
460
470
|
renderBottomToolbarCustomActions?: ({ table, }: {
|
|
461
471
|
table: MRT_TableInstance<TData>;
|
|
462
472
|
}) => ReactNode;
|
|
473
|
+
renderColumnFilterModeMenuItems?: ({ column, internalFilterOptions, onSelectFilterMode, table, }: {
|
|
474
|
+
column: MRT_Column<TData>;
|
|
475
|
+
internalFilterOptions: MRT_InternalFilterOption[];
|
|
476
|
+
onSelectFilterMode: (filterMode: MRT_FilterOption) => void;
|
|
477
|
+
table: MRT_TableInstance<TData>;
|
|
478
|
+
}) => ReactNode;
|
|
463
479
|
renderDetailPanel?: ({ row, table, }: {
|
|
464
480
|
row: MRT_Row<TData>;
|
|
465
481
|
table: MRT_TableInstance<TData>;
|
|
466
482
|
}) => ReactNode;
|
|
483
|
+
renderGlobalFilterModeMenuItems?: ({ internalFilterOptions, onSelectFilterMode, table, }: {
|
|
484
|
+
internalFilterOptions: MRT_InternalFilterOption[];
|
|
485
|
+
onSelectFilterMode: (filterMode: MRT_FilterOption) => void;
|
|
486
|
+
table: MRT_TableInstance<TData>;
|
|
487
|
+
}) => ReactNode[];
|
|
467
488
|
renderRowActionMenuItems?: ({ closeMenu, row, table, }: {
|
|
468
489
|
closeMenu: () => void;
|
|
469
490
|
row: MRT_Row<TData>;
|
|
@@ -488,5 +509,5 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
|
488
509
|
table: MRT_TableInstance<TData>;
|
|
489
510
|
}) => Partial<VirtualizerOptions<HTMLDivElement>>);
|
|
490
511
|
};
|
|
491
|
-
declare const _default: <TData extends Record<string, any> = {}>({ aggregationFns, autoResetExpanded, columnResizeMode, defaultColumn, editingMode, enableBottomToolbar, enableColumnActions,
|
|
512
|
+
declare const _default: <TData extends Record<string, any> = {}>({ aggregationFns, autoResetExpanded, columnResizeMode, defaultColumn, editingMode, enableBottomToolbar, enableColumnActions, enableColumnFilterModes, enableColumnFilters, enableColumnOrdering, enableColumnResizing, enableDensityToggle, enableExpandAll, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableGlobalFilterModes, enableGlobalFilterRankedResults, enableGrouping, enableHiding, enableMultiRowSelection, enableMultiSort, enablePagination, enablePinning, enableRowSelection, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarInternalActions, enableTopToolbar, filterFns, icons, localization, positionActionsColumn, positionExpandColumn, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, rowNumberMode, selectAllMode, sortingFns, ...rest }: MaterialReactTableProps<TData>) => JSX.Element;
|
|
492
513
|
export default _default;
|
|
@@ -3,6 +3,7 @@ import { MaterialReactTableProps, MRT_Column, MRT_ColumnDef, MRT_DefinedColumnDe
|
|
|
3
3
|
import { MRT_FilterFns } from './filterFns';
|
|
4
4
|
import { MRT_SortingFns } from './sortingFns';
|
|
5
5
|
export declare const defaultDisplayColumnDefOptions: Partial<MRT_ColumnDef<{}>>;
|
|
6
|
+
export declare const getColumnId: <TData extends Record<string, any> = {}>(columnDef: MRT_ColumnDef<TData>) => string;
|
|
6
7
|
export declare const getAllLeafColumnDefs: <TData extends Record<string, any> = {}>(columns: MRT_ColumnDef<TData>[]) => MRT_ColumnDef<TData>[];
|
|
7
8
|
export declare const prepareColumns: <TData extends Record<string, any> = {}>(columnDefs: MRT_ColumnDef<TData>[], columnFilterFns: {
|
|
8
9
|
[key: string]: MRT_FilterOption;
|
|
@@ -292,7 +292,7 @@ const MRT_ExpandButton = ({ row, table }) => {
|
|
|
292
292
|
} })))));
|
|
293
293
|
};
|
|
294
294
|
|
|
295
|
-
const
|
|
295
|
+
const mrtFilterOptions = (localization) => [
|
|
296
296
|
{
|
|
297
297
|
option: 'fuzzy',
|
|
298
298
|
symbol: '≈',
|
|
@@ -379,19 +379,19 @@ const internalFilterOptions = (localization) => [
|
|
|
379
379
|
},
|
|
380
380
|
];
|
|
381
381
|
const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, table, }) => {
|
|
382
|
-
var _a;
|
|
383
|
-
const { getState, options: { enabledGlobalFilterOptions, columnFilterModeOptions, localization, }, setColumnFilterFns, setGlobalFilterFn, } = table;
|
|
384
|
-
const {
|
|
382
|
+
var _a, _b;
|
|
383
|
+
const { getState, options: { enabledGlobalFilterOptions, columnFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
|
|
384
|
+
const { globalFilterFn, density } = getState();
|
|
385
385
|
const { column } = header !== null && header !== void 0 ? header : {};
|
|
386
386
|
const { columnDef } = column !== null && column !== void 0 ? column : {};
|
|
387
387
|
const allowedColumnFilterOptions = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _a !== void 0 ? _a : columnFilterModeOptions;
|
|
388
|
-
const
|
|
388
|
+
const internalFilterOptions = useMemo(() => mrtFilterOptions(localization).filter((filterOption) => columnDef
|
|
389
389
|
? allowedColumnFilterOptions === undefined ||
|
|
390
390
|
(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.includes(filterOption.option))
|
|
391
391
|
: (!enabledGlobalFilterOptions ||
|
|
392
392
|
enabledGlobalFilterOptions.includes(filterOption.option)) &&
|
|
393
|
-
['fuzzy', 'contains'].includes(filterOption.option)), []);
|
|
394
|
-
const
|
|
393
|
+
['fuzzy', 'contains', 'startsWith'].includes(filterOption.option)), []);
|
|
394
|
+
const handleSelectFilterMode = (option) => {
|
|
395
395
|
if (header && column) {
|
|
396
396
|
setColumnFilterFns((prev) => (Object.assign(Object.assign({}, prev), { [header.id]: option })));
|
|
397
397
|
if (['empty', 'notEmpty'].includes(option)) {
|
|
@@ -410,15 +410,26 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, table,
|
|
|
410
410
|
setAnchorEl(null);
|
|
411
411
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
|
412
412
|
};
|
|
413
|
-
const filterOption = !!header ?
|
|
413
|
+
const filterOption = !!header && columnDef ? columnDef._filterFn : globalFilterFn;
|
|
414
414
|
return (React.createElement(Menu, { anchorEl: anchorEl, anchorOrigin: { vertical: 'center', horizontal: 'right' }, onClose: () => setAnchorEl(null), open: !!anchorEl, MenuListProps: {
|
|
415
415
|
dense: density === 'compact',
|
|
416
|
-
} },
|
|
417
|
-
|
|
418
|
-
|
|
416
|
+
} }, (_b = (header && column
|
|
417
|
+
? renderColumnFilterModeMenuItems === null || renderColumnFilterModeMenuItems === void 0 ? void 0 : renderColumnFilterModeMenuItems({
|
|
418
|
+
column: column,
|
|
419
|
+
internalFilterOptions,
|
|
420
|
+
onSelectFilterMode: handleSelectFilterMode,
|
|
421
|
+
table,
|
|
422
|
+
})
|
|
423
|
+
: renderGlobalFilterModeMenuItems === null || renderGlobalFilterModeMenuItems === void 0 ? void 0 : renderGlobalFilterModeMenuItems({
|
|
424
|
+
internalFilterOptions,
|
|
425
|
+
onSelectFilterMode: handleSelectFilterMode,
|
|
426
|
+
table,
|
|
427
|
+
}))) !== null && _b !== void 0 ? _b : internalFilterOptions.map(({ option, label, divider, symbol }, index) => (React.createElement(MenuItem, { divider: divider, key: index, onClick: () => handleSelectFilterMode(option), selected: option === filterOption, sx: {
|
|
419
428
|
alignItems: 'center',
|
|
420
429
|
display: 'flex',
|
|
421
430
|
gap: '2ch',
|
|
431
|
+
my: 0,
|
|
432
|
+
py: '6px',
|
|
422
433
|
}, value: option },
|
|
423
434
|
React.createElement(Box, { sx: { fontSize: '1.25rem', width: '2ch' } }, symbol),
|
|
424
435
|
label)))));
|
|
@@ -706,7 +717,7 @@ const commonListItemStyles = {
|
|
|
706
717
|
};
|
|
707
718
|
const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
708
719
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
709
|
-
const { getState, toggleAllColumnsVisible, setColumnOrder, options: {
|
|
720
|
+
const { getState, toggleAllColumnsVisible, setColumnOrder, options: { enableColumnFilterModes, enableColumnFilters, enableColumnResizing, enableGrouping, enableHiding, enablePinning, enableSorting, columnFilterModeOptions, icons: { ArrowRightIcon, ClearAllIcon, ViewColumnIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, SortIcon, RestartAltIcon, VisibilityOffIcon, }, localization, }, refs: { filterInputRefs }, setShowFilters, } = table;
|
|
710
721
|
const { column } = header;
|
|
711
722
|
const { columnDef } = column;
|
|
712
723
|
const { columnSizing, columnVisibility, density } = getState();
|
|
@@ -764,8 +775,8 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
|
764
775
|
};
|
|
765
776
|
const isSelectFilter = !!columnDef.filterSelectOptions;
|
|
766
777
|
const allowedColumnFilterOptions = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _a !== void 0 ? _a : columnFilterModeOptions;
|
|
767
|
-
const showFilterModeSubMenu =
|
|
768
|
-
columnDef.
|
|
778
|
+
const showFilterModeSubMenu = enableColumnFilterModes &&
|
|
779
|
+
columnDef.enableColumnFilterModes !== false &&
|
|
769
780
|
!isSelectFilter &&
|
|
770
781
|
(allowedColumnFilterOptions === undefined ||
|
|
771
782
|
!!(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.length));
|
|
@@ -967,7 +978,7 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
|
|
967
978
|
|
|
968
979
|
const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
969
980
|
var _a;
|
|
970
|
-
const { getState, setGlobalFilter, options: {
|
|
981
|
+
const { getState, setGlobalFilter, options: { enableGlobalFilterModes, icons: { SearchIcon, CloseIcon }, localization, muiSearchTextFieldProps, }, refs: { searchInputRef }, } = table;
|
|
971
982
|
const { globalFilter, showGlobalFilter } = getState();
|
|
972
983
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
973
984
|
const [searchValue, setSearchValue] = useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
|
|
@@ -991,7 +1002,7 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
|
991
1002
|
: muiSearchTextFieldProps;
|
|
992
1003
|
return (React.createElement(Collapse, { in: showGlobalFilter, orientation: "horizontal" },
|
|
993
1004
|
React.createElement(TextField, Object.assign({ placeholder: localization.search, onChange: handleChange, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard", InputProps: {
|
|
994
|
-
startAdornment:
|
|
1005
|
+
startAdornment: enableGlobalFilterModes ? (React.createElement(InputAdornment, { position: "start" },
|
|
995
1006
|
React.createElement(Tooltip, { arrow: true, title: localization.changeSearchMode },
|
|
996
1007
|
React.createElement(IconButton, { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' } },
|
|
997
1008
|
React.createElement(SearchIcon, null))))) : (React.createElement(SearchIcon, { style: { marginRight: '4px' } })),
|
|
@@ -1302,10 +1313,9 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
|
1302
1313
|
|
|
1303
1314
|
const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1304
1315
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1305
|
-
const {
|
|
1316
|
+
const { options: { enableColumnFilterModes, columnFilterModeOptions, icons: { FilterListIcon, CloseIcon }, localization, muiTableHeadCellFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
|
|
1306
1317
|
const { column } = header;
|
|
1307
1318
|
const { columnDef } = column;
|
|
1308
|
-
const { columnFilterFns } = getState();
|
|
1309
1319
|
const mTableHeadCellFilterTextFieldProps = muiTableHeadCellFilterTextFieldProps instanceof Function
|
|
1310
1320
|
? muiTableHeadCellFilterTextFieldProps({
|
|
1311
1321
|
column,
|
|
@@ -1326,7 +1336,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1326
1336
|
const isMultiSelectFilter = columnDef.filterVariant === 'multi-select';
|
|
1327
1337
|
const isTextboxFilter = columnDef.filterVariant === 'text' ||
|
|
1328
1338
|
(!isSelectFilter && !isMultiSelectFilter);
|
|
1329
|
-
const currentFilterOption =
|
|
1339
|
+
const currentFilterOption = columnDef._filterFn;
|
|
1330
1340
|
const filterChipLabel = ['empty', 'notEmpty'].includes(currentFilterOption)
|
|
1331
1341
|
? //@ts-ignore
|
|
1332
1342
|
localization[`filter${((_b = (_a = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt) === null || _a === void 0 ? void 0 : _a.call(currentFilterOption, 0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) +
|
|
@@ -1340,8 +1350,8 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1340
1350
|
? localization.max
|
|
1341
1351
|
: '';
|
|
1342
1352
|
const allowedColumnFilterOptions = (_d = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _d !== void 0 ? _d : columnFilterModeOptions;
|
|
1343
|
-
const showChangeModeButton =
|
|
1344
|
-
columnDef.
|
|
1353
|
+
const showChangeModeButton = enableColumnFilterModes &&
|
|
1354
|
+
columnDef.enableColumnFilterModes !== false &&
|
|
1345
1355
|
!rangeFilterIndex &&
|
|
1346
1356
|
(allowedColumnFilterOptions === undefined ||
|
|
1347
1357
|
!!(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.length));
|
|
@@ -1448,7 +1458,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1448
1458
|
if (textFieldProps.inputRef) {
|
|
1449
1459
|
textFieldProps.inputRef = inputRef;
|
|
1450
1460
|
}
|
|
1451
|
-
}, sx: (theme) => (Object.assign({ p: 0, minWidth: !filterChipLabel ? '
|
|
1461
|
+
}, sx: (theme) => (Object.assign({ p: 0, minWidth: !filterChipLabel ? '120px' : 'auto', width: '100%', '& .MuiSelect-icon': {
|
|
1452
1462
|
mr: '1.5rem',
|
|
1453
1463
|
} }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
|
|
1454
1464
|
? textFieldProps.sx(theme)
|
|
@@ -1482,9 +1492,10 @@ const MRT_FilterRangeFields = ({ header, table }) => {
|
|
|
1482
1492
|
|
|
1483
1493
|
const MRT_TableHeadCellFilterContainer = ({ header, table, }) => {
|
|
1484
1494
|
const { getState } = table;
|
|
1485
|
-
const {
|
|
1495
|
+
const { showColumnFilters } = getState();
|
|
1486
1496
|
const { column } = header;
|
|
1487
|
-
|
|
1497
|
+
const { columnDef } = column;
|
|
1498
|
+
return (React.createElement(Collapse, { in: showColumnFilters, mountOnEnter: true, unmountOnExit: true }, ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (React.createElement(MRT_FilterRangeFields, { header: header, table: table })) : (React.createElement(MRT_FilterTextField, { header: header, table: table }))));
|
|
1488
1499
|
};
|
|
1489
1500
|
|
|
1490
1501
|
const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
@@ -2330,11 +2341,11 @@ const MRT_TableRoot = (props) => {
|
|
|
2330
2341
|
return initState;
|
|
2331
2342
|
}, []);
|
|
2332
2343
|
const [columnFilterFns, setColumnFilterFns] = useState(() => Object.assign({}, ...getAllLeafColumnDefs(props.columns).map((col) => {
|
|
2333
|
-
var _a, _b, _c, _d
|
|
2344
|
+
var _a, _b, _c, _d;
|
|
2334
2345
|
return ({
|
|
2335
|
-
[(
|
|
2336
|
-
? (
|
|
2337
|
-
: (
|
|
2346
|
+
[getColumnId(col)]: col.filterFn instanceof Function
|
|
2347
|
+
? (_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom'
|
|
2348
|
+
: (_d = (_b = col.filterFn) !== null && _b !== void 0 ? _b : (_c = initialState === null || initialState === void 0 ? void 0 : initialState.columnFilterFns) === null || _c === void 0 ? void 0 : _c[getColumnId(col)]) !== null && _d !== void 0 ? _d : getDefaultColumnFilterFn(col),
|
|
2338
2349
|
});
|
|
2339
2350
|
})));
|
|
2340
2351
|
const [columnOrder, setColumnOrder] = useState((_a = initialState.columnOrder) !== null && _a !== void 0 ? _a : []);
|
|
@@ -2432,8 +2443,8 @@ const MRT_TableRoot = (props) => {
|
|
|
2432
2443
|
};
|
|
2433
2444
|
|
|
2434
2445
|
var MaterialReactTable = (_a) => {
|
|
2435
|
-
var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onEnd', defaultColumn = { minSize: 40, maxSize: 1000, size: 180 }, editingMode = 'modal', enableBottomToolbar = true, enableColumnActions = true,
|
|
2436
|
-
return (React.createElement(MRT_TableRoot, Object.assign({ aggregationFns: Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns), autoResetExpanded: autoResetExpanded, columnResizeMode: columnResizeMode, defaultColumn: defaultColumn, editingMode: editingMode, enableBottomToolbar: enableBottomToolbar, enableColumnActions: enableColumnActions,
|
|
2446
|
+
var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onEnd', defaultColumn = { minSize: 40, maxSize: 1000, size: 180 }, editingMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilterModes = false, enableColumnFilters = true, enableColumnOrdering = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterModes = false, 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, localization, positionActionsColumn = 'first', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberMode = 'original', selectAllMode = 'all', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnResizeMode", "defaultColumn", "editingMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilterModes", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterModes", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enablePinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "localization", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberMode", "selectAllMode", "sortingFns"]);
|
|
2447
|
+
return (React.createElement(MRT_TableRoot, Object.assign({ aggregationFns: Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns), autoResetExpanded: autoResetExpanded, columnResizeMode: columnResizeMode, defaultColumn: defaultColumn, editingMode: editingMode, enableBottomToolbar: enableBottomToolbar, enableColumnActions: enableColumnActions, enableColumnFilterModes: enableColumnFilterModes, enableColumnFilters: enableColumnFilters, enableColumnOrdering: enableColumnOrdering, enableColumnResizing: enableColumnResizing, enableDensityToggle: enableDensityToggle, enableExpandAll: enableExpandAll, enableFilters: enableFilters, enableFullScreenToggle: enableFullScreenToggle, enableGlobalFilter: enableGlobalFilter, enableGlobalFilterModes: enableGlobalFilterModes, 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: Object.assign(Object.assign({}, MRT_FilterFns), filterFns), icons: Object.assign(Object.assign({}, MRT_Default_Icons), icons), localization: Object.assign(Object.assign({}, MRT_DefaultLocalization_EN), localization), positionActionsColumn: positionActionsColumn, positionExpandColumn: positionExpandColumn, positionGlobalFilter: positionGlobalFilter, positionPagination: positionPagination, positionToolbarAlertBanner: positionToolbarAlertBanner, positionToolbarDropZone: positionToolbarDropZone, rowNumberMode: rowNumberMode, selectAllMode: selectAllMode, sortingFns: Object.assign(Object.assign({}, MRT_SortingFns), sortingFns) }, rest)));
|
|
2437
2448
|
};
|
|
2438
2449
|
|
|
2439
2450
|
export { MRT_CopyButton, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MaterialReactTable as default };
|