material-react-table 1.0.0-beta.8 → 1.0.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/README.md +2 -2
- package/dist/cjs/MaterialReactTable.d.ts +112 -7
- package/dist/cjs/_locales/en.d.ts +2 -0
- package/dist/cjs/_locales/pt-BR.d.ts +2 -0
- package/dist/cjs/column.utils.d.ts +6 -0
- package/dist/cjs/head/MRT_TableHeadCellSortLabel.d.ts +2 -0
- package/dist/cjs/index.d.ts +4 -3
- package/dist/cjs/index.js +200 -71
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/inputs/MRT_FilterCheckbox.d.ts +8 -0
- package/dist/cjs/menus/MRT_FilterOptionMenu.d.ts +3 -3
- package/dist/cjs/table/MRT_TableRoot.d.ts +254 -2
- package/dist/cjs/toolbar/MRT_TablePagination.d.ts +3 -4
- package/dist/cjs/toolbar/MRT_ToolbarInternalButtons.d.ts +3 -4
- package/dist/cjs/toolbar/MRT_TopToolbar.d.ts +1 -0
- package/dist/esm/MaterialReactTable.d.ts +112 -7
- package/dist/esm/_locales/en.d.ts +2 -0
- package/dist/esm/_locales/pt-BR.d.ts +2 -0
- package/dist/esm/column.utils.d.ts +6 -0
- package/dist/esm/head/MRT_TableHeadCellSortLabel.d.ts +2 -0
- package/dist/esm/index.d.ts +4 -3
- package/dist/esm/inputs/MRT_FilterCheckbox.d.ts +8 -0
- package/dist/esm/material-react-table.esm.js +200 -73
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/menus/MRT_FilterOptionMenu.d.ts +3 -3
- package/dist/esm/table/MRT_TableRoot.d.ts +254 -2
- package/dist/esm/toolbar/MRT_TablePagination.d.ts +3 -4
- package/dist/esm/toolbar/MRT_ToolbarInternalButtons.d.ts +3 -4
- package/dist/esm/toolbar/MRT_TopToolbar.d.ts +1 -0
- package/dist/index.d.ts +61 -28
- package/locales/en.d.ts +2 -0
- package/locales/en.esm.d.ts +2 -0
- package/locales/en.esm.js +92 -0
- package/locales/en.esm.js.map +1 -0
- package/locales/en.js +96 -0
- package/locales/en.js.map +1 -0
- package/locales/pt-BR.d.ts +2 -0
- package/locales/pt-BR.esm.d.ts +2 -0
- package/locales/pt-BR.esm.js +92 -0
- package/locales/pt-BR.esm.js.map +1 -0
- package/locales/pt-BR.js +96 -0
- package/locales/pt-BR.js.map +1 -0
- package/package.json +13 -11
- package/src/MaterialReactTable.tsx +205 -67
- package/src/_locales/de.ts +1 -0
- package/src/{localization.ts → _locales/en.ts} +8 -84
- package/src/_locales/es.ts +1 -0
- package/src/_locales/fr.ts +1 -0
- package/src/_locales/hi.ts +1 -0
- package/src/_locales/id.ts +1 -0
- package/src/_locales/ja.ts +1 -0
- package/src/_locales/nl.ts +1 -0
- package/src/_locales/pt-BR.ts +92 -0
- package/src/_locales/pt.ts +1 -0
- package/src/_locales/ru.ts +1 -0
- package/src/_locales/uk.ts +1 -0
- package/src/_locales/vi.ts +1 -0
- package/src/_locales/zh.ts +1 -0
- package/src/body/MRT_EditRowModal.tsx +3 -2
- package/src/body/MRT_TableBodyCell.tsx +1 -1
- package/src/body/MRT_TableBodyRow.tsx +1 -1
- package/src/body/MRT_TableDetailPanel.tsx +1 -1
- package/src/buttons/MRT_ExpandAllButton.tsx +1 -1
- package/src/buttons/MRT_ExpandButton.tsx +1 -1
- package/src/buttons/MRT_GrabHandleButton.tsx +1 -1
- package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +7 -2
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +1 -1
- package/src/column.utils.ts +28 -3
- package/src/footer/MRT_TableFooter.tsx +1 -1
- package/src/head/MRT_TableHead.tsx +10 -2
- package/src/head/MRT_TableHeadCell.tsx +10 -2
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +1 -1
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +7 -3
- package/src/head/MRT_TableHeadCellGrabHandle.tsx +5 -1
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +1 -1
- package/src/head/MRT_TableHeadCellSortLabel.tsx +11 -3
- package/src/index.tsx +6 -3
- package/src/inputs/MRT_FilterCheckbox.tsx +96 -0
- package/src/inputs/MRT_FilterTextField.tsx +19 -13
- package/src/inputs/MRT_GlobalFilterTextField.tsx +18 -5
- package/src/inputs/MRT_SelectCheckbox.tsx +16 -7
- package/src/menus/MRT_FilterOptionMenu.tsx +19 -2
- package/src/table/MRT_TablePaper.tsx +16 -4
- package/src/table/MRT_TableRoot.tsx +8 -7
- package/src/toolbar/MRT_BottomToolbar.tsx +4 -1
- package/src/toolbar/MRT_TablePagination.tsx +45 -8
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +2 -1
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +8 -4
- package/src/toolbar/MRT_TopToolbar.tsx +2 -1
- package/dist/cjs/localization.d.ts +0 -84
- package/dist/esm/localization.d.ts +0 -84
package/dist/cjs/index.js
CHANGED
|
@@ -159,7 +159,7 @@ const MRT_FilterFns = Object.assign(Object.assign({}, reactTable.filterFns), { b
|
|
|
159
159
|
notEquals,
|
|
160
160
|
startsWith });
|
|
161
161
|
|
|
162
|
-
const
|
|
162
|
+
const MRT_Localization_EN = {
|
|
163
163
|
actions: 'Actions',
|
|
164
164
|
and: 'and',
|
|
165
165
|
cancel: 'Cancel',
|
|
@@ -200,6 +200,10 @@ const MRT_DefaultLocalization_EN = {
|
|
|
200
200
|
filterStartsWith: 'Starts With',
|
|
201
201
|
filterWeakEquals: 'Equals',
|
|
202
202
|
filteringByColumn: 'Filtering by {column} - {filterType} {filterValue}',
|
|
203
|
+
goToFirstPage: 'Go to first page',
|
|
204
|
+
goToLastPage: 'Go to last page',
|
|
205
|
+
goToNextPage: 'Go to next page',
|
|
206
|
+
goToPreviousPage: 'Go to previous page',
|
|
203
207
|
grab: 'Grab',
|
|
204
208
|
groupByColumn: 'Group by {column}',
|
|
205
209
|
groupedBy: 'Grouped by ',
|
|
@@ -210,6 +214,7 @@ const MRT_DefaultLocalization_EN = {
|
|
|
210
214
|
move: 'Move',
|
|
211
215
|
noRecordsToDisplay: 'No records to display',
|
|
212
216
|
noResultsFound: 'No results found',
|
|
217
|
+
of: 'of',
|
|
213
218
|
or: 'or',
|
|
214
219
|
pinToLeft: 'Pin to left',
|
|
215
220
|
pinToRight: 'Pin to right',
|
|
@@ -218,6 +223,7 @@ const MRT_DefaultLocalization_EN = {
|
|
|
218
223
|
rowActions: 'Row Actions',
|
|
219
224
|
rowNumber: '#',
|
|
220
225
|
rowNumbers: 'Row Numbers',
|
|
226
|
+
rowsPerPage: 'Rows per page',
|
|
221
227
|
save: 'Save',
|
|
222
228
|
search: 'Search',
|
|
223
229
|
selectedCountOfRowCountRowsSelected: '{selectedCount} of {rowCount} row(s) selected',
|
|
@@ -275,7 +281,7 @@ const MRT_ExpandAllButton = ({ table }) => {
|
|
|
275
281
|
: getIsSomeRowsExpanded()
|
|
276
282
|
? -90
|
|
277
283
|
: 0}deg)`,
|
|
278
|
-
transition: 'transform 0.
|
|
284
|
+
transition: 'transform 0.1s',
|
|
279
285
|
} })))));
|
|
280
286
|
};
|
|
281
287
|
|
|
@@ -303,7 +309,7 @@ const MRT_ExpandButton = ({ row, table }) => {
|
|
|
303
309
|
: row.getIsExpanded()
|
|
304
310
|
? -180
|
|
305
311
|
: 0}deg)`,
|
|
306
|
-
transition: 'transform 0.
|
|
312
|
+
transition: 'transform 0.1s',
|
|
307
313
|
} })))));
|
|
308
314
|
};
|
|
309
315
|
|
|
@@ -393,7 +399,7 @@ const mrtFilterOptions = (localization) => [
|
|
|
393
399
|
divider: false,
|
|
394
400
|
},
|
|
395
401
|
];
|
|
396
|
-
const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, table, }) => {
|
|
402
|
+
const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilterValue, table, }) => {
|
|
397
403
|
var _a, _b, _c, _d;
|
|
398
404
|
const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
|
|
399
405
|
const { globalFilterFn, density } = getState();
|
|
@@ -412,11 +418,19 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, table,
|
|
|
412
418
|
if (['empty', 'notEmpty'].includes(option)) {
|
|
413
419
|
column.setFilterValue(' ');
|
|
414
420
|
}
|
|
415
|
-
else if (
|
|
421
|
+
else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'multi-select' ||
|
|
422
|
+
['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'].includes(option)) {
|
|
423
|
+
column.setFilterValue([]);
|
|
424
|
+
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue([]);
|
|
425
|
+
}
|
|
426
|
+
else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'range' ||
|
|
427
|
+
['between', 'betweenInclusive', 'inNumberRange'].includes(option)) {
|
|
416
428
|
column.setFilterValue(['', '']);
|
|
429
|
+
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
|
|
417
430
|
}
|
|
418
431
|
else {
|
|
419
432
|
column.setFilterValue('');
|
|
433
|
+
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
|
|
420
434
|
}
|
|
421
435
|
}
|
|
422
436
|
else {
|
|
@@ -483,7 +497,7 @@ const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table,
|
|
|
483
497
|
var _a;
|
|
484
498
|
e.stopPropagation();
|
|
485
499
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
|
|
486
|
-
}, onDragStart: onDragStart, onDragEnd: onDragEnd, sx: (theme) => (Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 0.
|
|
500
|
+
}, onDragStart: onDragStart, onDragEnd: onDragEnd, sx: (theme) => (Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 0.1s ease-in-out', '&:hover': {
|
|
487
501
|
backgroundColor: 'transparent',
|
|
488
502
|
opacity: 1,
|
|
489
503
|
}, '&:active': {
|
|
@@ -591,10 +605,11 @@ const getDefaultColumnOrderIds = (props) => [
|
|
|
591
605
|
const getDefaultColumnFilterFn = (columnDef) => {
|
|
592
606
|
if (columnDef.filterVariant === 'multi-select')
|
|
593
607
|
return 'arrIncludesSome';
|
|
594
|
-
if (columnDef.filterVariant === 'select')
|
|
595
|
-
return 'equals';
|
|
596
608
|
if (columnDef.filterVariant === 'range')
|
|
597
609
|
return 'betweenInclusive';
|
|
610
|
+
if (columnDef.filterVariant === 'select' ||
|
|
611
|
+
columnDef.filterVariant === 'checkbox')
|
|
612
|
+
return 'equals';
|
|
598
613
|
return 'fuzzy';
|
|
599
614
|
};
|
|
600
615
|
const getIsLastLeftPinnedColumn = (table, column) => {
|
|
@@ -610,7 +625,7 @@ const getTotalRight = (table, column) => {
|
|
|
610
625
|
const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
|
611
626
|
var _a, _b, _c, _d;
|
|
612
627
|
return (Object.assign(Object.assign({ backgroundColor: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
|
613
|
-
? material.alpha(material.lighten(theme.palette.background.default, 0.04), 0.
|
|
628
|
+
? material.alpha(material.lighten(theme.palette.background.default, 0.04), 0.97)
|
|
614
629
|
: 'inherit', backgroundImage: 'inherit', boxShadow: getIsLastLeftPinnedColumn(table, column)
|
|
615
630
|
? `-4px 0 8px -6px ${material.alpha(theme.palette.common.black, 0.2)} inset`
|
|
616
631
|
: getIsFirstRightPinnedColumn(column)
|
|
@@ -624,10 +639,29 @@ const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, })
|
|
|
624
639
|
? 'sticky'
|
|
625
640
|
: undefined, right: column.getIsPinned() === 'right'
|
|
626
641
|
? `${getTotalRight(table, column)}px`
|
|
627
|
-
: undefined, transition: `all ${column.getIsResizing() ? 0 : '0.
|
|
642
|
+
: undefined, transition: `all ${column.getIsResizing() ? 0 : '0.1s'} ease-in-out` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
|
628
643
|
? tableCellProps.sx(theme)
|
|
629
644
|
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { maxWidth: `min(${column.getSize()}px, fit-content)`, minWidth: `max(${column.getSize()}px, ${(_c = column.columnDef.minSize) !== null && _c !== void 0 ? _c : 30}px)`, width: (_d = header === null || header === void 0 ? void 0 : header.getSize()) !== null && _d !== void 0 ? _d : column.getSize() }));
|
|
630
645
|
};
|
|
646
|
+
const MRT_DefaultColumn = {
|
|
647
|
+
minSize: 40,
|
|
648
|
+
maxSize: 1000,
|
|
649
|
+
size: 180,
|
|
650
|
+
};
|
|
651
|
+
const MRT_DefaultDisplayColumn = {
|
|
652
|
+
columnDefType: 'display',
|
|
653
|
+
enableClickToCopy: false,
|
|
654
|
+
enableColumnActions: false,
|
|
655
|
+
enableColumnDragging: false,
|
|
656
|
+
enableColumnFilter: false,
|
|
657
|
+
enableColumnOrdering: false,
|
|
658
|
+
enableEditing: false,
|
|
659
|
+
enableGlobalFilter: false,
|
|
660
|
+
enableGrouping: false,
|
|
661
|
+
enableHiding: false,
|
|
662
|
+
enableResizing: false,
|
|
663
|
+
enableSorting: false,
|
|
664
|
+
};
|
|
631
665
|
|
|
632
666
|
const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, isSubMenu, table, }) => {
|
|
633
667
|
var _a;
|
|
@@ -979,7 +1013,7 @@ const commonIconButtonStyles = {
|
|
|
979
1013
|
height: '2rem',
|
|
980
1014
|
ml: '10px',
|
|
981
1015
|
opacity: 0.5,
|
|
982
|
-
transition: 'opacity 0.
|
|
1016
|
+
transition: 'opacity 0.1s',
|
|
983
1017
|
width: '2rem',
|
|
984
1018
|
'&:hover': {
|
|
985
1019
|
opacity: 1,
|
|
@@ -1022,15 +1056,24 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
|
|
1022
1056
|
return (React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _a !== void 0 ? _a : (selectAll
|
|
1023
1057
|
? localization.toggleSelectAll
|
|
1024
1058
|
: localization.toggleSelectRow) },
|
|
1025
|
-
React__default["default"].createElement(material.Checkbox, Object.assign({ checked: selectAll
|
|
1059
|
+
React__default["default"].createElement(material.Checkbox, Object.assign({ checked: selectAll
|
|
1060
|
+
? selectAllMode === 'page'
|
|
1061
|
+
? table.getIsAllPageRowsSelected()
|
|
1062
|
+
: table.getIsAllRowsSelected()
|
|
1063
|
+
: row === null || row === void 0 ? void 0 : row.getIsSelected(), indeterminate: selectAll
|
|
1064
|
+
? table.getIsSomeRowsSelected() &&
|
|
1065
|
+
!(selectAllMode === 'page'
|
|
1066
|
+
? table.getIsAllPageRowsSelected()
|
|
1067
|
+
: table.getIsAllRowsSelected())
|
|
1068
|
+
: row === null || row === void 0 ? void 0 : row.getIsSomeSelected(), inputProps: {
|
|
1026
1069
|
'aria-label': selectAll
|
|
1027
1070
|
? localization.toggleSelectAll
|
|
1028
1071
|
: localization.toggleSelectRow,
|
|
1029
|
-
}, onChange:
|
|
1030
|
-
?
|
|
1072
|
+
}, onChange: row
|
|
1073
|
+
? row.getToggleSelectedHandler()
|
|
1074
|
+
: selectAllMode === 'all'
|
|
1031
1075
|
? table.getToggleAllRowsSelectedHandler()
|
|
1032
|
-
: table.getToggleAllPageRowsSelectedHandler()
|
|
1033
|
-
: row.getToggleSelectedHandler(), size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
|
|
1076
|
+
: table.getToggleAllPageRowsSelectedHandler(), size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
|
|
1034
1077
|
var _a;
|
|
1035
1078
|
e.stopPropagation();
|
|
1036
1079
|
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
|
@@ -1043,6 +1086,9 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
|
1043
1086
|
var _a;
|
|
1044
1087
|
const { getState, setGlobalFilter, options: { enableGlobalFilterModes, icons: { SearchIcon, CloseIcon }, localization, muiSearchTextFieldProps, }, refs: { searchInputRef }, } = table;
|
|
1045
1088
|
const { globalFilter, showGlobalFilter } = getState();
|
|
1089
|
+
const textFieldProps = muiSearchTextFieldProps instanceof Function
|
|
1090
|
+
? muiSearchTextFieldProps({ table })
|
|
1091
|
+
: muiSearchTextFieldProps;
|
|
1046
1092
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
1047
1093
|
const [searchValue, setSearchValue] = React.useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
|
|
1048
1094
|
const handleChangeDebounced = React.useCallback(material.debounce((event) => {
|
|
@@ -1060,9 +1106,11 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
|
1060
1106
|
setSearchValue('');
|
|
1061
1107
|
setGlobalFilter(undefined);
|
|
1062
1108
|
};
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1109
|
+
React.useEffect(() => {
|
|
1110
|
+
if (globalFilter === undefined) {
|
|
1111
|
+
handleClear();
|
|
1112
|
+
}
|
|
1113
|
+
}, [globalFilter]);
|
|
1066
1114
|
return (React__default["default"].createElement(material.Collapse, { in: showGlobalFilter, orientation: "horizontal", unmountOnExit: true, mountOnEnter: true },
|
|
1067
1115
|
React__default["default"].createElement(material.TextField, Object.assign({ placeholder: localization.search, onChange: handleChange, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard", InputProps: {
|
|
1068
1116
|
startAdornment: enableGlobalFilterModes ? (React__default["default"].createElement(material.InputAdornment, { position: "start" },
|
|
@@ -1080,7 +1128,7 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
|
1080
1128
|
textFieldProps.inputRef = inputRef;
|
|
1081
1129
|
}
|
|
1082
1130
|
} })),
|
|
1083
|
-
React__default["default"].createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table })));
|
|
1131
|
+
React__default["default"].createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table, onSelect: handleClear })));
|
|
1084
1132
|
};
|
|
1085
1133
|
|
|
1086
1134
|
const MRT_LinearProgressBar = ({ isTopToolbar, table }) => {
|
|
@@ -1098,8 +1146,8 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table }) => {
|
|
|
1098
1146
|
React__default["default"].createElement(material.LinearProgress, Object.assign({ "aria-label": "Loading", "aria-busy": "true", sx: { position: 'relative' } }, linearProgressProps))));
|
|
1099
1147
|
};
|
|
1100
1148
|
|
|
1101
|
-
const MRT_TablePagination = ({ table, position }) => {
|
|
1102
|
-
const { getPrePaginationRowModel, getState, setPageIndex, setPageSize, options: { muiTablePaginationProps, enableToolbarInternalActions, rowCount, }, } = table;
|
|
1149
|
+
const MRT_TablePagination = ({ table, position, }) => {
|
|
1150
|
+
const { getPrePaginationRowModel, getState, setPageIndex, setPageSize, options: { muiTablePaginationProps, enableToolbarInternalActions, localization, rowCount, }, } = table;
|
|
1103
1151
|
const { pagination: { pageSize = 10, pageIndex = 0 }, showGlobalFilter, } = getState();
|
|
1104
1152
|
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
|
|
1105
1153
|
const showFirstLastPageButtons = totalRowCount / pageSize > 2;
|
|
@@ -1109,10 +1157,26 @@ const MRT_TablePagination = ({ table, position }) => {
|
|
|
1109
1157
|
const handleChangeRowsPerPage = (event) => {
|
|
1110
1158
|
setPageSize(+event.target.value);
|
|
1111
1159
|
};
|
|
1112
|
-
return (React__default["default"].createElement(material.TablePagination, Object.assign({
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1160
|
+
return (React__default["default"].createElement(material.TablePagination, Object.assign({ component: "div", count: totalRowCount, getItemAriaLabel: (type) => type === 'first'
|
|
1161
|
+
? localization.goToFirstPage
|
|
1162
|
+
: type === 'last'
|
|
1163
|
+
? localization.goToLastPage
|
|
1164
|
+
: type === 'next'
|
|
1165
|
+
? localization.goToNextPage
|
|
1166
|
+
: localization.goToPreviousPage, labelDisplayedRows: ({ from, to, count }) => `${from}-${to} ${localization.of} ${count}`, labelRowsPerPage: localization.rowsPerPage, onPageChange: (_, newPage) => setPageIndex(newPage), onRowsPerPageChange: handleChangeRowsPerPage, page: pageIndex, rowsPerPage: pageSize, rowsPerPageOptions: [5, 10, 15, 20, 25, 30, 50, 100], showFirstButton: showFirstLastPageButtons, showLastButton: showFirstLastPageButtons }, tablePaginationProps, { SelectProps: Object.assign({ sx: { m: '0 1rem 0 1ch' }, MenuProps: { MenuListProps: { disablePadding: true }, sx: { m: 0 } } }, tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.SelectProps), sx: (theme) => (Object.assign({ '& .MuiTablePagination-toolbar': {
|
|
1167
|
+
display: 'flex',
|
|
1168
|
+
alignItems: 'center',
|
|
1169
|
+
}, '& .MuiTablePagination-selectLabel': {
|
|
1170
|
+
m: '0 -1px',
|
|
1171
|
+
}, '&. MuiInputBase-root': {
|
|
1172
|
+
m: '0 1px',
|
|
1173
|
+
}, '& . MuiTablePagination-select': {
|
|
1174
|
+
m: '0 1px',
|
|
1175
|
+
}, '& .MuiTablePagination-displayedRows': {
|
|
1176
|
+
m: '0 1px',
|
|
1177
|
+
}, '& .MuiTablePagination-actions': {
|
|
1178
|
+
m: '0 1px',
|
|
1179
|
+
}, mt: position === 'top' &&
|
|
1116
1180
|
enableToolbarInternalActions &&
|
|
1117
1181
|
!showGlobalFilter
|
|
1118
1182
|
? '3.5rem'
|
|
@@ -1123,7 +1187,7 @@ const MRT_TablePagination = ({ table, position }) => {
|
|
|
1123
1187
|
|
|
1124
1188
|
const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
1125
1189
|
var _a, _b;
|
|
1126
|
-
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, positionToolbarAlertBanner, }, } = table;
|
|
1190
|
+
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, positionToolbarAlertBanner, rowCount, }, } = table;
|
|
1127
1191
|
const { grouping, showAlertBanner } = getState();
|
|
1128
1192
|
const alertProps = muiToolbarAlertBannerProps instanceof Function
|
|
1129
1193
|
? muiToolbarAlertBannerProps({ table })
|
|
@@ -1132,7 +1196,7 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
|
1132
1196
|
? muiToolbarAlertBannerChipProps({ table })
|
|
1133
1197
|
: muiToolbarAlertBannerChipProps;
|
|
1134
1198
|
const selectMessage = getSelectedRowModel().rows.length > 0
|
|
1135
|
-
? (_b = (_a = localization.selectedCountOfRowCountRowsSelected) === null || _a === void 0 ? void 0 : _a.replace('{selectedCount}', getSelectedRowModel().rows.length.toString())) === null || _b === void 0 ? void 0 : _b.replace('{rowCount}', getPrePaginationRowModel().rows.length.toString())
|
|
1199
|
+
? (_b = (_a = localization.selectedCountOfRowCountRowsSelected) === null || _a === void 0 ? void 0 : _a.replace('{selectedCount}', getSelectedRowModel().rows.length.toString())) === null || _b === void 0 ? void 0 : _b.replace('{rowCount}', (rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length).toString())
|
|
1136
1200
|
: null;
|
|
1137
1201
|
const groupedByMessage = grouping.length > 0 ? (React__default["default"].createElement("span", null,
|
|
1138
1202
|
localization.groupedBy,
|
|
@@ -1217,16 +1281,16 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
|
|
|
1217
1281
|
var _b;
|
|
1218
1282
|
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
1219
1283
|
const { getState, options: { icons: { SearchIcon, SearchOffIcon }, localization, }, refs: { searchInputRef }, setShowGlobalFilter, } = table;
|
|
1220
|
-
const { showGlobalFilter } = getState();
|
|
1284
|
+
const { globalFilter, showGlobalFilter } = getState();
|
|
1221
1285
|
const handleToggleSearch = () => {
|
|
1222
1286
|
setShowGlobalFilter(!showGlobalFilter);
|
|
1223
1287
|
queueMicrotask(() => { var _a; return (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
1224
1288
|
};
|
|
1225
1289
|
return (React__default["default"].createElement(material.Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideSearch },
|
|
1226
|
-
React__default["default"].createElement(material.IconButton, Object.assign({ onClick: handleToggleSearch }, rest, { title: undefined }), showGlobalFilter ? React__default["default"].createElement(SearchOffIcon, null) : React__default["default"].createElement(SearchIcon, null))));
|
|
1290
|
+
React__default["default"].createElement(material.IconButton, Object.assign({ disabled: !!globalFilter, onClick: handleToggleSearch }, rest, { title: undefined }), showGlobalFilter ? React__default["default"].createElement(SearchOffIcon, null) : React__default["default"].createElement(SearchIcon, null))));
|
|
1227
1291
|
};
|
|
1228
1292
|
|
|
1229
|
-
const MRT_ToolbarInternalButtons = ({ table }) => {
|
|
1293
|
+
const MRT_ToolbarInternalButtons = ({ table, }) => {
|
|
1230
1294
|
var _a;
|
|
1231
1295
|
const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enablePinning, initialState, renderToolbarInternalActions, }, } = table;
|
|
1232
1296
|
return (React__default["default"].createElement(material.Box, { sx: {
|
|
@@ -1274,10 +1338,11 @@ const commonToolbarStyles = ({ theme }) => ({
|
|
|
1274
1338
|
backgroundColor: material.lighten(theme.palette.background.default, 0.04),
|
|
1275
1339
|
backgroundImage: 'none',
|
|
1276
1340
|
display: 'grid',
|
|
1341
|
+
flexWrap: 'wrap-reverse',
|
|
1277
1342
|
minHeight: '3.5rem',
|
|
1278
1343
|
overflow: 'hidden',
|
|
1279
1344
|
p: '0 !important',
|
|
1280
|
-
transition: 'all 0.
|
|
1345
|
+
transition: 'all 0.1s ease-in-out',
|
|
1281
1346
|
zIndex: 1,
|
|
1282
1347
|
});
|
|
1283
1348
|
const MRT_TopToolbar = ({ table }) => {
|
|
@@ -1339,7 +1404,7 @@ const MRT_BottomToolbar = ({ table }) => {
|
|
|
1339
1404
|
// @ts-ignore
|
|
1340
1405
|
toolbarProps.ref.current = ref;
|
|
1341
1406
|
}
|
|
1342
|
-
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow:
|
|
1407
|
+
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `0 1px 2px -1px ${material.alpha(theme.palette.common.black, 0.1)} inset`, left: 0, position: isFullScreen ? 'fixed' : 'relative', right: 0 }), ((toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx) instanceof Function
|
|
1343
1408
|
? toolbarProps.sx(theme)
|
|
1344
1409
|
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
|
|
1345
1410
|
React__default["default"].createElement(MRT_LinearProgressBar, { isTopToolbar: false, table: table }),
|
|
@@ -1387,7 +1452,7 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
|
1387
1452
|
const iconButtonProps = Object.assign(Object.assign({}, mTableHeadCellColumnActionsButtonProps), mcTableHeadCellColumnActionsButtonProps);
|
|
1388
1453
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1389
1454
|
React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.columnActions },
|
|
1390
|
-
React__default["default"].createElement(material.IconButton, Object.assign({ "aria-label": localization.columnActions, onClick: handleClick, size: "small" }, iconButtonProps, { sx: (theme) => (Object.assign({ height: '2rem', mt: '-0.2rem', opacity: 0.5, transition: 'opacity 0.
|
|
1455
|
+
React__default["default"].createElement(material.IconButton, Object.assign({ "aria-label": localization.columnActions, onClick: handleClick, size: "small" }, iconButtonProps, { sx: (theme) => (Object.assign({ height: '2rem', mt: '-0.2rem', opacity: 0.5, transition: 'opacity 0.1s', width: '2rem', '&:hover': {
|
|
1391
1456
|
opacity: 1,
|
|
1392
1457
|
} }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
|
1393
1458
|
? iconButtonProps.sx(theme)
|
|
@@ -1451,8 +1516,10 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1451
1516
|
});
|
|
1452
1517
|
const handleChangeDebounced = React.useCallback(material.debounce((event) => {
|
|
1453
1518
|
let value = textFieldProps.type === 'date'
|
|
1454
|
-
?
|
|
1455
|
-
:
|
|
1519
|
+
? event.target.valueAsDate
|
|
1520
|
+
: textFieldProps.type === 'number'
|
|
1521
|
+
? event.target.valueAsNumber
|
|
1522
|
+
: event.target.value;
|
|
1456
1523
|
if (isRangeFilter) {
|
|
1457
1524
|
column.setFilterValue((old) => {
|
|
1458
1525
|
const newFilterValues = old !== null && old !== void 0 ? old : ['', ''];
|
|
@@ -1495,10 +1562,12 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1495
1562
|
setAnchorEl(event.currentTarget);
|
|
1496
1563
|
};
|
|
1497
1564
|
React.useEffect(() => {
|
|
1498
|
-
|
|
1499
|
-
|
|
1565
|
+
if (column.getFilterValue() === undefined) {
|
|
1566
|
+
handleClear();
|
|
1567
|
+
}
|
|
1568
|
+
}, [column.getFilterValue()]);
|
|
1500
1569
|
if (columnDef.Filter) {
|
|
1501
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null, (_e = columnDef.Filter) === null || _e === void 0 ? void 0 : _e.call(columnDef, { column, header, table }));
|
|
1570
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null, (_e = columnDef.Filter) === null || _e === void 0 ? void 0 : _e.call(columnDef, { column, header, rangeFilterIndex, table })));
|
|
1502
1571
|
}
|
|
1503
1572
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1504
1573
|
React__default["default"].createElement(material.TextField, Object.assign({ fullWidth: true, inputProps: {
|
|
@@ -1513,7 +1582,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1513
1582
|
localization[`filter${((_f = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _f === void 0 ? void 0 : _f.toUpperCase()) +
|
|
1514
1583
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]))) : null, FormHelperTextProps: {
|
|
1515
1584
|
sx: {
|
|
1516
|
-
fontSize: '0.
|
|
1585
|
+
fontSize: '0.75rem',
|
|
1517
1586
|
lineHeight: '0.8rem',
|
|
1518
1587
|
whiteSpace: 'nowrap',
|
|
1519
1588
|
},
|
|
@@ -1554,11 +1623,11 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1554
1623
|
if (textFieldProps.inputRef) {
|
|
1555
1624
|
textFieldProps.inputRef = inputRef;
|
|
1556
1625
|
}
|
|
1557
|
-
}, sx: (theme) => (Object.assign({ p: 0, minWidth:
|
|
1558
|
-
? '
|
|
1626
|
+
}, sx: (theme) => (Object.assign({ p: 0, minWidth: isRangeFilter
|
|
1627
|
+
? '100px'
|
|
1559
1628
|
: !filterChipLabel
|
|
1560
1629
|
? '120px'
|
|
1561
|
-
: 'auto', width: '100%', '&
|
|
1630
|
+
: 'auto', width: '100%', '& .MuiSelect-icon': {
|
|
1562
1631
|
mr: '1.5rem',
|
|
1563
1632
|
} }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
|
|
1564
1633
|
? textFieldProps.sx(theme)
|
|
@@ -1586,7 +1655,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1586
1655
|
isMultiSelectFilter && (React__default["default"].createElement(material.Checkbox, { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })),
|
|
1587
1656
|
text));
|
|
1588
1657
|
})),
|
|
1589
|
-
React__default["default"].createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table })));
|
|
1658
|
+
React__default["default"].createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table, setFilterValue: setFilterValue })));
|
|
1590
1659
|
};
|
|
1591
1660
|
|
|
1592
1661
|
const MRT_FilterRangeFields = ({ header, table }) => {
|
|
@@ -1595,12 +1664,50 @@ const MRT_FilterRangeFields = ({ header, table }) => {
|
|
|
1595
1664
|
React__default["default"].createElement(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })));
|
|
1596
1665
|
};
|
|
1597
1666
|
|
|
1667
|
+
const MRT_FilterCheckbox = ({ column, table }) => {
|
|
1668
|
+
var _a, _b, _c;
|
|
1669
|
+
const { getState, options: { localization, muiTableHeadCellFilterCheckboxProps }, } = table;
|
|
1670
|
+
const { density } = getState();
|
|
1671
|
+
const { columnDef } = column;
|
|
1672
|
+
const mTableHeadCellFilterCheckboxProps = muiTableHeadCellFilterCheckboxProps instanceof Function
|
|
1673
|
+
? muiTableHeadCellFilterCheckboxProps({
|
|
1674
|
+
column,
|
|
1675
|
+
table,
|
|
1676
|
+
})
|
|
1677
|
+
: muiTableHeadCellFilterCheckboxProps;
|
|
1678
|
+
const mcTableHeadCellFilterCheckboxProps = columnDef.muiTableHeadCellFilterCheckboxProps instanceof Function
|
|
1679
|
+
? columnDef.muiTableHeadCellFilterCheckboxProps({
|
|
1680
|
+
column,
|
|
1681
|
+
table,
|
|
1682
|
+
})
|
|
1683
|
+
: columnDef.muiTableHeadCellFilterCheckboxProps;
|
|
1684
|
+
const checkboxProps = Object.assign(Object.assign({}, mTableHeadCellFilterCheckboxProps), mcTableHeadCellFilterCheckboxProps);
|
|
1685
|
+
const filterLabel = (_a = localization.filterByColumn) === null || _a === void 0 ? void 0 : _a.replace('{column}', columnDef.header);
|
|
1686
|
+
return (React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : filterLabel },
|
|
1687
|
+
React__default["default"].createElement(material.FormControlLabel, { control: React__default["default"].createElement(material.Checkbox, Object.assign({ checked: column.getFilterValue() === 'true', indeterminate: column.getFilterValue() === undefined, color: column.getFilterValue() === undefined ? 'default' : 'primary', size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
|
|
1688
|
+
var _a;
|
|
1689
|
+
e.stopPropagation();
|
|
1690
|
+
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
|
1691
|
+
}, onChange: (e, checked) => {
|
|
1692
|
+
var _a;
|
|
1693
|
+
column.setFilterValue(column.getFilterValue() === undefined
|
|
1694
|
+
? 'true'
|
|
1695
|
+
: column.getFilterValue() === 'true'
|
|
1696
|
+
? 'false'
|
|
1697
|
+
: undefined);
|
|
1698
|
+
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onChange) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e, checked);
|
|
1699
|
+
}, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, ((checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx) instanceof Function
|
|
1700
|
+
? checkboxProps.sx(theme)
|
|
1701
|
+
: 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 })));
|
|
1702
|
+
};
|
|
1703
|
+
|
|
1598
1704
|
const MRT_TableHeadCellFilterContainer = ({ header, table, }) => {
|
|
1599
1705
|
const { getState } = table;
|
|
1600
1706
|
const { showColumnFilters } = getState();
|
|
1601
1707
|
const { column } = header;
|
|
1602
1708
|
const { columnDef } = column;
|
|
1603
|
-
return (React__default["default"].createElement(material.Collapse, { in: showColumnFilters, mountOnEnter: true, unmountOnExit: true },
|
|
1709
|
+
return (React__default["default"].createElement(material.Collapse, { in: showColumnFilters, mountOnEnter: true, unmountOnExit: true }, columnDef.filterVariant === 'checkbox' ? (React__default["default"].createElement(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range' ||
|
|
1710
|
+
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (React__default["default"].createElement(MRT_FilterRangeFields, { header: header, table: table })) : (React__default["default"].createElement(MRT_FilterTextField, { header: header, table: table }))));
|
|
1604
1711
|
};
|
|
1605
1712
|
|
|
1606
1713
|
const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
@@ -1689,7 +1796,7 @@ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
|
|
1689
1796
|
position: 'absolute',
|
|
1690
1797
|
right: '1px',
|
|
1691
1798
|
touchAction: 'none',
|
|
1692
|
-
transition: column.getIsResizing() ? undefined : 'all 0.
|
|
1799
|
+
transition: column.getIsResizing() ? undefined : 'all 0.1s ease-in-out',
|
|
1693
1800
|
userSelect: 'none',
|
|
1694
1801
|
zIndex: 4,
|
|
1695
1802
|
'&:active': {
|
|
@@ -1704,7 +1811,7 @@ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
|
|
1704
1811
|
} }));
|
|
1705
1812
|
};
|
|
1706
1813
|
|
|
1707
|
-
const MRT_TableHeadCellSortLabel = ({ header, table }) => {
|
|
1814
|
+
const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
|
|
1708
1815
|
const { options: { localization }, } = table;
|
|
1709
1816
|
const { column } = header;
|
|
1710
1817
|
const { columnDef } = column;
|
|
@@ -1718,7 +1825,9 @@ const MRT_TableHeadCellSortLabel = ({ header, table }) => {
|
|
|
1718
1825
|
? column.getIsSorted()
|
|
1719
1826
|
: undefined, sx: {
|
|
1720
1827
|
width: '2ch',
|
|
1721
|
-
transform:
|
|
1828
|
+
transform: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) !== 'right'
|
|
1829
|
+
? 'translateX(-0.5ch)'
|
|
1830
|
+
: undefined,
|
|
1722
1831
|
} })));
|
|
1723
1832
|
};
|
|
1724
1833
|
|
|
@@ -1795,8 +1904,9 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1795
1904
|
header.isPlaceholder ? null : (React__default["default"].createElement(material.Box, { sx: {
|
|
1796
1905
|
alignItems: 'flex-start',
|
|
1797
1906
|
display: 'flex',
|
|
1907
|
+
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
|
1798
1908
|
justifyContent: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right'
|
|
1799
|
-
? 'flex-
|
|
1909
|
+
? 'flex-start'
|
|
1800
1910
|
: columnDefType === 'group' ||
|
|
1801
1911
|
(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
|
1802
1912
|
? 'center'
|
|
@@ -1810,6 +1920,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1810
1920
|
? 'pointer'
|
|
1811
1921
|
: undefined,
|
|
1812
1922
|
display: 'flex',
|
|
1923
|
+
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
|
1813
1924
|
flexWrap: 'nowrap',
|
|
1814
1925
|
m: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center' ? 'auto' : undefined,
|
|
1815
1926
|
pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center' && column.getCanSort()
|
|
@@ -1818,7 +1929,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1818
1929
|
whiteSpace: ((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) < 24 ? 'nowrap' : 'normal',
|
|
1819
1930
|
} },
|
|
1820
1931
|
headerElement,
|
|
1821
|
-
column.getCanSort() && (React__default["default"].createElement(MRT_TableHeadCellSortLabel, { header: header, table: table })),
|
|
1932
|
+
column.getCanSort() && (React__default["default"].createElement(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps })),
|
|
1822
1933
|
column.getCanFilter() && (React__default["default"].createElement(MRT_TableHeadCellFilterLabel, { header: header, table: table }))),
|
|
1823
1934
|
columnDefType !== 'group' && (React__default["default"].createElement(material.Box, { sx: { whiteSpace: 'nowrap' } },
|
|
1824
1935
|
enableColumnDragging !== false &&
|
|
@@ -1846,11 +1957,13 @@ const MRT_TableHeadRow = ({ headerGroup, table }) => {
|
|
|
1846
1957
|
};
|
|
1847
1958
|
|
|
1848
1959
|
const MRT_TableHead = ({ table }) => {
|
|
1849
|
-
const { getHeaderGroups, options: { muiTableHeadProps }, } = table;
|
|
1960
|
+
const { getHeaderGroups, options: { enableStickyHeader, muiTableHeadProps }, } = table;
|
|
1850
1961
|
const tableHeadProps = muiTableHeadProps instanceof Function
|
|
1851
1962
|
? muiTableHeadProps({ table })
|
|
1852
1963
|
: muiTableHeadProps;
|
|
1853
|
-
return (React__default["default"].createElement(material.TableHead, Object.assign({}, tableHeadProps
|
|
1964
|
+
return (React__default["default"].createElement(material.TableHead, Object.assign({}, tableHeadProps, { sx: (theme) => (Object.assign({ opacity: enableStickyHeader ? 0.97 : undefined }, ((tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx) instanceof Function
|
|
1965
|
+
? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
|
|
1966
|
+
: tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))) }), getHeaderGroups().map((headerGroup) => (React__default["default"].createElement(MRT_TableHeadRow, { headerGroup: headerGroup, key: headerGroup.id, table: table })))));
|
|
1854
1967
|
};
|
|
1855
1968
|
|
|
1856
1969
|
const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
|
@@ -2002,7 +2115,7 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2002
2115
|
? muiTableBodyCellProps({ cell, column, row, table })
|
|
2003
2116
|
: muiTableBodyCellProps;
|
|
2004
2117
|
const mcTableCellBodyProps = columnDef.muiTableBodyCellProps instanceof Function
|
|
2005
|
-
? columnDef.muiTableBodyCellProps({ cell, table })
|
|
2118
|
+
? columnDef.muiTableBodyCellProps({ cell, column, row, table })
|
|
2006
2119
|
: columnDef.muiTableBodyCellProps;
|
|
2007
2120
|
const tableCellProps = Object.assign(Object.assign({}, mTableCellBodyProps), mcTableCellBodyProps);
|
|
2008
2121
|
const skeletonProps = muiTableBodyCellSkeletonProps instanceof Function
|
|
@@ -2116,7 +2229,7 @@ const MRT_TableDetailPanel = ({ row, table }) => {
|
|
|
2116
2229
|
? muiTableDetailPanelProps({ row, table })
|
|
2117
2230
|
: muiTableDetailPanelProps;
|
|
2118
2231
|
return (React__default["default"].createElement(material.TableRow, Object.assign({}, tableRowProps),
|
|
2119
|
-
React__default["default"].createElement(material.TableCell, Object.assign({ colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ borderBottom: !row.getIsExpanded() ? 'none' : undefined, pb: row.getIsExpanded() ? '1rem' : 0, pt: row.getIsExpanded() ? '1rem' : 0, transition: 'all 0.
|
|
2232
|
+
React__default["default"].createElement(material.TableCell, Object.assign({ colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ borderBottom: !row.getIsExpanded() ? 'none' : undefined, pb: row.getIsExpanded() ? '1rem' : 0, pt: row.getIsExpanded() ? '1rem' : 0, transition: 'all 0.1s ease-in-out', width: `${table.getTotalSize()}px` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
|
2120
2233
|
? tableCellProps.sx(theme)
|
|
2121
2234
|
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (React__default["default"].createElement(material.Collapse, { in: row.getIsExpanded() }, renderDetailPanel({ row, table }))))));
|
|
2122
2235
|
};
|
|
@@ -2151,7 +2264,7 @@ const MRT_TableBodyRow = ({ row, rowIndex, table, virtualRow, }) => {
|
|
|
2151
2264
|
if (virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.measureRef) {
|
|
2152
2265
|
virtualRow.measureRef = node;
|
|
2153
2266
|
}
|
|
2154
|
-
} }, tableRowProps, { sx: (theme) => (Object.assign(Object.assign({ backgroundColor: material.lighten(theme.palette.background.default, 0.06), opacity: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id ? 0.5 : 1, transition: 'all 0.
|
|
2267
|
+
} }, tableRowProps, { sx: (theme) => (Object.assign(Object.assign({ backgroundColor: material.lighten(theme.palette.background.default, 0.06), opacity: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id ? 0.5 : 1, transition: 'all 0.1s ease-in-out', '&:hover td': {
|
|
2155
2268
|
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false && getIsSomeColumnsPinned()
|
|
2156
2269
|
? theme.palette.mode === 'dark'
|
|
2157
2270
|
? `${material.lighten(theme.palette.background.default, 0.12)}`
|
|
@@ -2306,7 +2419,7 @@ const MRT_TableFooter = ({ table }) => {
|
|
|
2306
2419
|
? muiTableFooterProps({ table })
|
|
2307
2420
|
: muiTableFooterProps;
|
|
2308
2421
|
const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
|
|
2309
|
-
return (React__default["default"].createElement(material.TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ backgroundColor: material.lighten(theme.palette.background.default, 0.06), bottom: stickFooter ? 0 : undefined, opacity: stickFooter ? 0.
|
|
2422
|
+
return (React__default["default"].createElement(material.TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ backgroundColor: material.lighten(theme.palette.background.default, 0.06), bottom: stickFooter ? 0 : undefined, opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
|
|
2310
2423
|
? theme.palette.mode === 'light'
|
|
2311
2424
|
? `1px solid ${theme.palette.grey[300]}`
|
|
2312
2425
|
: `1px solid ${theme.palette.grey[700]}`
|
|
@@ -2364,7 +2477,7 @@ const MRT_TableContainer = ({ table }) => {
|
|
|
2364
2477
|
};
|
|
2365
2478
|
|
|
2366
2479
|
const MRT_TablePaper = ({ table }) => {
|
|
2367
|
-
const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps }, refs: { tablePaperRef }, } = table;
|
|
2480
|
+
const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
|
|
2368
2481
|
const { isFullScreen } = getState();
|
|
2369
2482
|
const tablePaperProps = muiTablePaperProps instanceof Function
|
|
2370
2483
|
? muiTablePaperProps({ table })
|
|
@@ -2375,7 +2488,7 @@ const MRT_TablePaper = ({ table }) => {
|
|
|
2375
2488
|
//@ts-ignore
|
|
2376
2489
|
tablePaperProps.ref.current = ref;
|
|
2377
2490
|
}
|
|
2378
|
-
}, sx: (theme) => (Object.assign({ transition: 'all 0.
|
|
2491
|
+
}, sx: (theme) => (Object.assign({ transition: 'all 0.1s ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
|
|
2379
2492
|
? tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx(theme)
|
|
2380
2493
|
: tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), (isFullScreen
|
|
2381
2494
|
? {
|
|
@@ -2387,9 +2500,15 @@ const MRT_TablePaper = ({ table }) => {
|
|
|
2387
2500
|
width: '100vw',
|
|
2388
2501
|
}
|
|
2389
2502
|
: {})) }),
|
|
2390
|
-
enableTopToolbar &&
|
|
2503
|
+
enableTopToolbar &&
|
|
2504
|
+
(renderTopToolbar instanceof Function
|
|
2505
|
+
? renderTopToolbar({ table })
|
|
2506
|
+
: renderTopToolbar !== null && renderTopToolbar !== void 0 ? renderTopToolbar : React__default["default"].createElement(MRT_TopToolbar, { table: table })),
|
|
2391
2507
|
React__default["default"].createElement(MRT_TableContainer, { table: table }),
|
|
2392
|
-
enableBottomToolbar &&
|
|
2508
|
+
enableBottomToolbar &&
|
|
2509
|
+
(renderBottomToolbar instanceof Function
|
|
2510
|
+
? renderBottomToolbar({ table })
|
|
2511
|
+
: renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : React__default["default"].createElement(MRT_BottomToolbar, { table: table }))));
|
|
2393
2512
|
};
|
|
2394
2513
|
|
|
2395
2514
|
const MRT_EditRowModal = ({ open, row, table, }) => {
|
|
@@ -2399,9 +2518,10 @@ const MRT_EditRowModal = ({ open, row, table, }) => {
|
|
|
2399
2518
|
React__default["default"].createElement(material.DialogContent, null,
|
|
2400
2519
|
React__default["default"].createElement("form", { onSubmit: (e) => e.preventDefault() },
|
|
2401
2520
|
React__default["default"].createElement(material.Stack, { sx: {
|
|
2402
|
-
width: '100%',
|
|
2403
|
-
minWidth: { xs: '300px', sm: '360px', md: '400px' },
|
|
2404
2521
|
gap: '1.5rem',
|
|
2522
|
+
minWidth: { xs: '300px', sm: '360px', md: '400px' },
|
|
2523
|
+
pt: '1rem',
|
|
2524
|
+
width: '100%',
|
|
2405
2525
|
} }, row
|
|
2406
2526
|
.getAllCells()
|
|
2407
2527
|
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
|
@@ -2453,14 +2573,14 @@ const MRT_TableRoot = (props) => {
|
|
|
2453
2573
|
const [showColumnFilters, setShowFilters] = React.useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _p !== void 0 ? _p : false);
|
|
2454
2574
|
const [showGlobalFilter, setShowGlobalFilter] = React.useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _q !== void 0 ? _q : false);
|
|
2455
2575
|
const displayColumns = React.useMemo(() => {
|
|
2456
|
-
var _a, _b, _c, _d, _e
|
|
2576
|
+
var _a, _b, _c, _d, _e;
|
|
2457
2577
|
return [
|
|
2458
|
-
columnOrder.includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header:
|
|
2459
|
-
columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (React__default["default"].createElement(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header:
|
|
2578
|
+
columnOrder.includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header: props.localization.move, size: 60 }, props.defaultDisplayColumn), (_a = props.displayColumnDefOptions) === null || _a === void 0 ? void 0 : _a['mrt-row-drag']), { id: 'mrt-row-drag' }),
|
|
2579
|
+
columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (React__default["default"].createElement(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: props.localization.actions, size: 70 }, props.defaultDisplayColumn), (_b = props.displayColumnDefOptions) === null || _b === void 0 ? void 0 : _b['mrt-row-actions']), { id: 'mrt-row-actions' }),
|
|
2460
2580
|
columnOrder.includes('mrt-row-expand') &&
|
|
2461
|
-
showExpandColumn(props, grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React__default["default"].createElement(MRT_ExpandButton, { row: row, table: table })), Header: () => props.enableExpandAll ? (React__default["default"].createElement(MRT_ExpandAllButton, { table: table })) : null, header:
|
|
2462
|
-
columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React__default["default"].createElement(MRT_SelectCheckbox, { row: row, table: table })), Header: () => props.enableSelectAll ? (React__default["default"].createElement(MRT_SelectCheckbox, { selectAll: true, table: table })) : null, header:
|
|
2463
|
-
columnOrder.includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () =>
|
|
2581
|
+
showExpandColumn(props, grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React__default["default"].createElement(MRT_ExpandButton, { row: row, table: table })), Header: () => props.enableExpandAll ? (React__default["default"].createElement(MRT_ExpandAllButton, { table: table })) : null, header: props.localization.expand, size: 60 }, props.defaultDisplayColumn), (_c = props.displayColumnDefOptions) === null || _c === void 0 ? void 0 : _c['mrt-row-expand']), { id: 'mrt-row-expand' }),
|
|
2582
|
+
columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React__default["default"].createElement(MRT_SelectCheckbox, { row: row, table: table })), Header: () => props.enableSelectAll ? (React__default["default"].createElement(MRT_SelectCheckbox, { selectAll: true, table: table })) : null, header: props.localization.select, size: 60 }, props.defaultDisplayColumn), (_d = props.displayColumnDefOptions) === null || _d === void 0 ? void 0 : _d['mrt-row-select']), { id: 'mrt-row-select' }),
|
|
2583
|
+
columnOrder.includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => props.localization.rowNumber, header: props.localization.rowNumbers, size: 60 }, props.defaultDisplayColumn), (_e = props.displayColumnDefOptions) === null || _e === void 0 ? void 0 : _e['mrt-row-numbers']), { id: 'mrt-row-numbers' }),
|
|
2464
2584
|
].filter(Boolean);
|
|
2465
2585
|
}, [
|
|
2466
2586
|
columnOrder,
|
|
@@ -2567,17 +2687,26 @@ const MRT_TableRoot = (props) => {
|
|
|
2567
2687
|
editingRow && props.editingMode === 'modal' && (React__default["default"].createElement(MRT_EditRowModal, { row: editingRow, table: table, open: true }))));
|
|
2568
2688
|
};
|
|
2569
2689
|
|
|
2570
|
-
|
|
2571
|
-
var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onEnd', defaultColumn
|
|
2572
|
-
|
|
2690
|
+
const MaterialReactTable = (_a) => {
|
|
2691
|
+
var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onEnd', defaultColumn, defaultDisplayColumn, editingMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = 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, localization, 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", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "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"]);
|
|
2692
|
+
const _icons = React.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), []);
|
|
2693
|
+
const _localization = React.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), []);
|
|
2694
|
+
const _aggregationFns = React.useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
|
|
2695
|
+
const _filterFns = React.useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
|
|
2696
|
+
const _sortingFns = React.useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
|
|
2697
|
+
const _defaultColumn = React.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), []);
|
|
2698
|
+
const _defaultDisplayColumn = React.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), []);
|
|
2699
|
+
return (React__default["default"].createElement(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, 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, localization: _localization, positionActionsColumn: positionActionsColumn, positionExpandColumn: positionExpandColumn, positionGlobalFilter: positionGlobalFilter, positionPagination: positionPagination, positionToolbarAlertBanner: positionToolbarAlertBanner, positionToolbarDropZone: positionToolbarDropZone, rowNumberMode: rowNumberMode, selectAllMode: selectAllMode, sortingFns: _sortingFns }, rest)));
|
|
2573
2700
|
};
|
|
2574
2701
|
|
|
2575
2702
|
exports.MRT_CopyButton = MRT_CopyButton;
|
|
2576
2703
|
exports.MRT_FullScreenToggleButton = MRT_FullScreenToggleButton;
|
|
2577
2704
|
exports.MRT_GlobalFilterTextField = MRT_GlobalFilterTextField;
|
|
2578
2705
|
exports.MRT_ShowHideColumnsButton = MRT_ShowHideColumnsButton;
|
|
2706
|
+
exports.MRT_TablePagination = MRT_TablePagination;
|
|
2579
2707
|
exports.MRT_ToggleDensePaddingButton = MRT_ToggleDensePaddingButton;
|
|
2580
2708
|
exports.MRT_ToggleFiltersButton = MRT_ToggleFiltersButton;
|
|
2581
2709
|
exports.MRT_ToggleGlobalFilterButton = MRT_ToggleGlobalFilterButton;
|
|
2710
|
+
exports.MRT_ToolbarInternalButtons = MRT_ToolbarInternalButtons;
|
|
2582
2711
|
exports["default"] = MaterialReactTable;
|
|
2583
2712
|
//# sourceMappingURL=index.js.map
|