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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo, useRef, useState, useCallback, Fragment, memo,
|
|
1
|
+
import React, { useMemo, useRef, useState, useCallback, useEffect, Fragment, memo, useLayoutEffect } from 'react';
|
|
2
2
|
import { aggregationFns, filterFns, sortingFns, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedRowModel, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
|
|
3
3
|
import { ArrowRight, Cancel, CheckBox, ClearAll, Close, DensityLarge, DensityMedium, DensitySmall, DragHandle, DynamicFeed, Edit, ExpandLess, ExpandMore, FilterAlt, FilterAltOff, FilterList, FilterListOff, FullscreenExit, Fullscreen, KeyboardDoubleArrowDown, MoreHoriz, MoreVert, PushPin, RestartAlt, Save, Search, SearchOff, Sort, ViewColumn, VisibilityOff } from '@mui/icons-material';
|
|
4
4
|
import { rankItem, rankings, compareItems } from '@tanstack/match-sorter-utils';
|
|
@@ -151,7 +151,7 @@ const MRT_FilterFns = Object.assign(Object.assign({}, filterFns), { between,
|
|
|
151
151
|
notEquals,
|
|
152
152
|
startsWith });
|
|
153
153
|
|
|
154
|
-
const
|
|
154
|
+
const MRT_Localization_EN = {
|
|
155
155
|
actions: 'Actions',
|
|
156
156
|
and: 'and',
|
|
157
157
|
cancel: 'Cancel',
|
|
@@ -192,6 +192,10 @@ const MRT_DefaultLocalization_EN = {
|
|
|
192
192
|
filterStartsWith: 'Starts With',
|
|
193
193
|
filterWeakEquals: 'Equals',
|
|
194
194
|
filteringByColumn: 'Filtering by {column} - {filterType} {filterValue}',
|
|
195
|
+
goToFirstPage: 'Go to first page',
|
|
196
|
+
goToLastPage: 'Go to last page',
|
|
197
|
+
goToNextPage: 'Go to next page',
|
|
198
|
+
goToPreviousPage: 'Go to previous page',
|
|
195
199
|
grab: 'Grab',
|
|
196
200
|
groupByColumn: 'Group by {column}',
|
|
197
201
|
groupedBy: 'Grouped by ',
|
|
@@ -202,6 +206,7 @@ const MRT_DefaultLocalization_EN = {
|
|
|
202
206
|
move: 'Move',
|
|
203
207
|
noRecordsToDisplay: 'No records to display',
|
|
204
208
|
noResultsFound: 'No results found',
|
|
209
|
+
of: 'of',
|
|
205
210
|
or: 'or',
|
|
206
211
|
pinToLeft: 'Pin to left',
|
|
207
212
|
pinToRight: 'Pin to right',
|
|
@@ -210,6 +215,7 @@ const MRT_DefaultLocalization_EN = {
|
|
|
210
215
|
rowActions: 'Row Actions',
|
|
211
216
|
rowNumber: '#',
|
|
212
217
|
rowNumbers: 'Row Numbers',
|
|
218
|
+
rowsPerPage: 'Rows per page',
|
|
213
219
|
save: 'Save',
|
|
214
220
|
search: 'Search',
|
|
215
221
|
selectedCountOfRowCountRowsSelected: '{selectedCount} of {rowCount} row(s) selected',
|
|
@@ -267,7 +273,7 @@ const MRT_ExpandAllButton = ({ table }) => {
|
|
|
267
273
|
: getIsSomeRowsExpanded()
|
|
268
274
|
? -90
|
|
269
275
|
: 0}deg)`,
|
|
270
|
-
transition: 'transform 0.
|
|
276
|
+
transition: 'transform 0.1s',
|
|
271
277
|
} })))));
|
|
272
278
|
};
|
|
273
279
|
|
|
@@ -295,7 +301,7 @@ const MRT_ExpandButton = ({ row, table }) => {
|
|
|
295
301
|
: row.getIsExpanded()
|
|
296
302
|
? -180
|
|
297
303
|
: 0}deg)`,
|
|
298
|
-
transition: 'transform 0.
|
|
304
|
+
transition: 'transform 0.1s',
|
|
299
305
|
} })))));
|
|
300
306
|
};
|
|
301
307
|
|
|
@@ -483,7 +489,7 @@ const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table,
|
|
|
483
489
|
var _a;
|
|
484
490
|
e.stopPropagation();
|
|
485
491
|
(_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.
|
|
492
|
+
}, 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
493
|
backgroundColor: 'transparent',
|
|
488
494
|
opacity: 1,
|
|
489
495
|
}, '&:active': {
|
|
@@ -591,10 +597,11 @@ const getDefaultColumnOrderIds = (props) => [
|
|
|
591
597
|
const getDefaultColumnFilterFn = (columnDef) => {
|
|
592
598
|
if (columnDef.filterVariant === 'multi-select')
|
|
593
599
|
return 'arrIncludesSome';
|
|
594
|
-
if (columnDef.filterVariant === 'select')
|
|
595
|
-
return 'equals';
|
|
596
600
|
if (columnDef.filterVariant === 'range')
|
|
597
601
|
return 'betweenInclusive';
|
|
602
|
+
if (columnDef.filterVariant === 'select' ||
|
|
603
|
+
columnDef.filterVariant === 'checkbox')
|
|
604
|
+
return 'equals';
|
|
598
605
|
return 'fuzzy';
|
|
599
606
|
};
|
|
600
607
|
const getIsLastLeftPinnedColumn = (table, column) => {
|
|
@@ -610,7 +617,7 @@ const getTotalRight = (table, column) => {
|
|
|
610
617
|
const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
|
611
618
|
var _a, _b, _c, _d;
|
|
612
619
|
return (Object.assign(Object.assign({ backgroundColor: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
|
613
|
-
? alpha(lighten(theme.palette.background.default, 0.04), 0.
|
|
620
|
+
? alpha(lighten(theme.palette.background.default, 0.04), 0.97)
|
|
614
621
|
: 'inherit', backgroundImage: 'inherit', boxShadow: getIsLastLeftPinnedColumn(table, column)
|
|
615
622
|
? `-4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
616
623
|
: getIsFirstRightPinnedColumn(column)
|
|
@@ -624,10 +631,29 @@ const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, })
|
|
|
624
631
|
? 'sticky'
|
|
625
632
|
: undefined, right: column.getIsPinned() === 'right'
|
|
626
633
|
? `${getTotalRight(table, column)}px`
|
|
627
|
-
: undefined, transition: `all ${column.getIsResizing() ? 0 : '0.
|
|
634
|
+
: undefined, transition: `all ${column.getIsResizing() ? 0 : '0.1s'} ease-in-out` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
|
628
635
|
? tableCellProps.sx(theme)
|
|
629
636
|
: 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
637
|
};
|
|
638
|
+
const MRT_DefaultColumn = {
|
|
639
|
+
minSize: 40,
|
|
640
|
+
maxSize: 1000,
|
|
641
|
+
size: 180,
|
|
642
|
+
};
|
|
643
|
+
const MRT_DefaultDisplayColumn = {
|
|
644
|
+
columnDefType: 'display',
|
|
645
|
+
enableClickToCopy: false,
|
|
646
|
+
enableColumnActions: false,
|
|
647
|
+
enableColumnDragging: false,
|
|
648
|
+
enableColumnFilter: false,
|
|
649
|
+
enableColumnOrdering: false,
|
|
650
|
+
enableEditing: false,
|
|
651
|
+
enableGlobalFilter: false,
|
|
652
|
+
enableGrouping: false,
|
|
653
|
+
enableHiding: false,
|
|
654
|
+
enableResizing: false,
|
|
655
|
+
enableSorting: false,
|
|
656
|
+
};
|
|
631
657
|
|
|
632
658
|
const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, isSubMenu, table, }) => {
|
|
633
659
|
var _a;
|
|
@@ -979,7 +1005,7 @@ const commonIconButtonStyles = {
|
|
|
979
1005
|
height: '2rem',
|
|
980
1006
|
ml: '10px',
|
|
981
1007
|
opacity: 0.5,
|
|
982
|
-
transition: 'opacity 0.
|
|
1008
|
+
transition: 'opacity 0.1s',
|
|
983
1009
|
width: '2rem',
|
|
984
1010
|
'&:hover': {
|
|
985
1011
|
opacity: 1,
|
|
@@ -1022,15 +1048,24 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
|
|
1022
1048
|
return (React.createElement(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
1049
|
? localization.toggleSelectAll
|
|
1024
1050
|
: localization.toggleSelectRow) },
|
|
1025
|
-
React.createElement(Checkbox, Object.assign({ checked: selectAll
|
|
1051
|
+
React.createElement(Checkbox, Object.assign({ checked: selectAll
|
|
1052
|
+
? selectAllMode === 'page'
|
|
1053
|
+
? table.getIsAllPageRowsSelected()
|
|
1054
|
+
: table.getIsAllRowsSelected()
|
|
1055
|
+
: row === null || row === void 0 ? void 0 : row.getIsSelected(), indeterminate: selectAll
|
|
1056
|
+
? table.getIsSomeRowsSelected() &&
|
|
1057
|
+
!(selectAllMode === 'page'
|
|
1058
|
+
? table.getIsAllPageRowsSelected()
|
|
1059
|
+
: table.getIsAllRowsSelected())
|
|
1060
|
+
: row === null || row === void 0 ? void 0 : row.getIsSomeSelected(), inputProps: {
|
|
1026
1061
|
'aria-label': selectAll
|
|
1027
1062
|
? localization.toggleSelectAll
|
|
1028
1063
|
: localization.toggleSelectRow,
|
|
1029
|
-
}, onChange:
|
|
1030
|
-
?
|
|
1064
|
+
}, onChange: row
|
|
1065
|
+
? row.getToggleSelectedHandler()
|
|
1066
|
+
: selectAllMode === 'all'
|
|
1031
1067
|
? table.getToggleAllRowsSelectedHandler()
|
|
1032
|
-
: table.getToggleAllPageRowsSelectedHandler()
|
|
1033
|
-
: row.getToggleSelectedHandler(), size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
|
|
1068
|
+
: table.getToggleAllPageRowsSelectedHandler(), size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
|
|
1034
1069
|
var _a;
|
|
1035
1070
|
e.stopPropagation();
|
|
1036
1071
|
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
|
@@ -1043,6 +1078,9 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
|
1043
1078
|
var _a;
|
|
1044
1079
|
const { getState, setGlobalFilter, options: { enableGlobalFilterModes, icons: { SearchIcon, CloseIcon }, localization, muiSearchTextFieldProps, }, refs: { searchInputRef }, } = table;
|
|
1045
1080
|
const { globalFilter, showGlobalFilter } = getState();
|
|
1081
|
+
const textFieldProps = muiSearchTextFieldProps instanceof Function
|
|
1082
|
+
? muiSearchTextFieldProps({ table })
|
|
1083
|
+
: muiSearchTextFieldProps;
|
|
1046
1084
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
1047
1085
|
const [searchValue, setSearchValue] = useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
|
|
1048
1086
|
const handleChangeDebounced = useCallback(debounce((event) => {
|
|
@@ -1060,9 +1098,11 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
|
1060
1098
|
setSearchValue('');
|
|
1061
1099
|
setGlobalFilter(undefined);
|
|
1062
1100
|
};
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1101
|
+
useEffect(() => {
|
|
1102
|
+
if (globalFilter === undefined) {
|
|
1103
|
+
handleClear();
|
|
1104
|
+
}
|
|
1105
|
+
}, [globalFilter]);
|
|
1066
1106
|
return (React.createElement(Collapse, { in: showGlobalFilter, orientation: "horizontal", unmountOnExit: true, mountOnEnter: true },
|
|
1067
1107
|
React.createElement(TextField, Object.assign({ placeholder: localization.search, onChange: handleChange, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard", InputProps: {
|
|
1068
1108
|
startAdornment: enableGlobalFilterModes ? (React.createElement(InputAdornment, { position: "start" },
|
|
@@ -1098,8 +1138,8 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table }) => {
|
|
|
1098
1138
|
React.createElement(LinearProgress, Object.assign({ "aria-label": "Loading", "aria-busy": "true", sx: { position: 'relative' } }, linearProgressProps))));
|
|
1099
1139
|
};
|
|
1100
1140
|
|
|
1101
|
-
const MRT_TablePagination = ({ table, position }) => {
|
|
1102
|
-
const { getPrePaginationRowModel, getState, setPageIndex, setPageSize, options: { muiTablePaginationProps, enableToolbarInternalActions, rowCount, }, } = table;
|
|
1141
|
+
const MRT_TablePagination = ({ table, position, }) => {
|
|
1142
|
+
const { getPrePaginationRowModel, getState, setPageIndex, setPageSize, options: { muiTablePaginationProps, enableToolbarInternalActions, localization, rowCount, }, } = table;
|
|
1103
1143
|
const { pagination: { pageSize = 10, pageIndex = 0 }, showGlobalFilter, } = getState();
|
|
1104
1144
|
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
|
|
1105
1145
|
const showFirstLastPageButtons = totalRowCount / pageSize > 2;
|
|
@@ -1109,10 +1149,26 @@ const MRT_TablePagination = ({ table, position }) => {
|
|
|
1109
1149
|
const handleChangeRowsPerPage = (event) => {
|
|
1110
1150
|
setPageSize(+event.target.value);
|
|
1111
1151
|
};
|
|
1112
|
-
return (React.createElement(TablePagination, Object.assign({
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1152
|
+
return (React.createElement(TablePagination, Object.assign({ component: "div", count: totalRowCount, getItemAriaLabel: (type) => type === 'first'
|
|
1153
|
+
? localization.goToFirstPage
|
|
1154
|
+
: type === 'last'
|
|
1155
|
+
? localization.goToLastPage
|
|
1156
|
+
: type === 'next'
|
|
1157
|
+
? localization.goToNextPage
|
|
1158
|
+
: 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': {
|
|
1159
|
+
display: 'flex',
|
|
1160
|
+
alignItems: 'center',
|
|
1161
|
+
}, '& .MuiTablePagination-selectLabel': {
|
|
1162
|
+
m: '0 -1px',
|
|
1163
|
+
}, '&. MuiInputBase-root': {
|
|
1164
|
+
m: '0 1px',
|
|
1165
|
+
}, '& . MuiTablePagination-select': {
|
|
1166
|
+
m: '0 1px',
|
|
1167
|
+
}, '& .MuiTablePagination-displayedRows': {
|
|
1168
|
+
m: '0 1px',
|
|
1169
|
+
}, '& .MuiTablePagination-actions': {
|
|
1170
|
+
m: '0 1px',
|
|
1171
|
+
}, mt: position === 'top' &&
|
|
1116
1172
|
enableToolbarInternalActions &&
|
|
1117
1173
|
!showGlobalFilter
|
|
1118
1174
|
? '3.5rem'
|
|
@@ -1123,7 +1179,7 @@ const MRT_TablePagination = ({ table, position }) => {
|
|
|
1123
1179
|
|
|
1124
1180
|
const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
1125
1181
|
var _a, _b;
|
|
1126
|
-
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, positionToolbarAlertBanner, }, } = table;
|
|
1182
|
+
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, positionToolbarAlertBanner, rowCount, }, } = table;
|
|
1127
1183
|
const { grouping, showAlertBanner } = getState();
|
|
1128
1184
|
const alertProps = muiToolbarAlertBannerProps instanceof Function
|
|
1129
1185
|
? muiToolbarAlertBannerProps({ table })
|
|
@@ -1132,7 +1188,7 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
|
1132
1188
|
? muiToolbarAlertBannerChipProps({ table })
|
|
1133
1189
|
: muiToolbarAlertBannerChipProps;
|
|
1134
1190
|
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())
|
|
1191
|
+
? (_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
1192
|
: null;
|
|
1137
1193
|
const groupedByMessage = grouping.length > 0 ? (React.createElement("span", null,
|
|
1138
1194
|
localization.groupedBy,
|
|
@@ -1226,7 +1282,7 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
|
|
|
1226
1282
|
React.createElement(IconButton, Object.assign({ disabled: !!globalFilter, onClick: handleToggleSearch }, rest, { title: undefined }), showGlobalFilter ? React.createElement(SearchOffIcon, null) : React.createElement(SearchIcon, null))));
|
|
1227
1283
|
};
|
|
1228
1284
|
|
|
1229
|
-
const MRT_ToolbarInternalButtons = ({ table }) => {
|
|
1285
|
+
const MRT_ToolbarInternalButtons = ({ table, }) => {
|
|
1230
1286
|
var _a;
|
|
1231
1287
|
const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enablePinning, initialState, renderToolbarInternalActions, }, } = table;
|
|
1232
1288
|
return (React.createElement(Box, { sx: {
|
|
@@ -1274,10 +1330,11 @@ const commonToolbarStyles = ({ theme }) => ({
|
|
|
1274
1330
|
backgroundColor: lighten(theme.palette.background.default, 0.04),
|
|
1275
1331
|
backgroundImage: 'none',
|
|
1276
1332
|
display: 'grid',
|
|
1333
|
+
flexWrap: 'wrap-reverse',
|
|
1277
1334
|
minHeight: '3.5rem',
|
|
1278
1335
|
overflow: 'hidden',
|
|
1279
1336
|
p: '0 !important',
|
|
1280
|
-
transition: 'all 0.
|
|
1337
|
+
transition: 'all 0.1s ease-in-out',
|
|
1281
1338
|
zIndex: 1,
|
|
1282
1339
|
});
|
|
1283
1340
|
const MRT_TopToolbar = ({ table }) => {
|
|
@@ -1339,7 +1396,7 @@ const MRT_BottomToolbar = ({ table }) => {
|
|
|
1339
1396
|
// @ts-ignore
|
|
1340
1397
|
toolbarProps.ref.current = ref;
|
|
1341
1398
|
}
|
|
1342
|
-
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow:
|
|
1399
|
+
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `0 1px 2px -1px ${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
1400
|
? toolbarProps.sx(theme)
|
|
1344
1401
|
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
|
|
1345
1402
|
React.createElement(MRT_LinearProgressBar, { isTopToolbar: false, table: table }),
|
|
@@ -1387,7 +1444,7 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
|
1387
1444
|
const iconButtonProps = Object.assign(Object.assign({}, mTableHeadCellColumnActionsButtonProps), mcTableHeadCellColumnActionsButtonProps);
|
|
1388
1445
|
return (React.createElement(React.Fragment, null,
|
|
1389
1446
|
React.createElement(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.createElement(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.
|
|
1447
|
+
React.createElement(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
1448
|
opacity: 1,
|
|
1392
1449
|
} }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
|
1393
1450
|
? iconButtonProps.sx(theme)
|
|
@@ -1451,8 +1508,10 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1451
1508
|
});
|
|
1452
1509
|
const handleChangeDebounced = useCallback(debounce((event) => {
|
|
1453
1510
|
let value = textFieldProps.type === 'date'
|
|
1454
|
-
?
|
|
1455
|
-
:
|
|
1511
|
+
? event.target.valueAsDate
|
|
1512
|
+
: textFieldProps.type === 'number'
|
|
1513
|
+
? event.target.valueAsNumber
|
|
1514
|
+
: event.target.value;
|
|
1456
1515
|
if (isRangeFilter) {
|
|
1457
1516
|
column.setFilterValue((old) => {
|
|
1458
1517
|
const newFilterValues = old !== null && old !== void 0 ? old : ['', ''];
|
|
@@ -1494,8 +1553,13 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1494
1553
|
const handleFilterMenuOpen = (event) => {
|
|
1495
1554
|
setAnchorEl(event.currentTarget);
|
|
1496
1555
|
};
|
|
1556
|
+
useEffect(() => {
|
|
1557
|
+
if (column.getFilterValue() === undefined) {
|
|
1558
|
+
handleClear();
|
|
1559
|
+
}
|
|
1560
|
+
}, [column.getFilterValue()]);
|
|
1497
1561
|
if (columnDef.Filter) {
|
|
1498
|
-
return React.createElement(React.Fragment, null, (_e = columnDef.Filter) === null || _e === void 0 ? void 0 : _e.call(columnDef, { column, header, table }));
|
|
1562
|
+
return (React.createElement(React.Fragment, null, (_e = columnDef.Filter) === null || _e === void 0 ? void 0 : _e.call(columnDef, { column, header, rangeFilterIndex, table })));
|
|
1499
1563
|
}
|
|
1500
1564
|
return (React.createElement(React.Fragment, null,
|
|
1501
1565
|
React.createElement(TextField, Object.assign({ fullWidth: true, inputProps: {
|
|
@@ -1510,7 +1574,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1510
1574
|
localization[`filter${((_f = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _f === void 0 ? void 0 : _f.toUpperCase()) +
|
|
1511
1575
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]))) : null, FormHelperTextProps: {
|
|
1512
1576
|
sx: {
|
|
1513
|
-
fontSize: '0.
|
|
1577
|
+
fontSize: '0.75rem',
|
|
1514
1578
|
lineHeight: '0.8rem',
|
|
1515
1579
|
whiteSpace: 'nowrap',
|
|
1516
1580
|
},
|
|
@@ -1551,11 +1615,11 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1551
1615
|
if (textFieldProps.inputRef) {
|
|
1552
1616
|
textFieldProps.inputRef = inputRef;
|
|
1553
1617
|
}
|
|
1554
|
-
}, sx: (theme) => (Object.assign({ p: 0, minWidth:
|
|
1555
|
-
? '
|
|
1618
|
+
}, sx: (theme) => (Object.assign({ p: 0, minWidth: isRangeFilter
|
|
1619
|
+
? '100px'
|
|
1556
1620
|
: !filterChipLabel
|
|
1557
1621
|
? '120px'
|
|
1558
|
-
: 'auto', width: '100%', '&
|
|
1622
|
+
: 'auto', width: '100%', '& .MuiSelect-icon': {
|
|
1559
1623
|
mr: '1.5rem',
|
|
1560
1624
|
} }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
|
|
1561
1625
|
? textFieldProps.sx(theme)
|
|
@@ -1592,12 +1656,50 @@ const MRT_FilterRangeFields = ({ header, table }) => {
|
|
|
1592
1656
|
React.createElement(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })));
|
|
1593
1657
|
};
|
|
1594
1658
|
|
|
1659
|
+
const MRT_FilterCheckbox = ({ column, table }) => {
|
|
1660
|
+
var _a, _b, _c;
|
|
1661
|
+
const { getState, options: { localization, muiTableHeadCellFilterCheckboxProps }, } = table;
|
|
1662
|
+
const { density } = getState();
|
|
1663
|
+
const { columnDef } = column;
|
|
1664
|
+
const mTableHeadCellFilterCheckboxProps = muiTableHeadCellFilterCheckboxProps instanceof Function
|
|
1665
|
+
? muiTableHeadCellFilterCheckboxProps({
|
|
1666
|
+
column,
|
|
1667
|
+
table,
|
|
1668
|
+
})
|
|
1669
|
+
: muiTableHeadCellFilterCheckboxProps;
|
|
1670
|
+
const mcTableHeadCellFilterCheckboxProps = columnDef.muiTableHeadCellFilterCheckboxProps instanceof Function
|
|
1671
|
+
? columnDef.muiTableHeadCellFilterCheckboxProps({
|
|
1672
|
+
column,
|
|
1673
|
+
table,
|
|
1674
|
+
})
|
|
1675
|
+
: columnDef.muiTableHeadCellFilterCheckboxProps;
|
|
1676
|
+
const checkboxProps = Object.assign(Object.assign({}, mTableHeadCellFilterCheckboxProps), mcTableHeadCellFilterCheckboxProps);
|
|
1677
|
+
const filterLabel = (_a = localization.filterByColumn) === null || _a === void 0 ? void 0 : _a.replace('{column}', columnDef.header);
|
|
1678
|
+
return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : filterLabel },
|
|
1679
|
+
React.createElement(FormControlLabel, { control: React.createElement(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) => {
|
|
1680
|
+
var _a;
|
|
1681
|
+
e.stopPropagation();
|
|
1682
|
+
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
|
1683
|
+
}, onChange: (e, checked) => {
|
|
1684
|
+
var _a;
|
|
1685
|
+
column.setFilterValue(column.getFilterValue() === undefined
|
|
1686
|
+
? 'true'
|
|
1687
|
+
: column.getFilterValue() === 'true'
|
|
1688
|
+
? 'false'
|
|
1689
|
+
: undefined);
|
|
1690
|
+
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onChange) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e, checked);
|
|
1691
|
+
}, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, ((checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx) instanceof Function
|
|
1692
|
+
? checkboxProps.sx(theme)
|
|
1693
|
+
: checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx))) })), disableTypography: true, label: (_c = checkboxProps.title) !== null && _c !== void 0 ? _c : filterLabel, sx: { color: 'text.secondary', mt: '-4px', fontWeight: 'normal' }, title: undefined })));
|
|
1694
|
+
};
|
|
1695
|
+
|
|
1595
1696
|
const MRT_TableHeadCellFilterContainer = ({ header, table, }) => {
|
|
1596
1697
|
const { getState } = table;
|
|
1597
1698
|
const { showColumnFilters } = getState();
|
|
1598
1699
|
const { column } = header;
|
|
1599
1700
|
const { columnDef } = column;
|
|
1600
|
-
return (React.createElement(Collapse, { in: showColumnFilters, mountOnEnter: true, unmountOnExit: true },
|
|
1701
|
+
return (React.createElement(Collapse, { in: showColumnFilters, mountOnEnter: true, unmountOnExit: true }, columnDef.filterVariant === 'checkbox' ? (React.createElement(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range' ||
|
|
1702
|
+
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (React.createElement(MRT_FilterRangeFields, { header: header, table: table })) : (React.createElement(MRT_FilterTextField, { header: header, table: table }))));
|
|
1601
1703
|
};
|
|
1602
1704
|
|
|
1603
1705
|
const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
@@ -1686,7 +1788,7 @@ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
|
|
1686
1788
|
position: 'absolute',
|
|
1687
1789
|
right: '1px',
|
|
1688
1790
|
touchAction: 'none',
|
|
1689
|
-
transition: column.getIsResizing() ? undefined : 'all 0.
|
|
1791
|
+
transition: column.getIsResizing() ? undefined : 'all 0.1s ease-in-out',
|
|
1690
1792
|
userSelect: 'none',
|
|
1691
1793
|
zIndex: 4,
|
|
1692
1794
|
'&:active': {
|
|
@@ -1701,7 +1803,7 @@ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
|
|
1701
1803
|
} }));
|
|
1702
1804
|
};
|
|
1703
1805
|
|
|
1704
|
-
const MRT_TableHeadCellSortLabel = ({ header, table }) => {
|
|
1806
|
+
const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
|
|
1705
1807
|
const { options: { localization }, } = table;
|
|
1706
1808
|
const { column } = header;
|
|
1707
1809
|
const { columnDef } = column;
|
|
@@ -1715,7 +1817,9 @@ const MRT_TableHeadCellSortLabel = ({ header, table }) => {
|
|
|
1715
1817
|
? column.getIsSorted()
|
|
1716
1818
|
: undefined, sx: {
|
|
1717
1819
|
width: '2ch',
|
|
1718
|
-
transform:
|
|
1820
|
+
transform: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) !== 'right'
|
|
1821
|
+
? 'translateX(-0.5ch)'
|
|
1822
|
+
: undefined,
|
|
1719
1823
|
} })));
|
|
1720
1824
|
};
|
|
1721
1825
|
|
|
@@ -1792,8 +1896,9 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1792
1896
|
header.isPlaceholder ? null : (React.createElement(Box, { sx: {
|
|
1793
1897
|
alignItems: 'flex-start',
|
|
1794
1898
|
display: 'flex',
|
|
1899
|
+
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
|
1795
1900
|
justifyContent: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right'
|
|
1796
|
-
? 'flex-
|
|
1901
|
+
? 'flex-start'
|
|
1797
1902
|
: columnDefType === 'group' ||
|
|
1798
1903
|
(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
|
1799
1904
|
? 'center'
|
|
@@ -1807,6 +1912,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1807
1912
|
? 'pointer'
|
|
1808
1913
|
: undefined,
|
|
1809
1914
|
display: 'flex',
|
|
1915
|
+
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
|
1810
1916
|
flexWrap: 'nowrap',
|
|
1811
1917
|
m: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center' ? 'auto' : undefined,
|
|
1812
1918
|
pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center' && column.getCanSort()
|
|
@@ -1815,7 +1921,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1815
1921
|
whiteSpace: ((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) < 24 ? 'nowrap' : 'normal',
|
|
1816
1922
|
} },
|
|
1817
1923
|
headerElement,
|
|
1818
|
-
column.getCanSort() && (React.createElement(MRT_TableHeadCellSortLabel, { header: header, table: table })),
|
|
1924
|
+
column.getCanSort() && (React.createElement(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps })),
|
|
1819
1925
|
column.getCanFilter() && (React.createElement(MRT_TableHeadCellFilterLabel, { header: header, table: table }))),
|
|
1820
1926
|
columnDefType !== 'group' && (React.createElement(Box, { sx: { whiteSpace: 'nowrap' } },
|
|
1821
1927
|
enableColumnDragging !== false &&
|
|
@@ -1843,11 +1949,13 @@ const MRT_TableHeadRow = ({ headerGroup, table }) => {
|
|
|
1843
1949
|
};
|
|
1844
1950
|
|
|
1845
1951
|
const MRT_TableHead = ({ table }) => {
|
|
1846
|
-
const { getHeaderGroups, options: { muiTableHeadProps }, } = table;
|
|
1952
|
+
const { getHeaderGroups, options: { enableStickyHeader, muiTableHeadProps }, } = table;
|
|
1847
1953
|
const tableHeadProps = muiTableHeadProps instanceof Function
|
|
1848
1954
|
? muiTableHeadProps({ table })
|
|
1849
1955
|
: muiTableHeadProps;
|
|
1850
|
-
return (React.createElement(TableHead, Object.assign({}, tableHeadProps
|
|
1956
|
+
return (React.createElement(TableHead, Object.assign({}, tableHeadProps, { sx: (theme) => (Object.assign({ opacity: enableStickyHeader ? 0.97 : undefined }, ((tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx) instanceof Function
|
|
1957
|
+
? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
|
|
1958
|
+
: tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))) }), getHeaderGroups().map((headerGroup) => (React.createElement(MRT_TableHeadRow, { headerGroup: headerGroup, key: headerGroup.id, table: table })))));
|
|
1851
1959
|
};
|
|
1852
1960
|
|
|
1853
1961
|
const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
|
@@ -1999,7 +2107,7 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
1999
2107
|
? muiTableBodyCellProps({ cell, column, row, table })
|
|
2000
2108
|
: muiTableBodyCellProps;
|
|
2001
2109
|
const mcTableCellBodyProps = columnDef.muiTableBodyCellProps instanceof Function
|
|
2002
|
-
? columnDef.muiTableBodyCellProps({ cell, table })
|
|
2110
|
+
? columnDef.muiTableBodyCellProps({ cell, column, row, table })
|
|
2003
2111
|
: columnDef.muiTableBodyCellProps;
|
|
2004
2112
|
const tableCellProps = Object.assign(Object.assign({}, mTableCellBodyProps), mcTableCellBodyProps);
|
|
2005
2113
|
const skeletonProps = muiTableBodyCellSkeletonProps instanceof Function
|
|
@@ -2113,7 +2221,7 @@ const MRT_TableDetailPanel = ({ row, table }) => {
|
|
|
2113
2221
|
? muiTableDetailPanelProps({ row, table })
|
|
2114
2222
|
: muiTableDetailPanelProps;
|
|
2115
2223
|
return (React.createElement(TableRow, Object.assign({}, tableRowProps),
|
|
2116
|
-
React.createElement(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.
|
|
2224
|
+
React.createElement(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
|
|
2117
2225
|
? tableCellProps.sx(theme)
|
|
2118
2226
|
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (React.createElement(Collapse, { in: row.getIsExpanded() }, renderDetailPanel({ row, table }))))));
|
|
2119
2227
|
};
|
|
@@ -2148,7 +2256,7 @@ const MRT_TableBodyRow = ({ row, rowIndex, table, virtualRow, }) => {
|
|
|
2148
2256
|
if (virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.measureRef) {
|
|
2149
2257
|
virtualRow.measureRef = node;
|
|
2150
2258
|
}
|
|
2151
|
-
} }, tableRowProps, { sx: (theme) => (Object.assign(Object.assign({ backgroundColor: 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.
|
|
2259
|
+
} }, tableRowProps, { sx: (theme) => (Object.assign(Object.assign({ backgroundColor: 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': {
|
|
2152
2260
|
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false && getIsSomeColumnsPinned()
|
|
2153
2261
|
? theme.palette.mode === 'dark'
|
|
2154
2262
|
? `${lighten(theme.palette.background.default, 0.12)}`
|
|
@@ -2303,7 +2411,7 @@ const MRT_TableFooter = ({ table }) => {
|
|
|
2303
2411
|
? muiTableFooterProps({ table })
|
|
2304
2412
|
: muiTableFooterProps;
|
|
2305
2413
|
const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
|
|
2306
|
-
return (React.createElement(TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), bottom: stickFooter ? 0 : undefined, opacity: stickFooter ? 0.
|
|
2414
|
+
return (React.createElement(TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), bottom: stickFooter ? 0 : undefined, opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
|
|
2307
2415
|
? theme.palette.mode === 'light'
|
|
2308
2416
|
? `1px solid ${theme.palette.grey[300]}`
|
|
2309
2417
|
: `1px solid ${theme.palette.grey[700]}`
|
|
@@ -2361,7 +2469,6 @@ const MRT_TableContainer = ({ table }) => {
|
|
|
2361
2469
|
};
|
|
2362
2470
|
|
|
2363
2471
|
const MRT_TablePaper = ({ table }) => {
|
|
2364
|
-
var _a, _b;
|
|
2365
2472
|
const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
|
|
2366
2473
|
const { isFullScreen } = getState();
|
|
2367
2474
|
const tablePaperProps = muiTablePaperProps instanceof Function
|
|
@@ -2373,7 +2480,7 @@ const MRT_TablePaper = ({ table }) => {
|
|
|
2373
2480
|
//@ts-ignore
|
|
2374
2481
|
tablePaperProps.ref.current = ref;
|
|
2375
2482
|
}
|
|
2376
|
-
}, sx: (theme) => (Object.assign({ transition: 'all 0.
|
|
2483
|
+
}, sx: (theme) => (Object.assign({ transition: 'all 0.1s ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
|
|
2377
2484
|
? tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx(theme)
|
|
2378
2485
|
: tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), (isFullScreen
|
|
2379
2486
|
? {
|
|
@@ -2384,8 +2491,16 @@ const MRT_TablePaper = ({ table }) => {
|
|
|
2384
2491
|
padding: 0,
|
|
2385
2492
|
width: '100vw',
|
|
2386
2493
|
}
|
|
2387
|
-
: {})) }),
|
|
2388
|
-
|
|
2494
|
+
: {})) }),
|
|
2495
|
+
enableTopToolbar &&
|
|
2496
|
+
(renderTopToolbar instanceof Function
|
|
2497
|
+
? renderTopToolbar({ table })
|
|
2498
|
+
: renderTopToolbar !== null && renderTopToolbar !== void 0 ? renderTopToolbar : React.createElement(MRT_TopToolbar, { table: table })),
|
|
2499
|
+
React.createElement(MRT_TableContainer, { table: table }),
|
|
2500
|
+
enableBottomToolbar &&
|
|
2501
|
+
(renderBottomToolbar instanceof Function
|
|
2502
|
+
? renderBottomToolbar({ table })
|
|
2503
|
+
: renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : React.createElement(MRT_BottomToolbar, { table: table }))));
|
|
2389
2504
|
};
|
|
2390
2505
|
|
|
2391
2506
|
const MRT_EditRowModal = ({ open, row, table, }) => {
|
|
@@ -2395,9 +2510,10 @@ const MRT_EditRowModal = ({ open, row, table, }) => {
|
|
|
2395
2510
|
React.createElement(DialogContent, null,
|
|
2396
2511
|
React.createElement("form", { onSubmit: (e) => e.preventDefault() },
|
|
2397
2512
|
React.createElement(Stack, { sx: {
|
|
2398
|
-
width: '100%',
|
|
2399
|
-
minWidth: { xs: '300px', sm: '360px', md: '400px' },
|
|
2400
2513
|
gap: '1.5rem',
|
|
2514
|
+
minWidth: { xs: '300px', sm: '360px', md: '400px' },
|
|
2515
|
+
pt: '1rem',
|
|
2516
|
+
width: '100%',
|
|
2401
2517
|
} }, row
|
|
2402
2518
|
.getAllCells()
|
|
2403
2519
|
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
|
@@ -2449,14 +2565,14 @@ const MRT_TableRoot = (props) => {
|
|
|
2449
2565
|
const [showColumnFilters, setShowFilters] = useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _p !== void 0 ? _p : false);
|
|
2450
2566
|
const [showGlobalFilter, setShowGlobalFilter] = useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _q !== void 0 ? _q : false);
|
|
2451
2567
|
const displayColumns = useMemo(() => {
|
|
2452
|
-
var _a, _b, _c, _d, _e
|
|
2568
|
+
var _a, _b, _c, _d, _e;
|
|
2453
2569
|
return [
|
|
2454
|
-
columnOrder.includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header:
|
|
2455
|
-
columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (React.createElement(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header:
|
|
2570
|
+
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' }),
|
|
2571
|
+
columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (React.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' }),
|
|
2456
2572
|
columnOrder.includes('mrt-row-expand') &&
|
|
2457
|
-
showExpandColumn(props, grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_ExpandButton, { row: row, table: table })), Header: () => props.enableExpandAll ? (React.createElement(MRT_ExpandAllButton, { table: table })) : null, header:
|
|
2458
|
-
columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_SelectCheckbox, { row: row, table: table })), Header: () => props.enableSelectAll ? (React.createElement(MRT_SelectCheckbox, { selectAll: true, table: table })) : null, header:
|
|
2459
|
-
columnOrder.includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () =>
|
|
2573
|
+
showExpandColumn(props, grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_ExpandButton, { row: row, table: table })), Header: () => props.enableExpandAll ? (React.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' }),
|
|
2574
|
+
columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_SelectCheckbox, { row: row, table: table })), Header: () => props.enableSelectAll ? (React.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' }),
|
|
2575
|
+
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' }),
|
|
2460
2576
|
].filter(Boolean);
|
|
2461
2577
|
}, [
|
|
2462
2578
|
columnOrder,
|
|
@@ -2563,10 +2679,17 @@ const MRT_TableRoot = (props) => {
|
|
|
2563
2679
|
editingRow && props.editingMode === 'modal' && (React.createElement(MRT_EditRowModal, { row: editingRow, table: table, open: true }))));
|
|
2564
2680
|
};
|
|
2565
2681
|
|
|
2566
|
-
|
|
2567
|
-
var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onEnd', defaultColumn
|
|
2568
|
-
|
|
2682
|
+
const MaterialReactTable = (_a) => {
|
|
2683
|
+
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"]);
|
|
2684
|
+
const _icons = useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), []);
|
|
2685
|
+
const _localization = useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), []);
|
|
2686
|
+
const _aggregationFns = useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
|
|
2687
|
+
const _filterFns = useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
|
|
2688
|
+
const _sortingFns = useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
|
|
2689
|
+
const _defaultColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), []);
|
|
2690
|
+
const _defaultDisplayColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), []);
|
|
2691
|
+
return (React.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)));
|
|
2569
2692
|
};
|
|
2570
2693
|
|
|
2571
|
-
export { MRT_CopyButton, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MaterialReactTable as default };
|
|
2694
|
+
export { MRT_CopyButton, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_TablePagination, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MRT_ToolbarInternalButtons, MaterialReactTable as default };
|
|
2572
2695
|
//# sourceMappingURL=material-react-table.esm.js.map
|