material-react-table 1.0.0-beta.9 → 1.0.0-rc.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/README.md +1 -1
- package/dist/cjs/MaterialReactTable.d.ts +110 -11
- 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 +188 -63
- 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 +1 -2
- 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 +110 -11
- 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 +188 -65
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/menus/MRT_FilterOptionMenu.d.ts +1 -2
- 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 +59 -32
- 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 -77
- 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_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 +21 -11
- package/src/inputs/MRT_GlobalFilterTextField.tsx +17 -5
- package/src/inputs/MRT_SelectCheckbox.tsx +16 -7
- package/src/menus/MRT_FilterOptionMenu.tsx +1 -1
- package/src/table/MRT_TablePaper.tsx +9 -7
- 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
|
|
|
@@ -491,7 +497,7 @@ const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table,
|
|
|
491
497
|
var _a;
|
|
492
498
|
e.stopPropagation();
|
|
493
499
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
|
|
494
|
-
}, 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': {
|
|
495
501
|
backgroundColor: 'transparent',
|
|
496
502
|
opacity: 1,
|
|
497
503
|
}, '&:active': {
|
|
@@ -599,10 +605,11 @@ const getDefaultColumnOrderIds = (props) => [
|
|
|
599
605
|
const getDefaultColumnFilterFn = (columnDef) => {
|
|
600
606
|
if (columnDef.filterVariant === 'multi-select')
|
|
601
607
|
return 'arrIncludesSome';
|
|
602
|
-
if (columnDef.filterVariant === 'select')
|
|
603
|
-
return 'equals';
|
|
604
608
|
if (columnDef.filterVariant === 'range')
|
|
605
609
|
return 'betweenInclusive';
|
|
610
|
+
if (columnDef.filterVariant === 'select' ||
|
|
611
|
+
columnDef.filterVariant === 'checkbox')
|
|
612
|
+
return 'equals';
|
|
606
613
|
return 'fuzzy';
|
|
607
614
|
};
|
|
608
615
|
const getIsLastLeftPinnedColumn = (table, column) => {
|
|
@@ -618,7 +625,7 @@ const getTotalRight = (table, column) => {
|
|
|
618
625
|
const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
|
619
626
|
var _a, _b, _c, _d;
|
|
620
627
|
return (Object.assign(Object.assign({ backgroundColor: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
|
621
|
-
? material.alpha(material.lighten(theme.palette.background.default, 0.04), 0.
|
|
628
|
+
? material.alpha(material.lighten(theme.palette.background.default, 0.04), 0.97)
|
|
622
629
|
: 'inherit', backgroundImage: 'inherit', boxShadow: getIsLastLeftPinnedColumn(table, column)
|
|
623
630
|
? `-4px 0 8px -6px ${material.alpha(theme.palette.common.black, 0.2)} inset`
|
|
624
631
|
: getIsFirstRightPinnedColumn(column)
|
|
@@ -632,10 +639,29 @@ const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, })
|
|
|
632
639
|
? 'sticky'
|
|
633
640
|
: undefined, right: column.getIsPinned() === 'right'
|
|
634
641
|
? `${getTotalRight(table, column)}px`
|
|
635
|
-
: 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
|
|
636
643
|
? tableCellProps.sx(theme)
|
|
637
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() }));
|
|
638
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
|
+
};
|
|
639
665
|
|
|
640
666
|
const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, isSubMenu, table, }) => {
|
|
641
667
|
var _a;
|
|
@@ -987,7 +1013,7 @@ const commonIconButtonStyles = {
|
|
|
987
1013
|
height: '2rem',
|
|
988
1014
|
ml: '10px',
|
|
989
1015
|
opacity: 0.5,
|
|
990
|
-
transition: 'opacity 0.
|
|
1016
|
+
transition: 'opacity 0.1s',
|
|
991
1017
|
width: '2rem',
|
|
992
1018
|
'&:hover': {
|
|
993
1019
|
opacity: 1,
|
|
@@ -1030,15 +1056,24 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
|
|
1030
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
|
|
1031
1057
|
? localization.toggleSelectAll
|
|
1032
1058
|
: localization.toggleSelectRow) },
|
|
1033
|
-
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: {
|
|
1034
1069
|
'aria-label': selectAll
|
|
1035
1070
|
? localization.toggleSelectAll
|
|
1036
1071
|
: localization.toggleSelectRow,
|
|
1037
|
-
}, onChange:
|
|
1038
|
-
?
|
|
1072
|
+
}, onChange: row
|
|
1073
|
+
? row.getToggleSelectedHandler()
|
|
1074
|
+
: selectAllMode === 'all'
|
|
1039
1075
|
? table.getToggleAllRowsSelectedHandler()
|
|
1040
|
-
: table.getToggleAllPageRowsSelectedHandler()
|
|
1041
|
-
: row.getToggleSelectedHandler(), size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
|
|
1076
|
+
: table.getToggleAllPageRowsSelectedHandler(), size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
|
|
1042
1077
|
var _a;
|
|
1043
1078
|
e.stopPropagation();
|
|
1044
1079
|
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
|
@@ -1051,6 +1086,9 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
|
1051
1086
|
var _a;
|
|
1052
1087
|
const { getState, setGlobalFilter, options: { enableGlobalFilterModes, icons: { SearchIcon, CloseIcon }, localization, muiSearchTextFieldProps, }, refs: { searchInputRef }, } = table;
|
|
1053
1088
|
const { globalFilter, showGlobalFilter } = getState();
|
|
1089
|
+
const textFieldProps = muiSearchTextFieldProps instanceof Function
|
|
1090
|
+
? muiSearchTextFieldProps({ table })
|
|
1091
|
+
: muiSearchTextFieldProps;
|
|
1054
1092
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
1055
1093
|
const [searchValue, setSearchValue] = React.useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
|
|
1056
1094
|
const handleChangeDebounced = React.useCallback(material.debounce((event) => {
|
|
@@ -1068,9 +1106,11 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
|
1068
1106
|
setSearchValue('');
|
|
1069
1107
|
setGlobalFilter(undefined);
|
|
1070
1108
|
};
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1109
|
+
React.useEffect(() => {
|
|
1110
|
+
if (globalFilter === undefined) {
|
|
1111
|
+
handleClear();
|
|
1112
|
+
}
|
|
1113
|
+
}, [globalFilter]);
|
|
1074
1114
|
return (React__default["default"].createElement(material.Collapse, { in: showGlobalFilter, orientation: "horizontal", unmountOnExit: true, mountOnEnter: true },
|
|
1075
1115
|
React__default["default"].createElement(material.TextField, Object.assign({ placeholder: localization.search, onChange: handleChange, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard", InputProps: {
|
|
1076
1116
|
startAdornment: enableGlobalFilterModes ? (React__default["default"].createElement(material.InputAdornment, { position: "start" },
|
|
@@ -1106,8 +1146,8 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table }) => {
|
|
|
1106
1146
|
React__default["default"].createElement(material.LinearProgress, Object.assign({ "aria-label": "Loading", "aria-busy": "true", sx: { position: 'relative' } }, linearProgressProps))));
|
|
1107
1147
|
};
|
|
1108
1148
|
|
|
1109
|
-
const MRT_TablePagination = ({ table, position }) => {
|
|
1110
|
-
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;
|
|
1111
1151
|
const { pagination: { pageSize = 10, pageIndex = 0 }, showGlobalFilter, } = getState();
|
|
1112
1152
|
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
|
|
1113
1153
|
const showFirstLastPageButtons = totalRowCount / pageSize > 2;
|
|
@@ -1117,10 +1157,26 @@ const MRT_TablePagination = ({ table, position }) => {
|
|
|
1117
1157
|
const handleChangeRowsPerPage = (event) => {
|
|
1118
1158
|
setPageSize(+event.target.value);
|
|
1119
1159
|
};
|
|
1120
|
-
return (React__default["default"].createElement(material.TablePagination, Object.assign({
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
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' &&
|
|
1124
1180
|
enableToolbarInternalActions &&
|
|
1125
1181
|
!showGlobalFilter
|
|
1126
1182
|
? '3.5rem'
|
|
@@ -1131,7 +1187,7 @@ const MRT_TablePagination = ({ table, position }) => {
|
|
|
1131
1187
|
|
|
1132
1188
|
const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
1133
1189
|
var _a, _b;
|
|
1134
|
-
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, positionToolbarAlertBanner, }, } = table;
|
|
1190
|
+
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, positionToolbarAlertBanner, rowCount, }, } = table;
|
|
1135
1191
|
const { grouping, showAlertBanner } = getState();
|
|
1136
1192
|
const alertProps = muiToolbarAlertBannerProps instanceof Function
|
|
1137
1193
|
? muiToolbarAlertBannerProps({ table })
|
|
@@ -1140,7 +1196,7 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
|
1140
1196
|
? muiToolbarAlertBannerChipProps({ table })
|
|
1141
1197
|
: muiToolbarAlertBannerChipProps;
|
|
1142
1198
|
const selectMessage = getSelectedRowModel().rows.length > 0
|
|
1143
|
-
? (_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())
|
|
1144
1200
|
: null;
|
|
1145
1201
|
const groupedByMessage = grouping.length > 0 ? (React__default["default"].createElement("span", null,
|
|
1146
1202
|
localization.groupedBy,
|
|
@@ -1234,7 +1290,7 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
|
|
|
1234
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))));
|
|
1235
1291
|
};
|
|
1236
1292
|
|
|
1237
|
-
const MRT_ToolbarInternalButtons = ({ table }) => {
|
|
1293
|
+
const MRT_ToolbarInternalButtons = ({ table, }) => {
|
|
1238
1294
|
var _a;
|
|
1239
1295
|
const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enablePinning, initialState, renderToolbarInternalActions, }, } = table;
|
|
1240
1296
|
return (React__default["default"].createElement(material.Box, { sx: {
|
|
@@ -1282,10 +1338,11 @@ const commonToolbarStyles = ({ theme }) => ({
|
|
|
1282
1338
|
backgroundColor: material.lighten(theme.palette.background.default, 0.04),
|
|
1283
1339
|
backgroundImage: 'none',
|
|
1284
1340
|
display: 'grid',
|
|
1341
|
+
flexWrap: 'wrap-reverse',
|
|
1285
1342
|
minHeight: '3.5rem',
|
|
1286
1343
|
overflow: 'hidden',
|
|
1287
1344
|
p: '0 !important',
|
|
1288
|
-
transition: 'all 0.
|
|
1345
|
+
transition: 'all 0.1s ease-in-out',
|
|
1289
1346
|
zIndex: 1,
|
|
1290
1347
|
});
|
|
1291
1348
|
const MRT_TopToolbar = ({ table }) => {
|
|
@@ -1347,7 +1404,7 @@ const MRT_BottomToolbar = ({ table }) => {
|
|
|
1347
1404
|
// @ts-ignore
|
|
1348
1405
|
toolbarProps.ref.current = ref;
|
|
1349
1406
|
}
|
|
1350
|
-
}, 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
|
|
1351
1408
|
? toolbarProps.sx(theme)
|
|
1352
1409
|
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
|
|
1353
1410
|
React__default["default"].createElement(MRT_LinearProgressBar, { isTopToolbar: false, table: table }),
|
|
@@ -1395,7 +1452,7 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
|
1395
1452
|
const iconButtonProps = Object.assign(Object.assign({}, mTableHeadCellColumnActionsButtonProps), mcTableHeadCellColumnActionsButtonProps);
|
|
1396
1453
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1397
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 },
|
|
1398
|
-
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': {
|
|
1399
1456
|
opacity: 1,
|
|
1400
1457
|
} }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
|
1401
1458
|
? iconButtonProps.sx(theme)
|
|
@@ -1459,8 +1516,10 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1459
1516
|
});
|
|
1460
1517
|
const handleChangeDebounced = React.useCallback(material.debounce((event) => {
|
|
1461
1518
|
let value = textFieldProps.type === 'date'
|
|
1462
|
-
?
|
|
1463
|
-
:
|
|
1519
|
+
? event.target.valueAsDate
|
|
1520
|
+
: textFieldProps.type === 'number'
|
|
1521
|
+
? event.target.valueAsNumber
|
|
1522
|
+
: event.target.value;
|
|
1464
1523
|
if (isRangeFilter) {
|
|
1465
1524
|
column.setFilterValue((old) => {
|
|
1466
1525
|
const newFilterValues = old !== null && old !== void 0 ? old : ['', ''];
|
|
@@ -1502,8 +1561,13 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1502
1561
|
const handleFilterMenuOpen = (event) => {
|
|
1503
1562
|
setAnchorEl(event.currentTarget);
|
|
1504
1563
|
};
|
|
1564
|
+
React.useEffect(() => {
|
|
1565
|
+
if (column.getFilterValue() === undefined) {
|
|
1566
|
+
handleClear();
|
|
1567
|
+
}
|
|
1568
|
+
}, [column.getFilterValue()]);
|
|
1505
1569
|
if (columnDef.Filter) {
|
|
1506
|
-
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 })));
|
|
1507
1571
|
}
|
|
1508
1572
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1509
1573
|
React__default["default"].createElement(material.TextField, Object.assign({ fullWidth: true, inputProps: {
|
|
@@ -1518,7 +1582,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1518
1582
|
localization[`filter${((_f = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _f === void 0 ? void 0 : _f.toUpperCase()) +
|
|
1519
1583
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]))) : null, FormHelperTextProps: {
|
|
1520
1584
|
sx: {
|
|
1521
|
-
fontSize: '0.
|
|
1585
|
+
fontSize: '0.75rem',
|
|
1522
1586
|
lineHeight: '0.8rem',
|
|
1523
1587
|
whiteSpace: 'nowrap',
|
|
1524
1588
|
},
|
|
@@ -1559,11 +1623,11 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1559
1623
|
if (textFieldProps.inputRef) {
|
|
1560
1624
|
textFieldProps.inputRef = inputRef;
|
|
1561
1625
|
}
|
|
1562
|
-
}, sx: (theme) => (Object.assign({ p: 0, minWidth:
|
|
1563
|
-
? '
|
|
1626
|
+
}, sx: (theme) => (Object.assign({ p: 0, minWidth: isRangeFilter
|
|
1627
|
+
? '100px'
|
|
1564
1628
|
: !filterChipLabel
|
|
1565
1629
|
? '120px'
|
|
1566
|
-
: 'auto', width: '100%', '&
|
|
1630
|
+
: 'auto', width: '100%', '& .MuiSelect-icon': {
|
|
1567
1631
|
mr: '1.5rem',
|
|
1568
1632
|
} }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
|
|
1569
1633
|
? textFieldProps.sx(theme)
|
|
@@ -1600,12 +1664,50 @@ const MRT_FilterRangeFields = ({ header, table }) => {
|
|
|
1600
1664
|
React__default["default"].createElement(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })));
|
|
1601
1665
|
};
|
|
1602
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
|
+
|
|
1603
1704
|
const MRT_TableHeadCellFilterContainer = ({ header, table, }) => {
|
|
1604
1705
|
const { getState } = table;
|
|
1605
1706
|
const { showColumnFilters } = getState();
|
|
1606
1707
|
const { column } = header;
|
|
1607
1708
|
const { columnDef } = column;
|
|
1608
|
-
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 }))));
|
|
1609
1711
|
};
|
|
1610
1712
|
|
|
1611
1713
|
const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
@@ -1694,7 +1796,7 @@ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
|
|
1694
1796
|
position: 'absolute',
|
|
1695
1797
|
right: '1px',
|
|
1696
1798
|
touchAction: 'none',
|
|
1697
|
-
transition: column.getIsResizing() ? undefined : 'all 0.
|
|
1799
|
+
transition: column.getIsResizing() ? undefined : 'all 0.1s ease-in-out',
|
|
1698
1800
|
userSelect: 'none',
|
|
1699
1801
|
zIndex: 4,
|
|
1700
1802
|
'&:active': {
|
|
@@ -1709,7 +1811,7 @@ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
|
|
1709
1811
|
} }));
|
|
1710
1812
|
};
|
|
1711
1813
|
|
|
1712
|
-
const MRT_TableHeadCellSortLabel = ({ header, table }) => {
|
|
1814
|
+
const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
|
|
1713
1815
|
const { options: { localization }, } = table;
|
|
1714
1816
|
const { column } = header;
|
|
1715
1817
|
const { columnDef } = column;
|
|
@@ -1723,7 +1825,9 @@ const MRT_TableHeadCellSortLabel = ({ header, table }) => {
|
|
|
1723
1825
|
? column.getIsSorted()
|
|
1724
1826
|
: undefined, sx: {
|
|
1725
1827
|
width: '2ch',
|
|
1726
|
-
transform:
|
|
1828
|
+
transform: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) !== 'right'
|
|
1829
|
+
? 'translateX(-0.5ch)'
|
|
1830
|
+
: undefined,
|
|
1727
1831
|
} })));
|
|
1728
1832
|
};
|
|
1729
1833
|
|
|
@@ -1800,8 +1904,9 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1800
1904
|
header.isPlaceholder ? null : (React__default["default"].createElement(material.Box, { sx: {
|
|
1801
1905
|
alignItems: 'flex-start',
|
|
1802
1906
|
display: 'flex',
|
|
1907
|
+
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
|
1803
1908
|
justifyContent: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right'
|
|
1804
|
-
? 'flex-
|
|
1909
|
+
? 'flex-start'
|
|
1805
1910
|
: columnDefType === 'group' ||
|
|
1806
1911
|
(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
|
1807
1912
|
? 'center'
|
|
@@ -1815,6 +1920,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1815
1920
|
? 'pointer'
|
|
1816
1921
|
: undefined,
|
|
1817
1922
|
display: 'flex',
|
|
1923
|
+
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
|
1818
1924
|
flexWrap: 'nowrap',
|
|
1819
1925
|
m: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center' ? 'auto' : undefined,
|
|
1820
1926
|
pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center' && column.getCanSort()
|
|
@@ -1823,7 +1929,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1823
1929
|
whiteSpace: ((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) < 24 ? 'nowrap' : 'normal',
|
|
1824
1930
|
} },
|
|
1825
1931
|
headerElement,
|
|
1826
|
-
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 })),
|
|
1827
1933
|
column.getCanFilter() && (React__default["default"].createElement(MRT_TableHeadCellFilterLabel, { header: header, table: table }))),
|
|
1828
1934
|
columnDefType !== 'group' && (React__default["default"].createElement(material.Box, { sx: { whiteSpace: 'nowrap' } },
|
|
1829
1935
|
enableColumnDragging !== false &&
|
|
@@ -1851,11 +1957,13 @@ const MRT_TableHeadRow = ({ headerGroup, table }) => {
|
|
|
1851
1957
|
};
|
|
1852
1958
|
|
|
1853
1959
|
const MRT_TableHead = ({ table }) => {
|
|
1854
|
-
const { getHeaderGroups, options: { muiTableHeadProps }, } = table;
|
|
1960
|
+
const { getHeaderGroups, options: { enableStickyHeader, muiTableHeadProps }, } = table;
|
|
1855
1961
|
const tableHeadProps = muiTableHeadProps instanceof Function
|
|
1856
1962
|
? muiTableHeadProps({ table })
|
|
1857
1963
|
: muiTableHeadProps;
|
|
1858
|
-
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 })))));
|
|
1859
1967
|
};
|
|
1860
1968
|
|
|
1861
1969
|
const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
|
@@ -2007,7 +2115,7 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2007
2115
|
? muiTableBodyCellProps({ cell, column, row, table })
|
|
2008
2116
|
: muiTableBodyCellProps;
|
|
2009
2117
|
const mcTableCellBodyProps = columnDef.muiTableBodyCellProps instanceof Function
|
|
2010
|
-
? columnDef.muiTableBodyCellProps({ cell, table })
|
|
2118
|
+
? columnDef.muiTableBodyCellProps({ cell, column, row, table })
|
|
2011
2119
|
: columnDef.muiTableBodyCellProps;
|
|
2012
2120
|
const tableCellProps = Object.assign(Object.assign({}, mTableCellBodyProps), mcTableCellBodyProps);
|
|
2013
2121
|
const skeletonProps = muiTableBodyCellSkeletonProps instanceof Function
|
|
@@ -2121,7 +2229,7 @@ const MRT_TableDetailPanel = ({ row, table }) => {
|
|
|
2121
2229
|
? muiTableDetailPanelProps({ row, table })
|
|
2122
2230
|
: muiTableDetailPanelProps;
|
|
2123
2231
|
return (React__default["default"].createElement(material.TableRow, Object.assign({}, tableRowProps),
|
|
2124
|
-
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
|
|
2125
2233
|
? tableCellProps.sx(theme)
|
|
2126
2234
|
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (React__default["default"].createElement(material.Collapse, { in: row.getIsExpanded() }, renderDetailPanel({ row, table }))))));
|
|
2127
2235
|
};
|
|
@@ -2156,7 +2264,7 @@ const MRT_TableBodyRow = ({ row, rowIndex, table, virtualRow, }) => {
|
|
|
2156
2264
|
if (virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.measureRef) {
|
|
2157
2265
|
virtualRow.measureRef = node;
|
|
2158
2266
|
}
|
|
2159
|
-
} }, 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': {
|
|
2160
2268
|
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false && getIsSomeColumnsPinned()
|
|
2161
2269
|
? theme.palette.mode === 'dark'
|
|
2162
2270
|
? `${material.lighten(theme.palette.background.default, 0.12)}`
|
|
@@ -2311,7 +2419,7 @@ const MRT_TableFooter = ({ table }) => {
|
|
|
2311
2419
|
? muiTableFooterProps({ table })
|
|
2312
2420
|
: muiTableFooterProps;
|
|
2313
2421
|
const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
|
|
2314
|
-
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
|
|
2315
2423
|
? theme.palette.mode === 'light'
|
|
2316
2424
|
? `1px solid ${theme.palette.grey[300]}`
|
|
2317
2425
|
: `1px solid ${theme.palette.grey[700]}`
|
|
@@ -2369,7 +2477,6 @@ const MRT_TableContainer = ({ table }) => {
|
|
|
2369
2477
|
};
|
|
2370
2478
|
|
|
2371
2479
|
const MRT_TablePaper = ({ table }) => {
|
|
2372
|
-
var _a, _b;
|
|
2373
2480
|
const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
|
|
2374
2481
|
const { isFullScreen } = getState();
|
|
2375
2482
|
const tablePaperProps = muiTablePaperProps instanceof Function
|
|
@@ -2381,7 +2488,7 @@ const MRT_TablePaper = ({ table }) => {
|
|
|
2381
2488
|
//@ts-ignore
|
|
2382
2489
|
tablePaperProps.ref.current = ref;
|
|
2383
2490
|
}
|
|
2384
|
-
}, 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
|
|
2385
2492
|
? tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx(theme)
|
|
2386
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
|
|
2387
2494
|
? {
|
|
@@ -2392,8 +2499,16 @@ const MRT_TablePaper = ({ table }) => {
|
|
|
2392
2499
|
padding: 0,
|
|
2393
2500
|
width: '100vw',
|
|
2394
2501
|
}
|
|
2395
|
-
: {})) }),
|
|
2396
|
-
|
|
2502
|
+
: {})) }),
|
|
2503
|
+
enableTopToolbar &&
|
|
2504
|
+
(renderTopToolbar instanceof Function
|
|
2505
|
+
? renderTopToolbar({ table })
|
|
2506
|
+
: renderTopToolbar !== null && renderTopToolbar !== void 0 ? renderTopToolbar : React__default["default"].createElement(MRT_TopToolbar, { table: table })),
|
|
2507
|
+
React__default["default"].createElement(MRT_TableContainer, { table: table }),
|
|
2508
|
+
enableBottomToolbar &&
|
|
2509
|
+
(renderBottomToolbar instanceof Function
|
|
2510
|
+
? renderBottomToolbar({ table })
|
|
2511
|
+
: renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : React__default["default"].createElement(MRT_BottomToolbar, { table: table }))));
|
|
2397
2512
|
};
|
|
2398
2513
|
|
|
2399
2514
|
const MRT_EditRowModal = ({ open, row, table, }) => {
|
|
@@ -2403,9 +2518,10 @@ const MRT_EditRowModal = ({ open, row, table, }) => {
|
|
|
2403
2518
|
React__default["default"].createElement(material.DialogContent, null,
|
|
2404
2519
|
React__default["default"].createElement("form", { onSubmit: (e) => e.preventDefault() },
|
|
2405
2520
|
React__default["default"].createElement(material.Stack, { sx: {
|
|
2406
|
-
width: '100%',
|
|
2407
|
-
minWidth: { xs: '300px', sm: '360px', md: '400px' },
|
|
2408
2521
|
gap: '1.5rem',
|
|
2522
|
+
minWidth: { xs: '300px', sm: '360px', md: '400px' },
|
|
2523
|
+
pt: '1rem',
|
|
2524
|
+
width: '100%',
|
|
2409
2525
|
} }, row
|
|
2410
2526
|
.getAllCells()
|
|
2411
2527
|
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
|
@@ -2457,14 +2573,14 @@ const MRT_TableRoot = (props) => {
|
|
|
2457
2573
|
const [showColumnFilters, setShowFilters] = React.useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _p !== void 0 ? _p : false);
|
|
2458
2574
|
const [showGlobalFilter, setShowGlobalFilter] = React.useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _q !== void 0 ? _q : false);
|
|
2459
2575
|
const displayColumns = React.useMemo(() => {
|
|
2460
|
-
var _a, _b, _c, _d, _e
|
|
2576
|
+
var _a, _b, _c, _d, _e;
|
|
2461
2577
|
return [
|
|
2462
|
-
columnOrder.includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header:
|
|
2463
|
-
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' }),
|
|
2464
2580
|
columnOrder.includes('mrt-row-expand') &&
|
|
2465
|
-
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:
|
|
2466
|
-
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:
|
|
2467
|
-
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' }),
|
|
2468
2584
|
].filter(Boolean);
|
|
2469
2585
|
}, [
|
|
2470
2586
|
columnOrder,
|
|
@@ -2571,17 +2687,26 @@ const MRT_TableRoot = (props) => {
|
|
|
2571
2687
|
editingRow && props.editingMode === 'modal' && (React__default["default"].createElement(MRT_EditRowModal, { row: editingRow, table: table, open: true }))));
|
|
2572
2688
|
};
|
|
2573
2689
|
|
|
2574
|
-
|
|
2575
|
-
var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onEnd', defaultColumn
|
|
2576
|
-
|
|
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)));
|
|
2577
2700
|
};
|
|
2578
2701
|
|
|
2579
2702
|
exports.MRT_CopyButton = MRT_CopyButton;
|
|
2580
2703
|
exports.MRT_FullScreenToggleButton = MRT_FullScreenToggleButton;
|
|
2581
2704
|
exports.MRT_GlobalFilterTextField = MRT_GlobalFilterTextField;
|
|
2582
2705
|
exports.MRT_ShowHideColumnsButton = MRT_ShowHideColumnsButton;
|
|
2706
|
+
exports.MRT_TablePagination = MRT_TablePagination;
|
|
2583
2707
|
exports.MRT_ToggleDensePaddingButton = MRT_ToggleDensePaddingButton;
|
|
2584
2708
|
exports.MRT_ToggleFiltersButton = MRT_ToggleFiltersButton;
|
|
2585
2709
|
exports.MRT_ToggleGlobalFilterButton = MRT_ToggleGlobalFilterButton;
|
|
2710
|
+
exports.MRT_ToolbarInternalButtons = MRT_ToolbarInternalButtons;
|
|
2586
2711
|
exports["default"] = MaterialReactTable;
|
|
2587
2712
|
//# sourceMappingURL=index.js.map
|