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
package/dist/cjs/index.js
CHANGED
|
@@ -567,7 +567,7 @@ const getDefaultColumnFilterFn = (columnDef) => {
|
|
|
567
567
|
return 'fuzzy';
|
|
568
568
|
};
|
|
569
569
|
|
|
570
|
-
const MRT_ShowHideColumnsMenuItems = ({ allColumns,
|
|
570
|
+
const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, isSubMenu, table, }) => {
|
|
571
571
|
var _a;
|
|
572
572
|
const { getState, options: { enableColumnOrdering, enableHiding, enablePinning, localization, }, setColumnOrder, } = table;
|
|
573
573
|
const { columnOrder } = getState();
|
|
@@ -595,14 +595,14 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, currentHoveredColumn, setCur
|
|
|
595
595
|
};
|
|
596
596
|
const handleDragEnd = (_e) => {
|
|
597
597
|
setIsDragging(false);
|
|
598
|
-
|
|
599
|
-
if (
|
|
600
|
-
setColumnOrder(reorderColumn(column,
|
|
598
|
+
setHoveredColumn(null);
|
|
599
|
+
if (hoveredColumn) {
|
|
600
|
+
setColumnOrder(reorderColumn(column, hoveredColumn, columnOrder));
|
|
601
601
|
}
|
|
602
602
|
};
|
|
603
603
|
const handleDragEnter = (_e) => {
|
|
604
604
|
if (!isDragging) {
|
|
605
|
-
|
|
605
|
+
setHoveredColumn(column);
|
|
606
606
|
}
|
|
607
607
|
};
|
|
608
608
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
@@ -613,7 +613,7 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, currentHoveredColumn, setCur
|
|
|
613
613
|
opacity: isDragging ? 0.5 : 1,
|
|
614
614
|
outline: isDragging
|
|
615
615
|
? `1px dashed ${theme.palette.divider}`
|
|
616
|
-
: (
|
|
616
|
+
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
617
617
|
? `2px dashed ${theme.palette.primary.main}`
|
|
618
618
|
: 'none',
|
|
619
619
|
pl: `${(column.depth + 0.5) * 2}rem`,
|
|
@@ -643,7 +643,7 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, currentHoveredColumn, setCur
|
|
|
643
643
|
React__default["default"].createElement(material.Switch, null)), disabled: (isSubMenu && switchChecked) ||
|
|
644
644
|
!column.getCanHide() ||
|
|
645
645
|
column.getIsGrouped(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (React__default["default"].createElement(material.Typography, { sx: { alignSelf: 'center' } }, columnDef.header)))), (_a = column.columns) === null || _a === void 0 ? void 0 :
|
|
646
|
-
_a.map((c, i) => (React__default["default"].createElement(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c,
|
|
646
|
+
_a.map((c, i) => (React__default["default"].createElement(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, isSubMenu: isSubMenu, key: `${i}-${c.id}`, setHoveredColumn: setHoveredColumn, table: table })))));
|
|
647
647
|
};
|
|
648
648
|
|
|
649
649
|
const MRT_ShowHideColumnsMenu = ({ anchorEl, isSubMenu, setAnchorEl, table, }) => {
|
|
@@ -673,7 +673,7 @@ const MRT_ShowHideColumnsMenu = ({ anchorEl, isSubMenu, setAnchorEl, table, }) =
|
|
|
673
673
|
getLeftLeafColumns(),
|
|
674
674
|
getRightLeafColumns(),
|
|
675
675
|
]);
|
|
676
|
-
const [
|
|
676
|
+
const [hoveredColumn, setHoveredColumn] = React.useState(null);
|
|
677
677
|
return (React__default["default"].createElement(material.Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => setAnchorEl(null), MenuListProps: {
|
|
678
678
|
dense: density === 'compact',
|
|
679
679
|
} },
|
|
@@ -688,7 +688,7 @@ const MRT_ShowHideColumnsMenu = ({ anchorEl, isSubMenu, setAnchorEl, table, }) =
|
|
|
688
688
|
!isSubMenu && enablePinning && (React__default["default"].createElement(material.Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true) }, localization.unpinAll)),
|
|
689
689
|
React__default["default"].createElement(material.Button, { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true) }, localization.showAll)),
|
|
690
690
|
React__default["default"].createElement(material.Divider, null),
|
|
691
|
-
allColumns.map((column, index) => (React__default["default"].createElement(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column,
|
|
691
|
+
allColumns.map((column, index) => (React__default["default"].createElement(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, isSubMenu: isSubMenu, key: `${index}-${column.id}`, setHoveredColumn: setHoveredColumn, table: table })))));
|
|
692
692
|
};
|
|
693
693
|
|
|
694
694
|
const commonMenuItemStyles = {
|
|
@@ -881,16 +881,20 @@ const MRT_RowActionMenu = ({ anchorEl, handleEdit, row, setAnchorEl, table, }) =
|
|
|
881
881
|
};
|
|
882
882
|
|
|
883
883
|
const MRT_EditActionButtons = ({ row, table }) => {
|
|
884
|
-
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onEditRowSubmit, },
|
|
885
|
-
const {
|
|
884
|
+
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onEditRowSubmit, }, setEditingRow, } = table;
|
|
885
|
+
const { editingRow } = getState();
|
|
886
886
|
const handleCancel = () => {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
setCurrentEditingRow(null);
|
|
887
|
+
row._valuesCache = Object.assign({}, row.original);
|
|
888
|
+
setEditingRow(null);
|
|
890
889
|
};
|
|
891
890
|
const handleSave = () => {
|
|
892
|
-
|
|
893
|
-
|
|
891
|
+
var _a;
|
|
892
|
+
onEditRowSubmit === null || onEditRowSubmit === void 0 ? void 0 : onEditRowSubmit({
|
|
893
|
+
row: editingRow !== null && editingRow !== void 0 ? editingRow : row,
|
|
894
|
+
table,
|
|
895
|
+
values: (_a = editingRow === null || editingRow === void 0 ? void 0 : editingRow._valuesCache) !== null && _a !== void 0 ? _a : Object.assign({}, row.original),
|
|
896
|
+
});
|
|
897
|
+
setEditingRow(null);
|
|
894
898
|
};
|
|
895
899
|
return (React__default["default"].createElement(material.Box, { sx: { display: 'flex', gap: '0.75rem' } },
|
|
896
900
|
React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.cancel },
|
|
@@ -912,8 +916,8 @@ const commonIconButtonStyles = {
|
|
|
912
916
|
},
|
|
913
917
|
};
|
|
914
918
|
const MRT_ToggleRowActionMenuButton = ({ row, table }) => {
|
|
915
|
-
const { getState, options: { enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, },
|
|
916
|
-
const {
|
|
919
|
+
const { getState, options: { enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
|
|
920
|
+
const { editingRow } = getState();
|
|
917
921
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
918
922
|
const handleOpenRowActionMenu = (event) => {
|
|
919
923
|
event.stopPropagation();
|
|
@@ -921,10 +925,10 @@ const MRT_ToggleRowActionMenuButton = ({ row, table }) => {
|
|
|
921
925
|
setAnchorEl(event.currentTarget);
|
|
922
926
|
};
|
|
923
927
|
const handleStartEditMode = () => {
|
|
924
|
-
|
|
928
|
+
setEditingRow(Object.assign({}, row));
|
|
925
929
|
setAnchorEl(null);
|
|
926
930
|
};
|
|
927
|
-
return (React__default["default"].createElement(React__default["default"].Fragment, null, renderRowActions ? (React__default["default"].createElement(React__default["default"].Fragment, null, renderRowActions({ row, table }))) : row.id === (
|
|
931
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null, renderRowActions ? (React__default["default"].createElement(React__default["default"].Fragment, null, renderRowActions({ row, table }))) : row.id === (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) ? (React__default["default"].createElement(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems && enableEditing ? (React__default["default"].createElement(material.Tooltip, { placement: "right", arrow: true, title: localization.edit },
|
|
928
932
|
React__default["default"].createElement(material.IconButton, { sx: commonIconButtonStyles, onClick: handleStartEditMode },
|
|
929
933
|
React__default["default"].createElement(EditIcon, null)))) : renderRowActionMenuItems ? (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
930
934
|
React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions },
|
|
@@ -1154,15 +1158,15 @@ const MRT_ToolbarInternalButtons = ({ table }) => {
|
|
|
1154
1158
|
|
|
1155
1159
|
const MRT_ToolbarDropZone = ({ table }) => {
|
|
1156
1160
|
var _a, _b;
|
|
1157
|
-
const { getState, options: { enableGrouping, localization },
|
|
1158
|
-
const {
|
|
1161
|
+
const { getState, options: { enableGrouping, localization }, setHoveredColumn, } = table;
|
|
1162
|
+
const { draggingColumn, hoveredColumn } = getState();
|
|
1159
1163
|
const handleDragEnter = (_event) => {
|
|
1160
|
-
|
|
1164
|
+
setHoveredColumn({ id: 'drop-zone' });
|
|
1161
1165
|
};
|
|
1162
|
-
return (React__default["default"].createElement(material.Fade, { unmountOnExit: true, mountOnEnter: true, in: !!enableGrouping && !!
|
|
1166
|
+
return (React__default["default"].createElement(material.Fade, { unmountOnExit: true, mountOnEnter: true, in: !!enableGrouping && !!draggingColumn },
|
|
1163
1167
|
React__default["default"].createElement(material.Box, { sx: (theme) => ({
|
|
1164
1168
|
alignItems: 'center',
|
|
1165
|
-
backgroundColor: material.alpha(theme.palette.info.main, (
|
|
1169
|
+
backgroundColor: material.alpha(theme.palette.info.main, (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone' ? 0.2 : 0.1),
|
|
1166
1170
|
border: `dashed ${theme.palette.info.main} 2px`,
|
|
1167
1171
|
display: 'flex',
|
|
1168
1172
|
justifyContent: 'center',
|
|
@@ -1171,7 +1175,7 @@ const MRT_ToolbarDropZone = ({ table }) => {
|
|
|
1171
1175
|
width: 'calc(100% - 4px)',
|
|
1172
1176
|
zIndex: 2,
|
|
1173
1177
|
}), onDragEnter: handleDragEnter },
|
|
1174
|
-
React__default["default"].createElement(material.Typography, null, localization.dropToGroupBy.replace('{column}', (_b = (_a =
|
|
1178
|
+
React__default["default"].createElement(material.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 : '')))));
|
|
1175
1179
|
};
|
|
1176
1180
|
|
|
1177
1181
|
const commonToolbarStyles = ({ theme }) => ({
|
|
@@ -1501,9 +1505,9 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
|
1501
1505
|
};
|
|
1502
1506
|
|
|
1503
1507
|
const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
|
1504
|
-
const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps, onColumnDrop, }, setColumnOrder,
|
|
1508
|
+
const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps, onColumnDrop, }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
|
|
1505
1509
|
const { columnDef } = column;
|
|
1506
|
-
const {
|
|
1510
|
+
const { hoveredColumn, draggingColumn, columnOrder } = getState();
|
|
1507
1511
|
const mIconButtonProps = muiTableHeadCellDragHandleProps instanceof Function
|
|
1508
1512
|
? muiTableHeadCellDragHandleProps({ column, table })
|
|
1509
1513
|
: muiTableHeadCellDragHandleProps;
|
|
@@ -1512,25 +1516,25 @@ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
|
|
1512
1516
|
: columnDef.muiTableHeadCellDragHandleProps;
|
|
1513
1517
|
const iconButtonProps = Object.assign(Object.assign({}, mIconButtonProps), mcIconButtonProps);
|
|
1514
1518
|
const handleDragStart = (e) => {
|
|
1515
|
-
|
|
1519
|
+
setDraggingColumn(column);
|
|
1516
1520
|
e.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
|
|
1517
1521
|
};
|
|
1518
1522
|
const handleDragEnd = (event) => {
|
|
1519
1523
|
onColumnDrop === null || onColumnDrop === void 0 ? void 0 : onColumnDrop({
|
|
1520
1524
|
event,
|
|
1521
1525
|
draggedColumn: column,
|
|
1522
|
-
targetColumn:
|
|
1526
|
+
targetColumn: hoveredColumn,
|
|
1523
1527
|
});
|
|
1524
|
-
if ((
|
|
1528
|
+
if ((hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
|
1525
1529
|
column.toggleGrouping();
|
|
1526
1530
|
}
|
|
1527
1531
|
else if (enableColumnOrdering &&
|
|
1528
|
-
|
|
1529
|
-
(
|
|
1530
|
-
setColumnOrder(reorderColumn(column,
|
|
1532
|
+
hoveredColumn &&
|
|
1533
|
+
(hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) !== (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)) {
|
|
1534
|
+
setColumnOrder(reorderColumn(column, hoveredColumn, columnOrder));
|
|
1531
1535
|
}
|
|
1532
|
-
|
|
1533
|
-
|
|
1536
|
+
setDraggingColumn(null);
|
|
1537
|
+
setHoveredColumn(null);
|
|
1534
1538
|
};
|
|
1535
1539
|
return (React__default["default"].createElement(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
|
|
1536
1540
|
};
|
|
@@ -1588,8 +1592,8 @@ const MRT_TableHeadCellSortLabel = ({ header, table }) => {
|
|
|
1588
1592
|
const MRT_TableHeadCell = ({ header, table }) => {
|
|
1589
1593
|
var _a, _b, _c, _d;
|
|
1590
1594
|
const theme = material.useTheme();
|
|
1591
|
-
const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnResizing, enableGrouping, enableMultiSort, muiTableHeadCellProps, },
|
|
1592
|
-
const { density,
|
|
1595
|
+
const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnResizing, enableGrouping, enableMultiSort, muiTableHeadCellProps, }, setHoveredColumn, } = table;
|
|
1596
|
+
const { density, draggingColumn, hoveredColumn, showColumnFilters } = getState();
|
|
1593
1597
|
const { column } = header;
|
|
1594
1598
|
const { columnDef } = column;
|
|
1595
1599
|
const { columnDefType } = columnDef;
|
|
@@ -1611,16 +1615,16 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1611
1615
|
return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 150);
|
|
1612
1616
|
};
|
|
1613
1617
|
const handleDragEnter = (_e) => {
|
|
1614
|
-
if (enableGrouping && (
|
|
1615
|
-
|
|
1618
|
+
if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
|
1619
|
+
setHoveredColumn(null);
|
|
1616
1620
|
}
|
|
1617
|
-
if (enableColumnOrdering &&
|
|
1618
|
-
|
|
1621
|
+
if (enableColumnOrdering && draggingColumn) {
|
|
1622
|
+
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
|
1619
1623
|
}
|
|
1620
1624
|
};
|
|
1621
|
-
const draggingBorder = (
|
|
1625
|
+
const draggingBorder = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
1622
1626
|
? `1px dashed ${theme.palette.text.secondary}`
|
|
1623
|
-
: (
|
|
1627
|
+
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
1624
1628
|
? `2px dashed ${theme.palette.primary.main}`
|
|
1625
1629
|
: undefined;
|
|
1626
1630
|
const draggingBorders = draggingBorder
|
|
@@ -1648,8 +1652,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1648
1652
|
? `-4px 0 4px -2px ${material.alpha(theme.palette.common.black, 0.1)}`
|
|
1649
1653
|
: undefined, fontWeight: 'bold', left: column.getIsPinned() === 'left'
|
|
1650
1654
|
? `${column.getStart('left')}px`
|
|
1651
|
-
: undefined, overflow: 'visible', opacity: (
|
|
1652
|
-
(currentHoveredColumn === null || currentHoveredColumn === void 0 ? void 0 : currentHoveredColumn.id) === column.id
|
|
1655
|
+
: 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
|
|
1653
1656
|
? 0.5
|
|
1654
1657
|
: 1, p: density === 'compact'
|
|
1655
1658
|
? '0.5rem'
|
|
@@ -1671,7 +1674,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1671
1674
|
? '0.25'
|
|
1672
1675
|
: density === 'comfortable'
|
|
1673
1676
|
? '.75rem'
|
|
1674
|
-
: '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() || (
|
|
1677
|
+
: '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
|
|
1675
1678
|
? 3
|
|
1676
1679
|
: column.getIsPinned() && columnDefType !== 'group'
|
|
1677
1680
|
? 2
|
|
@@ -2229,27 +2232,28 @@ function calculateRange(_ref4) {
|
|
|
2229
2232
|
|
|
2230
2233
|
const MRT_EditCellTextField = ({ cell, table }) => {
|
|
2231
2234
|
var _a;
|
|
2232
|
-
const { getState, options: { tableId,
|
|
2235
|
+
const { getState, options: { tableId, muiTableBodyCellEditTextFieldProps, onCellEditBlur, onCellEditChange, }, setEditingCell, setEditingRow, } = table;
|
|
2233
2236
|
const { column, row } = cell;
|
|
2234
2237
|
const { columnDef } = column;
|
|
2235
|
-
const
|
|
2238
|
+
const { editingRow } = getState();
|
|
2239
|
+
const [value, setValue] = React.useState(() => cell.getValue());
|
|
2236
2240
|
const handleChange = (event) => {
|
|
2237
2241
|
var _a;
|
|
2238
2242
|
setValue(event.target.value);
|
|
2239
|
-
(_a = columnDef.onCellEditChange) === null || _a === void 0 ? void 0 : _a.call(columnDef, { event, cell, table });
|
|
2240
|
-
onCellEditChange === null || onCellEditChange === void 0 ? void 0 : onCellEditChange({ event, cell, table });
|
|
2243
|
+
(_a = columnDef.onCellEditChange) === null || _a === void 0 ? void 0 : _a.call(columnDef, { event, cell, table, value });
|
|
2244
|
+
onCellEditChange === null || onCellEditChange === void 0 ? void 0 : onCellEditChange({ event, cell, table, value });
|
|
2241
2245
|
};
|
|
2242
2246
|
const handleBlur = (event) => {
|
|
2243
2247
|
var _a;
|
|
2244
|
-
if (
|
|
2248
|
+
if (editingRow) {
|
|
2245
2249
|
if (!row._valuesCache)
|
|
2246
2250
|
row._valuesCache = {};
|
|
2247
2251
|
row._valuesCache[column.id] = value;
|
|
2248
|
-
|
|
2252
|
+
setEditingRow(Object.assign({}, editingRow));
|
|
2249
2253
|
}
|
|
2250
|
-
|
|
2251
|
-
(_a = columnDef.onCellEditBlur) === null || _a === void 0 ? void 0 : _a.call(columnDef, { event, cell, table });
|
|
2252
|
-
onCellEditBlur === null || onCellEditBlur === void 0 ? void 0 : onCellEditBlur({ event, cell, table });
|
|
2254
|
+
setEditingCell(null);
|
|
2255
|
+
(_a = columnDef.onCellEditBlur) === null || _a === void 0 ? void 0 : _a.call(columnDef, { event, cell, table, value });
|
|
2256
|
+
onCellEditBlur === null || onCellEditBlur === void 0 ? void 0 : onCellEditBlur({ event, cell, table, value });
|
|
2253
2257
|
};
|
|
2254
2258
|
const mTableBodyCellEditTextFieldProps = muiTableBodyCellEditTextFieldProps instanceof Function
|
|
2255
2259
|
? muiTableBodyCellEditTextFieldProps({ cell, table })
|
|
@@ -2261,10 +2265,10 @@ const MRT_EditCellTextField = ({ cell, table }) => {
|
|
|
2261
2265
|
})
|
|
2262
2266
|
: columnDef.muiTableBodyCellEditTextFieldProps;
|
|
2263
2267
|
const textFieldProps = Object.assign(Object.assign({}, mTableBodyCellEditTextFieldProps), mcTableBodyCellEditTextFieldProps);
|
|
2264
|
-
if (
|
|
2268
|
+
if (columnDef.Edit) {
|
|
2265
2269
|
return React__default["default"].createElement(React__default["default"].Fragment, null, (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, table }));
|
|
2266
2270
|
}
|
|
2267
|
-
return (React__default["default"].createElement(material.TextField, Object.assign({ id: `mrt-${tableId}-edit-cell-text-field-${cell.id}`, margin: "
|
|
2271
|
+
return (React__default["default"].createElement(material.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)));
|
|
2268
2272
|
};
|
|
2269
2273
|
|
|
2270
2274
|
const MRT_CopyButton = ({ cell, children, table }) => {
|
|
@@ -2300,16 +2304,16 @@ const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
|
|
|
2300
2304
|
: muiTableBodyRowDragHandleProps;
|
|
2301
2305
|
const handleDragStart = (e) => {
|
|
2302
2306
|
e.dataTransfer.setDragImage(rowRef.current, 0, 0);
|
|
2303
|
-
table.
|
|
2307
|
+
table.setDraggingRow(cell.row);
|
|
2304
2308
|
};
|
|
2305
2309
|
const handleDragEnd = (event) => {
|
|
2306
2310
|
onRowDrop === null || onRowDrop === void 0 ? void 0 : onRowDrop({
|
|
2307
2311
|
event,
|
|
2308
|
-
draggedRow: table.getState().
|
|
2309
|
-
targetRow: table.getState().
|
|
2312
|
+
draggedRow: table.getState().draggingRow,
|
|
2313
|
+
targetRow: table.getState().hoveredRow,
|
|
2310
2314
|
});
|
|
2311
|
-
table.
|
|
2312
|
-
table.
|
|
2315
|
+
table.setDraggingRow(null);
|
|
2316
|
+
table.setHoveredRow(null);
|
|
2313
2317
|
};
|
|
2314
2318
|
return (React__default["default"].createElement(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
|
|
2315
2319
|
};
|
|
@@ -2317,8 +2321,8 @@ const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
|
|
|
2317
2321
|
const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
2318
2322
|
var _a, _b, _c, _d, _f, _g, _h, _j;
|
|
2319
2323
|
const theme = material.useTheme();
|
|
2320
|
-
const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enablePagination, enableRowNumbers, muiTableBodyCellProps, muiTableBodyCellSkeletonProps, rowNumberMode, tableId, },
|
|
2321
|
-
const {
|
|
2324
|
+
const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enablePagination, enableRowNumbers, muiTableBodyCellProps, muiTableBodyCellSkeletonProps, rowNumberMode, tableId, }, setEditingCell, setHoveredColumn, } = table;
|
|
2325
|
+
const { draggingColumn, editingCell, editingRow, hoveredColumn, density, isLoading, showSkeletons, } = getState();
|
|
2322
2326
|
const { column, row } = cell;
|
|
2323
2327
|
const { columnDef } = column;
|
|
2324
2328
|
const { columnDefType } = columnDef;
|
|
@@ -2333,8 +2337,8 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2333
2337
|
columnDef.enableEditing !== false;
|
|
2334
2338
|
const isEditing = isEditable &&
|
|
2335
2339
|
(editingMode === 'table' ||
|
|
2336
|
-
(
|
|
2337
|
-
(
|
|
2340
|
+
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id ||
|
|
2341
|
+
(editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) === cell.id);
|
|
2338
2342
|
const [skeletonWidth, setSkeletonWidth] = React.useState(0);
|
|
2339
2343
|
React.useEffect(() => setSkeletonWidth(isLoading || showSkeletons
|
|
2340
2344
|
? columnDefType === 'display'
|
|
@@ -2346,7 +2350,7 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2346
2350
|
if ((enableEditing || columnDef.enableEditing) &&
|
|
2347
2351
|
columnDef.enableEditing !== false &&
|
|
2348
2352
|
editingMode === 'cell') {
|
|
2349
|
-
|
|
2353
|
+
setEditingCell(cell);
|
|
2350
2354
|
setTimeout(() => {
|
|
2351
2355
|
const textField = document.getElementById(`mrt-${tableId}-edit-cell-text-field-${cell.id}`);
|
|
2352
2356
|
if (textField) {
|
|
@@ -2367,16 +2371,16 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2367
2371
|
return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 150);
|
|
2368
2372
|
};
|
|
2369
2373
|
const handleDragEnter = (_e) => {
|
|
2370
|
-
if (enableGrouping && (
|
|
2371
|
-
|
|
2374
|
+
if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
|
2375
|
+
setHoveredColumn(null);
|
|
2372
2376
|
}
|
|
2373
|
-
if (enableColumnOrdering &&
|
|
2374
|
-
|
|
2377
|
+
if (enableColumnOrdering && draggingColumn) {
|
|
2378
|
+
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
|
2375
2379
|
}
|
|
2376
2380
|
};
|
|
2377
|
-
const draggingBorder = (
|
|
2381
|
+
const draggingBorder = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
2378
2382
|
? `1px dashed ${theme.palette.text.secondary}`
|
|
2379
|
-
: (
|
|
2383
|
+
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
2380
2384
|
? `2px dashed ${theme.palette.primary.main}`
|
|
2381
2385
|
: undefined;
|
|
2382
2386
|
const draggingBorders = draggingBorder
|
|
@@ -2402,8 +2406,7 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2402
2406
|
? `-4px 0 4px -2px ${material.alpha(theme.palette.common.black, 0.1)}`
|
|
2403
2407
|
: undefined, cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'text', left: column.getIsPinned() === 'left'
|
|
2404
2408
|
? `${column.getStart('left')}px`
|
|
2405
|
-
: undefined, opacity: (
|
|
2406
|
-
(currentHoveredColumn === null || currentHoveredColumn === void 0 ? void 0 : currentHoveredColumn.id) === column.id
|
|
2409
|
+
: undefined, opacity: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id || (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
2407
2410
|
? 0.5
|
|
2408
2411
|
: 1, overflow: 'hidden', p: density === 'compact'
|
|
2409
2412
|
? columnDefType === 'display'
|
|
@@ -2422,7 +2425,7 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2422
2425
|
: density === 'comfortable'
|
|
2423
2426
|
? 0.75
|
|
2424
2427
|
: 1.25)}rem`
|
|
2425
|
-
: 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: (
|
|
2428
|
+
: 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
|
|
2426
2429
|
? 2
|
|
2427
2430
|
: column.getIsPinned()
|
|
2428
2431
|
? 1
|
|
@@ -2468,20 +2471,20 @@ const MRT_TableDetailPanel = ({ row, table }) => {
|
|
|
2468
2471
|
const MRT_TableBodyRow = ({ row, rowIndex, table }) => {
|
|
2469
2472
|
var _a, _b;
|
|
2470
2473
|
const theme = material.useTheme();
|
|
2471
|
-
const { getIsSomeColumnsPinned, getState, options: { enableRowOrdering, muiTableBodyRowProps, renderDetailPanel },
|
|
2472
|
-
const {
|
|
2474
|
+
const { getIsSomeColumnsPinned, getState, options: { enableRowOrdering, muiTableBodyRowProps, renderDetailPanel }, setHoveredRow, } = table;
|
|
2475
|
+
const { draggingRow, hoveredRow } = getState();
|
|
2473
2476
|
const tableRowProps = muiTableBodyRowProps instanceof Function
|
|
2474
2477
|
? muiTableBodyRowProps({ row, table })
|
|
2475
2478
|
: muiTableBodyRowProps;
|
|
2476
2479
|
const handleDragEnter = (_e) => {
|
|
2477
|
-
if (enableRowOrdering &&
|
|
2478
|
-
|
|
2480
|
+
if (enableRowOrdering && draggingRow) {
|
|
2481
|
+
setHoveredRow(row);
|
|
2479
2482
|
}
|
|
2480
2483
|
};
|
|
2481
2484
|
const rowRef = React.useRef(null);
|
|
2482
|
-
const draggingBorder = (
|
|
2485
|
+
const draggingBorder = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id
|
|
2483
2486
|
? `1px dashed ${theme.palette.text.secondary}`
|
|
2484
|
-
: (
|
|
2487
|
+
: (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id
|
|
2485
2488
|
? `2px dashed ${theme.palette.primary.main}`
|
|
2486
2489
|
: undefined;
|
|
2487
2490
|
const draggingBorders = draggingBorder
|
|
@@ -2490,10 +2493,7 @@ const MRT_TableBodyRow = ({ row, rowIndex, table }) => {
|
|
|
2490
2493
|
}
|
|
2491
2494
|
: undefined;
|
|
2492
2495
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2493
|
-
React__default["default"].createElement(material.TableRow, Object.assign({ onDragEnter: handleDragEnter, hover: true, selected: row.getIsSelected(), ref: rowRef }, tableRowProps, { sx: (theme) => (Object.assign(Object.assign({ backgroundColor: material.lighten(theme.palette.background.default, 0.06), opacity: (
|
|
2494
|
-
(currentHoveredRow === null || currentHoveredRow === void 0 ? void 0 : currentHoveredRow.id) === row.id
|
|
2495
|
-
? 0.5
|
|
2496
|
-
: 1, transition: 'all 0.2s ease-in-out', '&:hover td': {
|
|
2496
|
+
React__default["default"].createElement(material.TableRow, Object.assign({ onDragEnter: handleDragEnter, hover: true, selected: row.getIsSelected(), ref: rowRef }, tableRowProps, { sx: (theme) => (Object.assign(Object.assign({ backgroundColor: material.lighten(theme.palette.background.default, 0.06), opacity: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id ? 0.5 : 1, transition: 'all 0.2s ease-in-out', '&:hover td': {
|
|
2497
2497
|
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false && getIsSomeColumnsPinned()
|
|
2498
2498
|
? theme.palette.mode === 'dark'
|
|
2499
2499
|
? `${material.lighten(theme.palette.background.default, 0.12)}`
|
|
@@ -2700,7 +2700,7 @@ const MRT_TablePaper = ({ table }) => {
|
|
|
2700
2700
|
};
|
|
2701
2701
|
|
|
2702
2702
|
const MRT_TableRoot = (props) => {
|
|
2703
|
-
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;
|
|
2703
|
+
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;
|
|
2704
2704
|
const [tableId, setIdPrefix] = React.useState(props.tableId);
|
|
2705
2705
|
React.useEffect(() => { var _a; return setIdPrefix((_a = props.tableId) !== null && _a !== void 0 ? _a : Math.random().toString(36).substring(2, 9)); }, [props.tableId]);
|
|
2706
2706
|
const initialState = React.useMemo(() => {
|
|
@@ -2708,20 +2708,12 @@ const MRT_TableRoot = (props) => {
|
|
|
2708
2708
|
const initState = (_a = props.initialState) !== null && _a !== void 0 ? _a : {};
|
|
2709
2709
|
initState.columnOrder =
|
|
2710
2710
|
(_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(props);
|
|
2711
|
+
initState.globalFilterFn =
|
|
2712
|
+
props.globalFilterFn instanceof String
|
|
2713
|
+
? props.globalFilterFn
|
|
2714
|
+
: 'fuzzy';
|
|
2711
2715
|
return initState;
|
|
2712
2716
|
}, []);
|
|
2713
|
-
const [columnOrder, setColumnOrder] = React.useState((_a = initialState.columnOrder) !== null && _a !== void 0 ? _a : []);
|
|
2714
|
-
const [currentDraggingColumn, setCurrentDraggingColumn] = React.useState((_b = initialState.currentDraggingColumn) !== null && _b !== void 0 ? _b : null);
|
|
2715
|
-
const [currentDraggingRow, setCurrentDraggingRow] = React.useState((_c = initialState.currentDraggingRow) !== null && _c !== void 0 ? _c : null);
|
|
2716
|
-
const [currentEditingCell, setCurrentEditingCell] = React.useState((_d = initialState.currentEditingCell) !== null && _d !== void 0 ? _d : null);
|
|
2717
|
-
const [currentEditingRow, setCurrentEditingRow] = React.useState((_e = initialState.currentEditingRow) !== null && _e !== void 0 ? _e : null);
|
|
2718
|
-
const [currentHoveredColumn, setCurrentHoveredColumn] = React.useState((_f = initialState.currentHoveredColumn) !== null && _f !== void 0 ? _f : null);
|
|
2719
|
-
const [currentHoveredRow, setCurrentHoveredRow] = React.useState((_g = initialState.currentHoveredRow) !== null && _g !== void 0 ? _g : null);
|
|
2720
|
-
const [density, setDensity] = React.useState((_h = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _h !== void 0 ? _h : 'comfortable');
|
|
2721
|
-
const [isFullScreen, setIsFullScreen] = React.useState((_j = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _j !== void 0 ? _j : false);
|
|
2722
|
-
const [showAlertBanner, setShowAlertBanner] = React.useState((_l = (_k = props.initialState) === null || _k === void 0 ? void 0 : _k.showAlertBanner) !== null && _l !== void 0 ? _l : false);
|
|
2723
|
-
const [showColumnFilters, setShowFilters] = React.useState((_m = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _m !== void 0 ? _m : false);
|
|
2724
|
-
const [showGlobalFilter, setShowGlobalFilter] = React.useState((_o = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _o !== void 0 ? _o : false);
|
|
2725
2717
|
const [columnFilterFns, setColumnFilterFns] = React.useState(() => Object.assign({}, ...getAllLeafColumnDefs(props.columns).map((col) => {
|
|
2726
2718
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2727
2719
|
return ({
|
|
@@ -2730,9 +2722,19 @@ const MRT_TableRoot = (props) => {
|
|
|
2730
2722
|
: (_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),
|
|
2731
2723
|
});
|
|
2732
2724
|
})));
|
|
2733
|
-
const [
|
|
2734
|
-
|
|
2735
|
-
|
|
2725
|
+
const [columnOrder, setColumnOrder] = React.useState((_a = initialState.columnOrder) !== null && _a !== void 0 ? _a : []);
|
|
2726
|
+
const [density, setDensity] = React.useState((_b = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _b !== void 0 ? _b : 'comfortable');
|
|
2727
|
+
const [draggingColumn, setDraggingColumn] = React.useState((_c = initialState.draggingColumn) !== null && _c !== void 0 ? _c : null);
|
|
2728
|
+
const [draggingRow, setDraggingRow] = React.useState((_d = initialState.draggingRow) !== null && _d !== void 0 ? _d : null);
|
|
2729
|
+
const [editingCell, setEditingCell] = React.useState((_e = initialState.editingCell) !== null && _e !== void 0 ? _e : null);
|
|
2730
|
+
const [editingRow, setEditingRow] = React.useState((_f = initialState.editingRow) !== null && _f !== void 0 ? _f : null);
|
|
2731
|
+
const [globalFilterFn, setGlobalFilterFn] = React.useState((_g = initialState.globalFilterFn) !== null && _g !== void 0 ? _g : 'fuzzy');
|
|
2732
|
+
const [hoveredColumn, setHoveredColumn] = React.useState((_h = initialState.hoveredColumn) !== null && _h !== void 0 ? _h : null);
|
|
2733
|
+
const [hoveredRow, setHoveredRow] = React.useState((_j = initialState.hoveredRow) !== null && _j !== void 0 ? _j : null);
|
|
2734
|
+
const [isFullScreen, setIsFullScreen] = React.useState((_k = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _k !== void 0 ? _k : false);
|
|
2735
|
+
const [showAlertBanner, setShowAlertBanner] = React.useState((_m = (_l = props.initialState) === null || _l === void 0 ? void 0 : _l.showAlertBanner) !== null && _m !== void 0 ? _m : false);
|
|
2736
|
+
const [showColumnFilters, setShowFilters] = React.useState((_o = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _o !== void 0 ? _o : false);
|
|
2737
|
+
const [showGlobalFilter, setShowGlobalFilter] = React.useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _p !== void 0 ? _p : false);
|
|
2736
2738
|
const displayColumns = React.useMemo(() => {
|
|
2737
2739
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2738
2740
|
return [
|
|
@@ -2759,8 +2761,6 @@ const MRT_TableRoot = (props) => {
|
|
|
2759
2761
|
props.enableRowSelection,
|
|
2760
2762
|
props.enableSelectAll,
|
|
2761
2763
|
props.localization,
|
|
2762
|
-
props.muiTableBodyCellProps,
|
|
2763
|
-
props.muiTableHeadCellProps,
|
|
2764
2764
|
props.positionActionsColumn,
|
|
2765
2765
|
]);
|
|
2766
2766
|
const columnDefs = React.useMemo(() => prepareColumns([...displayColumns, ...props.columns], columnFilterFns, props.filterFns, props.sortingFns), [columnFilterFns, displayColumns, props.columns]);
|
|
@@ -2779,26 +2779,24 @@ const MRT_TableRoot = (props) => {
|
|
|
2779
2779
|
});
|
|
2780
2780
|
})))
|
|
2781
2781
|
: props.data;
|
|
2782
|
-
}, [props.data, (
|
|
2782
|
+
}, [props.data, (_q = props.state) === null || _q === void 0 ? void 0 : _q.isLoading, (_r = props.state) === null || _r === void 0 ? void 0 : _r.showSkeletons]);
|
|
2783
2783
|
//@ts-ignore
|
|
2784
2784
|
const table = Object.assign(Object.assign({}, reactTable.useReactTable(Object.assign(Object.assign({ getCoreRowModel: reactTable.getCoreRowModel(), getExpandedRowModel: reactTable.getExpandedRowModel(), getFacetedRowModel: reactTable.getFacetedRowModel(), getFilteredRowModel: reactTable.getFilteredRowModel(), getGroupedRowModel: reactTable.getGroupedRowModel(), getPaginationRowModel: reactTable.getPaginationRowModel(), getSortedRowModel: reactTable.getSortedRowModel(), onColumnOrderChange: setColumnOrder, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows }, props), {
|
|
2785
2785
|
//@ts-ignore
|
|
2786
|
-
columns: columnDefs, data, globalFilterFn:
|
|
2787
|
-
|
|
2788
|
-
(_r = props.filterFns[globalFilterFn]) !== null && _r !== void 0 ? _r : props.filterFns.fuzzy, initialState, state: Object.assign({ columnOrder,
|
|
2789
|
-
currentDraggingColumn,
|
|
2790
|
-
currentDraggingRow,
|
|
2791
|
-
currentEditingCell,
|
|
2792
|
-
currentEditingRow,
|
|
2793
|
-
columnFilterFns,
|
|
2794
|
-
globalFilterFn,
|
|
2795
|
-
currentHoveredColumn,
|
|
2796
|
-
currentHoveredRow,
|
|
2786
|
+
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,
|
|
2787
|
+
columnOrder,
|
|
2797
2788
|
density,
|
|
2789
|
+
draggingColumn,
|
|
2790
|
+
draggingRow,
|
|
2791
|
+
editingCell,
|
|
2792
|
+
editingRow,
|
|
2793
|
+
globalFilterFn,
|
|
2794
|
+
hoveredColumn,
|
|
2795
|
+
hoveredRow,
|
|
2798
2796
|
isFullScreen,
|
|
2799
2797
|
showAlertBanner,
|
|
2800
2798
|
showColumnFilters,
|
|
2801
|
-
showGlobalFilter }, props.state), tableId }))), {
|
|
2799
|
+
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 });
|
|
2802
2800
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2803
2801
|
React__default["default"].createElement(material.Dialog, { PaperComponent: material.Box, TransitionComponent: material.Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => setIsFullScreen(false), open: isFullScreen, transitionDuration: 400 },
|
|
2804
2802
|
React__default["default"].createElement(MRT_TablePaper, { table: table })),
|