material-react-table 0.34.0 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/MaterialReactTable.d.ts +39 -32
- package/dist/cjs/index.js +116 -118
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/menus/MRT_ShowHideColumnsMenuItems.d.ts +3 -3
- package/dist/esm/MaterialReactTable.d.ts +39 -32
- package/dist/esm/material-react-table.esm.js +116 -118
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/menus/MRT_ShowHideColumnsMenuItems.d.ts +3 -3
- package/dist/index.d.ts +39 -32
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +38 -26
- package/src/body/MRT_TableBodyCell.tsx +17 -18
- package/src/body/MRT_TableBodyRow.tsx +7 -10
- package/src/body/MRT_TableBodyRowGrabHandle.tsx +5 -5
- package/src/buttons/MRT_EditActionButtons.tsx +10 -6
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +4 -4
- package/src/head/MRT_TableHeadCell.tsx +11 -16
- package/src/head/MRT_TableHeadCellGrabHandle.tsx +11 -12
- package/src/inputs/MRT_EditCellTextField.tsx +13 -13
- package/src/inputs/MRT_GlobalFilterTextField.tsx +1 -6
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +5 -4
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +11 -11
- package/src/table/MRT_TableRoot.tsx +57 -63
- package/src/toolbar/MRT_ToolbarDropZone.tsx +6 -10
|
@@ -559,7 +559,7 @@ const getDefaultColumnFilterFn = (columnDef) => {
|
|
|
559
559
|
return 'fuzzy';
|
|
560
560
|
};
|
|
561
561
|
|
|
562
|
-
const MRT_ShowHideColumnsMenuItems = ({ allColumns,
|
|
562
|
+
const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, isSubMenu, table, }) => {
|
|
563
563
|
var _a;
|
|
564
564
|
const { getState, options: { enableColumnOrdering, enableHiding, enablePinning, localization, }, setColumnOrder, } = table;
|
|
565
565
|
const { columnOrder } = getState();
|
|
@@ -587,14 +587,14 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, currentHoveredColumn, setCur
|
|
|
587
587
|
};
|
|
588
588
|
const handleDragEnd = (_e) => {
|
|
589
589
|
setIsDragging(false);
|
|
590
|
-
|
|
591
|
-
if (
|
|
592
|
-
setColumnOrder(reorderColumn(column,
|
|
590
|
+
setHoveredColumn(null);
|
|
591
|
+
if (hoveredColumn) {
|
|
592
|
+
setColumnOrder(reorderColumn(column, hoveredColumn, columnOrder));
|
|
593
593
|
}
|
|
594
594
|
};
|
|
595
595
|
const handleDragEnter = (_e) => {
|
|
596
596
|
if (!isDragging) {
|
|
597
|
-
|
|
597
|
+
setHoveredColumn(column);
|
|
598
598
|
}
|
|
599
599
|
};
|
|
600
600
|
return (React.createElement(React.Fragment, null,
|
|
@@ -605,7 +605,7 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, currentHoveredColumn, setCur
|
|
|
605
605
|
opacity: isDragging ? 0.5 : 1,
|
|
606
606
|
outline: isDragging
|
|
607
607
|
? `1px dashed ${theme.palette.divider}`
|
|
608
|
-
: (
|
|
608
|
+
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
609
609
|
? `2px dashed ${theme.palette.primary.main}`
|
|
610
610
|
: 'none',
|
|
611
611
|
pl: `${(column.depth + 0.5) * 2}rem`,
|
|
@@ -635,7 +635,7 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, currentHoveredColumn, setCur
|
|
|
635
635
|
React.createElement(Switch, null)), disabled: (isSubMenu && switchChecked) ||
|
|
636
636
|
!column.getCanHide() ||
|
|
637
637
|
column.getIsGrouped(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (React.createElement(Typography, { sx: { alignSelf: 'center' } }, columnDef.header)))), (_a = column.columns) === null || _a === void 0 ? void 0 :
|
|
638
|
-
_a.map((c, i) => (React.createElement(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c,
|
|
638
|
+
_a.map((c, i) => (React.createElement(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, isSubMenu: isSubMenu, key: `${i}-${c.id}`, setHoveredColumn: setHoveredColumn, table: table })))));
|
|
639
639
|
};
|
|
640
640
|
|
|
641
641
|
const MRT_ShowHideColumnsMenu = ({ anchorEl, isSubMenu, setAnchorEl, table, }) => {
|
|
@@ -665,7 +665,7 @@ const MRT_ShowHideColumnsMenu = ({ anchorEl, isSubMenu, setAnchorEl, table, }) =
|
|
|
665
665
|
getLeftLeafColumns(),
|
|
666
666
|
getRightLeafColumns(),
|
|
667
667
|
]);
|
|
668
|
-
const [
|
|
668
|
+
const [hoveredColumn, setHoveredColumn] = useState(null);
|
|
669
669
|
return (React.createElement(Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => setAnchorEl(null), MenuListProps: {
|
|
670
670
|
dense: density === 'compact',
|
|
671
671
|
} },
|
|
@@ -680,7 +680,7 @@ const MRT_ShowHideColumnsMenu = ({ anchorEl, isSubMenu, setAnchorEl, table, }) =
|
|
|
680
680
|
!isSubMenu && enablePinning && (React.createElement(Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true) }, localization.unpinAll)),
|
|
681
681
|
React.createElement(Button, { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true) }, localization.showAll)),
|
|
682
682
|
React.createElement(Divider, null),
|
|
683
|
-
allColumns.map((column, index) => (React.createElement(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column,
|
|
683
|
+
allColumns.map((column, index) => (React.createElement(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, isSubMenu: isSubMenu, key: `${index}-${column.id}`, setHoveredColumn: setHoveredColumn, table: table })))));
|
|
684
684
|
};
|
|
685
685
|
|
|
686
686
|
const commonMenuItemStyles = {
|
|
@@ -873,16 +873,20 @@ const MRT_RowActionMenu = ({ anchorEl, handleEdit, row, setAnchorEl, table, }) =
|
|
|
873
873
|
};
|
|
874
874
|
|
|
875
875
|
const MRT_EditActionButtons = ({ row, table }) => {
|
|
876
|
-
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onEditRowSubmit, },
|
|
877
|
-
const {
|
|
876
|
+
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onEditRowSubmit, }, setEditingRow, } = table;
|
|
877
|
+
const { editingRow } = getState();
|
|
878
878
|
const handleCancel = () => {
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
setCurrentEditingRow(null);
|
|
879
|
+
row._valuesCache = Object.assign({}, row.original);
|
|
880
|
+
setEditingRow(null);
|
|
882
881
|
};
|
|
883
882
|
const handleSave = () => {
|
|
884
|
-
|
|
885
|
-
|
|
883
|
+
var _a;
|
|
884
|
+
onEditRowSubmit === null || onEditRowSubmit === void 0 ? void 0 : onEditRowSubmit({
|
|
885
|
+
row: editingRow !== null && editingRow !== void 0 ? editingRow : row,
|
|
886
|
+
table,
|
|
887
|
+
values: (_a = editingRow === null || editingRow === void 0 ? void 0 : editingRow._valuesCache) !== null && _a !== void 0 ? _a : Object.assign({}, row.original),
|
|
888
|
+
});
|
|
889
|
+
setEditingRow(null);
|
|
886
890
|
};
|
|
887
891
|
return (React.createElement(Box, { sx: { display: 'flex', gap: '0.75rem' } },
|
|
888
892
|
React.createElement(Tooltip, { arrow: true, title: localization.cancel },
|
|
@@ -904,8 +908,8 @@ const commonIconButtonStyles = {
|
|
|
904
908
|
},
|
|
905
909
|
};
|
|
906
910
|
const MRT_ToggleRowActionMenuButton = ({ row, table }) => {
|
|
907
|
-
const { getState, options: { enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, },
|
|
908
|
-
const {
|
|
911
|
+
const { getState, options: { enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
|
|
912
|
+
const { editingRow } = getState();
|
|
909
913
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
910
914
|
const handleOpenRowActionMenu = (event) => {
|
|
911
915
|
event.stopPropagation();
|
|
@@ -913,10 +917,10 @@ const MRT_ToggleRowActionMenuButton = ({ row, table }) => {
|
|
|
913
917
|
setAnchorEl(event.currentTarget);
|
|
914
918
|
};
|
|
915
919
|
const handleStartEditMode = () => {
|
|
916
|
-
|
|
920
|
+
setEditingRow(Object.assign({}, row));
|
|
917
921
|
setAnchorEl(null);
|
|
918
922
|
};
|
|
919
|
-
return (React.createElement(React.Fragment, null, renderRowActions ? (React.createElement(React.Fragment, null, renderRowActions({ row, table }))) : row.id === (
|
|
923
|
+
return (React.createElement(React.Fragment, null, renderRowActions ? (React.createElement(React.Fragment, null, renderRowActions({ row, table }))) : row.id === (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) ? (React.createElement(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems && enableEditing ? (React.createElement(Tooltip, { placement: "right", arrow: true, title: localization.edit },
|
|
920
924
|
React.createElement(IconButton, { sx: commonIconButtonStyles, onClick: handleStartEditMode },
|
|
921
925
|
React.createElement(EditIcon, null)))) : renderRowActionMenuItems ? (React.createElement(React.Fragment, null,
|
|
922
926
|
React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions },
|
|
@@ -1146,15 +1150,15 @@ const MRT_ToolbarInternalButtons = ({ table }) => {
|
|
|
1146
1150
|
|
|
1147
1151
|
const MRT_ToolbarDropZone = ({ table }) => {
|
|
1148
1152
|
var _a, _b;
|
|
1149
|
-
const { getState, options: { enableGrouping, localization },
|
|
1150
|
-
const {
|
|
1153
|
+
const { getState, options: { enableGrouping, localization }, setHoveredColumn, } = table;
|
|
1154
|
+
const { draggingColumn, hoveredColumn } = getState();
|
|
1151
1155
|
const handleDragEnter = (_event) => {
|
|
1152
|
-
|
|
1156
|
+
setHoveredColumn({ id: 'drop-zone' });
|
|
1153
1157
|
};
|
|
1154
|
-
return (React.createElement(Fade, { unmountOnExit: true, mountOnEnter: true, in: !!enableGrouping && !!
|
|
1158
|
+
return (React.createElement(Fade, { unmountOnExit: true, mountOnEnter: true, in: !!enableGrouping && !!draggingColumn },
|
|
1155
1159
|
React.createElement(Box, { sx: (theme) => ({
|
|
1156
1160
|
alignItems: 'center',
|
|
1157
|
-
backgroundColor: alpha(theme.palette.info.main, (
|
|
1161
|
+
backgroundColor: alpha(theme.palette.info.main, (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone' ? 0.2 : 0.1),
|
|
1158
1162
|
border: `dashed ${theme.palette.info.main} 2px`,
|
|
1159
1163
|
display: 'flex',
|
|
1160
1164
|
justifyContent: 'center',
|
|
@@ -1163,7 +1167,7 @@ const MRT_ToolbarDropZone = ({ table }) => {
|
|
|
1163
1167
|
width: 'calc(100% - 4px)',
|
|
1164
1168
|
zIndex: 2,
|
|
1165
1169
|
}), onDragEnter: handleDragEnter },
|
|
1166
|
-
React.createElement(Typography, null, localization.dropToGroupBy.replace('{column}', (_b = (_a =
|
|
1170
|
+
React.createElement(Typography, null, localization.dropToGroupBy.replace('{column}', (_b = (_a = draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.columnDef) === null || _a === void 0 ? void 0 : _a.header) !== null && _b !== void 0 ? _b : '')))));
|
|
1167
1171
|
};
|
|
1168
1172
|
|
|
1169
1173
|
const commonToolbarStyles = ({ theme }) => ({
|
|
@@ -1493,9 +1497,9 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
|
1493
1497
|
};
|
|
1494
1498
|
|
|
1495
1499
|
const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
|
1496
|
-
const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps, onColumnDrop, }, setColumnOrder,
|
|
1500
|
+
const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps, onColumnDrop, }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
|
|
1497
1501
|
const { columnDef } = column;
|
|
1498
|
-
const {
|
|
1502
|
+
const { hoveredColumn, draggingColumn, columnOrder } = getState();
|
|
1499
1503
|
const mIconButtonProps = muiTableHeadCellDragHandleProps instanceof Function
|
|
1500
1504
|
? muiTableHeadCellDragHandleProps({ column, table })
|
|
1501
1505
|
: muiTableHeadCellDragHandleProps;
|
|
@@ -1504,25 +1508,25 @@ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
|
|
1504
1508
|
: columnDef.muiTableHeadCellDragHandleProps;
|
|
1505
1509
|
const iconButtonProps = Object.assign(Object.assign({}, mIconButtonProps), mcIconButtonProps);
|
|
1506
1510
|
const handleDragStart = (e) => {
|
|
1507
|
-
|
|
1511
|
+
setDraggingColumn(column);
|
|
1508
1512
|
e.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
|
|
1509
1513
|
};
|
|
1510
1514
|
const handleDragEnd = (event) => {
|
|
1511
1515
|
onColumnDrop === null || onColumnDrop === void 0 ? void 0 : onColumnDrop({
|
|
1512
1516
|
event,
|
|
1513
1517
|
draggedColumn: column,
|
|
1514
|
-
targetColumn:
|
|
1518
|
+
targetColumn: hoveredColumn,
|
|
1515
1519
|
});
|
|
1516
|
-
if ((
|
|
1520
|
+
if ((hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
|
1517
1521
|
column.toggleGrouping();
|
|
1518
1522
|
}
|
|
1519
1523
|
else if (enableColumnOrdering &&
|
|
1520
|
-
|
|
1521
|
-
(
|
|
1522
|
-
setColumnOrder(reorderColumn(column,
|
|
1524
|
+
hoveredColumn &&
|
|
1525
|
+
(hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) !== (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)) {
|
|
1526
|
+
setColumnOrder(reorderColumn(column, hoveredColumn, columnOrder));
|
|
1523
1527
|
}
|
|
1524
|
-
|
|
1525
|
-
|
|
1528
|
+
setDraggingColumn(null);
|
|
1529
|
+
setHoveredColumn(null);
|
|
1526
1530
|
};
|
|
1527
1531
|
return (React.createElement(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
|
|
1528
1532
|
};
|
|
@@ -1580,8 +1584,8 @@ const MRT_TableHeadCellSortLabel = ({ header, table }) => {
|
|
|
1580
1584
|
const MRT_TableHeadCell = ({ header, table }) => {
|
|
1581
1585
|
var _a, _b, _c, _d;
|
|
1582
1586
|
const theme = useTheme();
|
|
1583
|
-
const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnResizing, enableGrouping, enableMultiSort, muiTableHeadCellProps, },
|
|
1584
|
-
const { density,
|
|
1587
|
+
const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnResizing, enableGrouping, enableMultiSort, muiTableHeadCellProps, }, setHoveredColumn, } = table;
|
|
1588
|
+
const { density, draggingColumn, hoveredColumn, showColumnFilters } = getState();
|
|
1585
1589
|
const { column } = header;
|
|
1586
1590
|
const { columnDef } = column;
|
|
1587
1591
|
const { columnDefType } = columnDef;
|
|
@@ -1603,16 +1607,16 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1603
1607
|
return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 150);
|
|
1604
1608
|
};
|
|
1605
1609
|
const handleDragEnter = (_e) => {
|
|
1606
|
-
if (enableGrouping && (
|
|
1607
|
-
|
|
1610
|
+
if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
|
1611
|
+
setHoveredColumn(null);
|
|
1608
1612
|
}
|
|
1609
|
-
if (enableColumnOrdering &&
|
|
1610
|
-
|
|
1613
|
+
if (enableColumnOrdering && draggingColumn) {
|
|
1614
|
+
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
|
1611
1615
|
}
|
|
1612
1616
|
};
|
|
1613
|
-
const draggingBorder = (
|
|
1617
|
+
const draggingBorder = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
1614
1618
|
? `1px dashed ${theme.palette.text.secondary}`
|
|
1615
|
-
: (
|
|
1619
|
+
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
1616
1620
|
? `2px dashed ${theme.palette.primary.main}`
|
|
1617
1621
|
: undefined;
|
|
1618
1622
|
const draggingBorders = draggingBorder
|
|
@@ -1640,8 +1644,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1640
1644
|
? `-4px 0 4px -2px ${alpha(theme.palette.common.black, 0.1)}`
|
|
1641
1645
|
: undefined, fontWeight: 'bold', left: column.getIsPinned() === 'left'
|
|
1642
1646
|
? `${column.getStart('left')}px`
|
|
1643
|
-
: undefined, overflow: 'visible', opacity: (
|
|
1644
|
-
(currentHoveredColumn === null || currentHoveredColumn === void 0 ? void 0 : currentHoveredColumn.id) === column.id
|
|
1647
|
+
: undefined, overflow: 'visible', opacity: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id || (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
1645
1648
|
? 0.5
|
|
1646
1649
|
: 1, p: density === 'compact'
|
|
1647
1650
|
? '0.5rem'
|
|
@@ -1663,7 +1666,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1663
1666
|
? '0.25'
|
|
1664
1667
|
: density === 'comfortable'
|
|
1665
1668
|
? '.75rem'
|
|
1666
|
-
: '1.25rem', right: column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined, transition: `all ${enableColumnResizing ? 0 : '0.2s'} ease-in-out`, userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (
|
|
1669
|
+
: '1.25rem', right: column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined, transition: `all ${enableColumnResizing ? 0 : '0.2s'} ease-in-out`, userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
1667
1670
|
? 3
|
|
1668
1671
|
: column.getIsPinned() && columnDefType !== 'group'
|
|
1669
1672
|
? 2
|
|
@@ -2221,27 +2224,28 @@ function calculateRange(_ref4) {
|
|
|
2221
2224
|
|
|
2222
2225
|
const MRT_EditCellTextField = ({ cell, table }) => {
|
|
2223
2226
|
var _a;
|
|
2224
|
-
const { getState, options: { tableId,
|
|
2227
|
+
const { getState, options: { tableId, muiTableBodyCellEditTextFieldProps, onCellEditBlur, onCellEditChange, }, setEditingCell, setEditingRow, } = table;
|
|
2225
2228
|
const { column, row } = cell;
|
|
2226
2229
|
const { columnDef } = column;
|
|
2227
|
-
const
|
|
2230
|
+
const { editingRow } = getState();
|
|
2231
|
+
const [value, setValue] = useState(() => cell.getValue());
|
|
2228
2232
|
const handleChange = (event) => {
|
|
2229
2233
|
var _a;
|
|
2230
2234
|
setValue(event.target.value);
|
|
2231
|
-
(_a = columnDef.onCellEditChange) === null || _a === void 0 ? void 0 : _a.call(columnDef, { event, cell, table });
|
|
2232
|
-
onCellEditChange === null || onCellEditChange === void 0 ? void 0 : onCellEditChange({ event, cell, table });
|
|
2235
|
+
(_a = columnDef.onCellEditChange) === null || _a === void 0 ? void 0 : _a.call(columnDef, { event, cell, table, value });
|
|
2236
|
+
onCellEditChange === null || onCellEditChange === void 0 ? void 0 : onCellEditChange({ event, cell, table, value });
|
|
2233
2237
|
};
|
|
2234
2238
|
const handleBlur = (event) => {
|
|
2235
2239
|
var _a;
|
|
2236
|
-
if (
|
|
2240
|
+
if (editingRow) {
|
|
2237
2241
|
if (!row._valuesCache)
|
|
2238
2242
|
row._valuesCache = {};
|
|
2239
2243
|
row._valuesCache[column.id] = value;
|
|
2240
|
-
|
|
2244
|
+
setEditingRow(Object.assign({}, editingRow));
|
|
2241
2245
|
}
|
|
2242
|
-
|
|
2243
|
-
(_a = columnDef.onCellEditBlur) === null || _a === void 0 ? void 0 : _a.call(columnDef, { event, cell, table });
|
|
2244
|
-
onCellEditBlur === null || onCellEditBlur === void 0 ? void 0 : onCellEditBlur({ event, cell, table });
|
|
2246
|
+
setEditingCell(null);
|
|
2247
|
+
(_a = columnDef.onCellEditBlur) === null || _a === void 0 ? void 0 : _a.call(columnDef, { event, cell, table, value });
|
|
2248
|
+
onCellEditBlur === null || onCellEditBlur === void 0 ? void 0 : onCellEditBlur({ event, cell, table, value });
|
|
2245
2249
|
};
|
|
2246
2250
|
const mTableBodyCellEditTextFieldProps = muiTableBodyCellEditTextFieldProps instanceof Function
|
|
2247
2251
|
? muiTableBodyCellEditTextFieldProps({ cell, table })
|
|
@@ -2253,10 +2257,10 @@ const MRT_EditCellTextField = ({ cell, table }) => {
|
|
|
2253
2257
|
})
|
|
2254
2258
|
: columnDef.muiTableBodyCellEditTextFieldProps;
|
|
2255
2259
|
const textFieldProps = Object.assign(Object.assign({}, mTableBodyCellEditTextFieldProps), mcTableBodyCellEditTextFieldProps);
|
|
2256
|
-
if (
|
|
2260
|
+
if (columnDef.Edit) {
|
|
2257
2261
|
return React.createElement(React.Fragment, null, (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, table }));
|
|
2258
2262
|
}
|
|
2259
|
-
return (React.createElement(TextField, Object.assign({ id: `mrt-${tableId}-edit-cell-text-field-${cell.id}`, margin: "
|
|
2263
|
+
return (React.createElement(TextField, Object.assign({ id: `mrt-${tableId}-edit-cell-text-field-${cell.id}`, margin: "none", onBlur: handleBlur, onChange: handleChange, onClick: (e) => e.stopPropagation(), placeholder: columnDef.header, value: value, variant: "standard" }, textFieldProps)));
|
|
2260
2264
|
};
|
|
2261
2265
|
|
|
2262
2266
|
const MRT_CopyButton = ({ cell, children, table }) => {
|
|
@@ -2292,16 +2296,16 @@ const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
|
|
|
2292
2296
|
: muiTableBodyRowDragHandleProps;
|
|
2293
2297
|
const handleDragStart = (e) => {
|
|
2294
2298
|
e.dataTransfer.setDragImage(rowRef.current, 0, 0);
|
|
2295
|
-
table.
|
|
2299
|
+
table.setDraggingRow(cell.row);
|
|
2296
2300
|
};
|
|
2297
2301
|
const handleDragEnd = (event) => {
|
|
2298
2302
|
onRowDrop === null || onRowDrop === void 0 ? void 0 : onRowDrop({
|
|
2299
2303
|
event,
|
|
2300
|
-
draggedRow: table.getState().
|
|
2301
|
-
targetRow: table.getState().
|
|
2304
|
+
draggedRow: table.getState().draggingRow,
|
|
2305
|
+
targetRow: table.getState().hoveredRow,
|
|
2302
2306
|
});
|
|
2303
|
-
table.
|
|
2304
|
-
table.
|
|
2307
|
+
table.setDraggingRow(null);
|
|
2308
|
+
table.setHoveredRow(null);
|
|
2305
2309
|
};
|
|
2306
2310
|
return (React.createElement(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
|
|
2307
2311
|
};
|
|
@@ -2309,8 +2313,8 @@ const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
|
|
|
2309
2313
|
const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
2310
2314
|
var _a, _b, _c, _d, _f, _g, _h, _j;
|
|
2311
2315
|
const theme = useTheme();
|
|
2312
|
-
const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enablePagination, enableRowNumbers, muiTableBodyCellProps, muiTableBodyCellSkeletonProps, rowNumberMode, tableId, },
|
|
2313
|
-
const {
|
|
2316
|
+
const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enablePagination, enableRowNumbers, muiTableBodyCellProps, muiTableBodyCellSkeletonProps, rowNumberMode, tableId, }, setEditingCell, setHoveredColumn, } = table;
|
|
2317
|
+
const { draggingColumn, editingCell, editingRow, hoveredColumn, density, isLoading, showSkeletons, } = getState();
|
|
2314
2318
|
const { column, row } = cell;
|
|
2315
2319
|
const { columnDef } = column;
|
|
2316
2320
|
const { columnDefType } = columnDef;
|
|
@@ -2325,8 +2329,8 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2325
2329
|
columnDef.enableEditing !== false;
|
|
2326
2330
|
const isEditing = isEditable &&
|
|
2327
2331
|
(editingMode === 'table' ||
|
|
2328
|
-
(
|
|
2329
|
-
(
|
|
2332
|
+
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id ||
|
|
2333
|
+
(editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) === cell.id);
|
|
2330
2334
|
const [skeletonWidth, setSkeletonWidth] = useState(0);
|
|
2331
2335
|
useEffect(() => setSkeletonWidth(isLoading || showSkeletons
|
|
2332
2336
|
? columnDefType === 'display'
|
|
@@ -2338,7 +2342,7 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2338
2342
|
if ((enableEditing || columnDef.enableEditing) &&
|
|
2339
2343
|
columnDef.enableEditing !== false &&
|
|
2340
2344
|
editingMode === 'cell') {
|
|
2341
|
-
|
|
2345
|
+
setEditingCell(cell);
|
|
2342
2346
|
setTimeout(() => {
|
|
2343
2347
|
const textField = document.getElementById(`mrt-${tableId}-edit-cell-text-field-${cell.id}`);
|
|
2344
2348
|
if (textField) {
|
|
@@ -2359,16 +2363,16 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2359
2363
|
return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 150);
|
|
2360
2364
|
};
|
|
2361
2365
|
const handleDragEnter = (_e) => {
|
|
2362
|
-
if (enableGrouping && (
|
|
2363
|
-
|
|
2366
|
+
if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
|
2367
|
+
setHoveredColumn(null);
|
|
2364
2368
|
}
|
|
2365
|
-
if (enableColumnOrdering &&
|
|
2366
|
-
|
|
2369
|
+
if (enableColumnOrdering && draggingColumn) {
|
|
2370
|
+
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
|
2367
2371
|
}
|
|
2368
2372
|
};
|
|
2369
|
-
const draggingBorder = (
|
|
2373
|
+
const draggingBorder = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
2370
2374
|
? `1px dashed ${theme.palette.text.secondary}`
|
|
2371
|
-
: (
|
|
2375
|
+
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
2372
2376
|
? `2px dashed ${theme.palette.primary.main}`
|
|
2373
2377
|
: undefined;
|
|
2374
2378
|
const draggingBorders = draggingBorder
|
|
@@ -2394,8 +2398,7 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2394
2398
|
? `-4px 0 4px -2px ${alpha(theme.palette.common.black, 0.1)}`
|
|
2395
2399
|
: undefined, cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'text', left: column.getIsPinned() === 'left'
|
|
2396
2400
|
? `${column.getStart('left')}px`
|
|
2397
|
-
: undefined, opacity: (
|
|
2398
|
-
(currentHoveredColumn === null || currentHoveredColumn === void 0 ? void 0 : currentHoveredColumn.id) === column.id
|
|
2401
|
+
: undefined, opacity: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id || (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
2399
2402
|
? 0.5
|
|
2400
2403
|
: 1, overflow: 'hidden', p: density === 'compact'
|
|
2401
2404
|
? columnDefType === 'display'
|
|
@@ -2414,7 +2417,7 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2414
2417
|
: density === 'comfortable'
|
|
2415
2418
|
? 0.75
|
|
2416
2419
|
: 1.25)}rem`
|
|
2417
|
-
: undefined, position: column.getIsPinned() ? 'sticky' : 'relative', right: column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined, textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, transition: 'all 0.2s ease-in-out', whiteSpace: density === 'compact' ? 'nowrap' : 'normal', zIndex: (
|
|
2420
|
+
: undefined, position: column.getIsPinned() ? 'sticky' : 'relative', right: column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined, textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, transition: 'all 0.2s ease-in-out', whiteSpace: density === 'compact' ? 'nowrap' : 'normal', zIndex: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
2418
2421
|
? 2
|
|
2419
2422
|
: column.getIsPinned()
|
|
2420
2423
|
? 1
|
|
@@ -2460,20 +2463,20 @@ const MRT_TableDetailPanel = ({ row, table }) => {
|
|
|
2460
2463
|
const MRT_TableBodyRow = ({ row, rowIndex, table }) => {
|
|
2461
2464
|
var _a, _b;
|
|
2462
2465
|
const theme = useTheme();
|
|
2463
|
-
const { getIsSomeColumnsPinned, getState, options: { enableRowOrdering, muiTableBodyRowProps, renderDetailPanel },
|
|
2464
|
-
const {
|
|
2466
|
+
const { getIsSomeColumnsPinned, getState, options: { enableRowOrdering, muiTableBodyRowProps, renderDetailPanel }, setHoveredRow, } = table;
|
|
2467
|
+
const { draggingRow, hoveredRow } = getState();
|
|
2465
2468
|
const tableRowProps = muiTableBodyRowProps instanceof Function
|
|
2466
2469
|
? muiTableBodyRowProps({ row, table })
|
|
2467
2470
|
: muiTableBodyRowProps;
|
|
2468
2471
|
const handleDragEnter = (_e) => {
|
|
2469
|
-
if (enableRowOrdering &&
|
|
2470
|
-
|
|
2472
|
+
if (enableRowOrdering && draggingRow) {
|
|
2473
|
+
setHoveredRow(row);
|
|
2471
2474
|
}
|
|
2472
2475
|
};
|
|
2473
2476
|
const rowRef = useRef(null);
|
|
2474
|
-
const draggingBorder = (
|
|
2477
|
+
const draggingBorder = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id
|
|
2475
2478
|
? `1px dashed ${theme.palette.text.secondary}`
|
|
2476
|
-
: (
|
|
2479
|
+
: (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id
|
|
2477
2480
|
? `2px dashed ${theme.palette.primary.main}`
|
|
2478
2481
|
: undefined;
|
|
2479
2482
|
const draggingBorders = draggingBorder
|
|
@@ -2482,10 +2485,7 @@ const MRT_TableBodyRow = ({ row, rowIndex, table }) => {
|
|
|
2482
2485
|
}
|
|
2483
2486
|
: undefined;
|
|
2484
2487
|
return (React.createElement(React.Fragment, null,
|
|
2485
|
-
React.createElement(TableRow, Object.assign({ onDragEnter: handleDragEnter, hover: true, selected: row.getIsSelected(), ref: rowRef }, tableRowProps, { sx: (theme) => (Object.assign(Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), opacity: (
|
|
2486
|
-
(currentHoveredRow === null || currentHoveredRow === void 0 ? void 0 : currentHoveredRow.id) === row.id
|
|
2487
|
-
? 0.5
|
|
2488
|
-
: 1, transition: 'all 0.2s ease-in-out', '&:hover td': {
|
|
2488
|
+
React.createElement(TableRow, Object.assign({ onDragEnter: handleDragEnter, hover: true, selected: row.getIsSelected(), ref: rowRef }, tableRowProps, { sx: (theme) => (Object.assign(Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), opacity: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id ? 0.5 : 1, transition: 'all 0.2s ease-in-out', '&:hover td': {
|
|
2489
2489
|
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false && getIsSomeColumnsPinned()
|
|
2490
2490
|
? theme.palette.mode === 'dark'
|
|
2491
2491
|
? `${lighten(theme.palette.background.default, 0.12)}`
|
|
@@ -2692,7 +2692,7 @@ const MRT_TablePaper = ({ table }) => {
|
|
|
2692
2692
|
};
|
|
2693
2693
|
|
|
2694
2694
|
const MRT_TableRoot = (props) => {
|
|
2695
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
2695
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
|
|
2696
2696
|
const [tableId, setIdPrefix] = useState(props.tableId);
|
|
2697
2697
|
useEffect(() => { var _a; return setIdPrefix((_a = props.tableId) !== null && _a !== void 0 ? _a : Math.random().toString(36).substring(2, 9)); }, [props.tableId]);
|
|
2698
2698
|
const initialState = useMemo(() => {
|
|
@@ -2700,20 +2700,12 @@ const MRT_TableRoot = (props) => {
|
|
|
2700
2700
|
const initState = (_a = props.initialState) !== null && _a !== void 0 ? _a : {};
|
|
2701
2701
|
initState.columnOrder =
|
|
2702
2702
|
(_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(props);
|
|
2703
|
+
initState.globalFilterFn =
|
|
2704
|
+
props.globalFilterFn instanceof String
|
|
2705
|
+
? props.globalFilterFn
|
|
2706
|
+
: 'fuzzy';
|
|
2703
2707
|
return initState;
|
|
2704
2708
|
}, []);
|
|
2705
|
-
const [columnOrder, setColumnOrder] = useState((_a = initialState.columnOrder) !== null && _a !== void 0 ? _a : []);
|
|
2706
|
-
const [currentDraggingColumn, setCurrentDraggingColumn] = useState((_b = initialState.currentDraggingColumn) !== null && _b !== void 0 ? _b : null);
|
|
2707
|
-
const [currentDraggingRow, setCurrentDraggingRow] = useState((_c = initialState.currentDraggingRow) !== null && _c !== void 0 ? _c : null);
|
|
2708
|
-
const [currentEditingCell, setCurrentEditingCell] = useState((_d = initialState.currentEditingCell) !== null && _d !== void 0 ? _d : null);
|
|
2709
|
-
const [currentEditingRow, setCurrentEditingRow] = useState((_e = initialState.currentEditingRow) !== null && _e !== void 0 ? _e : null);
|
|
2710
|
-
const [currentHoveredColumn, setCurrentHoveredColumn] = useState((_f = initialState.currentHoveredColumn) !== null && _f !== void 0 ? _f : null);
|
|
2711
|
-
const [currentHoveredRow, setCurrentHoveredRow] = useState((_g = initialState.currentHoveredRow) !== null && _g !== void 0 ? _g : null);
|
|
2712
|
-
const [density, setDensity] = useState((_h = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _h !== void 0 ? _h : 'comfortable');
|
|
2713
|
-
const [isFullScreen, setIsFullScreen] = useState((_j = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _j !== void 0 ? _j : false);
|
|
2714
|
-
const [showAlertBanner, setShowAlertBanner] = useState((_l = (_k = props.initialState) === null || _k === void 0 ? void 0 : _k.showAlertBanner) !== null && _l !== void 0 ? _l : false);
|
|
2715
|
-
const [showColumnFilters, setShowFilters] = useState((_m = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _m !== void 0 ? _m : false);
|
|
2716
|
-
const [showGlobalFilter, setShowGlobalFilter] = useState((_o = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _o !== void 0 ? _o : false);
|
|
2717
2709
|
const [columnFilterFns, setColumnFilterFns] = useState(() => Object.assign({}, ...getAllLeafColumnDefs(props.columns).map((col) => {
|
|
2718
2710
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2719
2711
|
return ({
|
|
@@ -2722,9 +2714,19 @@ const MRT_TableRoot = (props) => {
|
|
|
2722
2714
|
: (_m = (_f = col.filterFn) !== null && _f !== void 0 ? _f : (_g = initialState === null || initialState === void 0 ? void 0 : initialState.columnFilterFns) === null || _g === void 0 ? void 0 : _g[(_l = (_j = (_h = col.id) === null || _h === void 0 ? void 0 : _h.toString()) !== null && _j !== void 0 ? _j : (_k = col.accessorKey) === null || _k === void 0 ? void 0 : _k.toString()) !== null && _l !== void 0 ? _l : '']) !== null && _m !== void 0 ? _m : getDefaultColumnFilterFn(col),
|
|
2723
2715
|
});
|
|
2724
2716
|
})));
|
|
2725
|
-
const [
|
|
2726
|
-
|
|
2727
|
-
|
|
2717
|
+
const [columnOrder, setColumnOrder] = useState((_a = initialState.columnOrder) !== null && _a !== void 0 ? _a : []);
|
|
2718
|
+
const [density, setDensity] = useState((_b = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _b !== void 0 ? _b : 'comfortable');
|
|
2719
|
+
const [draggingColumn, setDraggingColumn] = useState((_c = initialState.draggingColumn) !== null && _c !== void 0 ? _c : null);
|
|
2720
|
+
const [draggingRow, setDraggingRow] = useState((_d = initialState.draggingRow) !== null && _d !== void 0 ? _d : null);
|
|
2721
|
+
const [editingCell, setEditingCell] = useState((_e = initialState.editingCell) !== null && _e !== void 0 ? _e : null);
|
|
2722
|
+
const [editingRow, setEditingRow] = useState((_f = initialState.editingRow) !== null && _f !== void 0 ? _f : null);
|
|
2723
|
+
const [globalFilterFn, setGlobalFilterFn] = useState((_g = initialState.globalFilterFn) !== null && _g !== void 0 ? _g : 'fuzzy');
|
|
2724
|
+
const [hoveredColumn, setHoveredColumn] = useState((_h = initialState.hoveredColumn) !== null && _h !== void 0 ? _h : null);
|
|
2725
|
+
const [hoveredRow, setHoveredRow] = useState((_j = initialState.hoveredRow) !== null && _j !== void 0 ? _j : null);
|
|
2726
|
+
const [isFullScreen, setIsFullScreen] = useState((_k = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _k !== void 0 ? _k : false);
|
|
2727
|
+
const [showAlertBanner, setShowAlertBanner] = useState((_m = (_l = props.initialState) === null || _l === void 0 ? void 0 : _l.showAlertBanner) !== null && _m !== void 0 ? _m : false);
|
|
2728
|
+
const [showColumnFilters, setShowFilters] = useState((_o = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _o !== void 0 ? _o : false);
|
|
2729
|
+
const [showGlobalFilter, setShowGlobalFilter] = useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _p !== void 0 ? _p : false);
|
|
2728
2730
|
const displayColumns = useMemo(() => {
|
|
2729
2731
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2730
2732
|
return [
|
|
@@ -2751,8 +2753,6 @@ const MRT_TableRoot = (props) => {
|
|
|
2751
2753
|
props.enableRowSelection,
|
|
2752
2754
|
props.enableSelectAll,
|
|
2753
2755
|
props.localization,
|
|
2754
|
-
props.muiTableBodyCellProps,
|
|
2755
|
-
props.muiTableHeadCellProps,
|
|
2756
2756
|
props.positionActionsColumn,
|
|
2757
2757
|
]);
|
|
2758
2758
|
const columnDefs = useMemo(() => prepareColumns([...displayColumns, ...props.columns], columnFilterFns, props.filterFns, props.sortingFns), [columnFilterFns, displayColumns, props.columns]);
|
|
@@ -2771,26 +2771,24 @@ const MRT_TableRoot = (props) => {
|
|
|
2771
2771
|
});
|
|
2772
2772
|
})))
|
|
2773
2773
|
: props.data;
|
|
2774
|
-
}, [props.data, (
|
|
2774
|
+
}, [props.data, (_q = props.state) === null || _q === void 0 ? void 0 : _q.isLoading, (_r = props.state) === null || _r === void 0 ? void 0 : _r.showSkeletons]);
|
|
2775
2775
|
//@ts-ignore
|
|
2776
2776
|
const table = Object.assign(Object.assign({}, useReactTable(Object.assign(Object.assign({ getCoreRowModel: getCoreRowModel(), getExpandedRowModel: getExpandedRowModel(), getFacetedRowModel: getFacetedRowModel(), getFilteredRowModel: getFilteredRowModel(), getGroupedRowModel: getGroupedRowModel(), getPaginationRowModel: getPaginationRowModel(), getSortedRowModel: getSortedRowModel(), onColumnOrderChange: setColumnOrder, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows }, props), {
|
|
2777
2777
|
//@ts-ignore
|
|
2778
|
-
columns: columnDefs, data, globalFilterFn:
|
|
2779
|
-
|
|
2780
|
-
(_r = props.filterFns[globalFilterFn]) !== null && _r !== void 0 ? _r : props.filterFns.fuzzy, initialState, state: Object.assign({ columnOrder,
|
|
2781
|
-
currentDraggingColumn,
|
|
2782
|
-
currentDraggingRow,
|
|
2783
|
-
currentEditingCell,
|
|
2784
|
-
currentEditingRow,
|
|
2785
|
-
columnFilterFns,
|
|
2786
|
-
globalFilterFn,
|
|
2787
|
-
currentHoveredColumn,
|
|
2788
|
-
currentHoveredRow,
|
|
2778
|
+
columns: columnDefs, data, globalFilterFn: (_t = (_s = props.filterFns) === null || _s === void 0 ? void 0 : _s[globalFilterFn]) !== null && _t !== void 0 ? _t : (_u = props.filterFns) === null || _u === void 0 ? void 0 : _u.fuzzy, initialState, state: Object.assign({ columnFilterFns,
|
|
2779
|
+
columnOrder,
|
|
2789
2780
|
density,
|
|
2781
|
+
draggingColumn,
|
|
2782
|
+
draggingRow,
|
|
2783
|
+
editingCell,
|
|
2784
|
+
editingRow,
|
|
2785
|
+
globalFilterFn,
|
|
2786
|
+
hoveredColumn,
|
|
2787
|
+
hoveredRow,
|
|
2790
2788
|
isFullScreen,
|
|
2791
2789
|
showAlertBanner,
|
|
2792
2790
|
showColumnFilters,
|
|
2793
|
-
showGlobalFilter }, props.state), tableId }))), {
|
|
2791
|
+
showGlobalFilter }, props.state), tableId }))), { setColumnFilterFns: (_v = props.onFilterFnsChange) !== null && _v !== void 0 ? _v : setColumnFilterFns, setDensity: (_w = props.onDensityChange) !== null && _w !== void 0 ? _w : setDensity, setDraggingColumn: (_x = props.onDraggingColumnChange) !== null && _x !== void 0 ? _x : setDraggingColumn, setDraggingRow: (_y = props.onDraggingRowChange) !== null && _y !== void 0 ? _y : setDraggingRow, setEditingCell: (_z = props.onEditingCellChange) !== null && _z !== void 0 ? _z : setEditingCell, setEditingRow: (_0 = props.onEditingRowChange) !== null && _0 !== void 0 ? _0 : setEditingRow, setGlobalFilterFn: (_1 = props.onGlobalFilterFnChange) !== null && _1 !== void 0 ? _1 : setGlobalFilterFn, setHoveredColumn: (_2 = props.onHoveredColumnChange) !== null && _2 !== void 0 ? _2 : setHoveredColumn, setHoveredRow: (_3 = props.onHoveredRowChange) !== null && _3 !== void 0 ? _3 : setHoveredRow, setIsFullScreen: (_4 = props.onIsFullScreenChange) !== null && _4 !== void 0 ? _4 : setIsFullScreen, setShowAlertBanner: (_5 = props.onShowAlertBannerChange) !== null && _5 !== void 0 ? _5 : setShowAlertBanner, setShowFilters: (_6 = props.onShowFiltersChange) !== null && _6 !== void 0 ? _6 : setShowFilters, setShowGlobalFilter: (_7 = props.onShowGlobalFilterChange) !== null && _7 !== void 0 ? _7 : setShowGlobalFilter });
|
|
2794
2792
|
return (React.createElement(React.Fragment, null,
|
|
2795
2793
|
React.createElement(Dialog, { PaperComponent: Box, TransitionComponent: Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => setIsFullScreen(false), open: isFullScreen, transitionDuration: 400 },
|
|
2796
2794
|
React.createElement(MRT_TablePaper, { table: table })),
|