@mui/x-data-grid 8.14.1 → 8.16.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 (130) hide show
  1. package/CHANGELOG.md +207 -0
  2. package/DataGrid/DataGrid.js +2 -0
  3. package/DataGrid/useDataGridComponent.js +1 -1
  4. package/components/GridScrollShadows.js +23 -3
  5. package/constants/gridClasses.d.ts +12 -0
  6. package/constants/gridClasses.js +1 -1
  7. package/constants/localeTextConstants.js +2 -1
  8. package/esm/DataGrid/DataGrid.js +2 -0
  9. package/esm/DataGrid/useDataGridComponent.js +1 -1
  10. package/esm/components/GridScrollShadows.js +22 -3
  11. package/esm/constants/gridClasses.d.ts +12 -0
  12. package/esm/constants/gridClasses.js +1 -1
  13. package/esm/constants/localeTextConstants.js +2 -1
  14. package/esm/hooks/core/strategyProcessing/gridStrategyProcessingApi.d.ts +6 -4
  15. package/esm/hooks/features/dataSource/models.d.ts +28 -28
  16. package/esm/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
  17. package/esm/hooks/features/dataSource/useGridDataSourceBase.js +27 -14
  18. package/esm/hooks/features/dataSource/utils.d.ts +2 -1
  19. package/esm/hooks/features/dataSource/utils.js +2 -1
  20. package/esm/hooks/features/editing/useGridCellEditable.d.ts +5 -0
  21. package/esm/hooks/features/editing/useGridCellEditable.js +9 -0
  22. package/esm/hooks/features/editing/useGridEditing.d.ts +2 -1
  23. package/esm/hooks/features/editing/useGridEditing.js +4 -4
  24. package/esm/hooks/features/focus/useGridFocus.js +4 -2
  25. package/esm/hooks/features/rowSelection/useGridRowSelection.js +3 -1
  26. package/esm/index.js +1 -1
  27. package/esm/internals/index.d.ts +3 -1
  28. package/esm/internals/index.js +1 -0
  29. package/esm/locales/arSD.js +1 -0
  30. package/esm/locales/beBY.js +1 -0
  31. package/esm/locales/bgBG.js +1 -0
  32. package/esm/locales/bnBD.js +1 -0
  33. package/esm/locales/csCZ.js +1 -0
  34. package/esm/locales/daDK.js +1 -0
  35. package/esm/locales/deDE.js +1 -0
  36. package/esm/locales/elGR.js +1 -0
  37. package/esm/locales/esES.js +109 -119
  38. package/esm/locales/faIR.js +1 -0
  39. package/esm/locales/fiFI.js +1 -0
  40. package/esm/locales/frFR.js +1 -0
  41. package/esm/locales/heIL.js +1 -0
  42. package/esm/locales/hrHR.js +1 -0
  43. package/esm/locales/huHU.js +1 -0
  44. package/esm/locales/hyAM.js +1 -0
  45. package/esm/locales/idID.js +1 -0
  46. package/esm/locales/isIS.js +1 -0
  47. package/esm/locales/itIT.js +1 -0
  48. package/esm/locales/jaJP.js +1 -0
  49. package/esm/locales/koKR.js +1 -0
  50. package/esm/locales/nbNO.js +1 -0
  51. package/esm/locales/nlNL.js +1 -0
  52. package/esm/locales/nnNO.js +1 -0
  53. package/esm/locales/plPL.js +1 -0
  54. package/esm/locales/ptBR.js +1 -0
  55. package/esm/locales/ptPT.js +1 -0
  56. package/esm/locales/roRO.js +1 -0
  57. package/esm/locales/ruRU.js +1 -0
  58. package/esm/locales/skSK.js +1 -0
  59. package/esm/locales/svSE.js +1 -0
  60. package/esm/locales/trTR.js +1 -0
  61. package/esm/locales/ukUA.js +1 -0
  62. package/esm/locales/urPK.js +1 -0
  63. package/esm/locales/viVN.js +1 -0
  64. package/esm/locales/zhCN.js +1 -0
  65. package/esm/locales/zhHK.js +1 -0
  66. package/esm/locales/zhTW.js +1 -0
  67. package/esm/models/api/gridLocaleTextApi.d.ts +1 -0
  68. package/esm/models/configuration/gridCellEditableConfiguration.d.ts +19 -0
  69. package/esm/models/configuration/gridCellEditableConfiguration.js +1 -0
  70. package/esm/models/configuration/gridConfiguration.d.ts +2 -1
  71. package/esm/models/gridDataSource.d.ts +13 -0
  72. package/hooks/core/strategyProcessing/gridStrategyProcessingApi.d.ts +6 -4
  73. package/hooks/features/dataSource/models.d.ts +28 -28
  74. package/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
  75. package/hooks/features/dataSource/useGridDataSourceBase.js +27 -14
  76. package/hooks/features/dataSource/utils.d.ts +2 -1
  77. package/hooks/features/dataSource/utils.js +2 -1
  78. package/hooks/features/editing/useGridCellEditable.d.ts +5 -0
  79. package/hooks/features/editing/useGridCellEditable.js +15 -0
  80. package/hooks/features/editing/useGridEditing.d.ts +2 -1
  81. package/hooks/features/editing/useGridEditing.js +4 -4
  82. package/hooks/features/focus/useGridFocus.js +4 -2
  83. package/hooks/features/rowSelection/useGridRowSelection.js +3 -1
  84. package/index.js +1 -1
  85. package/internals/index.d.ts +3 -1
  86. package/internals/index.js +8 -0
  87. package/locales/arSD.js +1 -0
  88. package/locales/beBY.js +1 -0
  89. package/locales/bgBG.js +1 -0
  90. package/locales/bnBD.js +1 -0
  91. package/locales/csCZ.js +1 -0
  92. package/locales/daDK.js +1 -0
  93. package/locales/deDE.js +1 -0
  94. package/locales/elGR.js +1 -0
  95. package/locales/esES.js +109 -119
  96. package/locales/faIR.js +1 -0
  97. package/locales/fiFI.js +1 -0
  98. package/locales/frFR.js +1 -0
  99. package/locales/heIL.js +1 -0
  100. package/locales/hrHR.js +1 -0
  101. package/locales/huHU.js +1 -0
  102. package/locales/hyAM.js +1 -0
  103. package/locales/idID.js +1 -0
  104. package/locales/isIS.js +1 -0
  105. package/locales/itIT.js +1 -0
  106. package/locales/jaJP.js +1 -0
  107. package/locales/koKR.js +1 -0
  108. package/locales/nbNO.js +1 -0
  109. package/locales/nlNL.js +1 -0
  110. package/locales/nnNO.js +1 -0
  111. package/locales/plPL.js +1 -0
  112. package/locales/ptBR.js +1 -0
  113. package/locales/ptPT.js +1 -0
  114. package/locales/roRO.js +1 -0
  115. package/locales/ruRU.js +1 -0
  116. package/locales/skSK.js +1 -0
  117. package/locales/svSE.js +1 -0
  118. package/locales/trTR.js +1 -0
  119. package/locales/ukUA.js +1 -0
  120. package/locales/urPK.js +1 -0
  121. package/locales/viVN.js +1 -0
  122. package/locales/zhCN.js +1 -0
  123. package/locales/zhHK.js +1 -0
  124. package/locales/zhTW.js +1 -0
  125. package/models/api/gridLocaleTextApi.d.ts +1 -0
  126. package/models/configuration/gridCellEditableConfiguration.d.ts +19 -0
  127. package/models/configuration/gridCellEditableConfiguration.js +5 -0
  128. package/models/configuration/gridConfiguration.d.ts +2 -1
  129. package/models/gridDataSource.d.ts +13 -0
  130. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
- import { GridRowTreeCreationParams, GridRowTreeCreationValue, GridRowsState } from "../../features/rows/gridRowsInterfaces.js";
2
- import { GridFilteringMethodParams, GridFilteringMethodValue, GridFilterState, GridVisibleRowsLookupState } from "../../features/filter/gridFilterState.js";
3
- import { GridSortingMethodParams, GridSortingMethodValue } from "../../features/sorting/gridSortingState.js";
4
- import { GridGetRowsParams, GridGetRowsResponse } from "../../../models/gridDataSource.js";
1
+ import type { GridRowTreeCreationParams, GridRowTreeCreationValue, GridRowsState } from "../../features/rows/gridRowsInterfaces.js";
2
+ import type { GridFilteringMethodParams, GridFilteringMethodValue, GridFilterState, GridVisibleRowsLookupState } from "../../features/filter/gridFilterState.js";
3
+ import type { GridSortingMethodParams, GridSortingMethodValue } from "../../features/sorting/gridSortingState.js";
4
+ import type { GridGetRowsParams, GridGetRowsResponse, GridGetRowsOptions } from "../../../models/gridDataSource.js";
5
5
  export type GridStrategyProcessorName = keyof GridStrategyProcessingLookup;
6
6
  export declare enum GridStrategyGroup {
7
7
  DataSource = "dataSource",
@@ -14,9 +14,11 @@ export interface GridStrategyProcessingLookup {
14
14
  params: {
15
15
  response: GridGetRowsResponse;
16
16
  fetchParams: GridGetRowsParams;
17
+ options: GridGetRowsOptions;
17
18
  } | {
18
19
  error: Error;
19
20
  fetchParams: GridGetRowsParams;
21
+ options: GridGetRowsOptions;
20
22
  };
21
23
  value: void;
22
24
  };
@@ -1,40 +1,40 @@
1
- import type { GridDataSourceCache, GridGetRowsParams, GridUpdateRowParams } from "../../../models/gridDataSource.js";
1
+ import type { GridDataSourceCache, GridGetRowsParams, GridUpdateRowParams, GridGetRowsOptions } from "../../../models/gridDataSource.js";
2
2
  import type { GridRowId, GridRowModel } from "../../../models/gridRows.js";
3
3
  import type { GridDataSourceCacheDefaultConfig } from "./cache.js";
4
4
  /**
5
5
  * The parameters for the `fetchRows` method.
6
6
  */
7
- export interface GridDataSourceFetchRowsParams extends Partial<GridGetRowsParams> {
8
- /**
9
- * If `true`, bypasses the cache and forces a refetch of the rows from the server.
10
- */
11
- skipCache?: boolean;
12
- }
13
- export interface GridDataSourceApiBase {
14
- /**
15
- * Fetches the rows from the server.
16
- * If no `parentId` option is provided, it fetches the root rows.
17
- * Any missing parameter from `params` will be filled from the state (sorting, filtering, etc.).
18
- * @param {GridRowId} parentId The id of the parent node (default: `GRID_ROOT_GROUP_ID`).
19
- * @param {GridDataSourceFetchRowsParams} params Request parameters override.
20
- */
21
- fetchRows: (parentId?: GridRowId, params?: GridDataSourceFetchRowsParams) => void;
22
- /**
23
- * The data source cache object.
24
- */
25
- cache: GridDataSourceCache;
26
- /**
27
- * Syncs the row with the server and updates in the grid.
28
- * @param {GridUpdateRowParams} params The parameters for the edit operation.
29
- * @returns {Promise<GridRowModel> | undefined} The updated row or `undefined` if `dataSource.updateRow` is not passed.
30
- */
31
- editRow: (params: GridUpdateRowParams) => Promise<GridRowModel> | undefined;
32
- }
7
+ export type GridDataSourceFetchRowsParams<T> = Partial<T> & GridGetRowsOptions;
33
8
  export interface GridDataSourceApi {
34
9
  /**
35
10
  * The data source API.
36
11
  */
37
- dataSource: GridDataSourceApiBase;
12
+ dataSource: {
13
+ /**
14
+ * Fetches the rows from the server.
15
+ * If no `parentId` option is provided, it fetches the root rows.
16
+ * Any missing parameter from `params` will be filled from the state (sorting, filtering, etc.).
17
+ * @param {GridRowId} parentId The id of the parent node (default: `GRID_ROOT_GROUP_ID`).
18
+ * @param {GridDataSourceFetchRowsParams<GridGetRowsParams>} params Request parameters override.
19
+ * @returns {Promise<void>} A promise that resolves when the rows are fetched.
20
+ */
21
+ fetchRows: (parentId?: GridRowId, params?: GridDataSourceFetchRowsParams<GridGetRowsParams>) => Promise<void>;
22
+ /**
23
+ * The data source cache object.
24
+ */
25
+ cache: GridDataSourceCache;
26
+ /**
27
+ * Syncs the row with the server and updates in the grid.
28
+ * @param {GridUpdateRowParams} params The parameters for the edit operation.
29
+ * @returns {Promise<GridRowModel> | undefined} The updated row or `undefined` if `dataSource.updateRow` is not passed.
30
+ */
31
+ editRow: (params: GridUpdateRowParams) => Promise<GridRowModel> | undefined;
32
+ };
33
+ }
34
+ export interface GridDataSourceApiBase {
35
+ fetchRows: GridDataSourceApi['dataSource']['fetchRows'];
36
+ cache: GridDataSourceApi['dataSource']['cache'];
37
+ editRow: GridDataSourceApi['dataSource']['editRow'];
38
38
  }
39
39
  export interface GridDataSourceBaseOptions {
40
40
  cacheOptions?: GridDataSourceCacheDefaultConfig;
@@ -10,7 +10,7 @@ export declare const useGridDataSourceBase: <Api extends GridPrivateApiCommunity
10
10
  api: {
11
11
  public: GridDataSourceApi;
12
12
  };
13
- debouncedFetchRows: ((parentId?: import("@mui/x-data-grid").GridRowId, params?: import("./models.js").GridDataSourceFetchRowsParams) => void) & import("@mui/utils/debounce").Cancelable;
13
+ debouncedFetchRows: ((parentId?: import("@mui/x-data-grid").GridRowId, params?: import("./models.js").GridDataSourceFetchRowsParams<import("@mui/x-data-grid").GridGetRowsParams>) => Promise<void>) & import("@mui/utils/debounce").Cancelable;
14
14
  strategyProcessor: {
15
15
  strategyName: DataSourceRowsUpdateStrategy;
16
16
  group: "dataSourceRowsUpdate";
@@ -23,7 +23,7 @@ var _gridDataSourceSelector = require("./gridDataSourceSelector");
23
23
  var _utils2 = require("./utils");
24
24
  var _cache = require("./cache");
25
25
  var _gridDataSourceError = require("./gridDataSourceError");
26
- const _excluded = ["skipCache"];
26
+ const _excluded = ["skipCache", "keepChildrenExpanded"];
27
27
  const noopCache = {
28
28
  clear: () => {},
29
29
  get: () => undefined,
@@ -40,8 +40,8 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
40
40
  apiRef.current.setStrategyAvailability(_strategyProcessing.GridStrategyGroup.DataSource, _utils2.DataSourceRowsUpdateStrategy.Default, props.dataSource ? () => true : () => false);
41
41
  }, [apiRef, props.dataSource]);
42
42
  const [currentStrategy, setCurrentStrategy] = React.useState(apiRef.current.getActiveStrategy(_strategyProcessing.GridStrategyGroup.DataSource));
43
- const defaultRowsUpdateStrategyActive = React.useMemo(() => {
44
- return currentStrategy === _utils2.DataSourceRowsUpdateStrategy.Default;
43
+ const standardRowsUpdateStrategyActive = React.useMemo(() => {
44
+ return currentStrategy === _utils2.DataSourceRowsUpdateStrategy.Default || currentStrategy === _utils2.DataSourceRowsUpdateStrategy.GroupedData;
45
45
  }, [currentStrategy]);
46
46
  const paginationModel = (0, _useGridSelector.useGridSelector)(apiRef, _gridPaginationSelector.gridPaginationModelSelector);
47
47
  const lastRequestId = React.useRef(0);
@@ -67,7 +67,8 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
67
67
  options.clearDataSourceState?.();
68
68
  const _ref = params || {},
69
69
  {
70
- skipCache
70
+ skipCache,
71
+ keepChildrenExpanded
71
72
  } = _ref,
72
73
  getRowsParams = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
73
74
  const fetchParams = (0, _extends2.default)({}, (0, _gridDataSourceSelector.gridGetRowsParamsSelector)(apiRef), apiRef.current.unstable_applyPipeProcessors('getRowsParams', {}), getRowsParams);
@@ -76,13 +77,17 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
76
77
  if (!skipCache && responses.every(response => response !== undefined)) {
77
78
  apiRef.current.applyStrategyProcessor('dataSourceRowsUpdate', {
78
79
  response: _utils2.CacheChunkManager.mergeResponses(responses),
79
- fetchParams
80
+ fetchParams,
81
+ options: {
82
+ skipCache,
83
+ keepChildrenExpanded
84
+ }
80
85
  });
81
86
  return;
82
87
  }
83
88
 
84
89
  // Manage loading state only for the default strategy
85
- if (defaultRowsUpdateStrategyActive || apiRef.current.getRowsCount() === 0) {
90
+ if (standardRowsUpdateStrategyActive || apiRef.current.getRowsCount() === 0) {
86
91
  apiRef.current.setLoading(true);
87
92
  }
88
93
  const requestId = lastRequestId.current + 1;
@@ -94,14 +99,22 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
94
99
  if (lastRequestId.current === requestId) {
95
100
  apiRef.current.applyStrategyProcessor('dataSourceRowsUpdate', {
96
101
  response: getRowsResponse,
97
- fetchParams
102
+ fetchParams,
103
+ options: {
104
+ skipCache,
105
+ keepChildrenExpanded
106
+ }
98
107
  });
99
108
  }
100
109
  } catch (originalError) {
101
110
  if (lastRequestId.current === requestId) {
102
111
  apiRef.current.applyStrategyProcessor('dataSourceRowsUpdate', {
103
112
  error: originalError,
104
- fetchParams
113
+ fetchParams,
114
+ options: {
115
+ skipCache,
116
+ keepChildrenExpanded
117
+ }
105
118
  });
106
119
  if (typeof onDataSourceErrorProp === 'function') {
107
120
  onDataSourceErrorProp(new _gridDataSourceError.GridGetRowsError({
@@ -114,11 +127,11 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
114
127
  }
115
128
  }
116
129
  } finally {
117
- if (defaultRowsUpdateStrategyActive && lastRequestId.current === requestId) {
130
+ if (standardRowsUpdateStrategyActive && lastRequestId.current === requestId) {
118
131
  apiRef.current.setLoading(false);
119
132
  }
120
133
  }
121
- }, [cacheChunkManager, cache, apiRef, defaultRowsUpdateStrategyActive, props.dataSource?.getRows, onDataSourceErrorProp, options, props.signature]);
134
+ }, [cacheChunkManager, cache, apiRef, standardRowsUpdateStrategyActive, props.dataSource?.getRows, onDataSourceErrorProp, options, props.signature]);
122
135
  const handleStrategyActivityChange = React.useCallback(() => {
123
136
  setCurrentStrategy(apiRef.current.getActiveStrategy(_strategyProcessing.GridStrategyGroup.DataSource));
124
137
  }, [apiRef]);
@@ -193,7 +206,7 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
193
206
  React.useEffect(() => {
194
207
  // Return early if the proper strategy isn't set yet
195
208
  // Context: https://github.com/mui/mui-x/issues/19650
196
- if (currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.Default && currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.LazyLoading) {
209
+ if (currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.Default && currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.LazyLoading && currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.GroupedData) {
197
210
  return undefined;
198
211
  }
199
212
  if (props.dataSource) {
@@ -220,9 +233,9 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
220
233
  cache,
221
234
  events: {
222
235
  strategyAvailabilityChange: handleStrategyActivityChange,
223
- sortModelChange: (0, _utils.runIf)(defaultRowsUpdateStrategyActive, () => debouncedFetchRows()),
224
- filterModelChange: (0, _utils.runIf)(defaultRowsUpdateStrategyActive, () => debouncedFetchRows()),
225
- paginationModelChange: (0, _utils.runIf)(defaultRowsUpdateStrategyActive, () => debouncedFetchRows())
236
+ sortModelChange: (0, _utils.runIf)(standardRowsUpdateStrategyActive, () => debouncedFetchRows()),
237
+ filterModelChange: (0, _utils.runIf)(standardRowsUpdateStrategyActive, () => debouncedFetchRows()),
238
+ paginationModelChange: (0, _utils.runIf)(standardRowsUpdateStrategyActive, () => debouncedFetchRows())
226
239
  }
227
240
  };
228
241
  };
@@ -1,7 +1,8 @@
1
1
  import type { GridGetRowsParams, GridGetRowsResponse } from "../../../models/gridDataSource.js";
2
2
  export declare enum DataSourceRowsUpdateStrategy {
3
- Default = "set-new-rows",
3
+ Default = "set-flat-rows",
4
4
  LazyLoading = "replace-row-range",
5
+ GroupedData = "set-grouped-rows",
5
6
  }
6
7
  /**
7
8
  * Provides better cache hit rate by:
@@ -7,8 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.DataSourceRowsUpdateStrategy = exports.CacheChunkManager = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  let DataSourceRowsUpdateStrategy = exports.DataSourceRowsUpdateStrategy = /*#__PURE__*/function (DataSourceRowsUpdateStrategy) {
10
- DataSourceRowsUpdateStrategy["Default"] = "set-new-rows";
10
+ DataSourceRowsUpdateStrategy["Default"] = "set-flat-rows";
11
11
  DataSourceRowsUpdateStrategy["LazyLoading"] = "replace-row-range";
12
+ DataSourceRowsUpdateStrategy["GroupedData"] = "set-grouped-rows";
12
13
  return DataSourceRowsUpdateStrategy;
13
14
  }({});
14
15
  /**
@@ -0,0 +1,5 @@
1
+ import { CellEditableConditionFn } from "../../../models/configuration/gridCellEditableConfiguration.js";
2
+ /**
3
+ * Default implementation of the cell editable condition hook
4
+ */
5
+ export declare const useIsCellEditable: () => CellEditableConditionFn;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.useIsCellEditable = void 0;
9
+ var React = _interopRequireWildcard(require("react"));
10
+ var _gridRowsUtils = require("../rows/gridRowsUtils");
11
+ /**
12
+ * Default implementation of the cell editable condition hook
13
+ */
14
+ const useIsCellEditable = () => React.useCallback(params => !(0, _gridRowsUtils.isAutogeneratedRowNode)(params.rowNode), []);
15
+ exports.useIsCellEditable = useIsCellEditable;
@@ -1,6 +1,7 @@
1
1
  import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.js";
3
3
  import { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
4
+ import { GridConfiguration } from "../../../models/configuration/gridConfiguration.js";
4
5
  import { GridStateInitializer } from "../../utils/useGridInitializeState.js";
5
6
  export declare const editingStateInitializer: GridStateInitializer;
6
- export declare const useGridEditing: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "isCellEditable" | "editMode" | "processRowUpdate" | "dataSource" | "onDataSourceError">) => void;
7
+ export declare const useGridEditing: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "isCellEditable" | "editMode" | "processRowUpdate" | "dataSource" | "onDataSourceError">, configuration: GridConfiguration) => void;
@@ -14,20 +14,20 @@ var _useGridCellEditing = require("./useGridCellEditing");
14
14
  var _gridEditRowModel = require("../../../models/gridEditRowModel");
15
15
  var _useGridRowEditing = require("./useGridRowEditing");
16
16
  var _gridEditingSelectors = require("./gridEditingSelectors");
17
- var _gridRowsUtils = require("../rows/gridRowsUtils");
18
17
  const editingStateInitializer = state => (0, _extends2.default)({}, state, {
19
18
  editRows: {}
20
19
  });
21
20
  exports.editingStateInitializer = editingStateInitializer;
22
- const useGridEditing = (apiRef, props) => {
21
+ const useGridEditing = (apiRef, props, configuration) => {
23
22
  (0, _useGridCellEditing.useGridCellEditing)(apiRef, props);
24
23
  (0, _useGridRowEditing.useGridRowEditing)(apiRef, props);
25
24
  const debounceMap = React.useRef({});
26
25
  const {
27
26
  isCellEditable: isCellEditableProp
28
27
  } = props;
28
+ const isCellEditableFn = configuration.hooks.useIsCellEditable(apiRef, props);
29
29
  const isCellEditable = React.useCallback(params => {
30
- if ((0, _gridRowsUtils.isAutogeneratedRowNode)(params.rowNode)) {
30
+ if (!isCellEditableFn(params)) {
31
31
  return false;
32
32
  }
33
33
  if (!params.colDef.editable) {
@@ -40,7 +40,7 @@ const useGridEditing = (apiRef, props) => {
40
40
  return isCellEditableProp(params);
41
41
  }
42
42
  return true;
43
- }, [isCellEditableProp]);
43
+ }, [isCellEditableProp, isCellEditableFn]);
44
44
  const maybeDebounce = (id, field, debounceMs, callback) => {
45
45
  if (!debounceMs) {
46
46
  callback();
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", {
9
9
  exports.useGridFocus = exports.focusStateInitializer = void 0;
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var React = _interopRequireWildcard(require("react"));
12
+ var _debounce = _interopRequireDefault(require("@mui/utils/debounce"));
12
13
  var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
13
14
  var _ownerDocument = _interopRequireDefault(require("@mui/utils/ownerDocument"));
14
15
  var _gridClasses = require("../../../constants/gridClasses");
@@ -326,7 +327,7 @@ const useGridFocus = (apiRef, props) => {
326
327
  apiRef.current.setCellFocus(params.id, params.field);
327
328
  }
328
329
  }, [apiRef]);
329
- const handleRowSet = React.useCallback(() => {
330
+ const handleRowsSet = React.useCallback(() => {
330
331
  const cell = (0, _gridFocusStateSelector.gridFocusCellSelector)(apiRef);
331
332
 
332
333
  // If the focused cell is in a row which does not exist anymore,
@@ -357,6 +358,7 @@ const useGridFocus = (apiRef, props) => {
357
358
  }));
358
359
  }
359
360
  }, [apiRef, props.pagination, props.paginationMode]);
361
+ const debouncedHandleRowsSet = React.useMemo(() => (0, _debounce.default)(handleRowsSet, 0), [handleRowsSet]);
360
362
  const handlePaginationModelChange = (0, _useEventCallback.default)(() => {
361
363
  const currentFocusedCell = (0, _gridFocusStateSelector.gridFocusCellSelector)(apiRef);
362
364
  if (!currentFocusedCell) {
@@ -411,7 +413,7 @@ const useGridFocus = (apiRef, props) => {
411
413
  (0, _useGridEvent.useGridEvent)(apiRef, 'cellModeChange', handleCellModeChange);
412
414
  (0, _useGridEvent.useGridEvent)(apiRef, 'columnHeaderFocus', handleColumnHeaderFocus);
413
415
  (0, _useGridEvent.useGridEvent)(apiRef, 'columnGroupHeaderFocus', handleColumnGroupHeaderFocus);
414
- (0, _useGridEvent.useGridEvent)(apiRef, 'rowsSet', handleRowSet);
416
+ (0, _useGridEvent.useGridEvent)(apiRef, 'rowsSet', debouncedHandleRowsSet);
415
417
  (0, _useGridEvent.useGridEvent)(apiRef, 'paginationModelChange', handlePaginationModelChange);
416
418
  };
417
419
  exports.useGridFocus = useGridFocus;
@@ -514,7 +514,9 @@ const useGridRowSelection = (apiRef, props) => {
514
514
  }
515
515
  if (String.fromCharCode(event.keyCode) === 'A' && (event.ctrlKey || event.metaKey)) {
516
516
  event.preventDefault();
517
- toggleAllRows(true);
517
+ if (canHaveMultipleSelection) {
518
+ toggleAllRows(true);
519
+ }
518
520
  }
519
521
  }, [apiRef, canHaveMultipleSelection, handleSingleRowSelection, toggleAllRows]);
520
522
  const syncControlledState = (0, _useEventCallback.default)(() => {
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v8.14.1
2
+ * @mui/x-data-grid v8.16.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -56,6 +56,7 @@ export { useGridAriaAttributes } from "../hooks/utils/useGridAriaAttributes.js";
56
56
  export { useGridRowAriaAttributes } from "../hooks/features/rows/useGridRowAriaAttributes.js";
57
57
  export { useGridRowsOverridableMethods } from "../hooks/features/rows/useGridRowsOverridableMethods.js";
58
58
  export { useGridParamsOverridableMethods } from "../hooks/features/rows/useGridParamsOverridableMethods.js";
59
+ export { useIsCellEditable } from "../hooks/features/editing/useGridCellEditable.js";
59
60
  export { useGridRowsPreProcessors } from "../hooks/features/rows/useGridRowsPreProcessors.js";
60
61
  export type { GridRowTreeCreationParams, GridRowTreeCreationValue, GridHydrateRowsValue, GridRowsPartialUpdates, GridRowsPartialUpdateAction, GridTreeDepths, GridPinnedRowsState } from "../hooks/features/rows/gridRowsInterfaces.js";
61
62
  export { getTreeNodeDescendants, buildRootGroup } from "../hooks/features/rows/gridRowsUtils.js";
@@ -87,7 +88,7 @@ export { useGridInitializeState } from "../hooks/utils/useGridInitializeState.js
87
88
  export type { GridStateInitializer } from "../hooks/utils/useGridInitializeState.js";
88
89
  export type * as BaseSlots from "../models/gridBaseSlots.js";
89
90
  export type * from "../models/props/DataGridProps.js";
90
- export type { GridDataSourceApiBase, GridDataSourceApi, GridDataSourceBaseOptions } from "../hooks/features/dataSource/models.js";
91
+ export type { GridDataSourceApiBase, GridDataSourceApi, GridDataSourceBaseOptions, GridDataSourceFetchRowsParams } from "../hooks/features/dataSource/models.js";
91
92
  export { DataSourceRowsUpdateStrategy } from "../hooks/features/dataSource/utils.js";
92
93
  export { useGridDataSourceBase } from "../hooks/features/dataSource/useGridDataSourceBase.js";
93
94
  export { CacheChunkManager } from "../hooks/features/dataSource/utils.js";
@@ -117,6 +118,7 @@ export type { Localization } from "../utils/getGridLocalization.js";
117
118
  export * from "./demo/index.js";
118
119
  export { GridSkeletonLoadingOverlayInner } from "../components/GridSkeletonLoadingOverlay.js";
119
120
  export type { GridConfiguration } from "../models/configuration/gridConfiguration.js";
121
+ export type { CellEditableConditionFn } from "../models/configuration/gridCellEditableConfiguration.js";
120
122
  export * from "../hooks/features/pivoting/index.js";
121
123
  export { createSvgIcon } from "../material/icons/createSvgIcon.js";
122
124
  export { useGridPanelContext } from "../components/panel/GridPanelContext.js";
@@ -66,6 +66,7 @@ var _exportNames = {
66
66
  useGridRowAriaAttributes: true,
67
67
  useGridRowsOverridableMethods: true,
68
68
  useGridParamsOverridableMethods: true,
69
+ useIsCellEditable: true,
69
70
  useGridRowsPreProcessors: true,
70
71
  getTreeNodeDescendants: true,
71
72
  buildRootGroup: true,
@@ -833,6 +834,12 @@ Object.defineProperty(exports, "useGridVisibleRows", {
833
834
  return _useGridVisibleRows.useGridVisibleRows;
834
835
  }
835
836
  });
837
+ Object.defineProperty(exports, "useIsCellEditable", {
838
+ enumerable: true,
839
+ get: function () {
840
+ return _useGridCellEditable.useIsCellEditable;
841
+ }
842
+ });
836
843
  Object.defineProperty(exports, "useTimeout", {
837
844
  enumerable: true,
838
845
  get: function () {
@@ -935,6 +942,7 @@ var _useGridAriaAttributes = require("../hooks/utils/useGridAriaAttributes");
935
942
  var _useGridRowAriaAttributes = require("../hooks/features/rows/useGridRowAriaAttributes");
936
943
  var _useGridRowsOverridableMethods = require("../hooks/features/rows/useGridRowsOverridableMethods");
937
944
  var _useGridParamsOverridableMethods = require("../hooks/features/rows/useGridParamsOverridableMethods");
945
+ var _useGridCellEditable = require("../hooks/features/editing/useGridCellEditable");
938
946
  var _useGridRowsPreProcessors = require("../hooks/features/rows/useGridRowsPreProcessors");
939
947
  var _gridRowsUtils = require("../hooks/features/rows/gridRowsUtils");
940
948
  var _useGridRowsMeta = require("../hooks/features/rows/useGridRowsMeta");
package/locales/arSD.js CHANGED
@@ -304,5 +304,6 @@ const arSDGrid = {
304
304
  // promptChangePivotRowsLabel: (count: number) => `Rows (${count})`,
305
305
  // promptChangePivotValuesLabel: (count: number) => `Values (${count})`,
306
306
  // promptChangePivotValuesDescription: (column: string, aggregation: string) => `${column} (${aggregation})`,
307
+ // promptChangeChartsLabel: (dimensionsCount: number, valuesCount: number) => `Dimensions (${dimensionsCount}), Values (${valuesCount})`,
307
308
  };
308
309
  const arSD = exports.arSD = (0, _getGridLocalization.getGridLocalization)(arSDGrid);
package/locales/beBY.js CHANGED
@@ -328,5 +328,6 @@ const beBYGrid = {
328
328
  // promptChangePivotRowsLabel: (count: number) => `Rows (${count})`,
329
329
  // promptChangePivotValuesLabel: (count: number) => `Values (${count})`,
330
330
  // promptChangePivotValuesDescription: (column: string, aggregation: string) => `${column} (${aggregation})`,
331
+ // promptChangeChartsLabel: (dimensionsCount: number, valuesCount: number) => `Dimensions (${dimensionsCount}), Values (${valuesCount})`,
331
332
  };
332
333
  const beBY = exports.beBY = (0, _getGridLocalization.getGridLocalization)(beBYGrid);
package/locales/bgBG.js CHANGED
@@ -305,5 +305,6 @@ const bgBGGrid = {
305
305
  // promptChangePivotRowsLabel: (count: number) => `Rows (${count})`,
306
306
  // promptChangePivotValuesLabel: (count: number) => `Values (${count})`,
307
307
  // promptChangePivotValuesDescription: (column: string, aggregation: string) => `${column} (${aggregation})`,
308
+ // promptChangeChartsLabel: (dimensionsCount: number, valuesCount: number) => `Dimensions (${dimensionsCount}), Values (${valuesCount})`,
308
309
  };
309
310
  const bgBG = exports.bgBG = (0, _getGridLocalization.getGridLocalization)(bgBGGrid);
package/locales/bnBD.js CHANGED
@@ -303,5 +303,6 @@ const bnBDGrid = {
303
303
  // promptChangePivotRowsLabel: (count: number) => `Rows (${count})`,
304
304
  // promptChangePivotValuesLabel: (count: number) => `Values (${count})`,
305
305
  // promptChangePivotValuesDescription: (column: string, aggregation: string) => `${column} (${aggregation})`,
306
+ // promptChangeChartsLabel: (dimensionsCount: number, valuesCount: number) => `Dimensions (${dimensionsCount}), Values (${valuesCount})`,
306
307
  };
307
308
  const bnBD = exports.bnBD = (0, _getGridLocalization.getGridLocalization)(bnBDGrid);
package/locales/csCZ.js CHANGED
@@ -331,5 +331,6 @@ const csCZGrid = {
331
331
  // promptChangePivotRowsLabel: (count: number) => `Rows (${count})`,
332
332
  // promptChangePivotValuesLabel: (count: number) => `Values (${count})`,
333
333
  // promptChangePivotValuesDescription: (column: string, aggregation: string) => `${column} (${aggregation})`,
334
+ // promptChangeChartsLabel: (dimensionsCount: number, valuesCount: number) => `Dimensions (${dimensionsCount}), Values (${valuesCount})`,
334
335
  };
335
336
  const csCZ = exports.csCZ = (0, _getGridLocalization.getGridLocalization)(csCZGrid);
package/locales/daDK.js CHANGED
@@ -305,5 +305,6 @@ const daDKGrid = {
305
305
  // promptChangePivotRowsLabel: (count: number) => `Rows (${count})`,
306
306
  // promptChangePivotValuesLabel: (count: number) => `Values (${count})`,
307
307
  // promptChangePivotValuesDescription: (column: string, aggregation: string) => `${column} (${aggregation})`,
308
+ // promptChangeChartsLabel: (dimensionsCount: number, valuesCount: number) => `Dimensions (${dimensionsCount}), Values (${valuesCount})`,
308
309
  };
309
310
  const daDK = exports.daDK = (0, _getGridLocalization.getGridLocalization)(daDKGrid);
package/locales/deDE.js CHANGED
@@ -295,5 +295,6 @@ const deDEGrid = {
295
295
  promptChangePivotRowsLabel: count => `Zeilen (${count})`,
296
296
  promptChangePivotValuesLabel: count => `Werte (${count})`,
297
297
  promptChangePivotValuesDescription: (column, aggregation) => `${column} (${aggregation})`
298
+ // promptChangeChartsLabel: (dimensionsCount: number, valuesCount: number) => `Dimensions (${dimensionsCount}), Values (${valuesCount})`,
298
299
  };
299
300
  const deDE = exports.deDE = (0, _getGridLocalization.getGridLocalization)(deDEGrid);
package/locales/elGR.js CHANGED
@@ -306,5 +306,6 @@ const elGRGrid = {
306
306
  // promptChangePivotRowsLabel: (count: number) => `Rows (${count})`,
307
307
  // promptChangePivotValuesLabel: (count: number) => `Values (${count})`,
308
308
  // promptChangePivotValuesDescription: (column: string, aggregation: string) => `${column} (${aggregation})`,
309
+ // promptChangeChartsLabel: (dimensionsCount: number, valuesCount: number) => `Dimensions (${dimensionsCount}), Values (${valuesCount})`,
309
310
  };
310
311
  const elGR = exports.elGR = (0, _getGridLocalization.getGridLocalization)(elGRGrid);