material-react-table 1.11.3 → 1.11.5
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/index.js +590 -817
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/MaterialReactTable.d.ts +4 -5
- package/dist/cjs/types/_locales/hu.d.ts +2 -0
- package/dist/cjs/types/body/MRT_EditRowModal.d.ts +1 -2
- package/dist/cjs/types/body/MRT_TableBody.d.ts +3 -3
- package/dist/cjs/types/body/MRT_TableBodyCell.d.ts +3 -3
- package/dist/cjs/types/body/MRT_TableBodyCellValue.d.ts +1 -2
- package/dist/cjs/types/body/MRT_TableBodyRow.d.ts +3 -3
- package/dist/cjs/types/body/MRT_TableBodyRowGrabHandle.d.ts +1 -1
- package/dist/cjs/types/body/MRT_TableDetailPanel.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_ColumnPinningButtons.d.ts +1 -2
- package/dist/cjs/types/buttons/MRT_CopyButton.d.ts +1 -1
- package/dist/cjs/types/buttons/MRT_EditActionButtons.d.ts +1 -2
- package/dist/cjs/types/buttons/MRT_ExpandAllButton.d.ts +1 -2
- package/dist/cjs/types/buttons/MRT_ExpandButton.d.ts +1 -2
- package/dist/cjs/types/buttons/MRT_FullScreenToggleButton.d.ts +1 -2
- package/dist/cjs/types/buttons/MRT_GrabHandleButton.d.ts +1 -1
- package/dist/cjs/types/buttons/MRT_ShowHideColumnsButton.d.ts +1 -2
- package/dist/cjs/types/buttons/MRT_ToggleDensePaddingButton.d.ts +1 -2
- package/dist/cjs/types/buttons/MRT_ToggleFiltersButton.d.ts +1 -2
- package/dist/cjs/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +1 -2
- package/dist/cjs/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +1 -2
- package/dist/cjs/types/footer/MRT_TableFooter.d.ts +1 -2
- package/dist/cjs/types/footer/MRT_TableFooterCell.d.ts +1 -2
- package/dist/cjs/types/footer/MRT_TableFooterRow.d.ts +1 -2
- package/dist/cjs/types/head/MRT_TableHead.d.ts +1 -2
- package/dist/cjs/types/head/MRT_TableHeadCell.d.ts +1 -2
- package/dist/cjs/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +1 -2
- package/dist/cjs/types/head/MRT_TableHeadCellFilterContainer.d.ts +1 -2
- package/dist/cjs/types/head/MRT_TableHeadCellFilterLabel.d.ts +1 -2
- package/dist/cjs/types/head/MRT_TableHeadCellGrabHandle.d.ts +1 -1
- package/dist/cjs/types/head/MRT_TableHeadCellResizeHandle.d.ts +1 -2
- package/dist/cjs/types/head/MRT_TableHeadCellSortLabel.d.ts +1 -2
- package/dist/cjs/types/head/MRT_TableHeadRow.d.ts +1 -2
- package/dist/cjs/types/index.d.ts +3 -2
- package/dist/cjs/types/inputs/MRT_EditCellTextField.d.ts +1 -2
- package/dist/cjs/types/inputs/MRT_FilterCheckbox.d.ts +1 -2
- package/dist/cjs/types/inputs/MRT_FilterRangeFields.d.ts +1 -2
- package/dist/cjs/types/inputs/MRT_FilterTextField.d.ts +1 -2
- package/dist/cjs/types/inputs/MRT_GlobalFilterTextField.d.ts +1 -2
- package/dist/cjs/types/inputs/MRT_SelectCheckbox.d.ts +1 -2
- package/dist/cjs/types/menus/MRT_ColumnActionMenu.d.ts +1 -2
- package/dist/cjs/types/menus/MRT_FilterOptionMenu.d.ts +1 -2
- package/dist/cjs/types/menus/MRT_RowActionMenu.d.ts +1 -1
- package/dist/cjs/types/menus/MRT_ShowHideColumnsMenu.d.ts +1 -2
- package/dist/cjs/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +1 -1
- package/dist/cjs/types/table/MRT_Table.d.ts +1 -2
- package/dist/cjs/types/table/MRT_TableContainer.d.ts +1 -2
- package/dist/cjs/types/table/MRT_TablePaper.d.ts +1 -2
- package/dist/cjs/types/toolbar/MRT_BottomToolbar.d.ts +1 -2
- package/dist/cjs/types/toolbar/MRT_LinearProgressBar.d.ts +1 -2
- package/dist/cjs/types/toolbar/MRT_TablePagination.d.ts +1 -2
- package/dist/cjs/types/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -2
- package/dist/cjs/types/toolbar/MRT_ToolbarDropZone.d.ts +1 -2
- package/dist/cjs/types/toolbar/MRT_ToolbarInternalButtons.d.ts +1 -2
- package/dist/cjs/types/toolbar/MRT_TopToolbar.d.ts +1 -2
- package/dist/esm/material-react-table.esm.js +511 -738
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/MaterialReactTable.d.ts +4 -5
- package/dist/esm/types/_locales/hu.d.ts +2 -0
- package/dist/esm/types/body/MRT_EditRowModal.d.ts +1 -2
- package/dist/esm/types/body/MRT_TableBody.d.ts +3 -3
- package/dist/esm/types/body/MRT_TableBodyCell.d.ts +3 -3
- package/dist/esm/types/body/MRT_TableBodyCellValue.d.ts +1 -2
- package/dist/esm/types/body/MRT_TableBodyRow.d.ts +3 -3
- package/dist/esm/types/body/MRT_TableBodyRowGrabHandle.d.ts +1 -1
- package/dist/esm/types/body/MRT_TableDetailPanel.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_ColumnPinningButtons.d.ts +1 -2
- package/dist/esm/types/buttons/MRT_CopyButton.d.ts +1 -1
- package/dist/esm/types/buttons/MRT_EditActionButtons.d.ts +1 -2
- package/dist/esm/types/buttons/MRT_ExpandAllButton.d.ts +1 -2
- package/dist/esm/types/buttons/MRT_ExpandButton.d.ts +1 -2
- package/dist/esm/types/buttons/MRT_FullScreenToggleButton.d.ts +1 -2
- package/dist/esm/types/buttons/MRT_GrabHandleButton.d.ts +1 -1
- package/dist/esm/types/buttons/MRT_ShowHideColumnsButton.d.ts +1 -2
- package/dist/esm/types/buttons/MRT_ToggleDensePaddingButton.d.ts +1 -2
- package/dist/esm/types/buttons/MRT_ToggleFiltersButton.d.ts +1 -2
- package/dist/esm/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +1 -2
- package/dist/esm/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +1 -2
- package/dist/esm/types/footer/MRT_TableFooter.d.ts +1 -2
- package/dist/esm/types/footer/MRT_TableFooterCell.d.ts +1 -2
- package/dist/esm/types/footer/MRT_TableFooterRow.d.ts +1 -2
- package/dist/esm/types/head/MRT_TableHead.d.ts +1 -2
- package/dist/esm/types/head/MRT_TableHeadCell.d.ts +1 -2
- package/dist/esm/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +1 -2
- package/dist/esm/types/head/MRT_TableHeadCellFilterContainer.d.ts +1 -2
- package/dist/esm/types/head/MRT_TableHeadCellFilterLabel.d.ts +1 -2
- package/dist/esm/types/head/MRT_TableHeadCellGrabHandle.d.ts +1 -1
- package/dist/esm/types/head/MRT_TableHeadCellResizeHandle.d.ts +1 -2
- package/dist/esm/types/head/MRT_TableHeadCellSortLabel.d.ts +1 -2
- package/dist/esm/types/head/MRT_TableHeadRow.d.ts +1 -2
- package/dist/esm/types/index.d.ts +3 -2
- package/dist/esm/types/inputs/MRT_EditCellTextField.d.ts +1 -2
- package/dist/esm/types/inputs/MRT_FilterCheckbox.d.ts +1 -2
- package/dist/esm/types/inputs/MRT_FilterRangeFields.d.ts +1 -2
- package/dist/esm/types/inputs/MRT_FilterTextField.d.ts +1 -2
- package/dist/esm/types/inputs/MRT_GlobalFilterTextField.d.ts +1 -2
- package/dist/esm/types/inputs/MRT_SelectCheckbox.d.ts +1 -2
- package/dist/esm/types/menus/MRT_ColumnActionMenu.d.ts +1 -2
- package/dist/esm/types/menus/MRT_FilterOptionMenu.d.ts +1 -2
- package/dist/esm/types/menus/MRT_RowActionMenu.d.ts +1 -1
- package/dist/esm/types/menus/MRT_ShowHideColumnsMenu.d.ts +1 -2
- package/dist/esm/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +1 -1
- package/dist/esm/types/table/MRT_Table.d.ts +1 -2
- package/dist/esm/types/table/MRT_TableContainer.d.ts +1 -2
- package/dist/esm/types/table/MRT_TablePaper.d.ts +1 -2
- package/dist/esm/types/toolbar/MRT_BottomToolbar.d.ts +1 -2
- package/dist/esm/types/toolbar/MRT_LinearProgressBar.d.ts +1 -2
- package/dist/esm/types/toolbar/MRT_TablePagination.d.ts +1 -2
- package/dist/esm/types/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -2
- package/dist/esm/types/toolbar/MRT_ToolbarDropZone.d.ts +1 -2
- package/dist/esm/types/toolbar/MRT_ToolbarInternalButtons.d.ts +1 -2
- package/dist/esm/types/toolbar/MRT_TopToolbar.d.ts +1 -2
- package/dist/index.d.ts +39 -34
- package/locales/cs.esm.js +91 -89
- package/locales/cs.js +91 -89
- package/locales/da.esm.js +90 -89
- package/locales/da.js +90 -89
- package/locales/de.esm.js +90 -89
- package/locales/de.js +90 -89
- package/locales/en.esm.js +90 -89
- package/locales/en.js +90 -89
- package/locales/es.esm.js +90 -89
- package/locales/es.js +90 -89
- package/locales/fa.esm.js +90 -89
- package/locales/fa.js +90 -89
- package/locales/fi.esm.js +91 -89
- package/locales/fi.js +91 -89
- package/locales/fr.esm.js +90 -89
- package/locales/fr.js +90 -89
- package/locales/hu.d.ts +2 -0
- package/locales/hu.esm.d.ts +2 -0
- package/locales/hu.esm.js +95 -0
- package/locales/hu.esm.js.map +1 -0
- package/locales/hu.js +99 -0
- package/locales/hu.js.map +1 -0
- package/locales/id.esm.js +91 -89
- package/locales/id.js +91 -89
- package/locales/it.esm.js +90 -89
- package/locales/it.js +90 -89
- package/locales/ja.esm.js +90 -89
- package/locales/ja.js +90 -89
- package/locales/nl.esm.js +90 -89
- package/locales/nl.js +90 -89
- package/locales/pl.esm.js +90 -89
- package/locales/pl.js +90 -89
- package/locales/pt-BR.esm.js +90 -89
- package/locales/pt-BR.js +90 -89
- package/locales/pt.esm.js +90 -89
- package/locales/pt.js +90 -89
- package/locales/ro.esm.js +90 -89
- package/locales/ro.js +90 -89
- package/locales/ru.esm.js +90 -89
- package/locales/ru.js +90 -89
- package/locales/sk.esm.js +91 -89
- package/locales/sk.js +91 -89
- package/locales/sr-Cyrl-RS.esm.js +90 -89
- package/locales/sr-Cyrl-RS.js +90 -89
- package/locales/sr-Latn-RS.esm.js +90 -89
- package/locales/sr-Latn-RS.js +90 -89
- package/locales/sv.esm.js +90 -89
- package/locales/sv.js +90 -89
- package/locales/tr.esm.js +90 -89
- package/locales/tr.js +90 -89
- package/locales/uk.esm.js +90 -89
- package/locales/uk.js +90 -89
- package/locales/vi.esm.js +90 -89
- package/locales/vi.js +90 -89
- package/locales/zh-Hans.esm.js +89 -89
- package/locales/zh-Hans.js +89 -89
- package/locales/zh-Hant.esm.js +89 -89
- package/locales/zh-Hant.js +89 -89
- package/package.json +33 -15
- package/src/MaterialReactTable.tsx +5 -5
- package/src/_locales/hu.ts +94 -0
- package/src/body/MRT_EditRowModal.tsx +0 -1
- package/src/body/MRT_TableBody.tsx +6 -1
- package/src/body/MRT_TableBodyCell.tsx +1 -1
- package/src/body/MRT_TableBodyCellValue.tsx +1 -1
- package/src/body/MRT_TableBodyRow.tsx +1 -1
- package/src/body/MRT_TableBodyRowGrabHandle.tsx +1 -1
- package/src/body/MRT_TableDetailPanel.tsx +1 -1
- package/src/buttons/MRT_ColumnPinningButtons.tsx +0 -1
- package/src/buttons/MRT_CopyButton.tsx +1 -1
- package/src/buttons/MRT_EditActionButtons.tsx +0 -1
- package/src/buttons/MRT_ExpandAllButton.tsx +0 -1
- package/src/buttons/MRT_ExpandButton.tsx +1 -1
- package/src/buttons/MRT_FullScreenToggleButton.tsx +0 -1
- package/src/buttons/MRT_GrabHandleButton.tsx +1 -1
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +1 -1
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +0 -1
- package/src/buttons/MRT_ToggleFiltersButton.tsx +0 -1
- package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +0 -1
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +1 -1
- package/src/column.utils.ts +9 -7
- package/src/footer/MRT_TableFooter.tsx +0 -1
- package/src/footer/MRT_TableFooterCell.tsx +0 -1
- package/src/footer/MRT_TableFooterRow.tsx +0 -1
- package/src/head/MRT_TableHead.tsx +0 -1
- package/src/head/MRT_TableHeadCell.tsx +1 -1
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +1 -1
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +0 -1
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +1 -1
- package/src/head/MRT_TableHeadCellGrabHandle.tsx +1 -1
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +0 -1
- package/src/head/MRT_TableHeadCellSortLabel.tsx +0 -1
- package/src/head/MRT_TableHeadRow.tsx +0 -1
- package/src/index.tsx +4 -2
- package/src/inputs/MRT_EditCellTextField.tsx +1 -1
- package/src/inputs/MRT_FilterCheckbox.tsx +0 -1
- package/src/inputs/MRT_FilterRangeFields.tsx +0 -1
- package/src/inputs/MRT_FilterTextField.tsx +1 -1
- package/src/inputs/MRT_GlobalFilterTextField.tsx +1 -1
- package/src/inputs/MRT_SelectCheckbox.tsx +1 -1
- package/src/menus/MRT_ColumnActionMenu.tsx +21 -16
- package/src/menus/MRT_FilterOptionMenu.tsx +1 -1
- package/src/menus/MRT_RowActionMenu.tsx +1 -1
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +1 -1
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +1 -7
- package/src/table/MRT_Table.tsx +1 -1
- package/src/table/MRT_TableContainer.tsx +1 -1
- package/src/table/MRT_TablePaper.tsx +0 -1
- package/src/table/MRT_TableRoot.tsx +16 -16
- package/src/toolbar/MRT_BottomToolbar.tsx +0 -1
- package/src/toolbar/MRT_LinearProgressBar.tsx +0 -1
- package/src/toolbar/MRT_TablePagination.tsx +1 -1
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +1 -1
- package/src/toolbar/MRT_ToolbarDropZone.tsx +1 -1
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +0 -1
- package/src/toolbar/MRT_TopToolbar.tsx +0 -1
package/dist/cjs/index.js
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
6
|
+
var react = require('react');
|
6
7
|
var reactTable = require('@tanstack/react-table');
|
7
8
|
var styles = require('@mui/material/styles');
|
8
9
|
var matchSorterUtils = require('@tanstack/match-sorter-utils');
|
@@ -81,7 +82,6 @@ var Stack = require('@mui/material/Stack');
|
|
81
82
|
|
82
83
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
83
84
|
|
84
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
85
85
|
var ArrowDownwardIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowDownwardIcon);
|
86
86
|
var ArrowRightIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowRightIcon);
|
87
87
|
var CancelIcon__default = /*#__PURE__*/_interopDefaultLegacy(CancelIcon);
|
@@ -245,8 +245,9 @@ const reorderColumn = (draggedColumn, targetColumn, columnOrder) => {
|
|
245
245
|
if (draggedColumn.getCanPin()) {
|
246
246
|
draggedColumn.pin(targetColumn.getIsPinned());
|
247
247
|
}
|
248
|
-
|
249
|
-
|
248
|
+
let newColumnOrder = [...columnOrder];
|
249
|
+
newColumnOrder.splice(newColumnOrder.indexOf(targetColumn.id), 0, newColumnOrder.splice(newColumnOrder.indexOf(draggedColumn.id), 1)[0]);
|
250
|
+
return newColumnOrder;
|
250
251
|
};
|
251
252
|
const showExpandColumn = (props, grouping) => !!(props.enableExpanding ||
|
252
253
|
(props.enableGrouping && (grouping === undefined || (grouping === null || grouping === void 0 ? void 0 : grouping.length))) ||
|
@@ -314,7 +315,10 @@ const getIsFirstRightPinnedColumn = (column) => {
|
|
314
315
|
return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
|
315
316
|
};
|
316
317
|
const getTotalRight = (table, column) => {
|
317
|
-
return
|
318
|
+
return table
|
319
|
+
.getRightLeafHeaders()
|
320
|
+
.slice(column.getPinnedIndex() + 1)
|
321
|
+
.reduce((acc, col) => acc + col.getSize(), 0);
|
318
322
|
};
|
319
323
|
const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
320
324
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
@@ -515,16 +519,14 @@ const MRT_ExpandAllButton = ({ table }) => {
|
|
515
519
|
? muiExpandAllButtonProps({ table })
|
516
520
|
: muiExpandAllButtonProps;
|
517
521
|
const isAllRowsExpanded = getIsAllRowsExpanded();
|
518
|
-
return (
|
522
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: ((_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : isAllRowsExpanded)
|
519
523
|
? localization.collapseAll
|
520
|
-
: localization.expandAll },
|
521
|
-
React__default["default"].createElement("span", null,
|
522
|
-
React__default["default"].createElement(IconButton__default["default"], Object.assign({ "aria-label": localization.expandAll, disabled: isLoading || (!renderDetailPanel && !getCanSomeRowsExpand()), onClick: () => toggleAllRowsExpanded(!isAllRowsExpanded) }, iconButtonProps, { sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem', mt: density !== 'compact' ? '-0.25rem' : undefined }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
524
|
+
: localization.expandAll }, { children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.expandAll, disabled: isLoading || (!renderDetailPanel && !getCanSomeRowsExpand()), onClick: () => toggleAllRowsExpanded(!isAllRowsExpanded) }, iconButtonProps, { sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem', mt: density !== 'compact' ? '-0.25rem' : undefined }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
523
525
|
? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
|
524
|
-
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }
|
525
|
-
|
526
|
-
|
527
|
-
|
526
|
+
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }, { children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(KeyboardDoubleArrowDownIcon, { style: {
|
527
|
+
transform: `rotate(${isAllRowsExpanded ? -180 : getIsSomeRowsExpanded() ? -90 : 0}deg)`,
|
528
|
+
transition: 'transform 150ms',
|
529
|
+
} })) })) }) })));
|
528
530
|
};
|
529
531
|
|
530
532
|
const MRT_ExpandButton = ({ row, table, }) => {
|
@@ -542,16 +544,14 @@ const MRT_ExpandButton = ({ row, table, }) => {
|
|
542
544
|
row.toggleExpanded();
|
543
545
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
544
546
|
};
|
545
|
-
return (
|
547
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, disableHoverListener: !canExpand && !renderDetailPanel, enterDelay: 1000, enterNextDelay: 1000, title: ((_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : isExpanded)
|
546
548
|
? localization.collapse
|
547
|
-
: localization.expand },
|
548
|
-
React__default["default"].createElement("span", null,
|
549
|
-
React__default["default"].createElement(IconButton__default["default"], Object.assign({ "aria-label": localization.expand, disabled: !canExpand && !renderDetailPanel }, iconButtonProps, { onClick: handleToggleExpand, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem' }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
549
|
+
: localization.expand }, { children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.expand, disabled: !canExpand && !renderDetailPanel }, iconButtonProps, { onClick: handleToggleExpand, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem' }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
550
550
|
? iconButtonProps.sx(theme)
|
551
|
-
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }
|
552
|
-
|
553
|
-
|
554
|
-
|
551
|
+
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }, { children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(ExpandMoreIcon, { style: {
|
552
|
+
transform: `rotate(${!canExpand && !renderDetailPanel ? -90 : isExpanded ? -180 : 0}deg)`,
|
553
|
+
transition: 'transform 150ms',
|
554
|
+
} })) })) }) })));
|
555
555
|
};
|
556
556
|
|
557
557
|
const mrtFilterOptions = (localization) => [
|
@@ -651,7 +651,7 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
|
|
651
651
|
const { columnDef } = column !== null && column !== void 0 ? column : {};
|
652
652
|
const currentFilterValue = column === null || column === void 0 ? void 0 : column.getFilterValue();
|
653
653
|
const allowedColumnFilterOptions = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _a !== void 0 ? _a : columnFilterModeOptions;
|
654
|
-
const internalFilterOptions =
|
654
|
+
const internalFilterOptions = react.useMemo(() => mrtFilterOptions(localization).filter((filterOption) => columnDef
|
655
655
|
? allowedColumnFilterOptions === undefined ||
|
656
656
|
(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.includes(filterOption.option))
|
657
657
|
: (!globalFilterModeOptions ||
|
@@ -718,33 +718,31 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
|
|
718
718
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
719
719
|
};
|
720
720
|
const filterOption = !!header && columnDef ? columnDef._filterFn : globalFilterFn;
|
721
|
-
return (
|
721
|
+
return (jsxRuntime.jsx(Menu__default["default"], Object.assign({ anchorEl: anchorEl, anchorOrigin: { vertical: 'center', horizontal: 'right' }, onClose: () => setAnchorEl(null), open: !!anchorEl, MenuListProps: {
|
722
722
|
dense: density === 'compact',
|
723
|
-
} }, (_d = (header && column && columnDef
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
React__default["default"].createElement(Box__default["default"], { sx: { fontSize: '1.25rem', width: '2ch' } }, symbol),
|
747
|
-
label)))));
|
723
|
+
} }, { children: (_d = (header && column && columnDef
|
724
|
+
? (_c = (_b = columnDef.renderColumnFilterModeMenuItems) === null || _b === void 0 ? void 0 : _b.call(columnDef, {
|
725
|
+
column: column,
|
726
|
+
internalFilterOptions,
|
727
|
+
onSelectFilterMode: handleSelectFilterMode,
|
728
|
+
table,
|
729
|
+
})) !== null && _c !== void 0 ? _c : renderColumnFilterModeMenuItems === null || renderColumnFilterModeMenuItems === void 0 ? void 0 : renderColumnFilterModeMenuItems({
|
730
|
+
column: column,
|
731
|
+
internalFilterOptions,
|
732
|
+
onSelectFilterMode: handleSelectFilterMode,
|
733
|
+
table,
|
734
|
+
})
|
735
|
+
: renderGlobalFilterModeMenuItems === null || renderGlobalFilterModeMenuItems === void 0 ? void 0 : renderGlobalFilterModeMenuItems({
|
736
|
+
internalFilterOptions,
|
737
|
+
onSelectFilterMode: handleSelectFilterMode,
|
738
|
+
table,
|
739
|
+
}))) !== null && _d !== void 0 ? _d : internalFilterOptions.map(({ option, label, divider, symbol }, index) => (jsxRuntime.jsxs(MenuItem__default["default"], Object.assign({ divider: divider, onClick: () => handleSelectFilterMode(option), selected: option === filterOption, sx: {
|
740
|
+
alignItems: 'center',
|
741
|
+
display: 'flex',
|
742
|
+
gap: '2ch',
|
743
|
+
my: 0,
|
744
|
+
py: '6px',
|
745
|
+
}, value: option }, { children: [jsxRuntime.jsx(Box__default["default"], Object.assign({ sx: { fontSize: '1.25rem', width: '2ch' } }, { children: symbol })), label] }), index))) })));
|
748
746
|
};
|
749
747
|
|
750
748
|
const commonMenuItemStyles = {
|
@@ -759,11 +757,11 @@ const commonListItemStyles = {
|
|
759
757
|
};
|
760
758
|
const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
761
759
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
762
|
-
const { getState, toggleAllColumnsVisible, setColumnOrder, options: { columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnResizing, enableGrouping, enableHiding, enablePinning, enableSorting, icons: { ArrowRightIcon, ClearAllIcon, ViewColumnIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, SortIcon, RestartAltIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnSizingInfo, setShowColumnFilters, } = table;
|
760
|
+
const { getState, toggleAllColumnsVisible, setColumnOrder, options: { columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnResizing, enableGrouping, enableHiding, enablePinning, enableSorting, enableSortingRemoval, icons: { ArrowRightIcon, ClearAllIcon, ViewColumnIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, SortIcon, RestartAltIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnSizingInfo, setShowColumnFilters, } = table;
|
763
761
|
const { column } = header;
|
764
762
|
const { columnDef } = column;
|
765
763
|
const { columnSizing, columnVisibility, density, showColumnFilters } = getState();
|
766
|
-
const [filterMenuAnchorEl, setFilterMenuAnchorEl] =
|
764
|
+
const [filterMenuAnchorEl, setFilterMenuAnchorEl] = react.useState(null);
|
767
765
|
const handleClearSort = () => {
|
768
766
|
column.clearSorting();
|
769
767
|
setAnchorEl(null);
|
@@ -818,120 +816,60 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
818
816
|
!isSelectFilter &&
|
819
817
|
(allowedColumnFilterOptions === undefined ||
|
820
818
|
!!(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.length));
|
821
|
-
return (
|
819
|
+
return (jsxRuntime.jsxs(Menu__default["default"], Object.assign({ anchorEl: anchorEl, open: !!anchorEl, onClose: () => setAnchorEl(null), MenuListProps: {
|
822
820
|
dense: density === 'compact',
|
823
|
-
} }, (_d = (_c = (_b = columnDef.renderColumnActionsMenuItems) === null || _b === void 0 ? void 0 : _b.call(columnDef, {
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
:
|
860
|
-
|
861
|
-
React__default["default"].createElement(ListItemIcon__default["default"], null,
|
862
|
-
React__default["default"].createElement(FilterListIcon, null)), (_g = localization.filterByColumn) === null || _g === void 0 ? void 0 :
|
863
|
-
_g.replace('{column}', String(columnDef.header))),
|
864
|
-
showFilterModeSubMenu && (React__default["default"].createElement(IconButton__default["default"], { onClick: handleOpenFilterModeMenu, onMouseEnter: handleOpenFilterModeMenu, size: "small", sx: { p: 0 } },
|
865
|
-
React__default["default"].createElement(ArrowRightIcon, null)))),
|
866
|
-
showFilterModeSubMenu && (React__default["default"].createElement(MRT_FilterOptionMenu, { anchorEl: filterMenuAnchorEl, header: header, key: 2, onSelect: handleFilterByColumn, setAnchorEl: setFilterMenuAnchorEl, table: table })),
|
867
|
-
].filter(Boolean),
|
868
|
-
enableGrouping &&
|
869
|
-
column.getCanGroup() && [
|
870
|
-
React__default["default"].createElement(MenuItem__default["default"], { divider: enablePinning, key: 0, onClick: handleGroupByColumn, sx: commonMenuItemStyles },
|
871
|
-
React__default["default"].createElement(Box__default["default"], { sx: commonListItemStyles },
|
872
|
-
React__default["default"].createElement(ListItemIcon__default["default"], null,
|
873
|
-
React__default["default"].createElement(DynamicFeedIcon, null)), (_h = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _h === void 0 ? void 0 :
|
874
|
-
_h.replace('{column}', String(columnDef.header)))),
|
875
|
-
],
|
876
|
-
enablePinning &&
|
877
|
-
column.getCanPin() && [
|
878
|
-
React__default["default"].createElement(MenuItem__default["default"], { disabled: column.getIsPinned() === 'left' || !column.getCanPin(), key: 0, onClick: () => handlePinColumn('left'), sx: commonMenuItemStyles },
|
879
|
-
React__default["default"].createElement(Box__default["default"], { sx: commonListItemStyles },
|
880
|
-
React__default["default"].createElement(ListItemIcon__default["default"], null,
|
881
|
-
React__default["default"].createElement(PushPinIcon, { style: { transform: 'rotate(90deg)' } })),
|
882
|
-
localization.pinToLeft)),
|
883
|
-
React__default["default"].createElement(MenuItem__default["default"], { disabled: column.getIsPinned() === 'right' || !column.getCanPin(), key: 1, onClick: () => handlePinColumn('right'), sx: commonMenuItemStyles },
|
884
|
-
React__default["default"].createElement(Box__default["default"], { sx: commonListItemStyles },
|
885
|
-
React__default["default"].createElement(ListItemIcon__default["default"], null,
|
886
|
-
React__default["default"].createElement(PushPinIcon, { style: { transform: 'rotate(-90deg)' } })),
|
887
|
-
localization.pinToRight)),
|
888
|
-
React__default["default"].createElement(MenuItem__default["default"], { disabled: !column.getIsPinned(), divider: enableHiding, key: 2, onClick: () => handlePinColumn(false), sx: commonMenuItemStyles },
|
889
|
-
React__default["default"].createElement(Box__default["default"], { sx: commonListItemStyles },
|
890
|
-
React__default["default"].createElement(ListItemIcon__default["default"], null,
|
891
|
-
React__default["default"].createElement(PushPinIcon, null)),
|
892
|
-
localization.unpin)),
|
893
|
-
],
|
894
|
-
enableColumnResizing &&
|
895
|
-
column.getCanResize() && [
|
896
|
-
React__default["default"].createElement(MenuItem__default["default"], { disabled: !columnSizing[column.id], key: 0, onClick: handleResetColumnSize, sx: commonMenuItemStyles },
|
897
|
-
React__default["default"].createElement(Box__default["default"], { sx: commonListItemStyles },
|
898
|
-
React__default["default"].createElement(ListItemIcon__default["default"], null,
|
899
|
-
React__default["default"].createElement(RestartAltIcon, null)),
|
900
|
-
localization.resetColumnSize)),
|
901
|
-
],
|
902
|
-
enableHiding && [
|
903
|
-
React__default["default"].createElement(MenuItem__default["default"], { disabled: !column.getCanHide(), key: 0, onClick: handleHideColumn, sx: commonMenuItemStyles },
|
904
|
-
React__default["default"].createElement(Box__default["default"], { sx: commonListItemStyles },
|
905
|
-
React__default["default"].createElement(ListItemIcon__default["default"], null,
|
906
|
-
React__default["default"].createElement(VisibilityOffIcon, null)), (_j = localization.hideColumn) === null || _j === void 0 ? void 0 :
|
907
|
-
_j.replace('{column}', String(columnDef.header)))),
|
908
|
-
React__default["default"].createElement(MenuItem__default["default"], { disabled: !Object.values(columnVisibility).filter((visible) => !visible)
|
909
|
-
.length, key: 1, onClick: handleShowAllColumns, sx: commonMenuItemStyles },
|
910
|
-
React__default["default"].createElement(Box__default["default"], { sx: commonListItemStyles },
|
911
|
-
React__default["default"].createElement(ListItemIcon__default["default"], null,
|
912
|
-
React__default["default"].createElement(ViewColumnIcon, null)), (_k = localization.showAllColumns) === null || _k === void 0 ? void 0 :
|
913
|
-
_k.replace('{column}', String(columnDef.header)))),
|
914
|
-
]));
|
821
|
+
} }, { children: [(_d = (_c = (_b = columnDef.renderColumnActionsMenuItems) === null || _b === void 0 ? void 0 : _b.call(columnDef, {
|
822
|
+
closeMenu: () => setAnchorEl(null),
|
823
|
+
column,
|
824
|
+
table,
|
825
|
+
})) !== null && _c !== void 0 ? _c : renderColumnActionsMenuItems === null || renderColumnActionsMenuItems === void 0 ? void 0 : renderColumnActionsMenuItems({
|
826
|
+
closeMenu: () => setAnchorEl(null),
|
827
|
+
column,
|
828
|
+
table,
|
829
|
+
})) !== null && _d !== void 0 ? _d : (enableSorting &&
|
830
|
+
column.getCanSort() &&
|
831
|
+
[
|
832
|
+
enableSortingRemoval !== false && (jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ disabled: !column.getIsSorted(), onClick: handleClearSort, sx: commonMenuItemStyles }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: commonListItemStyles }, { children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(ClearAllIcon, {}) }), localization.clearSort] })) }), 0)),
|
833
|
+
jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ disabled: column.getIsSorted() === 'asc', onClick: handleSortAsc, sx: commonMenuItemStyles }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: commonListItemStyles }, { children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(SortIcon, { style: { transform: 'rotate(180deg) scaleX(-1)' } }) }), (_e = localization.sortByColumnAsc) === null || _e === void 0 ? void 0 : _e.replace('{column}', String(columnDef.header))] })) }), 1),
|
834
|
+
jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ divider: enableColumnFilters || enableGrouping || enableHiding, disabled: column.getIsSorted() === 'desc', onClick: handleSortDesc, sx: commonMenuItemStyles }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: commonListItemStyles }, { children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(SortIcon, {}) }), (_f = localization.sortByColumnDesc) === null || _f === void 0 ? void 0 : _f.replace('{column}', String(columnDef.header))] })) }), 2),
|
835
|
+
].filter(Boolean)), enableColumnFilters &&
|
836
|
+
column.getCanFilter() &&
|
837
|
+
[
|
838
|
+
jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ disabled: !column.getFilterValue(), onClick: handleClearFilter, sx: commonMenuItemStyles }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: commonListItemStyles }, { children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(FilterListOffIcon, {}) }), localization.clearFilter] })) }), 0),
|
839
|
+
jsxRuntime.jsxs(MenuItem__default["default"], Object.assign({ disabled: showColumnFilters && !enableColumnFilterModes, divider: enableGrouping || enableHiding, onClick: showColumnFilters
|
840
|
+
? handleOpenFilterModeMenu
|
841
|
+
: handleFilterByColumn, sx: commonMenuItemStyles }, { children: [jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: commonListItemStyles }, { children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(FilterListIcon, {}) }), (_g = localization.filterByColumn) === null || _g === void 0 ? void 0 : _g.replace('{column}', String(columnDef.header))] })), showFilterModeSubMenu && (jsxRuntime.jsx(IconButton__default["default"], Object.assign({ onClick: handleOpenFilterModeMenu, onMouseEnter: handleOpenFilterModeMenu, size: "small", sx: { p: 0 } }, { children: jsxRuntime.jsx(ArrowRightIcon, {}) })))] }), 1),
|
842
|
+
showFilterModeSubMenu && (jsxRuntime.jsx(MRT_FilterOptionMenu, { anchorEl: filterMenuAnchorEl, header: header, onSelect: handleFilterByColumn, setAnchorEl: setFilterMenuAnchorEl, table: table }, 2)),
|
843
|
+
].filter(Boolean), enableGrouping &&
|
844
|
+
column.getCanGroup() && [
|
845
|
+
jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ divider: enablePinning, onClick: handleGroupByColumn, sx: commonMenuItemStyles }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: commonListItemStyles }, { children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(DynamicFeedIcon, {}) }), (_h = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _h === void 0 ? void 0 : _h.replace('{column}', String(columnDef.header))] })) }), 0),
|
846
|
+
], enablePinning &&
|
847
|
+
column.getCanPin() && [
|
848
|
+
jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ disabled: column.getIsPinned() === 'left' || !column.getCanPin(), onClick: () => handlePinColumn('left'), sx: commonMenuItemStyles }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: commonListItemStyles }, { children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(PushPinIcon, { style: { transform: 'rotate(90deg)' } }) }), localization.pinToLeft] })) }), 0),
|
849
|
+
jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ disabled: column.getIsPinned() === 'right' || !column.getCanPin(), onClick: () => handlePinColumn('right'), sx: commonMenuItemStyles }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: commonListItemStyles }, { children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(PushPinIcon, { style: { transform: 'rotate(-90deg)' } }) }), localization.pinToRight] })) }), 1),
|
850
|
+
jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ disabled: !column.getIsPinned(), divider: enableHiding, onClick: () => handlePinColumn(false), sx: commonMenuItemStyles }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: commonListItemStyles }, { children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(PushPinIcon, {}) }), localization.unpin] })) }), 2),
|
851
|
+
], enableColumnResizing &&
|
852
|
+
column.getCanResize() && [
|
853
|
+
jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ disabled: !columnSizing[column.id], onClick: handleResetColumnSize, sx: commonMenuItemStyles }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: commonListItemStyles }, { children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(RestartAltIcon, {}) }), localization.resetColumnSize] })) }), 0),
|
854
|
+
], enableHiding && [
|
855
|
+
jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ disabled: !column.getCanHide(), onClick: handleHideColumn, sx: commonMenuItemStyles }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: commonListItemStyles }, { children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(VisibilityOffIcon, {}) }), (_j = localization.hideColumn) === null || _j === void 0 ? void 0 : _j.replace('{column}', String(columnDef.header))] })) }), 0),
|
856
|
+
jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ disabled: !Object.values(columnVisibility).filter((visible) => !visible)
|
857
|
+
.length, onClick: handleShowAllColumns, sx: commonMenuItemStyles }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: commonListItemStyles }, { children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(ViewColumnIcon, {}) }), (_k = localization.showAllColumns) === null || _k === void 0 ? void 0 : _k.replace('{column}', String(columnDef.header))] })) }), 1),
|
858
|
+
]] })));
|
915
859
|
};
|
916
860
|
|
917
861
|
const MRT_RowActionMenu = ({ anchorEl, handleEdit, row, setAnchorEl, table, }) => {
|
918
862
|
const { getState, options: { icons: { EditIcon }, enableEditing, localization, renderRowActionMenuItems, }, } = table;
|
919
863
|
const { density } = getState();
|
920
|
-
return (
|
864
|
+
return (jsxRuntime.jsxs(Menu__default["default"], Object.assign({ anchorEl: anchorEl, open: !!anchorEl, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), MenuListProps: {
|
921
865
|
dense: density === 'compact',
|
922
|
-
} },
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
localization.edit))), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 :
|
930
|
-
renderRowActionMenuItems({
|
931
|
-
row,
|
932
|
-
table,
|
933
|
-
closeMenu: () => setAnchorEl(null),
|
934
|
-
})));
|
866
|
+
} }, { children: [enableEditing instanceof Function
|
867
|
+
? enableEditing(row)
|
868
|
+
: enableEditing && (jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ onClick: handleEdit, sx: commonMenuItemStyles }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: commonListItemStyles }, { children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(EditIcon, {}) }), localization.edit] })) }))), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
|
869
|
+
row,
|
870
|
+
table,
|
871
|
+
closeMenu: () => setAnchorEl(null),
|
872
|
+
})] })));
|
935
873
|
};
|
936
874
|
|
937
875
|
const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
|
@@ -958,15 +896,7 @@ const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
|
|
958
896
|
values: (_b = editingRow === null || editingRow === void 0 ? void 0 : editingRow._valuesCache) !== null && _b !== void 0 ? _b : Object.assign({}, row.original),
|
959
897
|
});
|
960
898
|
};
|
961
|
-
return (
|
962
|
-
React__default["default"].createElement(Tooltip__default["default"], { arrow: true, title: localization.cancel },
|
963
|
-
React__default["default"].createElement(IconButton__default["default"], { "aria-label": localization.cancel, onClick: handleCancel },
|
964
|
-
React__default["default"].createElement(CancelIcon, null))),
|
965
|
-
React__default["default"].createElement(Tooltip__default["default"], { arrow: true, title: localization.save },
|
966
|
-
React__default["default"].createElement(IconButton__default["default"], { "aria-label": localization.save, color: "info", onClick: handleSave },
|
967
|
-
React__default["default"].createElement(SaveIcon, null))))) : (React__default["default"].createElement(React__default["default"].Fragment, null,
|
968
|
-
React__default["default"].createElement(Button__default["default"], { onClick: handleCancel }, localization.cancel),
|
969
|
-
React__default["default"].createElement(Button__default["default"], { onClick: handleSave, variant: "contained" }, localization.save)))));
|
899
|
+
return (jsxRuntime.jsx(Box__default["default"], Object.assign({ onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' } }, { children: variant === 'icon' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, title: localization.cancel }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.cancel, onClick: handleCancel }, { children: jsxRuntime.jsx(CancelIcon, {}) })) })), jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, title: localization.save }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.save, color: "info", onClick: handleSave }, { children: jsxRuntime.jsx(SaveIcon, {}) })) }))] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Button__default["default"], Object.assign({ onClick: handleCancel }, { children: localization.cancel })), jsxRuntime.jsx(Button__default["default"], Object.assign({ onClick: handleSave, variant: "contained" }, { children: localization.save }))] })) })));
|
970
900
|
};
|
971
901
|
|
972
902
|
const commonIconButtonStyles = {
|
@@ -982,7 +912,7 @@ const commonIconButtonStyles = {
|
|
982
912
|
const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
|
983
913
|
const { getState, options: { editingMode, enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
|
984
914
|
const { editingRow } = getState();
|
985
|
-
const [anchorEl, setAnchorEl] =
|
915
|
+
const [anchorEl, setAnchorEl] = react.useState(null);
|
986
916
|
const handleOpenRowActionMenu = (event) => {
|
987
917
|
event.stopPropagation();
|
988
918
|
event.preventDefault();
|
@@ -993,16 +923,10 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
|
|
993
923
|
setEditingRow(Object.assign({}, row));
|
994
924
|
setAnchorEl(null);
|
995
925
|
};
|
996
|
-
return (
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
React__default["default"].createElement(IconButton__default["default"], { "aria-label": localization.edit, sx: commonIconButtonStyles, onClick: handleStartEditMode },
|
1001
|
-
React__default["default"].createElement(EditIcon, null)))) : renderRowActionMenuItems ? (React__default["default"].createElement(React__default["default"].Fragment, null,
|
1002
|
-
React__default["default"].createElement(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions },
|
1003
|
-
React__default["default"].createElement(IconButton__default["default"], { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles },
|
1004
|
-
React__default["default"].createElement(MoreHorizIcon, null))),
|
1005
|
-
React__default["default"].createElement(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table }))) : null));
|
926
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderRowActions ? (renderRowActions({ cell, row, table })) : row.id === (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) && editingMode === 'row' ? (jsxRuntime.jsx(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems &&
|
927
|
+
(enableEditing instanceof Function
|
928
|
+
? enableEditing(row)
|
929
|
+
: enableEditing) ? (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ placement: "right", arrow: true, title: localization.edit }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.edit, sx: commonIconButtonStyles, onClick: handleStartEditMode }, { children: jsxRuntime.jsx(EditIcon, {}) })) }))) : renderRowActionMenuItems ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles }, { children: jsxRuntime.jsx(MoreHorizIcon, {}) })) })), jsxRuntime.jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table })] })) : null }));
|
1006
930
|
};
|
1007
931
|
|
1008
932
|
const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
@@ -1036,11 +960,11 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
|
1036
960
|
}, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', width: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined }, ((checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx) instanceof Function
|
1037
961
|
? checkboxProps.sx(theme)
|
1038
962
|
: checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx))), title: undefined });
|
1039
|
-
return (
|
963
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _a !== void 0 ? _a : (selectAll
|
1040
964
|
? localization.toggleSelectAll
|
1041
|
-
: localization.toggleSelectRow) }, enableMultiRowSelection === false ? (
|
1042
|
-
|
1043
|
-
|
965
|
+
: localization.toggleSelectRow) }, { children: enableMultiRowSelection === false ? (jsxRuntime.jsx(Radio__default["default"], Object.assign({}, commonProps))) : (jsxRuntime.jsx(Checkbox__default["default"], Object.assign({ indeterminate: selectAll
|
966
|
+
? table.getIsSomeRowsSelected() && !allRowsSelected
|
967
|
+
: row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) })));
|
1044
968
|
};
|
1045
969
|
|
1046
970
|
const MRT_GlobalFilterTextField = ({ table, }) => {
|
@@ -1050,10 +974,10 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
1050
974
|
const textFieldProps = muiSearchTextFieldProps instanceof Function
|
1051
975
|
? muiSearchTextFieldProps({ table })
|
1052
976
|
: muiSearchTextFieldProps;
|
1053
|
-
const isMounted =
|
1054
|
-
const [anchorEl, setAnchorEl] =
|
1055
|
-
const [searchValue, setSearchValue] =
|
1056
|
-
const handleChangeDebounced =
|
977
|
+
const isMounted = react.useRef(false);
|
978
|
+
const [anchorEl, setAnchorEl] = react.useState(null);
|
979
|
+
const [searchValue, setSearchValue] = react.useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
|
980
|
+
const handleChangeDebounced = react.useCallback(utils.debounce((event) => {
|
1057
981
|
var _a;
|
1058
982
|
setGlobalFilter((_a = event.target.value) !== null && _a !== void 0 ? _a : undefined);
|
1059
983
|
}, manualFiltering ? 500 : 250), []);
|
@@ -1068,7 +992,7 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
1068
992
|
setSearchValue('');
|
1069
993
|
setGlobalFilter(undefined);
|
1070
994
|
};
|
1071
|
-
|
995
|
+
react.useEffect(() => {
|
1072
996
|
if (isMounted.current) {
|
1073
997
|
if (globalFilter === undefined) {
|
1074
998
|
handleClear();
|
@@ -1079,24 +1003,15 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
1079
1003
|
}
|
1080
1004
|
isMounted.current = true;
|
1081
1005
|
}, [globalFilter]);
|
1082
|
-
return (
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
React__default["default"].createElement(IconButton__default["default"], { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small" },
|
1092
|
-
React__default["default"].createElement(CloseIcon, null)))))),
|
1093
|
-
} }, textFieldProps, { inputRef: (inputRef) => {
|
1094
|
-
searchInputRef.current = inputRef;
|
1095
|
-
if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.inputRef) {
|
1096
|
-
textFieldProps.inputRef = inputRef;
|
1097
|
-
}
|
1098
|
-
} })),
|
1099
|
-
React__default["default"].createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table, onSelect: handleClear })));
|
1006
|
+
return (jsxRuntime.jsxs(Collapse__default["default"], Object.assign({ in: showGlobalFilter, orientation: "horizontal", unmountOnExit: true, mountOnEnter: true }, { children: [jsxRuntime.jsx(TextField__default["default"], Object.assign({ placeholder: localization.search, onChange: handleChange, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard", InputProps: {
|
1007
|
+
startAdornment: enableGlobalFilterModes ? (jsxRuntime.jsx(InputAdornment__default["default"], Object.assign({ position: "start" }, { children: jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, title: localization.changeSearchMode }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' } }, { children: jsxRuntime.jsx(SearchIcon, {}) })) })) }))) : (jsxRuntime.jsx(SearchIcon, { style: { marginRight: '4px' } })),
|
1008
|
+
endAdornment: (jsxRuntime.jsx(InputAdornment__default["default"], Object.assign({ position: "end" }, { children: jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, title: (_a = localization.clearSearch) !== null && _a !== void 0 ? _a : '' }, { children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small" }, { children: jsxRuntime.jsx(CloseIcon, {}) })) }) })) }))),
|
1009
|
+
} }, textFieldProps, { inputRef: (inputRef) => {
|
1010
|
+
searchInputRef.current = inputRef;
|
1011
|
+
if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.inputRef) {
|
1012
|
+
textFieldProps.inputRef = inputRef;
|
1013
|
+
}
|
1014
|
+
} })), jsxRuntime.jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table, onSelect: handleClear })] })));
|
1100
1015
|
};
|
1101
1016
|
|
1102
1017
|
const MRT_LinearProgressBar = ({ isTopToolbar, table, }) => {
|
@@ -1105,13 +1020,12 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table, }) => {
|
|
1105
1020
|
const linearProgressProps = muiLinearProgressProps instanceof Function
|
1106
1021
|
? muiLinearProgressProps({ isTopToolbar, table })
|
1107
1022
|
: muiLinearProgressProps;
|
1108
|
-
return (
|
1023
|
+
return (jsxRuntime.jsx(Collapse__default["default"], Object.assign({ in: isLoading || showProgressBars, mountOnEnter: true, unmountOnExit: true, sx: {
|
1109
1024
|
bottom: isTopToolbar ? 0 : undefined,
|
1110
1025
|
position: 'absolute',
|
1111
1026
|
top: !isTopToolbar ? 0 : undefined,
|
1112
1027
|
width: '100%',
|
1113
|
-
} },
|
1114
|
-
React__default["default"].createElement(LinearProgress__default["default"], Object.assign({ "aria-label": "Loading", "aria-busy": "true", sx: { position: 'relative' } }, linearProgressProps))));
|
1028
|
+
} }, { children: jsxRuntime.jsx(LinearProgress__default["default"], Object.assign({ "aria-label": "Loading", "aria-busy": "true", sx: { position: 'relative' } }, linearProgressProps)) })));
|
1115
1029
|
};
|
1116
1030
|
|
1117
1031
|
const MRT_TablePagination = ({ table, position = 'bottom', }) => {
|
@@ -1125,7 +1039,7 @@ const MRT_TablePagination = ({ table, position = 'bottom', }) => {
|
|
1125
1039
|
const handleChangeRowsPerPage = (event) => {
|
1126
1040
|
setPageSize(+event.target.value);
|
1127
1041
|
};
|
1128
|
-
return (
|
1042
|
+
return (jsxRuntime.jsx(TablePagination__default["default"], Object.assign({ component: "div", count: totalRowCount, getItemAriaLabel: (type) => type === 'first'
|
1129
1043
|
? localization.goToFirstPage
|
1130
1044
|
: type === 'last'
|
1131
1045
|
? localization.goToLastPage
|
@@ -1166,27 +1080,14 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
1166
1080
|
const selectMessage = getSelectedRowModel().rows.length > 0
|
1167
1081
|
? (_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())
|
1168
1082
|
: null;
|
1169
|
-
const groupedByMessage = grouping.length > 0 ? (
|
1170
|
-
|
1171
|
-
' ',
|
1172
|
-
grouping.map((columnId, index) => (React__default["default"].createElement(React.Fragment, { key: `${index}-${columnId}` },
|
1173
|
-
index > 0 ? localization.thenBy : '',
|
1174
|
-
React__default["default"].createElement(Chip__default["default"], Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))))))) : null;
|
1175
|
-
return (React__default["default"].createElement(Collapse__default["default"], { in: showAlertBanner || !!selectMessage || !!groupedByMessage, timeout: stackAlertBanner ? 200 : 0 },
|
1176
|
-
React__default["default"].createElement(Alert__default["default"], Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => (Object.assign({ borderRadius: 0, fontSize: '1rem', left: 0, p: 0, position: 'relative', mb: stackAlertBanner
|
1083
|
+
const groupedByMessage = grouping.length > 0 ? (jsxRuntime.jsxs("span", { children: [localization.groupedBy, ' ', grouping.map((columnId, index) => (jsxRuntime.jsxs(react.Fragment, { children: [index > 0 ? localization.thenBy : '', jsxRuntime.jsx(Chip__default["default"], Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))] }, `${index}-${columnId}`)))] })) : null;
|
1084
|
+
return (jsxRuntime.jsx(Collapse__default["default"], Object.assign({ in: showAlertBanner || !!selectMessage || !!groupedByMessage, timeout: stackAlertBanner ? 200 : 0 }, { children: jsxRuntime.jsxs(Alert__default["default"], Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => (Object.assign({ borderRadius: 0, fontSize: '1rem', left: 0, p: 0, position: 'relative', mb: stackAlertBanner
|
1177
1085
|
? 0
|
1178
1086
|
: positionToolbarAlertBanner === 'bottom'
|
1179
1087
|
? '-1rem'
|
1180
1088
|
: undefined, right: 0, top: 0, width: '100%', zIndex: 2 }, ((alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx) instanceof Function
|
1181
1089
|
? alertProps.sx(theme)
|
1182
|
-
: alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx))) }),
|
1183
|
-
(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && React__default["default"].createElement(AlertTitle__default["default"], null, alertProps.title),
|
1184
|
-
React__default["default"].createElement(Box__default["default"], { sx: { p: '0.5rem 1rem' } }, alertProps === null || alertProps === void 0 ? void 0 :
|
1185
|
-
alertProps.children,
|
1186
|
-
(alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectMessage || groupedByMessage) && (React__default["default"].createElement("br", null)),
|
1187
|
-
selectMessage,
|
1188
|
-
selectMessage && groupedByMessage && React__default["default"].createElement("br", null),
|
1189
|
-
groupedByMessage))));
|
1090
|
+
: alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx))) }, { children: [(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && jsxRuntime.jsx(AlertTitle__default["default"], { children: alertProps.title }), jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: { p: '0.5rem 1rem' } }, { children: [alertProps === null || alertProps === void 0 ? void 0 : alertProps.children, (alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectMessage || groupedByMessage) && (jsxRuntime.jsx("br", {})), selectMessage, selectMessage && groupedByMessage && jsxRuntime.jsx("br", {}), groupedByMessage] }))] })) })));
|
1190
1091
|
};
|
1191
1092
|
|
1192
1093
|
const MRT_FullScreenToggleButton = (_a) => {
|
@@ -1197,8 +1098,7 @@ const MRT_FullScreenToggleButton = (_a) => {
|
|
1197
1098
|
const handleToggleFullScreen = () => {
|
1198
1099
|
setIsFullScreen(!isFullScreen);
|
1199
1100
|
};
|
1200
|
-
return (
|
1201
|
-
React__default["default"].createElement(IconButton__default["default"], Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleFullScreen }, rest, { title: undefined }), isFullScreen ? React__default["default"].createElement(FullscreenExitIcon, null) : React__default["default"].createElement(FullscreenIcon, null))));
|
1101
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleFullScreen }, rest, { title: undefined }, { children: isFullScreen ? jsxRuntime.jsx(FullscreenExitIcon, {}) : jsxRuntime.jsx(FullscreenIcon, {}) })) })));
|
1202
1102
|
};
|
1203
1103
|
|
1204
1104
|
const MRT_ColumnPinningButtons = ({ column, table, }) => {
|
@@ -1206,26 +1106,17 @@ const MRT_ColumnPinningButtons = ({ column, table, }) => {
|
|
1206
1106
|
const handlePinColumn = (pinDirection) => {
|
1207
1107
|
column.pin(pinDirection);
|
1208
1108
|
};
|
1209
|
-
return (
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
React__default["default"].createElement(PushPinIcon, { style: {
|
1215
|
-
transform: 'rotate(90deg)',
|
1216
|
-
} }))),
|
1217
|
-
React__default["default"].createElement(Tooltip__default["default"], { arrow: true, title: localization.pinToRight },
|
1218
|
-
React__default["default"].createElement(IconButton__default["default"], { onClick: () => handlePinColumn('right'), size: "small" },
|
1219
|
-
React__default["default"].createElement(PushPinIcon, { style: {
|
1220
|
-
transform: 'rotate(-90deg)',
|
1221
|
-
} })))))));
|
1109
|
+
return (jsxRuntime.jsx(Box__default["default"], Object.assign({ sx: { minWidth: '70px', textAlign: 'center' } }, { children: column.getIsPinned() ? (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, title: localization.unpin }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ onClick: () => handlePinColumn(false), size: "small" }, { children: jsxRuntime.jsx(PushPinIcon, {}) })) }))) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, title: localization.pinToLeft }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ onClick: () => handlePinColumn('left'), size: "small" }, { children: jsxRuntime.jsx(PushPinIcon, { style: {
|
1110
|
+
transform: 'rotate(90deg)',
|
1111
|
+
} }) })) })), jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, title: localization.pinToRight }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ onClick: () => handlePinColumn('right'), size: "small" }, { children: jsxRuntime.jsx(PushPinIcon, { style: {
|
1112
|
+
transform: 'rotate(-90deg)',
|
1113
|
+
} }) })) }))] })) })));
|
1222
1114
|
};
|
1223
1115
|
|
1224
1116
|
const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
|
1225
1117
|
var _a;
|
1226
1118
|
const { options: { icons: { DragHandleIcon }, localization, }, } = table;
|
1227
|
-
return (
|
1228
|
-
React__default["default"].createElement(IconButton__default["default"], Object.assign({ disableRipple: true, draggable: "true", size: "small" }, iconButtonProps, { onClick: (e) => {
|
1119
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ 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.move }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ disableRipple: true, draggable: "true", size: "small" }, iconButtonProps, { onClick: (e) => {
|
1229
1120
|
var _a;
|
1230
1121
|
e.stopPropagation();
|
1231
1122
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
|
@@ -1236,8 +1127,7 @@ const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table,
|
|
1236
1127
|
cursor: 'grabbing',
|
1237
1128
|
} }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
1238
1129
|
? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
|
1239
|
-
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined })
|
1240
|
-
React__default["default"].createElement(DragHandleIcon, null))));
|
1130
|
+
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }, { children: jsxRuntime.jsx(DragHandleIcon, {}) })) })));
|
1241
1131
|
};
|
1242
1132
|
|
1243
1133
|
const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, table, }) => {
|
@@ -1260,8 +1150,8 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredCol
|
|
1260
1150
|
column.toggleVisibility();
|
1261
1151
|
}
|
1262
1152
|
};
|
1263
|
-
const menuItemRef =
|
1264
|
-
const [isDragging, setIsDragging] =
|
1153
|
+
const menuItemRef = react.useRef(null);
|
1154
|
+
const [isDragging, setIsDragging] = react.useState(false);
|
1265
1155
|
const handleDragStart = (e) => {
|
1266
1156
|
setIsDragging(true);
|
1267
1157
|
e.dataTransfer.setDragImage(menuItemRef.current, 0, 0);
|
@@ -1278,42 +1168,35 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredCol
|
|
1278
1168
|
setHoveredColumn(column);
|
1279
1169
|
}
|
1280
1170
|
};
|
1281
|
-
return (
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
sx: {
|
1310
|
-
mb: 0,
|
1311
|
-
opacity: columnDefType !== 'display' ? 1 : 0.5,
|
1312
|
-
},
|
1313
|
-
},
|
1314
|
-
}, checked: switchChecked, control: React__default["default"].createElement(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.toggleVisibility },
|
1315
|
-
React__default["default"].createElement(Switch__default["default"], null)), disabled: !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (React__default["default"].createElement(Typography__default["default"], { sx: { alignSelf: 'center' } }, columnDef.header)))), (_a = column.columns) === null || _a === void 0 ? void 0 :
|
1316
|
-
_a.map((c, i) => (React__default["default"].createElement(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, key: `${i}-${c.id}`, setHoveredColumn: setHoveredColumn, table: table })))));
|
1171
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ disableRipple: true, ref: menuItemRef, onDragEnter: handleDragEnter, sx: (theme) => ({
|
1172
|
+
alignItems: 'center',
|
1173
|
+
justifyContent: 'flex-start',
|
1174
|
+
my: 0,
|
1175
|
+
opacity: isDragging ? 0.5 : 1,
|
1176
|
+
outlineOffset: '-2px',
|
1177
|
+
outline: isDragging
|
1178
|
+
? `2px dashed ${theme.palette.divider}`
|
1179
|
+
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
1180
|
+
? `2px dashed ${theme.palette.primary.main}`
|
1181
|
+
: 'none',
|
1182
|
+
pl: `${(column.depth + 0.5) * 2}rem`,
|
1183
|
+
py: '6px',
|
1184
|
+
}) }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: {
|
1185
|
+
display: 'flex',
|
1186
|
+
flexWrap: 'nowrap',
|
1187
|
+
gap: '8px',
|
1188
|
+
} }, { children: [columnDefType !== 'group' &&
|
1189
|
+
enableColumnOrdering &&
|
1190
|
+
!allColumns.some((col) => col.columnDef.columnDefType === 'group') &&
|
1191
|
+
(columnDef.enableColumnOrdering !== false ? (jsxRuntime.jsx(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (jsxRuntime.jsx(Box__default["default"], { sx: { width: '28px' } }))), enablePinning &&
|
1192
|
+
(column.getCanPin() ? (jsxRuntime.jsx(MRT_ColumnPinningButtons, { column: column, table: table })) : (jsxRuntime.jsx(Box__default["default"], { sx: { width: '70px' } }))), enableHiding ? (jsxRuntime.jsx(FormControlLabel__default["default"], { componentsProps: {
|
1193
|
+
typography: {
|
1194
|
+
sx: {
|
1195
|
+
mb: 0,
|
1196
|
+
opacity: columnDefType !== 'display' ? 1 : 0.5,
|
1197
|
+
},
|
1198
|
+
},
|
1199
|
+
}, checked: switchChecked, control: jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.toggleVisibility }, { children: jsxRuntime.jsx(Switch__default["default"], {}) })), disabled: !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (jsxRuntime.jsx(Typography__default["default"], Object.assign({ sx: { alignSelf: 'center' } }, { children: columnDef.header })))] })) })), (_a = column.columns) === null || _a === void 0 ? void 0 : _a.map((c, i) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${i}-${c.id}`)))] }));
|
1317
1200
|
};
|
1318
1201
|
|
1319
1202
|
const MRT_ShowHideColumnsMenu = ({ anchorEl, setAnchorEl, table, }) => {
|
@@ -1324,7 +1207,7 @@ const MRT_ShowHideColumnsMenu = ({ anchorEl, setAnchorEl, table, }) => {
|
|
1324
1207
|
.filter((col) => col.columnDef.enableHiding !== false)
|
1325
1208
|
.forEach((col) => col.toggleVisibility(false));
|
1326
1209
|
};
|
1327
|
-
const allColumns =
|
1210
|
+
const allColumns = react.useMemo(() => {
|
1328
1211
|
const columns = getAllColumns();
|
1329
1212
|
if (columnOrder.length > 0 &&
|
1330
1213
|
!columns.some((col) => col.columnDef.columnDefType === 'group')) {
|
@@ -1343,37 +1226,26 @@ const MRT_ShowHideColumnsMenu = ({ anchorEl, setAnchorEl, table, }) => {
|
|
1343
1226
|
getLeftLeafColumns(),
|
1344
1227
|
getRightLeafColumns(),
|
1345
1228
|
]);
|
1346
|
-
const [hoveredColumn, setHoveredColumn] =
|
1347
|
-
return (
|
1229
|
+
const [hoveredColumn, setHoveredColumn] = react.useState(null);
|
1230
|
+
return (jsxRuntime.jsxs(Menu__default["default"], Object.assign({ anchorEl: anchorEl, open: !!anchorEl, onClose: () => setAnchorEl(null), MenuListProps: {
|
1348
1231
|
dense: density === 'compact',
|
1349
|
-
} },
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
} },
|
1356
|
-
enableHiding && (React__default["default"].createElement(Button__default["default"], { disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns }, localization.hideAll)),
|
1357
|
-
enableColumnOrdering && (React__default["default"].createElement(Button__default["default"], { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)) }, localization.resetOrder)),
|
1358
|
-
enablePinning && (React__default["default"].createElement(Button__default["default"], { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true) }, localization.unpinAll)),
|
1359
|
-
enableHiding && (React__default["default"].createElement(Button__default["default"], { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true) }, localization.showAll))),
|
1360
|
-
React__default["default"].createElement(Divider__default["default"], null),
|
1361
|
-
allColumns.map((column, index) => (React__default["default"].createElement(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, key: `${index}-${column.id}`, setHoveredColumn: setHoveredColumn, table: table })))));
|
1232
|
+
} }, { children: [jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: {
|
1233
|
+
display: 'flex',
|
1234
|
+
justifyContent: 'space-between',
|
1235
|
+
p: '0.5rem',
|
1236
|
+
pt: 0,
|
1237
|
+
} }, { children: [enableHiding && (jsxRuntime.jsx(Button__default["default"], Object.assign({ disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns }, { children: localization.hideAll }))), enableColumnOrdering && (jsxRuntime.jsx(Button__default["default"], Object.assign({ onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)) }, { children: localization.resetOrder }))), enablePinning && (jsxRuntime.jsx(Button__default["default"], Object.assign({ disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true) }, { children: localization.unpinAll }))), enableHiding && (jsxRuntime.jsx(Button__default["default"], Object.assign({ disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true) }, { children: localization.showAll })))] })), jsxRuntime.jsx(Divider__default["default"], {}), allColumns.map((column, index) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] })));
|
1362
1238
|
};
|
1363
1239
|
|
1364
1240
|
const MRT_ShowHideColumnsButton = (_a) => {
|
1365
1241
|
var _b;
|
1366
1242
|
var { table } = _a, rest = __rest(_a, ["table"]);
|
1367
1243
|
const { options: { icons: { ViewColumnIcon }, localization, }, } = table;
|
1368
|
-
const [anchorEl, setAnchorEl] =
|
1244
|
+
const [anchorEl, setAnchorEl] = react.useState(null);
|
1369
1245
|
const handleClick = (event) => {
|
1370
1246
|
setAnchorEl(event.currentTarget);
|
1371
1247
|
};
|
1372
|
-
return (
|
1373
|
-
React__default["default"].createElement(Tooltip__default["default"], { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideColumns },
|
1374
|
-
React__default["default"].createElement(IconButton__default["default"], Object.assign({ "aria-label": localization.showHideColumns, onClick: handleClick }, rest, { title: undefined }),
|
1375
|
-
React__default["default"].createElement(ViewColumnIcon, null))),
|
1376
|
-
anchorEl && (React__default["default"].createElement(MRT_ShowHideColumnsMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table }))));
|
1248
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideColumns }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.showHideColumns, onClick: handleClick }, rest, { title: undefined }, { children: jsxRuntime.jsx(ViewColumnIcon, {}) })) })), anchorEl && (jsxRuntime.jsx(MRT_ShowHideColumnsMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table }))] }));
|
1377
1249
|
};
|
1378
1250
|
|
1379
1251
|
const MRT_ToggleDensePaddingButton = (_a) => {
|
@@ -1389,8 +1261,7 @@ const MRT_ToggleDensePaddingButton = (_a) => {
|
|
1389
1261
|
: 'comfortable';
|
1390
1262
|
setDensity(nextDensity);
|
1391
1263
|
};
|
1392
|
-
return (
|
1393
|
-
React__default["default"].createElement(IconButton__default["default"], Object.assign({ "aria-label": localization.toggleDensity, onClick: handleToggleDensePadding }, rest, { title: undefined }), density === 'compact' ? (React__default["default"].createElement(DensitySmallIcon, null)) : density === 'comfortable' ? (React__default["default"].createElement(DensityMediumIcon, null)) : (React__default["default"].createElement(DensityLargeIcon, null)))));
|
1264
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleDensity }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.toggleDensity, onClick: handleToggleDensePadding }, rest, { title: undefined }, { children: density === 'compact' ? (jsxRuntime.jsx(DensitySmallIcon, {})) : density === 'comfortable' ? (jsxRuntime.jsx(DensityMediumIcon, {})) : (jsxRuntime.jsx(DensityLargeIcon, {})) })) })));
|
1394
1265
|
};
|
1395
1266
|
|
1396
1267
|
const MRT_ToggleFiltersButton = (_a) => {
|
@@ -1401,8 +1272,7 @@ const MRT_ToggleFiltersButton = (_a) => {
|
|
1401
1272
|
const handleToggleShowFilters = () => {
|
1402
1273
|
setShowColumnFilters(!showColumnFilters);
|
1403
1274
|
};
|
1404
|
-
return (
|
1405
|
-
React__default["default"].createElement(IconButton__default["default"], Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleShowFilters }, rest, { title: undefined }), showColumnFilters ? React__default["default"].createElement(FilterListOffIcon, null) : React__default["default"].createElement(FilterListIcon, null))));
|
1275
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideFilters }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleShowFilters }, rest, { title: undefined }, { children: showColumnFilters ? jsxRuntime.jsx(FilterListOffIcon, {}) : jsxRuntime.jsx(FilterListIcon, {}) })) })));
|
1406
1276
|
};
|
1407
1277
|
|
1408
1278
|
const MRT_ToggleGlobalFilterButton = (_a) => {
|
@@ -1414,27 +1284,21 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
|
|
1414
1284
|
setShowGlobalFilter(!showGlobalFilter);
|
1415
1285
|
queueMicrotask(() => { var _a; return (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
|
1416
1286
|
};
|
1417
|
-
return (
|
1418
|
-
React__default["default"].createElement(IconButton__default["default"], Object.assign({ "aria-label": (_c = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _c !== void 0 ? _c : localization.showHideSearch, disabled: !!globalFilter, onClick: handleToggleSearch }, rest, { title: undefined }), showGlobalFilter ? React__default["default"].createElement(SearchOffIcon, null) : React__default["default"].createElement(SearchIcon, null))));
|
1287
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideSearch }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": (_c = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _c !== void 0 ? _c : localization.showHideSearch, disabled: !!globalFilter, onClick: handleToggleSearch }, rest, { title: undefined }, { children: showGlobalFilter ? jsxRuntime.jsx(SearchOffIcon, {}) : jsxRuntime.jsx(SearchIcon, {}) })) })));
|
1419
1288
|
};
|
1420
1289
|
|
1421
1290
|
const MRT_ToolbarInternalButtons = ({ table, }) => {
|
1422
1291
|
var _a;
|
1423
1292
|
const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enablePinning, initialState, renderToolbarInternalActions, }, } = table;
|
1424
|
-
return (
|
1293
|
+
return (jsxRuntime.jsx(Box__default["default"], Object.assign({ sx: {
|
1425
1294
|
alignItems: 'center',
|
1426
1295
|
display: 'flex',
|
1427
1296
|
zIndex: 3,
|
1428
|
-
} }, (_a = renderToolbarInternalActions === null || renderToolbarInternalActions === void 0 ? void 0 : renderToolbarInternalActions({
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
!(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (React__default["default"].createElement(MRT_ToggleGlobalFilterButton, { table: table })),
|
1434
|
-
enableFilters && enableColumnFilters && (React__default["default"].createElement(MRT_ToggleFiltersButton, { table: table })),
|
1435
|
-
(enableHiding || enableColumnOrdering || enablePinning) && (React__default["default"].createElement(MRT_ShowHideColumnsButton, { table: table })),
|
1436
|
-
enableDensityToggle && (React__default["default"].createElement(MRT_ToggleDensePaddingButton, { table: table })),
|
1437
|
-
enableFullScreenToggle && (React__default["default"].createElement(MRT_FullScreenToggleButton, { table: table }))))));
|
1297
|
+
} }, { children: (_a = renderToolbarInternalActions === null || renderToolbarInternalActions === void 0 ? void 0 : renderToolbarInternalActions({
|
1298
|
+
table,
|
1299
|
+
})) !== null && _a !== void 0 ? _a : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [enableFilters &&
|
1300
|
+
enableGlobalFilter &&
|
1301
|
+
!(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (jsxRuntime.jsx(MRT_ToggleGlobalFilterButton, { table: table })), enableFilters && enableColumnFilters && (jsxRuntime.jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enablePinning) && (jsxRuntime.jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsxRuntime.jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsxRuntime.jsx(MRT_FullScreenToggleButton, { table: table }))] })) })));
|
1438
1302
|
};
|
1439
1303
|
|
1440
1304
|
const MRT_ToolbarDropZone = ({ table, }) => {
|
@@ -1444,7 +1308,7 @@ const MRT_ToolbarDropZone = ({ table, }) => {
|
|
1444
1308
|
const handleDragEnter = (_event) => {
|
1445
1309
|
setHoveredColumn({ id: 'drop-zone' });
|
1446
1310
|
};
|
1447
|
-
|
1311
|
+
react.useEffect(() => {
|
1448
1312
|
var _a;
|
1449
1313
|
if (((_a = table.options.state) === null || _a === void 0 ? void 0 : _a.showToolbarDropZone) !== undefined) {
|
1450
1314
|
setShowToolbarDropZone(!!enableGrouping &&
|
@@ -1453,8 +1317,7 @@ const MRT_ToolbarDropZone = ({ table, }) => {
|
|
1453
1317
|
!grouping.includes(draggingColumn.id));
|
1454
1318
|
}
|
1455
1319
|
}, [enableGrouping, draggingColumn, grouping]);
|
1456
|
-
return (
|
1457
|
-
React__default["default"].createElement(Box__default["default"], { className: "Mui-ToolbarDropZone", sx: (theme) => ({
|
1320
|
+
return (jsxRuntime.jsx(Fade__default["default"], Object.assign({ in: showToolbarDropZone }, { children: jsxRuntime.jsx(Box__default["default"], Object.assign({ className: "Mui-ToolbarDropZone", sx: (theme) => ({
|
1458
1321
|
alignItems: 'center',
|
1459
1322
|
backgroundColor: styles.alpha(theme.palette.info.main, (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone' ? 0.2 : 0.1),
|
1460
1323
|
backdropFilter: 'blur(4px)',
|
@@ -1466,8 +1329,7 @@ const MRT_ToolbarDropZone = ({ table, }) => {
|
|
1466
1329
|
position: 'absolute',
|
1467
1330
|
width: '100%',
|
1468
1331
|
zIndex: 4,
|
1469
|
-
}), onDragEnter: handleDragEnter },
|
1470
|
-
React__default["default"].createElement(Typography__default["default"], { fontStyle: "italic" }, localization.dropToGroupBy.replace('{column}', (_b = (_a = draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.columnDef) === null || _a === void 0 ? void 0 : _a.header) !== null && _b !== void 0 ? _b : '')))));
|
1332
|
+
}), onDragEnter: handleDragEnter }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ fontStyle: "italic" }, { children: localization.dropToGroupBy.replace('{column}', (_b = (_a = draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.columnDef) === null || _a === void 0 ? void 0 : _a.header) !== null && _b !== void 0 ? _b : '') })) })) })));
|
1471
1333
|
};
|
1472
1334
|
|
1473
1335
|
const commonToolbarStyles = ({ theme }) => ({
|
@@ -1491,7 +1353,7 @@ const MRT_TopToolbar = ({ table, }) => {
|
|
1491
1353
|
? muiTopToolbarProps({ table })
|
1492
1354
|
: muiTopToolbarProps;
|
1493
1355
|
const stackAlertBanner = isMobile || !!renderTopToolbarCustomActions || showGlobalFilter;
|
1494
|
-
return (
|
1356
|
+
return (jsxRuntime.jsxs(Toolbar__default["default"], Object.assign({ variant: "dense" }, toolbarProps, { ref: (ref) => {
|
1495
1357
|
topToolbarRef.current = ref;
|
1496
1358
|
if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
|
1497
1359
|
// @ts-ignore
|
@@ -1499,32 +1361,23 @@ const MRT_TopToolbar = ({ table, }) => {
|
|
1499
1361
|
}
|
1500
1362
|
}, sx: (theme) => (Object.assign(Object.assign({ position: isFullScreen ? 'sticky' : undefined, top: isFullScreen ? '0' : undefined }, commonToolbarStyles({ theme })), ((toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx) instanceof Function
|
1501
1363
|
? toolbarProps.sx(theme)
|
1502
|
-
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
|
1503
|
-
|
1504
|
-
|
1505
|
-
React__default["default"].createElement(Box__default["default"], { sx: {
|
1506
|
-
alignItems: 'flex-start',
|
1507
|
-
boxSizing: 'border-box',
|
1508
|
-
display: 'flex',
|
1509
|
-
justifyContent: 'space-between',
|
1510
|
-
p: '0.5rem',
|
1511
|
-
position: stackAlertBanner ? 'relative' : 'absolute',
|
1512
|
-
right: 0,
|
1513
|
-
top: 0,
|
1514
|
-
width: '100%',
|
1515
|
-
} },
|
1516
|
-
enableGlobalFilter && positionGlobalFilter === 'left' && (React__default["default"].createElement(MRT_GlobalFilterTextField, { table: table })), (_a = renderTopToolbarCustomActions === null || renderTopToolbarCustomActions === void 0 ? void 0 : renderTopToolbarCustomActions({ table })) !== null && _a !== void 0 ? _a : React__default["default"].createElement("span", null),
|
1517
|
-
enableToolbarInternalActions ? (React__default["default"].createElement(Box__default["default"], { sx: {
|
1364
|
+
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }, { children: [positionToolbarAlertBanner === 'top' && (jsxRuntime.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: {
|
1365
|
+
alignItems: 'flex-start',
|
1366
|
+
boxSizing: 'border-box',
|
1518
1367
|
display: 'flex',
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1368
|
+
justifyContent: 'space-between',
|
1369
|
+
p: '0.5rem',
|
1370
|
+
position: stackAlertBanner ? 'relative' : 'absolute',
|
1371
|
+
right: 0,
|
1372
|
+
top: 0,
|
1373
|
+
width: '100%',
|
1374
|
+
} }, { children: [enableGlobalFilter && positionGlobalFilter === 'left' && (jsxRuntime.jsx(MRT_GlobalFilterTextField, { table: table })), (_a = renderTopToolbarCustomActions === null || renderTopToolbarCustomActions === void 0 ? void 0 : renderTopToolbarCustomActions({ table })) !== null && _a !== void 0 ? _a : jsxRuntime.jsx("span", {}), enableToolbarInternalActions ? (jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: {
|
1375
|
+
display: 'flex',
|
1376
|
+
flexWrap: 'wrap-reverse',
|
1377
|
+
justifyContent: 'flex-end',
|
1378
|
+
} }, { children: [enableGlobalFilter && positionGlobalFilter === 'right' && (jsxRuntime.jsx(MRT_GlobalFilterTextField, { table: table })), jsxRuntime.jsx(MRT_ToolbarInternalButtons, { table: table })] }))) : (enableGlobalFilter &&
|
1379
|
+
positionGlobalFilter === 'right' && (jsxRuntime.jsx(MRT_GlobalFilterTextField, { table: table })))] })), enablePagination &&
|
1380
|
+
['top', 'both'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (jsxRuntime.jsx(MRT_TablePagination, { table: table, position: "top" })), jsxRuntime.jsx(MRT_LinearProgressBar, { isTopToolbar: true, table: table })] })));
|
1528
1381
|
};
|
1529
1382
|
|
1530
1383
|
const MRT_BottomToolbar = ({ table, }) => {
|
@@ -1535,7 +1388,7 @@ const MRT_BottomToolbar = ({ table, }) => {
|
|
1535
1388
|
? muiBottomToolbarProps({ table })
|
1536
1389
|
: muiBottomToolbarProps;
|
1537
1390
|
const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions;
|
1538
|
-
return (
|
1391
|
+
return (jsxRuntime.jsxs(Toolbar__default["default"], Object.assign({ variant: "dense" }, toolbarProps, { ref: (node) => {
|
1539
1392
|
if (node) {
|
1540
1393
|
bottomToolbarRef.current = node;
|
1541
1394
|
if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
|
@@ -1545,27 +1398,21 @@ const MRT_BottomToolbar = ({ table, }) => {
|
|
1545
1398
|
}
|
1546
1399
|
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `0 1px 2px -1px ${styles.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
|
1547
1400
|
? toolbarProps.sx(theme)
|
1548
|
-
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
|
1549
|
-
|
1550
|
-
|
1551
|
-
['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (React__default["default"].createElement(MRT_ToolbarDropZone, { table: table })),
|
1552
|
-
React__default["default"].createElement(Box__default["default"], { sx: {
|
1553
|
-
alignItems: 'center',
|
1554
|
-
boxSizing: 'border-box',
|
1555
|
-
display: 'flex',
|
1556
|
-
justifyContent: 'space-between',
|
1557
|
-
p: '0.5rem',
|
1558
|
-
width: '100%',
|
1559
|
-
} },
|
1560
|
-
renderBottomToolbarCustomActions ? (renderBottomToolbarCustomActions({ table })) : (React__default["default"].createElement("span", null)),
|
1561
|
-
React__default["default"].createElement(Box__default["default"], { sx: {
|
1401
|
+
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }, { children: [jsxRuntime.jsx(MRT_LinearProgressBar, { isTopToolbar: false, table: table }), positionToolbarAlertBanner === 'bottom' && (jsxRuntime.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: {
|
1402
|
+
alignItems: 'center',
|
1403
|
+
boxSizing: 'border-box',
|
1562
1404
|
display: 'flex',
|
1563
|
-
justifyContent: '
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1405
|
+
justifyContent: 'space-between',
|
1406
|
+
p: '0.5rem',
|
1407
|
+
width: '100%',
|
1408
|
+
} }, { children: [renderBottomToolbarCustomActions ? (renderBottomToolbarCustomActions({ table })) : (jsxRuntime.jsx("span", {})), jsxRuntime.jsx(Box__default["default"], Object.assign({ sx: {
|
1409
|
+
display: 'flex',
|
1410
|
+
justifyContent: 'flex-end',
|
1411
|
+
position: stackAlertBanner ? 'relative' : 'absolute',
|
1412
|
+
right: 0,
|
1413
|
+
top: 0,
|
1414
|
+
} }, { children: enablePagination &&
|
1415
|
+
['bottom', 'both'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (jsxRuntime.jsx(MRT_TablePagination, { table: table, position: "bottom" })) }))] }))] })));
|
1569
1416
|
};
|
1570
1417
|
|
1571
1418
|
const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
@@ -1573,7 +1420,7 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
1573
1420
|
const { options: { icons: { MoreVertIcon }, localization, muiTableHeadCellColumnActionsButtonProps, }, } = table;
|
1574
1421
|
const { column } = header;
|
1575
1422
|
const { columnDef } = column;
|
1576
|
-
const [anchorEl, setAnchorEl] =
|
1423
|
+
const [anchorEl, setAnchorEl] = react.useState(null);
|
1577
1424
|
const handleClick = (event) => {
|
1578
1425
|
event.stopPropagation();
|
1579
1426
|
event.preventDefault();
|
@@ -1589,15 +1436,11 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
1589
1436
|
})
|
1590
1437
|
: columnDef.muiTableHeadCellColumnActionsButtonProps;
|
1591
1438
|
const iconButtonProps = Object.assign(Object.assign({}, mTableHeadCellColumnActionsButtonProps), mcTableHeadCellColumnActionsButtonProps);
|
1592
|
-
return (
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
? iconButtonProps.sx(theme)
|
1598
|
-
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }),
|
1599
|
-
React__default["default"].createElement(MoreVertIcon, null))),
|
1600
|
-
anchorEl && (React__default["default"].createElement(MRT_ColumnActionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table }))));
|
1439
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ 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 }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.columnActions, onClick: handleClick, size: "small" }, iconButtonProps, { sx: (theme) => (Object.assign({ height: '2rem', m: '-8px -4px', opacity: 0.5, transform: 'scale(0.85) translateX(-4px)', transition: 'opacity 150ms', width: '2rem', '&:hover': {
|
1440
|
+
opacity: 1,
|
1441
|
+
} }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
1442
|
+
? iconButtonProps.sx(theme)
|
1443
|
+
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }, { children: jsxRuntime.jsx(MoreVertIcon, {}) })) })), anchorEl && (jsxRuntime.jsx(MRT_ColumnActionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table }))] }));
|
1601
1444
|
};
|
1602
1445
|
|
1603
1446
|
const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
@@ -1644,8 +1487,8 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1644
1487
|
!rangeFilterIndex &&
|
1645
1488
|
(allowedColumnFilterOptions === undefined ||
|
1646
1489
|
!!(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.length));
|
1647
|
-
const [anchorEl, setAnchorEl] =
|
1648
|
-
const [filterValue, setFilterValue] =
|
1490
|
+
const [anchorEl, setAnchorEl] = react.useState(null);
|
1491
|
+
const [filterValue, setFilterValue] = react.useState(() => {
|
1649
1492
|
var _a, _b;
|
1650
1493
|
return isMultiSelectFilter
|
1651
1494
|
? column.getFilterValue() || []
|
@@ -1653,7 +1496,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1653
1496
|
? ((_a = column.getFilterValue()) === null || _a === void 0 ? void 0 : _a[rangeFilterIndex]) || []
|
1654
1497
|
: (_b = column.getFilterValue()) !== null && _b !== void 0 ? _b : '';
|
1655
1498
|
});
|
1656
|
-
const handleChangeDebounced =
|
1499
|
+
const handleChangeDebounced = react.useCallback(utils.debounce((event) => {
|
1657
1500
|
const value = textFieldProps.type === 'date'
|
1658
1501
|
? event.target.valueAsDate
|
1659
1502
|
: textFieldProps.type === 'number'
|
@@ -1703,8 +1546,8 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1703
1546
|
const handleFilterMenuOpen = (event) => {
|
1704
1547
|
setAnchorEl(event.currentTarget);
|
1705
1548
|
};
|
1706
|
-
const isMounted =
|
1707
|
-
|
1549
|
+
const isMounted = react.useRef(false);
|
1550
|
+
react.useEffect(() => {
|
1708
1551
|
if (isMounted.current) {
|
1709
1552
|
const filterValue = column.getFilterValue();
|
1710
1553
|
if (filterValue === undefined) {
|
@@ -1720,100 +1563,83 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1720
1563
|
isMounted.current = true;
|
1721
1564
|
}, [column.getFilterValue()]);
|
1722
1565
|
if (columnDef.Filter) {
|
1723
|
-
return (
|
1566
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (_f = columnDef.Filter) === null || _f === void 0 ? void 0 : _f.call(columnDef, { column, header, rangeFilterIndex, table }) }));
|
1724
1567
|
}
|
1725
|
-
return (
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
},
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1568
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(TextField__default["default"], Object.assign({ fullWidth: true, inputProps: {
|
1569
|
+
disabled: !!filterChipLabel,
|
1570
|
+
sx: {
|
1571
|
+
textOverflow: 'ellipsis',
|
1572
|
+
width: filterChipLabel ? 0 : undefined,
|
1573
|
+
},
|
1574
|
+
title: filterPlaceholder,
|
1575
|
+
}, helperText: showChangeModeButton ? (jsxRuntime.jsx("label", { children: localization.filterMode.replace('{filterType}',
|
1576
|
+
// @ts-ignore
|
1577
|
+
localization[`filter${((_g = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _g === void 0 ? void 0 : _g.toUpperCase()) +
|
1578
|
+
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null, FormHelperTextProps: {
|
1579
|
+
sx: {
|
1580
|
+
fontSize: '0.75rem',
|
1581
|
+
lineHeight: '0.8rem',
|
1582
|
+
whiteSpace: 'nowrap',
|
1583
|
+
},
|
1584
|
+
}, margin: "none", placeholder: filterChipLabel || isSelectFilter || isMultiSelectFilter
|
1585
|
+
? undefined
|
1586
|
+
: filterPlaceholder, onChange: handleChange, onClick: (e) => e.stopPropagation(), select: isSelectFilter || isMultiSelectFilter, value: filterValue !== null && filterValue !== void 0 ? filterValue : '', variant: "standard", InputProps: {
|
1587
|
+
startAdornment: showChangeModeButton ? (jsxRuntime.jsxs(InputAdornment__default["default"], Object.assign({ position: "start" }, { children: [jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, title: localization.changeFilterMode }, { children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.changeFilterMode, onClick: handleFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' } }, { children: jsxRuntime.jsx(FilterListIcon, {}) })) }) })), filterChipLabel && (jsxRuntime.jsx(Chip__default["default"], { onDelete: handleClearEmptyFilterChip, label: filterChipLabel }))] }))) : null,
|
1588
|
+
endAdornment: !filterChipLabel && (jsxRuntime.jsx(InputAdornment__default["default"], Object.assign({ position: "end" }, { children: jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, placement: "right", title: (_h = localization.clearFilter) !== null && _h !== void 0 ? _h : '' }, { children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.clearFilter, disabled: !((_j = filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString()) === null || _j === void 0 ? void 0 : _j.length), onClick: handleClear, size: "small", sx: {
|
1589
|
+
height: '1.75rem',
|
1590
|
+
width: '1.75rem',
|
1591
|
+
} }, { children: jsxRuntime.jsx(CloseIcon, {}) })) }) })) }))),
|
1592
|
+
}, SelectProps: {
|
1593
|
+
displayEmpty: true,
|
1594
|
+
multiple: isMultiSelectFilter,
|
1595
|
+
renderValue: isMultiSelectFilter
|
1596
|
+
? (selected) => !(selected === null || selected === void 0 ? void 0 : selected.length) ? (jsxRuntime.jsx(Box__default["default"], Object.assign({ sx: { opacity: 0.5 } }, { children: filterPlaceholder }))) : (jsxRuntime.jsx(Box__default["default"], Object.assign({ sx: { display: 'flex', flexWrap: 'wrap', gap: '2px' } }, { children: selected === null || selected === void 0 ? void 0 : selected.map((value) => {
|
1597
|
+
var _a;
|
1598
|
+
const selectedValue = (_a = columnDef.filterSelectOptions) === null || _a === void 0 ? void 0 : _a.find((option) => option instanceof Object
|
1599
|
+
? option.value === value
|
1600
|
+
: option === value);
|
1601
|
+
return (jsxRuntime.jsx(Chip__default["default"], { label: selectedValue instanceof Object
|
1602
|
+
? selectedValue.text
|
1603
|
+
: selectedValue }, value));
|
1604
|
+
}) })))
|
1605
|
+
: undefined,
|
1606
|
+
} }, textFieldProps, { inputRef: (inputRef) => {
|
1607
|
+
filterInputRefs.current[`${column.id}-${rangeFilterIndex !== null && rangeFilterIndex !== void 0 ? rangeFilterIndex : 0}`] =
|
1608
|
+
inputRef;
|
1609
|
+
if (textFieldProps.inputRef) {
|
1610
|
+
textFieldProps.inputRef = inputRef;
|
1611
|
+
}
|
1612
|
+
}, sx: (theme) => (Object.assign({ p: 0, minWidth: isRangeFilter
|
1613
|
+
? '100px'
|
1614
|
+
: !filterChipLabel
|
1615
|
+
? '120px'
|
1616
|
+
: 'auto', width: 'calc(100% + 4px)', mx: '-2px', '& .MuiSelect-icon': {
|
1617
|
+
mr: '1.5rem',
|
1618
|
+
} }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
|
1619
|
+
? textFieldProps.sx(theme)
|
1620
|
+
: textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx))) }, { children: [(isSelectFilter || isMultiSelectFilter) && (jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ divider: true, disabled: true, hidden: true, value: "" }, { children: jsxRuntime.jsx(Box__default["default"], Object.assign({ sx: { opacity: 0.5 } }, { children: filterPlaceholder })) }))), (_k = textFieldProps.children) !== null && _k !== void 0 ? _k : (_l = columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterSelectOptions) === null || _l === void 0 ? void 0 : _l.map((option) => {
|
1764
1621
|
var _a;
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
:
|
1782
|
-
? '120px'
|
1783
|
-
: 'auto', width: 'calc(100% + 4px)', mx: '-2px', '& .MuiSelect-icon': {
|
1784
|
-
mr: '1.5rem',
|
1785
|
-
} }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
|
1786
|
-
? textFieldProps.sx(theme)
|
1787
|
-
: textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx))) }),
|
1788
|
-
(isSelectFilter || isMultiSelectFilter) && (React__default["default"].createElement(MenuItem__default["default"], { divider: true, disabled: true, hidden: true, value: "" },
|
1789
|
-
React__default["default"].createElement(Box__default["default"], { sx: { opacity: 0.5 } }, filterPlaceholder))), (_k = textFieldProps.children) !== null && _k !== void 0 ? _k : (_l = columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterSelectOptions) === null || _l === void 0 ? void 0 : _l.map((option) => {
|
1790
|
-
var _a;
|
1791
|
-
let value;
|
1792
|
-
let text;
|
1793
|
-
if (typeof option !== 'object') {
|
1794
|
-
value = option;
|
1795
|
-
text = option;
|
1796
|
-
}
|
1797
|
-
else {
|
1798
|
-
value = option.value;
|
1799
|
-
text = option.text;
|
1800
|
-
}
|
1801
|
-
return (React__default["default"].createElement(MenuItem__default["default"], { key: value, sx: {
|
1802
|
-
display: 'flex',
|
1803
|
-
m: 0,
|
1804
|
-
alignItems: 'center',
|
1805
|
-
gap: '0.5rem',
|
1806
|
-
}, value: value },
|
1807
|
-
isMultiSelectFilter && (React__default["default"].createElement(Checkbox__default["default"], { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })),
|
1808
|
-
text));
|
1809
|
-
})),
|
1810
|
-
React__default["default"].createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table, setFilterValue: setFilterValue })));
|
1622
|
+
let value;
|
1623
|
+
let text;
|
1624
|
+
if (typeof option !== 'object') {
|
1625
|
+
value = option;
|
1626
|
+
text = option;
|
1627
|
+
}
|
1628
|
+
else {
|
1629
|
+
value = option.value;
|
1630
|
+
text = option.text;
|
1631
|
+
}
|
1632
|
+
return (jsxRuntime.jsxs(MenuItem__default["default"], Object.assign({ sx: {
|
1633
|
+
display: 'flex',
|
1634
|
+
m: 0,
|
1635
|
+
alignItems: 'center',
|
1636
|
+
gap: '0.5rem',
|
1637
|
+
}, value: value }, { children: [isMultiSelectFilter && (jsxRuntime.jsx(Checkbox__default["default"], { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })), text] }), value));
|
1638
|
+
})] })), jsxRuntime.jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table, setFilterValue: setFilterValue })] }));
|
1811
1639
|
};
|
1812
1640
|
|
1813
1641
|
const MRT_FilterRangeFields = ({ header, table }) => {
|
1814
|
-
return (
|
1815
|
-
React__default["default"].createElement(MRT_FilterTextField, { header: header, rangeFilterIndex: 0, table: table }),
|
1816
|
-
React__default["default"].createElement(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })));
|
1642
|
+
return (jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: { display: 'grid', gridTemplateColumns: '6fr 6fr', gap: '1rem' } }, { children: [jsxRuntime.jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 0, table: table }), jsxRuntime.jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })] })));
|
1817
1643
|
};
|
1818
1644
|
|
1819
1645
|
const MRT_FilterCheckbox = ({ column, table }) => {
|
@@ -1835,8 +1661,7 @@ const MRT_FilterCheckbox = ({ column, table }) => {
|
|
1835
1661
|
: columnDef.muiTableHeadCellFilterCheckboxProps;
|
1836
1662
|
const checkboxProps = Object.assign(Object.assign({}, mTableHeadCellFilterCheckboxProps), mcTableHeadCellFilterCheckboxProps);
|
1837
1663
|
const filterLabel = (_a = localization.filterByColumn) === null || _a === void 0 ? void 0 : _a.replace('{column}', columnDef.header);
|
1838
|
-
return (
|
1839
|
-
React__default["default"].createElement(FormControlLabel__default["default"], { control: React__default["default"].createElement(Checkbox__default["default"], Object.assign({ checked: column.getFilterValue() === 'true', indeterminate: column.getFilterValue() === undefined, color: column.getFilterValue() === undefined ? 'default' : 'primary', size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
|
1664
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : filterLabel }, { children: jsxRuntime.jsx(FormControlLabel__default["default"], { control: jsxRuntime.jsx(Checkbox__default["default"], Object.assign({ checked: column.getFilterValue() === 'true', indeterminate: column.getFilterValue() === undefined, color: column.getFilterValue() === undefined ? 'default' : 'primary', size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
|
1840
1665
|
var _a;
|
1841
1666
|
e.stopPropagation();
|
1842
1667
|
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
@@ -1850,7 +1675,7 @@ const MRT_FilterCheckbox = ({ column, table }) => {
|
|
1850
1675
|
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onChange) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e, checked);
|
1851
1676
|
}, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, ((checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx) instanceof Function
|
1852
1677
|
? checkboxProps.sx(theme)
|
1853
|
-
: 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 })));
|
1678
|
+
: 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 }) })));
|
1854
1679
|
};
|
1855
1680
|
|
1856
1681
|
const MRT_TableHeadCellFilterContainer = ({ header, table }) => {
|
@@ -1858,8 +1683,8 @@ const MRT_TableHeadCellFilterContainer = ({ header, table }) => {
|
|
1858
1683
|
const { showColumnFilters } = getState();
|
1859
1684
|
const { column } = header;
|
1860
1685
|
const { columnDef } = column;
|
1861
|
-
return (
|
1862
|
-
|
1686
|
+
return (jsxRuntime.jsx(Collapse__default["default"], Object.assign({ in: showColumnFilters, mountOnEnter: true, unmountOnExit: true }, { children: columnDef.filterVariant === 'checkbox' ? (jsxRuntime.jsx(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range' ||
|
1687
|
+
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (jsxRuntime.jsx(MRT_FilterRangeFields, { header: header, table: table })) : (jsxRuntime.jsx(MRT_FilterTextField, { header: header, table: table })) })));
|
1863
1688
|
};
|
1864
1689
|
|
1865
1690
|
const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
@@ -1880,12 +1705,9 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
1880
1705
|
? column.getFilterValue().join(`" ${isRangeFilter ? localization.and : localization.or} "`)
|
1881
1706
|
: column.getFilterValue()}"`)
|
1882
1707
|
.replace('" "', '');
|
1883
|
-
return (
|
1708
|
+
return (jsxRuntime.jsx(Grow__default["default"], Object.assign({ unmountOnExit: true, in: (!!column.getFilterValue() && !isRangeFilter) ||
|
1884
1709
|
(isRangeFilter && // @ts-ignore
|
1885
|
-
(!!((_b = column.getFilterValue()) === null || _b === void 0 ? void 0 : _b[0]) || !!((_c = column.getFilterValue()) === null || _c === void 0 ? void 0 : _c[1]))) },
|
1886
|
-
React__default["default"].createElement(Box__default["default"], { component: "span", sx: { flex: '0 0' } },
|
1887
|
-
React__default["default"].createElement(Tooltip__default["default"], { arrow: true, placement: "top", title: filterTooltip },
|
1888
|
-
React__default["default"].createElement(IconButton__default["default"], { disableRipple: true, onClick: (event) => {
|
1710
|
+
(!!((_b = column.getFilterValue()) === null || _b === void 0 ? void 0 : _b[0]) || !!((_c = column.getFilterValue()) === null || _c === void 0 ? void 0 : _c[1]))) }, { children: jsxRuntime.jsx(Box__default["default"], Object.assign({ component: "span", sx: { flex: '0 0' } }, { children: jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, placement: "top", title: filterTooltip }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ disableRipple: true, onClick: (event) => {
|
1889
1711
|
setShowColumnFilters(true);
|
1890
1712
|
queueMicrotask(() => {
|
1891
1713
|
var _a, _b;
|
@@ -1900,8 +1722,7 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
1900
1722
|
p: '2px',
|
1901
1723
|
transform: 'scale(0.66)',
|
1902
1724
|
width: '12px',
|
1903
|
-
} },
|
1904
|
-
React__default["default"].createElement(FilterAltIcon, null))))));
|
1725
|
+
} }, { children: jsxRuntime.jsx(FilterAltIcon, {}) })) })) })) })));
|
1905
1726
|
};
|
1906
1727
|
|
1907
1728
|
const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
@@ -1935,7 +1756,7 @@ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
|
1935
1756
|
setDraggingColumn(null);
|
1936
1757
|
setHoveredColumn(null);
|
1937
1758
|
};
|
1938
|
-
return (
|
1759
|
+
return (jsxRuntime.jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
|
1939
1760
|
};
|
1940
1761
|
|
1941
1762
|
const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
@@ -1943,7 +1764,7 @@ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
|
1943
1764
|
const { getState, options: { columnResizeMode }, setColumnSizingInfo, } = table;
|
1944
1765
|
const { density } = getState();
|
1945
1766
|
const { column } = header;
|
1946
|
-
return (
|
1767
|
+
return (jsxRuntime.jsx(Box__default["default"], Object.assign({ className: "Mui-TableHeadCell-ResizeHandle-Wrapper", onDoubleClick: () => {
|
1947
1768
|
setColumnSizingInfo((old) => (Object.assign(Object.assign({}, old), { isResizingColumn: false })));
|
1948
1769
|
column.resetSize();
|
1949
1770
|
}, onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), sx: (theme) => ({
|
@@ -1960,8 +1781,7 @@ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
|
1960
1781
|
transform: column.getIsResizing() && columnResizeMode === 'onEnd'
|
1961
1782
|
? `translateX(${(_a = getState().columnSizingInfo.deltaOffset) !== null && _a !== void 0 ? _a : 0}px)`
|
1962
1783
|
: undefined,
|
1963
|
-
} },
|
1964
|
-
React__default["default"].createElement(Divider__default["default"], { className: "Mui-TableHeadCell-ResizeHandle-Divider", flexItem: true, orientation: "vertical", sx: {
|
1784
|
+
} }, { children: jsxRuntime.jsx(Divider__default["default"], { className: "Mui-TableHeadCell-ResizeHandle-Divider", flexItem: true, orientation: "vertical", sx: {
|
1965
1785
|
borderRadius: '2px',
|
1966
1786
|
borderWidth: '2px',
|
1967
1787
|
height: '24px',
|
@@ -1971,7 +1791,7 @@ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
|
1971
1791
|
: 'all 150ms ease-in-out',
|
1972
1792
|
userSelect: 'none',
|
1973
1793
|
zIndex: 4,
|
1974
|
-
} })));
|
1794
|
+
} }) })));
|
1975
1795
|
};
|
1976
1796
|
|
1977
1797
|
const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
|
@@ -1984,9 +1804,7 @@ const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
|
|
1984
1804
|
? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
|
1985
1805
|
: localization.sortedByColumnAsc.replace('{column}', columnDef.header)
|
1986
1806
|
: localization.unsorted;
|
1987
|
-
return (
|
1988
|
-
React__default["default"].createElement(Badge__default["default"], { badgeContent: sorting.length > 1 ? column.getSortIndex() + 1 : 0, overlap: "circular" },
|
1989
|
-
React__default["default"].createElement(TableSortLabel__default["default"], { "aria-label": sortTooltip, active: !!column.getIsSorted(), direction: column.getIsSorted()
|
1807
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, placement: "top", title: sortTooltip }, { children: jsxRuntime.jsx(Badge__default["default"], Object.assign({ badgeContent: sorting.length > 1 ? column.getSortIndex() + 1 : 0, overlap: "circular" }, { children: jsxRuntime.jsx(TableSortLabel__default["default"], { "aria-label": sortTooltip, active: !!column.getIsSorted(), direction: column.getIsSorted()
|
1990
1808
|
? column.getIsSorted()
|
1991
1809
|
: undefined, sx: {
|
1992
1810
|
flex: '0 0',
|
@@ -1998,7 +1816,7 @@ const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
|
|
1998
1816
|
var _a;
|
1999
1817
|
e.stopPropagation();
|
2000
1818
|
(_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(e);
|
2001
|
-
} }))));
|
1819
|
+
} }) })) })));
|
2002
1820
|
};
|
2003
1821
|
|
2004
1822
|
const MRT_TableHeadCell = ({ header, table }) => {
|
@@ -2025,7 +1843,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
2025
1843
|
(enableGrouping &&
|
2026
1844
|
columnDef.enableGrouping !== false &&
|
2027
1845
|
!grouping.includes(column.id)));
|
2028
|
-
const headerPL =
|
1846
|
+
const headerPL = react.useMemo(() => {
|
2029
1847
|
let pl = 0;
|
2030
1848
|
if (column.getCanSort())
|
2031
1849
|
pl++;
|
@@ -2035,7 +1853,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
2035
1853
|
pl += 1.25;
|
2036
1854
|
return pl;
|
2037
1855
|
}, [showColumnActions, showDragHandle]);
|
2038
|
-
const draggingBorder =
|
1856
|
+
const draggingBorder = react.useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
2039
1857
|
? `1px dashed ${theme.palette.text.secondary}`
|
2040
1858
|
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
2041
1859
|
? `2px dashed ${theme.palette.primary.main}`
|
@@ -2062,7 +1880,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
2062
1880
|
table,
|
2063
1881
|
})
|
2064
1882
|
: (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) !== null && _b !== void 0 ? _b : columnDef.header;
|
2065
|
-
return (
|
1883
|
+
return (jsxRuntime.jsxs(TableCell__default["default"], Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
|
2066
1884
|
if (node) {
|
2067
1885
|
tableHeadCellRefs.current[column.id] = node;
|
2068
1886
|
}
|
@@ -2092,49 +1910,39 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
2092
1910
|
table,
|
2093
1911
|
tableCellProps,
|
2094
1912
|
theme,
|
2095
|
-
})), draggingBorders)) }
|
2096
|
-
header.isPlaceholder ? null : (React__default["default"].createElement(Box__default["default"], { className: "Mui-TableHeadCell-Content", sx: {
|
2097
|
-
alignItems: 'center',
|
2098
|
-
display: 'flex',
|
2099
|
-
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
2100
|
-
justifyContent: columnDefType === 'group' || (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
2101
|
-
? 'center'
|
2102
|
-
: column.getCanResize()
|
2103
|
-
? 'space-between'
|
2104
|
-
: 'flex-start',
|
2105
|
-
position: 'relative',
|
2106
|
-
width: '100%',
|
2107
|
-
} },
|
2108
|
-
React__default["default"].createElement(Box__default["default"], { className: "Mui-TableHeadCell-Content-Labels", onClick: column.getToggleSortingHandler(), sx: {
|
1913
|
+
})), draggingBorders)) }, { children: [header.isPlaceholder ? null : (jsxRuntime.jsxs(Box__default["default"], Object.assign({ className: "Mui-TableHeadCell-Content", sx: {
|
2109
1914
|
alignItems: 'center',
|
2110
|
-
cursor: column.getCanSort() && columnDefType !== 'group'
|
2111
|
-
? 'pointer'
|
2112
|
-
: undefined,
|
2113
1915
|
display: 'flex',
|
2114
1916
|
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
2115
|
-
|
2116
|
-
|
2117
|
-
|
2118
|
-
|
2119
|
-
|
2120
|
-
|
2121
|
-
|
2122
|
-
|
2123
|
-
|
2124
|
-
|
2125
|
-
|
2126
|
-
|
2127
|
-
|
2128
|
-
|
2129
|
-
|
2130
|
-
|
2131
|
-
|
2132
|
-
|
2133
|
-
|
2134
|
-
|
2135
|
-
|
2136
|
-
|
2137
|
-
|
1917
|
+
justifyContent: columnDefType === 'group' || (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
1918
|
+
? 'center'
|
1919
|
+
: column.getCanResize()
|
1920
|
+
? 'space-between'
|
1921
|
+
: 'flex-start',
|
1922
|
+
position: 'relative',
|
1923
|
+
width: '100%',
|
1924
|
+
} }, { children: [jsxRuntime.jsxs(Box__default["default"], Object.assign({ className: "Mui-TableHeadCell-Content-Labels", onClick: column.getToggleSortingHandler(), sx: {
|
1925
|
+
alignItems: 'center',
|
1926
|
+
cursor: column.getCanSort() && columnDefType !== 'group'
|
1927
|
+
? 'pointer'
|
1928
|
+
: undefined,
|
1929
|
+
display: 'flex',
|
1930
|
+
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
1931
|
+
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
1932
|
+
pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
1933
|
+
? `${headerPL}rem`
|
1934
|
+
: undefined,
|
1935
|
+
} }, { children: [jsxRuntime.jsx(Box__default["default"], Object.assign({ className: "Mui-TableHeadCell-Content-Wrapper", sx: {
|
1936
|
+
minWidth: `${Math.min((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0, 5)}ch`,
|
1937
|
+
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
1938
|
+
textOverflow: 'ellipsis',
|
1939
|
+
whiteSpace: ((_g = (_f = columnDef.header) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0) < 20 ? 'nowrap' : 'normal',
|
1940
|
+
'&:hover': {
|
1941
|
+
textOverflow: 'clip',
|
1942
|
+
},
|
1943
|
+
}, title: columnDefType === 'data' ? columnDef.header : undefined }, { children: headerElement })), column.getCanSort() && (jsxRuntime.jsx(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps })), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table }))] })), columnDefType !== 'group' && (jsxRuntime.jsxs(Box__default["default"], Object.assign({ className: "Mui-TableHeadCell-Content-Actions", sx: { whiteSpace: 'nowrap' } }, { children: [showDragHandle && (jsxRuntime.jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
|
1944
|
+
current: tableHeadCellRefs.current[column.id],
|
1945
|
+
} })), showColumnActions && (jsxRuntime.jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] }))), column.getCanResize() && (jsxRuntime.jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] }))), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
|
2138
1946
|
};
|
2139
1947
|
|
2140
1948
|
const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
@@ -2142,17 +1950,14 @@ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLe
|
|
2142
1950
|
const tableRowProps = muiTableHeadRowProps instanceof Function
|
2143
1951
|
? muiTableHeadRowProps({ headerGroup, table })
|
2144
1952
|
: muiTableHeadRowProps;
|
2145
|
-
return (
|
1953
|
+
return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.04), boxShadow: `4px 0 8px ${styles.alpha(theme.palette.common.black, 0.1)}`, display: layoutMode === 'grid' ? 'flex' : 'table-row', top: 0 }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
2146
1954
|
? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
|
2147
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))) }),
|
2148
|
-
|
2149
|
-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
return (React__default["default"].createElement(MRT_TableHeadCell, { header: header, key: header.id, table: table }));
|
2154
|
-
}),
|
2155
|
-
virtualPaddingRight ? (React__default["default"].createElement("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null));
|
1955
|
+
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))) }, { children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
|
1956
|
+
const header = virtualColumns
|
1957
|
+
? headerGroup.headers[headerOrVirtualHeader.index]
|
1958
|
+
: headerOrVirtualHeader;
|
1959
|
+
return (jsxRuntime.jsx(MRT_TableHeadCell, { header: header, table: table }, header.id));
|
1960
|
+
}), virtualPaddingRight ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
2156
1961
|
};
|
2157
1962
|
|
2158
1963
|
const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
@@ -2162,9 +1967,9 @@ const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddi
|
|
2162
1967
|
? muiTableHeadProps({ table })
|
2163
1968
|
: muiTableHeadProps;
|
2164
1969
|
const stickyHeader = enableStickyHeader || isFullScreen;
|
2165
|
-
return (
|
1970
|
+
return (jsxRuntime.jsx(TableHead__default["default"], Object.assign({}, tableHeadProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: 0.97, position: stickyHeader ? 'sticky' : 'relative', top: stickyHeader && layoutMode === 'grid' ? 0 : undefined, zIndex: stickyHeader ? 2 : undefined }, ((tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx) instanceof Function
|
2166
1971
|
? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
|
2167
|
-
: tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))) }
|
1972
|
+
: tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))) }, { children: getHeaderGroups().map((headerGroup) => (jsxRuntime.jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id))) })));
|
2168
1973
|
};
|
2169
1974
|
|
2170
1975
|
const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
@@ -2173,7 +1978,7 @@ const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
|
2173
1978
|
const { column, row } = cell;
|
2174
1979
|
const { columnDef } = column;
|
2175
1980
|
const { editingRow } = getState();
|
2176
|
-
const [value, setValue] =
|
1981
|
+
const [value, setValue] = react.useState(() => cell.getValue());
|
2177
1982
|
const mTableBodyCellEditTextFieldProps = muiTableBodyCellEditTextFieldProps instanceof Function
|
2178
1983
|
? muiTableBodyCellEditTextFieldProps({ cell, column, row, table })
|
2179
1984
|
: muiTableBodyCellEditTextFieldProps;
|
@@ -2214,9 +2019,9 @@ const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
|
2214
2019
|
}
|
2215
2020
|
};
|
2216
2021
|
if (columnDef.Edit) {
|
2217
|
-
return
|
2022
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table }) });
|
2218
2023
|
}
|
2219
|
-
return (
|
2024
|
+
return (jsxRuntime.jsx(TextField__default["default"], Object.assign({ disabled: (columnDef.enableEditing instanceof Function
|
2220
2025
|
? columnDef.enableEditing(row)
|
2221
2026
|
: columnDef.enableEditing) === false, fullWidth: true, inputRef: (inputRef) => {
|
2222
2027
|
if (inputRef) {
|
@@ -2229,24 +2034,24 @@ const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
|
2229
2034
|
var _a;
|
2230
2035
|
e.stopPropagation();
|
2231
2036
|
(_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
|
2232
|
-
}, onBlur: handleBlur, onChange: handleChange, onKeyDown: handleEnterKeyDown }
|
2233
|
-
|
2234
|
-
|
2235
|
-
|
2236
|
-
|
2237
|
-
|
2238
|
-
|
2239
|
-
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2243
|
-
|
2244
|
-
|
2245
|
-
|
2246
|
-
|
2247
|
-
|
2248
|
-
|
2249
|
-
|
2037
|
+
}, onBlur: handleBlur, onChange: handleChange, onKeyDown: handleEnterKeyDown }, { children: (_b = textFieldProps.children) !== null && _b !== void 0 ? _b : (_c = columnDef === null || columnDef === void 0 ? void 0 : columnDef.editSelectOptions) === null || _c === void 0 ? void 0 : _c.map((option) => {
|
2038
|
+
let value;
|
2039
|
+
let text;
|
2040
|
+
if (typeof option !== 'object') {
|
2041
|
+
value = option;
|
2042
|
+
text = option;
|
2043
|
+
}
|
2044
|
+
else {
|
2045
|
+
value = option.value;
|
2046
|
+
text = option.text;
|
2047
|
+
}
|
2048
|
+
return (jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ sx: {
|
2049
|
+
display: 'flex',
|
2050
|
+
m: 0,
|
2051
|
+
alignItems: 'center',
|
2052
|
+
gap: '0.5rem',
|
2053
|
+
}, value: value }, { children: text }), value));
|
2054
|
+
}) })));
|
2250
2055
|
};
|
2251
2056
|
|
2252
2057
|
const MRT_CopyButton = ({ cell, children, table, }) => {
|
@@ -2254,7 +2059,7 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
|
|
2254
2059
|
const { options: { localization, muiTableBodyCellCopyButtonProps }, } = table;
|
2255
2060
|
const { column, row } = cell;
|
2256
2061
|
const { columnDef } = column;
|
2257
|
-
const [copied, setCopied] =
|
2062
|
+
const [copied, setCopied] = react.useState(false);
|
2258
2063
|
const handleCopy = (event, text) => {
|
2259
2064
|
event.stopPropagation();
|
2260
2065
|
navigator.clipboard.writeText(text);
|
@@ -2273,10 +2078,9 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
|
|
2273
2078
|
})
|
2274
2079
|
: columnDef.muiTableBodyCellCopyButtonProps;
|
2275
2080
|
const buttonProps = Object.assign(Object.assign({}, mTableBodyCellCopyButtonProps), mcTableBodyCellCopyButtonProps);
|
2276
|
-
return (
|
2277
|
-
React__default["default"].createElement(Button__default["default"], Object.assign({ onClick: (e) => handleCopy(e, cell.getValue()), size: "small", type: "button", variant: "text" }, buttonProps, { sx: (theme) => (Object.assign({ backgroundColor: 'transparent', border: 'none', color: 'inherit', cursor: 'copy', fontFamily: 'inherit', fontSize: 'inherit', letterSpacing: 'inherit', m: '-0.25rem', minWidth: 'unset', textAlign: 'inherit', textTransform: 'inherit' }, ((buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx) instanceof Function
|
2081
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.title) !== null && _a !== void 0 ? _a : (copied ? localization.copiedToClipboard : localization.clickToCopy) }, { children: jsxRuntime.jsx(Button__default["default"], Object.assign({ onClick: (e) => handleCopy(e, cell.getValue()), size: "small", type: "button", variant: "text" }, buttonProps, { sx: (theme) => (Object.assign({ backgroundColor: 'transparent', border: 'none', color: 'inherit', cursor: 'copy', fontFamily: 'inherit', fontSize: 'inherit', letterSpacing: 'inherit', m: '-0.25rem', minWidth: 'unset', textAlign: 'inherit', textTransform: 'inherit' }, ((buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx) instanceof Function
|
2278
2082
|
? buttonProps.sx(theme)
|
2279
|
-
: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx))), title: undefined }
|
2083
|
+
: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx))), title: undefined }, { children: children })) })));
|
2280
2084
|
};
|
2281
2085
|
|
2282
2086
|
const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table }) => {
|
@@ -2297,7 +2101,7 @@ const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table }) => {
|
|
2297
2101
|
table.setDraggingRow(null);
|
2298
2102
|
table.setHoveredRow(null);
|
2299
2103
|
};
|
2300
|
-
return (
|
2104
|
+
return (jsxRuntime.jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
|
2301
2105
|
};
|
2302
2106
|
|
2303
2107
|
const allowedTypes = ['string', 'number'];
|
@@ -2345,16 +2149,16 @@ const MRT_TableBodyCellValue = ({ cell, table }) => {
|
|
2345
2149
|
matchExactly: (filterValue ? columnDef._filterFn : globalFilterFn) !== 'fuzzy',
|
2346
2150
|
});
|
2347
2151
|
if ((chunks === null || chunks === void 0 ? void 0 : chunks.length) > 1 || ((_b = chunks === null || chunks === void 0 ? void 0 : chunks[0]) === null || _b === void 0 ? void 0 : _b.match)) {
|
2348
|
-
renderedCellValue = (
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
|
2354
|
-
|
2355
|
-
|
2356
|
-
|
2357
|
-
|
2152
|
+
renderedCellValue = (jsxRuntime.jsx("span", Object.assign({ "aria-label": renderedCellValue, role: "note" }, { children: (_c = chunks === null || chunks === void 0 ? void 0 : chunks.map(({ key, match, text }) => (jsxRuntime.jsx(Box__default["default"], Object.assign({ "aria-hidden": "true", component: "span", sx: match
|
2153
|
+
? {
|
2154
|
+
backgroundColor: (theme) => theme.palette.mode === 'dark'
|
2155
|
+
? styles.darken(theme.palette.warning.dark, 0.25)
|
2156
|
+
: styles.lighten(theme.palette.warning.light, 0.5),
|
2157
|
+
borderRadius: '2px',
|
2158
|
+
color: (theme) => theme.palette.mode === 'dark' ? 'white' : 'black',
|
2159
|
+
padding: '2px 1px',
|
2160
|
+
}
|
2161
|
+
: undefined }, { children: text }), key)))) !== null && _c !== void 0 ? _c : renderedCellValue })));
|
2358
2162
|
}
|
2359
2163
|
}
|
2360
2164
|
if (columnDef.Cell && !isGroupedValue) {
|
@@ -2366,7 +2170,7 @@ const MRT_TableBodyCellValue = ({ cell, table }) => {
|
|
2366
2170
|
table,
|
2367
2171
|
});
|
2368
2172
|
}
|
2369
|
-
return
|
2173
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderedCellValue });
|
2370
2174
|
};
|
2371
2175
|
|
2372
2176
|
const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, table, virtualCell, }) => {
|
@@ -2387,14 +2191,14 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
|
|
2387
2191
|
const skeletonProps = muiTableBodyCellSkeletonProps instanceof Function
|
2388
2192
|
? muiTableBodyCellSkeletonProps({ cell, column, row, table })
|
2389
2193
|
: muiTableBodyCellSkeletonProps;
|
2390
|
-
const [skeletonWidth, setSkeletonWidth] =
|
2391
|
-
|
2194
|
+
const [skeletonWidth, setSkeletonWidth] = react.useState(0);
|
2195
|
+
react.useEffect(() => setSkeletonWidth(isLoading || showSkeletons
|
2392
2196
|
? columnDefType === 'display'
|
2393
2197
|
? column.getSize() / 2
|
2394
2198
|
: Math.round(Math.random() * (column.getSize() - column.getSize() / 3) +
|
2395
2199
|
column.getSize() / 3)
|
2396
2200
|
: 100), []);
|
2397
|
-
const draggingBorders =
|
2201
|
+
const draggingBorders = react.useMemo(() => {
|
2398
2202
|
const isDraggingColumn = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id;
|
2399
2203
|
const isHoveredColumn = (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id;
|
2400
2204
|
const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
|
@@ -2461,7 +2265,7 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
|
|
2461
2265
|
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
2462
2266
|
}
|
2463
2267
|
};
|
2464
|
-
return (
|
2268
|
+
return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ "data-index": virtualCell === null || virtualCell === void 0 ? void 0 : virtualCell.index, ref: (node) => {
|
2465
2269
|
if (node) {
|
2466
2270
|
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
2467
2271
|
}
|
@@ -2493,28 +2297,21 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
|
|
2493
2297
|
table,
|
2494
2298
|
theme,
|
2495
2299
|
tableCellProps,
|
2496
|
-
})), draggingBorders)) }),
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2503
|
-
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2507
|
-
|
2508
|
-
|
2509
|
-
})) : isEditing ? (React__default["default"].createElement(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
|
2510
|
-
columnDef.enableClickToCopy !== false ? (React__default["default"].createElement(MRT_CopyButton, { cell: cell, table: table },
|
2511
|
-
React__default["default"].createElement(MRT_TableBodyCellValue, { cell: cell, table: table }))) : (React__default["default"].createElement(MRT_TableBodyCellValue, { cell: cell, table: table })),
|
2512
|
-
cell.getIsGrouped() && !columnDef.GroupedCell && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
2513
|
-
" (", (_d = row.subRows) === null || _d === void 0 ? void 0 :
|
2514
|
-
_d.length,
|
2515
|
-
")")))));
|
2300
|
+
})), draggingBorders)) }, { children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [cell.getIsPlaceholder() ? ((_b = (_a = columnDef.PlaceholderCell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) !== null && _b !== void 0 ? _b : null) : isLoading || showSkeletons ? (jsxRuntime.jsx(Skeleton__default["default"], Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
|
2301
|
+
rowNumberMode === 'static' &&
|
2302
|
+
column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (jsxRuntime.jsx(MRT_TableBodyRowGrabHandle, { cell: cell, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
|
2303
|
+
(column.id === 'mrt-row-select' ||
|
2304
|
+
column.id === 'mrt-row-expand' ||
|
2305
|
+
!row.getIsGrouped()) ? ((_c = columnDef.Cell) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
|
2306
|
+
cell,
|
2307
|
+
renderedCellValue: cell.renderValue(),
|
2308
|
+
column,
|
2309
|
+
row,
|
2310
|
+
table,
|
2311
|
+
})) : isEditing ? (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
|
2312
|
+
columnDef.enableClickToCopy !== false ? (jsxRuntime.jsx(MRT_CopyButton, Object.assign({ cell: cell, table: table }, { children: jsxRuntime.jsx(MRT_TableBodyCellValue, { cell: cell, table: table }) }))) : (jsxRuntime.jsx(MRT_TableBodyCellValue, { cell: cell, table: table })), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [" (", (_d = row.subRows) === null || _d === void 0 ? void 0 : _d.length, ")"] }))] }) })));
|
2516
2313
|
};
|
2517
|
-
const Memo_MRT_TableBodyCell =
|
2314
|
+
const Memo_MRT_TableBodyCell = react.memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
|
2518
2315
|
|
2519
2316
|
const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow, }) => {
|
2520
2317
|
const { getVisibleLeafColumns, getState, options: { layoutMode, muiTableBodyRowProps, muiTableDetailPanelProps, renderDetailPanel, }, } = table;
|
@@ -2530,7 +2327,7 @@ const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow,
|
|
2530
2327
|
const tableCellProps = muiTableDetailPanelProps instanceof Function
|
2531
2328
|
? muiTableDetailPanelProps({ row, table })
|
2532
2329
|
: muiTableDetailPanelProps;
|
2533
|
-
return (
|
2330
|
+
return (jsxRuntime.jsx(TableRow__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
|
2534
2331
|
var _a, _b;
|
2535
2332
|
return (Object.assign({ display: layoutMode === 'grid' ? 'flex' : 'table-row', position: virtualRow ? 'absolute' : undefined, top: virtualRow
|
2536
2333
|
? `${(_b = (_a = parentRowRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height}px`
|
@@ -2539,12 +2336,11 @@ const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow,
|
|
2539
2336
|
: undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
2540
2337
|
? tableRowProps.sx(theme)
|
2541
2338
|
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)));
|
2542
|
-
} }),
|
2543
|
-
React__default["default"].createElement(TableCell__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
|
2339
|
+
} }, { children: jsxRuntime.jsx(TableCell__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
|
2544
2340
|
? styles.lighten(theme.palette.background.default, 0.06)
|
2545
2341
|
: undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: layoutMode === 'grid' ? 'flex' : 'table-cell', pb: row.getIsExpanded() ? '1rem' : 0, pt: row.getIsExpanded() ? '1rem' : 0, transition: 'all 150ms ease-in-out', width: `${table.getTotalSize()}px` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
2546
2342
|
? tableCellProps.sx(theme)
|
2547
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }
|
2343
|
+
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }, { children: renderDetailPanel && (jsxRuntime.jsx(Collapse__default["default"], Object.assign({ in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true }, { children: !isLoading && renderDetailPanel({ row, table }) }))) })) })));
|
2548
2344
|
};
|
2549
2345
|
|
2550
2346
|
const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
|
@@ -2558,54 +2354,49 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, row
|
|
2558
2354
|
setHoveredRow(row);
|
2559
2355
|
}
|
2560
2356
|
};
|
2561
|
-
const rowRef =
|
2562
|
-
return (
|
2563
|
-
|
2564
|
-
|
2565
|
-
|
2566
|
-
|
2567
|
-
}
|
2568
|
-
|
2569
|
-
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2577
|
-
|
2578
|
-
|
2579
|
-
|
2580
|
-
|
2581
|
-
|
2582
|
-
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2586
|
-
|
2587
|
-
|
2588
|
-
|
2589
|
-
|
2590
|
-
|
2591
|
-
|
2592
|
-
|
2593
|
-
|
2594
|
-
|
2595
|
-
|
2596
|
-
|
2597
|
-
|
2598
|
-
|
2599
|
-
|
2600
|
-
|
2601
|
-
!
|
2602
|
-
|
2603
|
-
|
2604
|
-
}),
|
2605
|
-
virtualPaddingRight ? (React__default["default"].createElement("td", { style: { display: 'flex', width: virtualPaddingRight } })) : null),
|
2606
|
-
renderDetailPanel && !row.getIsGrouped() && (React__default["default"].createElement(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, rowIndex: rowIndex, table: table, virtualRow: virtualRow }))));
|
2607
|
-
};
|
2608
|
-
const Memo_MRT_TableBodyRow = React.memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex);
|
2357
|
+
const rowRef = react.useRef(null);
|
2358
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ "data-index": virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.index, onDragEnter: handleDragEnter, selected: row.getIsSelected(), ref: (node) => {
|
2359
|
+
if (node) {
|
2360
|
+
rowRef.current = node;
|
2361
|
+
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
2362
|
+
}
|
2363
|
+
} }, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.06), boxSizing: 'border-box', display: layoutMode === 'grid' ? 'flex' : 'table-row', 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, position: virtualRow ? 'absolute' : undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', top: virtualRow ? 0 : undefined, width: '100%', '&:hover td': {
|
2364
|
+
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
|
2365
|
+
? row.getIsSelected()
|
2366
|
+
? `${styles.alpha(theme.palette.primary.main, 0.2)}`
|
2367
|
+
: theme.palette.mode === 'dark'
|
2368
|
+
? `${styles.lighten(theme.palette.background.default, 0.12)}`
|
2369
|
+
: `${styles.darken(theme.palette.background.default, 0.05)}`
|
2370
|
+
: undefined,
|
2371
|
+
} }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
2372
|
+
? tableRowProps.sx(theme)
|
2373
|
+
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), style: Object.assign({ transform: virtualRow
|
2374
|
+
? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
|
2375
|
+
: undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style) }, { children: [virtualPaddingLeft ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : row.getVisibleCells()).map((cellOrVirtualCell) => {
|
2376
|
+
const cell = columnVirtualizer
|
2377
|
+
? row.getVisibleCells()[cellOrVirtualCell.index]
|
2378
|
+
: cellOrVirtualCell;
|
2379
|
+
const props = {
|
2380
|
+
cell,
|
2381
|
+
key: cell.id,
|
2382
|
+
measureElement: columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement,
|
2383
|
+
numRows,
|
2384
|
+
rowIndex,
|
2385
|
+
rowRef,
|
2386
|
+
table,
|
2387
|
+
virtualCell: columnVirtualizer
|
2388
|
+
? cellOrVirtualCell
|
2389
|
+
: undefined,
|
2390
|
+
};
|
2391
|
+
return memoMode === 'cells' &&
|
2392
|
+
cell.column.columnDef.columnDefType === 'data' &&
|
2393
|
+
!draggingColumn &&
|
2394
|
+
!draggingRow &&
|
2395
|
+
(editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
|
2396
|
+
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (jsxRuntime.jsx(Memo_MRT_TableBodyCell, Object.assign({}, props))) : (jsxRuntime.jsx(MRT_TableBodyCell, Object.assign({}, props)));
|
2397
|
+
}), virtualPaddingRight ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })), renderDetailPanel && !row.getIsGrouped() && (jsxRuntime.jsx(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, rowIndex: rowIndex, table: table, virtualRow: virtualRow }))] }));
|
2398
|
+
};
|
2399
|
+
const Memo_MRT_TableBodyRow = react.memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex);
|
2609
2400
|
|
2610
2401
|
const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
2611
2402
|
var _a, _b, _c, _d;
|
@@ -2620,7 +2411,7 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
2620
2411
|
const vProps = rowVirtualizerProps instanceof Function
|
2621
2412
|
? rowVirtualizerProps({ table })
|
2622
2413
|
: rowVirtualizerProps;
|
2623
|
-
const shouldRankResults =
|
2414
|
+
const shouldRankResults = react.useMemo(() => !manualExpanding &&
|
2624
2415
|
!manualFiltering &&
|
2625
2416
|
!manualGrouping &&
|
2626
2417
|
!manualSorting &&
|
@@ -2639,7 +2430,7 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
2639
2430
|
manualSorting,
|
2640
2431
|
sorting,
|
2641
2432
|
]);
|
2642
|
-
const rows =
|
2433
|
+
const rows = react.useMemo(() => {
|
2643
2434
|
if (!shouldRankResults)
|
2644
2435
|
return getRowModel().rows;
|
2645
2436
|
const rankedRows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
|
@@ -2655,7 +2446,10 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
2655
2446
|
pagination.pageSize,
|
2656
2447
|
]);
|
2657
2448
|
const rowVirtualizer = enableRowVirtualization
|
2658
|
-
? reactVirtual.useVirtualizer(Object.assign(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current,
|
2449
|
+
? reactVirtual.useVirtualizer(Object.assign(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
|
2450
|
+
navigator.userAgent.indexOf('Firefox') === -1
|
2451
|
+
? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
|
2452
|
+
: undefined, overscan: 4 }, vProps_old), vProps))
|
2659
2453
|
: undefined;
|
2660
2454
|
if (rowVirtualizerInstanceRef && rowVirtualizer) {
|
2661
2455
|
rowVirtualizerInstanceRef.current = rowVirtualizer;
|
@@ -2667,45 +2461,44 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
2667
2461
|
const virtualRows = rowVirtualizer
|
2668
2462
|
? rowVirtualizer.getVirtualItems()
|
2669
2463
|
: undefined;
|
2670
|
-
return (
|
2464
|
+
return (jsxRuntime.jsx(TableBody__default["default"], Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', height: rowVirtualizer
|
2671
2465
|
? `${rowVirtualizer.getTotalSize()}px`
|
2672
2466
|
: 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, ((tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx) instanceof Function
|
2673
2467
|
? tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx(theme)
|
2674
|
-
: tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx))) }
|
2675
|
-
|
2676
|
-
|
2677
|
-
|
2678
|
-
|
2679
|
-
|
2680
|
-
|
2681
|
-
|
2682
|
-
|
2683
|
-
|
2684
|
-
|
2685
|
-
|
2686
|
-
|
2687
|
-
|
2688
|
-
|
2689
|
-
|
2690
|
-
|
2691
|
-
|
2692
|
-
|
2693
|
-
|
2694
|
-
|
2695
|
-
|
2696
|
-
|
2697
|
-
|
2698
|
-
|
2699
|
-
|
2700
|
-
|
2701
|
-
|
2702
|
-
|
2703
|
-
|
2704
|
-
|
2705
|
-
|
2706
|
-
}))))));
|
2468
|
+
: tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx))) }, { children: (_a = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _a !== void 0 ? _a : (!rows.length ? (jsxRuntime.jsx("tr", Object.assign({ style: { display: layoutMode === 'grid' ? 'grid' : 'table-row' } }, { children: jsxRuntime.jsx("td", Object.assign({ colSpan: table.getVisibleLeafColumns().length, style: {
|
2469
|
+
display: layoutMode === 'grid' ? 'grid' : 'table-cell',
|
2470
|
+
} }, { children: (_b = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(Typography__default["default"], Object.assign({ sx: {
|
2471
|
+
color: 'text.secondary',
|
2472
|
+
fontStyle: 'italic',
|
2473
|
+
maxWidth: `min(100vw, ${(_d = (_c = tablePaperRef.current) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 360}px)`,
|
2474
|
+
py: '2rem',
|
2475
|
+
textAlign: 'center',
|
2476
|
+
width: '100%',
|
2477
|
+
} }, { children: globalFilter || columnFilters.length
|
2478
|
+
? localization.noResultsFound
|
2479
|
+
: localization.noRecordsToDisplay }))) })) }))) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
|
2480
|
+
const row = rowVirtualizer
|
2481
|
+
? rows[rowOrVirtualRow.index]
|
2482
|
+
: rowOrVirtualRow;
|
2483
|
+
const props = {
|
2484
|
+
columnVirtualizer,
|
2485
|
+
key: row.id,
|
2486
|
+
measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
|
2487
|
+
numRows: rows.length,
|
2488
|
+
row,
|
2489
|
+
rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex,
|
2490
|
+
table,
|
2491
|
+
virtualColumns,
|
2492
|
+
virtualPaddingLeft,
|
2493
|
+
virtualPaddingRight,
|
2494
|
+
virtualRow: rowVirtualizer
|
2495
|
+
? rowOrVirtualRow
|
2496
|
+
: undefined,
|
2497
|
+
};
|
2498
|
+
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props))) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props)));
|
2499
|
+
}) }))) })));
|
2707
2500
|
};
|
2708
|
-
const Memo_MRT_TableBody =
|
2501
|
+
const Memo_MRT_TableBody = react.memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
|
2709
2502
|
|
2710
2503
|
const MRT_TableFooterCell = ({ footer, table }) => {
|
2711
2504
|
var _a, _b, _c;
|
@@ -2721,7 +2514,7 @@ const MRT_TableFooterCell = ({ footer, table }) => {
|
|
2721
2514
|
? columnDef.muiTableFooterCellProps({ column, table })
|
2722
2515
|
: columnDef.muiTableFooterCellProps;
|
2723
2516
|
const tableCellProps = Object.assign(Object.assign({}, mTableFooterCellProps), mcTableFooterCellProps);
|
2724
|
-
return (
|
2517
|
+
return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-cell', fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
|
2725
2518
|
? '0.5rem'
|
2726
2519
|
: density === 'comfortable'
|
2727
2520
|
? '1rem'
|
@@ -2730,16 +2523,15 @@ const MRT_TableFooterCell = ({ footer, table }) => {
|
|
2730
2523
|
table,
|
2731
2524
|
theme,
|
2732
2525
|
tableCellProps,
|
2733
|
-
}))) }
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
: columnDef.Footer)) !== null && _b !== void 0 ? _b : columnDef.footer) !== null && _c !== void 0 ? _c : null)));
|
2526
|
+
}))) }, { children: jsxRuntime.jsx(jsxRuntime.Fragment, { children: footer.isPlaceholder
|
2527
|
+
? null
|
2528
|
+
: (_c = (_b = (columnDef.Footer instanceof Function
|
2529
|
+
? (_a = columnDef.Footer) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
|
2530
|
+
column,
|
2531
|
+
footer,
|
2532
|
+
table,
|
2533
|
+
})
|
2534
|
+
: columnDef.Footer)) !== null && _b !== void 0 ? _b : columnDef.footer) !== null && _c !== void 0 ? _c : null }) })));
|
2743
2535
|
};
|
2744
2536
|
|
2745
2537
|
const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
@@ -2753,17 +2545,14 @@ const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPadding
|
|
2753
2545
|
const tableRowProps = muiTableFooterRowProps instanceof Function
|
2754
2546
|
? muiTableFooterRowProps({ footerGroup, table })
|
2755
2547
|
: muiTableFooterRowProps;
|
2756
|
-
return (
|
2548
|
+
return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.04), display: layoutMode === 'grid' ? 'flex' : 'table-row', width: '100%' }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
2757
2549
|
? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
|
2758
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))) }),
|
2759
|
-
|
2760
|
-
|
2761
|
-
|
2762
|
-
|
2763
|
-
|
2764
|
-
return (React__default["default"].createElement(MRT_TableFooterCell, { footer: footer, key: footer.id, table: table }));
|
2765
|
-
}),
|
2766
|
-
virtualPaddingRight ? (React__default["default"].createElement("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null));
|
2550
|
+
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))) }, { children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter) => {
|
2551
|
+
const footer = virtualColumns
|
2552
|
+
? footerGroup.headers[footerOrVirtualFooter.index]
|
2553
|
+
: footerOrVirtualFooter;
|
2554
|
+
return (jsxRuntime.jsx(MRT_TableFooterCell, { footer: footer, table: table }, footer.id));
|
2555
|
+
}), virtualPaddingRight ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
2767
2556
|
};
|
2768
2557
|
|
2769
2558
|
const MRT_TableFooter = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
@@ -2773,13 +2562,13 @@ const MRT_TableFooter = ({ table, virtualColumns, virtualPaddingLeft, virtualPad
|
|
2773
2562
|
? muiTableFooterProps({ table })
|
2774
2563
|
: muiTableFooterProps;
|
2775
2564
|
const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
|
2776
|
-
return (
|
2565
|
+
return (jsxRuntime.jsx(TableFooter__default["default"], Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ bottom: stickFooter ? 0 : undefined, display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
|
2777
2566
|
? theme.palette.mode === 'light'
|
2778
2567
|
? `1px solid ${theme.palette.grey[300]}`
|
2779
2568
|
: `1px solid ${theme.palette.grey[700]}`
|
2780
2569
|
: undefined, position: stickFooter ? 'sticky' : undefined, zIndex: stickFooter ? 1 : undefined }, ((tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx) instanceof Function
|
2781
2570
|
? tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx(theme)
|
2782
|
-
: tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))) }
|
2571
|
+
: tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))) }, { children: getFooterGroups().map((footerGroup) => (jsxRuntime.jsx(MRT_TableFooterRow, { footerGroup: footerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, footerGroup.id))) })));
|
2783
2572
|
};
|
2784
2573
|
|
2785
2574
|
const MRT_Table = ({ table }) => {
|
@@ -2792,7 +2581,7 @@ const MRT_Table = ({ table }) => {
|
|
2792
2581
|
const vProps = columnVirtualizerProps instanceof Function
|
2793
2582
|
? columnVirtualizerProps({ table })
|
2794
2583
|
: columnVirtualizerProps;
|
2795
|
-
const columnSizeVars =
|
2584
|
+
const columnSizeVars = react.useMemo(() => {
|
2796
2585
|
const headers = getFlatHeaders();
|
2797
2586
|
const colSizes = {};
|
2798
2587
|
for (let i = 0; i < headers.length; i++) {
|
@@ -2804,7 +2593,7 @@ const MRT_Table = ({ table }) => {
|
|
2804
2593
|
return colSizes;
|
2805
2594
|
}, [columns, columnSizing, columnSizingInfo, columnVisibility]);
|
2806
2595
|
//get first 16 column widths and average them
|
2807
|
-
const averageColumnWidth =
|
2596
|
+
const averageColumnWidth = react.useMemo(() => {
|
2808
2597
|
var _a, _b, _c, _d;
|
2809
2598
|
if (!enableColumnVirtualization)
|
2810
2599
|
return 0;
|
@@ -2813,7 +2602,7 @@ const MRT_Table = ({ table }) => {
|
|
2813
2602
|
.rows[0]) === null || _a === void 0 ? void 0 : _a.getCenterVisibleCells()) === null || _b === void 0 ? void 0 : _b.slice(0, 16)) === null || _c === void 0 ? void 0 : _c.map((cell) => cell.column.getSize() * 1.2)) !== null && _d !== void 0 ? _d : [];
|
2814
2603
|
return columnsWidths.reduce((a, b) => a + b, 0) / columnsWidths.length;
|
2815
2604
|
}, [table.getRowModel().rows, columnPinning, columnVisibility]);
|
2816
|
-
const [leftPinnedIndexes, rightPinnedIndexes] =
|
2605
|
+
const [leftPinnedIndexes, rightPinnedIndexes] = react.useMemo(() => enableColumnVirtualization && enablePinning
|
2817
2606
|
? [
|
2818
2607
|
table.getLeftLeafColumns().map((c) => c.getPinnedIndex()),
|
2819
2608
|
table
|
@@ -2822,7 +2611,7 @@ const MRT_Table = ({ table }) => {
|
|
2822
2611
|
]
|
2823
2612
|
: [[], []], [columnPinning, enableColumnVirtualization, enablePinning]);
|
2824
2613
|
const columnVirtualizer = enableColumnVirtualization
|
2825
|
-
? reactVirtual.useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor:
|
2614
|
+
? reactVirtual.useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: react.useCallback((range) => [
|
2826
2615
|
...new Set([
|
2827
2616
|
...leftPinnedIndexes,
|
2828
2617
|
...reactVirtual.defaultRangeExtractor(range),
|
@@ -2850,19 +2639,16 @@ const MRT_Table = ({ table }) => {
|
|
2850
2639
|
virtualPaddingLeft,
|
2851
2640
|
virtualPaddingRight,
|
2852
2641
|
};
|
2853
|
-
return (
|
2642
|
+
return (jsxRuntime.jsxs(Table__default["default"], Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: layoutMode === 'grid' ? 'grid' : 'table', tableLayout: layoutMode !== 'grid' && enableColumnResizing ? 'fixed' : undefined }, ((tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx) instanceof Function
|
2854
2643
|
? tableProps.sx(theme)
|
2855
|
-
: tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))), style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style) }),
|
2856
|
-
enableTableHead && React__default["default"].createElement(MRT_TableHead, Object.assign({}, props)),
|
2857
|
-
memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (React__default["default"].createElement(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (React__default["default"].createElement(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))),
|
2858
|
-
enableTableFooter && React__default["default"].createElement(MRT_TableFooter, Object.assign({}, props))));
|
2644
|
+
: tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))), style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style) }, { children: [enableTableHead && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, props))] })));
|
2859
2645
|
};
|
2860
2646
|
|
2861
|
-
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ?
|
2647
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
|
2862
2648
|
const MRT_TableContainer = ({ table }) => {
|
2863
2649
|
const { getState, options: { enableStickyHeader, muiTableContainerProps }, refs: { tableContainerRef, bottomToolbarRef, topToolbarRef }, } = table;
|
2864
2650
|
const { isFullScreen } = getState();
|
2865
|
-
const [totalToolbarHeight, setTotalToolbarHeight] =
|
2651
|
+
const [totalToolbarHeight, setTotalToolbarHeight] = react.useState(0);
|
2866
2652
|
const tableContainerProps = muiTableContainerProps instanceof Function
|
2867
2653
|
? muiTableContainerProps({ table })
|
2868
2654
|
: muiTableContainerProps;
|
@@ -2876,7 +2662,7 @@ const MRT_TableContainer = ({ table }) => {
|
|
2876
2662
|
: 0;
|
2877
2663
|
setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
|
2878
2664
|
});
|
2879
|
-
return (
|
2665
|
+
return (jsxRuntime.jsx(TableContainer__default["default"], Object.assign({}, tableContainerProps, { ref: (node) => {
|
2880
2666
|
if (node) {
|
2881
2667
|
tableContainerRef.current = node;
|
2882
2668
|
if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
|
@@ -2890,8 +2676,7 @@ const MRT_TableContainer = ({ table }) => {
|
|
2890
2676
|
? tableContainerProps.sx(theme)
|
2891
2677
|
: tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx))), style: Object.assign({ maxHeight: isFullScreen
|
2892
2678
|
? `calc(100vh - ${totalToolbarHeight}px)`
|
2893
|
-
: undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style) })
|
2894
|
-
React__default["default"].createElement(MRT_Table, { table: table })));
|
2679
|
+
: undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style) }, { children: jsxRuntime.jsx(MRT_Table, { table: table }) })));
|
2895
2680
|
};
|
2896
2681
|
|
2897
2682
|
const MRT_TablePaper = ({ table }) => {
|
@@ -2900,7 +2685,7 @@ const MRT_TablePaper = ({ table }) => {
|
|
2900
2685
|
const tablePaperProps = muiTablePaperProps instanceof Function
|
2901
2686
|
? muiTablePaperProps({ table })
|
2902
2687
|
: muiTablePaperProps;
|
2903
|
-
return (
|
2688
|
+
return (jsxRuntime.jsxs(Paper__default["default"], Object.assign({ elevation: 2 }, tablePaperProps, { ref: (ref) => {
|
2904
2689
|
tablePaperRef.current = ref;
|
2905
2690
|
if (tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.ref) {
|
2906
2691
|
//@ts-ignore
|
@@ -2917,48 +2702,39 @@ const MRT_TablePaper = ({ table }) => {
|
|
2917
2702
|
padding: 0,
|
2918
2703
|
width: '100vw',
|
2919
2704
|
}
|
2920
|
-
: {})) }
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
|
2925
|
-
|
2926
|
-
|
2927
|
-
(renderBottomToolbar instanceof Function
|
2928
|
-
? renderBottomToolbar({ table })
|
2929
|
-
: renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : React__default["default"].createElement(MRT_BottomToolbar, { table: table }))));
|
2705
|
+
: {})) }, { children: [enableTopToolbar &&
|
2706
|
+
(renderTopToolbar instanceof Function
|
2707
|
+
? renderTopToolbar({ table })
|
2708
|
+
: renderTopToolbar !== null && renderTopToolbar !== void 0 ? renderTopToolbar : jsxRuntime.jsx(MRT_TopToolbar, { table: table })), jsxRuntime.jsx(MRT_TableContainer, { table: table }), enableBottomToolbar &&
|
2709
|
+
(renderBottomToolbar instanceof Function
|
2710
|
+
? renderBottomToolbar({ table })
|
2711
|
+
: renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : jsxRuntime.jsx(MRT_BottomToolbar, { table: table }))] })));
|
2930
2712
|
};
|
2931
2713
|
|
2932
2714
|
const MRT_EditRowModal = ({ open, row, table, }) => {
|
2933
2715
|
const { options: { localization }, } = table;
|
2934
|
-
return (
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2938
|
-
|
2939
|
-
|
2940
|
-
|
2941
|
-
|
2942
|
-
|
2943
|
-
} }, row
|
2944
|
-
.getAllCells()
|
2945
|
-
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
2946
|
-
.map((cell) => (React__default["default"].createElement(MRT_EditCellTextField, { cell: cell, key: cell.id, showLabel: true, table: table })))))),
|
2947
|
-
React__default["default"].createElement(DialogActions__default["default"], { sx: { p: '1.25rem' } },
|
2948
|
-
React__default["default"].createElement(MRT_EditActionButtons, { row: row, table: table, variant: "text" }))));
|
2716
|
+
return (jsxRuntime.jsxs(Dialog__default["default"], Object.assign({ open: open }, { children: [jsxRuntime.jsx(DialogTitle__default["default"], Object.assign({ textAlign: "center" }, { children: localization.edit })), jsxRuntime.jsx(DialogContent__default["default"], { children: jsxRuntime.jsx("form", Object.assign({ onSubmit: (e) => e.preventDefault() }, { children: jsxRuntime.jsx(Stack__default["default"], Object.assign({ sx: {
|
2717
|
+
gap: '1.5rem',
|
2718
|
+
minWidth: { xs: '300px', sm: '360px', md: '400px' },
|
2719
|
+
pt: '1rem',
|
2720
|
+
width: '100%',
|
2721
|
+
} }, { children: row
|
2722
|
+
.getAllCells()
|
2723
|
+
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
2724
|
+
.map((cell) => (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, showLabel: true, table: table }, cell.id))) })) })) }), jsxRuntime.jsx(DialogActions__default["default"], Object.assign({ sx: { p: '1.25rem' } }, { children: jsxRuntime.jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) }))] })));
|
2949
2725
|
};
|
2950
2726
|
|
2951
2727
|
const MRT_TableRoot = (props) => {
|
2952
2728
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
|
2953
|
-
const bottomToolbarRef =
|
2954
|
-
const editInputRefs =
|
2955
|
-
const filterInputRefs =
|
2956
|
-
const searchInputRef =
|
2957
|
-
const tableContainerRef =
|
2958
|
-
const tableHeadCellRefs =
|
2959
|
-
const tablePaperRef =
|
2960
|
-
const topToolbarRef =
|
2961
|
-
const initialState =
|
2729
|
+
const bottomToolbarRef = react.useRef(null);
|
2730
|
+
const editInputRefs = react.useRef({});
|
2731
|
+
const filterInputRefs = react.useRef({});
|
2732
|
+
const searchInputRef = react.useRef(null);
|
2733
|
+
const tableContainerRef = react.useRef(null);
|
2734
|
+
const tableHeadCellRefs = react.useRef({});
|
2735
|
+
const tablePaperRef = react.useRef(null);
|
2736
|
+
const topToolbarRef = react.useRef(null);
|
2737
|
+
const initialState = react.useMemo(() => {
|
2962
2738
|
var _a, _b, _c;
|
2963
2739
|
const initState = (_a = props.initialState) !== null && _a !== void 0 ? _a : {};
|
2964
2740
|
initState.columnOrder =
|
@@ -2966,7 +2742,7 @@ const MRT_TableRoot = (props) => {
|
|
2966
2742
|
initState.globalFilterFn = (_c = props.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
|
2967
2743
|
return initState;
|
2968
2744
|
}, []);
|
2969
|
-
const [columnFilterFns, setColumnFilterFns] =
|
2745
|
+
const [columnFilterFns, setColumnFilterFns] = react.useState(() => Object.assign({}, ...getAllLeafColumnDefs(props.columns).map((col) => {
|
2970
2746
|
var _a, _b, _c, _d;
|
2971
2747
|
return ({
|
2972
2748
|
[getColumnId(col)]: col.filterFn instanceof Function
|
@@ -2974,32 +2750,32 @@ const MRT_TableRoot = (props) => {
|
|
2974
2750
|
: (_d = (_b = col.filterFn) !== null && _b !== void 0 ? _b : (_c = initialState === null || initialState === void 0 ? void 0 : initialState.columnFilterFns) === null || _c === void 0 ? void 0 : _c[getColumnId(col)]) !== null && _d !== void 0 ? _d : getDefaultColumnFilterFn(col),
|
2975
2751
|
});
|
2976
2752
|
})));
|
2977
|
-
const [columnOrder, setColumnOrder] =
|
2978
|
-
const [density, setDensity] =
|
2979
|
-
const [draggingColumn, setDraggingColumn] =
|
2980
|
-
const [draggingRow, setDraggingRow] =
|
2981
|
-
const [editingCell, setEditingCell] =
|
2982
|
-
const [editingRow, setEditingRow] =
|
2983
|
-
const [globalFilterFn, setGlobalFilterFn] =
|
2984
|
-
const [grouping, setGrouping] =
|
2985
|
-
const [hoveredColumn, setHoveredColumn] =
|
2986
|
-
const [hoveredRow, setHoveredRow] =
|
2987
|
-
const [isFullScreen, setIsFullScreen] =
|
2988
|
-
const [showAlertBanner, setShowAlertBanner] =
|
2989
|
-
const [showColumnFilters, setShowColumnFilters] =
|
2990
|
-
const [showGlobalFilter, setShowGlobalFilter] =
|
2991
|
-
const [showToolbarDropZone, setShowToolbarDropZone] =
|
2992
|
-
const displayColumns =
|
2753
|
+
const [columnOrder, setColumnOrder] = react.useState((_a = initialState.columnOrder) !== null && _a !== void 0 ? _a : []);
|
2754
|
+
const [density, setDensity] = react.useState((_b = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _b !== void 0 ? _b : 'comfortable');
|
2755
|
+
const [draggingColumn, setDraggingColumn] = react.useState((_c = initialState.draggingColumn) !== null && _c !== void 0 ? _c : null);
|
2756
|
+
const [draggingRow, setDraggingRow] = react.useState((_d = initialState.draggingRow) !== null && _d !== void 0 ? _d : null);
|
2757
|
+
const [editingCell, setEditingCell] = react.useState((_e = initialState.editingCell) !== null && _e !== void 0 ? _e : null);
|
2758
|
+
const [editingRow, setEditingRow] = react.useState((_f = initialState.editingRow) !== null && _f !== void 0 ? _f : null);
|
2759
|
+
const [globalFilterFn, setGlobalFilterFn] = react.useState((_g = initialState.globalFilterFn) !== null && _g !== void 0 ? _g : 'fuzzy');
|
2760
|
+
const [grouping, setGrouping] = react.useState((_h = initialState.grouping) !== null && _h !== void 0 ? _h : []);
|
2761
|
+
const [hoveredColumn, setHoveredColumn] = react.useState((_j = initialState.hoveredColumn) !== null && _j !== void 0 ? _j : null);
|
2762
|
+
const [hoveredRow, setHoveredRow] = react.useState((_k = initialState.hoveredRow) !== null && _k !== void 0 ? _k : null);
|
2763
|
+
const [isFullScreen, setIsFullScreen] = react.useState((_l = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _l !== void 0 ? _l : false);
|
2764
|
+
const [showAlertBanner, setShowAlertBanner] = react.useState((_o = (_m = props.initialState) === null || _m === void 0 ? void 0 : _m.showAlertBanner) !== null && _o !== void 0 ? _o : false);
|
2765
|
+
const [showColumnFilters, setShowColumnFilters] = react.useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _p !== void 0 ? _p : false);
|
2766
|
+
const [showGlobalFilter, setShowGlobalFilter] = react.useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _q !== void 0 ? _q : false);
|
2767
|
+
const [showToolbarDropZone, setShowToolbarDropZone] = react.useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _r !== void 0 ? _r : false);
|
2768
|
+
const displayColumns = react.useMemo(() => {
|
2993
2769
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
2994
2770
|
return [
|
2995
2771
|
((_b = (_a = props.state) === null || _a === void 0 ? void 0 : _a.columnOrder) !== null && _b !== void 0 ? _b : columnOrder).includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header: props.localization.move, size: 60 }, props.defaultDisplayColumn), (_c = props.displayColumnDefOptions) === null || _c === void 0 ? void 0 : _c['mrt-row-drag']), { id: 'mrt-row-drag' }),
|
2996
|
-
((_e = (_d = props.state) === null || _d === void 0 ? void 0 : _d.columnOrder) !== null && _e !== void 0 ? _e : columnOrder).includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (
|
2772
|
+
((_e = (_d = props.state) === null || _d === void 0 ? void 0 : _d.columnOrder) !== null && _e !== void 0 ? _e : columnOrder).includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (jsxRuntime.jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: props.localization.actions, size: 70 }, props.defaultDisplayColumn), (_f = props.displayColumnDefOptions) === null || _f === void 0 ? void 0 : _f['mrt-row-actions']), { id: 'mrt-row-actions' }),
|
2997
2773
|
((_h = (_g = props.state) === null || _g === void 0 ? void 0 : _g.columnOrder) !== null && _h !== void 0 ? _h : columnOrder).includes('mrt-row-expand') &&
|
2998
|
-
showExpandColumn(props, (_k = (_j = props.state) === null || _j === void 0 ? void 0 : _j.grouping) !== null && _k !== void 0 ? _k : grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (
|
2999
|
-
? () =>
|
2774
|
+
showExpandColumn(props, (_k = (_j = props.state) === null || _j === void 0 ? void 0 : _j.grouping) !== null && _k !== void 0 ? _k : grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (jsxRuntime.jsx(MRT_ExpandButton, { row: row, table: table })), Header: props.enableExpandAll
|
2775
|
+
? () => jsxRuntime.jsx(MRT_ExpandAllButton, { table: table })
|
3000
2776
|
: null, header: props.localization.expand, size: 60 }, props.defaultDisplayColumn), (_l = props.displayColumnDefOptions) === null || _l === void 0 ? void 0 : _l['mrt-row-expand']), { id: 'mrt-row-expand' }),
|
3001
|
-
((_o = (_m = props.state) === null || _m === void 0 ? void 0 : _m.columnOrder) !== null && _o !== void 0 ? _o : columnOrder).includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (
|
3002
|
-
? () =>
|
2777
|
+
((_o = (_m = props.state) === null || _m === void 0 ? void 0 : _m.columnOrder) !== null && _o !== void 0 ? _o : columnOrder).includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (jsxRuntime.jsx(MRT_SelectCheckbox, { row: row, table: table })), Header: props.enableSelectAll && props.enableMultiRowSelection
|
2778
|
+
? () => jsxRuntime.jsx(MRT_SelectCheckbox, { selectAll: true, table: table })
|
3003
2779
|
: null, header: props.localization.select, size: 60 }, props.defaultDisplayColumn), (_p = props.displayColumnDefOptions) === null || _p === void 0 ? void 0 : _p['mrt-row-select']), { id: 'mrt-row-select' }),
|
3004
2780
|
((_r = (_q = props.state) === null || _q === void 0 ? void 0 : _q.columnOrder) !== null && _r !== void 0 ? _r : 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), (_s = props.displayColumnDefOptions) === null || _s === void 0 ? void 0 : _s['mrt-row-numbers']), { id: 'mrt-row-numbers' }),
|
3005
2781
|
].filter(Boolean);
|
@@ -3029,7 +2805,7 @@ const MRT_TableRoot = (props) => {
|
|
3029
2805
|
(_s = props.state) === null || _s === void 0 ? void 0 : _s.columnOrder,
|
3030
2806
|
(_t = props.state) === null || _t === void 0 ? void 0 : _t.grouping,
|
3031
2807
|
]);
|
3032
|
-
const columnDefs =
|
2808
|
+
const columnDefs = react.useMemo(() => {
|
3033
2809
|
var _a, _b, _c;
|
3034
2810
|
return prepareColumns({
|
3035
2811
|
aggregationFns: props.aggregationFns,
|
@@ -3045,7 +2821,7 @@ const MRT_TableRoot = (props) => {
|
|
3045
2821
|
props.columns,
|
3046
2822
|
(_u = props.state) === null || _u === void 0 ? void 0 : _u.columnFilterFns,
|
3047
2823
|
]);
|
3048
|
-
const data =
|
2824
|
+
const data = react.useMemo(() => {
|
3049
2825
|
var _a, _b, _c, _d, _e;
|
3050
2826
|
return (((_a = props.state) === null || _a === void 0 ? void 0 : _a.isLoading) || ((_b = props.state) === null || _b === void 0 ? void 0 : _b.showSkeletons)) &&
|
3051
2827
|
!props.data.length
|
@@ -3094,13 +2870,13 @@ const MRT_TableRoot = (props) => {
|
|
3094
2870
|
if (props.tableInstanceRef) {
|
3095
2871
|
props.tableInstanceRef.current = table;
|
3096
2872
|
}
|
3097
|
-
const initialBodyHeight =
|
3098
|
-
|
2873
|
+
const initialBodyHeight = react.useRef();
|
2874
|
+
react.useEffect(() => {
|
3099
2875
|
if (typeof window !== 'undefined') {
|
3100
2876
|
initialBodyHeight.current = document.body.style.height;
|
3101
2877
|
}
|
3102
2878
|
}, []);
|
3103
|
-
|
2879
|
+
react.useEffect(() => {
|
3104
2880
|
if (typeof window !== 'undefined') {
|
3105
2881
|
if (table.getState().isFullScreen) {
|
3106
2882
|
document.body.style.height = '100vh';
|
@@ -3111,7 +2887,7 @@ const MRT_TableRoot = (props) => {
|
|
3111
2887
|
}
|
3112
2888
|
}, [table.getState().isFullScreen]);
|
3113
2889
|
//if page index is out of bounds, set it to the last page
|
3114
|
-
|
2890
|
+
react.useEffect(() => {
|
3115
2891
|
var _a;
|
3116
2892
|
const { pageIndex, pageSize } = table.getState().pagination;
|
3117
2893
|
const totalRowCount = (_a = props.rowCount) !== null && _a !== void 0 ? _a : table.getPrePaginationRowModel().rows.length;
|
@@ -3120,11 +2896,7 @@ const MRT_TableRoot = (props) => {
|
|
3120
2896
|
table.setPageIndex(Math.floor(totalRowCount / pageSize));
|
3121
2897
|
}
|
3122
2898
|
}, [props.rowCount, table.getPrePaginationRowModel().rows.length]);
|
3123
|
-
return (
|
3124
|
-
React__default["default"].createElement(Dialog__default["default"], { PaperComponent: Box__default["default"], TransitionComponent: !props.enableRowVirtualization ? Grow__default["default"] : undefined, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => table.setIsFullScreen(false), open: table.getState().isFullScreen, transitionDuration: 400 },
|
3125
|
-
React__default["default"].createElement(MRT_TablePaper, { table: table })),
|
3126
|
-
!table.getState().isFullScreen && (React__default["default"].createElement(MRT_TablePaper, { table: table })),
|
3127
|
-
editingRow && props.editingMode === 'modal' && (React__default["default"].createElement(MRT_EditRowModal, { row: editingRow, table: table, open: true }))));
|
2899
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Dialog__default["default"], Object.assign({ PaperComponent: Box__default["default"], TransitionComponent: !props.enableRowVirtualization ? Grow__default["default"] : undefined, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => table.setIsFullScreen(false), open: table.getState().isFullScreen, transitionDuration: 400 }, { children: jsxRuntime.jsx(MRT_TablePaper, { table: table }) })), !table.getState().isFullScreen && (jsxRuntime.jsx(MRT_TablePaper, { table: table })), editingRow && props.editingMode === 'modal' && (jsxRuntime.jsx(MRT_EditRowModal, { row: editingRow, table: table, open: true }))] }));
|
3128
2900
|
};
|
3129
2901
|
|
3130
2902
|
const MRT_Localization_EN = {
|
@@ -3222,13 +2994,13 @@ const MRT_Localization_EN = {
|
|
3222
2994
|
const MaterialReactTable = (_a) => {
|
3223
2995
|
var _b;
|
3224
2996
|
var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onChange', defaultColumn, defaultDisplayColumn, editingMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableFilterMatchHighlighting = 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, layoutMode = 'semantic', localization, manualFiltering, manualGrouping, manualPagination, manualSorting, 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", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enablePinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberMode", "selectAllMode", "sortingFns"]);
|
3225
|
-
const _icons =
|
3226
|
-
const _localization =
|
3227
|
-
const _aggregationFns =
|
3228
|
-
const _filterFns =
|
3229
|
-
const _sortingFns =
|
3230
|
-
const _defaultColumn =
|
3231
|
-
const _defaultDisplayColumn =
|
2997
|
+
const _icons = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
|
2998
|
+
const _localization = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
|
2999
|
+
const _aggregationFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
|
3000
|
+
const _filterFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
|
3001
|
+
const _sortingFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
|
3002
|
+
const _defaultColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
|
3003
|
+
const _defaultDisplayColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
|
3232
3004
|
if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
|
3233
3005
|
layoutMode = 'grid';
|
3234
3006
|
}
|
@@ -3244,7 +3016,7 @@ const MaterialReactTable = (_a) => {
|
|
3244
3016
|
manualPagination = true;
|
3245
3017
|
manualSorting = true;
|
3246
3018
|
}
|
3247
|
-
return (
|
3019
|
+
return (jsxRuntime.jsx(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, enableFilterMatchHighlighting: enableFilterMatchHighlighting, 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, layoutMode: layoutMode, localization: _localization, manualFiltering: manualFiltering, manualGrouping: manualGrouping, manualPagination: manualPagination, manualSorting: manualSorting, positionActionsColumn: positionActionsColumn, positionExpandColumn: positionExpandColumn, positionGlobalFilter: positionGlobalFilter, positionPagination: positionPagination, positionToolbarAlertBanner: positionToolbarAlertBanner, positionToolbarDropZone: positionToolbarDropZone, rowNumberMode: rowNumberMode, selectAllMode: selectAllMode, sortingFns: _sortingFns }, rest)));
|
3248
3020
|
};
|
3249
3021
|
|
3250
3022
|
exports.MRT_AggregationFns = MRT_AggregationFns;
|
@@ -3259,6 +3031,7 @@ exports.MRT_GlobalFilterTextField = MRT_GlobalFilterTextField;
|
|
3259
3031
|
exports.MRT_GrabHandleButton = MRT_GrabHandleButton;
|
3260
3032
|
exports.MRT_ShowHideColumnsButton = MRT_ShowHideColumnsButton;
|
3261
3033
|
exports.MRT_SortingFns = MRT_SortingFns;
|
3034
|
+
exports.MRT_TableHeadCellFilterContainer = MRT_TableHeadCellFilterContainer;
|
3262
3035
|
exports.MRT_TablePagination = MRT_TablePagination;
|
3263
3036
|
exports.MRT_ToggleDensePaddingButton = MRT_ToggleDensePaddingButton;
|
3264
3037
|
exports.MRT_ToggleFiltersButton = MRT_ToggleFiltersButton;
|