@mui/x-data-grid 9.12.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +152 -0
  2. package/DataGrid/DataGrid.js +1 -1
  3. package/DataGrid/DataGrid.mjs +1 -1
  4. package/components/GridPagination.js +1 -1
  5. package/components/GridPagination.mjs +1 -1
  6. package/components/GridRow.d.mts +1 -0
  7. package/components/GridRow.d.ts +1 -0
  8. package/components/GridRow.js +41 -6
  9. package/components/GridRow.mjs +41 -6
  10. package/components/cell/GridCell.js +7 -4
  11. package/components/cell/GridCell.mjs +7 -4
  12. package/components/cell/GridEditBooleanCell.d.mts +1 -1
  13. package/components/cell/GridEditBooleanCell.d.ts +1 -1
  14. package/components/cell/GridEditBooleanCell.js +4 -4
  15. package/components/cell/GridEditBooleanCell.mjs +4 -4
  16. package/components/cell/GridEditDateCell.d.mts +1 -1
  17. package/components/cell/GridEditDateCell.d.ts +1 -1
  18. package/components/cell/GridEditDateCell.js +5 -5
  19. package/components/cell/GridEditDateCell.mjs +5 -5
  20. package/components/cell/GridEditInputCell.d.mts +1 -1
  21. package/components/cell/GridEditInputCell.d.ts +1 -1
  22. package/components/cell/GridEditInputCell.js +1 -1
  23. package/components/cell/GridEditInputCell.mjs +1 -1
  24. package/components/cell/GridEditLongTextCell.d.mts +1 -1
  25. package/components/cell/GridEditLongTextCell.d.ts +1 -1
  26. package/components/cell/GridEditLongTextCell.js +2 -2
  27. package/components/cell/GridEditLongTextCell.mjs +2 -2
  28. package/components/cell/GridEditSingleSelectCell.d.mts +1 -1
  29. package/components/cell/GridEditSingleSelectCell.d.ts +1 -1
  30. package/components/cell/GridEditSingleSelectCell.js +4 -4
  31. package/components/cell/GridEditSingleSelectCell.mjs +4 -4
  32. package/components/toolbarV8/Toolbar.d.mts +5 -1
  33. package/components/toolbarV8/Toolbar.d.ts +5 -1
  34. package/components/toolbarV8/Toolbar.js +34 -12
  35. package/components/toolbarV8/Toolbar.mjs +33 -11
  36. package/hooks/core/useGridVirtualizer.js +14 -1
  37. package/hooks/core/useGridVirtualizer.mjs +14 -1
  38. package/hooks/features/dataSource/models.d.mts +2 -2
  39. package/hooks/features/dataSource/models.d.ts +2 -2
  40. package/hooks/features/dataSource/useGridDataSourceBase.js +11 -7
  41. package/hooks/features/dataSource/useGridDataSourceBase.mjs +12 -8
  42. package/hooks/features/pivoting/gridPivotingInterfaces.d.mts +2 -2
  43. package/hooks/features/pivoting/gridPivotingInterfaces.d.ts +2 -2
  44. package/hooks/features/rowSelection/useGridRowSelection.js +1 -1
  45. package/hooks/features/rowSelection/useGridRowSelection.mjs +2 -2
  46. package/hooks/features/rows/gridRowsUtils.d.mts +37 -3
  47. package/hooks/features/rows/gridRowsUtils.d.ts +37 -3
  48. package/hooks/features/rows/gridRowsUtils.js +120 -23
  49. package/hooks/features/rows/gridRowsUtils.mjs +115 -22
  50. package/hooks/features/rows/useGridRows.js +10 -1
  51. package/hooks/features/rows/useGridRows.mjs +10 -1
  52. package/index.js +1 -1
  53. package/index.mjs +1 -1
  54. package/internals/index.d.mts +2 -2
  55. package/internals/index.d.ts +2 -2
  56. package/internals/index.js +28 -0
  57. package/internals/index.mjs +2 -2
  58. package/material/variables.d.mts +6 -1
  59. package/material/variables.d.ts +6 -1
  60. package/material/variables.js +17 -3
  61. package/material/variables.mjs +14 -4
  62. package/models/api/gridRowApi.d.mts +7 -7
  63. package/models/api/gridRowApi.d.ts +7 -7
  64. package/models/gridDataSource.d.mts +3 -0
  65. package/models/gridDataSource.d.ts +3 -0
  66. package/models/gridRows.d.mts +28 -1
  67. package/models/gridRows.d.ts +28 -1
  68. package/models/props/DataGridProps.d.mts +3 -3
  69. package/models/props/DataGridProps.d.ts +3 -3
  70. package/package.json +6 -6
  71. package/utils/keyboardUtils.d.mts +1 -0
  72. package/utils/keyboardUtils.d.ts +1 -0
  73. package/utils/keyboardUtils.js +6 -0
  74. package/utils/keyboardUtils.mjs +5 -0
@@ -1,5 +1,10 @@
1
+ import type { Theme } from '@mui/material/styles';
1
2
  import type { GridCSSVariablesInterface } from "../constants/cssVariables.js";
2
3
  export declare function useMaterialCSSVariables(): {
3
4
  id: string;
4
5
  variables: GridCSSVariablesInterface;
5
- };
6
+ };
7
+ export declare function getBackgroundBase(theme: Theme): string;
8
+ export declare function getFontBody(theme: Theme): any;
9
+ export declare function getSpacingUnit(theme: Theme): any;
10
+ export declare function getBorderColor(theme: Theme): string;
@@ -4,6 +4,10 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
+ exports.getBackgroundBase = getBackgroundBase;
8
+ exports.getBorderColor = getBorderColor;
9
+ exports.getFontBody = getFontBody;
10
+ exports.getSpacingUnit = getSpacingUnit;
7
11
  exports.useMaterialCSSVariables = useMaterialCSSVariables;
8
12
  var React = _interopRequireWildcard(require("react"));
9
13
  var _styles = require("@mui/material/styles");
@@ -25,19 +29,19 @@ function transformTheme(t) {
25
29
  const borderColor = getBorderColor(t);
26
30
  const dataGridPalette = (t.vars || t).palette.DataGrid;
27
31
  const paperColor = (t.vars || t).palette.background.paper;
28
- const backgroundBase = dataGridPalette?.bg ?? (t.palette.mode === 'dark' ? (0, _GridRootStyles.colorMixIfSupported)(`color-mix(in srgb, ${paperColor} 95%, #fff)`, paperColor) : paperColor);
32
+ const backgroundBase = getBackgroundBase(t);
29
33
  const backgroundHeader = dataGridPalette?.headerBg ?? backgroundBase;
30
34
  const backgroundPinned = dataGridPalette?.pinnedBg ?? backgroundBase;
31
35
  const backgroundBackdrop = t.alpha((t.vars || t).palette.background.default, (t.vars || t).palette.action.disabledOpacity);
32
36
  const backgroundOverlay = t.palette.mode === 'dark' ? (0, _GridRootStyles.colorMixIfSupported)(`color-mix(in srgb, ${paperColor} 90%, #fff)`, paperColor) : paperColor;
33
37
  const selectedColor = (t.vars || t).palette.primary.main;
34
38
  const radius = getRadius(t);
35
- const fontBody = t.vars?.font?.body2 ?? formatFont(t.typography.body2);
39
+ const fontBody = getFontBody(t);
36
40
  const fontSmall = t.vars?.font?.caption ?? formatFont(t.typography.caption);
37
41
  const fontLarge = t.vars?.font?.body1 ?? formatFont(t.typography.body1);
38
42
  const k = _cssVariables.vars.keys;
39
43
  return {
40
- [k.spacingUnit]: t.vars ? t.vars.spacing ?? t.spacing(1) : t.spacing(1),
44
+ [k.spacingUnit]: getSpacingUnit(t),
41
45
  [k.colors.border.base]: borderColor,
42
46
  [k.colors.background.base]: backgroundBase,
43
47
  [k.colors.background.overlay]: backgroundOverlay,
@@ -85,6 +89,16 @@ function getRadius(theme) {
85
89
  }
86
90
  return typeof theme.shape.borderRadius === 'number' ? `${theme.shape.borderRadius}px` : theme.shape.borderRadius;
87
91
  }
92
+ function getBackgroundBase(theme) {
93
+ const paperColor = (theme.vars || theme).palette.background.paper;
94
+ return (theme.vars || theme).palette.DataGrid?.bg ?? (theme.palette.mode === 'dark' ? (0, _GridRootStyles.colorMixIfSupported)(`color-mix(in srgb, ${paperColor} 95%, #fff)`, paperColor) : paperColor);
95
+ }
96
+ function getFontBody(theme) {
97
+ return theme.vars?.font?.body2 ?? formatFont(theme.typography.body2);
98
+ }
99
+ function getSpacingUnit(theme) {
100
+ return theme.vars ? theme.vars.spacing ?? theme.spacing(1) : theme.spacing(1);
101
+ }
88
102
  function getBorderColor(theme) {
89
103
  if (theme.vars) {
90
104
  return theme.vars.palette.TableCell.border;
@@ -18,19 +18,19 @@ function transformTheme(t) {
18
18
  const borderColor = getBorderColor(t);
19
19
  const dataGridPalette = (t.vars || t).palette.DataGrid;
20
20
  const paperColor = (t.vars || t).palette.background.paper;
21
- const backgroundBase = dataGridPalette?.bg ?? (t.palette.mode === 'dark' ? colorMixIfSupported(`color-mix(in srgb, ${paperColor} 95%, #fff)`, paperColor) : paperColor);
21
+ const backgroundBase = getBackgroundBase(t);
22
22
  const backgroundHeader = dataGridPalette?.headerBg ?? backgroundBase;
23
23
  const backgroundPinned = dataGridPalette?.pinnedBg ?? backgroundBase;
24
24
  const backgroundBackdrop = t.alpha((t.vars || t).palette.background.default, (t.vars || t).palette.action.disabledOpacity);
25
25
  const backgroundOverlay = t.palette.mode === 'dark' ? colorMixIfSupported(`color-mix(in srgb, ${paperColor} 90%, #fff)`, paperColor) : paperColor;
26
26
  const selectedColor = (t.vars || t).palette.primary.main;
27
27
  const radius = getRadius(t);
28
- const fontBody = t.vars?.font?.body2 ?? formatFont(t.typography.body2);
28
+ const fontBody = getFontBody(t);
29
29
  const fontSmall = t.vars?.font?.caption ?? formatFont(t.typography.caption);
30
30
  const fontLarge = t.vars?.font?.body1 ?? formatFont(t.typography.body1);
31
31
  const k = vars.keys;
32
32
  return {
33
- [k.spacingUnit]: t.vars ? t.vars.spacing ?? t.spacing(1) : t.spacing(1),
33
+ [k.spacingUnit]: getSpacingUnit(t),
34
34
  [k.colors.border.base]: borderColor,
35
35
  [k.colors.background.base]: backgroundBase,
36
36
  [k.colors.background.overlay]: backgroundOverlay,
@@ -78,7 +78,17 @@ function getRadius(theme) {
78
78
  }
79
79
  return typeof theme.shape.borderRadius === 'number' ? `${theme.shape.borderRadius}px` : theme.shape.borderRadius;
80
80
  }
81
- function getBorderColor(theme) {
81
+ export function getBackgroundBase(theme) {
82
+ const paperColor = (theme.vars || theme).palette.background.paper;
83
+ return (theme.vars || theme).palette.DataGrid?.bg ?? (theme.palette.mode === 'dark' ? colorMixIfSupported(`color-mix(in srgb, ${paperColor} 95%, #fff)`, paperColor) : paperColor);
84
+ }
85
+ export function getFontBody(theme) {
86
+ return theme.vars?.font?.body2 ?? formatFont(theme.typography.body2);
87
+ }
88
+ export function getSpacingUnit(theme) {
89
+ return theme.vars ? theme.vars.spacing ?? theme.spacing(1) : theme.spacing(1);
90
+ }
91
+ export function getBorderColor(theme) {
82
92
  if (theme.vars) {
83
93
  return theme.vars.palette.TableCell.border;
84
94
  }
@@ -1,4 +1,4 @@
1
- import type { GridRowModel, GridRowId, GridRowModelUpdate, GridValidRowModel, GridTreeNode } from "../gridRows.mjs";
1
+ import type { GridRowModel, GridRowId, GridRowModelUpdate, GridRowModelReplace, GridValidRowModel, GridTreeNode } from "../gridRows.mjs";
2
2
  export type RowReorderDropPosition = 'above' | 'below' | 'inside';
3
3
  export type RowReorderDragDirection = 'up' | 'down';
4
4
  export interface GridRowGroupChildrenGetterParams {
@@ -58,10 +58,10 @@ export interface GridRowApi {
58
58
  */
59
59
  setRows: (rows: GridRowModel[]) => void;
60
60
  /**
61
- * Allows to update, insert and delete rows.
62
- * @param {GridRowModelUpdate[]} updates An array of rows with an `action` specifying what to do.
61
+ * Allows to update, insert, replace and delete rows.
62
+ * @param {Array<GridRowModelUpdate | GridRowModelReplace>} updates An array of rows with an `action` specifying what to do.
63
63
  */
64
- updateRows: (updates: GridRowModelUpdate[]) => void;
64
+ updateRows: (updates: Array<GridRowModelUpdate | GridRowModelReplace>) => void;
65
65
  /**
66
66
  * Gets the row data with a given id.
67
67
  * @param {GridRowId} id The id of the row.
@@ -139,11 +139,11 @@ export interface GridRowProApi {
139
139
  }
140
140
  export interface GridRowProPrivateApi {
141
141
  /**
142
- * Allows to update, insert and delete rows at a specific nested level.
143
- * @param {GridRowModelUpdate[]} updates An array of rows with an `action` specifying what to do.
142
+ * Allows to update, insert, replace and delete rows at a specific nested level.
143
+ * @param {Array<GridRowModelUpdate | GridRowModelReplace>} updates An array of rows with an `action` specifying what to do.
144
144
  * @param {string[]} nestedLevel The nested level of the rows to update, it represents the path to the row in the tree based on `node.groupingKey`.
145
145
  */
146
- updateNestedRows: (updates: GridRowModelUpdate[], nestedLevel?: string[]) => void;
146
+ updateNestedRows: (updates: Array<GridRowModelUpdate | GridRowModelReplace>, nestedLevel?: string[]) => void;
147
147
  }
148
148
  export interface GridRowSpanningPrivateApi {
149
149
  /**
@@ -1,4 +1,4 @@
1
- import type { GridRowModel, GridRowId, GridRowModelUpdate, GridValidRowModel, GridTreeNode } from "../gridRows.js";
1
+ import type { GridRowModel, GridRowId, GridRowModelUpdate, GridRowModelReplace, GridValidRowModel, GridTreeNode } from "../gridRows.js";
2
2
  export type RowReorderDropPosition = 'above' | 'below' | 'inside';
3
3
  export type RowReorderDragDirection = 'up' | 'down';
4
4
  export interface GridRowGroupChildrenGetterParams {
@@ -58,10 +58,10 @@ export interface GridRowApi {
58
58
  */
59
59
  setRows: (rows: GridRowModel[]) => void;
60
60
  /**
61
- * Allows to update, insert and delete rows.
62
- * @param {GridRowModelUpdate[]} updates An array of rows with an `action` specifying what to do.
61
+ * Allows to update, insert, replace and delete rows.
62
+ * @param {Array<GridRowModelUpdate | GridRowModelReplace>} updates An array of rows with an `action` specifying what to do.
63
63
  */
64
- updateRows: (updates: GridRowModelUpdate[]) => void;
64
+ updateRows: (updates: Array<GridRowModelUpdate | GridRowModelReplace>) => void;
65
65
  /**
66
66
  * Gets the row data with a given id.
67
67
  * @param {GridRowId} id The id of the row.
@@ -139,11 +139,11 @@ export interface GridRowProApi {
139
139
  }
140
140
  export interface GridRowProPrivateApi {
141
141
  /**
142
- * Allows to update, insert and delete rows at a specific nested level.
143
- * @param {GridRowModelUpdate[]} updates An array of rows with an `action` specifying what to do.
142
+ * Allows to update, insert, replace and delete rows at a specific nested level.
143
+ * @param {Array<GridRowModelUpdate | GridRowModelReplace>} updates An array of rows with an `action` specifying what to do.
144
144
  * @param {string[]} nestedLevel The nested level of the rows to update, it represents the path to the row in the tree based on `node.groupingKey`.
145
145
  */
146
- updateNestedRows: (updates: GridRowModelUpdate[], nestedLevel?: string[]) => void;
146
+ updateNestedRows: (updates: Array<GridRowModelUpdate | GridRowModelReplace>, nestedLevel?: string[]) => void;
147
147
  }
148
148
  export interface GridRowSpanningPrivateApi {
149
149
  /**
@@ -64,6 +64,9 @@ export interface GridDataSource {
64
64
  getRows(params: GridGetRowsParams): Promise<GridGetRowsResponse>;
65
65
  /**
66
66
  * This method will be called when the user updates a row.
67
+ * Resolve with the updated row to merge it into the existing one, or with a
68
+ * `{ _action: 'replace', row }` update ([[GridRowModelReplace]]) to store `row` as the new row
69
+ * without merging, which preserves its prototype chain, its `#private` fields and its identity.
67
70
  * @param {GridUpdateRowParams} params The parameters required to update the row.
68
71
  * @returns {Promise<any>} If resolved (synced on the backend), the grid will update the row and mutate the cache.
69
72
  */
@@ -64,6 +64,9 @@ export interface GridDataSource {
64
64
  getRows(params: GridGetRowsParams): Promise<GridGetRowsResponse>;
65
65
  /**
66
66
  * This method will be called when the user updates a row.
67
+ * Resolve with the updated row to merge it into the existing one, or with a
68
+ * `{ _action: 'replace', row }` update ([[GridRowModelReplace]]) to store `row` as the new row
69
+ * without merging, which preserves its prototype chain, its `#private` fields and its identity.
67
70
  * @param {GridUpdateRowParams} params The parameters required to update the row.
68
71
  * @returns {Promise<any>} If resolved (synced on the backend), the grid will update the row and mutate the cache.
69
72
  */
@@ -7,9 +7,36 @@ export type GridRowsProp<R extends GridValidRowModel = GridValidRowModel> = Read
7
7
  * The key value object representing the data of a row.
8
8
  */
9
9
  export type GridRowModel<R extends GridValidRowModel = GridValidRowModel> = R;
10
+ /**
11
+ * @deprecated Use `GridRowModelUpdate` or `GridRowModelReplace` instead.
12
+ */
10
13
  export type GridUpdateAction = 'delete';
11
14
  export interface GridRowModelUpdate extends GridRowModel {
12
- _action?: GridUpdateAction;
15
+ /**
16
+ * - `'delete'` removes the row.
17
+ * - `undefined` (default) performs a shallow, `Object.assign`-style partial merge into
18
+ * the existing row, which produces a new object.
19
+ *
20
+ * To store an object as the row without merging, see [[GridRowModelReplace]].
21
+ */
22
+ _action?: 'delete';
23
+ }
24
+ /**
25
+ * A row update that stores `row` as-is instead of merging it into the existing row.
26
+ * Use this when the row is a class instance (e.g. one with `#private` fields) whose
27
+ * prototype chain and object identity must be preserved across the update:
28
+ * `apiRef.current.getRow(id)` then returns the very object provided in `row`.
29
+ * Any field missing from `row` is removed from the stored row, because a replace is
30
+ * never a merge.
31
+ * It can be passed to `updateRows()` or returned from `processRowUpdate()`.
32
+ */
33
+ export interface GridRowModelReplace<R extends GridValidRowModel = GridValidRowModel> {
34
+ _action: 'replace';
35
+ /**
36
+ * The object stored as the new row, verbatim. Pass the instance itself — spreading it
37
+ * (`{ ...row }`) creates a plain object and defeats the purpose.
38
+ */
39
+ row: R;
13
40
  }
14
41
  /**
15
42
  * The grid rows total height and row positions.
@@ -7,9 +7,36 @@ export type GridRowsProp<R extends GridValidRowModel = GridValidRowModel> = Read
7
7
  * The key value object representing the data of a row.
8
8
  */
9
9
  export type GridRowModel<R extends GridValidRowModel = GridValidRowModel> = R;
10
+ /**
11
+ * @deprecated Use `GridRowModelUpdate` or `GridRowModelReplace` instead.
12
+ */
10
13
  export type GridUpdateAction = 'delete';
11
14
  export interface GridRowModelUpdate extends GridRowModel {
12
- _action?: GridUpdateAction;
15
+ /**
16
+ * - `'delete'` removes the row.
17
+ * - `undefined` (default) performs a shallow, `Object.assign`-style partial merge into
18
+ * the existing row, which produces a new object.
19
+ *
20
+ * To store an object as the row without merging, see [[GridRowModelReplace]].
21
+ */
22
+ _action?: 'delete';
23
+ }
24
+ /**
25
+ * A row update that stores `row` as-is instead of merging it into the existing row.
26
+ * Use this when the row is a class instance (e.g. one with `#private` fields) whose
27
+ * prototype chain and object identity must be preserved across the update:
28
+ * `apiRef.current.getRow(id)` then returns the very object provided in `row`.
29
+ * Any field missing from `row` is removed from the stored row, because a replace is
30
+ * never a merge.
31
+ * It can be passed to `updateRows()` or returned from `processRowUpdate()`.
32
+ */
33
+ export interface GridRowModelReplace<R extends GridValidRowModel = GridValidRowModel> {
34
+ _action: 'replace';
35
+ /**
36
+ * The object stored as the new row, verbatim. Pass the instance itself — spreading it
37
+ * (`{ ...row }`) creates a plain object and defeats the purpose.
38
+ */
39
+ row: R;
13
40
  }
14
41
  /**
15
42
  * The grid rows total height and row positions.
@@ -8,7 +8,7 @@ import type { GridFeatureMode } from "../gridFeatureMode.mjs";
8
8
  import type { Logger } from "../logger.mjs";
9
9
  import type { GridSortDirection, GridSortModel } from "../gridSortModel.mjs";
10
10
  import type { GridSlotsComponent } from "../gridSlotsComponent.mjs";
11
- import type { GridRowId, GridRowIdGetter, GridRowsProp, GridValidRowModel } from "../gridRows.mjs";
11
+ import type { GridRowId, GridRowIdGetter, GridRowModelReplace, GridRowsProp, GridValidRowModel } from "../gridRows.mjs";
12
12
  import type { GridEventListener } from "../events/index.mjs";
13
13
  import type { GridCallbackDetails, GridLocaleText } from "../api/index.mjs";
14
14
  import type { GridApiCommunity } from "../api/gridApiCommunity.mjs";
@@ -816,11 +816,11 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
816
816
  * @param {R} newRow Row object with the new values.
817
817
  * @param {R} oldRow Row object with the old values.
818
818
  * @param {{ rowId: GridRowId }} params Additional parameters.
819
- * @returns {Promise<R> | R} The final values to update the row.
819
+ * @returns {Promise<R | GridRowModelReplace<R>> | R | GridRowModelReplace<R>} The final values to update the row, or a `{ _action: 'replace', row }` update to store `row` as the new row without merging.
820
820
  */
821
821
  processRowUpdate?: (newRow: R, oldRow: R, params: {
822
822
  rowId: GridRowId;
823
- }) => Promise<R> | R;
823
+ }) => Promise<R | GridRowModelReplace<R>> | R | GridRowModelReplace<R>;
824
824
  /**
825
825
  * Callback called when `processRowUpdate()` throws an error or rejects.
826
826
  * @param {any} error The error thrown.
@@ -8,7 +8,7 @@ import type { GridFeatureMode } from "../gridFeatureMode.js";
8
8
  import type { Logger } from "../logger.js";
9
9
  import type { GridSortDirection, GridSortModel } from "../gridSortModel.js";
10
10
  import type { GridSlotsComponent } from "../gridSlotsComponent.js";
11
- import type { GridRowId, GridRowIdGetter, GridRowsProp, GridValidRowModel } from "../gridRows.js";
11
+ import type { GridRowId, GridRowIdGetter, GridRowModelReplace, GridRowsProp, GridValidRowModel } from "../gridRows.js";
12
12
  import type { GridEventListener } from "../events/index.js";
13
13
  import type { GridCallbackDetails, GridLocaleText } from "../api/index.js";
14
14
  import type { GridApiCommunity } from "../api/gridApiCommunity.js";
@@ -816,11 +816,11 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
816
816
  * @param {R} newRow Row object with the new values.
817
817
  * @param {R} oldRow Row object with the old values.
818
818
  * @param {{ rowId: GridRowId }} params Additional parameters.
819
- * @returns {Promise<R> | R} The final values to update the row.
819
+ * @returns {Promise<R | GridRowModelReplace<R>> | R | GridRowModelReplace<R>} The final values to update the row, or a `{ _action: 'replace', row }` update to store `row` as the new row without merging.
820
820
  */
821
821
  processRowUpdate?: (newRow: R, oldRow: R, params: {
822
822
  rowId: GridRowId;
823
- }) => Promise<R> | R;
823
+ }) => Promise<R | GridRowModelReplace<R>> | R | GridRowModelReplace<R>;
824
824
  /**
825
825
  * Callback called when `processRowUpdate()` throws an error or rejects.
826
826
  * @param {any} error The error thrown.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid",
3
- "version": "9.12.0",
3
+ "version": "9.13.0",
4
4
  "author": "MUI Team",
5
5
  "description": "The Community plan edition of the MUI X Data Grid components.",
6
6
  "license": "MIT",
@@ -38,13 +38,13 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@babel/runtime": "^7.29.7",
41
- "@base-ui/utils": "^0.3.1",
42
- "@mui/utils": "^9.3.0",
41
+ "@base-ui/utils": "^0.3.2",
42
+ "@mui/utils": "^9.4.0",
43
+ "@mui/x-internals": "^9.13.0",
44
+ "@mui/x-virtualizer": "0.7.1",
43
45
  "clsx": "^2.1.1",
44
46
  "prop-types": "^15.8.1",
45
- "use-sync-external-store": "^1.6.0",
46
- "@mui/x-internals": "^9.12.0",
47
- "@mui/x-virtualizer": "0.7.0"
47
+ "use-sync-external-store": "^1.6.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@emotion/react": "^11.9.0",
@@ -5,6 +5,7 @@ export declare const isKeyboardEvent: (event: any) => event is React.KeyboardEve
5
5
  export declare const isHideMenuKey: (key: React.KeyboardEvent['key']) => key is "Escape" | "Tab";
6
6
  export declare function isPasteShortcut(event: React.KeyboardEvent): boolean;
7
7
  export declare function isCopyShortcut(event: KeyboardEvent): boolean;
8
+ export declare function isSelectAllShortcut(event: React.KeyboardEvent): boolean;
8
9
  export declare function isUndoShortcut(event: React.KeyboardEvent): boolean;
9
10
  export declare function isFillDownShortcut(event: React.KeyboardEvent): boolean;
10
11
  export declare function isFillRightShortcut(event: React.KeyboardEvent): boolean;
@@ -5,6 +5,7 @@ export declare const isKeyboardEvent: (event: any) => event is React.KeyboardEve
5
5
  export declare const isHideMenuKey: (key: React.KeyboardEvent['key']) => key is "Escape" | "Tab";
6
6
  export declare function isPasteShortcut(event: React.KeyboardEvent): boolean;
7
7
  export declare function isCopyShortcut(event: KeyboardEvent): boolean;
8
+ export declare function isSelectAllShortcut(event: React.KeyboardEvent): boolean;
8
9
  export declare function isUndoShortcut(event: React.KeyboardEvent): boolean;
9
10
  export declare function isFillDownShortcut(event: React.KeyboardEvent): boolean;
10
11
  export declare function isFillRightShortcut(event: React.KeyboardEvent): boolean;
@@ -10,6 +10,7 @@ exports.isNavigationKey = exports.isKeyboardEvent = exports.isHideMenuKey = void
10
10
  exports.isPasteShortcut = isPasteShortcut;
11
11
  exports.isPrintableKey = isPrintableKey;
12
12
  exports.isRedoShortcut = isRedoShortcut;
13
+ exports.isSelectAllShortcut = isSelectAllShortcut;
13
14
  exports.isUndoShortcut = isUndoShortcut;
14
15
  // Non printable keys have a name, for example "ArrowRight", see the whole list:
15
16
  // https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
@@ -44,6 +45,11 @@ function isPasteShortcut(event) {
44
45
  function isCopyShortcut(event) {
45
46
  return (event.ctrlKey || event.metaKey) && String.fromCharCode(event.keyCode) === 'C' && !event.shiftKey && !event.altKey;
46
47
  }
48
+
49
+ // Checks if the keyboard event corresponds to the select-all shortcut (CTRL+A or CMD+A) across different localization keyboards.
50
+ function isSelectAllShortcut(event) {
51
+ return (event.ctrlKey || event.metaKey) && String.fromCharCode(event.keyCode) === 'A' && !event.shiftKey && !event.altKey;
52
+ }
47
53
  function isUndoShortcut(event) {
48
54
  return (event.ctrlKey || event.metaKey) && String.fromCharCode(event.keyCode) === 'Z' && !event.shiftKey && !event.altKey;
49
55
  }
@@ -28,6 +28,11 @@ export function isPasteShortcut(event) {
28
28
  export function isCopyShortcut(event) {
29
29
  return (event.ctrlKey || event.metaKey) && String.fromCharCode(event.keyCode) === 'C' && !event.shiftKey && !event.altKey;
30
30
  }
31
+
32
+ // Checks if the keyboard event corresponds to the select-all shortcut (CTRL+A or CMD+A) across different localization keyboards.
33
+ export function isSelectAllShortcut(event) {
34
+ return (event.ctrlKey || event.metaKey) && String.fromCharCode(event.keyCode) === 'A' && !event.shiftKey && !event.altKey;
35
+ }
31
36
  export function isUndoShortcut(event) {
32
37
  return (event.ctrlKey || event.metaKey) && String.fromCharCode(event.keyCode) === 'Z' && !event.shiftKey && !event.altKey;
33
38
  }