@mui/x-data-grid 8.13.1 → 8.14.1

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 (36) hide show
  1. package/CHANGELOG.md +204 -1
  2. package/components/cell/GridCell.js +1 -0
  3. package/esm/components/cell/GridCell.js +1 -0
  4. package/esm/hooks/core/useGridProps.d.ts +3 -5
  5. package/esm/hooks/core/useGridProps.js +5 -3
  6. package/esm/hooks/core/useGridVirtualizer.js +11 -9
  7. package/esm/hooks/features/columnGrouping/gridColumnGroupsUtils.d.ts +3 -2
  8. package/esm/hooks/features/columnGrouping/gridColumnGroupsUtils.js +34 -0
  9. package/esm/hooks/features/columnGrouping/useGridColumnGrouping.js +1 -34
  10. package/esm/hooks/features/dataSource/useGridDataSourceBase.js +8 -6
  11. package/esm/hooks/features/dataSource/utils.js +2 -4
  12. package/esm/hooks/features/rowSelection/useGridRowSelection.js +1 -1
  13. package/esm/hooks/features/rows/gridRowsInterfaces.d.ts +1 -11
  14. package/esm/hooks/features/rows/useGridRows.js +4 -4
  15. package/esm/index.js +1 -1
  16. package/esm/internals/index.d.ts +1 -1
  17. package/esm/locales/itIT.js +103 -115
  18. package/esm/locales/ptBR.js +117 -128
  19. package/esm/models/gridStateCommunity.d.ts +2 -3
  20. package/hooks/core/useGridProps.d.ts +3 -5
  21. package/hooks/core/useGridProps.js +5 -3
  22. package/hooks/core/useGridVirtualizer.js +11 -9
  23. package/hooks/features/columnGrouping/gridColumnGroupsUtils.d.ts +3 -2
  24. package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +37 -1
  25. package/hooks/features/columnGrouping/useGridColumnGrouping.js +3 -36
  26. package/hooks/features/dataSource/useGridDataSourceBase.js +8 -6
  27. package/hooks/features/dataSource/utils.js +2 -4
  28. package/hooks/features/rowSelection/useGridRowSelection.js +1 -1
  29. package/hooks/features/rows/gridRowsInterfaces.d.ts +1 -11
  30. package/hooks/features/rows/useGridRows.js +4 -4
  31. package/index.js +1 -1
  32. package/internals/index.d.ts +1 -1
  33. package/locales/itIT.js +103 -115
  34. package/locales/ptBR.js +117 -128
  35. package/models/gridStateCommunity.d.ts +2 -3
  36. package/package.json +5 -5
@@ -13,7 +13,7 @@ import type { GridRowReorderState } from "../hooks/features/rowReorder/gridRowRe
13
13
  * Some props are passed on the state to enable grid selectors to select
14
14
  * and react to them.
15
15
  */
16
- type GridStateProps = Pick<DataGridProcessedProps, 'getRowId' | 'listView'>;
16
+ export type GridStateProps = Pick<DataGridProcessedProps, 'getRowId' | 'listView' | 'isCellEditable'>;
17
17
  /**
18
18
  * The state of Data Grid.
19
19
  */
@@ -58,5 +58,4 @@ export interface GridInitialStateCommunity {
58
58
  top: number;
59
59
  left: number;
60
60
  };
61
- }
62
- export {};
61
+ }
@@ -1,8 +1,6 @@
1
1
  import type { RefObject } from '@mui/x-internals/types';
2
- import type { DataGridProcessedProps } from "../../models/props/DataGridProps.js";
3
2
  import type { GridPrivateApiCommon } from "../../models/api/gridApiCommon.js";
3
+ import type { GridStateProps } from "../../models/gridStateCommunity.js";
4
4
  import type { GridStateInitializer } from "../utils/useGridInitializeState.js";
5
- type Props = Pick<DataGridProcessedProps, 'getRowId' | 'listView'>;
6
- export declare const propsStateInitializer: GridStateInitializer<Props>;
7
- export declare const useGridProps: <PrivateApi extends GridPrivateApiCommon>(apiRef: RefObject<PrivateApi>, props: Props) => void;
8
- export {};
5
+ export declare const propsStateInitializer: GridStateInitializer<GridStateProps>;
6
+ export declare const useGridProps: <PrivateApi extends GridPrivateApiCommon>(apiRef: RefObject<PrivateApi>, props: GridStateProps) => void;
@@ -13,7 +13,8 @@ const propsStateInitializer = (state, props) => {
13
13
  return (0, _extends2.default)({}, state, {
14
14
  props: {
15
15
  listView: props.listView,
16
- getRowId: props.getRowId
16
+ getRowId: props.getRowId,
17
+ isCellEditable: props.isCellEditable
17
18
  }
18
19
  });
19
20
  };
@@ -23,9 +24,10 @@ const useGridProps = (apiRef, props) => {
23
24
  apiRef.current.setState(state => (0, _extends2.default)({}, state, {
24
25
  props: {
25
26
  listView: props.listView,
26
- getRowId: props.getRowId
27
+ getRowId: props.getRowId,
28
+ isCellEditable: props.isCellEditable
27
29
  }
28
30
  }));
29
- }, [apiRef, props.listView, props.getRowId]);
31
+ }, [apiRef, props.listView, props.getRowId, props.isCellEditable]);
30
32
  };
31
33
  exports.useGridProps = useGridProps;
@@ -66,7 +66,7 @@ function useGridVirtualizer(apiRef, rootProps) {
66
66
  const pinnedRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridPinnedRowsSelector);
67
67
  const pinnedColumns = (0, _gridColumnsSelector.gridVisiblePinnedColumnDefinitionsSelector)(apiRef);
68
68
  const rowSelectionManager = (0, _useGridSelector.useGridSelector)(apiRef, _rowSelection.gridRowSelectionManagerSelector);
69
- const isRowSelected = id => rowSelectionManager.has(id) && apiRef.current.isRowSelectable(id);
69
+ const isRowSelected = React.useCallback(id => rowSelectionManager.has(id) && apiRef.current.isRowSelectable(id), [rowSelectionManager, apiRef]);
70
70
  const currentPage = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef);
71
71
  const hasColSpan = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridHasColSpanSelector);
72
72
  const verticalScrollbarWidth = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridVerticalScrollbarWidthSelector);
@@ -114,6 +114,8 @@ function useGridVirtualizer(apiRef, rootProps) {
114
114
  // </ROWS_META>
115
115
 
116
116
  const focusedVirtualCell = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusedVirtualCellSelector.gridFocusedVirtualCellSelector);
117
+ const RowSlot = rootProps.slots.row;
118
+ const rowSlotProps = rootProps.slotProps?.row;
117
119
  const virtualizer = (0, _xVirtualizer.useVirtualizer)({
118
120
  refs: {
119
121
  container: apiRef.current.mainElementRef,
@@ -129,14 +131,14 @@ function useGridVirtualizer(apiRef, rootProps) {
129
131
  },
130
132
  colspan: {
131
133
  enabled: hasColSpan,
132
- getColspan: (rowId, column) => {
134
+ getColspan: React.useCallback((rowId, column) => {
133
135
  if (typeof column.colSpan === 'function') {
134
136
  const row = apiRef.current.getRow(rowId);
135
137
  const value = apiRef.current.getRowValue(row, column);
136
138
  return column.colSpan(value, row, column, apiRef) ?? 0;
137
139
  }
138
140
  return column.colSpan ?? 1;
139
- }
141
+ }, [apiRef])
140
142
  },
141
143
  initialState: {
142
144
  scroll: rootProps.initialState?.scroll,
@@ -189,15 +191,15 @@ function useGridVirtualizer(apiRef, rootProps) {
189
191
  onRenderContextChange: (0, _useEventCallback.default)(nextRenderContext => {
190
192
  apiRef.current.publishEvent('renderedRowsIntervalChange', nextRenderContext);
191
193
  }),
192
- onScrollChange: (scrollPosition, nextRenderContext) => {
194
+ onScrollChange: React.useCallback((scrollPosition, nextRenderContext) => {
193
195
  apiRef.current.publishEvent('scrollPositionChange', {
194
196
  top: scrollPosition.top,
195
197
  left: scrollPosition.left,
196
198
  renderContext: nextRenderContext
197
199
  });
198
- },
200
+ }, [apiRef]),
199
201
  scrollReset,
200
- renderRow: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.row, (0, _extends2.default)({
202
+ renderRow: React.useCallback(params => /*#__PURE__*/(0, _jsxRuntime.jsx)(RowSlot, (0, _extends2.default)({
201
203
  row: params.model,
202
204
  rowId: params.id,
203
205
  index: params.rowIndex,
@@ -216,10 +218,10 @@ function useGridVirtualizer(apiRef, rootProps) {
216
218
  showBottomBorder: params.showBottomBorder,
217
219
  scrollbarWidth: verticalScrollbarWidth,
218
220
  gridHasFiller: hasFiller
219
- }, rootProps.slotProps?.row), params.id),
220
- renderInfiniteLoadingTrigger: id => apiRef.current.getInfiniteLoadingTriggerElement?.({
221
+ }, rowSlotProps), params.id), [columnsTotalWidth, hasFiller, isRowSelected, pinnedColumns, RowSlot, rowSlotProps, verticalScrollbarWidth, visibleColumns]),
222
+ renderInfiniteLoadingTrigger: React.useCallback(id => apiRef.current.getInfiniteLoadingTriggerElement?.({
221
223
  lastRowId: id
222
- })
224
+ }), [apiRef])
223
225
  });
224
226
 
225
227
  // HACK: Keep the grid's store in sync with the virtualizer store. We set up the
@@ -1,9 +1,10 @@
1
- import { GridColumnGroupingModel, GridColumnGroup } from "../../../models/gridColumnGrouping.js";
1
+ import { GridColumnGroupingModel, GridColumnNode, GridColumnGroup } from "../../../models/gridColumnGrouping.js";
2
2
  import { GridColDef } from "../../../models/colDef/index.js";
3
- import { GridGroupingStructure } from "./gridColumnGroupsInterfaces.js";
3
+ import { GridColumnGroupLookup, GridGroupingStructure } from "./gridColumnGroupsInterfaces.js";
4
4
  type UnwrappedGroupingModel = {
5
5
  [key: GridColDef['field']]: GridColumnGroup['groupId'][];
6
6
  };
7
+ export declare const createGroupLookup: (columnGroupingModel: GridColumnNode[]) => GridColumnGroupLookup;
7
8
  /**
8
9
  * This is a function that provide for each column the array of its parents.
9
10
  * Parents are ordered from the root to the leaf.
@@ -1,11 +1,47 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.unwrapGroupingColumnModel = exports.getColumnGroupsHeaderStructure = void 0;
7
+ exports.unwrapGroupingColumnModel = exports.getColumnGroupsHeaderStructure = exports.createGroupLookup = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
7
10
  var _gridColumnGrouping = require("../../../models/gridColumnGrouping");
11
+ const _excluded = ["groupId", "children"];
12
+ const createGroupLookup = columnGroupingModel => {
13
+ const groupLookup = {};
14
+ for (let i = 0; i < columnGroupingModel.length; i += 1) {
15
+ const node = columnGroupingModel[i];
16
+ if ((0, _gridColumnGrouping.isLeaf)(node)) {
17
+ continue;
18
+ }
19
+ const {
20
+ groupId,
21
+ children
22
+ } = node,
23
+ other = (0, _objectWithoutPropertiesLoose2.default)(node, _excluded);
24
+ if (!groupId) {
25
+ throw new Error('MUI X: An element of the columnGroupingModel does not have either `field` or `groupId`.');
26
+ }
27
+ if (process.env.NODE_ENV !== 'production' && !children) {
28
+ console.warn(`MUI X: group groupId=${groupId} has no children.`);
29
+ }
30
+ const groupParam = (0, _extends2.default)({}, other, {
31
+ groupId
32
+ });
33
+ const subTreeLookup = createGroupLookup(children);
34
+ if (subTreeLookup[groupId] !== undefined || groupLookup[groupId] !== undefined) {
35
+ throw new Error(`MUI X: The groupId ${groupId} is used multiple times in the columnGroupingModel.`);
36
+ }
37
+ Object.assign(groupLookup, subTreeLookup);
38
+ groupLookup[groupId] = groupParam;
39
+ }
40
+ return groupLookup;
41
+ };
42
+
8
43
  // This is the recurrence function that help writing `unwrapGroupingColumnModel()`
44
+ exports.createGroupLookup = createGroupLookup;
9
45
  const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedGroupingModelToComplete) => {
10
46
  if ((0, _gridColumnGrouping.isLeaf)(columnGroupNode)) {
11
47
  if (unwrappedGroupingModelToComplete[columnGroupNode.field] !== undefined) {
@@ -1,52 +1,19 @@
1
1
  "use strict";
2
2
  'use client';
3
3
 
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
6
  Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
9
  exports.useGridColumnGrouping = exports.columnGroupsStateInitializer = void 0;
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
- var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
12
11
  var React = _interopRequireWildcard(require("react"));
13
- var _gridColumnGrouping = require("../../../models/gridColumnGrouping");
14
12
  var _gridColumnGroupsSelector = require("./gridColumnGroupsSelector");
15
13
  var _useGridApiMethod = require("../../utils/useGridApiMethod");
16
14
  var _gridColumnGroupsUtils = require("./gridColumnGroupsUtils");
17
15
  var _useGridEvent = require("../../utils/useGridEvent");
18
16
  var _columns = require("../columns");
19
- const _excluded = ["groupId", "children"];
20
- const createGroupLookup = columnGroupingModel => {
21
- const groupLookup = {};
22
- for (let i = 0; i < columnGroupingModel.length; i += 1) {
23
- const node = columnGroupingModel[i];
24
- if ((0, _gridColumnGrouping.isLeaf)(node)) {
25
- continue;
26
- }
27
- const {
28
- groupId,
29
- children
30
- } = node,
31
- other = (0, _objectWithoutPropertiesLoose2.default)(node, _excluded);
32
- if (!groupId) {
33
- throw new Error('MUI X: An element of the columnGroupingModel does not have either `field` or `groupId`.');
34
- }
35
- if (process.env.NODE_ENV !== 'production' && !children) {
36
- console.warn(`MUI X: group groupId=${groupId} has no children.`);
37
- }
38
- const groupParam = (0, _extends2.default)({}, other, {
39
- groupId
40
- });
41
- const subTreeLookup = createGroupLookup(children);
42
- if (subTreeLookup[groupId] !== undefined || groupLookup[groupId] !== undefined) {
43
- throw new Error(`MUI X: The groupId ${groupId} is used multiple times in the columnGroupingModel.`);
44
- }
45
- Object.assign(groupLookup, subTreeLookup);
46
- groupLookup[groupId] = groupParam;
47
- }
48
- return groupLookup;
49
- };
50
17
  const columnGroupsStateInitializer = (state, props, apiRef) => {
51
18
  apiRef.current.caches.columnGrouping = {
52
19
  lastColumnGroupingModel: props.columnGroupingModel
@@ -56,7 +23,7 @@ const columnGroupsStateInitializer = (state, props, apiRef) => {
56
23
  }
57
24
  const columnFields = (0, _columns.gridColumnFieldsSelector)(apiRef);
58
25
  const visibleColumnFields = (0, _columns.gridVisibleColumnFieldsSelector)(apiRef);
59
- const groupLookup = createGroupLookup(props.columnGroupingModel ?? []);
26
+ const groupLookup = (0, _gridColumnGroupsUtils.createGroupLookup)(props.columnGroupingModel ?? []);
60
27
  const unwrappedGroupingModel = (0, _gridColumnGroupsUtils.unwrapGroupingColumnModel)(props.columnGroupingModel ?? []);
61
28
  const columnGroupsHeaderStructure = (0, _gridColumnGroupsUtils.getColumnGroupsHeaderStructure)(columnFields, unwrappedGroupingModel, apiRef.current.state.pinnedColumns ?? {});
62
29
  const maxDepth = visibleColumnFields.length === 0 ? 0 : Math.max(...visibleColumnFields.map(field => unwrappedGroupingModel[field]?.length ?? 0));
@@ -111,7 +78,7 @@ const useGridColumnGrouping = (apiRef, props) => {
111
78
  const pinnedColumns = apiRef.current.getPinnedColumns?.() ?? {};
112
79
  const columnFields = (0, _columns.gridColumnFieldsSelector)(apiRef);
113
80
  const visibleColumnFields = (0, _columns.gridVisibleColumnFieldsSelector)(apiRef);
114
- const groupLookup = createGroupLookup(columnGroupingModel ?? []);
81
+ const groupLookup = (0, _gridColumnGroupsUtils.createGroupLookup)(columnGroupingModel ?? []);
115
82
  const unwrappedGroupingModel = (0, _gridColumnGroupsUtils.unwrapGroupingColumnModel)(columnGroupingModel ?? []);
116
83
  const columnGroupsHeaderStructure = (0, _gridColumnGroupsUtils.getColumnGroupsHeaderStructure)(columnFields, unwrappedGroupingModel, pinnedColumns);
117
84
  const maxDepth = visibleColumnFields.length === 0 ? 0 : Math.max(...visibleColumnFields.map(field => unwrappedGroupingModel[field]?.length ?? 0));
@@ -39,7 +39,10 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
39
39
  const setStrategyAvailability = React.useCallback(() => {
40
40
  apiRef.current.setStrategyAvailability(_strategyProcessing.GridStrategyGroup.DataSource, _utils2.DataSourceRowsUpdateStrategy.Default, props.dataSource ? () => true : () => false);
41
41
  }, [apiRef, props.dataSource]);
42
- const [defaultRowsUpdateStrategyActive, setDefaultRowsUpdateStrategyActive] = React.useState(false);
42
+ const [currentStrategy, setCurrentStrategy] = React.useState(apiRef.current.getActiveStrategy(_strategyProcessing.GridStrategyGroup.DataSource));
43
+ const defaultRowsUpdateStrategyActive = React.useMemo(() => {
44
+ return currentStrategy === _utils2.DataSourceRowsUpdateStrategy.Default;
45
+ }, [currentStrategy]);
43
46
  const paginationModel = (0, _useGridSelector.useGridSelector)(apiRef, _gridPaginationSelector.gridPaginationModelSelector);
44
47
  const lastRequestId = React.useRef(0);
45
48
  const onDataSourceErrorProp = props.onDataSourceError;
@@ -117,7 +120,7 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
117
120
  }
118
121
  }, [cacheChunkManager, cache, apiRef, defaultRowsUpdateStrategyActive, props.dataSource?.getRows, onDataSourceErrorProp, options, props.signature]);
119
122
  const handleStrategyActivityChange = React.useCallback(() => {
120
- setDefaultRowsUpdateStrategyActive(apiRef.current.getActiveStrategy(_strategyProcessing.GridStrategyGroup.DataSource) === _utils2.DataSourceRowsUpdateStrategy.Default);
123
+ setCurrentStrategy(apiRef.current.getActiveStrategy(_strategyProcessing.GridStrategyGroup.DataSource));
121
124
  }, [apiRef]);
122
125
  const handleDataUpdate = React.useCallback(params => {
123
126
  if ('error' in params) {
@@ -148,11 +151,11 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
148
151
  handleEditRowOption(params, finalRowUpdate);
149
152
  return finalRowUpdate;
150
153
  }
151
- apiRef.current.updateNestedRows([finalRowUpdate], []);
152
154
  if (finalRowUpdate && !(0, _isDeepEqual.isDeepEqual)(finalRowUpdate, params.previousRow)) {
153
155
  // Reset the outdated cache, only if the row is _actually_ updated
154
156
  apiRef.current.dataSource.cache.clear();
155
157
  }
158
+ apiRef.current.updateNestedRows([finalRowUpdate], []);
156
159
  return finalRowUpdate;
157
160
  } catch (errorThrown) {
158
161
  if (typeof onDataSourceErrorProp === 'function') {
@@ -190,8 +193,7 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
190
193
  React.useEffect(() => {
191
194
  // Return early if the proper strategy isn't set yet
192
195
  // Context: https://github.com/mui/mui-x/issues/19650
193
- const strategy = apiRef.current.getActiveStrategy(_strategyProcessing.GridStrategyGroup.DataSource);
194
- if (strategy !== _utils2.DataSourceRowsUpdateStrategy.Default && strategy !== _utils2.DataSourceRowsUpdateStrategy.LazyLoading) {
196
+ if (currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.Default && currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.LazyLoading) {
195
197
  return undefined;
196
198
  }
197
199
  if (props.dataSource) {
@@ -202,7 +204,7 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
202
204
  // ignore the current request on unmount
203
205
  lastRequestId.current += 1;
204
206
  };
205
- }, [apiRef, props.dataSource]);
207
+ }, [apiRef, props.dataSource, currentStrategy]);
206
208
  return {
207
209
  api: {
208
210
  public: dataSourceApi
@@ -66,10 +66,8 @@ class CacheChunkManager {
66
66
  if (responses.length === 1) {
67
67
  return responses[0];
68
68
  }
69
- return responses.reduce((acc, response) => ({
70
- rows: [...acc.rows, ...response.rows],
71
- rowCount: response.rowCount,
72
- pageInfo: response.pageInfo
69
+ return responses.reduce((acc, response) => (0, _extends2.default)({}, response, {
70
+ rows: [...acc.rows, ...response.rows]
73
71
  }), {
74
72
  rows: [],
75
73
  rowCount: 0,
@@ -249,7 +249,7 @@ const useGridRowSelection = (apiRef, props) => {
249
249
  }
250
250
  }, [logger, applyAutoSelection, canHaveMultipleSelection, apiRef, tree, props.rowSelectionPropagation?.descendants, props.rowSelectionPropagation?.parents, props.rowSelection]);
251
251
  const getPropagatedRowSelectionModel = React.useCallback(inputSelectionModel => {
252
- if (!isNestedData || !applyAutoSelection || inputSelectionModel.ids.size === 0 && inputSelectionModel.type === 'include') {
252
+ if (!isNestedData || !applyAutoSelection || inputSelectionModel.type === 'exclude' || inputSelectionModel.ids.size === 0 && inputSelectionModel.type === 'include') {
253
253
  return inputSelectionModel;
254
254
  }
255
255
  const propagatedSelectionModel = {
@@ -72,17 +72,7 @@ export interface GridRowTreeCreationParams {
72
72
  dataRowIdToModelLookup: GridRowIdToModelLookup;
73
73
  previousGroupsToFetch?: GridRowId[];
74
74
  }
75
- export type GridRowTreeUpdateGroupAction = 'removeChildren' | 'insertChildren' | 'modifyChildren';
76
- export type GridRowTreeUpdatedGroupsValue = {
77
- [groupId: GridRowId]: { [action in GridRowTreeUpdateGroupAction]?: boolean };
78
- };
79
- export type GridRowTreeUpdatedGroupsManager = {
80
- value: GridRowTreeUpdatedGroupsValue;
81
- addAction: (groupId: GridRowId, action: GridRowTreeUpdateGroupAction) => void;
82
- };
83
- export type GridRowTreeCreationValue = Pick<GridRowsState, 'groupingName' | 'tree' | 'treeDepths' | 'dataRowIds' | 'groupsToFetch'> & {
84
- updatedGroupsManager?: GridRowTreeUpdatedGroupsManager;
85
- };
75
+ export type GridRowTreeCreationValue = Pick<GridRowsState, 'groupingName' | 'tree' | 'treeDepths' | 'dataRowIds' | 'groupsToFetch'>;
86
76
  export type GridHydrateRowsValue = Pick<GridRowsState, 'tree' | 'treeDepths' | 'dataRowIds' | 'dataRowIdToModelLookup' | 'additionalRowGroups'>;
87
77
  export type GridRowsPartialUpdateAction = 'insert' | 'modify' | 'remove';
88
78
  export type GridRowIdToModelLookup<R extends GridValidRowModel = GridValidRowModel> = Record<string, R>;
@@ -113,7 +113,7 @@ const useGridRows = (apiRef, props, configuration) => {
113
113
  */
114
114
  const setRows = React.useCallback(rows => {
115
115
  logger.debug(`Updating all rows, new length ${rows.length}`);
116
- if ((0, _pivoting.gridPivotActiveSelector)(apiRef)) {
116
+ if (!props.dataSource && (0, _pivoting.gridPivotActiveSelector)(apiRef)) {
117
117
  apiRef.current.updateNonPivotRows(rows, false);
118
118
  return;
119
119
  }
@@ -129,12 +129,12 @@ const useGridRows = (apiRef, props, configuration) => {
129
129
  cache,
130
130
  throttle: true
131
131
  });
132
- }, [logger, props.getRowId, props.loading, props.rowCount, throttledRowsChange, apiRef]);
132
+ }, [logger, props.getRowId, props.dataSource, props.loading, props.rowCount, throttledRowsChange, apiRef]);
133
133
  const updateRows = React.useCallback(updates => {
134
134
  if (props.signature === _signature.GridSignature.DataGrid && updates.length > 1) {
135
135
  throw new Error(['MUI X: You cannot update several rows at once in `apiRef.current.updateRows` on the DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
136
136
  }
137
- if ((0, _pivoting.gridPivotActiveSelector)(apiRef)) {
137
+ if (!props.dataSource && (0, _pivoting.gridPivotActiveSelector)(apiRef)) {
138
138
  apiRef.current.updateNonPivotRows(updates);
139
139
  return;
140
140
  }
@@ -148,7 +148,7 @@ const useGridRows = (apiRef, props, configuration) => {
148
148
  cache,
149
149
  throttle: true
150
150
  });
151
- }, [props.signature, props.getRowId, throttledRowsChange, apiRef]);
151
+ }, [props.signature, props.dataSource, props.getRowId, throttledRowsChange, apiRef]);
152
152
  const updateNestedRows = React.useCallback((updates, groupKeys) => {
153
153
  const nonPinnedRowsUpdates = (0, _gridRowsUtils.computeRowsUpdates)(apiRef, updates, props.getRowId);
154
154
  const cache = (0, _gridRowsUtils.updateCacheWithNewRows)({
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v8.13.1
2
+ * @mui/x-data-grid v8.14.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -57,7 +57,7 @@ export { useGridRowAriaAttributes } from "../hooks/features/rows/useGridRowAriaA
57
57
  export { useGridRowsOverridableMethods } from "../hooks/features/rows/useGridRowsOverridableMethods.js";
58
58
  export { useGridParamsOverridableMethods } from "../hooks/features/rows/useGridParamsOverridableMethods.js";
59
59
  export { useGridRowsPreProcessors } from "../hooks/features/rows/useGridRowsPreProcessors.js";
60
- export type { GridRowTreeCreationParams, GridRowTreeCreationValue, GridHydrateRowsValue, GridRowsPartialUpdates, GridRowsPartialUpdateAction, GridTreeDepths, GridRowTreeUpdatedGroupsManager, GridRowTreeUpdateGroupAction, GridPinnedRowsState } from "../hooks/features/rows/gridRowsInterfaces.js";
60
+ export type { GridRowTreeCreationParams, GridRowTreeCreationValue, GridHydrateRowsValue, GridRowsPartialUpdates, GridRowsPartialUpdateAction, GridTreeDepths, GridPinnedRowsState } from "../hooks/features/rows/gridRowsInterfaces.js";
61
61
  export { getTreeNodeDescendants, buildRootGroup } from "../hooks/features/rows/gridRowsUtils.js";
62
62
  export { useGridRowsMeta, rowsMetaStateInitializer } from "../hooks/features/rows/useGridRowsMeta.js";
63
63
  export { useGridParamsApi } from "../hooks/features/rows/useGridParamsApi.js";