material-react-table 0.5.5 → 0.5.8
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/MaterialReactTable.d.ts +20 -3
- package/dist/filtersFNs.d.ts +4 -0
- package/dist/localization.d.ts +1 -0
- package/dist/material-react-table.cjs.development.js +174 -70
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +177 -71
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/menus/MRT_ColumnActionMenu.d.ts +11 -0
- package/package.json +6 -7
- package/src/MaterialReactTable.tsx +23 -9
- package/src/body/MRT_TableBodyCell.tsx +12 -3
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +32 -32
- package/src/filtersFNs.ts +12 -0
- package/src/head/MRT_TableHeadCell.tsx +6 -15
- package/src/inputs/MRT_FilterTextField.tsx +71 -17
- package/src/localization.ts +2 -0
- package/src/menus/MRT_ColumnActionMenu.tsx +125 -120
- package/src/menus/MRT_FilterTypeMenu.tsx +34 -26
- package/src/menus/MRT_RowActionMenu.tsx +14 -20
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +5 -1
- package/src/table/MRT_TableContainer.tsx +7 -1
- package/src/useMRT.tsx +14 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useMemo, useContext, createContext, Fragment, useRef, useEffect } from 'react';
|
|
2
2
|
import { useTable, useFilters, useGlobalFilter, useGroupBy, useSortBy, useExpanded, usePagination, useRowSelect, useResizeColumns, useFlexLayout, useAsyncDebounce } from 'react-table';
|
|
3
3
|
import { matchSorter } from 'match-sorter';
|
|
4
|
-
import { Menu,
|
|
4
|
+
import { Menu, MenuItem, TextField, InputAdornment, Tooltip, IconButton, Chip, Box, TableCell, TableSortLabel, Divider, Collapse, Skeleton, Checkbox, TableRow, TableHead, alpha, TableBody, TableFooter, Table, FormControlLabel, Switch, Button, TablePagination, useMediaQuery, Alert, Toolbar, TableContainer, Paper, LinearProgress } from '@mui/material';
|
|
5
5
|
import ArrowRightIcon from '@mui/icons-material/ArrowRight';
|
|
6
6
|
import CancelIcon from '@mui/icons-material/Cancel';
|
|
7
7
|
import ClearAllIcon from '@mui/icons-material/ClearAll';
|
|
@@ -227,13 +227,9 @@ var MaterialReactTableProvider = function MaterialReactTableProvider(props) {
|
|
|
227
227
|
|
|
228
228
|
var _useState6 = useState(function () {
|
|
229
229
|
return Object.assign.apply(Object, [{}].concat(props.columns.map(function (c) {
|
|
230
|
-
var _c$
|
|
230
|
+
var _ref, _c$filter, _props$initialState5, _props$initialState5$, _ref2;
|
|
231
231
|
|
|
232
|
-
return (_c$
|
|
233
|
-
}).map(function (accessor) {
|
|
234
|
-
var _props$initialState$f2, _props$initialState5, _props$initialState5$, _ref;
|
|
235
|
-
|
|
236
|
-
return _ref = {}, _ref[accessor] = (_props$initialState$f2 = props == null ? void 0 : (_props$initialState5 = props.initialState) == null ? void 0 : (_props$initialState5$ = _props$initialState5.filters) == null ? void 0 : _props$initialState5$[accessor]) != null ? _props$initialState$f2 : 'fuzzy', _ref;
|
|
232
|
+
return _ref2 = {}, _ref2[c.accessor] = (_ref = (_c$filter = c.filter) != null ? _c$filter : props == null ? void 0 : (_props$initialState5 = props.initialState) == null ? void 0 : (_props$initialState5$ = _props$initialState5.filters) == null ? void 0 : _props$initialState5$[c.accessor]) != null ? _ref : !!c.filterSelectOptions ? 'equals' : 'fuzzy', _ref2;
|
|
237
233
|
})));
|
|
238
234
|
}),
|
|
239
235
|
currentFilterTypes = _useState6[0],
|
|
@@ -249,6 +245,7 @@ var MaterialReactTableProvider = function MaterialReactTableProvider(props) {
|
|
|
249
245
|
columns: columns,
|
|
250
246
|
// @ts-ignore
|
|
251
247
|
filterTypes: filterTypes,
|
|
248
|
+
globalFilterValue: 'fuzzy',
|
|
252
249
|
useControlledState: function useControlledState(state) {
|
|
253
250
|
return useMemo(function () {
|
|
254
251
|
return _extends({}, state, {
|
|
@@ -298,6 +295,11 @@ var useMRT = function useMRT() {
|
|
|
298
295
|
return useContext(MaterialReactTableContext);
|
|
299
296
|
};
|
|
300
297
|
|
|
298
|
+
var commonMenuItemStyles = {
|
|
299
|
+
py: '6px',
|
|
300
|
+
my: 0,
|
|
301
|
+
alignItems: 'center'
|
|
302
|
+
};
|
|
301
303
|
var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
|
|
302
304
|
var anchorEl = _ref.anchorEl,
|
|
303
305
|
column = _ref.column,
|
|
@@ -311,35 +313,35 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
|
|
|
311
313
|
|
|
312
314
|
var filterTypes = useMemo(function () {
|
|
313
315
|
return [{
|
|
314
|
-
type:
|
|
316
|
+
type: MRT_FILTER_TYPE.FUZZY,
|
|
315
317
|
label: localization.filterMenuItemFuzzy,
|
|
316
318
|
divider: false
|
|
317
319
|
}, {
|
|
318
|
-
type:
|
|
320
|
+
type: MRT_FILTER_TYPE.CONTAINS,
|
|
319
321
|
label: localization.filterMenuItemContains,
|
|
320
322
|
divider: true
|
|
321
323
|
}, {
|
|
322
|
-
type:
|
|
324
|
+
type: MRT_FILTER_TYPE.STARTS_WITH,
|
|
323
325
|
label: localization.filterMenuItemStartsWith,
|
|
324
326
|
divider: false
|
|
325
327
|
}, {
|
|
326
|
-
type:
|
|
328
|
+
type: MRT_FILTER_TYPE.ENDS_WITH,
|
|
327
329
|
label: localization.filterMenuItemEndsWith,
|
|
328
330
|
divider: true
|
|
329
331
|
}, {
|
|
330
|
-
type:
|
|
332
|
+
type: MRT_FILTER_TYPE.EQUALS,
|
|
331
333
|
label: localization.filterMenuItemEquals,
|
|
332
334
|
divider: false
|
|
333
335
|
}, {
|
|
334
|
-
type:
|
|
336
|
+
type: MRT_FILTER_TYPE.NOT_EQUALS,
|
|
335
337
|
label: localization.filterMenuItemNotEquals,
|
|
336
338
|
divider: true
|
|
337
339
|
}, {
|
|
338
|
-
type:
|
|
340
|
+
type: MRT_FILTER_TYPE.EMPTY,
|
|
339
341
|
label: localization.filterMenuItemEmpty,
|
|
340
342
|
divider: false
|
|
341
343
|
}, {
|
|
342
|
-
type:
|
|
344
|
+
type: MRT_FILTER_TYPE.NOT_EMPTY,
|
|
343
345
|
label: localization.filterMenuItemNotEmpty,
|
|
344
346
|
divider: false
|
|
345
347
|
}];
|
|
@@ -353,7 +355,7 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
|
|
|
353
355
|
return _extends({}, prev, (_extends2 = {}, _extends2[column.id] = value, _extends2));
|
|
354
356
|
});
|
|
355
357
|
|
|
356
|
-
if ([
|
|
358
|
+
if ([MRT_FILTER_TYPE.EMPTY, MRT_FILTER_TYPE.NOT_EMPTY].includes(value)) {
|
|
357
359
|
column.setFilter(' ');
|
|
358
360
|
}
|
|
359
361
|
|
|
@@ -370,28 +372,29 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
|
|
|
370
372
|
onClose: function onClose() {
|
|
371
373
|
return setAnchorEl(null);
|
|
372
374
|
},
|
|
373
|
-
open: !!anchorEl
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
}, filterTypes.map(function (_ref2) {
|
|
375
|
+
open: !!anchorEl,
|
|
376
|
+
MenuListProps: {
|
|
377
|
+
dense: tableInstance.state.densePadding
|
|
378
|
+
}
|
|
379
|
+
}, filterTypes.map(function (_ref2, index) {
|
|
378
380
|
var type = _ref2.type,
|
|
379
381
|
label = _ref2.label,
|
|
380
382
|
divider = _ref2.divider;
|
|
381
383
|
return React.createElement(MenuItem, {
|
|
382
384
|
divider: divider,
|
|
383
|
-
key:
|
|
385
|
+
key: index,
|
|
384
386
|
onClick: function onClick() {
|
|
385
387
|
return handleSelectFilterType(type);
|
|
386
388
|
},
|
|
387
389
|
selected: type === filterType,
|
|
390
|
+
sx: commonMenuItemStyles,
|
|
388
391
|
value: type
|
|
389
392
|
}, label);
|
|
390
|
-
}))
|
|
393
|
+
}));
|
|
391
394
|
};
|
|
392
395
|
|
|
393
396
|
var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
394
|
-
var _localization$filterT, _localization$filterT2;
|
|
397
|
+
var _localization$filterT, _localization$filterT2, _column$filterSelectO;
|
|
395
398
|
|
|
396
399
|
var column = _ref.column;
|
|
397
400
|
|
|
@@ -439,7 +442,7 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
439
442
|
setCurrentFilterTypes(function (prev) {
|
|
440
443
|
var _extends2;
|
|
441
444
|
|
|
442
|
-
return _extends({}, prev, (_extends2 = {}, _extends2[column.id] =
|
|
445
|
+
return _extends({}, prev, (_extends2 = {}, _extends2[column.id] = MRT_FILTER_TYPE.FUZZY, _extends2));
|
|
443
446
|
});
|
|
444
447
|
};
|
|
445
448
|
|
|
@@ -450,7 +453,9 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
450
453
|
}
|
|
451
454
|
|
|
452
455
|
var filterType = tableInstance.state.currentFilterTypes[column.id];
|
|
453
|
-
var
|
|
456
|
+
var isCustomFilterType = filterType instanceof Function;
|
|
457
|
+
var isSelectFilter = !!column.filterSelectOptions;
|
|
458
|
+
var filterChipLabel = !isCustomFilterType && [MRT_FILTER_TYPE.EMPTY, MRT_FILTER_TYPE.NOT_EMPTY].includes(filterType);
|
|
454
459
|
var filterPlaceholder = (_localization$filterT = localization.filterTextFieldPlaceholder) == null ? void 0 : _localization$filterT.replace('{column}', String(column.Header));
|
|
455
460
|
return React.createElement(React.Fragment, null, React.createElement(TextField, Object.assign({
|
|
456
461
|
fullWidth: true,
|
|
@@ -459,12 +464,20 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
459
464
|
disabled: !!filterChipLabel,
|
|
460
465
|
sx: {
|
|
461
466
|
textOverflow: 'ellipsis',
|
|
462
|
-
width: filterChipLabel ? 0 :
|
|
467
|
+
width: filterChipLabel ? 0 : undefined
|
|
468
|
+
},
|
|
469
|
+
title: filterPlaceholder
|
|
470
|
+
},
|
|
471
|
+
label: isSelectFilter && !filterValue ? filterPlaceholder : undefined,
|
|
472
|
+
InputLabelProps: {
|
|
473
|
+
shrink: false,
|
|
474
|
+
sx: {
|
|
475
|
+
maxWidth: 'calc(100% - 2.5rem)'
|
|
463
476
|
},
|
|
464
477
|
title: filterPlaceholder
|
|
465
478
|
},
|
|
466
479
|
margin: "none",
|
|
467
|
-
placeholder: filterChipLabel ?
|
|
480
|
+
placeholder: filterChipLabel || isSelectFilter ? undefined : filterPlaceholder,
|
|
468
481
|
onChange: function onChange(e) {
|
|
469
482
|
setFilterValue(e.target.value);
|
|
470
483
|
handleChange(e.target.value);
|
|
@@ -472,22 +485,24 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
472
485
|
onClick: function onClick(e) {
|
|
473
486
|
return e.stopPropagation();
|
|
474
487
|
},
|
|
488
|
+
select: isSelectFilter,
|
|
475
489
|
value: filterValue != null ? filterValue : '',
|
|
476
490
|
variant: "standard",
|
|
477
491
|
InputProps: {
|
|
478
|
-
startAdornment: React.createElement(InputAdornment, {
|
|
492
|
+
startAdornment: !isSelectFilter && React.createElement(InputAdornment, {
|
|
479
493
|
position: "start"
|
|
480
494
|
}, React.createElement(Tooltip, {
|
|
481
495
|
arrow: true,
|
|
482
|
-
title:
|
|
483
|
-
}, React.createElement(IconButton, {
|
|
496
|
+
title: localization.changeFilterMode
|
|
497
|
+
}, React.createElement("span", null, React.createElement(IconButton, {
|
|
498
|
+
disabled: isCustomFilterType,
|
|
484
499
|
onClick: handleFilterMenuOpen,
|
|
485
500
|
size: "small",
|
|
486
501
|
sx: {
|
|
487
502
|
height: '1.75rem',
|
|
488
503
|
width: '1.75rem'
|
|
489
504
|
}
|
|
490
|
-
}, React.createElement(FilterListIcon, null))), filterChipLabel && React.createElement(Chip, {
|
|
505
|
+
}, React.createElement(FilterListIcon, null)))), filterChipLabel && React.createElement(Chip, {
|
|
491
506
|
onDelete: handleClearFilterChip,
|
|
492
507
|
label: filterType
|
|
493
508
|
})),
|
|
@@ -495,11 +510,12 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
495
510
|
position: "end"
|
|
496
511
|
}, React.createElement(Tooltip, {
|
|
497
512
|
arrow: true,
|
|
513
|
+
disableHoverListener: isSelectFilter,
|
|
498
514
|
placement: "right",
|
|
499
515
|
title: (_localization$filterT2 = localization.filterTextFieldClearButtonTitle) != null ? _localization$filterT2 : ''
|
|
500
516
|
}, React.createElement("span", null, React.createElement(IconButton, {
|
|
501
517
|
"aria-label": localization.filterTextFieldClearButtonTitle,
|
|
502
|
-
disabled: (filterValue
|
|
518
|
+
disabled: !(filterValue != null && filterValue.length),
|
|
503
519
|
onClick: handleClear,
|
|
504
520
|
size: "small",
|
|
505
521
|
sx: {
|
|
@@ -514,8 +530,32 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
514
530
|
sx: _extends({
|
|
515
531
|
m: '0 -0.25rem',
|
|
516
532
|
minWidth: !filterChipLabel ? '5rem' : 'auto',
|
|
517
|
-
width: 'calc(100% + 0.5rem)'
|
|
533
|
+
width: 'calc(100% + 0.5rem)',
|
|
534
|
+
mt: isSelectFilter && !filterValue ? '-1rem' : undefined,
|
|
535
|
+
'& .MuiSelect-icon': {
|
|
536
|
+
mr: '1.5rem'
|
|
537
|
+
}
|
|
518
538
|
}, textFieldProps == null ? void 0 : textFieldProps.sx)
|
|
539
|
+
}), isSelectFilter && React.createElement(MenuItem, {
|
|
540
|
+
divider: true,
|
|
541
|
+
disabled: !filterValue,
|
|
542
|
+
value: ""
|
|
543
|
+
}, localization.filterTextFieldClearButtonTitle), column == null ? void 0 : (_column$filterSelectO = column.filterSelectOptions) == null ? void 0 : _column$filterSelectO.map(function (option) {
|
|
544
|
+
var value;
|
|
545
|
+
var text;
|
|
546
|
+
|
|
547
|
+
if (typeof option === 'string') {
|
|
548
|
+
value = option;
|
|
549
|
+
text = option;
|
|
550
|
+
} else if (typeof option === 'object') {
|
|
551
|
+
value = option.value;
|
|
552
|
+
text = option.text;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
return React.createElement(MenuItem, {
|
|
556
|
+
key: value,
|
|
557
|
+
value: value
|
|
558
|
+
}, text);
|
|
519
559
|
})), React.createElement(MRT_FilterTypeMenu, {
|
|
520
560
|
anchorEl: anchorEl,
|
|
521
561
|
column: column,
|
|
@@ -523,8 +563,15 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
523
563
|
}));
|
|
524
564
|
};
|
|
525
565
|
|
|
526
|
-
var commonMenuItemStyles = {
|
|
566
|
+
var commonMenuItemStyles$1 = {
|
|
567
|
+
py: '6px',
|
|
568
|
+
my: 0,
|
|
569
|
+
justifyContent: 'space-between',
|
|
570
|
+
alignItems: 'center'
|
|
571
|
+
};
|
|
572
|
+
var commonListItemStyles = {
|
|
527
573
|
display: 'flex',
|
|
574
|
+
gap: '0.75rem',
|
|
528
575
|
alignItems: 'center'
|
|
529
576
|
};
|
|
530
577
|
var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
@@ -544,6 +591,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
|
544
591
|
ClearAllIcon = _useMRT$icons.ClearAllIcon,
|
|
545
592
|
DynamicFeedIcon = _useMRT$icons.DynamicFeedIcon,
|
|
546
593
|
FilterListIcon = _useMRT$icons.FilterListIcon,
|
|
594
|
+
FilterListOffIcon = _useMRT$icons.FilterListOffIcon,
|
|
547
595
|
SortIcon = _useMRT$icons.SortIcon,
|
|
548
596
|
VisibilityOffIcon = _useMRT$icons.VisibilityOffIcon,
|
|
549
597
|
idPrefix = _useMRT.idPrefix,
|
|
@@ -580,6 +628,11 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
|
580
628
|
setAnchorEl(null);
|
|
581
629
|
};
|
|
582
630
|
|
|
631
|
+
var handleClearFilter = function handleClearFilter() {
|
|
632
|
+
column.setFilter('');
|
|
633
|
+
setAnchorEl(null);
|
|
634
|
+
};
|
|
635
|
+
|
|
583
636
|
var handleFilterByColumn = function handleFilterByColumn() {
|
|
584
637
|
setShowFilters(true);
|
|
585
638
|
setTimeout(function () {
|
|
@@ -601,36 +654,51 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
|
601
654
|
open: !!anchorEl,
|
|
602
655
|
onClose: function onClose() {
|
|
603
656
|
return setAnchorEl(null);
|
|
657
|
+
},
|
|
658
|
+
MenuListProps: {
|
|
659
|
+
dense: tableInstance.state.densePadding
|
|
604
660
|
}
|
|
605
|
-
}, React.createElement(MenuList, {
|
|
606
|
-
dense: tableInstance.state.densePadding,
|
|
607
|
-
disablePadding: true
|
|
608
661
|
}, !disableSortBy && column.canSort && [React.createElement(MenuItem, {
|
|
609
|
-
key: 1,
|
|
610
662
|
disabled: !column.isSorted,
|
|
663
|
+
key: 1,
|
|
611
664
|
onClick: handleClearSort,
|
|
612
|
-
sx: commonMenuItemStyles
|
|
613
|
-
}, React.createElement(
|
|
665
|
+
sx: commonMenuItemStyles$1
|
|
666
|
+
}, React.createElement(Box, {
|
|
667
|
+
sx: commonListItemStyles
|
|
668
|
+
}, React.createElement(ClearAllIcon, null), localization.columnActionMenuItemClearSort)), React.createElement(MenuItem, {
|
|
614
669
|
disabled: column.isSorted && !column.isSortedDesc,
|
|
615
670
|
key: 2,
|
|
616
671
|
onClick: handleSortAsc,
|
|
617
|
-
sx: commonMenuItemStyles
|
|
618
|
-
}, React.createElement(
|
|
672
|
+
sx: commonMenuItemStyles$1
|
|
673
|
+
}, React.createElement(Box, {
|
|
674
|
+
sx: commonListItemStyles
|
|
675
|
+
}, React.createElement(SortIcon, null), (_localization$columnA = localization.columnActionMenuItemSortAsc) == null ? void 0 : _localization$columnA.replace('{column}', String(column.Header)))), React.createElement(MenuItem, {
|
|
619
676
|
divider: !disableFilters || enableColumnGrouping || !disableColumnHiding,
|
|
620
677
|
key: 3,
|
|
621
678
|
disabled: column.isSorted && column.isSortedDesc,
|
|
622
679
|
onClick: handleSortDesc,
|
|
623
|
-
sx: commonMenuItemStyles
|
|
624
|
-
}, React.createElement(
|
|
680
|
+
sx: commonMenuItemStyles$1
|
|
681
|
+
}, React.createElement(Box, {
|
|
682
|
+
sx: commonListItemStyles
|
|
683
|
+
}, React.createElement(SortIcon, {
|
|
625
684
|
style: {
|
|
626
685
|
transform: 'rotate(180deg) scaleX(-1)'
|
|
627
686
|
}
|
|
628
|
-
})
|
|
687
|
+
}), (_localization$columnA2 = localization.columnActionMenuItemSortDesc) == null ? void 0 : _localization$columnA2.replace('{column}', String(column.Header))))], !disableFilters && column.canFilter && [React.createElement(MenuItem, {
|
|
688
|
+
disabled: !column.filterValue,
|
|
689
|
+
key: 0,
|
|
690
|
+
onClick: handleClearFilter,
|
|
691
|
+
sx: commonMenuItemStyles$1
|
|
692
|
+
}, React.createElement(Box, {
|
|
693
|
+
sx: commonListItemStyles
|
|
694
|
+
}, React.createElement(FilterListOffIcon, null), localization.filterTextFieldClearButtonTitle)), React.createElement(MenuItem, {
|
|
629
695
|
divider: enableColumnGrouping || !disableColumnHiding,
|
|
630
696
|
key: 1,
|
|
631
697
|
onClick: handleFilterByColumn,
|
|
632
|
-
sx: commonMenuItemStyles
|
|
633
|
-
}, React.createElement(
|
|
698
|
+
sx: commonMenuItemStyles$1
|
|
699
|
+
}, React.createElement(Box, {
|
|
700
|
+
sx: commonListItemStyles
|
|
701
|
+
}, React.createElement(FilterListIcon, null), (_localization$filterT = localization.filterTextFieldPlaceholder) == null ? void 0 : _localization$filterT.replace('{column}', String(column.Header))), !column.filterSelectOptions && React.createElement(IconButton, {
|
|
634
702
|
onClick: handleOpenFilterModeMenu,
|
|
635
703
|
onMouseEnter: handleOpenFilterModeMenu,
|
|
636
704
|
size: "small",
|
|
@@ -647,12 +715,16 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
|
647
715
|
divider: !disableColumnHiding,
|
|
648
716
|
key: 2,
|
|
649
717
|
onClick: handleGroupByColumn,
|
|
650
|
-
sx: commonMenuItemStyles
|
|
651
|
-
}, React.createElement(
|
|
718
|
+
sx: commonMenuItemStyles$1
|
|
719
|
+
}, React.createElement(Box, {
|
|
720
|
+
sx: commonListItemStyles
|
|
721
|
+
}, React.createElement(DynamicFeedIcon, null), (_localization = localization[column.isGrouped ? 'columnActionMenuItemUnGroupBy' : 'columnActionMenuItemGroupBy']) == null ? void 0 : _localization.replace('{column}', String(column.Header))))], !disableColumnHiding && [React.createElement(MenuItem, {
|
|
652
722
|
key: 1,
|
|
653
723
|
onClick: handleHideColumn,
|
|
654
|
-
sx: commonMenuItemStyles
|
|
655
|
-
}, React.createElement(
|
|
724
|
+
sx: commonMenuItemStyles$1
|
|
725
|
+
}, React.createElement(Box, {
|
|
726
|
+
sx: commonListItemStyles
|
|
727
|
+
}, React.createElement(VisibilityOffIcon, null), (_localization$columnA3 = localization.columnActionMenuItemHideColumn) == null ? void 0 : _localization$columnA3.replace('{column}', String(column.Header))))]);
|
|
656
728
|
};
|
|
657
729
|
|
|
658
730
|
var MRT_ToggleColumnActionMenuButton = function MRT_ToggleColumnActionMenuButton(_ref) {
|
|
@@ -735,8 +807,7 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
735
807
|
});
|
|
736
808
|
|
|
737
809
|
var sortTooltip = column.isSorted ? column.isSortedDesc ? localization.columnActionMenuItemClearSort : (_localization$columnA = localization.columnActionMenuItemSortDesc) == null ? void 0 : _localization$columnA.replace('{column}', column.Header) : (_localization$columnA2 = localization.columnActionMenuItemSortAsc) == null ? void 0 : _localization$columnA2.replace('{column}', column.Header);
|
|
738
|
-
var filterTooltip = !!column.filterValue ? localization.filterApplied.replace('{column}', String(column.Header)).replace('{filterType}',
|
|
739
|
-
localization["filterMenuItem" + (tableInstance.state.currentFilterTypes[column.id].charAt(0).toUpperCase() + tableInstance.state.currentFilterTypes[column.id].slice(1))]) : localization.toggleFilterButtonTitle;
|
|
810
|
+
var filterTooltip = !!column.filterValue ? localization.filterApplied.replace('{column}', String(column.Header)).replace('{filterType}', column.filterValue) : localization.toggleFilterButtonTitle;
|
|
740
811
|
var columnHeader = column.render('Header');
|
|
741
812
|
return React.createElement(TableCell, Object.assign({
|
|
742
813
|
align: isParentHeader ? 'center' : 'left'
|
|
@@ -759,6 +830,7 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
759
830
|
title: undefined
|
|
760
831
|
}), column.render('Header'), !isParentHeader && column.canSort && React.createElement(Tooltip, {
|
|
761
832
|
arrow: true,
|
|
833
|
+
placement: "top",
|
|
762
834
|
title: sortTooltip
|
|
763
835
|
}, React.createElement(TableSortLabel, {
|
|
764
836
|
"aria-label": sortTooltip,
|
|
@@ -766,19 +838,22 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
766
838
|
direction: column.isSortedDesc ? 'desc' : 'asc'
|
|
767
839
|
})), !isParentHeader && !!column.canFilter && React.createElement(Tooltip, {
|
|
768
840
|
arrow: true,
|
|
841
|
+
placement: "top",
|
|
769
842
|
title: filterTooltip
|
|
770
843
|
}, React.createElement(IconButton, {
|
|
844
|
+
disableRipple: true,
|
|
771
845
|
onClick: function onClick(event) {
|
|
772
846
|
event.stopPropagation();
|
|
773
847
|
setShowFilters(!tableInstance.state.showFilters);
|
|
774
848
|
},
|
|
775
849
|
size: "small",
|
|
776
850
|
sx: {
|
|
851
|
+
m: 0,
|
|
777
852
|
opacity: !!column.filterValue ? 0.8 : 0,
|
|
778
853
|
p: '2px',
|
|
779
|
-
m: 0,
|
|
780
854
|
transition: 'all 0.2s ease-in-out',
|
|
781
855
|
'&:hover': {
|
|
856
|
+
backgroundColor: 'transparent',
|
|
782
857
|
opacity: 0.8
|
|
783
858
|
}
|
|
784
859
|
}
|
|
@@ -875,8 +950,10 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
875
950
|
var cell = _ref.cell;
|
|
876
951
|
|
|
877
952
|
var _useMRT = useMRT(),
|
|
878
|
-
|
|
953
|
+
isLoading = _useMRT.isLoading,
|
|
879
954
|
muiTableBodyCellProps = _useMRT.muiTableBodyCellProps,
|
|
955
|
+
muiTableBodyCellSkeletonProps = _useMRT.muiTableBodyCellSkeletonProps,
|
|
956
|
+
onCellClick = _useMRT.onCellClick,
|
|
880
957
|
_useMRT$tableInstance = _useMRT.tableInstance.state,
|
|
881
958
|
currentEditingRow = _useMRT$tableInstance.currentEditingRow,
|
|
882
959
|
densePadding = _useMRT$tableInstance.densePadding;
|
|
@@ -894,7 +971,11 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
894
971
|
}
|
|
895
972
|
}, tableCellProps, {
|
|
896
973
|
sx: _extends({}, commonTableBodyCellStyles(densePadding), tableCellProps == null ? void 0 : tableCellProps.sx)
|
|
897
|
-
}),
|
|
974
|
+
}), isLoading ? React.createElement(Skeleton, Object.assign({
|
|
975
|
+
animation: "wave",
|
|
976
|
+
height: 20,
|
|
977
|
+
width: Math.random() * (120 - 60) + 60
|
|
978
|
+
}, muiTableBodyCellSkeletonProps)) : (currentEditingRow == null ? void 0 : currentEditingRow.id) === cell.row.id ? React.createElement(MRT_EditCellTextField, {
|
|
898
979
|
cell: cell
|
|
899
980
|
}) : cell.isPlaceholder ? null : cell.isAggregated ? cell.render('Aggregated') : cell.isGrouped ? React.createElement("span", null, cell.render('Cell'), " (", cell.row.subRows.length, ")") : cell.render('Cell'));
|
|
900
981
|
};
|
|
@@ -1131,15 +1212,16 @@ var MRT_RowActionMenu = function MRT_RowActionMenu(_ref) {
|
|
|
1131
1212
|
open: !!anchorEl,
|
|
1132
1213
|
onClose: function onClose() {
|
|
1133
1214
|
return setAnchorEl(null);
|
|
1215
|
+
},
|
|
1216
|
+
MenuListProps: {
|
|
1217
|
+
dense: tableInstance.state.densePadding
|
|
1134
1218
|
}
|
|
1135
|
-
}, React.createElement(MenuList, {
|
|
1136
|
-
dense: tableInstance.state.densePadding,
|
|
1137
|
-
disablePadding: true
|
|
1138
1219
|
}, enableRowEditing && React.createElement(MenuItem, {
|
|
1139
|
-
onClick: handleEdit
|
|
1140
|
-
|
|
1220
|
+
onClick: handleEdit,
|
|
1221
|
+
sx: commonMenuItemStyles$1
|
|
1222
|
+
}, React.createElement(EditIcon, null), localization.rowActionMenuItemEdit), (_renderRowActionMenuI = renderRowActionMenuItems == null ? void 0 : renderRowActionMenuItems(row, tableInstance, function () {
|
|
1141
1223
|
return setAnchorEl(null);
|
|
1142
|
-
})) != null ? _renderRowActionMenuI : null)
|
|
1224
|
+
})) != null ? _renderRowActionMenuI : null);
|
|
1143
1225
|
};
|
|
1144
1226
|
|
|
1145
1227
|
function createCommonjsModule(fn, module) {
|
|
@@ -2321,10 +2403,17 @@ var MRT_ShowHideColumnsMenu = function MRT_ShowHideColumnsMenu(_ref) {
|
|
|
2321
2403
|
};
|
|
2322
2404
|
|
|
2323
2405
|
return React.createElement(React.Fragment, null, React.createElement(MenuItem, {
|
|
2324
|
-
sx: {
|
|
2406
|
+
sx: _extends({}, commonMenuItemStyles$1, {
|
|
2325
2407
|
pl: (column.depth + 0.5) * 2 + "rem"
|
|
2326
|
-
}
|
|
2408
|
+
})
|
|
2327
2409
|
}, React.createElement(FormControlLabel, {
|
|
2410
|
+
componentsProps: {
|
|
2411
|
+
typography: {
|
|
2412
|
+
sx: {
|
|
2413
|
+
marginBottom: 0
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
},
|
|
2328
2417
|
checked: switchChecked,
|
|
2329
2418
|
control: React.createElement(Switch, null),
|
|
2330
2419
|
label: column.Header,
|
|
@@ -2367,15 +2456,15 @@ var MRT_ShowHideColumnsButton = function MRT_ShowHideColumnsButton(_ref) {
|
|
|
2367
2456
|
open: !!anchorEl,
|
|
2368
2457
|
onClose: function onClose() {
|
|
2369
2458
|
return setAnchorEl(null);
|
|
2459
|
+
},
|
|
2460
|
+
MenuListProps: {
|
|
2461
|
+
dense: tableInstance.state.densePadding
|
|
2370
2462
|
}
|
|
2371
|
-
}, React.createElement(MenuList, {
|
|
2372
|
-
dense: tableInstance.state.densePadding,
|
|
2373
|
-
disablePadding: true
|
|
2374
2463
|
}, React.createElement(Box, {
|
|
2375
2464
|
sx: {
|
|
2376
2465
|
display: 'flex',
|
|
2377
2466
|
justifyContent: 'space-between',
|
|
2378
|
-
p: '0
|
|
2467
|
+
p: '0.5rem'
|
|
2379
2468
|
}
|
|
2380
2469
|
}, React.createElement(Button, {
|
|
2381
2470
|
disabled: !tableInstance.getToggleHideAllColumnsProps().checked && !tableInstance.getToggleHideAllColumnsProps().indeterminate,
|
|
@@ -2392,7 +2481,7 @@ var MRT_ShowHideColumnsButton = function MRT_ShowHideColumnsButton(_ref) {
|
|
|
2392
2481
|
key: index + "-" + column.id,
|
|
2393
2482
|
column: column
|
|
2394
2483
|
});
|
|
2395
|
-
})))
|
|
2484
|
+
})));
|
|
2396
2485
|
};
|
|
2397
2486
|
|
|
2398
2487
|
var MRT_ToggleDensePaddingButton = function MRT_ToggleDensePaddingButton(_ref) {
|
|
@@ -2677,6 +2766,7 @@ var MRT_TableContainer = function MRT_TableContainer() {
|
|
|
2677
2766
|
hideToolbarTop = _useMRT.hideToolbarTop,
|
|
2678
2767
|
isFetching = _useMRT.isFetching,
|
|
2679
2768
|
isLoading = _useMRT.isLoading,
|
|
2769
|
+
muiLinearProgressProps = _useMRT.muiLinearProgressProps,
|
|
2680
2770
|
muiTableContainerProps = _useMRT.muiTableContainerProps,
|
|
2681
2771
|
tableInstance = _useMRT.tableInstance;
|
|
2682
2772
|
|
|
@@ -2701,6 +2791,7 @@ var MRT_TableContainer = function MRT_TableContainer() {
|
|
|
2701
2791
|
}
|
|
2702
2792
|
}, [fullScreen]);
|
|
2703
2793
|
var tableContainerProps = muiTableContainerProps instanceof Function ? muiTableContainerProps(tableInstance) : muiTableContainerProps;
|
|
2794
|
+
var linearProgressProps = muiLinearProgressProps instanceof Function ? muiLinearProgressProps(tableInstance) : muiLinearProgressProps;
|
|
2704
2795
|
return React.createElement(TableContainer, Object.assign({
|
|
2705
2796
|
component: Paper
|
|
2706
2797
|
}, tableContainerProps, {
|
|
@@ -2719,7 +2810,7 @@ var MRT_TableContainer = function MRT_TableContainer() {
|
|
|
2719
2810
|
}), !hideToolbarTop && React.createElement(MRT_ToolbarTop, null), React.createElement(Collapse, {
|
|
2720
2811
|
"in": isFetching || isLoading,
|
|
2721
2812
|
unmountOnExit: true
|
|
2722
|
-
}, React.createElement(LinearProgress,
|
|
2813
|
+
}, React.createElement(LinearProgress, Object.assign({}, linearProgressProps))), React.createElement(Box, {
|
|
2723
2814
|
sx: {
|
|
2724
2815
|
maxWidth: '100%',
|
|
2725
2816
|
overflowX: 'auto'
|
|
@@ -2745,6 +2836,7 @@ var MRT_DefaultLocalization_EN = {
|
|
|
2745
2836
|
filterMenuItemEmpty: 'Empty',
|
|
2746
2837
|
filterMenuItemEndsWith: 'Ends With',
|
|
2747
2838
|
filterMenuItemEquals: 'Equals',
|
|
2839
|
+
changeFilterMode: 'Change filter mode',
|
|
2748
2840
|
filterMenuItemFuzzy: 'Fuzzy Match (Default)',
|
|
2749
2841
|
filterMenuItemNotEmpty: 'Not Empty',
|
|
2750
2842
|
filterMenuItemNotEquals: 'Not Equals',
|
|
@@ -2803,6 +2895,19 @@ var MRT_Default_Icons = {
|
|
|
2803
2895
|
};
|
|
2804
2896
|
|
|
2805
2897
|
var _excluded = ["defaultColumn", "icons", "localization", "positionActionsColumn", "positionPagination", "positionToolbarActions", "positionToolbarAlertBanner"];
|
|
2898
|
+
var MRT_FILTER_TYPE;
|
|
2899
|
+
|
|
2900
|
+
(function (MRT_FILTER_TYPE) {
|
|
2901
|
+
MRT_FILTER_TYPE["CONTAINS"] = "contains";
|
|
2902
|
+
MRT_FILTER_TYPE["EMPTY"] = "empty";
|
|
2903
|
+
MRT_FILTER_TYPE["ENDS_WITH"] = "endsWith";
|
|
2904
|
+
MRT_FILTER_TYPE["EQUALS"] = "equals";
|
|
2905
|
+
MRT_FILTER_TYPE["FUZZY"] = "fuzzy";
|
|
2906
|
+
MRT_FILTER_TYPE["NOT_EMPTY"] = "notEmpty";
|
|
2907
|
+
MRT_FILTER_TYPE["NOT_EQUALS"] = "notEquals";
|
|
2908
|
+
MRT_FILTER_TYPE["STARTS_WITH"] = "startsWith";
|
|
2909
|
+
})(MRT_FILTER_TYPE || (MRT_FILTER_TYPE = {}));
|
|
2910
|
+
|
|
2806
2911
|
var MaterialReactTable = (function (_ref) {
|
|
2807
2912
|
var _ref$defaultColumn = _ref.defaultColumn,
|
|
2808
2913
|
defaultColumn = _ref$defaultColumn === void 0 ? {
|
|
@@ -2833,4 +2938,5 @@ var MaterialReactTable = (function (_ref) {
|
|
|
2833
2938
|
});
|
|
2834
2939
|
|
|
2835
2940
|
export default MaterialReactTable;
|
|
2941
|
+
export { MRT_FILTER_TYPE };
|
|
2836
2942
|
//# sourceMappingURL=material-react-table.esm.js.map
|