material-react-table-narender 2.13.5 → 2.13.6
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 +3 -0
- package/dist/index.esm.js +22 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +22 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +12 -0
- package/src/components/menus/MRT_ShowHideColumnsMenuItems.tsx +29 -0
- package/src/icons.ts +2 -0
- package/src/utils/cell.utils.ts +16 -0
package/dist/index.d.ts
CHANGED
|
@@ -233,6 +233,9 @@ declare const MRT_Default_Icons: {
|
|
|
233
233
|
readonly VisibilityOffIcon: _mui_material_OverridableComponent.OverridableComponent<_mui_material.SvgIconTypeMap<{}, "svg">> & {
|
|
234
234
|
muiName: string;
|
|
235
235
|
};
|
|
236
|
+
readonly SettingsBackupRestoreIcon: _mui_material_OverridableComponent.OverridableComponent<_mui_material.SvgIconTypeMap<{}, "svg">> & {
|
|
237
|
+
muiName: string;
|
|
238
|
+
};
|
|
236
239
|
};
|
|
237
240
|
type MRT_Icons = Record<keyof typeof MRT_Default_Icons, any>;
|
|
238
241
|
|
package/dist/index.esm.js
CHANGED
|
@@ -48,9 +48,10 @@ import SortIcon from '@mui/icons-material/Sort';
|
|
|
48
48
|
import SyncAltIcon from '@mui/icons-material/SyncAlt';
|
|
49
49
|
import ViewColumnIcon from '@mui/icons-material/ViewColumn';
|
|
50
50
|
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
|
|
51
|
+
import SettingsBackupRestoreIcon from '@mui/icons-material/SettingsBackupRestore';
|
|
51
52
|
import { defaultRangeExtractor, useVirtualizer } from '@tanstack/react-virtual';
|
|
52
53
|
import Paper from '@mui/material/Paper';
|
|
53
|
-
import { useTheme as useTheme$1 } from '@mui/material';
|
|
54
|
+
import { Button as Button$1, useTheme as useTheme$1 } from '@mui/material';
|
|
54
55
|
import TableContainer from '@mui/material/TableContainer';
|
|
55
56
|
import Table from '@mui/material/Table';
|
|
56
57
|
import TableBody from '@mui/material/TableBody';
|
|
@@ -502,6 +503,16 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement
|
|
|
502
503
|
'PageDown',
|
|
503
504
|
].includes(event.key)) {
|
|
504
505
|
event.preventDefault();
|
|
506
|
+
if (['ArrowDown'].includes(event.key)) {
|
|
507
|
+
debugger; // This will pause execution for debugging purposes
|
|
508
|
+
// Select the input element within the MUI Autocomplete component
|
|
509
|
+
const autocomplete = currentCell.querySelector('.MuiAutocomplete-root input[type="text"]');
|
|
510
|
+
// Check if the current cell is an MUI Autocomplete
|
|
511
|
+
if (autocomplete) {
|
|
512
|
+
return; // Exit the function if it's an Autocomplete
|
|
513
|
+
}
|
|
514
|
+
// Additional logic for when it's not an Autocomplete can go here
|
|
515
|
+
}
|
|
505
516
|
const currentRow = parentElement || currentCell.closest('tr');
|
|
506
517
|
const tableElement = containerElement || currentCell.closest('table');
|
|
507
518
|
const allCells = cellElements ||
|
|
@@ -1270,6 +1281,7 @@ const MRT_Default_Icons = {
|
|
|
1270
1281
|
SyncAltIcon,
|
|
1271
1282
|
ViewColumnIcon,
|
|
1272
1283
|
VisibilityOffIcon,
|
|
1284
|
+
SettingsBackupRestoreIcon
|
|
1273
1285
|
};
|
|
1274
1286
|
|
|
1275
1287
|
const MRT_Localization_EN = {
|
|
@@ -3992,7 +4004,7 @@ const MRT_ColumnPinningButtons = (_a) => {
|
|
|
3992
4004
|
const MRT_ShowHideColumnsMenuItems = (_a) => {
|
|
3993
4005
|
var _b;
|
|
3994
4006
|
var { allColumns, column, hoveredColumn, isNestedColumns, setHoveredColumn, table } = _a, rest = __rest(_a, ["allColumns", "column", "hoveredColumn", "isNestedColumns", "setHoveredColumn", "table"]);
|
|
3995
|
-
const { getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, mrtTheme: { draggingBorderColor }, }, setColumnOrder, } = table;
|
|
4007
|
+
const { getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, enableColumnResizing, mrtTheme: { draggingBorderColor }, icons: { SettingsBackupRestoreIcon }, }, setColumnOrder, } = table;
|
|
3996
4008
|
const { columnOrder } = getState();
|
|
3997
4009
|
const { columnDef } = column;
|
|
3998
4010
|
const { columnDefType } = columnDef;
|
|
@@ -4053,12 +4065,15 @@ const MRT_ShowHideColumnsMenuItems = (_a) => {
|
|
|
4053
4065
|
opacity: columnDefType !== 'display' ? 1 : 0.5,
|
|
4054
4066
|
},
|
|
4055
4067
|
},
|
|
4056
|
-
}, control: jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { title: localization.toggleVisibility, children: jsx(Switch, {}) })), disabled: !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (jsx(Typography, { sx: { alignSelf: 'center' }, children: columnDef.header }))
|
|
4068
|
+
}, control: jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { title: localization.toggleVisibility, children: jsx(Switch, {}) })), disabled: !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (jsx(Typography, { sx: { alignSelf: 'center' }, children: columnDef.header })), enableColumnResizing && columnDefType !== 'group' &&
|
|
4069
|
+
(columnDef.enableResizing !== false ? (jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { title: localization.resetColumnSize, children: jsx(Button$1, { onClick: () => {
|
|
4070
|
+
column.resetSize();
|
|
4071
|
+
}, children: jsx(SettingsBackupRestoreIcon, {}) }) }))) : (jsx(Box, { sx: { width: '28px' } })))] }) })), (_b = column.columns) === null || _b === void 0 ? void 0 : _b.map((c, i) => (jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, isNestedColumns: isNestedColumns, setHoveredColumn: setHoveredColumn, table: table }, `${i}-${c.id}`)))] }));
|
|
4057
4072
|
};
|
|
4058
4073
|
|
|
4059
4074
|
const MRT_ShowHideColumnsMenu = (_a) => {
|
|
4060
4075
|
var { anchorEl, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "setAnchorEl", "table"]);
|
|
4061
|
-
const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, mrtTheme: { menuBackgroundColor }, }, } = table;
|
|
4076
|
+
const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, enableColumnResizing, mrtTheme: { menuBackgroundColor }, }, } = table;
|
|
4062
4077
|
const { columnOrder, columnPinning, density } = getState();
|
|
4063
4078
|
const handleToggleAllColumns = (value) => {
|
|
4064
4079
|
getAllLeafColumns()
|
|
@@ -4096,7 +4111,9 @@ const MRT_ShowHideColumnsMenu = (_a) => {
|
|
|
4096
4111
|
justifyContent: 'space-between',
|
|
4097
4112
|
p: '0.5rem',
|
|
4098
4113
|
pt: 0,
|
|
4099
|
-
}, children: [enableHiding && (jsx(Button, { disabled: !getIsSomeColumnsVisible(), onClick: () => handleToggleAllColumns(false), children: localization.hideAll })), enableColumnOrdering && (jsx(Button, { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options, true)), children: localization.resetOrder })), enableColumnPinning && (jsx(Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsx(Button, { disabled: getIsAllColumnsVisible(), onClick: () => handleToggleAllColumns(true), children: localization.showAll }))
|
|
4114
|
+
}, children: [enableHiding && (jsx(Button, { disabled: !getIsSomeColumnsVisible(), onClick: () => handleToggleAllColumns(false), children: localization.hideAll })), enableColumnOrdering && (jsx(Button, { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options, true)), children: localization.resetOrder })), enableColumnPinning && (jsx(Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsx(Button, { disabled: getIsAllColumnsVisible(), onClick: () => handleToggleAllColumns(true), children: localization.showAll })), enableColumnResizing && (jsx(Button, { onClick: () => {
|
|
4115
|
+
table.resetColumnSizing(true);
|
|
4116
|
+
}, children: localization.resetColumnSize }))] }), jsx(Divider, {}), allColumns.map((column, index) => (jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, isNestedColumns: isNestedColumns, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] })));
|
|
4100
4117
|
};
|
|
4101
4118
|
|
|
4102
4119
|
const MRT_ShowHideColumnsButton = (_a) => {
|