@mui/x-data-grid 5.8.0 → 5.9.0
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/CHANGELOG.md +141 -63
- package/DataGrid/DataGrid.js +1 -1
- package/DataGrid/useDataGridComponent.js +3 -1
- package/LICENSE +21 -0
- package/README.md +1 -1
- package/components/GridRow.d.ts +4 -0
- package/components/GridRow.js +49 -23
- package/components/base/GridOverlays.js +4 -3
- package/components/cell/GridActionsCell.d.ts +5 -1
- package/components/cell/GridActionsCell.js +170 -21
- package/components/cell/GridActionsCellItem.d.ts +66 -4
- package/components/cell/GridActionsCellItem.js +7 -5
- package/components/cell/GridCell.d.ts +1 -0
- package/components/cell/GridCell.js +28 -7
- package/components/cell/GridEditInputCell.js +1 -1
- package/components/cell/GridEditSingleSelectCell.js +22 -13
- package/components/columnHeaders/GridColumnHeaderItem.js +4 -7
- package/components/columnHeaders/GridColumnHeaders.d.ts +0 -1
- package/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/components/columnSelection/GridCellCheckboxRenderer.d.ts +3 -3
- package/components/columnSelection/GridCellCheckboxRenderer.js +20 -3
- package/components/panel/GridPanel.js +1 -0
- package/components/panel/filterPanel/GridFilterForm.js +14 -10
- package/components/panel/filterPanel/GridFilterInputBoolean.js +13 -8
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +22 -15
- package/components/panel/filterPanel/GridFilterInputValue.js +22 -15
- package/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/virtualization/GridVirtualScroller.js +2 -0
- package/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/constants/gridDetailPanelToggleField.d.ts +1 -0
- package/constants/gridDetailPanelToggleField.js +2 -0
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +32 -15
- package/hooks/core/pipeProcessing/index.d.ts +1 -0
- package/hooks/core/pipeProcessing/index.js +2 -1
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +8 -3
- package/hooks/core/pipeProcessing/useGridPipeProcessing.js +53 -19
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +3 -0
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +0 -3
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +0 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +76 -10
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +19 -1
- package/hooks/features/columns/gridColumnsUtils.js +61 -8
- package/hooks/features/columns/useGridColumnSpanning.d.ts +7 -0
- package/hooks/features/columns/useGridColumnSpanning.js +109 -0
- package/hooks/features/columns/useGridColumns.js +24 -18
- package/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/hooks/features/editRows/useGridCellEditing.new.js +18 -10
- package/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/hooks/features/editRows/useGridRowEditing.new.js +23 -15
- package/hooks/features/filter/useGridFilter.js +14 -9
- package/hooks/features/focus/useGridFocus.js +19 -9
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -0
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +39 -7
- package/hooks/features/rows/gridRowsSelector.d.ts +1 -0
- package/hooks/features/rows/gridRowsSelector.js +1 -0
- package/hooks/features/rows/gridRowsState.d.ts +4 -0
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +5 -4
- package/hooks/features/rows/useGridRowsMeta.js +6 -13
- package/hooks/features/scroll/useGridScroll.d.ts +2 -0
- package/hooks/features/scroll/useGridScroll.js +25 -3
- package/hooks/features/selection/useGridSelection.js +3 -2
- package/hooks/features/sorting/useGridSorting.js +10 -10
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +7 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +54 -27
- package/index.js +1 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/legacy/DataGrid/DataGrid.js +1 -1
- package/legacy/DataGrid/useDataGridComponent.js +3 -1
- package/legacy/components/GridRow.js +47 -23
- package/legacy/components/base/GridOverlays.js +4 -3
- package/legacy/components/cell/GridActionsCell.js +188 -27
- package/legacy/components/cell/GridActionsCellItem.js +7 -5
- package/legacy/components/cell/GridCell.js +29 -7
- package/legacy/components/cell/GridEditInputCell.js +1 -1
- package/legacy/components/cell/GridEditSingleSelectCell.js +33 -24
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +4 -7
- package/legacy/components/columnHeaders/GridColumnHeaders.js +2 -3
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +21 -3
- package/legacy/components/panel/GridPanel.js +1 -0
- package/legacy/components/panel/filterPanel/GridFilterForm.js +14 -10
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +13 -8
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +22 -17
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +22 -17
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/legacy/components/virtualization/GridVirtualScroller.js +2 -0
- package/legacy/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/legacy/constants/gridDetailPanelToggleField.js +2 -0
- package/legacy/hooks/core/pipeProcessing/index.js +2 -1
- package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +60 -24
- package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
- package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +89 -10
- package/legacy/hooks/features/columns/gridColumnsUtils.js +79 -22
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +107 -0
- package/legacy/hooks/features/columns/useGridColumns.js +24 -18
- package/legacy/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +14 -8
- package/legacy/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +32 -24
- package/legacy/hooks/features/filter/useGridFilter.js +14 -9
- package/legacy/hooks/features/focus/useGridFocus.js +19 -9
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +39 -6
- package/legacy/hooks/features/rows/gridRowsSelector.js +3 -0
- package/legacy/hooks/features/rows/useGridRows.js +5 -4
- package/legacy/hooks/features/rows/useGridRowsMeta.js +6 -13
- package/legacy/hooks/features/scroll/useGridScroll.js +25 -3
- package/legacy/hooks/features/selection/useGridSelection.js +3 -2
- package/legacy/hooks/features/sorting/useGridSorting.js +5 -7
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +65 -37
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -0
- package/legacy/locales/huHU.js +120 -0
- package/legacy/locales/index.js +1 -0
- package/legacy/models/api/gridColumnSpanning.js +1 -0
- package/legacy/models/events/gridEvents.js +2 -3
- package/legacy/models/gridColumnSpanning.js +1 -0
- package/locales/huHU.d.ts +2 -0
- package/locales/huHU.js +108 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/models/api/gridApiCommon.d.ts +2 -1
- package/models/api/gridColumnSpanning.d.ts +28 -0
- package/models/api/gridColumnSpanning.js +1 -0
- package/models/api/gridEditingApi.d.ts +49 -3
- package/models/colDef/gridColDef.d.ts +5 -0
- package/models/events/gridEventLookup.d.ts +3 -8
- package/models/events/gridEvents.d.ts +9 -14
- package/models/events/gridEvents.js +2 -3
- package/models/gridColumnSpanning.d.ts +12 -0
- package/models/gridColumnSpanning.js +1 -0
- package/models/gridEditRowModel.d.ts +1 -1
- package/models/params/gridCellParams.d.ts +12 -2
- package/models/params/gridRowParams.d.ts +5 -0
- package/models/props/DataGridProps.d.ts +1 -1
- package/modern/DataGrid/DataGrid.js +1 -1
- package/modern/DataGrid/useDataGridComponent.js +3 -1
- package/modern/components/GridRow.js +47 -21
- package/modern/components/base/GridOverlays.js +4 -3
- package/modern/components/cell/GridActionsCell.js +168 -21
- package/modern/components/cell/GridActionsCellItem.js +7 -5
- package/modern/components/cell/GridCell.js +28 -7
- package/modern/components/cell/GridEditInputCell.js +1 -1
- package/modern/components/cell/GridEditSingleSelectCell.js +20 -11
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +4 -7
- package/modern/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +20 -3
- package/modern/components/panel/GridPanel.js +1 -0
- package/modern/components/panel/filterPanel/GridFilterForm.js +10 -6
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +11 -6
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +20 -13
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +20 -13
- package/modern/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/modern/components/virtualization/GridVirtualScroller.js +2 -0
- package/modern/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/modern/constants/gridDetailPanelToggleField.js +2 -0
- package/modern/hooks/core/pipeProcessing/index.js +2 -1
- package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +53 -19
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +76 -10
- package/modern/hooks/features/columns/gridColumnsUtils.js +61 -8
- package/modern/hooks/features/columns/useGridColumnSpanning.js +107 -0
- package/modern/hooks/features/columns/useGridColumns.js +24 -18
- package/modern/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +18 -10
- package/modern/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +23 -15
- package/modern/hooks/features/filter/useGridFilter.js +14 -9
- package/modern/hooks/features/focus/useGridFocus.js +19 -9
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +37 -7
- package/modern/hooks/features/rows/gridRowsSelector.js +1 -0
- package/modern/hooks/features/rows/useGridRows.js +5 -4
- package/modern/hooks/features/rows/useGridRowsMeta.js +6 -13
- package/modern/hooks/features/scroll/useGridScroll.js +23 -3
- package/modern/hooks/features/selection/useGridSelection.js +3 -2
- package/modern/hooks/features/sorting/useGridSorting.js +10 -10
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +54 -23
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/locales/huHU.js +108 -0
- package/modern/locales/index.js +1 -0
- package/modern/models/api/gridColumnSpanning.js +1 -0
- package/modern/models/events/gridEvents.js +2 -3
- package/modern/models/gridColumnSpanning.js +1 -0
- package/node/DataGrid/DataGrid.js +1 -1
- package/node/DataGrid/useDataGridComponent.js +4 -1
- package/node/components/GridRow.js +50 -23
- package/node/components/base/GridOverlays.js +3 -2
- package/node/components/cell/GridActionsCell.js +172 -21
- package/node/components/cell/GridActionsCellItem.js +7 -4
- package/node/components/cell/GridCell.js +28 -7
- package/node/components/cell/GridEditInputCell.js +1 -1
- package/node/components/cell/GridEditSingleSelectCell.js +23 -13
- package/node/components/columnHeaders/GridColumnHeaderItem.js +4 -7
- package/node/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +20 -3
- package/node/components/panel/GridPanel.js +1 -0
- package/node/components/panel/filterPanel/GridFilterForm.js +15 -10
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +14 -8
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +23 -15
- package/node/components/panel/filterPanel/GridFilterInputValue.js +23 -15
- package/node/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/node/components/virtualization/GridVirtualScroller.js +2 -0
- package/node/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/node/constants/gridDetailPanelToggleField.js +9 -0
- package/node/hooks/core/pipeProcessing/index.js +13 -0
- package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +51 -20
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +42 -0
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -3
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +80 -10
- package/node/hooks/features/columns/gridColumnsUtils.js +65 -9
- package/node/hooks/features/columns/useGridColumnSpanning.js +130 -0
- package/node/hooks/features/columns/useGridColumns.js +23 -17
- package/node/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/node/hooks/features/editRows/useGridCellEditing.new.js +18 -10
- package/node/hooks/features/editRows/useGridEditing.new.js +6 -2
- package/node/hooks/features/editRows/useGridRowEditing.new.js +21 -14
- package/node/hooks/features/filter/useGridFilter.js +14 -9
- package/node/hooks/features/focus/useGridFocus.js +19 -9
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +40 -7
- package/node/hooks/features/rows/gridRowsSelector.js +3 -1
- package/node/hooks/features/rows/useGridRows.js +5 -4
- package/node/hooks/features/rows/useGridRowsMeta.js +6 -14
- package/node/hooks/features/scroll/useGridScroll.js +26 -2
- package/node/hooks/features/selection/useGridSelection.js +4 -2
- package/node/hooks/features/sorting/useGridSorting.js +10 -10
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +59 -27
- package/node/index.js +1 -1
- package/node/internals/index.js +8 -0
- package/node/locales/huHU.js +118 -0
- package/node/locales/index.js +13 -0
- package/node/models/api/gridColumnSpanning.js +5 -0
- package/node/models/events/gridEvents.js +2 -3
- package/node/models/gridColumnSpanning.js +5 -0
- package/package.json +4 -4
- package/utils/domUtils.d.ts +2 -2
package/components/GridRow.js
CHANGED
|
@@ -20,6 +20,7 @@ import { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
|
20
20
|
import { findParentElementFromClassName } from '../utils/domUtils';
|
|
21
21
|
import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../colDef/gridCheckboxSelectionColDef';
|
|
22
22
|
import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
|
|
23
|
+
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelToggleField';
|
|
23
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
25
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
26
|
|
|
@@ -61,6 +62,7 @@ function GridRow(props) {
|
|
|
61
62
|
const {
|
|
62
63
|
selected,
|
|
63
64
|
rowId,
|
|
65
|
+
row,
|
|
64
66
|
index,
|
|
65
67
|
style: styleProp,
|
|
66
68
|
rowHeight,
|
|
@@ -132,7 +134,7 @@ function GridRow(props) {
|
|
|
132
134
|
} // User opened a detail panel
|
|
133
135
|
|
|
134
136
|
|
|
135
|
-
if (field ===
|
|
137
|
+
if (field === GRID_DETAIL_PANEL_TOGGLE_FIELD) {
|
|
136
138
|
return;
|
|
137
139
|
} // User is editing a cell
|
|
138
140
|
|
|
@@ -176,7 +178,8 @@ function GridRow(props) {
|
|
|
176
178
|
|
|
177
179
|
const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
|
|
178
180
|
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
179
|
-
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1
|
|
181
|
+
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
182
|
+
indexRelativeToCurrentPage
|
|
180
183
|
});
|
|
181
184
|
|
|
182
185
|
rowClassName = rootProps.getRowClassName(rowParams);
|
|
@@ -185,8 +188,6 @@ function GridRow(props) {
|
|
|
185
188
|
const cells = [];
|
|
186
189
|
|
|
187
190
|
for (let i = 0; i < renderedColumns.length; i += 1) {
|
|
188
|
-
var _rootProps$components;
|
|
189
|
-
|
|
190
191
|
const column = renderedColumns[i];
|
|
191
192
|
const indexRelativeToAllColumns = firstColumnToRender + i;
|
|
192
193
|
const isLastColumn = indexRelativeToAllColumns === visibleColumns.length - 1;
|
|
@@ -215,7 +216,16 @@ function GridRow(props) {
|
|
|
215
216
|
if (editCellState != null && column.renderEditCell) {
|
|
216
217
|
var _rootProps$classes2;
|
|
217
218
|
|
|
218
|
-
|
|
219
|
+
let updatedRow = row;
|
|
220
|
+
|
|
221
|
+
if (apiRef.current.unstable_getRowWithUpdatedValues) {
|
|
222
|
+
// Only the new editing API has this method
|
|
223
|
+
updatedRow = apiRef.current.unstable_getRowWithUpdatedValues(rowId, column.field);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const params = _extends({}, cellParams, {
|
|
227
|
+
row: updatedRow
|
|
228
|
+
}, editCellState, {
|
|
219
229
|
api: apiRef.current
|
|
220
230
|
});
|
|
221
231
|
|
|
@@ -231,24 +241,35 @@ function GridRow(props) {
|
|
|
231
241
|
|
|
232
242
|
const hasFocus = cellFocus !== null && cellFocus.id === rowId && cellFocus.field === column.field;
|
|
233
243
|
const tabIndex = cellTabIndex !== null && cellTabIndex.id === rowId && cellTabIndex.field === column.field && cellParams.cellMode === 'view' ? 0 : -1;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
244
|
+
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
245
|
+
|
|
246
|
+
if (cellColSpanInfo && !cellColSpanInfo.spannedByColSpan) {
|
|
247
|
+
var _rootProps$components;
|
|
248
|
+
|
|
249
|
+
const {
|
|
250
|
+
colSpan,
|
|
251
|
+
width
|
|
252
|
+
} = cellColSpanInfo.cellProps;
|
|
253
|
+
cells.push( /*#__PURE__*/_jsx(rootProps.components.Cell, _extends({
|
|
254
|
+
value: cellParams.value,
|
|
255
|
+
field: column.field,
|
|
256
|
+
width: width,
|
|
257
|
+
rowId: rowId,
|
|
258
|
+
height: rowHeight,
|
|
259
|
+
showRightBorder: showRightBorder,
|
|
260
|
+
formattedValue: cellParams.formattedValue,
|
|
261
|
+
align: column.align || 'left',
|
|
262
|
+
cellMode: cellParams.cellMode,
|
|
263
|
+
colIndex: indexRelativeToAllColumns,
|
|
264
|
+
isEditable: cellParams.isEditable,
|
|
265
|
+
hasFocus: hasFocus,
|
|
266
|
+
tabIndex: tabIndex,
|
|
267
|
+
className: clsx(classNames),
|
|
268
|
+
colSpan: colSpan
|
|
269
|
+
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.cell, {
|
|
270
|
+
children: content
|
|
271
|
+
}), column.field));
|
|
272
|
+
}
|
|
252
273
|
}
|
|
253
274
|
|
|
254
275
|
const emptyCellWidth = containerWidth - columnsTotalWidth;
|
|
@@ -282,6 +303,11 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
282
303
|
containerWidth: PropTypes.number.isRequired,
|
|
283
304
|
editRowsState: PropTypes.object.isRequired,
|
|
284
305
|
firstColumnToRender: PropTypes.number.isRequired,
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Index of the row in the whole sorted and filtered dataset.
|
|
309
|
+
* If some rows above have expanded children, this index also take those children into account.
|
|
310
|
+
*/
|
|
285
311
|
index: PropTypes.number.isRequired,
|
|
286
312
|
isLastVisible: PropTypes.bool,
|
|
287
313
|
lastColumnToRender: PropTypes.number.isRequired,
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
|
|
4
4
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
5
5
|
import { gridVisibleRowCountSelector } from '../../hooks/features/filter/gridFilterSelector';
|
|
6
|
-
import { gridRowCountSelector } from '../../hooks/features/rows/gridRowsSelector';
|
|
6
|
+
import { gridRowCountSelector, gridRowsLoadingSelector } from '../../hooks/features/rows/gridRowsSelector';
|
|
7
7
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
8
8
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
9
9
|
import { gridDensityHeaderHeightSelector } from '../../hooks/features/density/densitySelector';
|
|
@@ -55,8 +55,9 @@ export function GridOverlays() {
|
|
|
55
55
|
const rootProps = useGridRootProps();
|
|
56
56
|
const totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
|
|
57
57
|
const visibleRowCount = useGridSelector(apiRef, gridVisibleRowCountSelector);
|
|
58
|
-
const
|
|
59
|
-
const
|
|
58
|
+
const loading = useGridSelector(apiRef, gridRowsLoadingSelector);
|
|
59
|
+
const showNoRowsOverlay = !loading && totalRowCount === 0;
|
|
60
|
+
const showNoResultsOverlay = !loading && totalRowCount > 0 && visibleRowCount === 0;
|
|
60
61
|
let overlay = null;
|
|
61
62
|
|
|
62
63
|
if (showNoRowsOverlay) {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GridRenderCellParams } from '../../models/params/gridCellParams';
|
|
3
3
|
import { GridMenuProps } from '../menu/GridMenu';
|
|
4
|
-
|
|
4
|
+
interface GridActionsCellProps extends Omit<GridRenderCellParams, 'value' | 'formattedValue'> {
|
|
5
|
+
value?: GridRenderCellParams['value'];
|
|
6
|
+
formattedValue?: GridRenderCellParams['formattedValue'];
|
|
7
|
+
position?: GridMenuProps['position'];
|
|
8
|
+
}
|
|
5
9
|
declare const GridActionsCell: {
|
|
6
10
|
(props: GridActionsCellProps): JSX.Element;
|
|
7
11
|
propTypes: any;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["colDef", "id", "api", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "getValue", "tabIndex", "position", "focusElementRef"];
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
6
|
import IconButton from '@mui/material/IconButton';
|
|
@@ -7,26 +9,33 @@ import { unstable_useId as useId } from '@mui/material/utils';
|
|
|
7
9
|
import { gridClasses } from '../../constants/gridClasses';
|
|
8
10
|
import { GridMenu } from '../menu/GridMenu';
|
|
9
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
10
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
15
|
|
|
13
16
|
const hasActions = colDef => typeof colDef.getActions === 'function';
|
|
14
17
|
|
|
15
18
|
const GridActionsCell = props => {
|
|
19
|
+
const {
|
|
20
|
+
colDef,
|
|
21
|
+
id,
|
|
22
|
+
hasFocus,
|
|
23
|
+
tabIndex,
|
|
24
|
+
position = 'bottom-end',
|
|
25
|
+
focusElementRef
|
|
26
|
+
} = props,
|
|
27
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
28
|
+
|
|
29
|
+
const [focusedButtonIndex, setFocusedButtonIndex] = React.useState(-1);
|
|
16
30
|
const [open, setOpen] = React.useState(false);
|
|
31
|
+
const apiRef = useGridApiContext();
|
|
32
|
+
const rootRef = React.useRef(null);
|
|
17
33
|
const buttonRef = React.useRef(null);
|
|
34
|
+
const ignoreCallToFocus = React.useRef(false);
|
|
18
35
|
const touchRippleRefs = React.useRef({});
|
|
19
36
|
const menuId = useId();
|
|
20
37
|
const buttonId = useId();
|
|
21
38
|
const rootProps = useGridRootProps();
|
|
22
|
-
const {
|
|
23
|
-
colDef,
|
|
24
|
-
id,
|
|
25
|
-
api,
|
|
26
|
-
hasFocus,
|
|
27
|
-
position = 'bottom-end'
|
|
28
|
-
} = props; // TODO apply the rest to the root element
|
|
29
|
-
|
|
30
39
|
React.useLayoutEffect(() => {
|
|
31
40
|
if (!hasFocus) {
|
|
32
41
|
Object.entries(touchRippleRefs.current).forEach(([index, ref]) => {
|
|
@@ -36,56 +45,144 @@ const GridActionsCell = props => {
|
|
|
36
45
|
});
|
|
37
46
|
}
|
|
38
47
|
}, [hasFocus]);
|
|
48
|
+
React.useEffect(() => {
|
|
49
|
+
if (focusedButtonIndex >= 0) {
|
|
50
|
+
var _rootRef$current;
|
|
51
|
+
|
|
52
|
+
const child = (_rootRef$current = rootRef.current) == null ? void 0 : _rootRef$current.children[focusedButtonIndex];
|
|
53
|
+
child.focus();
|
|
54
|
+
}
|
|
55
|
+
}, [focusedButtonIndex]);
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
if (!hasFocus) {
|
|
58
|
+
setFocusedButtonIndex(-1);
|
|
59
|
+
ignoreCallToFocus.current = false;
|
|
60
|
+
}
|
|
61
|
+
}, [hasFocus]);
|
|
62
|
+
React.useImperativeHandle(focusElementRef, () => ({
|
|
63
|
+
focus() {
|
|
64
|
+
// If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
|
|
65
|
+
if (!ignoreCallToFocus.current) {
|
|
66
|
+
setFocusedButtonIndex(0);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}), []);
|
|
39
71
|
|
|
40
72
|
if (!hasActions(colDef)) {
|
|
41
73
|
throw new Error('MUI: Missing the `getActions` property in the `GridColDef`.');
|
|
42
74
|
}
|
|
43
75
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const hideMenu = () => setOpen(false);
|
|
47
|
-
|
|
48
|
-
const options = colDef.getActions(api.getRowParams(id));
|
|
76
|
+
const options = colDef.getActions(apiRef.current.getRowParams(id));
|
|
49
77
|
const iconButtons = options.filter(option => !option.props.showInMenu);
|
|
50
78
|
const menuButtons = options.filter(option => option.props.showInMenu);
|
|
79
|
+
const numberOfButtons = iconButtons.length + (menuButtons.length ? 1 : 0);
|
|
80
|
+
|
|
81
|
+
const showMenu = () => {
|
|
82
|
+
setOpen(true);
|
|
83
|
+
setFocusedButtonIndex(numberOfButtons - 1);
|
|
84
|
+
ignoreCallToFocus.current = true;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const hideMenu = () => {
|
|
88
|
+
setOpen(false);
|
|
89
|
+
};
|
|
51
90
|
|
|
52
91
|
const handleTouchRippleRef = index => instance => {
|
|
53
92
|
touchRippleRefs.current[index] = instance;
|
|
54
93
|
};
|
|
55
94
|
|
|
56
|
-
|
|
95
|
+
const handleButtonClick = (index, onClick) => event => {
|
|
96
|
+
setFocusedButtonIndex(index);
|
|
97
|
+
ignoreCallToFocus.current = true;
|
|
98
|
+
|
|
99
|
+
if (onClick) {
|
|
100
|
+
onClick(event);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const handleRootKeyDown = event => {
|
|
105
|
+
if (numberOfButtons <= 1) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
let newIndex = focusedButtonIndex;
|
|
110
|
+
|
|
111
|
+
if (event.key === 'ArrowRight') {
|
|
112
|
+
newIndex += 1;
|
|
113
|
+
} else if (event.key === 'ArrowLeft') {
|
|
114
|
+
newIndex -= 1;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (newIndex < 0 || newIndex >= numberOfButtons) {
|
|
118
|
+
return; // We're already in the first or last item = do nothing and let the grid listen the event
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (newIndex !== focusedButtonIndex) {
|
|
122
|
+
event.preventDefault(); // Prevent scrolling
|
|
123
|
+
|
|
124
|
+
event.stopPropagation(); // Don't stop propagation for other keys, e.g. ArrowUp
|
|
125
|
+
|
|
126
|
+
setFocusedButtonIndex(newIndex);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const handleListKeyDown = event => {
|
|
131
|
+
if (event.key === 'Tab') {
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (['Tab', 'Enter', 'Escape'].includes(event.key)) {
|
|
136
|
+
hideMenu();
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
return /*#__PURE__*/_jsxs("div", _extends({
|
|
141
|
+
role: "menu",
|
|
142
|
+
ref: rootRef,
|
|
143
|
+
tabIndex: -1,
|
|
57
144
|
className: gridClasses.actionsCell,
|
|
145
|
+
onKeyDown: handleRootKeyDown
|
|
146
|
+
}, other, {
|
|
58
147
|
children: [iconButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
|
|
59
148
|
key: index,
|
|
60
|
-
touchRippleRef: handleTouchRippleRef(index)
|
|
61
|
-
|
|
149
|
+
touchRippleRef: handleTouchRippleRef(index),
|
|
150
|
+
onClick: handleButtonClick(index, button.props.onClick),
|
|
151
|
+
tabIndex: focusedButtonIndex === index ? tabIndex : -1
|
|
152
|
+
})), menuButtons.length > 0 && buttonId && /*#__PURE__*/_jsx(IconButton, {
|
|
62
153
|
ref: buttonRef,
|
|
63
154
|
id: buttonId,
|
|
64
|
-
"aria-label":
|
|
155
|
+
"aria-label": apiRef.current.getLocaleText('actionsCellMore'),
|
|
65
156
|
"aria-controls": menuId,
|
|
66
157
|
"aria-expanded": open ? 'true' : undefined,
|
|
67
158
|
"aria-haspopup": "true",
|
|
159
|
+
role: "menuitem",
|
|
68
160
|
size: "small",
|
|
69
161
|
onClick: showMenu,
|
|
162
|
+
touchRippleRef: handleTouchRippleRef(buttonId),
|
|
163
|
+
tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1,
|
|
70
164
|
children: /*#__PURE__*/_jsx(rootProps.components.MoreActionsIcon, {
|
|
71
165
|
fontSize: "small"
|
|
72
166
|
})
|
|
73
167
|
}), menuButtons.length > 0 && /*#__PURE__*/_jsx(GridMenu, {
|
|
74
|
-
id: menuId,
|
|
75
168
|
onClickAway: hideMenu,
|
|
76
169
|
onClick: hideMenu,
|
|
77
170
|
open: open,
|
|
78
171
|
target: buttonRef.current,
|
|
79
172
|
position: position,
|
|
80
|
-
"aria-labelledby": buttonId,
|
|
81
173
|
children: /*#__PURE__*/_jsx(MenuList, {
|
|
174
|
+
id: menuId,
|
|
82
175
|
className: gridClasses.menuList,
|
|
176
|
+
onKeyDown: handleListKeyDown,
|
|
177
|
+
"aria-labelledby": buttonId,
|
|
178
|
+
variant: "menu",
|
|
179
|
+
autoFocusItem: true,
|
|
83
180
|
children: menuButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
|
|
84
181
|
key: index
|
|
85
182
|
}))
|
|
86
183
|
})
|
|
87
184
|
})]
|
|
88
|
-
});
|
|
185
|
+
}));
|
|
89
186
|
};
|
|
90
187
|
|
|
91
188
|
process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
@@ -100,11 +197,42 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
100
197
|
*/
|
|
101
198
|
api: PropTypes.any.isRequired,
|
|
102
199
|
|
|
200
|
+
/**
|
|
201
|
+
* The mode of the cell.
|
|
202
|
+
*/
|
|
203
|
+
cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
|
|
204
|
+
|
|
103
205
|
/**
|
|
104
206
|
* The column of the row that the current cell belongs to.
|
|
105
207
|
*/
|
|
106
208
|
colDef: PropTypes.object.isRequired,
|
|
107
209
|
|
|
210
|
+
/**
|
|
211
|
+
* The column field of the cell that triggered the event.
|
|
212
|
+
*/
|
|
213
|
+
field: PropTypes.string.isRequired,
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* A ref allowing to set imperative focus.
|
|
217
|
+
* It can be passed to the element that should receive focus.
|
|
218
|
+
* @ignore - do not document.
|
|
219
|
+
*/
|
|
220
|
+
focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
221
|
+
current: PropTypes.shape({
|
|
222
|
+
focus: PropTypes.func.isRequired
|
|
223
|
+
})
|
|
224
|
+
})]),
|
|
225
|
+
formattedValue: PropTypes.any,
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Get the cell value of a row and field.
|
|
229
|
+
* @param {GridRowId} id The row id.
|
|
230
|
+
* @param {string} field The field.
|
|
231
|
+
* @returns {any} The cell value.
|
|
232
|
+
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
233
|
+
*/
|
|
234
|
+
getValue: PropTypes.func.isRequired,
|
|
235
|
+
|
|
108
236
|
/**
|
|
109
237
|
* If true, the cell is the active element.
|
|
110
238
|
*/
|
|
@@ -114,7 +242,28 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
114
242
|
* The grid row id.
|
|
115
243
|
*/
|
|
116
244
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
117
|
-
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* If true, the cell is editable.
|
|
248
|
+
*/
|
|
249
|
+
isEditable: PropTypes.bool,
|
|
250
|
+
position: PropTypes.oneOf(['bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* The row model of the row that the current cell belongs to.
|
|
254
|
+
*/
|
|
255
|
+
row: PropTypes.object.isRequired,
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* The node of the row that the current cell belongs to.
|
|
259
|
+
*/
|
|
260
|
+
rowNode: PropTypes.object.isRequired,
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* the tabIndex value.
|
|
264
|
+
*/
|
|
265
|
+
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
266
|
+
value: PropTypes.any
|
|
118
267
|
} : void 0;
|
|
119
268
|
export { GridActionsCell };
|
|
120
269
|
export const renderActionsCell = params => /*#__PURE__*/_jsx(GridActionsCell, _extends({}, params));
|
|
@@ -10,8 +10,70 @@ export declare type GridActionsCellItemProps = {
|
|
|
10
10
|
} & IconButtonProps) | ({
|
|
11
11
|
showInMenu: true;
|
|
12
12
|
} & MenuItemProps));
|
|
13
|
-
declare const GridActionsCellItem: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
13
|
+
declare const GridActionsCellItem: React.ForwardRefExoticComponent<(Pick<{
|
|
14
|
+
label: string;
|
|
15
|
+
icon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
showInMenu?: false | undefined;
|
|
18
|
+
icon: React.ReactElement;
|
|
19
|
+
} & {
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
classes?: Partial<import("@mui/material/IconButton").IconButtonClasses> | undefined;
|
|
22
|
+
color?: "inherit" | "default" | "warning" | "error" | "success" | "info" | "primary" | "secondary" | undefined;
|
|
23
|
+
disabled?: boolean | undefined;
|
|
24
|
+
disableFocusRipple?: boolean | undefined;
|
|
25
|
+
edge?: false | "end" | "start" | undefined;
|
|
26
|
+
size?: "medium" | "large" | "small" | undefined;
|
|
27
|
+
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
28
|
+
} & Omit<{
|
|
29
|
+
action?: React.Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
30
|
+
centerRipple?: boolean | undefined;
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
33
|
+
disabled?: boolean | undefined;
|
|
34
|
+
disableRipple?: boolean | undefined;
|
|
35
|
+
disableTouchRipple?: boolean | undefined;
|
|
36
|
+
focusRipple?: boolean | undefined;
|
|
37
|
+
focusVisibleClassName?: string | undefined;
|
|
38
|
+
LinkComponent?: React.ElementType<any> | undefined;
|
|
39
|
+
onFocusVisible?: React.FocusEventHandler<any> | undefined;
|
|
40
|
+
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
41
|
+
tabIndex?: number | undefined;
|
|
42
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
43
|
+
touchRippleRef?: React.Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
44
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
45
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
46
|
+
}, "color" | "size" | "disabled" | "children" | "action" | "tabIndex" | "sx" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge">, "hidden" | "color" | "size" | "icon" | "translate" | "disabled" | "form" | "label" | "slot" | "title" | "children" | "key" | "action" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "type" | "value" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "showInMenu"> | Pick<{
|
|
47
|
+
label: string;
|
|
48
|
+
icon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
49
|
+
} & {
|
|
50
|
+
showInMenu: true;
|
|
51
|
+
} & {
|
|
52
|
+
autoFocus?: boolean | undefined;
|
|
53
|
+
classes?: Partial<import("@mui/material/MenuItem").MenuItemClasses> | undefined;
|
|
54
|
+
dense?: boolean | undefined;
|
|
55
|
+
disabled?: boolean | undefined;
|
|
56
|
+
disableGutters?: boolean | undefined;
|
|
57
|
+
divider?: boolean | undefined;
|
|
58
|
+
selected?: boolean | undefined;
|
|
59
|
+
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
60
|
+
} & Omit<{
|
|
61
|
+
action?: React.Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
62
|
+
centerRipple?: boolean | undefined;
|
|
63
|
+
children?: React.ReactNode;
|
|
64
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
65
|
+
disabled?: boolean | undefined;
|
|
66
|
+
disableRipple?: boolean | undefined;
|
|
67
|
+
disableTouchRipple?: boolean | undefined;
|
|
68
|
+
focusRipple?: boolean | undefined;
|
|
69
|
+
focusVisibleClassName?: string | undefined;
|
|
70
|
+
LinkComponent?: React.ElementType<any> | undefined;
|
|
71
|
+
onFocusVisible?: React.FocusEventHandler<any> | undefined;
|
|
72
|
+
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
73
|
+
tabIndex?: number | undefined;
|
|
74
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
75
|
+
touchRippleRef?: React.Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
76
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof React.LiHTMLAttributes<HTMLLIElement>> & {
|
|
77
|
+
ref?: ((instance: HTMLLIElement | null) => void) | React.RefObject<HTMLLIElement> | null | undefined;
|
|
78
|
+
}, "dense" | "disabled" | "children" | "action" | "autoFocus" | "tabIndex" | "selected" | "sx" | "divider" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableGutters">, "hidden" | "color" | "dense" | "icon" | "translate" | "disabled" | "label" | "slot" | "title" | "children" | "key" | "action" | "autoFocus" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "selected" | "value" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "divider" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableGutters" | "showInMenu">) & React.RefAttributes<HTMLButtonElement>>;
|
|
17
79
|
export { GridActionsCellItem };
|
|
@@ -8,8 +8,7 @@ import MenuItem from '@mui/material/MenuItem';
|
|
|
8
8
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
|
|
12
|
-
const GridActionsCellItem = props => {
|
|
11
|
+
const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
13
12
|
const {
|
|
14
13
|
label,
|
|
15
14
|
icon,
|
|
@@ -26,7 +25,9 @@ const GridActionsCellItem = props => {
|
|
|
26
25
|
|
|
27
26
|
if (!showInMenu) {
|
|
28
27
|
return /*#__PURE__*/_jsx(IconButton, _extends({
|
|
28
|
+
ref: ref,
|
|
29
29
|
size: "small",
|
|
30
|
+
role: "menuitem",
|
|
30
31
|
"aria-label": label
|
|
31
32
|
}, other, {
|
|
32
33
|
onClick: handleClick,
|
|
@@ -36,14 +37,15 @@ const GridActionsCellItem = props => {
|
|
|
36
37
|
}));
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
return /*#__PURE__*/_jsxs(MenuItem, _extends({
|
|
40
|
+
return /*#__PURE__*/_jsxs(MenuItem, _extends({
|
|
41
|
+
ref: ref
|
|
42
|
+
}, other, {
|
|
40
43
|
onClick: onClick,
|
|
41
44
|
children: [icon && /*#__PURE__*/_jsx(ListItemIcon, {
|
|
42
45
|
children: icon
|
|
43
46
|
}), label]
|
|
44
47
|
}));
|
|
45
|
-
};
|
|
46
|
-
|
|
48
|
+
});
|
|
47
49
|
process.env.NODE_ENV !== "production" ? GridActionsCellItem.propTypes = {
|
|
48
50
|
// ----------------------------- Warning --------------------------------
|
|
49
51
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -17,6 +17,7 @@ export interface GridCellProps<V = any, F = V> {
|
|
|
17
17
|
cellMode?: GridCellMode;
|
|
18
18
|
children: React.ReactNode;
|
|
19
19
|
tabIndex: 0 | -1;
|
|
20
|
+
colSpan?: number;
|
|
20
21
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
21
22
|
onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
22
23
|
onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
|