@mui/x-data-grid-pro 5.13.1 → 5.15.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 (90) hide show
  1. package/CHANGELOG.md +147 -6
  2. package/DataGridPro/DataGridPro.js +15 -0
  3. package/DataGridPro/useDataGridProComponent.js +6 -1
  4. package/components/DataGridProVirtualScroller.js +198 -35
  5. package/components/GridRowReorderCell.d.ts +2 -2
  6. package/components/GridRowReorderCell.js +14 -1
  7. package/hooks/features/columnPinning/useGridColumnPinning.d.ts +1 -1
  8. package/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
  9. package/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  10. package/hooks/features/index.d.ts +1 -0
  11. package/hooks/features/index.js +2 -1
  12. package/hooks/features/rowPinning/gridRowPinningInterface.d.ts +17 -0
  13. package/hooks/features/rowPinning/gridRowPinningInterface.js +1 -0
  14. package/hooks/features/rowPinning/gridRowPinningSelector.d.ts +1 -0
  15. package/hooks/features/rowPinning/gridRowPinningSelector.js +1 -0
  16. package/hooks/features/rowPinning/index.d.ts +1 -0
  17. package/hooks/features/rowPinning/index.js +1 -0
  18. package/hooks/features/rowPinning/useGridRowPinning.d.ts +6 -0
  19. package/hooks/features/rowPinning/useGridRowPinning.js +71 -0
  20. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +34 -0
  21. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +89 -0
  22. package/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  23. package/hooks/features/rowReorder/useGridRowReorder.js +6 -0
  24. package/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  25. package/index.js +1 -1
  26. package/internals/index.d.ts +3 -0
  27. package/internals/index.js +3 -0
  28. package/legacy/DataGridPro/DataGridPro.js +15 -0
  29. package/legacy/DataGridPro/useDataGridProComponent.js +6 -1
  30. package/legacy/components/DataGridProVirtualScroller.js +187 -25
  31. package/legacy/components/GridRowReorderCell.js +11 -0
  32. package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
  33. package/legacy/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  34. package/legacy/hooks/features/index.js +2 -1
  35. package/legacy/hooks/features/rowPinning/gridRowPinningInterface.js +1 -0
  36. package/legacy/hooks/features/rowPinning/gridRowPinningSelector.js +1 -0
  37. package/legacy/hooks/features/rowPinning/index.js +1 -0
  38. package/legacy/hooks/features/rowPinning/useGridRowPinning.js +71 -0
  39. package/legacy/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +89 -0
  40. package/legacy/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  41. package/legacy/hooks/features/rowReorder/useGridRowReorder.js +6 -0
  42. package/legacy/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  43. package/legacy/index.js +1 -1
  44. package/legacy/internals/index.js +3 -0
  45. package/legacy/utils/releaseInfo.js +1 -1
  46. package/legacy/utils/tree/sortRowTree.js +27 -14
  47. package/models/dataGridProProps.d.ts +11 -5
  48. package/models/gridApiPro.d.ts +2 -2
  49. package/modern/DataGridPro/DataGridPro.js +15 -0
  50. package/modern/DataGridPro/useDataGridProComponent.js +6 -1
  51. package/modern/components/DataGridProVirtualScroller.js +198 -35
  52. package/modern/components/GridRowReorderCell.js +12 -1
  53. package/modern/hooks/features/columnPinning/useGridColumnPinning.js +8 -3
  54. package/modern/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  55. package/modern/hooks/features/index.js +2 -1
  56. package/modern/hooks/features/rowPinning/gridRowPinningInterface.js +1 -0
  57. package/modern/hooks/features/rowPinning/gridRowPinningSelector.js +1 -0
  58. package/modern/hooks/features/rowPinning/index.js +1 -0
  59. package/modern/hooks/features/rowPinning/useGridRowPinning.js +63 -0
  60. package/modern/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +85 -0
  61. package/modern/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  62. package/modern/hooks/features/rowReorder/useGridRowReorder.js +4 -0
  63. package/modern/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  64. package/modern/index.js +1 -1
  65. package/modern/internals/index.js +3 -0
  66. package/modern/utils/releaseInfo.js +1 -1
  67. package/modern/utils/tree/sortRowTree.js +26 -11
  68. package/node/DataGridPro/DataGridPro.js +15 -0
  69. package/node/DataGridPro/useDataGridProComponent.js +8 -1
  70. package/node/components/DataGridProVirtualScroller.js +198 -34
  71. package/node/components/GridRowReorderCell.js +14 -1
  72. package/node/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
  73. package/node/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  74. package/node/hooks/features/index.js +13 -0
  75. package/node/hooks/features/rowPinning/gridRowPinningInterface.js +5 -0
  76. package/node/hooks/features/rowPinning/gridRowPinningSelector.js +19 -0
  77. package/node/hooks/features/rowPinning/index.js +18 -0
  78. package/node/hooks/features/rowPinning/useGridRowPinning.js +92 -0
  79. package/node/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +105 -0
  80. package/node/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  81. package/node/hooks/features/rowReorder/useGridRowReorder.js +6 -0
  82. package/node/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  83. package/node/index.js +1 -1
  84. package/node/internals/index.js +41 -0
  85. package/node/utils/releaseInfo.js +1 -1
  86. package/node/utils/tree/sortRowTree.js +26 -11
  87. package/package.json +3 -3
  88. package/typeOverloads/modules.d.ts +2 -0
  89. package/utils/releaseInfo.js +1 -1
  90. package/utils/tree/sortRowTree.js +26 -11
@@ -43,6 +43,8 @@ const mergeStateWithPinnedColumns = pinnedColumns => state => _extends({}, state
43
43
  });
44
44
 
45
45
  export const useGridColumnPinning = (apiRef, props) => {
46
+ var _props$initialState4;
47
+
46
48
  const pinnedColumns = useGridSelector(apiRef, gridPinnedColumnsSelector); // Each visible row (not to be confused with a filter result) is composed of a central .MuiDataGrid-row element
47
49
  // and up to two additional .MuiDataGrid-row's, one for the columns pinned to the left and another
48
50
  // for those on the right side. When hovering any of these elements, the :hover styles are applied only to
@@ -164,17 +166,24 @@ export const useGridColumnPinning = (apiRef, props) => {
164
166
 
165
167
  return initialValue;
166
168
  }, [apiRef, pinnedColumns]);
167
- const stateExportPreProcessing = React.useCallback(prevState => {
169
+ const stateExportPreProcessing = React.useCallback((prevState, context) => {
170
+ var _props$initialState3, _pinnedColumnsToExpor, _pinnedColumnsToExpor2;
171
+
168
172
  const pinnedColumnsToExport = gridPinnedColumnsSelector(apiRef.current.state);
173
+ const shouldExportPinnedColumns = // Always export if the `exportOnlyDirtyModels` property is activated
174
+ !context.exportOnlyDirtyModels || // Always export if the model is controlled
175
+ props.pinnedColumns != null || // Always export if the model has been initialized
176
+ ((_props$initialState3 = props.initialState) == null ? void 0 : _props$initialState3.pinnedColumns) != null || // Export if the model is not empty
177
+ ((_pinnedColumnsToExpor = pinnedColumnsToExport.left) != null ? _pinnedColumnsToExpor : []).length > 0 || ((_pinnedColumnsToExpor2 = pinnedColumnsToExport.right) != null ? _pinnedColumnsToExpor2 : []).length > 0;
169
178
 
170
- if ((!pinnedColumnsToExport.left || pinnedColumnsToExport.left.length === 0) && (!pinnedColumnsToExport.right || pinnedColumnsToExport.right.length === 0)) {
179
+ if (!shouldExportPinnedColumns) {
171
180
  return prevState;
172
181
  }
173
182
 
174
183
  return _extends({}, prevState, {
175
184
  pinnedColumns: pinnedColumnsToExport
176
185
  });
177
- }, [apiRef]);
186
+ }, [apiRef, props.pinnedColumns, (_props$initialState4 = props.initialState) == null ? void 0 : _props$initialState4.pinnedColumns]);
178
187
  const stateRestorePreProcessing = React.useCallback((params, context) => {
179
188
  const newPinnedColumns = context.stateToRestore.pinnedColumns;
180
189
 
@@ -12,6 +12,8 @@ export const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = _extends({}, GRID_STRING_COL_DEF
12
12
  sortable: false,
13
13
  filterable: false,
14
14
  resizable: false,
15
+ // @ts-ignore
16
+ aggregable: false,
15
17
  disableColumnMenu: true,
16
18
  disableReorder: true,
17
19
  disableExport: true,
@@ -4,3 +4,4 @@ export * from './columnResize';
4
4
  export * from './rowReorder';
5
5
  export * from './treeData';
6
6
  export * from './detailPanel';
7
+ export * from './rowPinning';
@@ -4,4 +4,5 @@ export * from './columnReorder';
4
4
  export * from './columnResize';
5
5
  export * from './rowReorder';
6
6
  export * from './treeData';
7
- export * from './detailPanel';
7
+ export * from './detailPanel';
8
+ export * from './rowPinning';
@@ -0,0 +1,17 @@
1
+ import { GridRowId, GridRowsLookup, GridRowsProp } from '@mui/x-data-grid';
2
+ export interface GridPinnedRowsProp<R = any> {
3
+ top?: GridRowsProp<R>;
4
+ bottom?: GridRowsProp<R>;
5
+ }
6
+ export interface GridRowPinningApi {
7
+ /**
8
+ * Changes the pinned rows.
9
+ * @param {GridPinnedRowsProp} pinnedRows An object containing the rows to pin.
10
+ */
11
+ unstable_setPinnedRows: (pinnedRows?: GridPinnedRowsProp) => void;
12
+ }
13
+ export interface GridRowPinningInternalCache {
14
+ topIds: GridRowId[];
15
+ bottomIds: GridRowId[];
16
+ idLookup: GridRowsLookup;
17
+ }
@@ -0,0 +1 @@
1
+ export { gridAdditionalRowGroupsSelector, gridPinnedRowsSelector, } from '@mui/x-data-grid/internals';
@@ -0,0 +1 @@
1
+ export { gridAdditionalRowGroupsSelector, gridPinnedRowsSelector } from '@mui/x-data-grid/internals';
@@ -0,0 +1 @@
1
+ export * from './gridRowPinningInterface';
@@ -0,0 +1 @@
1
+ export * from './gridRowPinningInterface';
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import { GridStateInitializer } from '@mui/x-data-grid/internals';
3
+ import { GridApiPro } from '../../../models/gridApiPro';
4
+ import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
5
+ export declare const rowPinningStateInitializer: GridStateInitializer<Pick<DataGridProProcessedProps, 'pinnedRows' | 'getRowId' | 'experimentalFeatures'>>;
6
+ export declare const useGridRowPinning: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'pinnedRows' | 'getRowId' | 'experimentalFeatures'>) => void;
@@ -0,0 +1,71 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ import { useGridApiMethod } from '@mui/x-data-grid';
4
+ import { getRowIdFromRowModel } from '@mui/x-data-grid/internals';
5
+
6
+ function createPinnedRowsInternalCache(pinnedRows, getRowId) {
7
+ var _pinnedRows$top, _pinnedRows$bottom;
8
+
9
+ const cache = {
10
+ topIds: [],
11
+ bottomIds: [],
12
+ idLookup: {}
13
+ };
14
+ pinnedRows == null ? void 0 : (_pinnedRows$top = pinnedRows.top) == null ? void 0 : _pinnedRows$top.forEach(rowModel => {
15
+ const id = getRowIdFromRowModel(rowModel, getRowId);
16
+ cache.topIds.push(id);
17
+ cache.idLookup[id] = rowModel;
18
+ });
19
+ pinnedRows == null ? void 0 : (_pinnedRows$bottom = pinnedRows.bottom) == null ? void 0 : _pinnedRows$bottom.forEach(rowModel => {
20
+ const id = getRowIdFromRowModel(rowModel, getRowId);
21
+ cache.bottomIds.push(id);
22
+ cache.idLookup[id] = rowModel;
23
+ });
24
+ return cache;
25
+ }
26
+
27
+ export const rowPinningStateInitializer = (state, props, apiRef) => {
28
+ var _props$experimentalFe, _state$rows;
29
+
30
+ if (!((_props$experimentalFe = props.experimentalFeatures) != null && _props$experimentalFe.rowPinning)) {
31
+ return state;
32
+ }
33
+
34
+ apiRef.current.unstable_caches.pinnedRows = createPinnedRowsInternalCache(props.pinnedRows, props.getRowId);
35
+ return _extends({}, state, {
36
+ rows: _extends({}, state.rows, {
37
+ additionalRowGroups: _extends({}, (_state$rows = state.rows) == null ? void 0 : _state$rows.additionalRowGroups, {
38
+ pinnedRows: {
39
+ top: [],
40
+ bottom: []
41
+ }
42
+ })
43
+ })
44
+ });
45
+ };
46
+ export const useGridRowPinning = (apiRef, props) => {
47
+ var _props$experimentalFe3;
48
+
49
+ const setPinnedRows = React.useCallback(newPinnedRows => {
50
+ var _props$experimentalFe2;
51
+
52
+ if (!((_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.rowPinning)) {
53
+ return;
54
+ }
55
+
56
+ apiRef.current.unstable_caches.pinnedRows = createPinnedRowsInternalCache(newPinnedRows, props.getRowId);
57
+ apiRef.current.unstable_requestPipeProcessorsApplication('hydrateRows');
58
+ }, [apiRef, (_props$experimentalFe3 = props.experimentalFeatures) == null ? void 0 : _props$experimentalFe3.rowPinning, props.getRowId]);
59
+ useGridApiMethod(apiRef, {
60
+ unstable_setPinnedRows: setPinnedRows
61
+ }, 'rowPinningApi');
62
+ const isFirstRender = React.useRef(true);
63
+ React.useEffect(() => {
64
+ if (isFirstRender.current) {
65
+ isFirstRender.current = false;
66
+ return;
67
+ }
68
+
69
+ apiRef.current.unstable_setPinnedRows(props.pinnedRows);
70
+ }, [apiRef, props.pinnedRows]);
71
+ };
@@ -0,0 +1,34 @@
1
+ import * as React from 'react';
2
+ import { GridHydrateRowsValue } from '@mui/x-data-grid/internals';
3
+ import { GridRowEntry, GridRowId, GridRowModel } from '@mui/x-data-grid';
4
+ import { GridApiPro } from '../../../models/gridApiPro';
5
+ import { GridPinnedRowsProp } from './gridRowPinningInterface';
6
+ declare type GridPinnedRowPosition = keyof GridPinnedRowsProp;
7
+ export declare function addPinnedRow({ groupingParams, rowModel, rowId, position, apiRef, }: {
8
+ groupingParams: GridHydrateRowsValue;
9
+ rowModel: GridRowModel;
10
+ rowId: GridRowId;
11
+ position: GridPinnedRowPosition;
12
+ apiRef: React.MutableRefObject<GridApiPro>;
13
+ }): {
14
+ idRowsLookup: {
15
+ [x: string]: any;
16
+ [x: number]: any;
17
+ };
18
+ tree: {
19
+ [x: string]: import("@mui/x-data-grid").GridRowTreeNodeConfig;
20
+ [x: number]: import("@mui/x-data-grid").GridRowTreeNodeConfig;
21
+ };
22
+ additionalRowGroups: {
23
+ pinnedRows: {
24
+ top?: GridRowEntry<any>[] | undefined;
25
+ bottom?: GridRowEntry<any>[] | undefined;
26
+ };
27
+ };
28
+ groupingName: string;
29
+ treeDepth: number;
30
+ ids: GridRowId[];
31
+ idToIdLookup: Record<string, GridRowId>;
32
+ };
33
+ export declare const useGridRowPinningPreProcessors: (apiRef: React.MutableRefObject<GridApiPro>) => void;
34
+ export {};
@@ -0,0 +1,89 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
4
+ export function addPinnedRow({
5
+ groupingParams,
6
+ rowModel,
7
+ rowId,
8
+ position,
9
+ apiRef
10
+ }) {
11
+ var _groupingParams$addit;
12
+
13
+ const idRowsLookup = _extends({}, groupingParams.idRowsLookup);
14
+
15
+ const tree = _extends({}, groupingParams.tree); // TODO: warn if id is already present in `props.rows`
16
+
17
+
18
+ idRowsLookup[rowId] = rowModel; // Do not push it to ids list so that pagination is not affected by pinned rows
19
+ // ids.push(rowId);
20
+
21
+ tree[rowId] = {
22
+ id: rowId,
23
+ isAutoGenerated: false,
24
+ parent: null,
25
+ depth: 0,
26
+ groupingKey: null,
27
+ groupingField: null,
28
+ isPinned: true
29
+ };
30
+ apiRef.current.unstable_caches.rows.idRowsLookup[rowId] = _extends({}, rowModel);
31
+ apiRef.current.unstable_caches.rows.idToIdLookup[rowId] = rowId;
32
+ const previousPinnedRows = ((_groupingParams$addit = groupingParams.additionalRowGroups) == null ? void 0 : _groupingParams$addit.pinnedRows) || {};
33
+ const newPinnedRow = {
34
+ id: rowId,
35
+ model: rowModel
36
+ };
37
+ return _extends({}, groupingParams, {
38
+ idRowsLookup,
39
+ tree,
40
+ additionalRowGroups: _extends({}, groupingParams.additionalRowGroups, {
41
+ pinnedRows: _extends({}, previousPinnedRows, {
42
+ [position]: [...(previousPinnedRows[position] || []), newPinnedRow]
43
+ })
44
+ })
45
+ });
46
+ }
47
+ export const useGridRowPinningPreProcessors = apiRef => {
48
+ const addPinnedRows = React.useCallback(groupingParams => {
49
+ var _pinnedRowsCache$topI, _pinnedRowsCache$bott;
50
+
51
+ const pinnedRowsCache = apiRef.current.unstable_caches.pinnedRows || {};
52
+
53
+ let newGroupingParams = _extends({}, groupingParams, {
54
+ additionalRowGroups: _extends({}, groupingParams.additionalRowGroups, {
55
+ // reset pinned rows state
56
+ pinnedRows: {}
57
+ })
58
+ });
59
+
60
+ (_pinnedRowsCache$topI = pinnedRowsCache.topIds) == null ? void 0 : _pinnedRowsCache$topI.forEach(rowId => {
61
+ newGroupingParams = addPinnedRow({
62
+ groupingParams: newGroupingParams,
63
+ rowModel: pinnedRowsCache.idLookup[rowId],
64
+ rowId,
65
+ position: 'top',
66
+ apiRef
67
+ });
68
+ });
69
+ (_pinnedRowsCache$bott = pinnedRowsCache.bottomIds) == null ? void 0 : _pinnedRowsCache$bott.forEach(rowId => {
70
+ newGroupingParams = addPinnedRow({
71
+ groupingParams: newGroupingParams,
72
+ rowModel: pinnedRowsCache.idLookup[rowId],
73
+ rowId,
74
+ position: 'bottom',
75
+ apiRef
76
+ });
77
+ }); // If row with the same `id` is present both in `rows` and `pinnedRows` - remove it from `ids`
78
+
79
+ newGroupingParams.ids = newGroupingParams.ids.filter(rowId => {
80
+ if (newGroupingParams.tree[rowId] && newGroupingParams.tree[rowId].isPinned) {
81
+ return false;
82
+ }
83
+
84
+ return true;
85
+ });
86
+ return newGroupingParams;
87
+ }, [apiRef]);
88
+ useGridRegisterPipeProcessor(apiRef, 'hydrateRows', addPinnedRows);
89
+ };
@@ -13,6 +13,8 @@ export const GRID_REORDER_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
13
13
  disableExport: true,
14
14
  disableReorder: true,
15
15
  resizable: false,
16
+ // @ts-ignore
17
+ aggregable: false,
16
18
  renderHeader: () => ' ',
17
19
  renderCell: renderRowReorderCell
18
20
  });
@@ -60,10 +60,16 @@ export const useGridRowReorder = (apiRef, props) => {
60
60
  originRowIndex.current = apiRef.current.getRowIndex(params.id);
61
61
  }, [isRowReorderDisabled, classes.rowDragging, logger, apiRef]);
62
62
  const handleDragOver = React.useCallback((params, event) => {
63
+ var _apiRef$current$getRo;
64
+
63
65
  if (dragRowId === '') {
64
66
  return;
65
67
  }
66
68
 
69
+ if ((_apiRef$current$getRo = apiRef.current.getRowNode(params.id)) != null && _apiRef$current$getRo.isPinned) {
70
+ return;
71
+ }
72
+
67
73
  logger.debug(`Dragging over row ${params.id}`);
68
74
  event.preventDefault(); // Prevent drag events propagation.
69
75
  // For more information check here https://github.com/mui/mui-x/issues/2680.
@@ -62,11 +62,20 @@ export const filterRowTreeFromTreeData = params => {
62
62
  visibleRowsLookup[node.id] = shouldPassFilters && areAncestorsExpanded;
63
63
  filteredRowsLookup[node.id] = shouldPassFilters;
64
64
 
65
+ if (node.footerId != null) {
66
+ visibleRowsLookup[node.footerId] = shouldPassFilters && areAncestorsExpanded && !!node.childrenExpanded;
67
+ }
68
+
65
69
  if (!shouldPassFilters) {
66
70
  return 0;
67
71
  }
68
72
 
69
73
  filteredDescendantCountLookup[node.id] = filteredDescendantCount;
74
+
75
+ if (node.position === 'footer') {
76
+ return filteredDescendantCount;
77
+ }
78
+
70
79
  return filteredDescendantCount + 1;
71
80
  };
72
81
 
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.13.1
1
+ /** @license MUI v5.15.1
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -12,6 +12,9 @@ export { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorde
12
12
  export { useGridRowReorderPreProcessors } from '../hooks/features/rowReorder/useGridRowReorderPreProcessors';
13
13
  export { useGridTreeData } from '../hooks/features/treeData/useGridTreeData';
14
14
  export { useGridTreeDataPreProcessors } from '../hooks/features/treeData/useGridTreeDataPreProcessors';
15
+ export { TREE_DATA_STRATEGY } from '../hooks/features/treeData/gridTreeDataUtils';
16
+ export { useGridRowPinning, rowPinningStateInitializer, } from '../hooks/features/rowPinning/useGridRowPinning';
17
+ export { useGridRowPinningPreProcessors, addPinnedRow, } from '../hooks/features/rowPinning/useGridRowPinningPreProcessors';
15
18
  export type { GridExperimentalProFeatures, DataGridProPropsWithoutDefaultValue, DataGridProPropsWithDefaultValue, } from '../models/dataGridProProps';
16
19
  export { buildRowTree } from '../utils/tree/buildRowTree';
17
20
  export type { BuildRowTreeGroupingCriteria } from '../utils/tree/buildRowTree';
@@ -12,5 +12,8 @@ export { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorde
12
12
  export { useGridRowReorderPreProcessors } from '../hooks/features/rowReorder/useGridRowReorderPreProcessors';
13
13
  export { useGridTreeData } from '../hooks/features/treeData/useGridTreeData';
14
14
  export { useGridTreeDataPreProcessors } from '../hooks/features/treeData/useGridTreeDataPreProcessors';
15
+ export { TREE_DATA_STRATEGY } from '../hooks/features/treeData/gridTreeDataUtils';
16
+ export { useGridRowPinning, rowPinningStateInitializer } from '../hooks/features/rowPinning/useGridRowPinning';
17
+ export { useGridRowPinningPreProcessors, addPinnedRow } from '../hooks/features/rowPinning/useGridRowPinningPreProcessors';
15
18
  export { buildRowTree } from '../utils/tree/buildRowTree';
16
19
  export { sortRowTree } from '../utils/tree/sortRowTree';
@@ -217,6 +217,12 @@ DataGridProRaw.propTypes = {
217
217
  */
218
218
  disableExtendRowFullWidth: PropTypes.bool,
219
219
 
220
+ /**
221
+ * If `true`, modification to a cell will not be discarded if the mode is changed from "edit" to "view" while processing props.
222
+ * @default false
223
+ */
224
+ disableIgnoreModificationsIfProcessingProps: PropTypes.bool,
225
+
220
226
  /**
221
227
  * If `true`, filtering with multiple columns is disabled.
222
228
  * @default false
@@ -270,6 +276,7 @@ DataGridProRaw.propTypes = {
270
276
  experimentalFeatures: PropTypes.shape({
271
277
  newEditingApi: PropTypes.bool,
272
278
  preventCommitWhileValidating: PropTypes.bool,
279
+ rowPinning: PropTypes.bool,
273
280
  warnIfFocusStateIsNotSynced: PropTypes.bool
274
281
  }),
275
282
 
@@ -854,6 +861,14 @@ DataGridProRaw.propTypes = {
854
861
  right: PropTypes.arrayOf(PropTypes.string)
855
862
  }),
856
863
 
864
+ /**
865
+ * Rows data to pin on top or bottom.
866
+ */
867
+ pinnedRows: PropTypes.shape({
868
+ bottom: PropTypes.array,
869
+ top: PropTypes.array
870
+ }),
871
+
857
872
  /**
858
873
  * Callback called before updating a row with new values in the row and cell editing.
859
874
  * Only applied if `props.experimentalFeatures.newEditingApi: true`.
@@ -11,6 +11,8 @@ import { useGridDetailPanel, detailPanelStateInitializer } from '../hooks/featur
11
11
  import { useGridDetailPanelPreProcessors } from '../hooks/features/detailPanel/useGridDetailPanelPreProcessors';
12
12
  import { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorder';
13
13
  import { useGridRowReorderPreProcessors } from '../hooks/features/rowReorder/useGridRowReorderPreProcessors';
14
+ import { useGridRowPinning, rowPinningStateInitializer } from '../hooks/features/rowPinning/useGridRowPinning';
15
+ import { useGridRowPinningPreProcessors } from '../hooks/features/rowPinning/useGridRowPinningPreProcessors';
14
16
  export var useDataGridProComponent = function useDataGridProComponent(inputApiRef, props) {
15
17
  var _props$experimentalFe, _props$experimentalFe2;
16
18
 
@@ -22,6 +24,7 @@ export var useDataGridProComponent = function useDataGridProComponent(inputApiRe
22
24
  useGridSelectionPreProcessors(apiRef, props);
23
25
  useGridRowReorderPreProcessors(apiRef, props);
24
26
  useGridTreeDataPreProcessors(apiRef, props);
27
+ useGridRowPinningPreProcessors(apiRef);
25
28
  useGridDetailPanelPreProcessors(apiRef, props); // The column pinning `hydrateColumns` pre-processor must be after every other `hydrateColumns` pre-processors
26
29
  // Because it changes the order of the columns.
27
30
 
@@ -35,6 +38,7 @@ export var useDataGridProComponent = function useDataGridProComponent(inputApiRe
35
38
  useGridInitializeState(detailPanelStateInitializer, apiRef, props);
36
39
  useGridInitializeState(columnPinningStateInitializer, apiRef, props);
37
40
  useGridInitializeState(columnsStateInitializer, apiRef, props);
41
+ useGridInitializeState(rowPinningStateInitializer, apiRef, props);
38
42
  useGridInitializeState(rowsStateInitializer, apiRef, props);
39
43
  useGridInitializeState((_props$experimentalFe = props.experimentalFeatures) != null && _props$experimentalFe.newEditingApi ? editingStateInitializer_new : editingStateInitializer_old, apiRef, props);
40
44
  useGridInitializeState(focusStateInitializer, apiRef, props);
@@ -51,6 +55,7 @@ export var useDataGridProComponent = function useDataGridProComponent(inputApiRe
51
55
  useGridKeyboardNavigation(apiRef, props);
52
56
  useGridSelection(apiRef, props);
53
57
  useGridColumnPinning(apiRef, props);
58
+ useGridRowPinning(apiRef, props);
54
59
  useGridColumns(apiRef, props);
55
60
  useGridRows(apiRef, props);
56
61
  useGridParamsApi(apiRef);
@@ -59,7 +64,7 @@ export var useDataGridProComponent = function useDataGridProComponent(inputApiRe
59
64
  var useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
60
65
  useGridEditing(apiRef, props);
61
66
  useGridFocus(apiRef, props);
62
- useGridPreferencesPanel(apiRef);
67
+ useGridPreferencesPanel(apiRef, props);
63
68
  useGridFilter(apiRef, props);
64
69
  useGridSorting(apiRef, props);
65
70
  useGridDensity(apiRef, props);