@mui/x-data-grid 7.0.0-alpha.2 → 7.0.0-alpha.3
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 +241 -0
- package/DataGrid/DataGrid.d.ts +0 -10
- package/DataGrid/DataGrid.js +11 -23
- package/DataGrid/useDataGridProps.js +1 -1
- package/README.md +0 -1
- package/components/GridHeader.js +3 -2
- package/components/GridRow.js +2 -4
- package/components/cell/GridCell.js +3 -3
- package/components/cell/GridEditDateCell.js +1 -20
- package/components/columnHeaders/GridColumnGroupHeader.js +2 -1
- package/components/columnHeaders/GridColumnHeaderItem.js +2 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
- package/components/panel/filterPanel/GridFilterForm.js +2 -2
- package/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/components/panel/index.d.ts +0 -1
- package/components/panel/index.js +0 -1
- package/constants/defaultGridSlotsComponents.js +1 -2
- package/hooks/features/clipboard/useGridClipboard.d.ts +1 -1
- package/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/hooks/features/editing/useGridCellEditing.js +8 -21
- package/hooks/features/editing/useGridRowEditing.js +7 -21
- package/hooks/features/export/useGridCsvExport.d.ts +1 -1
- package/hooks/features/export/useGridCsvExport.js +1 -1
- package/hooks/features/filter/gridFilterUtils.d.ts +1 -0
- package/hooks/features/filter/gridFilterUtils.js +7 -4
- package/hooks/features/filter/useGridFilter.js +2 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/hooks/features/sorting/useGridSorting.js +6 -5
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/legacy/DataGrid/DataGrid.js +11 -23
- package/legacy/DataGrid/useDataGridProps.js +1 -1
- package/legacy/components/GridHeader.js +3 -2
- package/legacy/components/GridRow.js +2 -4
- package/legacy/components/cell/GridCell.js +3 -3
- package/legacy/components/cell/GridEditDateCell.js +1 -20
- package/legacy/components/columnHeaders/GridColumnGroupHeader.js +2 -1
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +2 -1
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterForm.js +2 -2
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/legacy/components/panel/index.js +0 -1
- package/legacy/constants/defaultGridSlotsComponents.js +1 -2
- package/legacy/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/legacy/hooks/features/editing/useGridCellEditing.js +8 -21
- package/legacy/hooks/features/editing/useGridRowEditing.js +7 -23
- package/legacy/hooks/features/export/useGridCsvExport.js +1 -1
- package/legacy/hooks/features/filter/gridFilterUtils.js +7 -4
- package/legacy/hooks/features/filter/useGridFilter.js +2 -2
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -1
- package/legacy/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/legacy/hooks/features/sorting/useGridSorting.js +6 -5
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -1
- package/legacy/locales/bgBG.js +33 -37
- package/legacy/models/params/gridEditCellParams.js +1 -0
- package/legacy/utils/domUtils.js +10 -1
- package/locales/bgBG.js +33 -37
- package/models/api/gridEditingApi.d.ts +2 -4
- package/models/api/gridSortApi.d.ts +2 -2
- package/models/gridFilterModel.d.ts +2 -2
- package/models/gridSlotsComponent.d.ts +0 -5
- package/models/gridSlotsComponentsProps.d.ts +0 -3
- package/models/params/gridEditCellParams.d.ts +3 -1
- package/models/params/gridEditCellParams.js +1 -0
- package/models/params/gridRowParams.d.ts +1 -0
- package/models/props/DataGridProps.d.ts +1 -1
- package/modern/DataGrid/DataGrid.js +11 -23
- package/modern/DataGrid/useDataGridProps.js +1 -1
- package/modern/components/GridHeader.js +2 -1
- package/modern/components/GridRow.js +2 -4
- package/modern/components/cell/GridCell.js +2 -2
- package/modern/components/cell/GridEditDateCell.js +1 -20
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +2 -1
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +2 -1
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterForm.js +2 -2
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/modern/components/panel/index.js +0 -1
- package/modern/constants/defaultGridSlotsComponents.js +1 -2
- package/modern/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/modern/hooks/features/editing/useGridCellEditing.js +8 -21
- package/modern/hooks/features/editing/useGridRowEditing.js +7 -21
- package/modern/hooks/features/export/useGridCsvExport.js +1 -1
- package/modern/hooks/features/filter/gridFilterUtils.js +4 -2
- package/modern/hooks/features/filter/useGridFilter.js +2 -2
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/modern/hooks/features/sorting/useGridSorting.js +6 -5
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/locales/bgBG.js +33 -37
- package/modern/models/params/gridEditCellParams.js +1 -0
- package/modern/utils/domUtils.js +10 -1
- package/node/DataGrid/DataGrid.js +11 -23
- package/node/DataGrid/useDataGridProps.js +1 -1
- package/node/components/GridHeader.js +2 -1
- package/node/components/GridRow.js +1 -3
- package/node/components/cell/GridCell.js +2 -2
- package/node/components/cell/GridEditDateCell.js +1 -20
- package/node/components/columnHeaders/GridColumnGroupHeader.js +2 -1
- package/node/components/columnHeaders/GridColumnHeaderItem.js +2 -1
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
- package/node/components/panel/filterPanel/GridFilterForm.js +2 -2
- package/node/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/node/components/panel/index.js +0 -11
- package/node/constants/defaultGridSlotsComponents.js +0 -1
- package/node/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/node/hooks/features/editing/useGridCellEditing.js +7 -20
- package/node/hooks/features/editing/useGridRowEditing.js +6 -20
- package/node/hooks/features/export/useGridCsvExport.js +1 -1
- package/node/hooks/features/filter/gridFilterUtils.js +6 -3
- package/node/hooks/features/filter/useGridFilter.js +1 -1
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/node/hooks/features/sorting/useGridSorting.js +6 -5
- package/node/index.js +1 -1
- package/node/internals/index.js +7 -0
- package/node/locales/bgBG.js +33 -37
- package/node/models/params/gridEditCellParams.js +1 -0
- package/node/utils/domUtils.js +11 -1
- package/package.json +2 -2
- package/utils/domUtils.d.ts +2 -0
- package/utils/domUtils.js +10 -1
|
@@ -4,7 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
const _excluded = ["id"],
|
|
5
5
|
_excluded2 = ["id"];
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import { unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
7
|
+
import { unstable_useEventCallback as useEventCallback, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
8
8
|
import { useGridApiEventHandler, useGridApiOptionHandler } from '../../utils/useGridApiEventHandler';
|
|
9
9
|
import { GridEditModes, GridRowModes } from '../../../models/gridEditRowModel';
|
|
10
10
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
@@ -172,7 +172,6 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
172
172
|
const rowParams = apiRef.current.getRowParams(params.id);
|
|
173
173
|
const newParams = _extends({}, rowParams, {
|
|
174
174
|
field: params.field,
|
|
175
|
-
key: event.key,
|
|
176
175
|
reason
|
|
177
176
|
});
|
|
178
177
|
apiRef.current.publishEvent('rowEditStart', newParams, event);
|
|
@@ -183,24 +182,13 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
183
182
|
const {
|
|
184
183
|
id,
|
|
185
184
|
field,
|
|
186
|
-
reason
|
|
187
|
-
key,
|
|
188
|
-
columns
|
|
185
|
+
reason
|
|
189
186
|
} = params;
|
|
190
187
|
const startRowEditModeParams = {
|
|
191
188
|
id,
|
|
192
189
|
fieldToFocus: field
|
|
193
190
|
};
|
|
194
|
-
if (reason === GridRowEditStartReasons.printableKeyDown) {
|
|
195
|
-
if (React.version.startsWith('17')) {
|
|
196
|
-
// In React 17, cleaning the input is enough.
|
|
197
|
-
// The sequence of events makes the key pressed by the end-users update the textbox directly.
|
|
198
|
-
startRowEditModeParams.deleteValue = !!field;
|
|
199
|
-
} else {
|
|
200
|
-
const colDef = columns.find(col => col.field === field);
|
|
201
|
-
startRowEditModeParams.initialValue = colDef.valueParser ? colDef.valueParser(key) : key;
|
|
202
|
-
}
|
|
203
|
-
} else if (reason === GridRowEditStartReasons.deleteKeyDown) {
|
|
191
|
+
if (reason === GridRowEditStartReasons.printableKeyDown || reason === GridRowEditStartReasons.deleteKeyDown) {
|
|
204
192
|
startRowEditModeParams.deleteValue = !!field;
|
|
205
193
|
}
|
|
206
194
|
apiRef.current.startRowEditMode(startRowEditModeParams);
|
|
@@ -323,17 +311,13 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
323
311
|
return acc;
|
|
324
312
|
}
|
|
325
313
|
let newValue = apiRef.current.getCellValue(id, field);
|
|
326
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
327
|
-
let unstable_updateValueOnRender = false;
|
|
328
314
|
if (fieldToFocus === field && (deleteValue || initialValue)) {
|
|
329
315
|
newValue = deleteValue ? '' : initialValue;
|
|
330
|
-
unstable_updateValueOnRender = true;
|
|
331
316
|
}
|
|
332
317
|
acc[field] = {
|
|
333
318
|
value: newValue,
|
|
334
319
|
error: false,
|
|
335
|
-
isProcessingProps: false
|
|
336
|
-
unstable_updateValueOnRender
|
|
320
|
+
isProcessingProps: false
|
|
337
321
|
};
|
|
338
322
|
return acc;
|
|
339
323
|
}, {});
|
|
@@ -553,7 +537,9 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
553
537
|
updateRowModesModel(rowModesModelProp);
|
|
554
538
|
}
|
|
555
539
|
}, [rowModesModelProp, updateRowModesModel]);
|
|
556
|
-
|
|
540
|
+
|
|
541
|
+
// Run this effect synchronously so that the keyboard event can impact the yet-to-be-rendered input.
|
|
542
|
+
useEnhancedEffect(() => {
|
|
557
543
|
const idToIdLookup = gridRowsDataRowIdToIdLookupSelector(apiRef);
|
|
558
544
|
|
|
559
545
|
// Update the ref here because updateStateToStopRowEditMode may change it later
|
|
@@ -8,4 +8,4 @@ import type { DataGridProcessedProps } from '../../../models/props/DataGridProps
|
|
|
8
8
|
* @requires useGridSelection (state)
|
|
9
9
|
* @requires useGridParamsApi (method)
|
|
10
10
|
*/
|
|
11
|
-
export declare const useGridCsvExport: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, '
|
|
11
|
+
export declare const useGridCsvExport: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'ignoreValueFormatterDuringExport'>) => void;
|
|
@@ -16,7 +16,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
16
16
|
*/
|
|
17
17
|
export const useGridCsvExport = (apiRef, props) => {
|
|
18
18
|
const logger = useGridLogger(apiRef, 'useGridCsvExport');
|
|
19
|
-
const ignoreValueFormatterProp = props.
|
|
19
|
+
const ignoreValueFormatterProp = props.ignoreValueFormatterDuringExport;
|
|
20
20
|
const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp == null ? void 0 : ignoreValueFormatterProp.csvExport : ignoreValueFormatterProp) || false;
|
|
21
21
|
const getDataAsCsv = React.useCallback((options = {}) => {
|
|
22
22
|
var _options$getRowsToExp, _options$includeHeade, _options$includeColum;
|
|
@@ -14,6 +14,7 @@ export declare const cleanFilterItem: (item: GridFilterItem, apiRef: React.Mutab
|
|
|
14
14
|
export declare const sanitizeFilterModel: (model: GridFilterModel, disableMultipleColumnsFiltering: boolean, apiRef: React.MutableRefObject<GridPrivateApiCommunity>) => GridFilterModel;
|
|
15
15
|
export declare const mergeStateWithFilterModel: (filterModel: GridFilterModel, disableMultipleColumnsFiltering: boolean, apiRef: React.MutableRefObject<GridPrivateApiCommunity>) => (filteringState: GridStateCommunity['filter']) => GridStateCommunity['filter'];
|
|
16
16
|
export declare const removeDiacritics: (value: unknown) => unknown;
|
|
17
|
+
export declare const shouldQuickFilterExcludeHiddenColumns: (filterModel: GridFilterModel) => boolean;
|
|
17
18
|
export declare const buildAggregatedFilterApplier: (filterModel: GridFilterModel, apiRef: React.MutableRefObject<GridPrivateApiCommunity>, disableEval: boolean) => GridAggregatedFilterItemApplier;
|
|
18
19
|
type FilterCache = {
|
|
19
20
|
cleanedFilterItems?: GridFilterItem[];
|
|
@@ -175,6 +175,10 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
175
175
|
filterItemsApplierId += 1;
|
|
176
176
|
return filterItem;
|
|
177
177
|
};
|
|
178
|
+
export const shouldQuickFilterExcludeHiddenColumns = filterModel => {
|
|
179
|
+
var _filterModel$quickFil;
|
|
180
|
+
return (_filterModel$quickFil = filterModel.quickFilterExcludeHiddenColumns) != null ? _filterModel$quickFil : true;
|
|
181
|
+
};
|
|
178
182
|
|
|
179
183
|
/**
|
|
180
184
|
* Generates a method to easily check if a row is matching the current quick filter.
|
|
@@ -183,13 +187,12 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
183
187
|
* @returns {GridAggregatedFilterItemApplier | null} A method that checks if a row is matching the current filter model. If `null`, we consider that all the rows are matching the filters.
|
|
184
188
|
*/
|
|
185
189
|
const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
186
|
-
var _filterModel$
|
|
187
|
-
const quickFilterValues = (_filterModel$
|
|
190
|
+
var _filterModel$quickFil2, _filterModel$quickFil3;
|
|
191
|
+
const quickFilterValues = (_filterModel$quickFil2 = (_filterModel$quickFil3 = filterModel.quickFilterValues) == null ? void 0 : _filterModel$quickFil3.filter(Boolean)) != null ? _filterModel$quickFil2 : [];
|
|
188
192
|
if (quickFilterValues.length === 0) {
|
|
189
193
|
return null;
|
|
190
194
|
}
|
|
191
|
-
const
|
|
192
|
-
const columnFields = quickFilterExcludeHiddenColumns ? gridVisibleColumnFieldsSelector(apiRef) : gridColumnFieldsSelector(apiRef);
|
|
195
|
+
const columnFields = shouldQuickFilterExcludeHiddenColumns(filterModel) ? gridVisibleColumnFieldsSelector(apiRef) : gridColumnFieldsSelector(apiRef);
|
|
193
196
|
const appliersPerField = [];
|
|
194
197
|
const {
|
|
195
198
|
ignoreDiacritics
|
|
@@ -14,7 +14,7 @@ import { useFirstRender } from '../../utils/useFirstRender';
|
|
|
14
14
|
import { gridRowsLookupSelector } from '../rows';
|
|
15
15
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
16
16
|
import { GRID_DEFAULT_STRATEGY, useGridRegisterStrategyProcessor } from '../../core/strategyProcessing';
|
|
17
|
-
import { buildAggregatedFilterApplier, sanitizeFilterModel, mergeStateWithFilterModel, cleanFilterItem, passFilterLogic } from './gridFilterUtils';
|
|
17
|
+
import { buildAggregatedFilterApplier, sanitizeFilterModel, mergeStateWithFilterModel, cleanFilterItem, passFilterLogic, shouldQuickFilterExcludeHiddenColumns } from './gridFilterUtils';
|
|
18
18
|
import { isDeepEqual } from '../../../utils/utils';
|
|
19
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
20
|
export const filterStateInitializer = (state, props, apiRef) => {
|
|
@@ -345,7 +345,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
345
345
|
useGridApiEventHandler(apiRef, 'rowExpansionChange', updateVisibleRowsLookupState);
|
|
346
346
|
useGridApiEventHandler(apiRef, 'columnVisibilityModelChange', () => {
|
|
347
347
|
const filterModel = gridFilterModelSelector(apiRef);
|
|
348
|
-
if (filterModel.quickFilterValues && filterModel
|
|
348
|
+
if (filterModel.quickFilterValues && shouldQuickFilterExcludeHiddenColumns(filterModel)) {
|
|
349
349
|
// re-apply filters because the quick filter results may have changed
|
|
350
350
|
apiRef.current.unstable_applyFilters();
|
|
351
351
|
}
|
|
@@ -15,6 +15,7 @@ import { unstable_gridFocusColumnGroupHeaderSelector } from '../focus';
|
|
|
15
15
|
import { gridColumnGroupsHeaderMaxDepthSelector } from '../columnGrouping/gridColumnGroupsSelector';
|
|
16
16
|
import { unstable_gridHeaderFilteringEditFieldSelector, unstable_gridHeaderFilteringMenuSelector } from '../headerFiltering/gridHeaderFilteringSelectors';
|
|
17
17
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
18
|
+
import { isEventTargetInPortal } from '../../../utils/domUtils';
|
|
18
19
|
function enrichPageRowsWithPinnedRows(apiRef, rows) {
|
|
19
20
|
const pinnedRows = gridPinnedRowsSelector(apiRef) || {};
|
|
20
21
|
return [...(pinnedRows.top || []), ...rows, ...(pinnedRows.bottom || [])];
|
|
@@ -414,7 +415,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
414
415
|
}, [apiRef, currentPageRows.length, goToHeader, goToGroupHeader, goToCell, getRowIdFromIndex]);
|
|
415
416
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
416
417
|
// Ignore portal
|
|
417
|
-
if (
|
|
418
|
+
if (isEventTargetInPortal(event)) {
|
|
418
419
|
return;
|
|
419
420
|
}
|
|
420
421
|
|
|
@@ -14,6 +14,7 @@ import { isKeyboardEvent, isNavigationKey } from '../../../utils/keyboardUtils';
|
|
|
14
14
|
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
15
15
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../../../constants/gridDetailPanelToggleField';
|
|
16
16
|
import { gridClasses } from '../../../constants/gridClasses';
|
|
17
|
+
import { isEventTargetInPortal } from '../../../utils/domUtils';
|
|
17
18
|
const getSelectionModelPropValue = (selectionModelProp, prevSelectionModel) => {
|
|
18
19
|
if (selectionModelProp == null) {
|
|
19
20
|
return selectionModelProp;
|
|
@@ -289,7 +290,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
289
290
|
|
|
290
291
|
// Ignore portal
|
|
291
292
|
// Do not apply shortcuts if the focus is not on the cell root component
|
|
292
|
-
if (
|
|
293
|
+
if (isEventTargetInPortal(event)) {
|
|
293
294
|
return;
|
|
294
295
|
}
|
|
295
296
|
if (isNavigationKey(event.key) && event.shiftKey) {
|
|
@@ -116,7 +116,8 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
116
116
|
apiRef.current.applySorting();
|
|
117
117
|
}
|
|
118
118
|
}, [apiRef, logger, props.disableMultipleColumnsSorting]);
|
|
119
|
-
const sortColumn = React.useCallback((
|
|
119
|
+
const sortColumn = React.useCallback((field, direction, allowMultipleSorting) => {
|
|
120
|
+
const column = apiRef.current.getColumn(field);
|
|
120
121
|
if (!column.sortable) {
|
|
121
122
|
return;
|
|
122
123
|
}
|
|
@@ -199,17 +200,17 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
199
200
|
* EVENTS
|
|
200
201
|
*/
|
|
201
202
|
const handleColumnHeaderClick = React.useCallback(({
|
|
202
|
-
|
|
203
|
+
field
|
|
203
204
|
}, event) => {
|
|
204
205
|
const allowMultipleSorting = event.shiftKey || event.metaKey || event.ctrlKey;
|
|
205
|
-
sortColumn(
|
|
206
|
+
sortColumn(field, undefined, allowMultipleSorting);
|
|
206
207
|
}, [sortColumn]);
|
|
207
208
|
const handleColumnHeaderKeyDown = React.useCallback(({
|
|
208
|
-
|
|
209
|
+
field
|
|
209
210
|
}, event) => {
|
|
210
211
|
// Ctrl + Enter opens the column menu
|
|
211
212
|
if (isEnterKey(event.key) && !event.ctrlKey && !event.metaKey) {
|
|
212
|
-
sortColumn(
|
|
213
|
+
sortColumn(field, undefined, event.shiftKey);
|
|
213
214
|
}
|
|
214
215
|
}, [sortColumn]);
|
|
215
216
|
const handleColumnsChange = React.useCallback(() => {
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export type { GridExperimentalFeatures, DataGridPropsWithoutDefaultValue, DataGr
|
|
|
67
67
|
export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
|
|
68
68
|
export * from '../utils/createControllablePromise';
|
|
69
69
|
export { createSelector, createSelectorMemoized, unstable_resetCreateSelectorCache, } from '../utils/createSelector';
|
|
70
|
-
export { findParentElementFromClassName, getActiveElement } from '../utils/domUtils';
|
|
70
|
+
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal, } from '../utils/domUtils';
|
|
71
71
|
export { isNavigationKey } from '../utils/keyboardUtils';
|
|
72
72
|
export { clamp, isDeepEqual, isNumber, isFunction, isObject } from '../utils/utils';
|
|
73
73
|
export { buildWarning } from '../utils/warning';
|
package/internals/index.js
CHANGED
|
@@ -54,7 +54,7 @@ export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
|
|
54
54
|
export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
|
|
55
55
|
export * from '../utils/createControllablePromise';
|
|
56
56
|
export { createSelector, createSelectorMemoized, unstable_resetCreateSelectorCache } from '../utils/createSelector';
|
|
57
|
-
export { findParentElementFromClassName, getActiveElement } from '../utils/domUtils';
|
|
57
|
+
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal } from '../utils/domUtils';
|
|
58
58
|
export { isNavigationKey } from '../utils/keyboardUtils';
|
|
59
59
|
export { clamp, isDeepEqual, isNumber, isFunction, isObject } from '../utils/utils';
|
|
60
60
|
export { buildWarning } from '../utils/warning';
|
|
@@ -5,7 +5,7 @@ import { chainPropTypes } from '@mui/utils';
|
|
|
5
5
|
import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot } from '../components';
|
|
6
6
|
import { GridContextProvider } from '../context/GridContextProvider';
|
|
7
7
|
import { useDataGridComponent } from './useDataGridComponent';
|
|
8
|
-
import { useDataGridProps
|
|
8
|
+
import { useDataGridProps } from './useDataGridProps';
|
|
9
9
|
import { DataGridVirtualScroller } from '../components/DataGridVirtualScroller';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -35,18 +35,6 @@ var DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref)
|
|
|
35
35
|
* - [DataGrid API](https://mui.com/x/api/data-grid/data-grid/)
|
|
36
36
|
*/
|
|
37
37
|
export var DataGrid = /*#__PURE__*/React.memo(DataGridRaw);
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Remove at v7
|
|
41
|
-
* @deprecated
|
|
42
|
-
*/
|
|
43
|
-
export var SUBMIT_FILTER_STROKE_TIME = DATA_GRID_PROPS_DEFAULT_VALUES.filterDebounceMs;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Remove at v7
|
|
47
|
-
* @deprecated
|
|
48
|
-
*/
|
|
49
|
-
export var SUBMIT_FILTER_DATE_STROKE_TIME = DATA_GRID_PROPS_DEFAULT_VALUES.filterDebounceMs;
|
|
50
38
|
DataGridRaw.propTypes = {
|
|
51
39
|
// ----------------------------- Warning --------------------------------
|
|
52
40
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -276,6 +264,15 @@ DataGridRaw.propTypes = {
|
|
|
276
264
|
* @default false
|
|
277
265
|
*/
|
|
278
266
|
ignoreDiacritics: PropTypes.bool,
|
|
267
|
+
/**
|
|
268
|
+
* If `true`, the grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
|
|
269
|
+
* If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
|
|
270
|
+
* @default false
|
|
271
|
+
*/
|
|
272
|
+
ignoreValueFormatterDuringExport: PropTypes.oneOfType([PropTypes.shape({
|
|
273
|
+
clipboardExport: PropTypes.bool,
|
|
274
|
+
csvExport: PropTypes.bool
|
|
275
|
+
}), PropTypes.bool]),
|
|
279
276
|
/**
|
|
280
277
|
* The initial state of the DataGrid.
|
|
281
278
|
* The data in it will be set in the state on initialization but will not be controlled.
|
|
@@ -668,14 +665,5 @@ DataGridRaw.propTypes = {
|
|
|
668
665
|
/**
|
|
669
666
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
670
667
|
*/
|
|
671
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
672
|
-
/**
|
|
673
|
-
* If `true`, the grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
|
|
674
|
-
* If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
|
|
675
|
-
* @default false
|
|
676
|
-
*/
|
|
677
|
-
unstable_ignoreValueFormatterDuringExport: PropTypes.oneOfType([PropTypes.shape({
|
|
678
|
-
clipboardExport: PropTypes.bool,
|
|
679
|
-
csvExport: PropTypes.bool
|
|
680
|
-
}), PropTypes.bool])
|
|
668
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
681
669
|
};
|
|
@@ -68,7 +68,7 @@ export var DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
68
68
|
disableColumnResize: false,
|
|
69
69
|
keepNonExistentRowsSelected: false,
|
|
70
70
|
keepColumnPositionIfDraggedOutside: false,
|
|
71
|
-
|
|
71
|
+
ignoreValueFormatterDuringExport: false,
|
|
72
72
|
clipboardCopyCellDelimiter: '\t',
|
|
73
73
|
rowPositionsDebounceMs: 166
|
|
74
74
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
4
|
+
import { GridPreferencesPanel } from './panel/GridPreferencesPanel';
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
7
|
export function GridHeader() {
|
|
7
|
-
var _rootProps$slotProps
|
|
8
|
+
var _rootProps$slotProps;
|
|
8
9
|
var rootProps = useGridRootProps();
|
|
9
10
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
10
|
-
children: [/*#__PURE__*/_jsx(
|
|
11
|
+
children: [/*#__PURE__*/_jsx(GridPreferencesPanel, {}), rootProps.slots.toolbar && /*#__PURE__*/_jsx(rootProps.slots.toolbar, _extends({}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.toolbar))]
|
|
11
12
|
});
|
|
12
13
|
}
|
|
@@ -15,7 +15,7 @@ import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
|
15
15
|
import { gridColumnsTotalWidthSelector } from '../hooks/features/columns/gridColumnsSelector';
|
|
16
16
|
import { useGridSelector, objectShallowCompare } from '../hooks/utils/useGridSelector';
|
|
17
17
|
import { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
18
|
-
import { findParentElementFromClassName } from '../utils/domUtils';
|
|
18
|
+
import { findParentElementFromClassName, isEventTargetInPortal } from '../utils/domUtils';
|
|
19
19
|
import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../colDef/gridCheckboxSelectionColDef';
|
|
20
20
|
import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
|
|
21
21
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelToggleField';
|
|
@@ -141,9 +141,7 @@ var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
141
141
|
var publish = React.useCallback(function (eventName, propHandler) {
|
|
142
142
|
return function (event) {
|
|
143
143
|
// Ignore portal
|
|
144
|
-
|
|
145
|
-
// See https://github.com/mui/material-ui/issues/10534
|
|
146
|
-
if (event.target.nodeType === 1 && !event.currentTarget.contains(event.target)) {
|
|
144
|
+
if (isEventTargetInPortal(event)) {
|
|
147
145
|
return;
|
|
148
146
|
}
|
|
149
147
|
|
|
@@ -387,7 +387,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
387
387
|
} : void 0;
|
|
388
388
|
export { MemoizedCellWrapper as GridCellWrapper, GridCell };
|
|
389
389
|
var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
390
|
-
var _getActions, _ref, _rootProps$
|
|
390
|
+
var _getActions, _ref, _rootProps$cellSelect, _rootProps$experiment3, _rootProps$experiment4;
|
|
391
391
|
var column = props.column,
|
|
392
392
|
rowId = props.rowId,
|
|
393
393
|
editCellState = props.editCellState,
|
|
@@ -463,8 +463,8 @@ var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
463
463
|
var cellRef = React.useRef(null);
|
|
464
464
|
var handleRef = useForkRef(ref, cellRef);
|
|
465
465
|
var focusElementRef = React.useRef(null);
|
|
466
|
-
// @ts-expect-error To access `
|
|
467
|
-
var isSelectionMode = (_rootProps$
|
|
466
|
+
// @ts-expect-error To access `cellSelection` flag as it's a `premium` feature
|
|
467
|
+
var isSelectionMode = (_rootProps$cellSelect = rootProps.cellSelection) != null ? _rootProps$cellSelect : false;
|
|
468
468
|
var ownerState = {
|
|
469
469
|
align: align,
|
|
470
470
|
showRightBorder: showRightBorder,
|
|
@@ -74,7 +74,6 @@ function GridEditDateCell(props) {
|
|
|
74
74
|
classes: rootProps.classes
|
|
75
75
|
};
|
|
76
76
|
var classes = useUtilityClasses(ownerState);
|
|
77
|
-
var hasUpdatedEditValueOnMount = React.useRef(false);
|
|
78
77
|
var parseValueToDate = React.useCallback(function (value) {
|
|
79
78
|
if (value === '') {
|
|
80
79
|
return null;
|
|
@@ -148,26 +147,8 @@ function GridEditDateCell(props) {
|
|
|
148
147
|
inputRef.current.focus();
|
|
149
148
|
}
|
|
150
149
|
}, [hasFocus]);
|
|
151
|
-
var meta = apiRef.current.unstable_getEditCellMeta(id, field);
|
|
152
|
-
var handleInputRef = function handleInputRef(el) {
|
|
153
|
-
inputRef.current = el;
|
|
154
|
-
if (meta != null && meta.unstable_updateValueOnRender && !hasUpdatedEditValueOnMount.current) {
|
|
155
|
-
var inputValue = inputRef.current.value;
|
|
156
|
-
var parsedDate = parseValueToDate(inputValue);
|
|
157
|
-
setValueState({
|
|
158
|
-
parsed: parsedDate,
|
|
159
|
-
formatted: inputValue
|
|
160
|
-
});
|
|
161
|
-
apiRef.current.setEditCellValue({
|
|
162
|
-
id: id,
|
|
163
|
-
field: field,
|
|
164
|
-
value: parsedDate
|
|
165
|
-
});
|
|
166
|
-
hasUpdatedEditValueOnMount.current = true;
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
150
|
return /*#__PURE__*/_jsx(StyledInputBase, _extends({
|
|
170
|
-
inputRef:
|
|
151
|
+
inputRef: inputRef,
|
|
171
152
|
fullWidth: true,
|
|
172
153
|
className: classes.root,
|
|
173
154
|
type: isDateTime ? 'datetime-local' : 'date',
|
|
@@ -7,6 +7,7 @@ import { gridColumnGroupsLookupSelector } from '../../hooks/features/columnGroup
|
|
|
7
7
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
8
8
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
9
9
|
import { GridGenericColumnHeaderItem } from './GridGenericColumnHeaderItem';
|
|
10
|
+
import { isEventTargetInPortal } from '../../utils/domUtils';
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
12
13
|
var classes = ownerState.classes,
|
|
@@ -85,7 +86,7 @@ function GridColumnGroupHeader(props) {
|
|
|
85
86
|
return function (event) {
|
|
86
87
|
// Ignore portal
|
|
87
88
|
// See https://github.com/mui/mui-x/issues/1721
|
|
88
|
-
if (
|
|
89
|
+
if (isEventTargetInPortal(event)) {
|
|
89
90
|
return;
|
|
90
91
|
}
|
|
91
92
|
apiRef.current.publishEvent(eventName, renderParams, event);
|
|
@@ -10,6 +10,7 @@ import { GridColumnHeaderMenu } from '../menu/columnMenu/GridColumnHeaderMenu';
|
|
|
10
10
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
11
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
12
|
import { GridGenericColumnHeaderItem } from './GridGenericColumnHeaderItem';
|
|
13
|
+
import { isEventTargetInPortal } from '../../utils/domUtils';
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -71,7 +72,7 @@ function GridColumnHeaderItem(props) {
|
|
|
71
72
|
return function (event) {
|
|
72
73
|
// Ignore portal
|
|
73
74
|
// See https://github.com/mui/mui-x/issues/1721
|
|
74
|
-
if (
|
|
75
|
+
if (isEventTargetInPortal(event)) {
|
|
75
76
|
return;
|
|
76
77
|
}
|
|
77
78
|
apiRef.current.publishEvent(eventName, apiRef.current.getColumnHeaderParams(colDef.field), event);
|
|
@@ -29,7 +29,7 @@ function GridColumnMenuSortItem(props) {
|
|
|
29
29
|
var onSortMenuItemClick = React.useCallback(function (event) {
|
|
30
30
|
onClick(event);
|
|
31
31
|
var direction = event.currentTarget.getAttribute('data-value') || null;
|
|
32
|
-
apiRef.current.sortColumn(colDef, direction === sortDirection ? null : direction);
|
|
32
|
+
apiRef.current.sortColumn(colDef.field, direction === sortDirection ? null : direction);
|
|
33
33
|
}, [apiRef, colDef, onClick, sortDirection]);
|
|
34
34
|
if (!colDef || !colDef.sortable || !sortingOrder.some(function (item) {
|
|
35
35
|
return !!item;
|
|
@@ -205,8 +205,8 @@ var GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props
|
|
|
205
205
|
return operator.value === item.operator;
|
|
206
206
|
}) || column.filterOperators[0];
|
|
207
207
|
|
|
208
|
-
// Erase filter value if the input component is modified
|
|
209
|
-
var eraseItemValue = !newOperator.InputComponent || newOperator.InputComponent !== (currentOperator == null ? void 0 : currentOperator.InputComponent);
|
|
208
|
+
// Erase filter value if the input component or filtered column type is modified
|
|
209
|
+
var eraseItemValue = !newOperator.InputComponent || newOperator.InputComponent !== (currentOperator == null ? void 0 : currentOperator.InputComponent) || column.type !== currentColumn.type;
|
|
210
210
|
applyFilterChanges(_extends({}, item, {
|
|
211
211
|
field: field,
|
|
212
212
|
operator: newOperator.value,
|
|
@@ -47,7 +47,7 @@ function GridFilterInputValue(props) {
|
|
|
47
47
|
}, [id, applyValue, item, rootProps.filterDebounceMs, filterTimeout]);
|
|
48
48
|
React.useEffect(function () {
|
|
49
49
|
var itemPlusTag = item;
|
|
50
|
-
if (itemPlusTag.fromInput !== id) {
|
|
50
|
+
if (itemPlusTag.fromInput !== id || item.value === undefined) {
|
|
51
51
|
var _item$value2;
|
|
52
52
|
setFilterValueState(String((_item$value2 = item.value) != null ? _item$value2 : ''));
|
|
53
53
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { GridSkeletonCell, GridColumnsPanel, GridFilterPanel, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel,
|
|
2
|
+
import { GridSkeletonCell, GridColumnsPanel, GridFilterPanel, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridRow, GridColumnHeaderFilterIconButton, GridRowCount } from '../components';
|
|
3
3
|
import { GridCellV7 } from '../components/cell/GridCell';
|
|
4
4
|
import { GridColumnHeaders } from '../components/GridColumnHeaders';
|
|
5
5
|
import { GridColumnMenu } from '../components/menu/columnMenu/GridColumnMenu';
|
|
@@ -17,7 +17,6 @@ export var DATA_GRID_DEFAULT_SLOTS_COMPONENTS = _extends({}, materialSlots, {
|
|
|
17
17
|
footer: GridFooter,
|
|
18
18
|
footerRowCount: GridRowCount,
|
|
19
19
|
toolbar: null,
|
|
20
|
-
preferencesPanel: GridPreferencesPanel,
|
|
21
20
|
loadingOverlay: GridLoadingOverlay,
|
|
22
21
|
noResultsOverlay: GridNoResultsOverlay,
|
|
23
22
|
noRowsOverlay: GridNoRowsOverlay,
|
|
@@ -51,7 +51,7 @@ function hasNativeSelection(element) {
|
|
|
51
51
|
* @requires useGridSelection (method)
|
|
52
52
|
*/
|
|
53
53
|
export var useGridClipboard = function useGridClipboard(apiRef, props) {
|
|
54
|
-
var ignoreValueFormatterProp = props.
|
|
54
|
+
var ignoreValueFormatterProp = props.ignoreValueFormatterDuringExport;
|
|
55
55
|
var ignoreValueFormatter = (_typeof(ignoreValueFormatterProp) === 'object' ? ignoreValueFormatterProp == null ? void 0 : ignoreValueFormatterProp.clipboardExport : ignoreValueFormatterProp) || false;
|
|
56
56
|
var clipboardCopyCellDelimiter = props.clipboardCopyCellDelimiter;
|
|
57
57
|
var handleCopy = React.useCallback(function (event) {
|
|
@@ -8,7 +8,7 @@ var _excluded = ["id", "field"],
|
|
|
8
8
|
_excluded2 = ["id", "field"];
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
import * as React from 'react';
|
|
11
|
-
import { unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
11
|
+
import { unstable_useEventCallback as useEventCallback, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
12
12
|
import { useGridApiEventHandler, useGridApiOptionHandler } from '../../utils/useGridApiEventHandler';
|
|
13
13
|
import { GridEditModes, GridCellModes } from '../../../models/gridEditRowModel';
|
|
14
14
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
@@ -108,7 +108,7 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
108
108
|
if (isPrintableKey(event)) {
|
|
109
109
|
_reason = GridCellEditStartReasons.printableKeyDown;
|
|
110
110
|
} else if ((event.ctrlKey || event.metaKey) && event.key === 'v') {
|
|
111
|
-
_reason = GridCellEditStartReasons.
|
|
111
|
+
_reason = GridCellEditStartReasons.pasteKeyDown;
|
|
112
112
|
} else if (event.key === 'Enter') {
|
|
113
113
|
_reason = GridCellEditStartReasons.enterKeyDown;
|
|
114
114
|
} else if (event.key === 'Delete' || event.key === 'Backspace') {
|
|
@@ -127,23 +127,12 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
127
127
|
var handleCellEditStart = React.useCallback(function (params) {
|
|
128
128
|
var id = params.id,
|
|
129
129
|
field = params.field,
|
|
130
|
-
reason = params.reason
|
|
131
|
-
key = params.key,
|
|
132
|
-
colDef = params.colDef;
|
|
130
|
+
reason = params.reason;
|
|
133
131
|
var startCellEditModeParams = {
|
|
134
132
|
id: id,
|
|
135
133
|
field: field
|
|
136
134
|
};
|
|
137
|
-
if (reason === GridCellEditStartReasons.printableKeyDown) {
|
|
138
|
-
if (React.version.startsWith('17')) {
|
|
139
|
-
// In React 17, cleaning the input is enough.
|
|
140
|
-
// The sequence of events makes the key pressed by the end-users update the textbox directly.
|
|
141
|
-
startCellEditModeParams.deleteValue = true;
|
|
142
|
-
} else {
|
|
143
|
-
var initialValue = colDef.valueParser ? colDef.valueParser(key) : key;
|
|
144
|
-
startCellEditModeParams.initialValue = initialValue;
|
|
145
|
-
}
|
|
146
|
-
} else if (reason === GridCellEditStartReasons.deleteKeyDown) {
|
|
135
|
+
if (reason === GridCellEditStartReasons.printableKeyDown || reason === GridCellEditStartReasons.deleteKeyDown || reason === GridCellEditStartReasons.pasteKeyDown) {
|
|
147
136
|
startCellEditModeParams.deleteValue = true;
|
|
148
137
|
}
|
|
149
138
|
apiRef.current.startCellEditMode(startCellEditModeParams);
|
|
@@ -244,17 +233,13 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
244
233
|
deleteValue = params.deleteValue,
|
|
245
234
|
initialValue = params.initialValue;
|
|
246
235
|
var newValue = apiRef.current.getCellValue(id, field);
|
|
247
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
248
|
-
var unstable_updateValueOnRender = false;
|
|
249
236
|
if (deleteValue || initialValue) {
|
|
250
237
|
newValue = deleteValue ? '' : initialValue;
|
|
251
|
-
unstable_updateValueOnRender = true;
|
|
252
238
|
}
|
|
253
239
|
var newProps = {
|
|
254
240
|
value: newValue,
|
|
255
241
|
error: false,
|
|
256
|
-
isProcessingProps: false
|
|
257
|
-
unstable_updateValueOnRender: unstable_updateValueOnRender
|
|
242
|
+
isProcessingProps: false
|
|
258
243
|
};
|
|
259
244
|
updateOrDeleteFieldState(id, field, newProps);
|
|
260
245
|
apiRef.current.setCellFocus(id, field);
|
|
@@ -439,7 +424,9 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
439
424
|
updateCellModesModel(cellModesModelProp);
|
|
440
425
|
}
|
|
441
426
|
}, [cellModesModelProp, updateCellModesModel]);
|
|
442
|
-
|
|
427
|
+
|
|
428
|
+
// Run this effect synchronously so that the keyboard event can impact the yet-to-be-rendered input.
|
|
429
|
+
useEnhancedEffect(function () {
|
|
443
430
|
var idToIdLookup = gridRowsDataRowIdToIdLookupSelector(apiRef);
|
|
444
431
|
|
|
445
432
|
// Update the ref here because updateStateToStopCellEditMode may change it later
|