@dooherceg/material-react-table 3.2.7 → 3.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +77 -7
- package/dist/index.esm.js +1558 -1405
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1564 -1408
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,24 +4,39 @@ var matchSorterUtils = require('@tanstack/match-sorter-utils');
|
|
|
4
4
|
var reactTable = require('@tanstack/react-table');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var CancelIcon = require('@mui/icons-material/Cancel');
|
|
8
|
+
var Button = require('@mui/material/Button');
|
|
9
|
+
var Dialog = require('@mui/material/Dialog');
|
|
10
|
+
var DialogActions = require('@mui/material/DialogActions');
|
|
11
|
+
var DialogContent = require('@mui/material/DialogContent');
|
|
12
|
+
var DialogTitle = require('@mui/material/DialogTitle');
|
|
7
13
|
var IconButton = require('@mui/material/IconButton');
|
|
8
|
-
var
|
|
14
|
+
var Stack = require('@mui/material/Stack');
|
|
15
|
+
var DeleteOutlineIcon = require('@mui/icons-material/DeleteOutline');
|
|
16
|
+
var EditNoteIcon = require('@mui/icons-material/EditNote');
|
|
17
|
+
var FileDownloadIcon = require('@mui/icons-material/FileDownload');
|
|
18
|
+
var PrintIcon = require('@mui/icons-material/Print');
|
|
19
|
+
var Checkbox = require('@mui/material/Checkbox');
|
|
20
|
+
var CircularProgress = require('@mui/material/CircularProgress');
|
|
21
|
+
var Divider = require('@mui/material/Divider');
|
|
22
|
+
var FormControl = require('@mui/material/FormControl');
|
|
23
|
+
var FormControlLabel = require('@mui/material/FormControlLabel');
|
|
9
24
|
var Menu = require('@mui/material/Menu');
|
|
10
|
-
var Box = require('@mui/material/Box');
|
|
11
|
-
var ListItemIcon = require('@mui/material/ListItemIcon');
|
|
12
25
|
var MenuItem = require('@mui/material/MenuItem');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
26
|
+
var Radio = require('@mui/material/Radio');
|
|
27
|
+
var RadioGroup = require('@mui/material/RadioGroup');
|
|
15
28
|
var styles = require('@mui/material/styles');
|
|
16
|
-
var
|
|
29
|
+
var Tooltip = require('@mui/material/Tooltip');
|
|
30
|
+
var Typography = require('@mui/material/Typography');
|
|
31
|
+
var printJS = require('print-js');
|
|
32
|
+
var notistack = require('notistack');
|
|
33
|
+
var Box = require('@mui/material/Box');
|
|
34
|
+
var ListItemIcon = require('@mui/material/ListItemIcon');
|
|
17
35
|
var SubdirectoryArrowLeftIcon = require('@mui/icons-material/SubdirectoryArrowLeft');
|
|
18
36
|
var VerticalAlignTopIcon = require('@mui/icons-material/VerticalAlignTop');
|
|
19
|
-
var Checkbox = require('@mui/material/Checkbox');
|
|
20
|
-
var Radio = require('@mui/material/Radio');
|
|
21
37
|
var AddIcon = require('@mui/icons-material/Add');
|
|
22
38
|
var ArrowDownwardIcon = require('@mui/icons-material/ArrowDownward');
|
|
23
39
|
var ArrowRightIcon = require('@mui/icons-material/ArrowRight');
|
|
24
|
-
var CancelIcon = require('@mui/icons-material/Cancel');
|
|
25
40
|
var ChevronLeftIcon = require('@mui/icons-material/ChevronLeft');
|
|
26
41
|
var ChevronRightIcon = require('@mui/icons-material/ChevronRight');
|
|
27
42
|
var ClearAllIcon = require('@mui/icons-material/ClearAll');
|
|
@@ -53,15 +68,6 @@ var SortIcon = require('@mui/icons-material/Sort');
|
|
|
53
68
|
var SyncAltIcon = require('@mui/icons-material/SyncAlt');
|
|
54
69
|
var ViewColumnIcon = require('@mui/icons-material/ViewColumn');
|
|
55
70
|
var VisibilityOffIcon = require('@mui/icons-material/VisibilityOff');
|
|
56
|
-
var FileDownloadIcon = require('@mui/icons-material/FileDownload');
|
|
57
|
-
var PrintIcon = require('@mui/icons-material/Print');
|
|
58
|
-
var Divider = require('@mui/material/Divider');
|
|
59
|
-
var FormControl = require('@mui/material/FormControl');
|
|
60
|
-
var FormControlLabel = require('@mui/material/FormControlLabel');
|
|
61
|
-
var RadioGroup = require('@mui/material/RadioGroup');
|
|
62
|
-
var Typography = require('@mui/material/Typography');
|
|
63
|
-
var printJS = require('print-js');
|
|
64
|
-
var notistack = require('notistack');
|
|
65
71
|
var reactVirtual = require('@tanstack/react-virtual');
|
|
66
72
|
var Drawer = require('@mui/material/Drawer');
|
|
67
73
|
var TextField = require('@mui/material/TextField');
|
|
@@ -106,10 +112,6 @@ var DeleteForeverIcon = require('@mui/icons-material/DeleteForever');
|
|
|
106
112
|
var Switch = require('@mui/material/Switch');
|
|
107
113
|
var Badge = require('@mui/material/Badge');
|
|
108
114
|
var TableContainer = require('@mui/material/TableContainer');
|
|
109
|
-
var Dialog = require('@mui/material/Dialog');
|
|
110
|
-
var DialogActions = require('@mui/material/DialogActions');
|
|
111
|
-
var DialogContent = require('@mui/material/DialogContent');
|
|
112
|
-
var DialogTitle = require('@mui/material/DialogTitle');
|
|
113
115
|
var Modal = require('@mui/material/Modal');
|
|
114
116
|
var Accordion = require('@mui/material/Accordion');
|
|
115
117
|
var AccordionDetails = require('@mui/material/AccordionDetails');
|
|
@@ -723,99 +725,6 @@ const createRow = (table, originalRow, rowIndex = -1, depth = 0, subRows, parent
|
|
|
723
725
|
[getColumnId(col)]: '',
|
|
724
726
|
}))), rowIndex, depth, subRows, parentId);
|
|
725
727
|
|
|
726
|
-
const MRT_AggregationFns = Object.assign({}, reactTable.aggregationFns);
|
|
727
|
-
|
|
728
|
-
const fuzzy = (row, columnId, filterValue, addMeta) => {
|
|
729
|
-
const itemRank = matchSorterUtils.rankItem(row.getValue(columnId), filterValue, {
|
|
730
|
-
threshold: matchSorterUtils.rankings.MATCHES,
|
|
731
|
-
});
|
|
732
|
-
addMeta(itemRank);
|
|
733
|
-
return itemRank.passed;
|
|
734
|
-
};
|
|
735
|
-
fuzzy.autoRemove = (val) => !val;
|
|
736
|
-
const contains = (row, id, filterValue) => {
|
|
737
|
-
var _a;
|
|
738
|
-
return !!((_a = row
|
|
739
|
-
.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim().includes(filterValue.toString().toLowerCase().trim()));
|
|
740
|
-
};
|
|
741
|
-
contains.autoRemove = (val) => !val;
|
|
742
|
-
const startsWith = (row, id, filterValue) => {
|
|
743
|
-
var _a;
|
|
744
|
-
return !!((_a = row
|
|
745
|
-
.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim().startsWith(filterValue.toString().toLowerCase().trim()));
|
|
746
|
-
};
|
|
747
|
-
startsWith.autoRemove = (val) => !val;
|
|
748
|
-
const endsWith = (row, id, filterValue) => {
|
|
749
|
-
var _a;
|
|
750
|
-
return !!((_a = row
|
|
751
|
-
.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim().endsWith(filterValue.toString().toLowerCase().trim()));
|
|
752
|
-
};
|
|
753
|
-
endsWith.autoRemove = (val) => !val;
|
|
754
|
-
const equals = (row, id, filterValue) => {
|
|
755
|
-
var _a;
|
|
756
|
-
return ((_a = row.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim()) ===
|
|
757
|
-
filterValue.toString().toLowerCase().trim();
|
|
758
|
-
};
|
|
759
|
-
equals.autoRemove = (val) => !val;
|
|
760
|
-
const notEquals = (row, id, filterValue) => {
|
|
761
|
-
var _a;
|
|
762
|
-
return ((_a = row.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim()) !==
|
|
763
|
-
filterValue.toString().toLowerCase().trim();
|
|
764
|
-
};
|
|
765
|
-
notEquals.autoRemove = (val) => !val;
|
|
766
|
-
const greaterThan = (row, id, filterValue) => {
|
|
767
|
-
var _a, _b, _c;
|
|
768
|
-
return !isNaN(+filterValue) && !isNaN(+row.getValue(id))
|
|
769
|
-
? +((_a = row.getValue(id)) !== null && _a !== void 0 ? _a : 0) > +filterValue
|
|
770
|
-
: ((_c = ((_b = row.getValue(id)) !== null && _b !== void 0 ? _b : '')) === null || _c === void 0 ? void 0 : _c.toString().toLowerCase().trim()) > filterValue.toString().toLowerCase().trim();
|
|
771
|
-
};
|
|
772
|
-
greaterThan.autoRemove = (val) => !val;
|
|
773
|
-
const greaterThanOrEqualTo = (row, id, filterValue) => equals(row, id, filterValue) || greaterThan(row, id, filterValue);
|
|
774
|
-
greaterThanOrEqualTo.autoRemove = (val) => !val;
|
|
775
|
-
const lessThan = (row, id, filterValue) => {
|
|
776
|
-
var _a, _b, _c;
|
|
777
|
-
return !isNaN(+filterValue) && !isNaN(+row.getValue(id))
|
|
778
|
-
? +((_a = row.getValue(id)) !== null && _a !== void 0 ? _a : 0) < +filterValue
|
|
779
|
-
: ((_c = ((_b = row.getValue(id)) !== null && _b !== void 0 ? _b : '')) === null || _c === void 0 ? void 0 : _c.toString().toLowerCase().trim()) < filterValue.toString().toLowerCase().trim();
|
|
780
|
-
};
|
|
781
|
-
lessThan.autoRemove = (val) => !val;
|
|
782
|
-
const lessThanOrEqualTo = (row, id, filterValue) => equals(row, id, filterValue) || lessThan(row, id, filterValue);
|
|
783
|
-
lessThanOrEqualTo.autoRemove = (val) => !val;
|
|
784
|
-
const between = (row, id, filterValues) => (['', undefined].includes(filterValues[0]) ||
|
|
785
|
-
greaterThan(row, id, filterValues[0])) &&
|
|
786
|
-
((!isNaN(+filterValues[0]) &&
|
|
787
|
-
!isNaN(+filterValues[1]) &&
|
|
788
|
-
+filterValues[0] > +filterValues[1]) ||
|
|
789
|
-
['', undefined].includes(filterValues[1]) ||
|
|
790
|
-
lessThan(row, id, filterValues[1]));
|
|
791
|
-
between.autoRemove = (val) => !val;
|
|
792
|
-
const betweenInclusive = (row, id, filterValues) => (['', undefined].includes(filterValues[0]) ||
|
|
793
|
-
greaterThanOrEqualTo(row, id, filterValues[0])) &&
|
|
794
|
-
((!isNaN(+filterValues[0]) &&
|
|
795
|
-
!isNaN(+filterValues[1]) &&
|
|
796
|
-
+filterValues[0] > +filterValues[1]) ||
|
|
797
|
-
['', undefined].includes(filterValues[1]) ||
|
|
798
|
-
lessThanOrEqualTo(row, id, filterValues[1]));
|
|
799
|
-
betweenInclusive.autoRemove = (val) => !val;
|
|
800
|
-
const empty = (row, id, _filterValue) => { var _a; return !((_a = row.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().trim()); };
|
|
801
|
-
empty.autoRemove = (val) => !val;
|
|
802
|
-
const notEmpty = (row, id, _filterValue) => { var _a; return !!((_a = row.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().trim()); };
|
|
803
|
-
notEmpty.autoRemove = (val) => !val;
|
|
804
|
-
const MRT_FilterFns = Object.assign(Object.assign({}, reactTable.filterFns), { between,
|
|
805
|
-
betweenInclusive,
|
|
806
|
-
contains,
|
|
807
|
-
empty,
|
|
808
|
-
endsWith,
|
|
809
|
-
equals,
|
|
810
|
-
fuzzy,
|
|
811
|
-
greaterThan,
|
|
812
|
-
greaterThanOrEqualTo,
|
|
813
|
-
lessThan,
|
|
814
|
-
lessThanOrEqualTo,
|
|
815
|
-
notEmpty,
|
|
816
|
-
notEquals,
|
|
817
|
-
startsWith });
|
|
818
|
-
|
|
819
728
|
/******************************************************************************
|
|
820
729
|
Copyright (c) Microsoft Corporation.
|
|
821
730
|
|
|
@@ -860,1413 +769,1659 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
860
769
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
861
770
|
};
|
|
862
771
|
|
|
863
|
-
|
|
864
|
-
const
|
|
865
|
-
|
|
772
|
+
function MRT_DeleteRowButton({ onClick, }) {
|
|
773
|
+
const iconButtonStyle = {
|
|
774
|
+
p: 0,
|
|
775
|
+
};
|
|
776
|
+
return (jsxRuntime.jsx(IconButton, { disableRipple: true, color: "error", sx: iconButtonStyle, onClick: onClick, children: jsxRuntime.jsx(DeleteOutlineIcon, {}) }));
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
const DeleteRowAction = ({ onDeleteConfirm, table, deleteConfirmation, }) => {
|
|
780
|
+
// Toolbar context — no specific row is targeted
|
|
781
|
+
const [open, setOpen] = react.useState(false);
|
|
782
|
+
const [deleting, setDeleting] = react.useState(false);
|
|
783
|
+
// Resolve deleteConfirmation — plain object, defaults to empty object.
|
|
784
|
+
const resolvedDeleteConfirmation = deleteConfirmation !== null && deleteConfirmation !== void 0 ? deleteConfirmation : {};
|
|
785
|
+
const { title: titleOverride, message: messageOverride, confirmButtonText: confirmButtonTextOverride, cancelButtonText: cancelButtonTextOverride, dialogSx, contentContainerSx, headerSx, titleSx, bodySx, footerSx, closeButtonProps, cancelButtonProps, confirmButtonProps, } = resolvedDeleteConfirmation;
|
|
786
|
+
// Consumer override takes priority over localization fallback.
|
|
787
|
+
const deleteConfirmationTitle = titleOverride !== null && titleOverride !== void 0 ? titleOverride : table.options.localization.deleteConfirmationTitle;
|
|
788
|
+
const deleteConfirmationMessage = messageOverride !== null && messageOverride !== void 0 ? messageOverride : table.options.localization.deleteConfirmationMessage;
|
|
789
|
+
const confirmButtonLabel = confirmButtonTextOverride !== null && confirmButtonTextOverride !== void 0 ? confirmButtonTextOverride : table.options.localization.deleteConfirmYes;
|
|
790
|
+
const cancelButtonLabel = cancelButtonTextOverride !== null && cancelButtonTextOverride !== void 0 ? cancelButtonTextOverride : table.options.localization.deleteConfirmNo;
|
|
791
|
+
const deletingLabel = table.options.localization.deleteConfirmDeleting;
|
|
792
|
+
const handleDeleteRowButtonClick = () => {
|
|
793
|
+
setOpen(true);
|
|
794
|
+
};
|
|
795
|
+
const handleConfirmDelete = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
796
|
+
setDeleting(true);
|
|
797
|
+
yield onDeleteConfirm();
|
|
798
|
+
setDeleting(false);
|
|
799
|
+
setOpen(false);
|
|
800
|
+
});
|
|
801
|
+
const handleClose = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
802
|
+
setOpen(false);
|
|
803
|
+
});
|
|
804
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Dialog, { open: open, onClose: () => setOpen(false), keepMounted: true, "aria-describedby": "alert-dialog-slide-description", role: "alertdialog", sx: dialogSx, children: jsxRuntime.jsxs(Stack, { flexDirection: "column", height: "min-content", sx: contentContainerSx, children: [jsxRuntime.jsxs(Stack, { flexDirection: "row", alignItems: "center", justifyContent: "space-between", sx: Object.assign({ width: '100%' }, headerSx), children: [jsxRuntime.jsx(DialogTitle, { sx: Object.assign({ p: '0.7rem' }, titleSx), children: deleteConfirmationTitle }), jsxRuntime.jsx(DialogActions, { sx: {
|
|
805
|
+
p: '0.7rem',
|
|
806
|
+
}, children: jsxRuntime.jsx(IconButton, Object.assign({ color: "error", "aria-label": "close", onClick: handleClose }, closeButtonProps, { children: jsxRuntime.jsx(CancelIcon, {}) })) })] }), jsxRuntime.jsxs(Stack, { children: [jsxRuntime.jsx(DialogContent, { sx: Object.assign({ pr: '6rem' }, bodySx), children: deleteConfirmationMessage }), jsxRuntime.jsxs(DialogActions, { sx: footerSx, children: [jsxRuntime.jsx(Button, Object.assign({ onClick: () => setOpen(false), disabled: deleting, autoFocus: true, variant: "soft" }, cancelButtonProps, { children: cancelButtonLabel })), jsxRuntime.jsx(Button, Object.assign({ onClick: handleConfirmDelete, disabled: deleting, variant: "contained", color: "error" }, confirmButtonProps, { children: deleting ? deletingLabel : confirmButtonLabel }))] })] })] }) }), jsxRuntime.jsx(MRT_DeleteRowButton, { onClick: handleDeleteRowButtonClick })] }));
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
const createDeleteAction = (_a = {}) => {
|
|
810
|
+
var { onDelete, renderRow: customRenderRow, renderToolbar: customRenderToolbar, deleteConfirmation } = _a, rest = __rest(_a, ["onDelete", "renderRow", "renderToolbar", "deleteConfirmation"]);
|
|
811
|
+
// Default delete behavior used when the consumer does not provide a custom onDelete.
|
|
812
|
+
// Also exposed to custom onDelete through context.defaultOnDelete for composition.
|
|
813
|
+
const defaultOnDelete = (_a) => __awaiter(void 0, [_a], void 0, function* ({ rowsToDelete, table, }) {
|
|
814
|
+
var _b, _c;
|
|
815
|
+
// Nothing to delete, so exit early.
|
|
816
|
+
if (!rowsToDelete.length) {
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
yield ((_c = (_b = table.options).deleteRowsFn) === null || _c === void 0 ? void 0 : _c.call(_b, { rowsToDelete, table }));
|
|
820
|
+
});
|
|
821
|
+
// Single execution pipeline for every delete flow (row or toolbar).
|
|
822
|
+
// If a custom handler exists, it receives defaultOnDelete and decides when to call it.
|
|
823
|
+
const executeDelete = (context) => {
|
|
824
|
+
const executeDefaultDelete = () => defaultOnDelete(context);
|
|
825
|
+
if (onDelete) {
|
|
826
|
+
return onDelete(Object.assign(Object.assign({}, context), { defaultOnDelete: executeDefaultDelete }));
|
|
827
|
+
}
|
|
828
|
+
return executeDefaultDelete();
|
|
829
|
+
};
|
|
830
|
+
// Resolves selected rows from table state for toolbar-triggered delete.
|
|
831
|
+
const handleMultipleRowDelete = ({ table, }) => {
|
|
832
|
+
const rowsToDelete = table.getSelectedRowModel().rows;
|
|
833
|
+
return executeDelete({ table, rowsToDelete });
|
|
834
|
+
};
|
|
835
|
+
// Resolves only the active row for row-triggered delete.
|
|
836
|
+
const handleSingleRowDelete = ({ table, row, }) => {
|
|
837
|
+
return executeDelete({ table, rowsToDelete: [row] });
|
|
838
|
+
};
|
|
839
|
+
// Wraps row context into a zero-argument callback expected by row action UI.
|
|
840
|
+
const createRowDeleteExecutor = (context) => {
|
|
841
|
+
return () => {
|
|
842
|
+
void handleSingleRowDelete(context);
|
|
843
|
+
};
|
|
844
|
+
};
|
|
845
|
+
// Wraps toolbar context into a zero-argument callback expected by toolbar action UI.
|
|
846
|
+
const createToolbarDeleteExecutor = (context) => {
|
|
847
|
+
return () => {
|
|
848
|
+
void handleMultipleRowDelete(context);
|
|
849
|
+
};
|
|
850
|
+
};
|
|
851
|
+
// Uses custom row renderer when provided; otherwise renders default delete action UI.
|
|
852
|
+
const renderRowAction = (context) => {
|
|
853
|
+
const onRowDelete = createRowDeleteExecutor(context);
|
|
854
|
+
if (customRenderRow) {
|
|
855
|
+
return customRenderRow(Object.assign(Object.assign({}, context), { onDelete: onRowDelete }));
|
|
856
|
+
}
|
|
857
|
+
return (jsxRuntime.jsx(DeleteRowAction, { onDeleteConfirm: onRowDelete, table: context.table, deleteConfirmation: deleteConfirmation }));
|
|
858
|
+
};
|
|
859
|
+
// Uses custom toolbar renderer when provided; otherwise renders default delete action UI.
|
|
860
|
+
const renderToolbarAction = (context) => {
|
|
861
|
+
const onToolbarDelete = createToolbarDeleteExecutor(context);
|
|
862
|
+
if (customRenderToolbar) {
|
|
863
|
+
return customRenderToolbar(Object.assign(Object.assign({}, context), { onDelete: onToolbarDelete }));
|
|
864
|
+
}
|
|
865
|
+
return (jsxRuntime.jsx(DeleteRowAction, { onDeleteConfirm: onToolbarDelete, table: context.table }));
|
|
866
|
+
};
|
|
867
|
+
return Object.assign({ name: 'delete', renderRow: renderRowAction, renderToolbar: renderToolbarAction }, rest);
|
|
866
868
|
};
|
|
867
869
|
|
|
868
|
-
const
|
|
869
|
-
|
|
870
|
-
const { options: { icons: { ArrowRightIcon }, }, } = table;
|
|
871
|
-
return (jsxRuntime.jsxs(MenuItem, Object.assign({ sx: {
|
|
872
|
-
alignItems: 'center',
|
|
873
|
-
justifyContent: 'space-between',
|
|
874
|
-
minWidth: '120px',
|
|
875
|
-
my: 0,
|
|
876
|
-
py: '6px',
|
|
877
|
-
}, tabIndex: 0 }, rest, { children: [jsxRuntime.jsxs(Box, { sx: {
|
|
878
|
-
alignItems: 'center',
|
|
879
|
-
display: 'flex',
|
|
880
|
-
}, children: [jsxRuntime.jsx(ListItemIcon, { children: icon }), label] }), onOpenSubMenu && (jsxRuntime.jsx(IconButton, { onClick: (e) => onOpenSubMenu(e), onMouseEnter: (e) => onOpenSubMenu(e), size: "small", sx: { p: 0 }, children: jsxRuntime.jsx(ArrowRightIcon, {}) }))] })));
|
|
870
|
+
const MRT_EditRowButton = ({ onClick }) => {
|
|
871
|
+
return (jsxRuntime.jsx(IconButton, { sx: { p: 0 }, disableRipple: true, color: "primary", onClick: onClick, children: jsxRuntime.jsx(EditNoteIcon, {}) }));
|
|
881
872
|
};
|
|
882
873
|
|
|
883
|
-
const
|
|
884
|
-
|
|
885
|
-
const { options: { editDisplayMode, enableEditing, icons: { EditIcon }, localization, mrtTheme: { menuBackgroundColor }, renderRowActionMenuItems, }, } = table;
|
|
886
|
-
const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
|
|
887
|
-
const menuItems = react.useMemo(() => {
|
|
888
|
-
const items = [];
|
|
889
|
-
const editItem = parseFromValuesOrFunc(enableEditing, row) &&
|
|
890
|
-
['modal', 'row'].includes(editDisplayMode) && (jsxRuntime.jsx(MRT_ActionMenuItem, { icon: jsxRuntime.jsx(EditIcon, {}), label: localization.edit, onClick: handleEdit, table: table }, 'edit'));
|
|
891
|
-
if (editItem)
|
|
892
|
-
items.push(editItem);
|
|
893
|
-
const rowActionMenuItems = renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
|
|
894
|
-
closeMenu: () => setAnchorEl(null),
|
|
895
|
-
row,
|
|
896
|
-
staticRowIndex,
|
|
897
|
-
table,
|
|
898
|
-
});
|
|
899
|
-
if (rowActionMenuItems === null || rowActionMenuItems === void 0 ? void 0 : rowActionMenuItems.length)
|
|
900
|
-
items.push(...rowActionMenuItems);
|
|
901
|
-
return items;
|
|
902
|
-
}, [renderRowActionMenuItems, row, staticRowIndex, table]);
|
|
903
|
-
if (!menuItems.length)
|
|
904
|
-
return null;
|
|
905
|
-
return (jsxRuntime.jsx(Menu, Object.assign({ MenuListProps: {
|
|
906
|
-
dense: density === 'compact',
|
|
907
|
-
sx: {
|
|
908
|
-
backgroundColor: menuBackgroundColor,
|
|
909
|
-
},
|
|
910
|
-
}, anchorEl: anchorEl, disableScrollLock: true, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: menuItems })));
|
|
874
|
+
const EditRowAction = ({ onEditButtonClick, }) => {
|
|
875
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(MRT_EditRowButton, { onClick: onEditButtonClick }) }));
|
|
911
876
|
};
|
|
912
877
|
|
|
913
|
-
const
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
const isEditing = useMRT_SliceValue(table._uiStore, (s) => { var _a; return ((_a = s.editingRow) === null || _a === void 0 ? void 0 : _a.id) === row.id; });
|
|
919
|
-
const handleCancel = () => {
|
|
920
|
-
if (isCreating) {
|
|
921
|
-
onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
|
|
922
|
-
setCreatingRow(null);
|
|
878
|
+
const createEditAction = ({ onEdit, renderRow: customRenderRow, } = {}) => {
|
|
879
|
+
const defaultOnEdit = (_a) => __awaiter(void 0, [_a], void 0, function* ({ rowToEdit, table, }) {
|
|
880
|
+
// Nothing to edit, so exit early.
|
|
881
|
+
if (!rowToEdit) {
|
|
882
|
+
return;
|
|
923
883
|
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
884
|
+
const { setNewEntryModal } = table;
|
|
885
|
+
const handleOpenEditModal = () => {
|
|
886
|
+
setNewEntryModal({
|
|
887
|
+
open: true,
|
|
888
|
+
mode: 'edit',
|
|
889
|
+
});
|
|
890
|
+
};
|
|
891
|
+
if (table.options.editRowFn) {
|
|
892
|
+
yield table.options.editRowFn({ rowToEdit, table });
|
|
893
|
+
return;
|
|
927
894
|
}
|
|
928
|
-
|
|
895
|
+
handleOpenEditModal();
|
|
896
|
+
});
|
|
897
|
+
const executeEdit = (context) => {
|
|
898
|
+
const executeDefaultEdit = () => defaultOnEdit(context);
|
|
899
|
+
if (onEdit) {
|
|
900
|
+
return onEdit(Object.assign(Object.assign({}, context), { defaultOnEdit: executeDefaultEdit }));
|
|
901
|
+
}
|
|
902
|
+
return executeDefaultEdit();
|
|
929
903
|
};
|
|
930
|
-
const
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
onCreatingRowSave === null || onCreatingRowSave === void 0 ? void 0 : onCreatingRowSave({
|
|
943
|
-
exitCreatingMode: () => setCreatingRow(null),
|
|
944
|
-
row,
|
|
945
|
-
table,
|
|
946
|
-
values: row._valuesCache,
|
|
947
|
-
});
|
|
948
|
-
else if (isEditing) {
|
|
949
|
-
onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
|
|
950
|
-
exitEditingMode: () => setEditingRow(null),
|
|
951
|
-
row,
|
|
952
|
-
table,
|
|
953
|
-
values: row === null || row === void 0 ? void 0 : row._valuesCache,
|
|
954
|
-
});
|
|
904
|
+
const handleEditRow = ({ table, row }) => {
|
|
905
|
+
return executeEdit({ table, rowToEdit: row });
|
|
906
|
+
};
|
|
907
|
+
const createEditRowExecutor = (context) => {
|
|
908
|
+
return () => {
|
|
909
|
+
void handleEditRow(context);
|
|
910
|
+
};
|
|
911
|
+
};
|
|
912
|
+
const renderRowAction = (context) => {
|
|
913
|
+
const onRowEdit = createEditRowExecutor(context);
|
|
914
|
+
if (customRenderRow) {
|
|
915
|
+
return customRenderRow(Object.assign(Object.assign({}, context), { onEdit: onRowEdit }));
|
|
955
916
|
}
|
|
917
|
+
return jsxRuntime.jsx(EditRowAction, { onEditButtonClick: onRowEdit });
|
|
956
918
|
};
|
|
957
|
-
return (jsxRuntime.jsx(Box, { onClick: (e) => e.stopPropagation(), sx: (theme) => (Object.assign({ display: 'flex', gap: '0.75rem' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: variant === 'icon' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip, { title: localization.cancel, children: jsxRuntime.jsx(IconButton, { "aria-label": localization.cancel, onClick: handleCancel, children: jsxRuntime.jsx(CancelIcon, {}) }) }), ((isCreating && onCreatingRowSave) ||
|
|
958
|
-
(isEditing && onEditingRowSave)) && (jsxRuntime.jsx(Tooltip, { title: localization.save, children: jsxRuntime.jsx(IconButton, { "aria-label": localization.save, color: "info", disabled: isSaving, onClick: handleSubmitRow, children: isSaving ? jsxRuntime.jsx(CircularProgress, { size: 18 }) : jsxRuntime.jsx(SaveIcon, {}) }) }))] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Button, { onClick: handleCancel, sx: { minWidth: '100px' }, children: localization.cancel }), jsxRuntime.jsxs(Button, { disabled: isSaving, onClick: handleSubmitRow, sx: { minWidth: '100px' }, variant: "contained", children: [isSaving && jsxRuntime.jsx(CircularProgress, { color: "inherit", size: 18 }), localization.save] })] })) }));
|
|
959
|
-
};
|
|
960
|
-
|
|
961
|
-
const parseCSSVarId = (id) => id.replace(/[^a-zA-Z0-9]/g, '_');
|
|
962
|
-
const getMRTTheme = (mrtTheme, muiTheme) => {
|
|
963
|
-
const mrtThemeOverrides = parseFromValuesOrFunc(mrtTheme, muiTheme);
|
|
964
|
-
const baseBackgroundColor = muiTheme.palette.background.default;
|
|
965
|
-
return Object.assign({ baseBackgroundColor, cellNavigationOutlineColor: muiTheme.palette.primary.main, draggingBorderColor: muiTheme.palette.primary.main, matchHighlightColor: muiTheme.palette.mode === 'dark'
|
|
966
|
-
? styles.darken(muiTheme.palette.warning.dark, 0.25)
|
|
967
|
-
: styles.lighten(muiTheme.palette.warning.light, 0.5), menuBackgroundColor: styles.lighten(baseBackgroundColor, 0.07), pinnedRowBackgroundColor: styles.alpha(muiTheme.palette.primary.main, 0.1), selectedRowBackgroundColor: styles.alpha(muiTheme.palette.primary.main, 0.2) }, mrtThemeOverrides);
|
|
968
|
-
};
|
|
969
|
-
const commonCellBeforeAfterStyles = {
|
|
970
|
-
content: '""',
|
|
971
|
-
height: '100%',
|
|
972
|
-
left: 0,
|
|
973
|
-
position: 'absolute',
|
|
974
|
-
top: 0,
|
|
975
|
-
width: '100%',
|
|
976
|
-
zIndex: -1,
|
|
977
|
-
};
|
|
978
|
-
const getCommonPinnedCellStyles = ({ table, theme, }) => {
|
|
979
|
-
const { baseBackgroundColor } = table.options.mrtTheme;
|
|
980
919
|
return {
|
|
981
|
-
'
|
|
982
|
-
|
|
983
|
-
},
|
|
920
|
+
name: 'edit',
|
|
921
|
+
renderRow: renderRowAction,
|
|
984
922
|
};
|
|
985
923
|
};
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
}
|
|
1004
|
-
// The checkbox column is technically pinned (for sticky positioning) but
|
|
1005
|
-
// should look like a regular center column — no background overlay or shadow.
|
|
1006
|
-
const isCheckboxColumn = column.id === CHECKBOX_DISPLAY_COLUMN_ID;
|
|
1007
|
-
// Count all currently pinned column IDs across both sides.
|
|
1008
|
-
// Checkbox is always pinned (counts as 1), so > 1 means the user has
|
|
1009
|
-
// explicitly pinned at least one additional column.
|
|
1010
|
-
const totalPinnedColumnCount = [
|
|
1011
|
-
...((_e = table.getState().columnPinning.left) !== null && _e !== void 0 ? _e : []),
|
|
1012
|
-
...((_f = table.getState().columnPinning.right) !== null && _f !== void 0 ? _f : []),
|
|
1013
|
-
].length;
|
|
1014
|
-
const hasNoPinnedColumns = totalPinnedColumnCount === 0;
|
|
1015
|
-
const pinnedStyles = isColumnPinned
|
|
1016
|
-
? Object.assign(Object.assign({}, (isCheckboxColumn
|
|
1017
|
-
? hasNoPinnedColumns
|
|
1018
|
-
? {
|
|
1019
|
-
// Use doubled class selector (&&) to beat the row-level
|
|
1020
|
-
// td[data-pinned="true"]:before specificity from MRT_TableBodyRow.
|
|
1021
|
-
'&&[data-pinned="true"]': {
|
|
1022
|
-
'&:before': {
|
|
1023
|
-
backgroundColor: 'transparent',
|
|
1024
|
-
boxShadow: 'none',
|
|
1025
|
-
},
|
|
1026
|
-
},
|
|
1027
|
-
}
|
|
1028
|
-
: // Other columns are also pinned — apply standard pinned background
|
|
1029
|
-
// so the checkbox header matches the pinned row cells below it.
|
|
1030
|
-
getCommonPinnedCellStyles({ column, table, theme })
|
|
1031
|
-
: getCommonPinnedCellStyles({ column, table, theme }))), { left: isColumnPinned === 'left'
|
|
1032
|
-
? `${column.getStart('left')}px`
|
|
1033
|
-
: undefined,
|
|
1034
|
-
// Skip opacity reduction for checkbox — keep it fully opaque like center columns
|
|
1035
|
-
opacity: isCheckboxColumn ? undefined : 0.97, position: 'sticky', right: isColumnPinned === 'right'
|
|
1036
|
-
? `${column.getAfter('right')}px`
|
|
1037
|
-
: undefined }) : {};
|
|
1038
|
-
return Object.assign(Object.assign(Object.assign({ backgroundColor: 'inherit', backgroundImage: 'inherit', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, justifyContent: columnDefType === 'group'
|
|
1039
|
-
? 'center'
|
|
1040
|
-
: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid'))
|
|
1041
|
-
? tableCellProps.align
|
|
1042
|
-
: undefined, opacity: isDraggingColumn || isHoveredColumn ? 0.5 : 1, position: 'relative', transition: enableColumnVirtualization
|
|
1043
|
-
? 'none'
|
|
1044
|
-
: `padding 150ms ease-in-out`, zIndex: column.getIsResizing() || isDraggingColumn
|
|
1045
|
-
? 2
|
|
1046
|
-
: columnDefType !== 'group' && isColumnPinned
|
|
1047
|
-
? 1
|
|
1048
|
-
: 0, '&:focus-visible': {
|
|
1049
|
-
outline: `2px solid ${table.options.mrtTheme.cellNavigationOutlineColor}`,
|
|
1050
|
-
outlineOffset: '-2px',
|
|
1051
|
-
} }, pinnedStyles), widthStyles), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme));
|
|
924
|
+
|
|
925
|
+
const downloadExportFiles = (files) => {
|
|
926
|
+
files.forEach((file) => {
|
|
927
|
+
const binaryString = atob(file.content);
|
|
928
|
+
const len = binaryString.length;
|
|
929
|
+
const bytes = new Uint8Array(len);
|
|
930
|
+
for (let i = 0; i < len; i++) {
|
|
931
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
932
|
+
}
|
|
933
|
+
const blob = new Blob([bytes], { type: 'application/octet-stream' });
|
|
934
|
+
const element = document.createElement('a');
|
|
935
|
+
element.href = URL.createObjectURL(blob);
|
|
936
|
+
element.download = file.filename;
|
|
937
|
+
document.body.appendChild(element);
|
|
938
|
+
element.click();
|
|
939
|
+
document.body.removeChild(element);
|
|
940
|
+
URL.revokeObjectURL(element.href);
|
|
941
|
+
});
|
|
1052
942
|
};
|
|
1053
|
-
const getCommonToolbarStyles = ({ table, }) => ({
|
|
1054
|
-
alignItems: 'flex-start',
|
|
1055
|
-
backgroundColor: table.options.mrtTheme.baseBackgroundColor,
|
|
1056
|
-
display: 'grid',
|
|
1057
|
-
flexWrap: 'wrap-reverse',
|
|
1058
|
-
position: 'relative',
|
|
1059
|
-
transition: 'all 150ms ease-in-out',
|
|
1060
|
-
zIndex: 1,
|
|
1061
|
-
});
|
|
1062
|
-
const flipIconStyles = (theme) => theme.direction === 'rtl'
|
|
1063
|
-
? { style: { transform: 'scaleX(-1)' } }
|
|
1064
|
-
: undefined;
|
|
1065
|
-
const getCommonTooltipProps = (placement) => ({
|
|
1066
|
-
disableInteractive: true,
|
|
1067
|
-
enterDelay: 1000,
|
|
1068
|
-
enterNextDelay: 1000,
|
|
1069
|
-
placement,
|
|
1070
|
-
});
|
|
1071
943
|
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
944
|
+
const printExportFiles = (files) => {
|
|
945
|
+
files.forEach((file) => {
|
|
946
|
+
const binaryString = atob(file.content);
|
|
947
|
+
const len = binaryString.length;
|
|
948
|
+
const bytes = new Uint8Array(len);
|
|
949
|
+
for (let i = 0; i < len; i++) {
|
|
950
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
951
|
+
}
|
|
952
|
+
const blob = new Blob([bytes], { type: 'application/pdf' });
|
|
953
|
+
const url = URL.createObjectURL(blob);
|
|
954
|
+
printJS({
|
|
955
|
+
printable: url,
|
|
956
|
+
type: 'pdf',
|
|
957
|
+
onLoadingEnd: () => URL.revokeObjectURL(url),
|
|
958
|
+
});
|
|
959
|
+
});
|
|
1081
960
|
};
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
const {
|
|
1086
|
-
const {
|
|
1087
|
-
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
|
1088
|
-
const isEditing = useMRT_SliceValue(table._uiStore, (s) => { var _a; return ((_a = s.editingRow) === null || _a === void 0 ? void 0 : _a.id) === row.id; });
|
|
1089
|
-
const showEditActionButtons = (isCreating && createDisplayMode === 'row') ||
|
|
1090
|
-
(isEditing && editDisplayMode === 'row');
|
|
961
|
+
|
|
962
|
+
const MRT_ExportsToolbar = ({ table, availableExports, exportState, onExportStateChange, loadExport, }) => {
|
|
963
|
+
const theme = styles.useTheme();
|
|
964
|
+
const { localization } = table.options;
|
|
965
|
+
const { selectedExports, selectedFormat, grouped } = exportState;
|
|
1091
966
|
const [anchorEl, setAnchorEl] = react.useState(null);
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1094
|
-
|
|
967
|
+
const [loadingExportType, setLoadingExportType] = react.useState(null);
|
|
968
|
+
const { rowSelection } = table.getState();
|
|
969
|
+
const selectedRowIds = Object.keys(rowSelection).filter((id) => rowSelection[id]);
|
|
970
|
+
const isNoRowsSelected = selectedRowIds.length === 0;
|
|
971
|
+
const availableFormats = react.useMemo(() => {
|
|
972
|
+
const allFormats = Object.values(availableExports).flatMap((exp) => exp.formats);
|
|
973
|
+
return Array.from(new Set(allFormats));
|
|
974
|
+
}, [availableExports]);
|
|
975
|
+
const hasPdfFormat = availableFormats.includes('pdf');
|
|
976
|
+
const exportTypesForSelectedFormat = react.useMemo(() => {
|
|
977
|
+
if (!selectedFormat)
|
|
978
|
+
return [];
|
|
979
|
+
return Object.values(availableExports).filter((exp) => exp.formats.includes(selectedFormat));
|
|
980
|
+
}, [availableExports, selectedFormat]);
|
|
981
|
+
const isPrintDisabled = selectedFormat !== 'pdf' ||
|
|
982
|
+
!selectedFormat ||
|
|
983
|
+
selectedExports.length < 1 ||
|
|
984
|
+
(!grouped && selectedExports.length > 1);
|
|
985
|
+
const isDownloadDisabled = !selectedFormat || selectedExports.length < 1;
|
|
986
|
+
const handleOpenMenu = (event) => {
|
|
1095
987
|
setAnchorEl(event.currentTarget);
|
|
1096
988
|
};
|
|
1097
|
-
const
|
|
1098
|
-
event.stopPropagation();
|
|
1099
|
-
setEditingRow(Object.assign({}, row));
|
|
989
|
+
const handleCloseMenu = () => {
|
|
1100
990
|
setAnchorEl(null);
|
|
1101
991
|
};
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
closeMenu: () => { },
|
|
1106
|
-
row,
|
|
1107
|
-
staticRowIndex,
|
|
1108
|
-
table,
|
|
1109
|
-
})) === null || _b === void 0 ? void 0 : _b.length) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { title: localization.rowActions, children: jsxRuntime.jsx(IconButton, Object.assign({ "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles }, rest, { children: jsxRuntime.jsx(MoreHorizIcon, {}) })) })), jsxRuntime.jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, staticRowIndex: staticRowIndex, table: table })] })) : null }));
|
|
1110
|
-
};
|
|
1111
|
-
|
|
1112
|
-
const getMRT_RowActionsColumnDef = (tableOptions) => {
|
|
1113
|
-
return Object.assign({ Cell: ({ cell, row, staticRowIndex, table }) => (jsxRuntime.jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, staticRowIndex: staticRowIndex, table: table })) }, defaultDisplayColumnProps({
|
|
1114
|
-
header: 'actions',
|
|
1115
|
-
id: 'mrt-row-actions',
|
|
1116
|
-
size: 70,
|
|
1117
|
-
tableOptions,
|
|
1118
|
-
}));
|
|
1119
|
-
};
|
|
1120
|
-
|
|
1121
|
-
const MRT_GrabHandleButton = (_a) => {
|
|
1122
|
-
var _b, _c;
|
|
1123
|
-
var { location, table } = _a, rest = __rest(_a, ["location", "table"]);
|
|
1124
|
-
const { options: { icons: { DragHandleIcon }, localization, }, } = table;
|
|
1125
|
-
return (jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps('top'), { title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.move, children: jsxRuntime.jsx(IconButton, Object.assign({ "aria-label": (_c = rest.title) !== null && _c !== void 0 ? _c : localization.move, disableRipple: true, draggable: "true", size: "small" }, rest, { onClick: (e) => {
|
|
1126
|
-
var _a;
|
|
1127
|
-
e.stopPropagation();
|
|
1128
|
-
(_a = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _a === void 0 ? void 0 : _a.call(rest, e);
|
|
1129
|
-
}, sx: (theme) => (Object.assign({ '&:active': {
|
|
1130
|
-
cursor: 'grabbing',
|
|
1131
|
-
}, '&:hover': {
|
|
1132
|
-
backgroundColor: 'transparent',
|
|
1133
|
-
opacity: 1,
|
|
1134
|
-
}, cursor: 'grab', m: '0 -0.1rem', opacity: location === 'row' ? 1 : 0.5, p: '2px', transition: 'all 150ms ease-in-out' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), title: undefined, children: jsxRuntime.jsx(DragHandleIcon, {}) })) })));
|
|
1135
|
-
};
|
|
1136
|
-
|
|
1137
|
-
const MRT_TableBodyRowGrabHandle = (_a) => {
|
|
1138
|
-
var { row, rowRef, table } = _a, rest = __rest(_a, ["row", "rowRef", "table"]);
|
|
1139
|
-
const { options: { muiRowDragHandleProps }, } = table;
|
|
1140
|
-
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiRowDragHandleProps, {
|
|
1141
|
-
row,
|
|
1142
|
-
table,
|
|
1143
|
-
})), rest);
|
|
1144
|
-
const handleDragStart = (event) => {
|
|
1145
|
-
var _a;
|
|
1146
|
-
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
|
1147
|
-
try {
|
|
1148
|
-
event.dataTransfer.setDragImage(rowRef.current, 0, 0);
|
|
1149
|
-
}
|
|
1150
|
-
catch (e) {
|
|
1151
|
-
console.error(e);
|
|
1152
|
-
}
|
|
1153
|
-
table.setDraggingRow(row);
|
|
1154
|
-
};
|
|
1155
|
-
const handleDragEnd = (event) => {
|
|
1156
|
-
var _a;
|
|
1157
|
-
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
|
1158
|
-
table.setDraggingRow(null);
|
|
1159
|
-
table.setHoveredRow(null);
|
|
992
|
+
const handleSelectFormat = (format) => {
|
|
993
|
+
const newFormat = selectedFormat === format ? null : format;
|
|
994
|
+
onExportStateChange((prev) => (Object.assign(Object.assign({}, (prev !== null && prev !== void 0 ? prev : { grouped: false })), { selectedExports: [], selectedFormat: newFormat })));
|
|
1160
995
|
};
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
|
|
1194
|
-
const iconButtonProps = parseFromValuesOrFunc(muiExpandButtonProps, {
|
|
1195
|
-
row,
|
|
1196
|
-
staticRowIndex,
|
|
1197
|
-
table,
|
|
996
|
+
const handleToggleExportType = (exportName) => {
|
|
997
|
+
const isAlreadySelected = selectedExports.includes(exportName);
|
|
998
|
+
const newSelectedExports = isAlreadySelected
|
|
999
|
+
? selectedExports.filter((name) => name !== exportName)
|
|
1000
|
+
: [...selectedExports, exportName];
|
|
1001
|
+
onExportStateChange((prev) => (Object.assign(Object.assign({}, (prev !== null && prev !== void 0 ? prev : { selectedFormat: null, grouped: false })), { selectedExports: newSelectedExports })));
|
|
1002
|
+
};
|
|
1003
|
+
const handleToggleGrouped = () => {
|
|
1004
|
+
onExportStateChange((prev) => (Object.assign(Object.assign({}, (prev !== null && prev !== void 0 ? prev : { selectedFormat: null, selectedExports: [] })), { grouped: !grouped })));
|
|
1005
|
+
};
|
|
1006
|
+
const handleExportAction = (type) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1007
|
+
setLoadingExportType(type);
|
|
1008
|
+
try {
|
|
1009
|
+
const response = yield loadExport({
|
|
1010
|
+
format: selectedFormat,
|
|
1011
|
+
exports: selectedExports,
|
|
1012
|
+
separated_files: !grouped,
|
|
1013
|
+
download: false,
|
|
1014
|
+
ids: JSON.stringify(selectedRowIds),
|
|
1015
|
+
type,
|
|
1016
|
+
});
|
|
1017
|
+
handleCloseMenu();
|
|
1018
|
+
if (type === 'download') {
|
|
1019
|
+
downloadExportFiles(response);
|
|
1020
|
+
}
|
|
1021
|
+
else {
|
|
1022
|
+
printExportFiles(response);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
finally {
|
|
1026
|
+
setLoadingExportType(null);
|
|
1027
|
+
}
|
|
1198
1028
|
});
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
(
|
|
1029
|
+
const renderFormatSelector = () => (jsxRuntime.jsx(Stack, { justifyContent: "flex-start", minWidth: "200px", sx: {
|
|
1030
|
+
borderRight: selectedFormat
|
|
1031
|
+
? `1px dashed ${theme.palette.divider}`
|
|
1032
|
+
: 'none',
|
|
1033
|
+
}, children: jsxRuntime.jsx(FormControl, { children: jsxRuntime.jsx(RadioGroup, { value: selectedFormat !== null && selectedFormat !== void 0 ? selectedFormat : '', children: availableFormats.map((format) => (jsxRuntime.jsx(FormControlLabel, { sx: { m: 0 }, value: format, control: jsxRuntime.jsx(Radio, { size: "small", onClick: () => handleSelectFormat(format) }), label: jsxRuntime.jsx(Typography, { variant: "subtitle2", sx: { fontWeight: 800 }, children: format }) }, format))) }) }) }));
|
|
1034
|
+
const renderExportTypeSelector = () => {
|
|
1035
|
+
if (!selectedFormat || exportTypesForSelectedFormat.length === 0)
|
|
1036
|
+
return null;
|
|
1037
|
+
return (jsxRuntime.jsx(Stack, { minWidth: "250px", maxHeight: "500px", sx: { overflowY: 'auto' }, children: exportTypesForSelectedFormat.map((exportType) => (jsxRuntime.jsxs(MenuItem, { onClick: () => handleToggleExportType(exportType.name), value: exportType.name, children: [jsxRuntime.jsx(Checkbox, { checked: selectedExports.includes(exportType.name), size: "small" }), jsxRuntime.jsx(Typography, { variant: "body2", children: exportType.label })] }, exportType.name))) }));
|
|
1206
1038
|
};
|
|
1207
|
-
const
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
? -180
|
|
1218
|
-
: 0}deg)`,
|
|
1219
|
-
transition: 'transform 150ms',
|
|
1220
|
-
} })) })) }) })));
|
|
1039
|
+
const renderActionButtons = () => {
|
|
1040
|
+
const isAnyLoading = loadingExportType !== null;
|
|
1041
|
+
return (jsxRuntime.jsxs(Stack, { direction: "row", gap: 0.5, mt: 1, mr: 2, children: [hasPdfFormat && (jsxRuntime.jsx(Button, { sx: { display: 'flex', gap: 0.5 }, disabled: isPrintDisabled || isAnyLoading, onClick: () => handleExportAction('print'), startIcon: loadingExportType === 'print' ? (jsxRuntime.jsx(CircularProgress, { size: 16, color: "inherit" })) : (jsxRuntime.jsx(PrintIcon, { fontSize: "small" })), children: localization.exportPrintPdf })), jsxRuntime.jsx(Button, { sx: { display: 'flex', gap: 0.5 }, disabled: isDownloadDisabled || isAnyLoading, onClick: () => handleExportAction('download'), startIcon: loadingExportType === 'download' ? (jsxRuntime.jsx(CircularProgress, { size: 16, color: "inherit" })) : (jsxRuntime.jsx(FileDownloadIcon, { fontSize: "small" })), children: localization.exportDownload })] }));
|
|
1042
|
+
};
|
|
1043
|
+
const renderGroupedCheckbox = () => (jsxRuntime.jsx(Stack, { mt: "auto", children: jsxRuntime.jsx(FormControlLabel, { onChange: handleToggleGrouped, sx: { m: 0 }, control: jsxRuntime.jsx(Checkbox, { checked: grouped, size: "small" }), label: jsxRuntime.jsx(Typography, { variant: "body2", children: localization.exportGrouped }) }) }));
|
|
1044
|
+
return (jsxRuntime.jsxs(Stack, { direction: "row", gap: 0.5, alignItems: "center", children: [jsxRuntime.jsx(Tooltip, { title: isNoRowsSelected
|
|
1045
|
+
? localization.exportSelectRowsTooltip
|
|
1046
|
+
: localization.exportButton, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(Button, { "aria-label": localization.exportButton, disabled: isNoRowsSelected, onClick: handleOpenMenu, size: "small", startIcon: jsxRuntime.jsx(FileDownloadIcon, { fontSize: "small" }), variant: "text", children: localization.exportButton }) }) }), jsxRuntime.jsxs(Menu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleCloseMenu, anchorOrigin: { vertical: 'bottom', horizontal: 'left' }, transformOrigin: { vertical: 'top', horizontal: 'left' }, children: [jsxRuntime.jsxs(Stack, { direction: "row", sx: { px: 1, pt: 1, maxHeight: '320px', overflow: 'auto' }, children: [renderFormatSelector(), selectedFormat &&
|
|
1047
|
+
exportTypesForSelectedFormat.length > 0 &&
|
|
1048
|
+
renderExportTypeSelector()] }), jsxRuntime.jsx(Divider, { sx: { mt: 1 } }), jsxRuntime.jsxs(Stack, { direction: "row", alignItems: "center", sx: { px: 1, pb: 1 }, children: [renderActionButtons(), renderGroupedCheckbox()] })] })] }));
|
|
1221
1049
|
};
|
|
1222
1050
|
|
|
1223
|
-
const
|
|
1224
|
-
|
|
1225
|
-
const MRT_InsertHereAction = ({ onClick, }) => {
|
|
1226
|
-
return (jsxRuntime.jsx(Tooltip, { title: INSERT_HERE_TOOLTIP, disableInteractive: true, children: jsxRuntime.jsx(IconButton, { onClick: onClick, size: ACTION_ICON_SIZE$1, children: jsxRuntime.jsx(SubdirectoryArrowLeftIcon, { color: "warning" }) }) }));
|
|
1051
|
+
const MRT_ExportRowButton = ({ onClick }) => {
|
|
1052
|
+
return (jsxRuntime.jsx(IconButton, { sx: { p: 0 }, disableRipple: true, onClick: onClick, children: jsxRuntime.jsx(FileDownloadIcon, { fontSize: "small" }) }));
|
|
1227
1053
|
};
|
|
1228
1054
|
|
|
1229
|
-
const
|
|
1230
|
-
|
|
1231
|
-
const ACTION_BUTTON_HEIGHT = '1.75rem';
|
|
1232
|
-
const MRT_MoveToTopAction = ({ onClick }) => {
|
|
1233
|
-
return (jsxRuntime.jsx(Tooltip, { title: MOVE_TO_TOP_TOOLTIP, disableInteractive: true, children: jsxRuntime.jsx(IconButton, { onClick: onClick, size: ACTION_ICON_SIZE, sx: { height: ACTION_BUTTON_HEIGHT }, children: jsxRuntime.jsx(VerticalAlignTopIcon, { fontSize: "small" }) }) }));
|
|
1055
|
+
const MRT_PrintRowButton = ({ onClick }) => {
|
|
1056
|
+
return (jsxRuntime.jsx(IconButton, { sx: { p: 0 }, disableRipple: true, onClick: onClick, children: jsxRuntime.jsx(PrintIcon, { fontSize: "small" }) }));
|
|
1234
1057
|
};
|
|
1235
1058
|
|
|
1236
|
-
const
|
|
1237
|
-
return (jsxRuntime.
|
|
1238
|
-
color: (theme) => theme.palette.warning.main,
|
|
1239
|
-
'&.Mui-checked': {
|
|
1240
|
-
color: (theme) => theme.palette.warning.main,
|
|
1241
|
-
},
|
|
1242
|
-
} }));
|
|
1059
|
+
const ExportRowAction = ({ onExport, onPrint }) => {
|
|
1060
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MRT_ExportRowButton, { onClick: onExport }), onPrint && jsxRuntime.jsx(MRT_PrintRowButton, { onClick: onPrint })] }));
|
|
1243
1061
|
};
|
|
1244
1062
|
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
* Example: Row at depth 1 with a child at depth 3 → returns 3
|
|
1249
|
-
*/
|
|
1250
|
-
const getDeepestSubRowDepth = (row) => {
|
|
1251
|
-
var _a;
|
|
1252
|
-
if (!((_a = row.subRows) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1253
|
-
return row.depth;
|
|
1254
|
-
}
|
|
1255
|
-
return row.subRows.reduce((maxDepth, subRow) => Math.max(maxDepth, getDeepestSubRowDepth(subRow)), row.depth);
|
|
1256
|
-
};
|
|
1257
|
-
/**
|
|
1258
|
-
* Extracts an array of IDs of only the selected rows from the selection object.
|
|
1259
|
-
* Filters the record where the value is true and maps only the keys (IDs).
|
|
1260
|
-
* Example: { row1: true, row2: false, row3: true } → ['row1', 'row3']
|
|
1261
|
-
*/
|
|
1262
|
-
const getSelectedReorderRowIds = (rowReorderingSelection) => {
|
|
1263
|
-
return Object.entries(rowReorderingSelection !== null && rowReorderingSelection !== void 0 ? rowReorderingSelection : {})
|
|
1264
|
-
.filter(([, isSelected]) => isSelected)
|
|
1265
|
-
.map(([rowId]) => rowId);
|
|
1266
|
-
};
|
|
1267
|
-
/**
|
|
1268
|
-
* Checks WHETHER we can move selected rows as children of target row
|
|
1269
|
-
* without exceeding the maximum allowed depth.
|
|
1270
|
-
* Directly calculates the final maximum depth after the move.
|
|
1271
|
-
* Example: selectedRows at depth 1-2 with descendants to depth 4, target depth 1, maxDepth 5
|
|
1272
|
-
* → new max depth = 1 + 1 + (4 - 1) = 5, which equals maxDepth, so returns false
|
|
1273
|
-
*/
|
|
1274
|
-
const canInsertSelectedRowsWithoutExceedingMaxDepth = ({ maxDepth, selectedRows, targetRowDepth, }) => {
|
|
1275
|
-
// Cannot insert if there are no selected rows to move
|
|
1276
|
-
if (selectedRows.length === 0) {
|
|
1277
|
-
return false;
|
|
1278
|
-
}
|
|
1279
|
-
// No depth restriction - can insert anywhere
|
|
1280
|
-
if (maxDepth === undefined) {
|
|
1281
|
-
return true;
|
|
1282
|
-
}
|
|
1283
|
-
// Find the deepest descendant among all selected rows
|
|
1284
|
-
const maxDeepestDescendantDepth = selectedRows.reduce((max, row) => {
|
|
1285
|
-
return Math.max(max, getDeepestSubRowDepth(row));
|
|
1286
|
-
}, 0);
|
|
1287
|
-
// Find the minimum depth of selected rows (to calculate relative depth)
|
|
1288
|
-
const minSelectedRowDepth = Math.min(...selectedRows.map((r) => r.depth));
|
|
1289
|
-
// Calculate the maximum depth after moving rows as children of target
|
|
1290
|
-
// newMaxDepth = target.depth + 1 (as children) + relative depth of selected rows
|
|
1291
|
-
const newMaxDepth = targetRowDepth + 1 + (maxDeepestDescendantDepth - minSelectedRowDepth);
|
|
1292
|
-
return newMaxDepth < maxDepth;
|
|
1293
|
-
};
|
|
1294
|
-
/**
|
|
1295
|
-
* Finds the depth of the FIRST selected row in the selection object.
|
|
1296
|
-
* Used to enforce constraint: can only select rows at the SAME depth.
|
|
1297
|
-
* Example: If I select a row at depth 2, I cannot select a row at depth 3
|
|
1298
|
-
*/
|
|
1299
|
-
const getFirstSelectedReorderRowDepth = ({ rowReorderingSelection, table, }) => {
|
|
1300
|
-
var _a, _b;
|
|
1301
|
-
const firstSelectedRowId = (_a = Object.entries(rowReorderingSelection !== null && rowReorderingSelection !== void 0 ? rowReorderingSelection : {}).find(([, isSelected]) => isSelected)) === null || _a === void 0 ? void 0 : _a[0];
|
|
1302
|
-
if (!firstSelectedRowId) {
|
|
1303
|
-
return undefined;
|
|
1304
|
-
}
|
|
1305
|
-
return (_b = table.getRow(firstSelectedRowId, true)) === null || _b === void 0 ? void 0 : _b.depth;
|
|
1306
|
-
};
|
|
1307
|
-
/**
|
|
1308
|
-
* Checks WHETHER we can select a specific row.
|
|
1309
|
-
* Rule: If a selection already exists, new row MUST be at the SAME depth as the first selected.
|
|
1310
|
-
* Without this, you could move rows from different levels which would break the hierarchy.
|
|
1311
|
-
*/
|
|
1312
|
-
const canSelectRowForReorder = ({ rowId, rowDepth, rowReorderingSelection, firstSelectedReorderRowDepth, }) => {
|
|
1313
|
-
const isCurrentRowSelected = !!(rowReorderingSelection === null || rowReorderingSelection === void 0 ? void 0 : rowReorderingSelection[rowId]);
|
|
1314
|
-
if (isCurrentRowSelected) {
|
|
1315
|
-
return true;
|
|
1316
|
-
}
|
|
1317
|
-
const hasAnySelection = Object.values(rowReorderingSelection !== null && rowReorderingSelection !== void 0 ? rowReorderingSelection : {}).some(Boolean);
|
|
1318
|
-
if (!hasAnySelection) {
|
|
1319
|
-
return true;
|
|
1320
|
-
}
|
|
1321
|
-
return rowDepth === firstSelectedReorderRowDepth;
|
|
1322
|
-
};
|
|
1323
|
-
/**
|
|
1324
|
-
* Creates an array of MRT_Row objects from an array of IDs.
|
|
1325
|
-
* Finds each row from the table and collects it in the result.
|
|
1326
|
-
* Used to prepare data for the onTreeRowReorder callback.
|
|
1327
|
-
*/
|
|
1328
|
-
const buildSelectedRowsArray = (selectedRowIds, table) => {
|
|
1329
|
-
return selectedRowIds.reduce((selectedRows, selectedRowId) => {
|
|
1330
|
-
const selectedRow = table.getRow(selectedRowId, true);
|
|
1331
|
-
if (selectedRow) {
|
|
1332
|
-
selectedRows.push(selectedRow);
|
|
1333
|
-
}
|
|
1334
|
-
return selectedRows;
|
|
1335
|
-
}, []);
|
|
1063
|
+
const hasActiveExports = (table) => {
|
|
1064
|
+
const { activeExports } = table.getState();
|
|
1065
|
+
return !!((activeExports === null || activeExports === void 0 ? void 0 : activeExports.selectedFormat) && activeExports.selectedExports.length > 0);
|
|
1336
1066
|
};
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
* Used to prevent circular references (parent cannot become child of its own child).
|
|
1341
|
-
*/
|
|
1342
|
-
const isRowInSubtreeOf = (targetRowId, parentRow) => {
|
|
1067
|
+
// Same conditions as MRT_ExportsToolbar: pdf format selected, at least one export type,
|
|
1068
|
+
// and either grouped or exactly one export type selected.
|
|
1069
|
+
const isPrintAvailable = (table) => {
|
|
1343
1070
|
var _a;
|
|
1344
|
-
|
|
1071
|
+
const allFormats = Object.values((_a = table.options.availableExports) !== null && _a !== void 0 ? _a : {}).flatMap((e) => e.formats);
|
|
1072
|
+
if (!allFormats.includes('pdf'))
|
|
1345
1073
|
return false;
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
return false;
|
|
1074
|
+
const { activeExports } = table.getState();
|
|
1075
|
+
if (!activeExports)
|
|
1076
|
+
return false;
|
|
1077
|
+
const { selectedFormat, selectedExports, grouped } = activeExports;
|
|
1078
|
+
return (selectedFormat === 'pdf' &&
|
|
1079
|
+
selectedExports.length >= 1 &&
|
|
1080
|
+
(grouped || selectedExports.length === 1));
|
|
1356
1081
|
};
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
const
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
}
|
|
1377
|
-
return true;
|
|
1378
|
-
};
|
|
1379
|
-
|
|
1380
|
-
const useTreeRowReorderingCell = ({ row, table, rowReorderingSelection, maxDepth, onTreeRowReorder, }) => {
|
|
1381
|
-
const [isRowHovered, setIsRowHovered] = react.useState(false);
|
|
1382
|
-
const firstSelectedReorderRowDepth = getFirstSelectedReorderRowDepth({
|
|
1383
|
-
rowReorderingSelection,
|
|
1384
|
-
table,
|
|
1385
|
-
});
|
|
1386
|
-
const canSelectForReorder = canSelectRowForReorder({
|
|
1387
|
-
rowId: row.id,
|
|
1388
|
-
rowDepth: row.depth,
|
|
1389
|
-
rowReorderingSelection,
|
|
1390
|
-
firstSelectedReorderRowDepth,
|
|
1082
|
+
const createExportAction = (_a = {}) => {
|
|
1083
|
+
var { onExport, renderRow: customRenderRow, renderToolbar: customRenderToolbar } = _a, rest = __rest(_a, ["onExport", "renderRow", "renderToolbar"]);
|
|
1084
|
+
// Pure download logic — no notifications. Throws on failure so callers can handle it.
|
|
1085
|
+
const defaultOnExport = (_a) => __awaiter(void 0, [_a], void 0, function* ({ rowsToExport, table, }) {
|
|
1086
|
+
if (!rowsToExport.length)
|
|
1087
|
+
return;
|
|
1088
|
+
const { loadExport } = table.options;
|
|
1089
|
+
const { activeExports } = table.getState();
|
|
1090
|
+
if (!loadExport || !activeExports)
|
|
1091
|
+
return;
|
|
1092
|
+
const response = yield loadExport({
|
|
1093
|
+
format: activeExports.selectedFormat,
|
|
1094
|
+
exports: activeExports.selectedExports,
|
|
1095
|
+
separated_files: !activeExports.grouped,
|
|
1096
|
+
download: false,
|
|
1097
|
+
ids: JSON.stringify(rowsToExport.map((r) => r.id)),
|
|
1098
|
+
type: 'download',
|
|
1099
|
+
});
|
|
1100
|
+
downloadExportFiles(response);
|
|
1391
1101
|
});
|
|
1392
|
-
|
|
1393
|
-
const
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1102
|
+
// Pure print logic — no notifications. Throws on failure so callers can handle it.
|
|
1103
|
+
const defaultOnPrint = (_a) => __awaiter(void 0, [_a], void 0, function* ({ rowsToExport, table, }) {
|
|
1104
|
+
if (!rowsToExport.length)
|
|
1105
|
+
return;
|
|
1106
|
+
const { loadExport } = table.options;
|
|
1107
|
+
const { activeExports } = table.getState();
|
|
1108
|
+
if (!loadExport || !activeExports)
|
|
1109
|
+
return;
|
|
1110
|
+
const response = yield loadExport({
|
|
1111
|
+
format: activeExports.selectedFormat,
|
|
1112
|
+
exports: activeExports.selectedExports,
|
|
1113
|
+
separated_files: !activeExports.grouped,
|
|
1114
|
+
download: false,
|
|
1115
|
+
ids: JSON.stringify(rowsToExport.map((r) => r.id)),
|
|
1116
|
+
type: 'print',
|
|
1406
1117
|
});
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
const
|
|
1412
|
-
|
|
1413
|
-
|
|
1118
|
+
printExportFiles(response);
|
|
1119
|
+
});
|
|
1120
|
+
// Single execution pipeline for every export flow (row or toolbar).
|
|
1121
|
+
// If a custom handler exists, it receives defaultOnExport and decides when to call it.
|
|
1122
|
+
const executeExport = (context) => {
|
|
1123
|
+
const executeDefaultExport = () => defaultOnExport(context);
|
|
1124
|
+
if (onExport) {
|
|
1125
|
+
return onExport(Object.assign(Object.assign({}, context), { defaultOnExport: executeDefaultExport }));
|
|
1126
|
+
}
|
|
1127
|
+
return executeDefaultExport();
|
|
1128
|
+
};
|
|
1129
|
+
// Row download: checks for active exports, then wraps with loading/success/error notifications.
|
|
1130
|
+
const handleSingleRowExport = (_a) => __awaiter(void 0, [_a], void 0, function* ({ table, row, }) {
|
|
1131
|
+
const { localization } = table.options;
|
|
1132
|
+
if (!hasActiveExports(table)) {
|
|
1133
|
+
notistack.enqueueSnackbar(localization.exportNoExportsSelected, {
|
|
1134
|
+
variant: 'warning',
|
|
1135
|
+
});
|
|
1414
1136
|
return;
|
|
1415
1137
|
}
|
|
1138
|
+
const loadingKey = notistack.enqueueSnackbar(localization.exportInProgress, {
|
|
1139
|
+
variant: 'info',
|
|
1140
|
+
persist: true,
|
|
1141
|
+
});
|
|
1416
1142
|
try {
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
table,
|
|
1421
|
-
targetRow: row,
|
|
1422
|
-
};
|
|
1423
|
-
onTreeRowReorder(treeRowReorderEvent);
|
|
1143
|
+
yield executeExport({ table, rowsToExport: [row] });
|
|
1144
|
+
notistack.closeSnackbar(loadingKey);
|
|
1145
|
+
notistack.enqueueSnackbar(localization.exportSuccess, { variant: 'success' });
|
|
1424
1146
|
}
|
|
1425
|
-
catch (
|
|
1426
|
-
|
|
1147
|
+
catch (_b) {
|
|
1148
|
+
notistack.closeSnackbar(loadingKey);
|
|
1149
|
+
notistack.enqueueSnackbar(localization.exportError, { variant: 'error' });
|
|
1427
1150
|
}
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
table
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
isRowHovered,
|
|
1437
|
-
shouldShowReorderCheckbox,
|
|
1438
|
-
shouldShowInsertHereAction,
|
|
1439
|
-
handleRowHoverEnter: () => setIsRowHovered(true),
|
|
1440
|
-
handleRowHoverLeave: () => setIsRowHovered(false),
|
|
1441
|
-
handleReorderCheckboxChange,
|
|
1442
|
-
handleInsertHereActionClick,
|
|
1443
|
-
isReorderCheckboxSelected: !!(rowReorderingSelection === null || rowReorderingSelection === void 0 ? void 0 : rowReorderingSelection[row.id]),
|
|
1444
|
-
};
|
|
1445
|
-
};
|
|
1446
|
-
|
|
1447
|
-
const useTreeRowReorderingHeader = ({ table, enableRowReordering, onTreeRowReorder, }) => {
|
|
1448
|
-
const rowReorderingSelection = useMRT_SliceValue(table._uiStore, (s) => s.rowReorderingSelection);
|
|
1449
|
-
const selectedReorderRowIds = getSelectedReorderRowIds(rowReorderingSelection);
|
|
1450
|
-
const selectedRowsForReorder = buildSelectedRowsArray(selectedReorderRowIds, table);
|
|
1451
|
-
const shouldShowMoveToTopLevelAction = !!enableRowReordering &&
|
|
1452
|
-
selectedRowsForReorder.length > 0 &&
|
|
1453
|
-
selectedRowsForReorder.some((selectedRow) => selectedRow.depth > 0);
|
|
1454
|
-
const handleMoveToTopLevelActionClick = react.useCallback(() => {
|
|
1455
|
-
if (!onTreeRowReorder) {
|
|
1456
|
-
console.warn('[MRT] onTreeRowReorder callback is not defined');
|
|
1151
|
+
});
|
|
1152
|
+
// Row print: same guard + notification pattern as download, but calls defaultOnPrint.
|
|
1153
|
+
const handleSingleRowPrint = (_a) => __awaiter(void 0, [_a], void 0, function* ({ table, row, }) {
|
|
1154
|
+
const { localization } = table.options;
|
|
1155
|
+
if (!hasActiveExports(table)) {
|
|
1156
|
+
notistack.enqueueSnackbar(localization.exportNoExportsSelected, {
|
|
1157
|
+
variant: 'warning',
|
|
1158
|
+
});
|
|
1457
1159
|
return;
|
|
1458
1160
|
}
|
|
1161
|
+
const loadingKey = notistack.enqueueSnackbar(localization.exportInProgress, {
|
|
1162
|
+
variant: 'info',
|
|
1163
|
+
persist: true,
|
|
1164
|
+
});
|
|
1459
1165
|
try {
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
table,
|
|
1464
|
-
targetRow: null,
|
|
1465
|
-
};
|
|
1466
|
-
onTreeRowReorder(treeRowReorderEvent);
|
|
1166
|
+
yield defaultOnPrint({ table, rowsToExport: [row] });
|
|
1167
|
+
notistack.closeSnackbar(loadingKey);
|
|
1168
|
+
notistack.enqueueSnackbar(localization.exportSuccess, { variant: 'success' });
|
|
1467
1169
|
}
|
|
1468
|
-
catch (
|
|
1469
|
-
|
|
1170
|
+
catch (_b) {
|
|
1171
|
+
notistack.closeSnackbar(loadingKey);
|
|
1172
|
+
notistack.enqueueSnackbar(localization.exportError, { variant: 'error' });
|
|
1470
1173
|
}
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1174
|
+
});
|
|
1175
|
+
// Resolves selected rows from table state for toolbar-triggered export (custom renderToolbar only).
|
|
1176
|
+
const handleMultipleRowExport = ({ table, }) => {
|
|
1177
|
+
const rowsToExport = table.getSelectedRowModel().rows;
|
|
1178
|
+
return executeExport({ table, rowsToExport });
|
|
1475
1179
|
};
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
const
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
const
|
|
1483
|
-
|
|
1484
|
-
|
|
1180
|
+
const createRowExportExecutor = (context) => () => {
|
|
1181
|
+
void handleSingleRowExport(context);
|
|
1182
|
+
};
|
|
1183
|
+
const createRowPrintExecutor = (context) => () => {
|
|
1184
|
+
void handleSingleRowPrint(context);
|
|
1185
|
+
};
|
|
1186
|
+
const createToolbarExportExecutor = (context) => () => {
|
|
1187
|
+
void handleMultipleRowExport(context);
|
|
1188
|
+
};
|
|
1189
|
+
// Renders download + optional print button. Print is shown under the same conditions
|
|
1190
|
+
// as in MRT_ExportsToolbar: pdf format selected, active exports, grouped or single type.
|
|
1191
|
+
const renderRowAction = (context) => {
|
|
1192
|
+
const onRowExport = createRowExportExecutor(context);
|
|
1193
|
+
const onRowPrint = isPrintAvailable(context.table)
|
|
1194
|
+
? createRowPrintExecutor(context)
|
|
1195
|
+
: undefined;
|
|
1196
|
+
if (customRenderRow) {
|
|
1197
|
+
return customRenderRow(Object.assign(Object.assign({}, context), { onExport: onRowExport }));
|
|
1485
1198
|
}
|
|
1486
|
-
:
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1199
|
+
return jsxRuntime.jsx(ExportRowAction, { onExport: onRowExport, onPrint: onRowPrint });
|
|
1200
|
+
};
|
|
1201
|
+
// Uses custom toolbar renderer when provided; otherwise renders MRT_ExportsToolbar.
|
|
1202
|
+
// loadExport is always wrapped with notifications so that loading/success/error are shown
|
|
1203
|
+
// regardless of whether a custom onExport handler was provided.
|
|
1204
|
+
// When onExport is provided, it intercepts the call and returns [] so MRT_ExportsToolbar
|
|
1205
|
+
// does not attempt a second download from an empty response.
|
|
1206
|
+
const renderToolbarAction = (context) => {
|
|
1207
|
+
const { table } = context;
|
|
1208
|
+
const { availableExports, loadExport, onActiveExportsChange, localization, } = table.options;
|
|
1209
|
+
const { activeExports } = table.getState();
|
|
1210
|
+
if (customRenderToolbar) {
|
|
1211
|
+
return customRenderToolbar(Object.assign(Object.assign({}, context), { onExport: createToolbarExportExecutor(context) }));
|
|
1212
|
+
}
|
|
1213
|
+
if (!availableExports ||
|
|
1214
|
+
!loadExport ||
|
|
1215
|
+
!onActiveExportsChange ||
|
|
1216
|
+
!activeExports) {
|
|
1217
|
+
return null;
|
|
1218
|
+
}
|
|
1219
|
+
const notifiedLoadExport = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1220
|
+
const loadingKey = notistack.enqueueSnackbar(localization.exportInProgress, {
|
|
1221
|
+
variant: 'info',
|
|
1222
|
+
persist: true,
|
|
1496
1223
|
});
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
: defaultGroupedCell, cellLogic.shouldShowReorderCheckbox && (jsxRuntime.jsx(MRT_ReorderRowCheckbox, { isSelected: cellLogic.isReorderCheckboxSelected, onChange: cellLogic.handleReorderCheckboxChange })), cellLogic.shouldShowInsertHereAction && (jsxRuntime.jsx(MRT_InsertHereAction, { onClick: cellLogic.handleInsertHereActionClick })), !!subRowsLength && jsxRuntime.jsxs("span", { children: ["(", subRowsLength, ")"] })] }));
|
|
1224
|
+
try {
|
|
1225
|
+
let response;
|
|
1226
|
+
if (onExport) {
|
|
1227
|
+
const rowsToExport = table.getSelectedRowModel().rows;
|
|
1228
|
+
yield executeExport({ table, rowsToExport });
|
|
1229
|
+
response = [];
|
|
1230
|
+
}
|
|
1231
|
+
else {
|
|
1232
|
+
response = yield loadExport(params);
|
|
1233
|
+
}
|
|
1234
|
+
notistack.closeSnackbar(loadingKey);
|
|
1235
|
+
notistack.enqueueSnackbar(localization.exportSuccess, { variant: 'success' });
|
|
1236
|
+
return response;
|
|
1511
1237
|
}
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
const headerLogic = useTreeRowReorderingHeader({
|
|
1517
|
-
table,
|
|
1518
|
-
enableRowReordering,
|
|
1519
|
-
onTreeRowReorder,
|
|
1520
|
-
});
|
|
1521
|
-
return (jsxRuntime.jsxs(Stack, { alignItems: "center", flexDirection: "row", gap: TREE_REORDER_ICON_SPACING, children: [jsxRuntime.jsx(MRT_ExpandAllButton, { table: table }), headerLogic.shouldShowMoveToTopLevelAction && (jsxRuntime.jsx(MRT_MoveToTopAction, { onClick: headerLogic.handleMoveToTopLevelActionClick })), groupedColumnMode === 'remove' &&
|
|
1522
|
-
((_a = grouping === null || grouping === void 0 ? void 0 : grouping.map((groupedColumnId) => table.getColumn(groupedColumnId).columnDef.header)) === null || _a === void 0 ? void 0 : _a.join(', '))] }));
|
|
1238
|
+
catch (_a) {
|
|
1239
|
+
notistack.closeSnackbar(loadingKey);
|
|
1240
|
+
notistack.enqueueSnackbar(localization.exportError, { variant: 'error' });
|
|
1241
|
+
return [];
|
|
1523
1242
|
}
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
? ((_a = defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.size) !== null && _a !== void 0 ? _a : 180)
|
|
1529
|
-
: renderDetailPanel
|
|
1530
|
-
? enableExpandAll
|
|
1531
|
-
? 60
|
|
1532
|
-
: 70
|
|
1533
|
-
: 100,
|
|
1534
|
-
tableOptions,
|
|
1535
|
-
})), { enableResizing: true });
|
|
1243
|
+
});
|
|
1244
|
+
return (jsxRuntime.jsx(MRT_ExportsToolbar, { table: table, availableExports: availableExports, exportState: activeExports, onExportStateChange: onActiveExportsChange, loadExport: notifiedLoadExport }));
|
|
1245
|
+
};
|
|
1246
|
+
return Object.assign({ name: 'export', renderRow: renderRowAction, renderToolbar: renderToolbarAction }, rest);
|
|
1536
1247
|
};
|
|
1537
1248
|
|
|
1538
|
-
const
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1249
|
+
const MRT_AggregationFns = Object.assign({}, reactTable.aggregationFns);
|
|
1250
|
+
|
|
1251
|
+
const fuzzy = (row, columnId, filterValue, addMeta) => {
|
|
1252
|
+
const itemRank = matchSorterUtils.rankItem(row.getValue(columnId), filterValue, {
|
|
1253
|
+
threshold: matchSorterUtils.rankings.MATCHES,
|
|
1254
|
+
});
|
|
1255
|
+
addMeta(itemRank);
|
|
1256
|
+
return itemRank.passed;
|
|
1257
|
+
};
|
|
1258
|
+
fuzzy.autoRemove = (val) => !val;
|
|
1259
|
+
const contains = (row, id, filterValue) => {
|
|
1260
|
+
var _a;
|
|
1261
|
+
return !!((_a = row
|
|
1262
|
+
.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim().includes(filterValue.toString().toLowerCase().trim()));
|
|
1263
|
+
};
|
|
1264
|
+
contains.autoRemove = (val) => !val;
|
|
1265
|
+
const startsWith = (row, id, filterValue) => {
|
|
1266
|
+
var _a;
|
|
1267
|
+
return !!((_a = row
|
|
1268
|
+
.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim().startsWith(filterValue.toString().toLowerCase().trim()));
|
|
1269
|
+
};
|
|
1270
|
+
startsWith.autoRemove = (val) => !val;
|
|
1271
|
+
const endsWith = (row, id, filterValue) => {
|
|
1272
|
+
var _a;
|
|
1273
|
+
return !!((_a = row
|
|
1274
|
+
.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim().endsWith(filterValue.toString().toLowerCase().trim()));
|
|
1275
|
+
};
|
|
1276
|
+
endsWith.autoRemove = (val) => !val;
|
|
1277
|
+
const equals = (row, id, filterValue) => {
|
|
1278
|
+
var _a;
|
|
1279
|
+
return ((_a = row.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim()) ===
|
|
1280
|
+
filterValue.toString().toLowerCase().trim();
|
|
1281
|
+
};
|
|
1282
|
+
equals.autoRemove = (val) => !val;
|
|
1283
|
+
const notEquals = (row, id, filterValue) => {
|
|
1284
|
+
var _a;
|
|
1285
|
+
return ((_a = row.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase().trim()) !==
|
|
1286
|
+
filterValue.toString().toLowerCase().trim();
|
|
1287
|
+
};
|
|
1288
|
+
notEquals.autoRemove = (val) => !val;
|
|
1289
|
+
const greaterThan = (row, id, filterValue) => {
|
|
1290
|
+
var _a, _b, _c;
|
|
1291
|
+
return !isNaN(+filterValue) && !isNaN(+row.getValue(id))
|
|
1292
|
+
? +((_a = row.getValue(id)) !== null && _a !== void 0 ? _a : 0) > +filterValue
|
|
1293
|
+
: ((_c = ((_b = row.getValue(id)) !== null && _b !== void 0 ? _b : '')) === null || _c === void 0 ? void 0 : _c.toString().toLowerCase().trim()) > filterValue.toString().toLowerCase().trim();
|
|
1294
|
+
};
|
|
1295
|
+
greaterThan.autoRemove = (val) => !val;
|
|
1296
|
+
const greaterThanOrEqualTo = (row, id, filterValue) => equals(row, id, filterValue) || greaterThan(row, id, filterValue);
|
|
1297
|
+
greaterThanOrEqualTo.autoRemove = (val) => !val;
|
|
1298
|
+
const lessThan = (row, id, filterValue) => {
|
|
1299
|
+
var _a, _b, _c;
|
|
1300
|
+
return !isNaN(+filterValue) && !isNaN(+row.getValue(id))
|
|
1301
|
+
? +((_a = row.getValue(id)) !== null && _a !== void 0 ? _a : 0) < +filterValue
|
|
1302
|
+
: ((_c = ((_b = row.getValue(id)) !== null && _b !== void 0 ? _b : '')) === null || _c === void 0 ? void 0 : _c.toString().toLowerCase().trim()) < filterValue.toString().toLowerCase().trim();
|
|
1303
|
+
};
|
|
1304
|
+
lessThan.autoRemove = (val) => !val;
|
|
1305
|
+
const lessThanOrEqualTo = (row, id, filterValue) => equals(row, id, filterValue) || lessThan(row, id, filterValue);
|
|
1306
|
+
lessThanOrEqualTo.autoRemove = (val) => !val;
|
|
1307
|
+
const between = (row, id, filterValues) => (['', undefined].includes(filterValues[0]) ||
|
|
1308
|
+
greaterThan(row, id, filterValues[0])) &&
|
|
1309
|
+
((!isNaN(+filterValues[0]) &&
|
|
1310
|
+
!isNaN(+filterValues[1]) &&
|
|
1311
|
+
+filterValues[0] > +filterValues[1]) ||
|
|
1312
|
+
['', undefined].includes(filterValues[1]) ||
|
|
1313
|
+
lessThan(row, id, filterValues[1]));
|
|
1314
|
+
between.autoRemove = (val) => !val;
|
|
1315
|
+
const betweenInclusive = (row, id, filterValues) => (['', undefined].includes(filterValues[0]) ||
|
|
1316
|
+
greaterThanOrEqualTo(row, id, filterValues[0])) &&
|
|
1317
|
+
((!isNaN(+filterValues[0]) &&
|
|
1318
|
+
!isNaN(+filterValues[1]) &&
|
|
1319
|
+
+filterValues[0] > +filterValues[1]) ||
|
|
1320
|
+
['', undefined].includes(filterValues[1]) ||
|
|
1321
|
+
lessThanOrEqualTo(row, id, filterValues[1]));
|
|
1322
|
+
betweenInclusive.autoRemove = (val) => !val;
|
|
1323
|
+
const empty = (row, id, _filterValue) => { var _a; return !((_a = row.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().trim()); };
|
|
1324
|
+
empty.autoRemove = (val) => !val;
|
|
1325
|
+
const notEmpty = (row, id, _filterValue) => { var _a; return !!((_a = row.getValue(id)) === null || _a === void 0 ? void 0 : _a.toString().trim()); };
|
|
1326
|
+
notEmpty.autoRemove = (val) => !val;
|
|
1327
|
+
const MRT_FilterFns = Object.assign(Object.assign({}, reactTable.filterFns), { between,
|
|
1328
|
+
betweenInclusive,
|
|
1329
|
+
contains,
|
|
1330
|
+
empty,
|
|
1331
|
+
endsWith,
|
|
1332
|
+
equals,
|
|
1333
|
+
fuzzy,
|
|
1334
|
+
greaterThan,
|
|
1335
|
+
greaterThanOrEqualTo,
|
|
1336
|
+
lessThan,
|
|
1337
|
+
lessThanOrEqualTo,
|
|
1338
|
+
notEmpty,
|
|
1339
|
+
notEquals,
|
|
1340
|
+
startsWith });
|
|
1341
|
+
|
|
1342
|
+
const useMRT_SliceValue = (store, selector) => {
|
|
1343
|
+
const getSnapshot = () => selector(store.get());
|
|
1344
|
+
return react.useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
|
|
1552
1345
|
};
|
|
1553
1346
|
|
|
1554
|
-
const
|
|
1555
|
-
var {
|
|
1556
|
-
const { options: { icons: {
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
: pinningPosition === 'top'
|
|
1568
|
-
? 180
|
|
1569
|
-
: 0}deg)`,
|
|
1570
|
-
} })) })) })));
|
|
1347
|
+
const MRT_ActionMenuItem = (_a) => {
|
|
1348
|
+
var { icon, label, onOpenSubMenu, table } = _a, rest = __rest(_a, ["icon", "label", "onOpenSubMenu", "table"]);
|
|
1349
|
+
const { options: { icons: { ArrowRightIcon }, }, } = table;
|
|
1350
|
+
return (jsxRuntime.jsxs(MenuItem, Object.assign({ sx: {
|
|
1351
|
+
alignItems: 'center',
|
|
1352
|
+
justifyContent: 'space-between',
|
|
1353
|
+
minWidth: '120px',
|
|
1354
|
+
my: 0,
|
|
1355
|
+
py: '6px',
|
|
1356
|
+
}, tabIndex: 0 }, rest, { children: [jsxRuntime.jsxs(Box, { sx: {
|
|
1357
|
+
alignItems: 'center',
|
|
1358
|
+
display: 'flex',
|
|
1359
|
+
}, children: [jsxRuntime.jsx(ListItemIcon, { children: icon }), label] }), onOpenSubMenu && (jsxRuntime.jsx(IconButton, { onClick: (e) => onOpenSubMenu(e), onMouseEnter: (e) => onOpenSubMenu(e), size: "small", sx: { p: 0 }, children: jsxRuntime.jsx(ArrowRightIcon, {}) }))] })));
|
|
1571
1360
|
};
|
|
1572
1361
|
|
|
1573
|
-
const
|
|
1574
|
-
var { row, table } = _a, rest = __rest(_a, ["row", "table"]);
|
|
1575
|
-
const { options: {
|
|
1362
|
+
const MRT_RowActionMenu = (_a) => {
|
|
1363
|
+
var { anchorEl, handleEdit, row, setAnchorEl, staticRowIndex, table } = _a, rest = __rest(_a, ["anchorEl", "handleEdit", "row", "setAnchorEl", "staticRowIndex", "table"]);
|
|
1364
|
+
const { options: { editDisplayMode, enableEditing, icons: { EditIcon }, localization, mrtTheme: { menuBackgroundColor }, renderRowActionMenuItems, }, } = table;
|
|
1576
1365
|
const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
|
|
1577
|
-
const
|
|
1578
|
-
|
|
1366
|
+
const menuItems = react.useMemo(() => {
|
|
1367
|
+
const items = [];
|
|
1368
|
+
const editItem = parseFromValuesOrFunc(enableEditing, row) &&
|
|
1369
|
+
['modal', 'row'].includes(editDisplayMode) && (jsxRuntime.jsx(MRT_ActionMenuItem, { icon: jsxRuntime.jsx(EditIcon, {}), label: localization.edit, onClick: handleEdit, table: table }, 'edit'));
|
|
1370
|
+
if (editItem)
|
|
1371
|
+
items.push(editItem);
|
|
1372
|
+
const rowActionMenuItems = renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
|
|
1373
|
+
closeMenu: () => setAnchorEl(null),
|
|
1374
|
+
row,
|
|
1375
|
+
staticRowIndex,
|
|
1376
|
+
table,
|
|
1377
|
+
});
|
|
1378
|
+
if (rowActionMenuItems === null || rowActionMenuItems === void 0 ? void 0 : rowActionMenuItems.length)
|
|
1379
|
+
items.push(...rowActionMenuItems);
|
|
1380
|
+
return items;
|
|
1381
|
+
}, [renderRowActionMenuItems, row, staticRowIndex, table]);
|
|
1382
|
+
if (!menuItems.length)
|
|
1579
1383
|
return null;
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
}, children: [jsxRuntime.jsx(MRT_RowPinButton, Object.assign({ pinningPosition: "top" }, rowPinButtonProps)), jsxRuntime.jsx(MRT_RowPinButton, Object.assign({ pinningPosition: "bottom" }, rowPinButtonProps))] }));
|
|
1587
|
-
}
|
|
1588
|
-
return (jsxRuntime.jsx(MRT_RowPinButton, Object.assign({ pinningPosition: rowPinningDisplayMode === 'bottom' ? 'bottom' : 'top' }, rowPinButtonProps)));
|
|
1589
|
-
};
|
|
1590
|
-
|
|
1591
|
-
const getMRT_RowPinningColumnDef = (tableOptions) => {
|
|
1592
|
-
return Object.assign({ Cell: ({ row, table }) => (jsxRuntime.jsx(MRT_TableBodyRowPinButton, { row: row, table: table })), grow: false }, defaultDisplayColumnProps({
|
|
1593
|
-
header: 'pin',
|
|
1594
|
-
id: 'mrt-row-pin',
|
|
1595
|
-
size: 60,
|
|
1596
|
-
tableOptions,
|
|
1597
|
-
}));
|
|
1384
|
+
return (jsxRuntime.jsx(Menu, Object.assign({ MenuListProps: {
|
|
1385
|
+
dense: density === 'compact',
|
|
1386
|
+
sx: {
|
|
1387
|
+
backgroundColor: menuBackgroundColor,
|
|
1388
|
+
},
|
|
1389
|
+
}, anchorEl: anchorEl, disableScrollLock: true, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: menuItems })));
|
|
1598
1390
|
};
|
|
1599
1391
|
|
|
1600
|
-
const
|
|
1601
|
-
|
|
1602
|
-
const
|
|
1603
|
-
const {
|
|
1604
|
-
|
|
1605
|
-
const
|
|
1606
|
-
const
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
};
|
|
1611
|
-
const handleClose = () => {
|
|
1612
|
-
setAnchorEl(null);
|
|
1613
|
-
};
|
|
1614
|
-
// Clears row pinning on every bulk selection/deselection
|
|
1615
|
-
const clearPinning = () => {
|
|
1616
|
-
if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'))) {
|
|
1617
|
-
table.setRowPinning({ bottom: [], top: [] });
|
|
1618
|
-
}
|
|
1619
|
-
};
|
|
1620
|
-
// ── Current-page actions ────────────────────────────────────────────────────
|
|
1621
|
-
const handleSelectCurrentPage = () => {
|
|
1622
|
-
table.toggleAllPageRowsSelected(true);
|
|
1623
|
-
clearPinning();
|
|
1624
|
-
handleClose();
|
|
1625
|
-
};
|
|
1626
|
-
const handleDeselectCurrentPage = () => {
|
|
1627
|
-
if (allSelectableRowIdsRef.current.length > 0) {
|
|
1628
|
-
// When all pages are selected, deselecting the current page must clear the entire selection — otherwise rows on other pages remain "ghost-selected" but the user can't see them.
|
|
1629
|
-
table.setRowSelection({});
|
|
1630
|
-
allSelectableRowIdsRef.current = [];
|
|
1392
|
+
const MRT_EditActionButtons = (_a) => {
|
|
1393
|
+
var { row, table, variant = 'icon' } = _a, rest = __rest(_a, ["row", "table", "variant"]);
|
|
1394
|
+
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowCancel, onEditingRowSave, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
|
|
1395
|
+
const { creatingRow, isSaving } = getState();
|
|
1396
|
+
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
|
1397
|
+
const isEditing = useMRT_SliceValue(table._uiStore, (s) => { var _a; return ((_a = s.editingRow) === null || _a === void 0 ? void 0 : _a.id) === row.id; });
|
|
1398
|
+
const handleCancel = () => {
|
|
1399
|
+
if (isCreating) {
|
|
1400
|
+
onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
|
|
1401
|
+
setCreatingRow(null);
|
|
1631
1402
|
}
|
|
1632
|
-
else {
|
|
1633
|
-
table
|
|
1403
|
+
else if (isEditing) {
|
|
1404
|
+
onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
|
|
1405
|
+
setEditingRow(null);
|
|
1634
1406
|
}
|
|
1635
|
-
|
|
1636
|
-
handleClose();
|
|
1407
|
+
row._valuesCache = {}; //reset values cache
|
|
1637
1408
|
};
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
allSelectableRowIdsRef.current = ids;
|
|
1648
|
-
const newSelection = {};
|
|
1649
|
-
ids.forEach((id) => {
|
|
1650
|
-
newSelection[id] = true;
|
|
1651
|
-
});
|
|
1652
|
-
table.setRowSelection(newSelection);
|
|
1653
|
-
clearPinning();
|
|
1654
|
-
}
|
|
1655
|
-
finally {
|
|
1656
|
-
setIsSelectingAllPages(false);
|
|
1657
|
-
table.setShowProgressBars(false);
|
|
1409
|
+
const handleSubmitRow = () => {
|
|
1410
|
+
var _a, _b;
|
|
1411
|
+
//look for auto-filled input values
|
|
1412
|
+
(_b = Object.values((_a = editInputRefs.current) !== null && _a !== void 0 ? _a : {})
|
|
1413
|
+
.filter((inputRef) => { var _a, _b; return row.id === ((_b = (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.name) === null || _a === void 0 ? void 0 : _a.split('_')) === null || _b === void 0 ? void 0 : _b[0]); })) === null || _b === void 0 ? void 0 : _b.forEach((input) => {
|
|
1414
|
+
if (input.value !== undefined &&
|
|
1415
|
+
Object.hasOwn(row === null || row === void 0 ? void 0 : row._valuesCache, input.name)) {
|
|
1416
|
+
// @ts-expect-error
|
|
1417
|
+
row._valuesCache[input.name] = input.value;
|
|
1658
1418
|
}
|
|
1419
|
+
});
|
|
1420
|
+
if (isCreating)
|
|
1421
|
+
onCreatingRowSave === null || onCreatingRowSave === void 0 ? void 0 : onCreatingRowSave({
|
|
1422
|
+
exitCreatingMode: () => setCreatingRow(null),
|
|
1423
|
+
row,
|
|
1424
|
+
table,
|
|
1425
|
+
values: row._valuesCache,
|
|
1426
|
+
});
|
|
1427
|
+
else if (isEditing) {
|
|
1428
|
+
onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
|
|
1429
|
+
exitEditingMode: () => setEditingRow(null),
|
|
1430
|
+
row,
|
|
1431
|
+
table,
|
|
1432
|
+
values: row === null || row === void 0 ? void 0 : row._valuesCache,
|
|
1433
|
+
});
|
|
1659
1434
|
}
|
|
1660
|
-
else {
|
|
1661
|
-
// Client-side: all data is available locally
|
|
1662
|
-
table.toggleAllRowsSelected(true);
|
|
1663
|
-
clearPinning();
|
|
1664
|
-
}
|
|
1665
|
-
});
|
|
1666
|
-
const handleDeselectAllPages = () => {
|
|
1667
|
-
if (getAllSelectableRowIds) {
|
|
1668
|
-
table.setRowSelection({});
|
|
1669
|
-
}
|
|
1670
|
-
else {
|
|
1671
|
-
table.toggleAllRowsSelected(false);
|
|
1672
|
-
}
|
|
1673
|
-
allSelectableRowIdsRef.current = [];
|
|
1674
|
-
clearPinning();
|
|
1675
|
-
handleClose();
|
|
1676
1435
|
};
|
|
1677
|
-
|
|
1678
|
-
|
|
1436
|
+
return (jsxRuntime.jsx(Box, { onClick: (e) => e.stopPropagation(), sx: (theme) => (Object.assign({ display: 'flex', gap: '0.75rem' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: variant === 'icon' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip, { title: localization.cancel, children: jsxRuntime.jsx(IconButton, { "aria-label": localization.cancel, onClick: handleCancel, children: jsxRuntime.jsx(CancelIcon, {}) }) }), ((isCreating && onCreatingRowSave) ||
|
|
1437
|
+
(isEditing && onEditingRowSave)) && (jsxRuntime.jsx(Tooltip, { title: localization.save, children: jsxRuntime.jsx(IconButton, { "aria-label": localization.save, color: "info", disabled: isSaving, onClick: handleSubmitRow, children: isSaving ? jsxRuntime.jsx(CircularProgress, { size: 18 }) : jsxRuntime.jsx(SaveIcon, {}) }) }))] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Button, { onClick: handleCancel, sx: { minWidth: '100px' }, children: localization.cancel }), jsxRuntime.jsxs(Button, { disabled: isSaving, onClick: handleSubmitRow, sx: { minWidth: '100px' }, variant: "contained", children: [isSaving && jsxRuntime.jsx(CircularProgress, { color: "inherit", size: 18 }), localization.save] })] })) }));
|
|
1679
1438
|
};
|
|
1680
1439
|
|
|
1681
|
-
const
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
const
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
const allRowsSelected = selectAll
|
|
1689
|
-
? selectAllMode === 'page'
|
|
1690
|
-
? table.getIsAllPageRowsSelected()
|
|
1691
|
-
: table.getIsAllRowsSelected()
|
|
1692
|
-
: undefined;
|
|
1693
|
-
const isChecked = selectAll
|
|
1694
|
-
? allRowsSelected
|
|
1695
|
-
: getIsRowSelected({ row, table });
|
|
1696
|
-
const checkboxProps = Object.assign(Object.assign({}, (selectAll
|
|
1697
|
-
? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
|
|
1698
|
-
: parseFromValuesOrFunc(muiSelectCheckboxProps, {
|
|
1699
|
-
row,
|
|
1700
|
-
staticRowIndex,
|
|
1701
|
-
table,
|
|
1702
|
-
}))), rest);
|
|
1703
|
-
const onSelectionChange = row
|
|
1704
|
-
? getMRT_RowSelectionHandler({
|
|
1705
|
-
row,
|
|
1706
|
-
staticRowIndex,
|
|
1707
|
-
table,
|
|
1708
|
-
})
|
|
1709
|
-
: undefined;
|
|
1710
|
-
const onSelectAllChange = getMRT_SelectAllHandler({ table });
|
|
1711
|
-
const commonProps = Object.assign(Object.assign({ 'aria-label': selectAll
|
|
1712
|
-
? localization.toggleSelectAll
|
|
1713
|
-
: localization.toggleSelectRow, checked: isChecked, disabled: isLoading || (row && !row.getCanSelect()) || (row === null || row === void 0 ? void 0 : row.id) === 'mrt-row-create', inputProps: {
|
|
1714
|
-
'aria-label': selectAll
|
|
1715
|
-
? localization.toggleSelectAll
|
|
1716
|
-
: localization.toggleSelectRow,
|
|
1717
|
-
}, onChange: (event) => {
|
|
1718
|
-
event.stopPropagation();
|
|
1719
|
-
selectAll ? onSelectAllChange(event) : onSelectionChange(event);
|
|
1720
|
-
}, size: (density === 'compact' ? 'small' : 'medium') }, checkboxProps), { onClick: (e) => {
|
|
1721
|
-
var _a;
|
|
1722
|
-
e.stopPropagation();
|
|
1723
|
-
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
|
1724
|
-
}, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.5rem', zIndex: 0 }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))), title: undefined });
|
|
1725
|
-
return (jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : (selectAll
|
|
1726
|
-
? localization.toggleSelectAll
|
|
1727
|
-
: localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsxRuntime.jsx(Radio, Object.assign({}, commonProps))) : (jsxRuntime.jsx(Checkbox, Object.assign({ disableRipple: true, indeterminate: !isChecked && selectAll
|
|
1728
|
-
? table.getIsSomeRowsSelected()
|
|
1729
|
-
: (row === null || row === void 0 ? void 0 : row.getIsSomeSelected()) && row.getCanSelectSubRows() }, commonProps))) })));
|
|
1440
|
+
const parseCSSVarId = (id) => id.replace(/[^a-zA-Z0-9]/g, '_');
|
|
1441
|
+
const getMRTTheme = (mrtTheme, muiTheme) => {
|
|
1442
|
+
const mrtThemeOverrides = parseFromValuesOrFunc(mrtTheme, muiTheme);
|
|
1443
|
+
const baseBackgroundColor = muiTheme.palette.background.default;
|
|
1444
|
+
return Object.assign({ baseBackgroundColor, cellNavigationOutlineColor: muiTheme.palette.primary.main, draggingBorderColor: muiTheme.palette.primary.main, matchHighlightColor: muiTheme.palette.mode === 'dark'
|
|
1445
|
+
? styles.darken(muiTheme.palette.warning.dark, 0.25)
|
|
1446
|
+
: styles.lighten(muiTheme.palette.warning.light, 0.5), menuBackgroundColor: styles.lighten(baseBackgroundColor, 0.07), pinnedRowBackgroundColor: styles.alpha(muiTheme.palette.primary.main, 0.1), selectedRowBackgroundColor: styles.alpha(muiTheme.palette.primary.main, 0.2) }, mrtThemeOverrides);
|
|
1730
1447
|
};
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
size: enableSelectAll ? 90 : 70, // widened from 60 to accommodate both the checkbox and the menu button
|
|
1740
|
-
tableOptions,
|
|
1741
|
-
}));
|
|
1448
|
+
const commonCellBeforeAfterStyles = {
|
|
1449
|
+
content: '""',
|
|
1450
|
+
height: '100%',
|
|
1451
|
+
left: 0,
|
|
1452
|
+
position: 'absolute',
|
|
1453
|
+
top: 0,
|
|
1454
|
+
width: '100%',
|
|
1455
|
+
zIndex: -1,
|
|
1742
1456
|
};
|
|
1743
|
-
|
|
1744
|
-
const
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
ChevronRightIcon,
|
|
1751
|
-
ClearAllIcon,
|
|
1752
|
-
CloseIcon,
|
|
1753
|
-
ContentCopy,
|
|
1754
|
-
DensityLargeIcon,
|
|
1755
|
-
DensityMediumIcon,
|
|
1756
|
-
DensitySmallIcon,
|
|
1757
|
-
DragHandleIcon,
|
|
1758
|
-
DynamicFeedIcon,
|
|
1759
|
-
EditIcon,
|
|
1760
|
-
ExpandMoreIcon,
|
|
1761
|
-
FilterAltIcon,
|
|
1762
|
-
FilterListIcon,
|
|
1763
|
-
FilterListOffIcon,
|
|
1764
|
-
FirstPageIcon,
|
|
1765
|
-
FullscreenExitIcon,
|
|
1766
|
-
FullscreenIcon,
|
|
1767
|
-
KeyboardDoubleArrowDownIcon,
|
|
1768
|
-
LastPageIcon,
|
|
1769
|
-
MoreHorizIcon,
|
|
1770
|
-
MoreVertIcon,
|
|
1771
|
-
PushPinIcon,
|
|
1772
|
-
RestartAltIcon,
|
|
1773
|
-
SaveIcon,
|
|
1774
|
-
SearchIcon,
|
|
1775
|
-
SearchOffIcon,
|
|
1776
|
-
SortIcon,
|
|
1777
|
-
SyncAltIcon,
|
|
1778
|
-
ViewColumnIcon,
|
|
1779
|
-
VisibilityOffIcon,
|
|
1457
|
+
const getCommonPinnedCellStyles = ({ table, theme, }) => {
|
|
1458
|
+
const { baseBackgroundColor } = table.options.mrtTheme;
|
|
1459
|
+
return {
|
|
1460
|
+
'&[data-pinned="true"]': {
|
|
1461
|
+
'&:before': Object.assign({ backgroundColor: styles.alpha(styles.darken(baseBackgroundColor, theme.palette.mode === 'dark' ? 0.05 : 0.01), 0.97) }, commonCellBeforeAfterStyles),
|
|
1462
|
+
},
|
|
1463
|
+
};
|
|
1780
1464
|
};
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
filterToToday: 'To Today',
|
|
1848
|
-
filteringByColumn: 'Filtering by {column} - {filterType} {filterValue}',
|
|
1849
|
-
goToFirstPage: 'Go to first page',
|
|
1850
|
-
goToLastPage: 'Go to last page',
|
|
1851
|
-
goToNextPage: 'Go to next page',
|
|
1852
|
-
goToPreviousPage: 'Go to previous page',
|
|
1853
|
-
grab: 'Grab',
|
|
1854
|
-
groupByColumn: 'Group by {column}',
|
|
1855
|
-
groupedBy: 'Grouped by ',
|
|
1856
|
-
hideAll: 'Hide all',
|
|
1857
|
-
hideColumn: 'Hide {column} column',
|
|
1858
|
-
max: 'Max',
|
|
1859
|
-
min: 'Min',
|
|
1860
|
-
move: 'Move',
|
|
1861
|
-
noRecordsToDisplay: 'No records to display',
|
|
1862
|
-
noResultsFound: 'No results found',
|
|
1863
|
-
moreThan: 'more than',
|
|
1864
|
-
of: 'of',
|
|
1865
|
-
or: 'or',
|
|
1866
|
-
pin: 'Pin',
|
|
1867
|
-
pinToLeft: 'Pin to left',
|
|
1868
|
-
pinToRight: 'Pin to right',
|
|
1869
|
-
resetColumnSize: 'Reset column size',
|
|
1870
|
-
resetOrder: 'Reset order',
|
|
1871
|
-
rowActions: 'Row Actions',
|
|
1872
|
-
rowNumber: '#',
|
|
1873
|
-
rowNumbers: 'Row Numbers',
|
|
1874
|
-
rowsPerPage: 'Rows per page',
|
|
1875
|
-
countRows: 'Count Rows',
|
|
1876
|
-
countRowsTooltip: 'Count total rows for current filters',
|
|
1877
|
-
rowCount: 'Row Count',
|
|
1878
|
-
rowsSelected: '{count} row(s) selected',
|
|
1879
|
-
save: 'Save',
|
|
1880
|
-
search: 'Search',
|
|
1881
|
-
selectedCountOfRowCountRowsSelected: '{selectedCount} of {rowCount} row(s) selected',
|
|
1882
|
-
select: 'Select',
|
|
1883
|
-
selectAllOnAllPages: 'Select all on all pages',
|
|
1884
|
-
selectAllOnCurrentPage: 'Select all on current page',
|
|
1885
|
-
showAll: 'Show all',
|
|
1886
|
-
showAllColumns: 'Show all columns',
|
|
1887
|
-
showHideColumns: 'Columns',
|
|
1888
|
-
showHideFilters: 'Show/Hide filters',
|
|
1889
|
-
showHideSearch: 'Show/Hide search',
|
|
1890
|
-
showAdvancedFilters: 'Show advanced filters',
|
|
1891
|
-
advancedFilters: 'Advanced Filters',
|
|
1892
|
-
filters: 'Filters',
|
|
1893
|
-
add: 'Add',
|
|
1894
|
-
newEntry: 'New Entry',
|
|
1895
|
-
clear: 'Clear',
|
|
1896
|
-
discardChanges: 'Discard changes',
|
|
1897
|
-
saveFilters: 'Save filters',
|
|
1898
|
-
savedFilters: 'Saved filters',
|
|
1899
|
-
noSavedFilters: 'No saved filters',
|
|
1900
|
-
filterName: 'Filter name',
|
|
1901
|
-
apply: 'Apply',
|
|
1902
|
-
sortByColumnAsc: 'Sort by {column} ascending',
|
|
1903
|
-
sortByColumnDesc: 'Sort by {column} descending',
|
|
1904
|
-
sortedByColumnAsc: 'Sorted by {column} ascending',
|
|
1905
|
-
sortedByColumnDesc: 'Sorted by {column} descending',
|
|
1906
|
-
thenBy: ', then by ',
|
|
1907
|
-
toggleDensity: 'Density',
|
|
1908
|
-
densityCompact: 'Compact',
|
|
1909
|
-
densityStandard: 'Standard',
|
|
1910
|
-
densityComfortable: 'Comfortable',
|
|
1911
|
-
toggleFullScreen: 'Toggle full screen',
|
|
1912
|
-
toggleSelectAll: 'Toggle select all',
|
|
1913
|
-
toggleSelectRow: 'Toggle select row',
|
|
1914
|
-
toggleVisibility: 'Toggle visibility',
|
|
1915
|
-
ungroupByColumn: 'Ungroup by {column}',
|
|
1916
|
-
unpin: 'Unpin',
|
|
1917
|
-
unpinAll: 'Unpin all',
|
|
1918
|
-
dimensionRotationEnabled: 'Rotation enabled',
|
|
1919
|
-
dimensionRotationDisabled: 'Rotation disabled',
|
|
1920
|
-
length: 'Length',
|
|
1921
|
-
width: 'Width',
|
|
1922
|
-
height: 'Height',
|
|
1923
|
-
depth: 'Depth',
|
|
1924
|
-
tolerance: 'Tolerance',
|
|
1925
|
-
exportButton: 'Export',
|
|
1926
|
-
exportSelectRowsTooltip: 'Select rows to export',
|
|
1927
|
-
exportPrintPdf: 'Print PDF',
|
|
1928
|
-
exportDownload: 'Download',
|
|
1929
|
-
exportGrouped: 'Group files',
|
|
1930
|
-
exportInProgress: 'Export in progress...',
|
|
1931
|
-
exportSuccess: 'Export completed successfully.',
|
|
1932
|
-
exportError: 'Export failed. Please try again.',
|
|
1933
|
-
exportNoExportsSelected: 'No export type selected. Please configure the export first.',
|
|
1934
|
-
deleteConfirmationTitle: 'Delete Row',
|
|
1935
|
-
deleteConfirmationMessage: 'Are you sure you want to delete the selected row(s)?',
|
|
1936
|
-
deleteConfirmYes: 'Delete',
|
|
1937
|
-
deleteConfirmNo: 'Cancel',
|
|
1938
|
-
deleteConfirmDeleting: 'Deleting...',
|
|
1939
|
-
errorTitle: 'Unexpected error',
|
|
1940
|
-
errorMessage: 'An unexpected error occurred. Please try again.',
|
|
1941
|
-
serverTableErrorTitle: 'Unable to load table',
|
|
1942
|
-
serverTableErrorMessage: 'Something went wrong while loading the table configuration. Please try again.',
|
|
1943
|
-
serverTableErrorRetry: 'Try again',
|
|
1944
|
-
resetState: 'Reset State',
|
|
1945
|
-
tableOptions: 'Options',
|
|
1946
|
-
};
|
|
1947
|
-
|
|
1948
|
-
const downloadExportFiles = (files) => {
|
|
1949
|
-
files.forEach((file) => {
|
|
1950
|
-
const binaryString = atob(file.content);
|
|
1951
|
-
const len = binaryString.length;
|
|
1952
|
-
const bytes = new Uint8Array(len);
|
|
1953
|
-
for (let i = 0; i < len; i++) {
|
|
1954
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
1955
|
-
}
|
|
1956
|
-
const blob = new Blob([bytes], { type: 'application/octet-stream' });
|
|
1957
|
-
const element = document.createElement('a');
|
|
1958
|
-
element.href = URL.createObjectURL(blob);
|
|
1959
|
-
element.download = file.filename;
|
|
1960
|
-
document.body.appendChild(element);
|
|
1961
|
-
element.click();
|
|
1962
|
-
document.body.removeChild(element);
|
|
1963
|
-
URL.revokeObjectURL(element.href);
|
|
1964
|
-
});
|
|
1465
|
+
const getCommonMRTCellStyles = ({ column, header, isDraggingColumn, isHoveredColumn, table, tableCellProps, theme, }) => {
|
|
1466
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1467
|
+
const { options: { enableColumnVirtualization, layoutMode }, } = table;
|
|
1468
|
+
const { columnDef } = column;
|
|
1469
|
+
const { columnDefType } = columnDef;
|
|
1470
|
+
const isColumnPinned = columnDef.columnDefType !== 'group' && column.getIsPinned();
|
|
1471
|
+
const widthStyles = {
|
|
1472
|
+
minWidth: `max(calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId((_a = header === null || header === void 0 ? void 0 : header.id) !== null && _a !== void 0 ? _a : column.id)}-size) * 1px), ${(_b = columnDef.minSize) !== null && _b !== void 0 ? _b : 30}px)`,
|
|
1473
|
+
width: `calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId((_c = header === null || header === void 0 ? void 0 : header.id) !== null && _c !== void 0 ? _c : column.id)}-size) * 1px)`,
|
|
1474
|
+
};
|
|
1475
|
+
if (layoutMode === 'grid') {
|
|
1476
|
+
widthStyles.flex = `${[0, false].includes(columnDef.grow)
|
|
1477
|
+
? 0
|
|
1478
|
+
: `var(--${header ? 'header' : 'col'}-${parseCSSVarId((_d = header === null || header === void 0 ? void 0 : header.id) !== null && _d !== void 0 ? _d : column.id)}-size)`} 0 auto`;
|
|
1479
|
+
}
|
|
1480
|
+
else if (layoutMode === 'grid-no-grow') {
|
|
1481
|
+
widthStyles.flex = `${+(columnDef.grow || 0)} 0 auto`;
|
|
1482
|
+
}
|
|
1483
|
+
// The checkbox column is technically pinned (for sticky positioning) but
|
|
1484
|
+
// should look like a regular center column — no background overlay or shadow.
|
|
1485
|
+
const isCheckboxColumn = column.id === CHECKBOX_DISPLAY_COLUMN_ID;
|
|
1486
|
+
// Count all currently pinned column IDs across both sides.
|
|
1487
|
+
// Checkbox is always pinned (counts as 1), so > 1 means the user has
|
|
1488
|
+
// explicitly pinned at least one additional column.
|
|
1489
|
+
const totalPinnedColumnCount = [
|
|
1490
|
+
...((_e = table.getState().columnPinning.left) !== null && _e !== void 0 ? _e : []),
|
|
1491
|
+
...((_f = table.getState().columnPinning.right) !== null && _f !== void 0 ? _f : []),
|
|
1492
|
+
].length;
|
|
1493
|
+
const hasNoPinnedColumns = totalPinnedColumnCount === 0;
|
|
1494
|
+
const pinnedStyles = isColumnPinned
|
|
1495
|
+
? Object.assign(Object.assign({}, (isCheckboxColumn
|
|
1496
|
+
? hasNoPinnedColumns
|
|
1497
|
+
? {
|
|
1498
|
+
// Use doubled class selector (&&) to beat the row-level
|
|
1499
|
+
// td[data-pinned="true"]:before specificity from MRT_TableBodyRow.
|
|
1500
|
+
'&&[data-pinned="true"]': {
|
|
1501
|
+
'&:before': {
|
|
1502
|
+
backgroundColor: 'transparent',
|
|
1503
|
+
boxShadow: 'none',
|
|
1504
|
+
},
|
|
1505
|
+
},
|
|
1506
|
+
}
|
|
1507
|
+
: // Other columns are also pinned — apply standard pinned background
|
|
1508
|
+
// so the checkbox header matches the pinned row cells below it.
|
|
1509
|
+
getCommonPinnedCellStyles({ column, table, theme })
|
|
1510
|
+
: getCommonPinnedCellStyles({ column, table, theme }))), { left: isColumnPinned === 'left'
|
|
1511
|
+
? `${column.getStart('left')}px`
|
|
1512
|
+
: undefined,
|
|
1513
|
+
// Skip opacity reduction for checkbox — keep it fully opaque like center columns
|
|
1514
|
+
opacity: isCheckboxColumn ? undefined : 0.97, position: 'sticky', right: isColumnPinned === 'right'
|
|
1515
|
+
? `${column.getAfter('right')}px`
|
|
1516
|
+
: undefined }) : {};
|
|
1517
|
+
return Object.assign(Object.assign(Object.assign({ backgroundColor: 'inherit', backgroundImage: 'inherit', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, justifyContent: columnDefType === 'group'
|
|
1518
|
+
? 'center'
|
|
1519
|
+
: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid'))
|
|
1520
|
+
? tableCellProps.align
|
|
1521
|
+
: undefined, opacity: isDraggingColumn || isHoveredColumn ? 0.5 : 1, position: 'relative', transition: enableColumnVirtualization
|
|
1522
|
+
? 'none'
|
|
1523
|
+
: `padding 150ms ease-in-out`, zIndex: column.getIsResizing() || isDraggingColumn
|
|
1524
|
+
? 2
|
|
1525
|
+
: columnDefType !== 'group' && isColumnPinned
|
|
1526
|
+
? 1
|
|
1527
|
+
: 0, '&:focus-visible': {
|
|
1528
|
+
outline: `2px solid ${table.options.mrtTheme.cellNavigationOutlineColor}`,
|
|
1529
|
+
outlineOffset: '-2px',
|
|
1530
|
+
} }, pinnedStyles), widthStyles), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme));
|
|
1965
1531
|
};
|
|
1532
|
+
const getCommonToolbarStyles = ({ table, }) => ({
|
|
1533
|
+
alignItems: 'flex-start',
|
|
1534
|
+
backgroundColor: table.options.mrtTheme.baseBackgroundColor,
|
|
1535
|
+
display: 'grid',
|
|
1536
|
+
flexWrap: 'wrap-reverse',
|
|
1537
|
+
position: 'relative',
|
|
1538
|
+
transition: 'all 150ms ease-in-out',
|
|
1539
|
+
zIndex: 1,
|
|
1540
|
+
});
|
|
1541
|
+
const flipIconStyles = (theme) => theme.direction === 'rtl'
|
|
1542
|
+
? { style: { transform: 'scaleX(-1)' } }
|
|
1543
|
+
: undefined;
|
|
1544
|
+
const getCommonTooltipProps = (placement) => ({
|
|
1545
|
+
disableInteractive: true,
|
|
1546
|
+
enterDelay: 1000,
|
|
1547
|
+
enterNextDelay: 1000,
|
|
1548
|
+
placement,
|
|
1549
|
+
});
|
|
1966
1550
|
|
|
1967
|
-
const
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
const url = URL.createObjectURL(blob);
|
|
1977
|
-
printJS({
|
|
1978
|
-
printable: url,
|
|
1979
|
-
type: 'pdf',
|
|
1980
|
-
onLoadingEnd: () => URL.revokeObjectURL(url),
|
|
1981
|
-
});
|
|
1982
|
-
});
|
|
1551
|
+
const commonIconButtonStyles = {
|
|
1552
|
+
'&:hover': {
|
|
1553
|
+
opacity: 1,
|
|
1554
|
+
},
|
|
1555
|
+
height: '2rem',
|
|
1556
|
+
ml: '10px',
|
|
1557
|
+
opacity: 0.5,
|
|
1558
|
+
transition: 'opacity 150ms',
|
|
1559
|
+
width: '2rem',
|
|
1983
1560
|
};
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
const { localization } = table
|
|
1988
|
-
const {
|
|
1561
|
+
const MRT_ToggleRowActionMenuButton = (_a) => {
|
|
1562
|
+
var _b;
|
|
1563
|
+
var { cell, row, staticRowIndex, table } = _a, rest = __rest(_a, ["cell", "row", "staticRowIndex", "table"]);
|
|
1564
|
+
const { getState, options: { createDisplayMode, editDisplayMode, enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
|
|
1565
|
+
const { creatingRow } = getState();
|
|
1566
|
+
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
|
1567
|
+
const isEditing = useMRT_SliceValue(table._uiStore, (s) => { var _a; return ((_a = s.editingRow) === null || _a === void 0 ? void 0 : _a.id) === row.id; });
|
|
1568
|
+
const showEditActionButtons = (isCreating && createDisplayMode === 'row') ||
|
|
1569
|
+
(isEditing && editDisplayMode === 'row');
|
|
1989
1570
|
const [anchorEl, setAnchorEl] = react.useState(null);
|
|
1990
|
-
const
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
const isNoRowsSelected = selectedRowIds.length === 0;
|
|
1994
|
-
const availableFormats = react.useMemo(() => {
|
|
1995
|
-
const allFormats = Object.values(availableExports).flatMap((exp) => exp.formats);
|
|
1996
|
-
return Array.from(new Set(allFormats));
|
|
1997
|
-
}, [availableExports]);
|
|
1998
|
-
const hasPdfFormat = availableFormats.includes('pdf');
|
|
1999
|
-
const exportTypesForSelectedFormat = react.useMemo(() => {
|
|
2000
|
-
if (!selectedFormat)
|
|
2001
|
-
return [];
|
|
2002
|
-
return Object.values(availableExports).filter((exp) => exp.formats.includes(selectedFormat));
|
|
2003
|
-
}, [availableExports, selectedFormat]);
|
|
2004
|
-
const isPrintDisabled = selectedFormat !== 'pdf' ||
|
|
2005
|
-
!selectedFormat ||
|
|
2006
|
-
selectedExports.length < 1 ||
|
|
2007
|
-
(!grouped && selectedExports.length > 1);
|
|
2008
|
-
const isDownloadDisabled = !selectedFormat || selectedExports.length < 1;
|
|
2009
|
-
const handleOpenMenu = (event) => {
|
|
1571
|
+
const handleOpenRowActionMenu = (event) => {
|
|
1572
|
+
event.stopPropagation();
|
|
1573
|
+
event.preventDefault();
|
|
2010
1574
|
setAnchorEl(event.currentTarget);
|
|
2011
1575
|
};
|
|
2012
|
-
const
|
|
1576
|
+
const handleStartEditMode = (event) => {
|
|
1577
|
+
event.stopPropagation();
|
|
1578
|
+
setEditingRow(Object.assign({}, row));
|
|
2013
1579
|
setAnchorEl(null);
|
|
2014
1580
|
};
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
1581
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderRowActions && !showEditActionButtons ? (renderRowActions({ cell, row, staticRowIndex, table })) : showEditActionButtons ? (jsxRuntime.jsx(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems &&
|
|
1582
|
+
parseFromValuesOrFunc(enableEditing, row) &&
|
|
1583
|
+
['modal', 'row'].includes(editDisplayMode) ? (jsxRuntime.jsx(Tooltip, { placement: "right", title: localization.edit, children: jsxRuntime.jsx(IconButton, Object.assign({ "aria-label": localization.edit, onClick: handleStartEditMode, sx: commonIconButtonStyles }, rest, { children: jsxRuntime.jsx(EditIcon, {}) })) })) : ((_b = renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
|
|
1584
|
+
closeMenu: () => { },
|
|
1585
|
+
row,
|
|
1586
|
+
staticRowIndex,
|
|
1587
|
+
table,
|
|
1588
|
+
})) === null || _b === void 0 ? void 0 : _b.length) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { title: localization.rowActions, children: jsxRuntime.jsx(IconButton, Object.assign({ "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles }, rest, { children: jsxRuntime.jsx(MoreHorizIcon, {}) })) })), jsxRuntime.jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, staticRowIndex: staticRowIndex, table: table })] })) : null }));
|
|
1589
|
+
};
|
|
1590
|
+
|
|
1591
|
+
const getMRT_RowActionsColumnDef = (tableOptions) => {
|
|
1592
|
+
return Object.assign({ Cell: ({ cell, row, staticRowIndex, table }) => (jsxRuntime.jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, staticRowIndex: staticRowIndex, table: table })) }, defaultDisplayColumnProps({
|
|
1593
|
+
header: 'actions',
|
|
1594
|
+
id: 'mrt-row-actions',
|
|
1595
|
+
size: 70,
|
|
1596
|
+
tableOptions,
|
|
1597
|
+
}));
|
|
1598
|
+
};
|
|
1599
|
+
|
|
1600
|
+
const MRT_GrabHandleButton = (_a) => {
|
|
1601
|
+
var _b, _c;
|
|
1602
|
+
var { location, table } = _a, rest = __rest(_a, ["location", "table"]);
|
|
1603
|
+
const { options: { icons: { DragHandleIcon }, localization, }, } = table;
|
|
1604
|
+
return (jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps('top'), { title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.move, children: jsxRuntime.jsx(IconButton, Object.assign({ "aria-label": (_c = rest.title) !== null && _c !== void 0 ? _c : localization.move, disableRipple: true, draggable: "true", size: "small" }, rest, { onClick: (e) => {
|
|
1605
|
+
var _a;
|
|
1606
|
+
e.stopPropagation();
|
|
1607
|
+
(_a = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _a === void 0 ? void 0 : _a.call(rest, e);
|
|
1608
|
+
}, sx: (theme) => (Object.assign({ '&:active': {
|
|
1609
|
+
cursor: 'grabbing',
|
|
1610
|
+
}, '&:hover': {
|
|
1611
|
+
backgroundColor: 'transparent',
|
|
1612
|
+
opacity: 1,
|
|
1613
|
+
}, cursor: 'grab', m: '0 -0.1rem', opacity: location === 'row' ? 1 : 0.5, p: '2px', transition: 'all 150ms ease-in-out' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), title: undefined, children: jsxRuntime.jsx(DragHandleIcon, {}) })) })));
|
|
1614
|
+
};
|
|
1615
|
+
|
|
1616
|
+
const MRT_TableBodyRowGrabHandle = (_a) => {
|
|
1617
|
+
var { row, rowRef, table } = _a, rest = __rest(_a, ["row", "rowRef", "table"]);
|
|
1618
|
+
const { options: { muiRowDragHandleProps }, } = table;
|
|
1619
|
+
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiRowDragHandleProps, {
|
|
1620
|
+
row,
|
|
1621
|
+
table,
|
|
1622
|
+
})), rest);
|
|
1623
|
+
const handleDragStart = (event) => {
|
|
1624
|
+
var _a;
|
|
1625
|
+
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
|
2031
1626
|
try {
|
|
2032
|
-
|
|
2033
|
-
format: selectedFormat,
|
|
2034
|
-
exports: selectedExports,
|
|
2035
|
-
separated_files: !grouped,
|
|
2036
|
-
download: false,
|
|
2037
|
-
ids: JSON.stringify(selectedRowIds),
|
|
2038
|
-
type,
|
|
2039
|
-
});
|
|
2040
|
-
handleCloseMenu();
|
|
2041
|
-
if (type === 'download') {
|
|
2042
|
-
downloadExportFiles(response);
|
|
2043
|
-
}
|
|
2044
|
-
else {
|
|
2045
|
-
printExportFiles(response);
|
|
2046
|
-
}
|
|
1627
|
+
event.dataTransfer.setDragImage(rowRef.current, 0, 0);
|
|
2047
1628
|
}
|
|
2048
|
-
|
|
2049
|
-
|
|
1629
|
+
catch (e) {
|
|
1630
|
+
console.error(e);
|
|
2050
1631
|
}
|
|
2051
|
-
|
|
2052
|
-
const renderFormatSelector = () => (jsxRuntime.jsx(Stack, { justifyContent: "flex-start", minWidth: "200px", sx: {
|
|
2053
|
-
borderRight: selectedFormat
|
|
2054
|
-
? `1px dashed ${theme.palette.divider}`
|
|
2055
|
-
: 'none',
|
|
2056
|
-
}, children: jsxRuntime.jsx(FormControl, { children: jsxRuntime.jsx(RadioGroup, { value: selectedFormat !== null && selectedFormat !== void 0 ? selectedFormat : '', children: availableFormats.map((format) => (jsxRuntime.jsx(FormControlLabel, { sx: { m: 0 }, value: format, control: jsxRuntime.jsx(Radio, { size: "small", onClick: () => handleSelectFormat(format) }), label: jsxRuntime.jsx(Typography, { variant: "subtitle2", sx: { fontWeight: 800 }, children: format }) }, format))) }) }) }));
|
|
2057
|
-
const renderExportTypeSelector = () => {
|
|
2058
|
-
if (!selectedFormat || exportTypesForSelectedFormat.length === 0)
|
|
2059
|
-
return null;
|
|
2060
|
-
return (jsxRuntime.jsx(Stack, { minWidth: "250px", maxHeight: "500px", sx: { overflowY: 'auto' }, children: exportTypesForSelectedFormat.map((exportType) => (jsxRuntime.jsxs(MenuItem, { onClick: () => handleToggleExportType(exportType.name), value: exportType.name, children: [jsxRuntime.jsx(Checkbox, { checked: selectedExports.includes(exportType.name), size: "small" }), jsxRuntime.jsx(Typography, { variant: "body2", children: exportType.label })] }, exportType.name))) }));
|
|
1632
|
+
table.setDraggingRow(row);
|
|
2061
1633
|
};
|
|
2062
|
-
const
|
|
2063
|
-
|
|
2064
|
-
|
|
1634
|
+
const handleDragEnd = (event) => {
|
|
1635
|
+
var _a;
|
|
1636
|
+
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
|
1637
|
+
table.setDraggingRow(null);
|
|
1638
|
+
table.setHoveredRow(null);
|
|
2065
1639
|
};
|
|
2066
|
-
|
|
2067
|
-
return (jsxRuntime.jsxs(Stack, { direction: "row", gap: 0.5, alignItems: "center", children: [jsxRuntime.jsx(Tooltip, { title: isNoRowsSelected
|
|
2068
|
-
? localization.exportSelectRowsTooltip
|
|
2069
|
-
: localization.exportButton, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(Button, { "aria-label": localization.exportButton, disabled: isNoRowsSelected, onClick: handleOpenMenu, size: "small", startIcon: jsxRuntime.jsx(FileDownloadIcon, { fontSize: "small" }), variant: "text", children: localization.exportButton }) }) }), jsxRuntime.jsxs(Menu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleCloseMenu, anchorOrigin: { vertical: 'bottom', horizontal: 'left' }, transformOrigin: { vertical: 'top', horizontal: 'left' }, children: [jsxRuntime.jsxs(Stack, { direction: "row", sx: { px: 1, pt: 1, maxHeight: '320px', overflow: 'auto' }, children: [renderFormatSelector(), selectedFormat &&
|
|
2070
|
-
exportTypesForSelectedFormat.length > 0 &&
|
|
2071
|
-
renderExportTypeSelector()] }), jsxRuntime.jsx(Divider, { sx: { mt: 1 } }), jsxRuntime.jsxs(Stack, { direction: "row", alignItems: "center", sx: { px: 1, pb: 1 }, children: [renderActionButtons(), renderGroupedCheckbox()] })] })] }));
|
|
1640
|
+
return (jsxRuntime.jsx(MRT_GrabHandleButton, Object.assign({}, iconButtonProps, { location: "row", onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })));
|
|
2072
1641
|
};
|
|
2073
1642
|
|
|
2074
|
-
const
|
|
2075
|
-
return
|
|
1643
|
+
const getMRT_RowDragColumnDef = (tableOptions) => {
|
|
1644
|
+
return Object.assign({ Cell: ({ row, rowRef, table }) => (jsxRuntime.jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })), grow: false }, defaultDisplayColumnProps({
|
|
1645
|
+
header: 'move',
|
|
1646
|
+
id: 'mrt-row-drag',
|
|
1647
|
+
size: 60,
|
|
1648
|
+
tableOptions,
|
|
1649
|
+
}));
|
|
2076
1650
|
};
|
|
2077
1651
|
|
|
2078
|
-
const
|
|
2079
|
-
|
|
1652
|
+
const MRT_ExpandAllButton = (_a) => {
|
|
1653
|
+
var _b, _c;
|
|
1654
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
1655
|
+
const { getCanSomeRowsExpand, getIsAllRowsExpanded, getIsSomeRowsExpanded, getState, options: { icons: { KeyboardDoubleArrowDownIcon }, localization, muiExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
|
|
1656
|
+
const { isLoading } = getState();
|
|
1657
|
+
const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
|
|
1658
|
+
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiExpandAllButtonProps, {
|
|
1659
|
+
table,
|
|
1660
|
+
})), rest);
|
|
1661
|
+
const isAllRowsExpanded = getIsAllRowsExpanded();
|
|
1662
|
+
return (jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { title: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _b !== void 0 ? _b : (isAllRowsExpanded ? localization.collapseAll : localization.expandAll), children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton, 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', mt: density !== 'compact' ? '-0.25rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.25rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: (_c = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _c !== void 0 ? _c : (jsxRuntime.jsx(KeyboardDoubleArrowDownIcon, { style: {
|
|
1663
|
+
transform: `rotate(${isAllRowsExpanded ? -180 : getIsSomeRowsExpanded() ? -90 : 0}deg)`,
|
|
1664
|
+
transition: 'transform 150ms',
|
|
1665
|
+
} })) })) }) })));
|
|
2080
1666
|
};
|
|
2081
1667
|
|
|
2082
|
-
const
|
|
2083
|
-
|
|
1668
|
+
const MRT_ExpandButton = ({ row, staticRowIndex, table, }) => {
|
|
1669
|
+
var _a, _b;
|
|
1670
|
+
const theme = styles.useTheme();
|
|
1671
|
+
const { options: { icons: { ExpandMoreIcon }, localization, maxDepth, muiExpandButtonProps, positionExpandColumn, renderDetailPanel, }, } = table;
|
|
1672
|
+
const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
|
|
1673
|
+
const iconButtonProps = parseFromValuesOrFunc(muiExpandButtonProps, {
|
|
1674
|
+
row,
|
|
1675
|
+
staticRowIndex,
|
|
1676
|
+
table,
|
|
1677
|
+
});
|
|
1678
|
+
const canExpand = row.getCanExpand() && (maxDepth === undefined || row.depth < maxDepth - 1);
|
|
1679
|
+
const isExpanded = row.getIsExpanded();
|
|
1680
|
+
const handleToggleExpand = (event) => {
|
|
1681
|
+
var _a;
|
|
1682
|
+
event.stopPropagation();
|
|
1683
|
+
row.toggleExpanded();
|
|
1684
|
+
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
|
1685
|
+
};
|
|
1686
|
+
const detailPanel = !!(renderDetailPanel === null || renderDetailPanel === void 0 ? void 0 : renderDetailPanel({ row, table }));
|
|
1687
|
+
return (jsxRuntime.jsx(Tooltip, Object.assign({ disableHoverListener: !canExpand && !detailPanel }, getCommonTooltipProps(), { title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : (isExpanded ? localization.collapse : localization.expand), children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton, Object.assign({ "aria-label": localization.expand, disabled: !canExpand && !detailPanel }, iconButtonProps, { onClick: handleToggleExpand, sx: (theme) => (Object.assign({ opacity: !canExpand && !detailPanel ? 0.3 : 1, [theme.direction === 'rtl' || positionExpandColumn === 'last'
|
|
1688
|
+
? 'mr'
|
|
1689
|
+
: 'ml']: `${row.depth * 16}px`, width: density === 'compact' ? '1.75rem' : '2.25rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), size: "small", title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(ExpandMoreIcon, { style: {
|
|
1690
|
+
transform: `rotate(${!canExpand && !renderDetailPanel
|
|
1691
|
+
? positionExpandColumn === 'last' ||
|
|
1692
|
+
theme.direction === 'rtl'
|
|
1693
|
+
? 90
|
|
1694
|
+
: -90
|
|
1695
|
+
: isExpanded
|
|
1696
|
+
? -180
|
|
1697
|
+
: 0}deg)`,
|
|
1698
|
+
transition: 'transform 150ms',
|
|
1699
|
+
} })) })) }) })));
|
|
2084
1700
|
};
|
|
2085
1701
|
|
|
2086
|
-
const
|
|
2087
|
-
|
|
2088
|
-
|
|
1702
|
+
const INSERT_HERE_TOOLTIP = 'Insert here';
|
|
1703
|
+
const ACTION_ICON_SIZE$1 = 'small';
|
|
1704
|
+
const MRT_InsertHereAction = ({ onClick, }) => {
|
|
1705
|
+
return (jsxRuntime.jsx(Tooltip, { title: INSERT_HERE_TOOLTIP, disableInteractive: true, children: jsxRuntime.jsx(IconButton, { onClick: onClick, size: ACTION_ICON_SIZE$1, children: jsxRuntime.jsx(SubdirectoryArrowLeftIcon, { color: "warning" }) }) }));
|
|
2089
1706
|
};
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
const
|
|
1707
|
+
|
|
1708
|
+
const MOVE_TO_TOP_TOOLTIP = 'Move to top level';
|
|
1709
|
+
const ACTION_ICON_SIZE = 'small';
|
|
1710
|
+
const ACTION_BUTTON_HEIGHT = '1.75rem';
|
|
1711
|
+
const MRT_MoveToTopAction = ({ onClick }) => {
|
|
1712
|
+
return (jsxRuntime.jsx(Tooltip, { title: MOVE_TO_TOP_TOOLTIP, disableInteractive: true, children: jsxRuntime.jsx(IconButton, { onClick: onClick, size: ACTION_ICON_SIZE, sx: { height: ACTION_BUTTON_HEIGHT }, children: jsxRuntime.jsx(VerticalAlignTopIcon, { fontSize: "small" }) }) }));
|
|
1713
|
+
};
|
|
1714
|
+
|
|
1715
|
+
const MRT_ReorderRowCheckbox = ({ onChange, isSelected, }) => {
|
|
1716
|
+
return (jsxRuntime.jsx(Checkbox, { checked: isSelected, color: "warning", disableRipple: true, onChange: onChange, sx: {
|
|
1717
|
+
color: (theme) => theme.palette.warning.main,
|
|
1718
|
+
'&.Mui-checked': {
|
|
1719
|
+
color: (theme) => theme.palette.warning.main,
|
|
1720
|
+
},
|
|
1721
|
+
} }));
|
|
1722
|
+
};
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* Finds the maximum depth in the hierarchy of a given row (recursively searches all descendants).
|
|
1726
|
+
* Used to determine the "size" of the tree being moved.
|
|
1727
|
+
* Example: Row at depth 1 with a child at depth 3 → returns 3
|
|
1728
|
+
*/
|
|
1729
|
+
const getDeepestSubRowDepth = (row) => {
|
|
2093
1730
|
var _a;
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
if (!activeExports)
|
|
2099
|
-
return false;
|
|
2100
|
-
const { selectedFormat, selectedExports, grouped } = activeExports;
|
|
2101
|
-
return (selectedFormat === 'pdf' &&
|
|
2102
|
-
selectedExports.length >= 1 &&
|
|
2103
|
-
(grouped || selectedExports.length === 1));
|
|
1731
|
+
if (!((_a = row.subRows) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1732
|
+
return row.depth;
|
|
1733
|
+
}
|
|
1734
|
+
return row.subRows.reduce((maxDepth, subRow) => Math.max(maxDepth, getDeepestSubRowDepth(subRow)), row.depth);
|
|
2104
1735
|
};
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
1736
|
+
/**
|
|
1737
|
+
* Extracts an array of IDs of only the selected rows from the selection object.
|
|
1738
|
+
* Filters the record where the value is true and maps only the keys (IDs).
|
|
1739
|
+
* Example: { row1: true, row2: false, row3: true } → ['row1', 'row3']
|
|
1740
|
+
*/
|
|
1741
|
+
const getSelectedReorderRowIds = (rowReorderingSelection) => {
|
|
1742
|
+
return Object.entries(rowReorderingSelection !== null && rowReorderingSelection !== void 0 ? rowReorderingSelection : {})
|
|
1743
|
+
.filter(([, isSelected]) => isSelected)
|
|
1744
|
+
.map(([rowId]) => rowId);
|
|
1745
|
+
};
|
|
1746
|
+
/**
|
|
1747
|
+
* Checks WHETHER we can move selected rows as children of target row
|
|
1748
|
+
* without exceeding the maximum allowed depth.
|
|
1749
|
+
* Directly calculates the final maximum depth after the move.
|
|
1750
|
+
* Example: selectedRows at depth 1-2 with descendants to depth 4, target depth 1, maxDepth 5
|
|
1751
|
+
* → new max depth = 1 + 1 + (4 - 1) = 5, which equals maxDepth, so returns false
|
|
1752
|
+
*/
|
|
1753
|
+
const canInsertSelectedRowsWithoutExceedingMaxDepth = ({ maxDepth, selectedRows, targetRowDepth, }) => {
|
|
1754
|
+
// Cannot insert if there are no selected rows to move
|
|
1755
|
+
if (selectedRows.length === 0) {
|
|
1756
|
+
return false;
|
|
1757
|
+
}
|
|
1758
|
+
// No depth restriction - can insert anywhere
|
|
1759
|
+
if (maxDepth === undefined) {
|
|
1760
|
+
return true;
|
|
1761
|
+
}
|
|
1762
|
+
// Find the deepest descendant among all selected rows
|
|
1763
|
+
const maxDeepestDescendantDepth = selectedRows.reduce((max, row) => {
|
|
1764
|
+
return Math.max(max, getDeepestSubRowDepth(row));
|
|
1765
|
+
}, 0);
|
|
1766
|
+
// Find the minimum depth of selected rows (to calculate relative depth)
|
|
1767
|
+
const minSelectedRowDepth = Math.min(...selectedRows.map((r) => r.depth));
|
|
1768
|
+
// Calculate the maximum depth after moving rows as children of target
|
|
1769
|
+
// newMaxDepth = target.depth + 1 (as children) + relative depth of selected rows
|
|
1770
|
+
const newMaxDepth = targetRowDepth + 1 + (maxDeepestDescendantDepth - minSelectedRowDepth);
|
|
1771
|
+
return newMaxDepth < maxDepth;
|
|
1772
|
+
};
|
|
1773
|
+
/**
|
|
1774
|
+
* Finds the depth of the FIRST selected row in the selection object.
|
|
1775
|
+
* Used to enforce constraint: can only select rows at the SAME depth.
|
|
1776
|
+
* Example: If I select a row at depth 2, I cannot select a row at depth 3
|
|
1777
|
+
*/
|
|
1778
|
+
const getFirstSelectedReorderRowDepth = ({ rowReorderingSelection, table, }) => {
|
|
1779
|
+
var _a, _b;
|
|
1780
|
+
const firstSelectedRowId = (_a = Object.entries(rowReorderingSelection !== null && rowReorderingSelection !== void 0 ? rowReorderingSelection : {}).find(([, isSelected]) => isSelected)) === null || _a === void 0 ? void 0 : _a[0];
|
|
1781
|
+
if (!firstSelectedRowId) {
|
|
1782
|
+
return undefined;
|
|
1783
|
+
}
|
|
1784
|
+
return (_b = table.getRow(firstSelectedRowId, true)) === null || _b === void 0 ? void 0 : _b.depth;
|
|
1785
|
+
};
|
|
1786
|
+
/**
|
|
1787
|
+
* Checks WHETHER we can select a specific row.
|
|
1788
|
+
* Rule: If a selection already exists, new row MUST be at the SAME depth as the first selected.
|
|
1789
|
+
* Without this, you could move rows from different levels which would break the hierarchy.
|
|
1790
|
+
*/
|
|
1791
|
+
const canSelectRowForReorder = ({ rowId, rowDepth, rowReorderingSelection, firstSelectedReorderRowDepth, }) => {
|
|
1792
|
+
const isCurrentRowSelected = !!(rowReorderingSelection === null || rowReorderingSelection === void 0 ? void 0 : rowReorderingSelection[rowId]);
|
|
1793
|
+
if (isCurrentRowSelected) {
|
|
1794
|
+
return true;
|
|
1795
|
+
}
|
|
1796
|
+
const hasAnySelection = Object.values(rowReorderingSelection !== null && rowReorderingSelection !== void 0 ? rowReorderingSelection : {}).some(Boolean);
|
|
1797
|
+
if (!hasAnySelection) {
|
|
1798
|
+
return true;
|
|
1799
|
+
}
|
|
1800
|
+
return rowDepth === firstSelectedReorderRowDepth;
|
|
1801
|
+
};
|
|
1802
|
+
/**
|
|
1803
|
+
* Creates an array of MRT_Row objects from an array of IDs.
|
|
1804
|
+
* Finds each row from the table and collects it in the result.
|
|
1805
|
+
* Used to prepare data for the onTreeRowReorder callback.
|
|
1806
|
+
*/
|
|
1807
|
+
const buildSelectedRowsArray = (selectedRowIds, table) => {
|
|
1808
|
+
return selectedRowIds.reduce((selectedRows, selectedRowId) => {
|
|
1809
|
+
const selectedRow = table.getRow(selectedRowId, true);
|
|
1810
|
+
if (selectedRow) {
|
|
1811
|
+
selectedRows.push(selectedRow);
|
|
2149
1812
|
}
|
|
2150
|
-
return
|
|
2151
|
-
};
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
1813
|
+
return selectedRows;
|
|
1814
|
+
}, []);
|
|
1815
|
+
};
|
|
1816
|
+
/**
|
|
1817
|
+
* Helper function to check if a row is a descendant of another row.
|
|
1818
|
+
* Recursively searches through all subRows to find if targetRowId exists.
|
|
1819
|
+
* Used to prevent circular references (parent cannot become child of its own child).
|
|
1820
|
+
*/
|
|
1821
|
+
const isRowInSubtreeOf = (targetRowId, parentRow) => {
|
|
1822
|
+
var _a;
|
|
1823
|
+
if (!((_a = parentRow.subRows) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1824
|
+
return false;
|
|
1825
|
+
}
|
|
1826
|
+
for (const subRow of parentRow.subRows) {
|
|
1827
|
+
if (subRow.id === targetRowId) {
|
|
1828
|
+
return true;
|
|
2160
1829
|
}
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
persist: true,
|
|
2164
|
-
});
|
|
2165
|
-
try {
|
|
2166
|
-
yield executeExport({ table, rowsToExport: [row] });
|
|
2167
|
-
notistack.closeSnackbar(loadingKey);
|
|
2168
|
-
notistack.enqueueSnackbar(localization.exportSuccess, { variant: 'success' });
|
|
1830
|
+
if (isRowInSubtreeOf(targetRowId, subRow)) {
|
|
1831
|
+
return true;
|
|
2169
1832
|
}
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
1833
|
+
}
|
|
1834
|
+
return false;
|
|
1835
|
+
};
|
|
1836
|
+
/**
|
|
1837
|
+
* Checks if a row can be used as a valid insert target for selected rows.
|
|
1838
|
+
* Rules: Target row must NOT be already selected AND must NOT be a descendant of any selected row.
|
|
1839
|
+
* This prevents circular references where a parent becomes a child of its own descendants.
|
|
1840
|
+
* Example: If you select "Department", you cannot insert it under "Project" (which is its descendant)
|
|
1841
|
+
*/
|
|
1842
|
+
const isValidInsertTarget = ({ targetRowId, selectedRowIds, table, }) => {
|
|
1843
|
+
// Rule 1: Target row cannot be already selected
|
|
1844
|
+
if (selectedRowIds.includes(targetRowId) || selectedRowIds.length === 0) {
|
|
1845
|
+
return false;
|
|
1846
|
+
}
|
|
1847
|
+
// Rule 2: Target row cannot be a descendant of any selected row
|
|
1848
|
+
// (prevents parent from becoming child of its own descendants)
|
|
1849
|
+
for (const selectedRowId of selectedRowIds) {
|
|
1850
|
+
const selectedRow = table.getRow(selectedRowId, true);
|
|
1851
|
+
if (selectedRow &&
|
|
1852
|
+
isRowInSubtreeOf(targetRowId, selectedRow)) {
|
|
1853
|
+
return false;
|
|
2173
1854
|
}
|
|
1855
|
+
}
|
|
1856
|
+
return true;
|
|
1857
|
+
};
|
|
1858
|
+
|
|
1859
|
+
const useTreeRowReorderingCell = ({ row, table, rowReorderingSelection, maxDepth, onTreeRowReorder, }) => {
|
|
1860
|
+
const [isRowHovered, setIsRowHovered] = react.useState(false);
|
|
1861
|
+
const firstSelectedReorderRowDepth = getFirstSelectedReorderRowDepth({
|
|
1862
|
+
rowReorderingSelection,
|
|
1863
|
+
table,
|
|
2174
1864
|
});
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
1865
|
+
const canSelectForReorder = canSelectRowForReorder({
|
|
1866
|
+
rowId: row.id,
|
|
1867
|
+
rowDepth: row.depth,
|
|
1868
|
+
rowReorderingSelection,
|
|
1869
|
+
firstSelectedReorderRowDepth,
|
|
1870
|
+
});
|
|
1871
|
+
const hasAnyReorderSelection = Object.values(rowReorderingSelection !== null && rowReorderingSelection !== void 0 ? rowReorderingSelection : {}).some(Boolean);
|
|
1872
|
+
const selectedReorderRowIds = getSelectedReorderRowIds(rowReorderingSelection);
|
|
1873
|
+
const selectedRowsForReorder = buildSelectedRowsArray(selectedReorderRowIds, table);
|
|
1874
|
+
const shouldShowReorderCheckbox = canSelectForReorder && (isRowHovered || hasAnyReorderSelection);
|
|
1875
|
+
const shouldShowInsertHereAction = selectedReorderRowIds.length > 0 &&
|
|
1876
|
+
isValidInsertTarget({
|
|
1877
|
+
targetRowId: row.id,
|
|
1878
|
+
selectedRowIds: selectedReorderRowIds,
|
|
1879
|
+
table,
|
|
1880
|
+
}) &&
|
|
1881
|
+
canInsertSelectedRowsWithoutExceedingMaxDepth({
|
|
1882
|
+
maxDepth,
|
|
1883
|
+
selectedRows: selectedRowsForReorder,
|
|
1884
|
+
targetRowDepth: row.depth,
|
|
1885
|
+
});
|
|
1886
|
+
const handleReorderCheckboxChange = react.useCallback((event) => {
|
|
1887
|
+
const checked = event.target.checked;
|
|
1888
|
+
table.setRowReorderingSelection((prev) => (Object.assign(Object.assign({}, prev), { [row.id]: checked })));
|
|
1889
|
+
}, [row.id, table]);
|
|
1890
|
+
const handleInsertHereActionClick = react.useCallback(() => {
|
|
1891
|
+
if (!onTreeRowReorder) {
|
|
1892
|
+
console.warn('[MRT] onTreeRowReorder callback is not defined');
|
|
2182
1893
|
return;
|
|
2183
1894
|
}
|
|
2184
|
-
const loadingKey = notistack.enqueueSnackbar(localization.exportInProgress, {
|
|
2185
|
-
variant: 'info',
|
|
2186
|
-
persist: true,
|
|
2187
|
-
});
|
|
2188
1895
|
try {
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
1896
|
+
const treeRowReorderEvent = {
|
|
1897
|
+
selectedRowIds: selectedReorderRowIds,
|
|
1898
|
+
selectedRows: selectedRowsForReorder,
|
|
1899
|
+
table,
|
|
1900
|
+
targetRow: row,
|
|
1901
|
+
};
|
|
1902
|
+
onTreeRowReorder(treeRowReorderEvent);
|
|
2192
1903
|
}
|
|
2193
|
-
catch (
|
|
2194
|
-
|
|
2195
|
-
notistack.enqueueSnackbar(localization.exportError, { variant: 'error' });
|
|
1904
|
+
catch (error) {
|
|
1905
|
+
console.error('[MRT] Error during tree row reorder:', error);
|
|
2196
1906
|
}
|
|
2197
|
-
}
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
// as in MRT_ExportsToolbar: pdf format selected, active exports, grouped or single type.
|
|
2214
|
-
const renderRowAction = (context) => {
|
|
2215
|
-
const onRowExport = createRowExportExecutor(context);
|
|
2216
|
-
const onRowPrint = isPrintAvailable(context.table)
|
|
2217
|
-
? createRowPrintExecutor(context)
|
|
2218
|
-
: undefined;
|
|
2219
|
-
if (customRenderRow) {
|
|
2220
|
-
return customRenderRow(Object.assign(Object.assign({}, context), { onExport: onRowExport }));
|
|
2221
|
-
}
|
|
2222
|
-
return jsxRuntime.jsx(ExportRowAction, { onExport: onRowExport, onPrint: onRowPrint });
|
|
1907
|
+
}, [
|
|
1908
|
+
onTreeRowReorder,
|
|
1909
|
+
selectedReorderRowIds,
|
|
1910
|
+
selectedRowsForReorder,
|
|
1911
|
+
table,
|
|
1912
|
+
row,
|
|
1913
|
+
]);
|
|
1914
|
+
return {
|
|
1915
|
+
isRowHovered,
|
|
1916
|
+
shouldShowReorderCheckbox,
|
|
1917
|
+
shouldShowInsertHereAction,
|
|
1918
|
+
handleRowHoverEnter: () => setIsRowHovered(true),
|
|
1919
|
+
handleRowHoverLeave: () => setIsRowHovered(false),
|
|
1920
|
+
handleReorderCheckboxChange,
|
|
1921
|
+
handleInsertHereActionClick,
|
|
1922
|
+
isReorderCheckboxSelected: !!(rowReorderingSelection === null || rowReorderingSelection === void 0 ? void 0 : rowReorderingSelection[row.id]),
|
|
2223
1923
|
};
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
const
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
1924
|
+
};
|
|
1925
|
+
|
|
1926
|
+
const useTreeRowReorderingHeader = ({ table, enableRowReordering, onTreeRowReorder, }) => {
|
|
1927
|
+
const rowReorderingSelection = useMRT_SliceValue(table._uiStore, (s) => s.rowReorderingSelection);
|
|
1928
|
+
const selectedReorderRowIds = getSelectedReorderRowIds(rowReorderingSelection);
|
|
1929
|
+
const selectedRowsForReorder = buildSelectedRowsArray(selectedReorderRowIds, table);
|
|
1930
|
+
const shouldShowMoveToTopLevelAction = !!enableRowReordering &&
|
|
1931
|
+
selectedRowsForReorder.length > 0 &&
|
|
1932
|
+
selectedRowsForReorder.some((selectedRow) => selectedRow.depth > 0);
|
|
1933
|
+
const handleMoveToTopLevelActionClick = react.useCallback(() => {
|
|
1934
|
+
if (!onTreeRowReorder) {
|
|
1935
|
+
console.warn('[MRT] onTreeRowReorder callback is not defined');
|
|
1936
|
+
return;
|
|
2235
1937
|
}
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
1938
|
+
try {
|
|
1939
|
+
const treeRowReorderEvent = {
|
|
1940
|
+
selectedRowIds: selectedReorderRowIds,
|
|
1941
|
+
selectedRows: selectedRowsForReorder,
|
|
1942
|
+
table,
|
|
1943
|
+
targetRow: null,
|
|
1944
|
+
};
|
|
1945
|
+
onTreeRowReorder(treeRowReorderEvent);
|
|
2241
1946
|
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
1947
|
+
catch (error) {
|
|
1948
|
+
console.error('[MRT] Error during tree row reorder to top level:', error);
|
|
1949
|
+
}
|
|
1950
|
+
}, [onTreeRowReorder, selectedReorderRowIds, selectedRowsForReorder, table]);
|
|
1951
|
+
return {
|
|
1952
|
+
shouldShowMoveToTopLevelAction,
|
|
1953
|
+
handleMoveToTopLevelActionClick,
|
|
1954
|
+
};
|
|
1955
|
+
};
|
|
1956
|
+
|
|
1957
|
+
const TREE_REORDER_ICON_SPACING = '0.25rem';
|
|
1958
|
+
const getMRT_RowExpandColumnDef = (tableOptions) => {
|
|
1959
|
+
var _a;
|
|
1960
|
+
const { defaultColumn, enableRowReordering, enableExpandAll, groupedColumnMode, maxDepth, onTreeRowReorder, positionExpandColumn, renderDetailPanel, state: { grouping }, } = tableOptions;
|
|
1961
|
+
const alignProps = positionExpandColumn === 'last'
|
|
1962
|
+
? {
|
|
1963
|
+
align: 'right',
|
|
1964
|
+
}
|
|
1965
|
+
: undefined;
|
|
1966
|
+
return Object.assign(Object.assign({ Cell: ({ cell, column, row, staticRowIndex, table }) => {
|
|
1967
|
+
var _a, _b, _c;
|
|
1968
|
+
const rowReorderingSelection = useMRT_SliceValue(table._uiStore, (s) => s.rowReorderingSelection);
|
|
1969
|
+
const cellLogic = useTreeRowReorderingCell({
|
|
1970
|
+
row,
|
|
1971
|
+
table,
|
|
1972
|
+
rowReorderingSelection,
|
|
1973
|
+
maxDepth,
|
|
1974
|
+
onTreeRowReorder,
|
|
2246
1975
|
});
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
1976
|
+
const expandButtonProps = { row, staticRowIndex, table };
|
|
1977
|
+
const subRowsLength = (_a = row.subRows) === null || _a === void 0 ? void 0 : _a.length;
|
|
1978
|
+
const customGroupedCell = (_c = (_b = column.columnDef).GroupedCell) === null || _c === void 0 ? void 0 : _c.call(_b, {
|
|
1979
|
+
cell,
|
|
1980
|
+
column,
|
|
1981
|
+
row,
|
|
1982
|
+
table,
|
|
1983
|
+
staticRowIndex,
|
|
1984
|
+
});
|
|
1985
|
+
if (groupedColumnMode === 'remove' && row.groupingColumnId) {
|
|
1986
|
+
const defaultGroupedCell = (jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps('right'), { title: table.getColumn(row.groupingColumnId).columnDef.header, children: jsxRuntime.jsx("span", { children: row.groupingValue }) })));
|
|
1987
|
+
return (jsxRuntime.jsxs(Stack, { alignItems: "center", flexDirection: "row", gap: TREE_REORDER_ICON_SPACING, onMouseEnter: cellLogic.handleRowHoverEnter, onMouseLeave: cellLogic.handleRowHoverLeave, width: "100%", children: [jsxRuntime.jsx(MRT_ExpandButton, Object.assign({}, expandButtonProps)), column.columnDef.GroupedCell
|
|
1988
|
+
? customGroupedCell
|
|
1989
|
+
: defaultGroupedCell, cellLogic.shouldShowReorderCheckbox && (jsxRuntime.jsx(MRT_ReorderRowCheckbox, { isSelected: cellLogic.isReorderCheckboxSelected, onChange: cellLogic.handleReorderCheckboxChange })), cellLogic.shouldShowInsertHereAction && (jsxRuntime.jsx(MRT_InsertHereAction, { onClick: cellLogic.handleInsertHereActionClick })), !!subRowsLength && jsxRuntime.jsxs("span", { children: ["(", subRowsLength, ")"] })] }));
|
|
2260
1990
|
}
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
1991
|
+
return (jsxRuntime.jsxs(Stack, { alignItems: "center", flexDirection: "row", gap: TREE_REORDER_ICON_SPACING, onMouseEnter: cellLogic.handleRowHoverEnter, onMouseLeave: cellLogic.handleRowHoverLeave, width: "100%", children: [jsxRuntime.jsx(MRT_ExpandButton, Object.assign({}, expandButtonProps)), customGroupedCell, cellLogic.shouldShowReorderCheckbox && (jsxRuntime.jsx(MRT_ReorderRowCheckbox, { isSelected: cellLogic.isReorderCheckboxSelected, onChange: cellLogic.handleReorderCheckboxChange })), cellLogic.shouldShowInsertHereAction && (jsxRuntime.jsx(MRT_InsertHereAction, { onClick: cellLogic.handleInsertHereActionClick }))] }));
|
|
1992
|
+
}, Header: enableExpandAll
|
|
1993
|
+
? ({ table }) => {
|
|
1994
|
+
var _a;
|
|
1995
|
+
const headerLogic = useTreeRowReorderingHeader({
|
|
1996
|
+
table,
|
|
1997
|
+
enableRowReordering,
|
|
1998
|
+
onTreeRowReorder,
|
|
1999
|
+
});
|
|
2000
|
+
return (jsxRuntime.jsxs(Stack, { alignItems: "center", flexDirection: "row", gap: TREE_REORDER_ICON_SPACING, children: [jsxRuntime.jsx(MRT_ExpandAllButton, { table: table }), headerLogic.shouldShowMoveToTopLevelAction && (jsxRuntime.jsx(MRT_MoveToTopAction, { onClick: headerLogic.handleMoveToTopLevelActionClick })), groupedColumnMode === 'remove' &&
|
|
2001
|
+
((_a = grouping === null || grouping === void 0 ? void 0 : grouping.map((groupedColumnId) => table.getColumn(groupedColumnId).columnDef.header)) === null || _a === void 0 ? void 0 : _a.join(', '))] }));
|
|
2265
2002
|
}
|
|
2266
|
-
|
|
2267
|
-
|
|
2003
|
+
: undefined, muiTableBodyCellProps: alignProps, muiTableHeadCellProps: alignProps }, defaultDisplayColumnProps({
|
|
2004
|
+
header: 'expand',
|
|
2005
|
+
id: 'mrt-row-expand',
|
|
2006
|
+
size: groupedColumnMode === 'remove'
|
|
2007
|
+
? ((_a = defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.size) !== null && _a !== void 0 ? _a : 180)
|
|
2008
|
+
: renderDetailPanel
|
|
2009
|
+
? enableExpandAll
|
|
2010
|
+
? 60
|
|
2011
|
+
: 70
|
|
2012
|
+
: 100,
|
|
2013
|
+
tableOptions,
|
|
2014
|
+
})), { enableResizing: true });
|
|
2015
|
+
};
|
|
2016
|
+
|
|
2017
|
+
const getMRT_RowNumbersColumnDef = (tableOptions) => {
|
|
2018
|
+
const { localization, rowNumberDisplayMode } = tableOptions;
|
|
2019
|
+
const { pagination: { pageIndex, pageSize }, } = tableOptions.state;
|
|
2020
|
+
return Object.assign({ Cell: ({ row, staticRowIndex }) => {
|
|
2021
|
+
var _a;
|
|
2022
|
+
return ((_a = (rowNumberDisplayMode === 'static'
|
|
2023
|
+
? (staticRowIndex || 0) + (pageSize || 0) * (pageIndex || 0)
|
|
2024
|
+
: row.index)) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
2025
|
+
}, Header: () => localization.rowNumber, grow: false }, defaultDisplayColumnProps({
|
|
2026
|
+
header: 'rowNumbers',
|
|
2027
|
+
id: 'mrt-row-numbers',
|
|
2028
|
+
size: 50,
|
|
2029
|
+
tableOptions,
|
|
2030
|
+
}));
|
|
2031
|
+
};
|
|
2032
|
+
|
|
2033
|
+
const MRT_RowPinButton = (_a) => {
|
|
2034
|
+
var { pinningPosition, row, table } = _a, rest = __rest(_a, ["pinningPosition", "row", "table"]);
|
|
2035
|
+
const { options: { icons: { CloseIcon, PushPinIcon }, localization, rowPinningDisplayMode, }, } = table;
|
|
2036
|
+
const isPinned = row.getIsPinned();
|
|
2037
|
+
const [tooltipOpened, setTooltipOpened] = react.useState(false);
|
|
2038
|
+
const handleTogglePin = (event) => {
|
|
2039
|
+
setTooltipOpened(false);
|
|
2040
|
+
event.stopPropagation();
|
|
2041
|
+
row.pin(isPinned ? false : pinningPosition);
|
|
2268
2042
|
};
|
|
2269
|
-
return Object.assign({
|
|
2043
|
+
return (jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { open: tooltipOpened, title: isPinned ? localization.unpin : localization.pin, children: jsxRuntime.jsx(IconButton, Object.assign({ "aria-label": localization.pin, onBlur: () => setTooltipOpened(false), onClick: handleTogglePin, onFocus: () => setTooltipOpened(true), onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false), size: "small" }, rest, { sx: (theme) => (Object.assign({ height: '24px', width: '24px' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: isPinned ? (jsxRuntime.jsx(CloseIcon, {})) : (jsxRuntime.jsx(PushPinIcon, { fontSize: "small", style: {
|
|
2044
|
+
transform: `rotate(${rowPinningDisplayMode === 'sticky'
|
|
2045
|
+
? 135
|
|
2046
|
+
: pinningPosition === 'top'
|
|
2047
|
+
? 180
|
|
2048
|
+
: 0}deg)`,
|
|
2049
|
+
} })) })) })));
|
|
2050
|
+
};
|
|
2051
|
+
|
|
2052
|
+
const MRT_TableBodyRowPinButton = (_a) => {
|
|
2053
|
+
var { row, table } = _a, rest = __rest(_a, ["row", "table"]);
|
|
2054
|
+
const { options: { enableRowPinning, rowPinningDisplayMode }, } = table;
|
|
2055
|
+
const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
|
|
2056
|
+
const canPin = parseFromValuesOrFunc(enableRowPinning, row);
|
|
2057
|
+
if (!canPin)
|
|
2058
|
+
return null;
|
|
2059
|
+
const rowPinButtonProps = Object.assign({ row,
|
|
2060
|
+
table }, rest);
|
|
2061
|
+
if (rowPinningDisplayMode === 'top-and-bottom' && !row.getIsPinned()) {
|
|
2062
|
+
return (jsxRuntime.jsxs(Box, { sx: {
|
|
2063
|
+
display: 'flex',
|
|
2064
|
+
flexDirection: density === 'compact' ? 'row' : 'column',
|
|
2065
|
+
}, children: [jsxRuntime.jsx(MRT_RowPinButton, Object.assign({ pinningPosition: "top" }, rowPinButtonProps)), jsxRuntime.jsx(MRT_RowPinButton, Object.assign({ pinningPosition: "bottom" }, rowPinButtonProps))] }));
|
|
2066
|
+
}
|
|
2067
|
+
return (jsxRuntime.jsx(MRT_RowPinButton, Object.assign({ pinningPosition: rowPinningDisplayMode === 'bottom' ? 'bottom' : 'top' }, rowPinButtonProps)));
|
|
2068
|
+
};
|
|
2069
|
+
|
|
2070
|
+
const getMRT_RowPinningColumnDef = (tableOptions) => {
|
|
2071
|
+
return Object.assign({ Cell: ({ row, table }) => (jsxRuntime.jsx(MRT_TableBodyRowPinButton, { row: row, table: table })), grow: false }, defaultDisplayColumnProps({
|
|
2072
|
+
header: 'pin',
|
|
2073
|
+
id: 'mrt-row-pin',
|
|
2074
|
+
size: 60,
|
|
2075
|
+
tableOptions,
|
|
2076
|
+
}));
|
|
2077
|
+
};
|
|
2078
|
+
|
|
2079
|
+
const MRT_SelectAllMenu = ({ table, }) => {
|
|
2080
|
+
const [anchorEl, setAnchorEl] = react.useState(null);
|
|
2081
|
+
const [isSelectingAllPages, setIsSelectingAllPages] = react.useState(false);
|
|
2082
|
+
const { getState, options: { enableRowPinning, getAllSelectableRowIds, localization, rowPinningDisplayMode, }, refs: { allSelectableRowIdsRef }, } = table;
|
|
2083
|
+
// rowSelection is read here so that any change to selection will trigger a re-render and update the menu options accordingly
|
|
2084
|
+
const { isLoading, rowSelection } = getState();
|
|
2085
|
+
const isAllCurrentPageSelected = table.getIsAllPageRowsSelected();
|
|
2086
|
+
const isAllPagesActive = getIsAllPagesSelectionActive(table, rowSelection);
|
|
2087
|
+
const handleOpen = (event) => {
|
|
2088
|
+
setAnchorEl(event.currentTarget);
|
|
2089
|
+
};
|
|
2090
|
+
const handleClose = () => {
|
|
2091
|
+
setAnchorEl(null);
|
|
2092
|
+
};
|
|
2093
|
+
// Clears row pinning on every bulk selection/deselection
|
|
2094
|
+
const clearPinning = () => {
|
|
2095
|
+
if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'))) {
|
|
2096
|
+
table.setRowPinning({ bottom: [], top: [] });
|
|
2097
|
+
}
|
|
2098
|
+
};
|
|
2099
|
+
// ── Current-page actions ────────────────────────────────────────────────────
|
|
2100
|
+
const handleSelectCurrentPage = () => {
|
|
2101
|
+
table.toggleAllPageRowsSelected(true);
|
|
2102
|
+
clearPinning();
|
|
2103
|
+
handleClose();
|
|
2104
|
+
};
|
|
2105
|
+
const handleDeselectCurrentPage = () => {
|
|
2106
|
+
if (allSelectableRowIdsRef.current.length > 0) {
|
|
2107
|
+
// When all pages are selected, deselecting the current page must clear the entire selection — otherwise rows on other pages remain "ghost-selected" but the user can't see them.
|
|
2108
|
+
table.setRowSelection({});
|
|
2109
|
+
allSelectableRowIdsRef.current = [];
|
|
2110
|
+
}
|
|
2111
|
+
else {
|
|
2112
|
+
table.toggleAllPageRowsSelected(false);
|
|
2113
|
+
}
|
|
2114
|
+
clearPinning();
|
|
2115
|
+
handleClose();
|
|
2116
|
+
};
|
|
2117
|
+
// ── All-pages actions ───────────────────────────────────────────────────────
|
|
2118
|
+
const handleSelectAllPages = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
2119
|
+
handleClose();
|
|
2120
|
+
if (getAllSelectableRowIds) {
|
|
2121
|
+
// Server-side: IDs are not available locally, fetch them from the API
|
|
2122
|
+
setIsSelectingAllPages(true);
|
|
2123
|
+
table.setShowProgressBars(true);
|
|
2124
|
+
try {
|
|
2125
|
+
const ids = yield getAllSelectableRowIds({ table });
|
|
2126
|
+
allSelectableRowIdsRef.current = ids;
|
|
2127
|
+
const newSelection = {};
|
|
2128
|
+
ids.forEach((id) => {
|
|
2129
|
+
newSelection[id] = true;
|
|
2130
|
+
});
|
|
2131
|
+
table.setRowSelection(newSelection);
|
|
2132
|
+
clearPinning();
|
|
2133
|
+
}
|
|
2134
|
+
finally {
|
|
2135
|
+
setIsSelectingAllPages(false);
|
|
2136
|
+
table.setShowProgressBars(false);
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
else {
|
|
2140
|
+
// Client-side: all data is available locally
|
|
2141
|
+
table.toggleAllRowsSelected(true);
|
|
2142
|
+
clearPinning();
|
|
2143
|
+
}
|
|
2144
|
+
});
|
|
2145
|
+
const handleDeselectAllPages = () => {
|
|
2146
|
+
if (getAllSelectableRowIds) {
|
|
2147
|
+
table.setRowSelection({});
|
|
2148
|
+
}
|
|
2149
|
+
else {
|
|
2150
|
+
table.toggleAllRowsSelected(false);
|
|
2151
|
+
}
|
|
2152
|
+
allSelectableRowIdsRef.current = [];
|
|
2153
|
+
clearPinning();
|
|
2154
|
+
handleClose();
|
|
2155
|
+
};
|
|
2156
|
+
const isDisabled = isLoading || isSelectingAllPages;
|
|
2157
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { title: localization.toggleSelectAll, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton, { "aria-label": localization.toggleSelectAll, disabled: isDisabled, onClick: handleOpen, size: "small", sx: { height: '1.5rem', width: '1.5rem' }, children: jsxRuntime.jsx(table.options.icons.MoreVertIcon, { style: { transform: 'scale(0.85)' } }) }) }) })), jsxRuntime.jsxs(Menu, { anchorEl: anchorEl, onClose: handleClose, open: Boolean(anchorEl), children: [isAllCurrentPageSelected ? (jsxRuntime.jsx(MenuItem, { onClick: handleDeselectCurrentPage, children: localization.deselectAllOnCurrentPage })) : (jsxRuntime.jsx(MenuItem, { onClick: handleSelectCurrentPage, children: localization.selectAllOnCurrentPage })), isAllPagesActive ? (jsxRuntime.jsx(MenuItem, { onClick: handleDeselectAllPages, children: localization.deselectAllOnAllPages })) : (jsxRuntime.jsxs(MenuItem, { disabled: isSelectingAllPages, onClick: handleSelectAllPages, children: [isSelectingAllPages && (jsxRuntime.jsx(CircularProgress, { "aria-label": "Loading", size: 14, sx: { mr: 1 } })), localization.selectAllOnAllPages] }))] })] }));
|
|
2158
|
+
};
|
|
2159
|
+
|
|
2160
|
+
const MRT_SelectCheckbox = (_a) => {
|
|
2161
|
+
var _b;
|
|
2162
|
+
var { row, staticRowIndex, table } = _a, rest = __rest(_a, ["row", "staticRowIndex", "table"]);
|
|
2163
|
+
const { getState, options: { enableMultiRowSelection, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, selectAllMode, }, } = table;
|
|
2164
|
+
const { isLoading } = getState();
|
|
2165
|
+
const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
|
|
2166
|
+
const selectAll = !row;
|
|
2167
|
+
const allRowsSelected = selectAll
|
|
2168
|
+
? selectAllMode === 'page'
|
|
2169
|
+
? table.getIsAllPageRowsSelected()
|
|
2170
|
+
: table.getIsAllRowsSelected()
|
|
2171
|
+
: undefined;
|
|
2172
|
+
const isChecked = selectAll
|
|
2173
|
+
? allRowsSelected
|
|
2174
|
+
: getIsRowSelected({ row, table });
|
|
2175
|
+
const checkboxProps = Object.assign(Object.assign({}, (selectAll
|
|
2176
|
+
? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
|
|
2177
|
+
: parseFromValuesOrFunc(muiSelectCheckboxProps, {
|
|
2178
|
+
row,
|
|
2179
|
+
staticRowIndex,
|
|
2180
|
+
table,
|
|
2181
|
+
}))), rest);
|
|
2182
|
+
const onSelectionChange = row
|
|
2183
|
+
? getMRT_RowSelectionHandler({
|
|
2184
|
+
row,
|
|
2185
|
+
staticRowIndex,
|
|
2186
|
+
table,
|
|
2187
|
+
})
|
|
2188
|
+
: undefined;
|
|
2189
|
+
const onSelectAllChange = getMRT_SelectAllHandler({ table });
|
|
2190
|
+
const commonProps = Object.assign(Object.assign({ 'aria-label': selectAll
|
|
2191
|
+
? localization.toggleSelectAll
|
|
2192
|
+
: localization.toggleSelectRow, checked: isChecked, disabled: isLoading || (row && !row.getCanSelect()) || (row === null || row === void 0 ? void 0 : row.id) === 'mrt-row-create', inputProps: {
|
|
2193
|
+
'aria-label': selectAll
|
|
2194
|
+
? localization.toggleSelectAll
|
|
2195
|
+
: localization.toggleSelectRow,
|
|
2196
|
+
}, onChange: (event) => {
|
|
2197
|
+
event.stopPropagation();
|
|
2198
|
+
selectAll ? onSelectAllChange(event) : onSelectionChange(event);
|
|
2199
|
+
}, size: (density === 'compact' ? 'small' : 'medium') }, checkboxProps), { onClick: (e) => {
|
|
2200
|
+
var _a;
|
|
2201
|
+
e.stopPropagation();
|
|
2202
|
+
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
|
2203
|
+
}, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.5rem', zIndex: 0 }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))), title: undefined });
|
|
2204
|
+
return (jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : (selectAll
|
|
2205
|
+
? localization.toggleSelectAll
|
|
2206
|
+
: localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsxRuntime.jsx(Radio, Object.assign({}, commonProps))) : (jsxRuntime.jsx(Checkbox, Object.assign({ disableRipple: true, indeterminate: !isChecked && selectAll
|
|
2207
|
+
? table.getIsSomeRowsSelected()
|
|
2208
|
+
: (row === null || row === void 0 ? void 0 : row.getIsSomeSelected()) && row.getCanSelectSubRows() }, commonProps))) })));
|
|
2209
|
+
};
|
|
2210
|
+
|
|
2211
|
+
const getMRT_RowSelectColumnDef = (tableOptions) => {
|
|
2212
|
+
const { enableMultiRowSelection, enableSelectAll } = tableOptions;
|
|
2213
|
+
return Object.assign({ Cell: ({ row, staticRowIndex, table }) => (jsxRuntime.jsx(MRT_SelectCheckbox, { row: row, staticRowIndex: staticRowIndex, table: table })), Header: enableSelectAll && enableMultiRowSelection
|
|
2214
|
+
? ({ table }) => (jsxRuntime.jsxs(Box, { sx: { alignItems: 'center', display: 'flex' }, children: [jsxRuntime.jsx(MRT_SelectCheckbox, { table: table }), jsxRuntime.jsx(MRT_SelectAllMenu, { table: table })] }))
|
|
2215
|
+
: undefined, grow: false }, defaultDisplayColumnProps({
|
|
2216
|
+
header: 'select',
|
|
2217
|
+
id: '__check__',
|
|
2218
|
+
size: enableSelectAll ? 90 : 70, // widened from 60 to accommodate both the checkbox and the menu button
|
|
2219
|
+
tableOptions,
|
|
2220
|
+
}));
|
|
2221
|
+
};
|
|
2222
|
+
|
|
2223
|
+
const MRT_Default_Icons = {
|
|
2224
|
+
AddIcon,
|
|
2225
|
+
ArrowDownwardIcon,
|
|
2226
|
+
ArrowRightIcon,
|
|
2227
|
+
CancelIcon,
|
|
2228
|
+
ChevronLeftIcon,
|
|
2229
|
+
ChevronRightIcon,
|
|
2230
|
+
ClearAllIcon,
|
|
2231
|
+
CloseIcon,
|
|
2232
|
+
ContentCopy,
|
|
2233
|
+
DensityLargeIcon,
|
|
2234
|
+
DensityMediumIcon,
|
|
2235
|
+
DensitySmallIcon,
|
|
2236
|
+
DragHandleIcon,
|
|
2237
|
+
DynamicFeedIcon,
|
|
2238
|
+
EditIcon,
|
|
2239
|
+
ExpandMoreIcon,
|
|
2240
|
+
FilterAltIcon,
|
|
2241
|
+
FilterListIcon,
|
|
2242
|
+
FilterListOffIcon,
|
|
2243
|
+
FirstPageIcon,
|
|
2244
|
+
FullscreenExitIcon,
|
|
2245
|
+
FullscreenIcon,
|
|
2246
|
+
KeyboardDoubleArrowDownIcon,
|
|
2247
|
+
LastPageIcon,
|
|
2248
|
+
MoreHorizIcon,
|
|
2249
|
+
MoreVertIcon,
|
|
2250
|
+
PushPinIcon,
|
|
2251
|
+
RestartAltIcon,
|
|
2252
|
+
SaveIcon,
|
|
2253
|
+
SearchIcon,
|
|
2254
|
+
SearchOffIcon,
|
|
2255
|
+
SortIcon,
|
|
2256
|
+
SyncAltIcon,
|
|
2257
|
+
ViewColumnIcon,
|
|
2258
|
+
VisibilityOffIcon,
|
|
2259
|
+
};
|
|
2260
|
+
|
|
2261
|
+
const MRT_Localization_EN = {
|
|
2262
|
+
language: 'en',
|
|
2263
|
+
actions: 'Actions',
|
|
2264
|
+
and: 'and',
|
|
2265
|
+
booleanFalse: 'False',
|
|
2266
|
+
booleanTrue: 'True',
|
|
2267
|
+
cancel: 'Cancel',
|
|
2268
|
+
close: 'Close',
|
|
2269
|
+
changeFilterMode: 'Change filter mode',
|
|
2270
|
+
changeSearchMode: 'Change search mode',
|
|
2271
|
+
clearFilter: 'Clear filter',
|
|
2272
|
+
clearSearch: 'Clear search',
|
|
2273
|
+
clearSelection: 'Clear selection',
|
|
2274
|
+
clearSort: 'Clear sort',
|
|
2275
|
+
deselectAllOnAllPages: 'Deselect all on all pages',
|
|
2276
|
+
deselectAllOnCurrentPage: 'Deselect all on current page',
|
|
2277
|
+
clickToCopy: 'Click to copy',
|
|
2278
|
+
copy: 'Copy',
|
|
2279
|
+
collapse: 'Collapse',
|
|
2280
|
+
collapseAll: 'Collapse all',
|
|
2281
|
+
columnActions: 'Column Actions',
|
|
2282
|
+
columns: 'Columns',
|
|
2283
|
+
copiedToClipboard: 'Copied to clipboard',
|
|
2284
|
+
dropToGroupBy: 'Drop to group by {column}',
|
|
2285
|
+
edit: 'Edit',
|
|
2286
|
+
expand: 'Expand',
|
|
2287
|
+
expandAll: 'Expand all',
|
|
2288
|
+
filterArrIncludes: 'Includes',
|
|
2289
|
+
filterArrIncludesAll: 'Includes all',
|
|
2290
|
+
filterArrIncludesSome: 'Includes',
|
|
2291
|
+
filterBetween: 'Between',
|
|
2292
|
+
filterBetweenInclusive: 'Between Inclusive',
|
|
2293
|
+
filterByColumn: 'Filter by {column}',
|
|
2294
|
+
filterFrom: 'From',
|
|
2295
|
+
filterTo: 'To',
|
|
2296
|
+
filterContains: 'Contains',
|
|
2297
|
+
filterEmpty: 'Empty',
|
|
2298
|
+
filterEndsWith: 'Ends With',
|
|
2299
|
+
filterEquals: 'Equals',
|
|
2300
|
+
filterEqualsString: 'Equals',
|
|
2301
|
+
filterFuzzy: 'Fuzzy',
|
|
2302
|
+
filterGreaterThan: 'Greater Than',
|
|
2303
|
+
filterGreaterThanOrEqualTo: 'Greater Than Or Equal To',
|
|
2304
|
+
filterInArray: 'Is any of',
|
|
2305
|
+
filterIsAnyOf: 'Is any of',
|
|
2306
|
+
filterInNumberRange: 'Between',
|
|
2307
|
+
filterIncludesString: 'Contains',
|
|
2308
|
+
filterIncludesStringSensitive: 'Contains',
|
|
2309
|
+
filterLessThan: 'Less Than',
|
|
2310
|
+
filterLessThanOrEqualTo: 'Less Than Or Equal To',
|
|
2311
|
+
filterMode: 'Filter Mode: {filterType}',
|
|
2312
|
+
filterNoOptions: 'No filter options available',
|
|
2313
|
+
filterNotEmpty: 'Not Empty',
|
|
2314
|
+
filterNotEquals: 'Not Equals',
|
|
2315
|
+
filterNotContains: 'Does Not Contain',
|
|
2316
|
+
filterLogic: 'Logic',
|
|
2317
|
+
filterOperator: 'Operator',
|
|
2318
|
+
filterStartsWith: 'Starts With',
|
|
2319
|
+
filterWeakEquals: 'Equals',
|
|
2320
|
+
filterCurrentWeek: 'Current Week',
|
|
2321
|
+
filterCurrentMonth: 'Current Month',
|
|
2322
|
+
filterLast7Days: 'Last 7 Days',
|
|
2323
|
+
filterLastWeek: 'Last Week',
|
|
2324
|
+
filterLastMonth: 'Last Month',
|
|
2325
|
+
filterFromToday: 'From Today',
|
|
2326
|
+
filterToToday: 'To Today',
|
|
2327
|
+
filteringByColumn: 'Filtering by {column} - {filterType} {filterValue}',
|
|
2328
|
+
goToFirstPage: 'Go to first page',
|
|
2329
|
+
goToLastPage: 'Go to last page',
|
|
2330
|
+
goToNextPage: 'Go to next page',
|
|
2331
|
+
goToPreviousPage: 'Go to previous page',
|
|
2332
|
+
grab: 'Grab',
|
|
2333
|
+
groupByColumn: 'Group by {column}',
|
|
2334
|
+
groupedBy: 'Grouped by ',
|
|
2335
|
+
hideAll: 'Hide all',
|
|
2336
|
+
hideColumn: 'Hide {column} column',
|
|
2337
|
+
max: 'Max',
|
|
2338
|
+
min: 'Min',
|
|
2339
|
+
move: 'Move',
|
|
2340
|
+
noRecordsToDisplay: 'No records to display',
|
|
2341
|
+
noResultsFound: 'No results found',
|
|
2342
|
+
moreThan: 'more than',
|
|
2343
|
+
of: 'of',
|
|
2344
|
+
or: 'or',
|
|
2345
|
+
pin: 'Pin',
|
|
2346
|
+
pinToLeft: 'Pin to left',
|
|
2347
|
+
pinToRight: 'Pin to right',
|
|
2348
|
+
resetColumnSize: 'Reset column size',
|
|
2349
|
+
resetOrder: 'Reset order',
|
|
2350
|
+
rowActions: 'Row Actions',
|
|
2351
|
+
rowNumber: '#',
|
|
2352
|
+
rowNumbers: 'Row Numbers',
|
|
2353
|
+
rowsPerPage: 'Rows per page',
|
|
2354
|
+
countRows: 'Count Rows',
|
|
2355
|
+
countRowsTooltip: 'Count total rows for current filters',
|
|
2356
|
+
rowCount: 'Row Count',
|
|
2357
|
+
rowsSelected: '{count} row(s) selected',
|
|
2358
|
+
save: 'Save',
|
|
2359
|
+
search: 'Search',
|
|
2360
|
+
selectedCountOfRowCountRowsSelected: '{selectedCount} of {rowCount} row(s) selected',
|
|
2361
|
+
select: 'Select',
|
|
2362
|
+
selectAllOnAllPages: 'Select all on all pages',
|
|
2363
|
+
selectAllOnCurrentPage: 'Select all on current page',
|
|
2364
|
+
showAll: 'Show all',
|
|
2365
|
+
showAllColumns: 'Show all columns',
|
|
2366
|
+
showHideColumns: 'Columns',
|
|
2367
|
+
showHideFilters: 'Show/Hide filters',
|
|
2368
|
+
showHideSearch: 'Show/Hide search',
|
|
2369
|
+
showAdvancedFilters: 'Show advanced filters',
|
|
2370
|
+
advancedFilters: 'Advanced Filters',
|
|
2371
|
+
filters: 'Filters',
|
|
2372
|
+
add: 'Add',
|
|
2373
|
+
newEntry: 'New Entry',
|
|
2374
|
+
clear: 'Clear',
|
|
2375
|
+
discardChanges: 'Discard changes',
|
|
2376
|
+
saveFilters: 'Save filters',
|
|
2377
|
+
savedFilters: 'Saved filters',
|
|
2378
|
+
noSavedFilters: 'No saved filters',
|
|
2379
|
+
filterName: 'Filter name',
|
|
2380
|
+
apply: 'Apply',
|
|
2381
|
+
sortByColumnAsc: 'Sort by {column} ascending',
|
|
2382
|
+
sortByColumnDesc: 'Sort by {column} descending',
|
|
2383
|
+
sortedByColumnAsc: 'Sorted by {column} ascending',
|
|
2384
|
+
sortedByColumnDesc: 'Sorted by {column} descending',
|
|
2385
|
+
thenBy: ', then by ',
|
|
2386
|
+
toggleDensity: 'Density',
|
|
2387
|
+
densityCompact: 'Compact',
|
|
2388
|
+
densityStandard: 'Standard',
|
|
2389
|
+
densityComfortable: 'Comfortable',
|
|
2390
|
+
toggleFullScreen: 'Toggle full screen',
|
|
2391
|
+
toggleSelectAll: 'Toggle select all',
|
|
2392
|
+
toggleSelectRow: 'Toggle select row',
|
|
2393
|
+
toggleVisibility: 'Toggle visibility',
|
|
2394
|
+
ungroupByColumn: 'Ungroup by {column}',
|
|
2395
|
+
unpin: 'Unpin',
|
|
2396
|
+
unpinAll: 'Unpin all',
|
|
2397
|
+
dimensionRotationEnabled: 'Rotation enabled',
|
|
2398
|
+
dimensionRotationDisabled: 'Rotation disabled',
|
|
2399
|
+
length: 'Length',
|
|
2400
|
+
width: 'Width',
|
|
2401
|
+
height: 'Height',
|
|
2402
|
+
depth: 'Depth',
|
|
2403
|
+
tolerance: 'Tolerance',
|
|
2404
|
+
exportButton: 'Export',
|
|
2405
|
+
exportSelectRowsTooltip: 'Select rows to export',
|
|
2406
|
+
exportPrintPdf: 'Print PDF',
|
|
2407
|
+
exportDownload: 'Download',
|
|
2408
|
+
exportGrouped: 'Group files',
|
|
2409
|
+
exportInProgress: 'Export in progress...',
|
|
2410
|
+
exportSuccess: 'Export completed successfully.',
|
|
2411
|
+
exportError: 'Export failed. Please try again.',
|
|
2412
|
+
exportNoExportsSelected: 'No export type selected. Please configure the export first.',
|
|
2413
|
+
deleteConfirmationTitle: 'Delete Row',
|
|
2414
|
+
deleteConfirmationMessage: 'Are you sure you want to delete the selected row(s)?',
|
|
2415
|
+
deleteConfirmYes: 'Delete',
|
|
2416
|
+
deleteConfirmNo: 'Cancel',
|
|
2417
|
+
deleteConfirmDeleting: 'Deleting...',
|
|
2418
|
+
errorTitle: 'Unexpected error',
|
|
2419
|
+
errorMessage: 'An unexpected error occurred. Please try again.',
|
|
2420
|
+
serverTableErrorTitle: 'Unable to load table',
|
|
2421
|
+
serverTableErrorMessage: 'Something went wrong while loading the table configuration. Please try again.',
|
|
2422
|
+
serverTableErrorRetry: 'Try again',
|
|
2423
|
+
resetState: 'Reset State',
|
|
2424
|
+
tableOptions: 'Options',
|
|
2270
2425
|
};
|
|
2271
2426
|
|
|
2272
2427
|
const MRT_DefaultColumn = {
|
|
@@ -7465,7 +7620,6 @@ const MRT_TableFooterCell = (_a) => {
|
|
|
7465
7620
|
var { footer, staticColumnIndex, table } = _a, rest = __rest(_a, ["footer", "staticColumnIndex", "table"]);
|
|
7466
7621
|
const theme = styles.useTheme();
|
|
7467
7622
|
const { options: { enableColumnPinning, muiTableFooterCellProps, enableKeyboardShortcuts, }, } = table;
|
|
7468
|
-
useMRT_SliceValue(table._uiStore, (s) => s.density);
|
|
7469
7623
|
const { column } = footer;
|
|
7470
7624
|
const { columnDef } = column;
|
|
7471
7625
|
const { columnDefType } = columnDef;
|
|
@@ -7966,7 +8120,6 @@ const MRT_TableHeadCell = (_a) => {
|
|
|
7966
8120
|
const { getState, options: { columnResizeDirection, columnResizeMode, enableKeyboardShortcuts, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping, enableMultiSort, layoutMode, mrtTheme: { draggingBorderColor }, muiTableHeadCellProps, }, refs: { isResizingRef, tableHeadCellRefs }, setHoveredColumn, } = table;
|
|
7967
8121
|
const [isColumnCellHovered, setIsColumnCellHovered] = react.useState(false);
|
|
7968
8122
|
const { grouping } = getState();
|
|
7969
|
-
useMRT_SliceValue(table._uiStore, (s) => s.density);
|
|
7970
8123
|
const showColumnFilters = useMRT_SliceValue(table._uiStore, (s) => s.showColumnFilters);
|
|
7971
8124
|
const { column } = header;
|
|
7972
8125
|
const { columnDef } = column;
|
|
@@ -8751,6 +8904,9 @@ exports.Memo_MRT_TableBodyRow = Memo_MRT_TableBodyRow;
|
|
|
8751
8904
|
exports.RHF_FormProvider = RHF_FormProvider;
|
|
8752
8905
|
exports.buildDefaultValues = buildDefaultValues;
|
|
8753
8906
|
exports.cellKeyboardShortcuts = cellKeyboardShortcuts;
|
|
8907
|
+
exports.createDeleteAction = createDeleteAction;
|
|
8908
|
+
exports.createEditAction = createEditAction;
|
|
8909
|
+
exports.createExportAction = createExportAction;
|
|
8754
8910
|
exports.createMRTColumnHelper = createMRTColumnHelper;
|
|
8755
8911
|
exports.createRow = createRow;
|
|
8756
8912
|
exports.defaultDisplayColumnProps = defaultDisplayColumnProps;
|