@mui/x-data-grid 9.11.0 → 9.13.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 +317 -0
- package/DataGrid/DataGrid.js +4 -2
- package/DataGrid/DataGrid.mjs +4 -2
- package/DataGrid/useDataGridProps.d.mts +1 -1
- package/DataGrid/useDataGridProps.d.ts +1 -1
- package/components/GridPagination.js +1 -1
- package/components/GridPagination.mjs +1 -1
- package/components/GridRow.d.mts +1 -0
- package/components/GridRow.d.ts +1 -0
- package/components/GridRow.js +41 -6
- package/components/GridRow.mjs +41 -6
- package/components/cell/GridCell.js +21 -5
- package/components/cell/GridCell.mjs +21 -5
- package/components/cell/GridEditBooleanCell.d.mts +1 -1
- package/components/cell/GridEditBooleanCell.d.ts +1 -1
- package/components/cell/GridEditBooleanCell.js +4 -4
- package/components/cell/GridEditBooleanCell.mjs +4 -4
- package/components/cell/GridEditDateCell.d.mts +1 -1
- package/components/cell/GridEditDateCell.d.ts +1 -1
- package/components/cell/GridEditDateCell.js +5 -5
- package/components/cell/GridEditDateCell.mjs +5 -5
- package/components/cell/GridEditInputCell.d.mts +1 -1
- package/components/cell/GridEditInputCell.d.ts +1 -1
- package/components/cell/GridEditInputCell.js +1 -1
- package/components/cell/GridEditInputCell.mjs +1 -1
- package/components/cell/GridEditLongTextCell.d.mts +1 -1
- package/components/cell/GridEditLongTextCell.d.ts +1 -1
- package/components/cell/GridEditLongTextCell.js +2 -2
- package/components/cell/GridEditLongTextCell.mjs +2 -2
- package/components/cell/GridEditSingleSelectCell.d.mts +1 -1
- package/components/cell/GridEditSingleSelectCell.d.ts +1 -1
- package/components/cell/GridEditSingleSelectCell.js +4 -4
- package/components/cell/GridEditSingleSelectCell.mjs +4 -4
- package/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/components/columnHeaders/GridBaseColumnHeaders.mjs +1 -1
- package/components/columnHeaders/GridColumnHeaderItem.js +4 -0
- package/components/columnHeaders/GridColumnHeaderItem.mjs +4 -0
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.mts +7 -0
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +7 -0
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +5 -4
- package/components/columnHeaders/GridGenericColumnHeaderItem.mjs +5 -4
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +18 -6
- package/components/panel/filterPanel/GridFilterInputSingleSelect.mjs +18 -6
- package/components/toolbarV8/Toolbar.d.mts +5 -1
- package/components/toolbarV8/Toolbar.d.ts +5 -1
- package/components/toolbarV8/Toolbar.js +34 -12
- package/components/toolbarV8/Toolbar.mjs +33 -11
- package/constants/gridClasses.d.mts +12 -0
- package/constants/gridClasses.d.ts +12 -0
- package/constants/gridClasses.js +1 -1
- package/constants/gridClasses.mjs +1 -1
- package/constants/localeTextConstants.js +4 -0
- package/constants/localeTextConstants.mjs +4 -0
- package/hooks/core/useGridApiInitialization.js +5 -1
- package/hooks/core/useGridApiInitialization.mjs +5 -1
- package/hooks/core/useGridStateInitialization.js +3 -1
- package/hooks/core/useGridStateInitialization.mjs +3 -1
- package/hooks/core/useGridVirtualizer.js +17 -1
- package/hooks/core/useGridVirtualizer.mjs +17 -1
- package/hooks/features/columnResize/useGridColumnResize.js +5 -0
- package/hooks/features/columnResize/useGridColumnResize.mjs +5 -0
- package/hooks/features/columns/gridColumnsUtils.d.mts +1 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.js +2 -2
- package/hooks/features/columns/gridColumnsUtils.mjs +2 -2
- package/hooks/features/dataSource/gridDataSourceSelector.js +6 -2
- package/hooks/features/dataSource/gridDataSourceSelector.mjs +6 -2
- package/hooks/features/dataSource/models.d.mts +2 -2
- package/hooks/features/dataSource/models.d.ts +2 -2
- package/hooks/features/dataSource/useGridDataSourceBase.js +25 -8
- package/hooks/features/dataSource/useGridDataSourceBase.mjs +26 -9
- package/hooks/features/dataSource/useGridDataSourceFilterModelChange.d.mts +9 -0
- package/hooks/features/dataSource/useGridDataSourceFilterModelChange.d.ts +9 -0
- package/hooks/features/dataSource/useGridDataSourceFilterModelChange.js +57 -0
- package/hooks/features/dataSource/useGridDataSourceFilterModelChange.mjs +49 -0
- package/hooks/features/editing/useGridCellEditing.js +3 -1
- package/hooks/features/editing/useGridCellEditing.mjs +3 -1
- package/hooks/features/editing/useGridRowEditing.js +3 -1
- package/hooks/features/editing/useGridRowEditing.mjs +3 -1
- package/hooks/features/filter/gridFilterUtils.d.mts +13 -0
- package/hooks/features/filter/gridFilterUtils.d.ts +13 -0
- package/hooks/features/filter/gridFilterUtils.js +32 -1
- package/hooks/features/filter/gridFilterUtils.mjs +29 -1
- package/hooks/features/filter/useGridFilter.js +1 -21
- package/hooks/features/filter/useGridFilter.mjs +2 -22
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +1 -1
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.mjs +1 -1
- package/hooks/features/pivoting/gridPivotingInterfaces.d.mts +2 -2
- package/hooks/features/pivoting/gridPivotingInterfaces.d.ts +2 -2
- package/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.mjs +2 -2
- package/hooks/features/rows/gridRowsUtils.d.mts +37 -3
- package/hooks/features/rows/gridRowsUtils.d.ts +37 -3
- package/hooks/features/rows/gridRowsUtils.js +120 -23
- package/hooks/features/rows/gridRowsUtils.mjs +115 -22
- package/hooks/features/rows/useGridRowSpanning.js +5 -0
- package/hooks/features/rows/useGridRowSpanning.mjs +5 -0
- package/hooks/features/rows/useGridRows.js +10 -1
- package/hooks/features/rows/useGridRows.mjs +10 -1
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.mts +1 -1
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +1 -1
- package/hooks/utils/useGridEvent.d.mts +2 -2
- package/hooks/utils/useGridEvent.d.ts +2 -2
- package/hooks/utils/useGridEvent.js +2 -0
- package/hooks/utils/useGridEvent.mjs +2 -0
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/index.d.mts +4 -2
- package/internals/index.d.ts +4 -2
- package/internals/index.js +48 -0
- package/internals/index.mjs +4 -2
- package/locales/arSD.js +5 -0
- package/locales/arSD.mjs +5 -0
- package/locales/beBY.js +5 -0
- package/locales/beBY.mjs +5 -0
- package/locales/bgBG.js +5 -0
- package/locales/bgBG.mjs +5 -0
- package/locales/bnBD.js +5 -0
- package/locales/bnBD.mjs +5 -0
- package/locales/caES.js +5 -0
- package/locales/caES.mjs +5 -0
- package/locales/csCZ.js +5 -0
- package/locales/csCZ.mjs +5 -0
- package/locales/daDK.js +5 -0
- package/locales/daDK.mjs +5 -0
- package/locales/deDE.js +5 -0
- package/locales/deDE.mjs +5 -0
- package/locales/elGR.js +5 -0
- package/locales/elGR.mjs +5 -0
- package/locales/esES.js +5 -0
- package/locales/esES.mjs +5 -0
- package/locales/faIR.js +5 -0
- package/locales/faIR.mjs +5 -0
- package/locales/fiFI.js +5 -0
- package/locales/fiFI.mjs +5 -0
- package/locales/frFR.js +5 -0
- package/locales/frFR.mjs +5 -0
- package/locales/heIL.js +5 -0
- package/locales/heIL.mjs +5 -0
- package/locales/hrHR.js +5 -0
- package/locales/hrHR.mjs +5 -0
- package/locales/huHU.js +5 -0
- package/locales/huHU.mjs +5 -0
- package/locales/hyAM.js +5 -0
- package/locales/hyAM.mjs +5 -0
- package/locales/idID.js +5 -0
- package/locales/idID.mjs +5 -0
- package/locales/isIS.js +5 -0
- package/locales/isIS.mjs +5 -0
- package/locales/itIT.js +5 -0
- package/locales/itIT.mjs +5 -0
- package/locales/jaJP.js +5 -0
- package/locales/jaJP.mjs +5 -0
- package/locales/koKR.js +5 -0
- package/locales/koKR.mjs +5 -0
- package/locales/nbNO.js +5 -0
- package/locales/nbNO.mjs +5 -0
- package/locales/nlNL.js +5 -0
- package/locales/nlNL.mjs +5 -0
- package/locales/nnNO.js +5 -0
- package/locales/nnNO.mjs +5 -0
- package/locales/plPL.js +5 -0
- package/locales/plPL.mjs +5 -0
- package/locales/ptBR.js +5 -0
- package/locales/ptBR.mjs +5 -0
- package/locales/ptPT.js +5 -0
- package/locales/ptPT.mjs +5 -0
- package/locales/roRO.js +5 -0
- package/locales/roRO.mjs +5 -0
- package/locales/ruRU.js +5 -0
- package/locales/ruRU.mjs +5 -0
- package/locales/skSK.js +5 -0
- package/locales/skSK.mjs +5 -0
- package/locales/svSE.js +5 -0
- package/locales/svSE.mjs +5 -0
- package/locales/thTH.js +5 -0
- package/locales/thTH.mjs +5 -0
- package/locales/trTR.js +5 -0
- package/locales/trTR.mjs +5 -0
- package/locales/ukUA.js +5 -0
- package/locales/ukUA.mjs +5 -0
- package/locales/urPK.js +5 -0
- package/locales/urPK.mjs +5 -0
- package/locales/viVN.js +5 -0
- package/locales/viVN.mjs +5 -0
- package/locales/zhCN.js +5 -0
- package/locales/zhCN.mjs +5 -0
- package/locales/zhHK.js +5 -0
- package/locales/zhHK.mjs +5 -0
- package/locales/zhTW.js +5 -0
- package/locales/zhTW.mjs +5 -0
- package/material/variables.d.mts +6 -1
- package/material/variables.d.ts +6 -1
- package/material/variables.js +17 -3
- package/material/variables.mjs +14 -4
- package/models/api/gridApiCommon.d.mts +2 -2
- package/models/api/gridApiCommon.d.ts +2 -2
- package/models/api/gridCallbackDetails.d.mts +11 -1
- package/models/api/gridCallbackDetails.d.ts +11 -1
- package/models/api/gridLocaleTextApi.d.mts +3 -0
- package/models/api/gridLocaleTextApi.d.ts +3 -0
- package/models/api/gridRowApi.d.mts +19 -7
- package/models/api/gridRowApi.d.ts +19 -7
- package/models/api/gridStateApi.d.mts +3 -2
- package/models/api/gridStateApi.d.ts +3 -2
- package/models/api/index.d.mts +1 -1
- package/models/api/index.d.ts +1 -1
- package/models/colDef/gridColDef.d.mts +5 -0
- package/models/colDef/gridColDef.d.ts +5 -0
- package/models/configuration/gridConfiguration.d.mts +13 -1
- package/models/configuration/gridConfiguration.d.ts +13 -1
- package/models/controlStateItem.d.mts +3 -2
- package/models/controlStateItem.d.ts +3 -2
- package/models/events/gridEventListener.d.mts +3 -2
- package/models/events/gridEventListener.d.ts +3 -2
- package/models/gridDataSource.d.mts +3 -0
- package/models/gridDataSource.d.ts +3 -0
- package/models/gridRows.d.mts +28 -1
- package/models/gridRows.d.ts +28 -1
- package/models/props/DataGridProps.d.mts +41 -38
- package/models/props/DataGridProps.d.ts +41 -38
- package/package.json +6 -6
- package/utils/domUtils.js +1 -1
- package/utils/domUtils.mjs +1 -1
- package/utils/getPublicApiRef.d.mts +2 -2
- package/utils/getPublicApiRef.d.ts +2 -2
- package/utils/getPublicApiRef.js +15 -3
- package/utils/getPublicApiRef.mjs +15 -3
- package/utils/keyboardUtils.d.mts +1 -0
- package/utils/keyboardUtils.d.ts +1 -0
- package/utils/keyboardUtils.js +6 -0
- package/utils/keyboardUtils.mjs +5 -0
|
@@ -101,14 +101,17 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
|
|
|
101
101
|
value: forcedValue,
|
|
102
102
|
formattedValue: forcedFormattedValue
|
|
103
103
|
} = cellAggregationResult || {};
|
|
104
|
+
const stateTabIndex = (0, _useGridSelector.useGridSelector)(apiRef, () => {
|
|
105
|
+
const cellTabIndex = (0, _gridFocusStateSelector.gridTabIndexCellSelector)(apiRef);
|
|
106
|
+
return cellTabIndex && cellTabIndex.field === field && cellTabIndex.id === rowId ? 0 : -1;
|
|
107
|
+
});
|
|
104
108
|
const cellParams = apiRef.current.getCellParamsForRow(rowId, field, row, {
|
|
105
109
|
colDef: column,
|
|
106
110
|
cellMode,
|
|
107
111
|
rowNode: rowNode,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}),
|
|
112
|
+
// A cell kept mounted outside the render context is collapsed to zero size, so it must not
|
|
113
|
+
// become the grid's tab stop: tabbing in would move focus to something the user can't see.
|
|
114
|
+
tabIndex: isNotVisible ? -1 : stateTabIndex,
|
|
112
115
|
hasFocus: (0, _useGridSelector.useGridSelector)(apiRef, () => {
|
|
113
116
|
const focus = (0, _gridFocusStateSelector.gridFocusCellSelector)(apiRef);
|
|
114
117
|
return focus?.id === rowId && focus.field === field;
|
|
@@ -231,6 +234,19 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
|
|
|
231
234
|
}
|
|
232
235
|
const doc = (0, _ownerDocument.default)(apiRef.current.rootElementRef.current);
|
|
233
236
|
if (cellRef.current && !cellRef.current.contains(doc.activeElement)) {
|
|
237
|
+
// An external editor can legitimately hold DOM focus for the focused cell
|
|
238
|
+
// (e.g. the Premium formula bar) — the same pipe the document click
|
|
239
|
+
// handler consults decides whether pulling focus back is allowed. The
|
|
240
|
+
// pseudo-event only carries the element that owns the focus.
|
|
241
|
+
const canUpdateFocus = apiRef.current.unstable_applyPipeProcessors('canUpdateFocus', true, {
|
|
242
|
+
event: {
|
|
243
|
+
target: doc.activeElement
|
|
244
|
+
},
|
|
245
|
+
cell: null
|
|
246
|
+
});
|
|
247
|
+
if (!canUpdateFocus) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
234
250
|
const focusableElement = cellRef.current.querySelector('[tabindex="0"]');
|
|
235
251
|
const elementToFocus = focusableElement || cellRef.current;
|
|
236
252
|
(0, _focusElement.focusElement)(elementToFocus, apiRef);
|
|
@@ -291,7 +307,7 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
|
|
|
291
307
|
};
|
|
292
308
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", (0, _extends2.default)({
|
|
293
309
|
className: (0, _clsx.default)(classes.root, classNames, className),
|
|
294
|
-
role:
|
|
310
|
+
role: column.rowHeader ? 'rowheader' : 'gridcell',
|
|
295
311
|
"data-field": field,
|
|
296
312
|
"data-colindex": colIndex,
|
|
297
313
|
"aria-colindex": colIndex + 1,
|
|
@@ -94,14 +94,17 @@ const GridCell = forwardRef(function GridCell(props, ref) {
|
|
|
94
94
|
value: forcedValue,
|
|
95
95
|
formattedValue: forcedFormattedValue
|
|
96
96
|
} = cellAggregationResult || {};
|
|
97
|
+
const stateTabIndex = useGridSelector(apiRef, () => {
|
|
98
|
+
const cellTabIndex = gridTabIndexCellSelector(apiRef);
|
|
99
|
+
return cellTabIndex && cellTabIndex.field === field && cellTabIndex.id === rowId ? 0 : -1;
|
|
100
|
+
});
|
|
97
101
|
const cellParams = apiRef.current.getCellParamsForRow(rowId, field, row, {
|
|
98
102
|
colDef: column,
|
|
99
103
|
cellMode,
|
|
100
104
|
rowNode: rowNode,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}),
|
|
105
|
+
// A cell kept mounted outside the render context is collapsed to zero size, so it must not
|
|
106
|
+
// become the grid's tab stop: tabbing in would move focus to something the user can't see.
|
|
107
|
+
tabIndex: isNotVisible ? -1 : stateTabIndex,
|
|
105
108
|
hasFocus: useGridSelector(apiRef, () => {
|
|
106
109
|
const focus = gridFocusCellSelector(apiRef);
|
|
107
110
|
return focus?.id === rowId && focus.field === field;
|
|
@@ -224,6 +227,19 @@ const GridCell = forwardRef(function GridCell(props, ref) {
|
|
|
224
227
|
}
|
|
225
228
|
const doc = ownerDocument(apiRef.current.rootElementRef.current);
|
|
226
229
|
if (cellRef.current && !cellRef.current.contains(doc.activeElement)) {
|
|
230
|
+
// An external editor can legitimately hold DOM focus for the focused cell
|
|
231
|
+
// (e.g. the Premium formula bar) — the same pipe the document click
|
|
232
|
+
// handler consults decides whether pulling focus back is allowed. The
|
|
233
|
+
// pseudo-event only carries the element that owns the focus.
|
|
234
|
+
const canUpdateFocus = apiRef.current.unstable_applyPipeProcessors('canUpdateFocus', true, {
|
|
235
|
+
event: {
|
|
236
|
+
target: doc.activeElement
|
|
237
|
+
},
|
|
238
|
+
cell: null
|
|
239
|
+
});
|
|
240
|
+
if (!canUpdateFocus) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
227
243
|
const focusableElement = cellRef.current.querySelector('[tabindex="0"]');
|
|
228
244
|
const elementToFocus = focusableElement || cellRef.current;
|
|
229
245
|
focusElement(elementToFocus, apiRef);
|
|
@@ -284,7 +300,7 @@ const GridCell = forwardRef(function GridCell(props, ref) {
|
|
|
284
300
|
};
|
|
285
301
|
return /*#__PURE__*/_jsx("div", _extends({
|
|
286
302
|
className: clsx(classes.root, classNames, className),
|
|
287
|
-
role:
|
|
303
|
+
role: column.rowHeader ? 'rowheader' : 'gridcell',
|
|
288
304
|
"data-field": field,
|
|
289
305
|
"data-colindex": colIndex,
|
|
290
306
|
"aria-colindex": colIndex + 1,
|
|
@@ -5,7 +5,7 @@ export interface GridEditBooleanCellProps extends GridRenderEditCellParams, Omit
|
|
|
5
5
|
* Callback called when the value is changed by the user.
|
|
6
6
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
7
7
|
* @param {boolean} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
8
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
8
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
9
9
|
*/
|
|
10
10
|
onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: boolean) => Promise<void> | void;
|
|
11
11
|
}
|
|
@@ -5,7 +5,7 @@ export interface GridEditBooleanCellProps extends GridRenderEditCellParams, Omit
|
|
|
5
5
|
* Callback called when the value is changed by the user.
|
|
6
6
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
7
7
|
* @param {boolean} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
8
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
8
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
9
9
|
*/
|
|
10
10
|
onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: boolean) => Promise<void> | void;
|
|
11
11
|
}
|
|
@@ -51,15 +51,15 @@ function GridEditBooleanCell(props) {
|
|
|
51
51
|
const classes = useUtilityClasses(ownerState);
|
|
52
52
|
const handleChange = React.useCallback(async event => {
|
|
53
53
|
const newValue = event.target.checked;
|
|
54
|
-
if (onValueChange) {
|
|
55
|
-
await onValueChange(event, newValue);
|
|
56
|
-
}
|
|
57
54
|
setValueState(newValue);
|
|
58
55
|
await apiRef.current.setEditCellValue({
|
|
59
56
|
id: idProp,
|
|
60
57
|
field,
|
|
61
58
|
value: newValue
|
|
62
59
|
}, event);
|
|
60
|
+
if (onValueChange) {
|
|
61
|
+
await onValueChange(event, newValue);
|
|
62
|
+
}
|
|
63
63
|
}, [apiRef, field, idProp, onValueChange]);
|
|
64
64
|
React.useEffect(() => {
|
|
65
65
|
setValueState(value);
|
|
@@ -126,7 +126,7 @@ process.env.NODE_ENV !== "production" ? GridEditBooleanCell.propTypes /* remove-
|
|
|
126
126
|
* Callback called when the value is changed by the user.
|
|
127
127
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
128
128
|
* @param {boolean} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
129
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
129
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
130
130
|
*/
|
|
131
131
|
onValueChange: _propTypes.default.func,
|
|
132
132
|
/**
|
|
@@ -43,15 +43,15 @@ function GridEditBooleanCell(props) {
|
|
|
43
43
|
const classes = useUtilityClasses(ownerState);
|
|
44
44
|
const handleChange = React.useCallback(async event => {
|
|
45
45
|
const newValue = event.target.checked;
|
|
46
|
-
if (onValueChange) {
|
|
47
|
-
await onValueChange(event, newValue);
|
|
48
|
-
}
|
|
49
46
|
setValueState(newValue);
|
|
50
47
|
await apiRef.current.setEditCellValue({
|
|
51
48
|
id: idProp,
|
|
52
49
|
field,
|
|
53
50
|
value: newValue
|
|
54
51
|
}, event);
|
|
52
|
+
if (onValueChange) {
|
|
53
|
+
await onValueChange(event, newValue);
|
|
54
|
+
}
|
|
55
55
|
}, [apiRef, field, idProp, onValueChange]);
|
|
56
56
|
React.useEffect(() => {
|
|
57
57
|
setValueState(value);
|
|
@@ -118,7 +118,7 @@ process.env.NODE_ENV !== "production" ? GridEditBooleanCell.propTypes /* remove-
|
|
|
118
118
|
* Callback called when the value is changed by the user.
|
|
119
119
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
120
120
|
* @param {boolean} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
121
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
121
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
122
122
|
*/
|
|
123
123
|
onValueChange: PropTypes.func,
|
|
124
124
|
/**
|
|
@@ -6,7 +6,7 @@ export interface GridEditDateCellProps extends GridRenderEditCellParams {
|
|
|
6
6
|
* Callback called when the value is changed by the user.
|
|
7
7
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
8
8
|
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
9
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
9
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
10
10
|
*/
|
|
11
11
|
onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: Date | null) => Promise<void> | void;
|
|
12
12
|
slotProps?: {
|
|
@@ -6,7 +6,7 @@ export interface GridEditDateCellProps extends GridRenderEditCellParams {
|
|
|
6
6
|
* Callback called when the value is changed by the user.
|
|
7
7
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
8
8
|
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
9
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
9
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
10
10
|
*/
|
|
11
11
|
onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: Date | null) => Promise<void> | void;
|
|
12
12
|
slotProps?: {
|
|
@@ -94,18 +94,18 @@ function GridEditDateCell(props) {
|
|
|
94
94
|
const handleChange = React.useCallback(async event => {
|
|
95
95
|
const newFormattedDate = event.target.value;
|
|
96
96
|
const newParsedDate = parseValueToDate(newFormattedDate);
|
|
97
|
-
if (onValueChange) {
|
|
98
|
-
await onValueChange(event, newParsedDate);
|
|
99
|
-
}
|
|
100
97
|
setValueState({
|
|
101
98
|
parsed: newParsedDate,
|
|
102
99
|
formatted: newFormattedDate
|
|
103
100
|
});
|
|
104
|
-
apiRef.current.setEditCellValue({
|
|
101
|
+
await apiRef.current.setEditCellValue({
|
|
105
102
|
id,
|
|
106
103
|
field,
|
|
107
104
|
value: newParsedDate
|
|
108
105
|
}, event);
|
|
106
|
+
if (onValueChange) {
|
|
107
|
+
await onValueChange(event, newParsedDate);
|
|
108
|
+
}
|
|
109
109
|
}, [apiRef, field, id, onValueChange, parseValueToDate]);
|
|
110
110
|
React.useEffect(() => {
|
|
111
111
|
setValueState(state => {
|
|
@@ -180,7 +180,7 @@ process.env.NODE_ENV !== "production" ? GridEditDateCell.propTypes /* remove-pro
|
|
|
180
180
|
* Callback called when the value is changed by the user.
|
|
181
181
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
182
182
|
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
183
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
183
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
184
184
|
*/
|
|
185
185
|
onValueChange: _propTypes.default.func,
|
|
186
186
|
/**
|
|
@@ -86,18 +86,18 @@ function GridEditDateCell(props) {
|
|
|
86
86
|
const handleChange = React.useCallback(async event => {
|
|
87
87
|
const newFormattedDate = event.target.value;
|
|
88
88
|
const newParsedDate = parseValueToDate(newFormattedDate);
|
|
89
|
-
if (onValueChange) {
|
|
90
|
-
await onValueChange(event, newParsedDate);
|
|
91
|
-
}
|
|
92
89
|
setValueState({
|
|
93
90
|
parsed: newParsedDate,
|
|
94
91
|
formatted: newFormattedDate
|
|
95
92
|
});
|
|
96
|
-
apiRef.current.setEditCellValue({
|
|
93
|
+
await apiRef.current.setEditCellValue({
|
|
97
94
|
id,
|
|
98
95
|
field,
|
|
99
96
|
value: newParsedDate
|
|
100
97
|
}, event);
|
|
98
|
+
if (onValueChange) {
|
|
99
|
+
await onValueChange(event, newParsedDate);
|
|
100
|
+
}
|
|
101
101
|
}, [apiRef, field, id, onValueChange, parseValueToDate]);
|
|
102
102
|
React.useEffect(() => {
|
|
103
103
|
setValueState(state => {
|
|
@@ -172,7 +172,7 @@ process.env.NODE_ENV !== "production" ? GridEditDateCell.propTypes /* remove-pro
|
|
|
172
172
|
* Callback called when the value is changed by the user.
|
|
173
173
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
174
174
|
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
175
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
175
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
176
176
|
*/
|
|
177
177
|
onValueChange: PropTypes.func,
|
|
178
178
|
/**
|
|
@@ -7,7 +7,7 @@ export interface GridEditInputCellProps extends GridRenderEditCellParams {
|
|
|
7
7
|
* Callback called when the value is changed by the user.
|
|
8
8
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
9
9
|
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
10
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
10
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
11
11
|
*/
|
|
12
12
|
onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: string) => Promise<void> | void;
|
|
13
13
|
slotProps?: {
|
|
@@ -7,7 +7,7 @@ export interface GridEditInputCellProps extends GridRenderEditCellParams {
|
|
|
7
7
|
* Callback called when the value is changed by the user.
|
|
8
8
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
9
9
|
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
10
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
10
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
11
11
|
*/
|
|
12
12
|
onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: string) => Promise<void> | void;
|
|
13
13
|
slotProps?: {
|
|
@@ -153,7 +153,7 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes /* remove-pr
|
|
|
153
153
|
* Callback called when the value is changed by the user.
|
|
154
154
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
155
155
|
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
156
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
156
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
157
157
|
*/
|
|
158
158
|
onValueChange: _propTypes.default.func,
|
|
159
159
|
/**
|
|
@@ -146,7 +146,7 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes /* remove-pr
|
|
|
146
146
|
* Callback called when the value is changed by the user.
|
|
147
147
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
148
148
|
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
149
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
149
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
150
150
|
*/
|
|
151
151
|
onValueChange: PropTypes.func,
|
|
152
152
|
/**
|
|
@@ -7,7 +7,7 @@ export interface GridEditLongTextCellProps extends GridRenderEditCellParams<any,
|
|
|
7
7
|
* Callback called when the value is changed by the user.
|
|
8
8
|
* @param {React.ChangeEvent<HTMLTextAreaElement>} event The event source of the callback.
|
|
9
9
|
* @param {string} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
10
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
10
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
11
11
|
*/
|
|
12
12
|
onValueChange?: (event: React.ChangeEvent<HTMLTextAreaElement>, newValue: string) => Promise<void> | void;
|
|
13
13
|
/**
|
|
@@ -7,7 +7,7 @@ export interface GridEditLongTextCellProps extends GridRenderEditCellParams<any,
|
|
|
7
7
|
* Callback called when the value is changed by the user.
|
|
8
8
|
* @param {React.ChangeEvent<HTMLTextAreaElement>} event The event source of the callback.
|
|
9
9
|
* @param {string} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
10
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
10
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
11
11
|
*/
|
|
12
12
|
onValueChange?: (event: React.ChangeEvent<HTMLTextAreaElement>, newValue: string) => Promise<void> | void;
|
|
13
13
|
/**
|
|
@@ -217,7 +217,7 @@ process.env.NODE_ENV !== "production" ? GridEditLongTextCell.propTypes /* remove
|
|
|
217
217
|
* Callback called when the value is changed by the user.
|
|
218
218
|
* @param {React.ChangeEvent<HTMLTextAreaElement>} event The event source of the callback.
|
|
219
219
|
* @param {string} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
220
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
220
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
221
221
|
*/
|
|
222
222
|
onValueChange: _propTypes.default.func,
|
|
223
223
|
/**
|
|
@@ -359,7 +359,7 @@ process.env.NODE_ENV !== "production" ? GridEditLongTextarea.propTypes /* remove
|
|
|
359
359
|
* Callback called when the value is changed by the user.
|
|
360
360
|
* @param {React.ChangeEvent<HTMLTextAreaElement>} event The event source of the callback.
|
|
361
361
|
* @param {string} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
362
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
362
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
363
363
|
*/
|
|
364
364
|
onValueChange: _propTypes.default.func,
|
|
365
365
|
/**
|
|
@@ -209,7 +209,7 @@ process.env.NODE_ENV !== "production" ? GridEditLongTextCell.propTypes /* remove
|
|
|
209
209
|
* Callback called when the value is changed by the user.
|
|
210
210
|
* @param {React.ChangeEvent<HTMLTextAreaElement>} event The event source of the callback.
|
|
211
211
|
* @param {string} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
212
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
212
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
213
213
|
*/
|
|
214
214
|
onValueChange: PropTypes.func,
|
|
215
215
|
/**
|
|
@@ -351,7 +351,7 @@ process.env.NODE_ENV !== "production" ? GridEditLongTextarea.propTypes /* remove
|
|
|
351
351
|
* Callback called when the value is changed by the user.
|
|
352
352
|
* @param {React.ChangeEvent<HTMLTextAreaElement>} event The event source of the callback.
|
|
353
353
|
* @param {string} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
354
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
354
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
355
355
|
*/
|
|
356
356
|
onValueChange: PropTypes.func,
|
|
357
357
|
/**
|
|
@@ -6,7 +6,7 @@ export interface GridEditSingleSelectCellProps extends GridRenderEditCellParams
|
|
|
6
6
|
* Callback called when the value is changed by the user.
|
|
7
7
|
* @param {Event<any>} event The event source of the callback.
|
|
8
8
|
* @param {any} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
9
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
9
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
10
10
|
*/
|
|
11
11
|
onValueChange?: (event: Parameters<NonNullable<GridSlotProps['baseSelect']['onOpen']>>[0], newValue: any) => Promise<void> | void;
|
|
12
12
|
/**
|
|
@@ -6,7 +6,7 @@ export interface GridEditSingleSelectCellProps extends GridRenderEditCellParams
|
|
|
6
6
|
* Callback called when the value is changed by the user.
|
|
7
7
|
* @param {Event<any>} event The event source of the callback.
|
|
8
8
|
* @param {any} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
9
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
9
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
10
10
|
*/
|
|
11
11
|
onValueChange?: (event: Parameters<NonNullable<GridSlotProps['baseSelect']['onOpen']>>[0], newValue: any) => Promise<void> | void;
|
|
12
12
|
/**
|
|
@@ -70,14 +70,14 @@ function GridEditSingleSelectCell(props) {
|
|
|
70
70
|
const target = event.target;
|
|
71
71
|
// NativeSelect casts the value to a string.
|
|
72
72
|
const formattedTargetValue = (0, _filterPanelUtils.getValueFromValueOptions)(target.value, valueOptions, getOptionValue);
|
|
73
|
-
if (onValueChange) {
|
|
74
|
-
await onValueChange(event, formattedTargetValue);
|
|
75
|
-
}
|
|
76
73
|
await apiRef.current.setEditCellValue({
|
|
77
74
|
id,
|
|
78
75
|
field,
|
|
79
76
|
value: formattedTargetValue
|
|
80
77
|
}, event);
|
|
78
|
+
if (onValueChange) {
|
|
79
|
+
await onValueChange(event, formattedTargetValue);
|
|
80
|
+
}
|
|
81
81
|
};
|
|
82
82
|
const handleClose = (event, reason) => {
|
|
83
83
|
if (rootProps.editMode === _gridEditRowModel.GridEditModes.Row) {
|
|
@@ -174,7 +174,7 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes /* re
|
|
|
174
174
|
* Callback called when the value is changed by the user.
|
|
175
175
|
* @param {Event<any>} event The event source of the callback.
|
|
176
176
|
* @param {any} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
177
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
177
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
178
178
|
*/
|
|
179
179
|
onValueChange: _propTypes.default.func,
|
|
180
180
|
/**
|
|
@@ -62,14 +62,14 @@ function GridEditSingleSelectCell(props) {
|
|
|
62
62
|
const target = event.target;
|
|
63
63
|
// NativeSelect casts the value to a string.
|
|
64
64
|
const formattedTargetValue = getValueFromValueOptions(target.value, valueOptions, getOptionValue);
|
|
65
|
-
if (onValueChange) {
|
|
66
|
-
await onValueChange(event, formattedTargetValue);
|
|
67
|
-
}
|
|
68
65
|
await apiRef.current.setEditCellValue({
|
|
69
66
|
id,
|
|
70
67
|
field,
|
|
71
68
|
value: formattedTargetValue
|
|
72
69
|
}, event);
|
|
70
|
+
if (onValueChange) {
|
|
71
|
+
await onValueChange(event, formattedTargetValue);
|
|
72
|
+
}
|
|
73
73
|
};
|
|
74
74
|
const handleClose = (event, reason) => {
|
|
75
75
|
if (rootProps.editMode === GridEditModes.Row) {
|
|
@@ -166,7 +166,7 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes /* re
|
|
|
166
166
|
* Callback called when the value is changed by the user.
|
|
167
167
|
* @param {Event<any>} event The event source of the callback.
|
|
168
168
|
* @param {any} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
169
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
169
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
170
170
|
*/
|
|
171
171
|
onValueChange: PropTypes.func,
|
|
172
172
|
/**
|
|
@@ -18,6 +18,7 @@ var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
|
18
18
|
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
19
19
|
var _focusElement = require("../../utils/focusElement");
|
|
20
20
|
var _useGridPrivateApiContext = require("../../hooks/utils/useGridPrivateApiContext");
|
|
21
|
+
var _useGridConfiguration = require("../../hooks/utils/useGridConfiguration");
|
|
21
22
|
var _getColumnMenuItemKeys = require("../../hooks/features/columnMenu/getColumnMenuItemKeys");
|
|
22
23
|
var _ColumnHeaderMenuIcon = require("./ColumnHeaderMenuIcon");
|
|
23
24
|
var _GridColumnHeaderMenu = require("../menu/columnMenu/GridColumnHeaderMenu");
|
|
@@ -81,8 +82,10 @@ function GridColumnHeaderItem(props) {
|
|
|
81
82
|
pinnedOffset
|
|
82
83
|
} = props;
|
|
83
84
|
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
85
|
+
const configuration = (0, _useGridConfiguration.useGridConfiguration)();
|
|
84
86
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
85
87
|
const isRtl = (0, _RtlProvider.useRtl)();
|
|
88
|
+
const adornment = configuration.hooks.useColumnHeaderAdornment(colDef.field);
|
|
86
89
|
const headerCellRef = React.useRef(null);
|
|
87
90
|
const columnMenuId = (0, _useId.default)();
|
|
88
91
|
const columnMenuButtonId = (0, _useId.default)();
|
|
@@ -232,6 +235,7 @@ function GridColumnHeaderItem(props) {
|
|
|
232
235
|
separatorSide: separatorSide,
|
|
233
236
|
isDraggable: isDraggable,
|
|
234
237
|
headerComponent: headerComponent,
|
|
238
|
+
adornment: adornment,
|
|
235
239
|
description: colDef.description,
|
|
236
240
|
elementId: colDef.field,
|
|
237
241
|
width: colDef.computedWidth,
|
|
@@ -11,6 +11,7 @@ import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
|
11
11
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
12
12
|
import { focusElement } from "../../utils/focusElement.mjs";
|
|
13
13
|
import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.mjs";
|
|
14
|
+
import { useGridConfiguration } from "../../hooks/utils/useGridConfiguration.mjs";
|
|
14
15
|
import { getColumnMenuItemKeys } from "../../hooks/features/columnMenu/getColumnMenuItemKeys.mjs";
|
|
15
16
|
import { ColumnHeaderMenuIcon } from "./ColumnHeaderMenuIcon.mjs";
|
|
16
17
|
import { GridColumnHeaderMenu } from "../menu/columnMenu/GridColumnHeaderMenu.mjs";
|
|
@@ -74,8 +75,10 @@ function GridColumnHeaderItem(props) {
|
|
|
74
75
|
pinnedOffset
|
|
75
76
|
} = props;
|
|
76
77
|
const apiRef = useGridPrivateApiContext();
|
|
78
|
+
const configuration = useGridConfiguration();
|
|
77
79
|
const rootProps = useGridRootProps();
|
|
78
80
|
const isRtl = useRtl();
|
|
81
|
+
const adornment = configuration.hooks.useColumnHeaderAdornment(colDef.field);
|
|
79
82
|
const headerCellRef = React.useRef(null);
|
|
80
83
|
const columnMenuId = useId();
|
|
81
84
|
const columnMenuButtonId = useId();
|
|
@@ -225,6 +228,7 @@ function GridColumnHeaderItem(props) {
|
|
|
225
228
|
separatorSide: separatorSide,
|
|
226
229
|
isDraggable: isDraggable,
|
|
227
230
|
headerComponent: headerComponent,
|
|
231
|
+
adornment: adornment,
|
|
228
232
|
description: colDef.description,
|
|
229
233
|
elementId: colDef.field,
|
|
230
234
|
width: colDef.computedWidth,
|
|
@@ -23,6 +23,13 @@ interface GridGenericColumnHeaderItemProps extends Pick<GridStateColDef, 'header
|
|
|
23
23
|
columnMenuIconButton?: React.ReactNode;
|
|
24
24
|
columnMenu?: React.ReactNode;
|
|
25
25
|
columnTitleIconButtons?: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Optional adornment rendered at the start of the title content, before the
|
|
28
|
+
* title label (used by the Premium formula feature for A1 column letters).
|
|
29
|
+
* Placing it inside the (non-reversed) title content keeps it on the same
|
|
30
|
+
* side of the title for both left- and right-aligned headers.
|
|
31
|
+
*/
|
|
32
|
+
adornment?: React.ReactNode;
|
|
26
33
|
label: string;
|
|
27
34
|
draggableContainerProps?: Partial<React.HTMLProps<HTMLDivElement>>;
|
|
28
35
|
columnHeaderSeparatorProps?: Partial<GridColumnHeaderSeparatorProps>;
|
|
@@ -23,6 +23,13 @@ interface GridGenericColumnHeaderItemProps extends Pick<GridStateColDef, 'header
|
|
|
23
23
|
columnMenuIconButton?: React.ReactNode;
|
|
24
24
|
columnMenu?: React.ReactNode;
|
|
25
25
|
columnTitleIconButtons?: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Optional adornment rendered at the start of the title content, before the
|
|
28
|
+
* title label (used by the Premium formula feature for A1 column letters).
|
|
29
|
+
* Placing it inside the (non-reversed) title content keeps it on the same
|
|
30
|
+
* side of the title for both left- and right-aligned headers.
|
|
31
|
+
*/
|
|
32
|
+
adornment?: React.ReactNode;
|
|
26
33
|
label: string;
|
|
27
34
|
draggableContainerProps?: Partial<React.HTMLProps<HTMLDivElement>>;
|
|
28
35
|
columnHeaderSeparatorProps?: Partial<GridColumnHeaderSeparatorProps>;
|
|
@@ -17,7 +17,7 @@ var _GridColumnHeaderTitle = require("./GridColumnHeaderTitle");
|
|
|
17
17
|
var _GridColumnHeaderSeparator = require("./GridColumnHeaderSeparator");
|
|
18
18
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const _excluded = ["classes", "columnMenuOpen", "colIndex", "height", "isResizing", "sortDirection", "hasFocus", "tabIndex", "separatorSide", "isDraggable", "headerComponent", "description", "elementId", "width", "columnMenuIconButton", "columnMenu", "columnTitleIconButtons", "headerClassName", "label", "resizable", "draggableContainerProps", "columnHeaderSeparatorProps", "style"];
|
|
20
|
+
const _excluded = ["classes", "columnMenuOpen", "colIndex", "height", "isResizing", "sortDirection", "hasFocus", "tabIndex", "separatorSide", "isDraggable", "headerComponent", "description", "elementId", "width", "columnMenuIconButton", "columnMenu", "columnTitleIconButtons", "adornment", "headerClassName", "label", "resizable", "draggableContainerProps", "columnHeaderSeparatorProps", "style"];
|
|
21
21
|
const GridGenericColumnHeaderItem = exports.GridGenericColumnHeaderItem = (0, _forwardRef.forwardRef)(function GridGenericColumnHeaderItem(props, ref) {
|
|
22
22
|
const {
|
|
23
23
|
classes,
|
|
@@ -34,6 +34,7 @@ const GridGenericColumnHeaderItem = exports.GridGenericColumnHeaderItem = (0, _f
|
|
|
34
34
|
columnMenuIconButton = null,
|
|
35
35
|
columnMenu = null,
|
|
36
36
|
columnTitleIconButtons = null,
|
|
37
|
+
adornment = null,
|
|
37
38
|
headerClassName,
|
|
38
39
|
label,
|
|
39
40
|
resizable,
|
|
@@ -68,13 +69,13 @@ const GridGenericColumnHeaderItem = exports.GridGenericColumnHeaderItem = (0, _f
|
|
|
68
69
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
69
70
|
className: classes.titleContainer,
|
|
70
71
|
role: "none",
|
|
71
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
72
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
72
73
|
className: classes.titleContainerContent,
|
|
73
|
-
children: headerComponent !== undefined ? headerComponent : /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridColumnHeaderTitle.GridColumnHeaderTitle, {
|
|
74
|
+
children: [adornment, headerComponent !== undefined ? headerComponent : /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridColumnHeaderTitle.GridColumnHeaderTitle, {
|
|
74
75
|
label: label,
|
|
75
76
|
description: description,
|
|
76
77
|
columnWidth: width
|
|
77
|
-
})
|
|
78
|
+
})]
|
|
78
79
|
}), columnTitleIconButtons]
|
|
79
80
|
}), columnMenuIconButton]
|
|
80
81
|
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridColumnHeaderSeparator.GridColumnHeaderSeparator, (0, _extends2.default)({
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["classes", "columnMenuOpen", "colIndex", "height", "isResizing", "sortDirection", "hasFocus", "tabIndex", "separatorSide", "isDraggable", "headerComponent", "description", "elementId", "width", "columnMenuIconButton", "columnMenu", "columnTitleIconButtons", "headerClassName", "label", "resizable", "draggableContainerProps", "columnHeaderSeparatorProps", "style"];
|
|
5
|
+
const _excluded = ["classes", "columnMenuOpen", "colIndex", "height", "isResizing", "sortDirection", "hasFocus", "tabIndex", "separatorSide", "isDraggable", "headerComponent", "description", "elementId", "width", "columnMenuIconButton", "columnMenu", "columnTitleIconButtons", "adornment", "headerClassName", "label", "resizable", "draggableContainerProps", "columnHeaderSeparatorProps", "style"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import useForkRef from '@mui/utils/useForkRef';
|
|
@@ -27,6 +27,7 @@ const GridGenericColumnHeaderItem = forwardRef(function GridGenericColumnHeaderI
|
|
|
27
27
|
columnMenuIconButton = null,
|
|
28
28
|
columnMenu = null,
|
|
29
29
|
columnTitleIconButtons = null,
|
|
30
|
+
adornment = null,
|
|
30
31
|
headerClassName,
|
|
31
32
|
label,
|
|
32
33
|
resizable,
|
|
@@ -61,13 +62,13 @@ const GridGenericColumnHeaderItem = forwardRef(function GridGenericColumnHeaderI
|
|
|
61
62
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
62
63
|
className: classes.titleContainer,
|
|
63
64
|
role: "none",
|
|
64
|
-
children: [/*#__PURE__*/
|
|
65
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
65
66
|
className: classes.titleContainerContent,
|
|
66
|
-
children: headerComponent !== undefined ? headerComponent : /*#__PURE__*/_jsx(GridColumnHeaderTitle, {
|
|
67
|
+
children: [adornment, headerComponent !== undefined ? headerComponent : /*#__PURE__*/_jsx(GridColumnHeaderTitle, {
|
|
67
68
|
label: label,
|
|
68
69
|
description: description,
|
|
69
70
|
columnWidth: width
|
|
70
|
-
})
|
|
71
|
+
})]
|
|
71
72
|
}), columnTitleIconButtons]
|
|
72
73
|
}), columnMenuIconButton]
|
|
73
74
|
})), /*#__PURE__*/_jsx(GridColumnHeaderSeparator, _extends({
|