@mui/x-data-grid-pro 6.0.0-beta.4 → 6.0.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 (83) hide show
  1. package/CHANGELOG.md +204 -29
  2. package/DataGridPro/DataGridPro.js +16 -4
  3. package/DataGridPro/useDataGridProProps.js +26 -19
  4. package/components/DataGridProVirtualScroller.js +29 -22
  5. package/components/GridColumnHeaders.d.ts +9 -0
  6. package/components/{DataGridProColumnHeaders.js → GridColumnHeaders.js} +99 -16
  7. package/components/GridColumnMenuPinningItem.js +3 -3
  8. package/components/GridDetailPanel.js +4 -0
  9. package/components/GridDetailPanelToggleCell.js +4 -4
  10. package/components/GridRowReorderCell.js +1 -1
  11. package/components/GridTreeDataGroupingCell.js +4 -4
  12. package/components/index.d.ts +1 -1
  13. package/components/index.js +1 -1
  14. package/constants/dataGridProDefaultSlotsComponents.d.ts +1 -2
  15. package/constants/dataGridProDefaultSlotsComponents.js +5 -7
  16. package/hooks/features/columnPinning/useGridColumnPinning.d.ts +1 -1
  17. package/hooks/features/rowPinning/useGridRowPinning.d.ts +1 -1
  18. package/hooks/features/rowPinning/useGridRowPinning.js +2 -10
  19. package/index.d.ts +1 -0
  20. package/index.js +3 -2
  21. package/internals/index.d.ts +1 -1
  22. package/internals/index.js +1 -1
  23. package/legacy/DataGridPro/DataGridPro.js +16 -4
  24. package/legacy/DataGridPro/useDataGridProProps.js +21 -20
  25. package/legacy/components/DataGridProVirtualScroller.js +29 -22
  26. package/legacy/components/{DataGridProColumnHeaders.js → GridColumnHeaders.js} +101 -15
  27. package/legacy/components/GridColumnMenuPinningItem.js +3 -3
  28. package/legacy/components/GridDetailPanel.js +4 -0
  29. package/legacy/components/GridDetailPanelToggleCell.js +4 -4
  30. package/legacy/components/GridRowReorderCell.js +1 -1
  31. package/legacy/components/GridTreeDataGroupingCell.js +4 -4
  32. package/legacy/components/index.js +1 -1
  33. package/legacy/constants/dataGridProDefaultSlotsComponents.js +5 -7
  34. package/legacy/hooks/features/rowPinning/useGridRowPinning.js +2 -10
  35. package/legacy/index.js +3 -2
  36. package/legacy/internals/index.js +1 -1
  37. package/legacy/material/index.js +8 -0
  38. package/legacy/utils/releaseInfo.js +1 -1
  39. package/material/index.d.ts +6 -0
  40. package/material/index.js +8 -0
  41. package/material/package.json +6 -0
  42. package/models/dataGridProProps.d.ts +9 -8
  43. package/models/gridProSlotsComponent.d.ts +4 -1
  44. package/modern/DataGridPro/DataGridPro.js +16 -4
  45. package/modern/DataGridPro/useDataGridProProps.js +21 -17
  46. package/modern/components/DataGridProVirtualScroller.js +29 -22
  47. package/modern/components/{DataGridProColumnHeaders.js → GridColumnHeaders.js} +99 -16
  48. package/modern/components/GridColumnMenuPinningItem.js +3 -3
  49. package/modern/components/GridDetailPanel.js +4 -0
  50. package/modern/components/GridDetailPanelToggleCell.js +3 -3
  51. package/modern/components/GridRowReorderCell.js +1 -1
  52. package/modern/components/GridTreeDataGroupingCell.js +3 -3
  53. package/modern/components/index.js +1 -1
  54. package/modern/constants/dataGridProDefaultSlotsComponents.js +5 -7
  55. package/modern/hooks/features/rowPinning/useGridRowPinning.js +1 -7
  56. package/modern/index.js +3 -2
  57. package/modern/internals/index.js +1 -1
  58. package/modern/material/index.js +8 -0
  59. package/modern/utils/releaseInfo.js +1 -1
  60. package/node/DataGridPro/DataGridPro.js +15 -3
  61. package/node/DataGridPro/useDataGridProProps.js +21 -17
  62. package/node/components/DataGridProVirtualScroller.js +29 -22
  63. package/node/components/{DataGridProColumnHeaders.js → GridColumnHeaders.js} +96 -14
  64. package/node/components/GridColumnMenuPinningItem.js +3 -3
  65. package/node/components/GridDetailPanel.js +4 -0
  66. package/node/components/GridDetailPanelToggleCell.js +3 -3
  67. package/node/components/GridRowReorderCell.js +1 -1
  68. package/node/components/GridTreeDataGroupingCell.js +3 -3
  69. package/node/components/index.js +1 -1
  70. package/node/constants/dataGridProDefaultSlotsComponents.js +6 -9
  71. package/node/hooks/features/rowPinning/useGridRowPinning.js +1 -7
  72. package/node/index.js +11 -3
  73. package/node/internals/index.js +6 -6
  74. package/node/material/index.js +16 -0
  75. package/node/utils/releaseInfo.js +1 -1
  76. package/package.json +3 -3
  77. package/utils/releaseInfo.js +1 -1
  78. package/components/DataGridProColumnHeaders.d.ts +0 -6
  79. /package/legacy/{components → material}/icons.js +0 -0
  80. /package/{components → material}/icons.d.ts +0 -0
  81. /package/{components → material}/icons.js +0 -0
  82. /package/modern/{components → material}/icons.js +0 -0
  83. /package/node/{components → material}/icons.js +0 -0
@@ -1,4 +1,5 @@
1
- import { GridSlotsComponent } from '@mui/x-data-grid';
1
+ import { GridSlotsComponent, UncapitalizedGridSlotsComponent } from '@mui/x-data-grid';
2
+ import { UncapitalizeObjectKeys } from '@mui/x-data-grid/internals';
2
3
  import { GridProIconSlotsComponent } from './gridProIconSlotsComponent';
3
4
  /**
4
5
  * Grid components React prop interface containing all the overridable components
@@ -6,3 +7,5 @@ import { GridProIconSlotsComponent } from './gridProIconSlotsComponent';
6
7
  */
7
8
  export interface GridProSlotsComponent extends GridSlotsComponent, GridProIconSlotsComponent {
8
9
  }
10
+ export interface UncapitalizedGridProSlotsComponent extends UncapitalizedGridSlotsComponent, UncapitalizeObjectKeys<GridProIconSlotsComponent> {
11
+ }
@@ -2,12 +2,12 @@ import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useLicenseVerifier, Watermark } from '@mui/x-license-pro';
4
4
  import { chainPropTypes } from '@mui/utils';
5
- import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot, GridContextProvider } from '@mui/x-data-grid';
5
+ import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot, GridContextProvider, useGridSelector } from '@mui/x-data-grid';
6
6
  import { useDataGridProComponent } from './useDataGridProComponent';
7
7
  import { useDataGridProProps } from './useDataGridProProps';
8
8
  import { DataGridProVirtualScroller } from '../components/DataGridProVirtualScroller';
9
- import { DataGridProColumnHeaders } from '../components/DataGridProColumnHeaders';
10
9
  import { getReleaseInfo } from '../utils/releaseInfo';
10
+ import { gridPinnedColumnsSelector } from '../hooks/features/columnPinning/gridColumnPinningSelector';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
13
  const releaseInfo = getReleaseInfo();
@@ -15,6 +15,7 @@ const DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProp
15
15
  const props = useDataGridProProps(inProps);
16
16
  const privateApiRef = useDataGridProComponent(props.apiRef, props);
17
17
  useLicenseVerifier('x-data-grid-pro', releaseInfo);
18
+ const pinnedColumns = useGridSelector(privateApiRef, gridPinnedColumnsSelector);
18
19
  return /*#__PURE__*/_jsx(GridContextProvider, {
19
20
  privateApiRef: privateApiRef,
20
21
  props: props,
@@ -24,8 +25,10 @@ const DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProp
24
25
  sx: props.sx,
25
26
  ref: ref,
26
27
  children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {
27
- ColumnHeadersComponent: DataGridProColumnHeaders,
28
28
  VirtualScrollerComponent: DataGridProVirtualScroller,
29
+ ColumnHeadersProps: {
30
+ pinnedColumns
31
+ },
29
32
  children: /*#__PURE__*/_jsx(Watermark, {
30
33
  packageName: "x-data-grid-pro",
31
34
  releaseInfo: releaseInfo
@@ -115,10 +118,12 @@ DataGridProRaw.propTypes = {
115
118
  columnVisibilityModel: PropTypes.object,
116
119
  /**
117
120
  * Overrideable components.
121
+ * @deprecated Use the `slots` prop instead.
118
122
  */
119
123
  components: PropTypes.object,
120
124
  /**
121
125
  * Overrideable components props dynamically passed to the component at rendering.
126
+ * @deprecated Use the `slotProps` prop instead.
122
127
  */
123
128
  componentsProps: PropTypes.object,
124
129
  /**
@@ -218,7 +223,6 @@ DataGridProRaw.propTypes = {
218
223
  experimentalFeatures: PropTypes.shape({
219
224
  columnGrouping: PropTypes.bool,
220
225
  lazyLoading: PropTypes.bool,
221
- rowPinning: PropTypes.bool,
222
226
  warnIfFocusStateIsNotSynced: PropTypes.bool
223
227
  }),
224
228
  /**
@@ -771,6 +775,14 @@ DataGridProRaw.propTypes = {
771
775
  * @default false
772
776
  */
773
777
  showColumnVerticalBorder: PropTypes.bool,
778
+ /**
779
+ * Overrideable components props dynamically passed to the component at rendering.
780
+ */
781
+ slotProps: PropTypes.object,
782
+ /**
783
+ * Overrideable components.
784
+ */
785
+ slots: PropTypes.object,
774
786
  /**
775
787
  * Sorting can be processed on the server or client-side.
776
788
  * Set it to 'client' if you would like to handle sorting on the client-side.
@@ -1,7 +1,10 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
1
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
+ const _excluded = ["components", "componentsProps"];
2
4
  import * as React from 'react';
3
5
  import { useThemeProps } from '@mui/material/styles';
4
6
  import { GRID_DEFAULT_LOCALE_TEXT, DATA_GRID_PROPS_DEFAULT_VALUES } from '@mui/x-data-grid';
7
+ import { computeSlots, uncapitalizeObjectKeys } from '@mui/x-data-grid/internals';
5
8
  import { DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS } from '../constants/dataGridProDefaultSlotsComponents';
6
9
 
7
10
  /**
@@ -19,26 +22,27 @@ export const DATA_GRID_PRO_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PROPS_D
19
22
  rowsLoadingMode: 'client',
20
23
  getDetailPanelHeight: () => 500
21
24
  });
25
+ const defaultSlots = uncapitalizeObjectKeys(DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS);
22
26
  export const useDataGridProProps = inProps => {
23
- const themedProps = useThemeProps({
24
- props: inProps,
25
- name: 'MuiDataGrid'
26
- });
27
+ const _useThemeProps = useThemeProps({
28
+ props: inProps,
29
+ name: 'MuiDataGrid'
30
+ }),
31
+ {
32
+ components,
33
+ componentsProps
34
+ } = _useThemeProps,
35
+ themedProps = _objectWithoutPropertiesLoose(_useThemeProps, _excluded);
27
36
  const localeText = React.useMemo(() => _extends({}, GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText), [themedProps.localeText]);
28
- const components = React.useMemo(() => {
29
- const overrides = themedProps.components;
30
- if (!overrides) {
31
- return _extends({}, DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS);
32
- }
33
- const mergedComponents = {};
34
- Object.entries(DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS).forEach(([key, defaultComponent]) => {
35
- mergedComponents[key] = overrides[key] === undefined ? defaultComponent : overrides[key];
36
- });
37
- return mergedComponents;
38
- }, [themedProps.components]);
37
+ const slots = React.useMemo(() => computeSlots({
38
+ defaultSlots,
39
+ slots: themedProps.slots,
40
+ components
41
+ }), [components, themedProps.slots]);
39
42
  return React.useMemo(() => _extends({}, DATA_GRID_PRO_PROPS_DEFAULT_VALUES, themedProps, {
40
43
  localeText,
41
- components,
44
+ slots,
45
+ slotProps: themedProps.slotProps ?? componentsProps,
42
46
  signature: 'DataGridPro'
43
- }), [themedProps, localeText, components]);
47
+ }), [themedProps, localeText, slots, componentsProps]);
44
48
  };
@@ -108,6 +108,11 @@ const VirtualScrollerPinnedColumns = styled('div', {
108
108
  borderLeftStyle: 'solid'
109
109
  });
110
110
  });
111
+ var PinnedRowsPosition;
112
+ (function (PinnedRowsPosition) {
113
+ PinnedRowsPosition["top"] = "top";
114
+ PinnedRowsPosition["bottom"] = "bottom";
115
+ })(PinnedRowsPosition || (PinnedRowsPosition = {}));
111
116
  const VirtualScrollerPinnedRows = styled('div', {
112
117
  name: 'MuiDataGrid',
113
118
  slot: 'PinnedRows',
@@ -133,7 +138,7 @@ const VirtualScrollerPinnedRows = styled('div', {
133
138
  }), ownerState.position === 'top' && {
134
139
  top: 0,
135
140
  boxShadow: `0px 3px 4px -2px ${boxShadowColor}`
136
- }, ownerState.position === 'bottom' && {
141
+ }, ownerState.position === PinnedRowsPosition.bottom && {
137
142
  boxShadow: `0px -3px 4px -2px ${boxShadowColor}`,
138
143
  bottom: 0
139
144
  });
@@ -171,7 +176,7 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
171
176
  bottomPinnedRowsRenderZoneRef.current.style.transform = `translate3d(${left}px, 0px, 0px)`;
172
177
  }
173
178
  }, []);
174
- const getRowProps = id => {
179
+ const getRowProps = React.useCallback(id => {
175
180
  if (!expandedRowIds.includes(id)) {
176
181
  return null;
177
182
  }
@@ -181,15 +186,16 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
181
186
  marginBottom: height
182
187
  }
183
188
  };
184
- };
189
+ }, [detailPanelsHeights, expandedRowIds]);
185
190
  const pinnedColumns = useGridSelector(apiRef, gridPinnedColumnsSelector);
186
191
  const [leftPinnedColumns, rightPinnedColumns] = filterColumns(pinnedColumns, visibleColumnFields, theme.direction === 'rtl');
187
192
  const pinnedRows = useGridSelector(apiRef, gridPinnedRowsSelector);
188
193
  const topPinnedRowsData = React.useMemo(() => pinnedRows?.top || [], [pinnedRows?.top]);
189
194
  const bottomPinnedRowsData = React.useMemo(() => pinnedRows?.bottom || [], [pinnedRows?.bottom]);
190
- const classes = useUtilityClasses({
195
+ const ownerState = _extends({}, rootProps, {
191
196
  classes: rootProps.classes
192
197
  });
198
+ const classes = useUtilityClasses(ownerState);
193
199
  const {
194
200
  renderContext,
195
201
  getRows,
@@ -281,9 +287,9 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
281
287
  return /*#__PURE__*/_jsxs(GridVirtualScroller, _extends({}, getRootProps(other), {
282
288
  children: [/*#__PURE__*/_jsx(GridOverlays, {}), topPinnedRowsData.length > 0 ? /*#__PURE__*/_jsxs(VirtualScrollerPinnedRows, {
283
289
  className: classes.topPinnedRows,
284
- ownerState: {
285
- position: 'top'
286
- },
290
+ ownerState: _extends({}, ownerState, {
291
+ position: PinnedRowsPosition.top
292
+ }),
287
293
  style: {
288
294
  width: contentProps.style.width,
289
295
  height: pinnedRowsHeight.top
@@ -291,10 +297,10 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
291
297
  role: "rowgroup",
292
298
  children: [leftRenderContext && /*#__PURE__*/_jsx(VirtualScrollerPinnedColumns, {
293
299
  className: classes.leftPinnedColumns,
294
- ownerState: {
300
+ ownerState: _extends({}, ownerState, {
295
301
  side: GridPinnedPosition.left,
296
302
  showCellVerticalBorder: rootProps.showCellVerticalBorder
297
- },
303
+ }),
298
304
  children: getRows({
299
305
  renderContext: leftRenderContext,
300
306
  minFirstColumn: leftRenderContext.firstColumnIndex,
@@ -310,10 +316,10 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
310
316
  children: topPinnedRows
311
317
  }), rightRenderContext && /*#__PURE__*/_jsx(VirtualScrollerPinnedColumns, {
312
318
  className: classes.rightPinnedColumns,
313
- ownerState: {
319
+ ownerState: _extends({}, ownerState, {
314
320
  side: GridPinnedPosition.right,
315
321
  showCellVerticalBorder: rootProps.showCellVerticalBorder
316
- },
322
+ }),
317
323
  children: getRows({
318
324
  renderContext: rightRenderContext,
319
325
  minFirstColumn: rightRenderContext.firstColumnIndex,
@@ -327,10 +333,10 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
327
333
  children: [leftRenderContext && /*#__PURE__*/_jsx(VirtualScrollerPinnedColumns, {
328
334
  ref: leftColumns,
329
335
  className: classes.leftPinnedColumns,
330
- ownerState: {
336
+ ownerState: _extends({}, ownerState, {
331
337
  side: GridPinnedPosition.left,
332
338
  showCellVerticalBorder: rootProps.showCellVerticalBorder
333
- },
339
+ }),
334
340
  style: pinnedColumnsStyle,
335
341
  children: getRows({
336
342
  renderContext: leftRenderContext,
@@ -344,10 +350,10 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
344
350
  children: mainRows
345
351
  })), rightRenderContext && /*#__PURE__*/_jsx(VirtualScrollerPinnedColumns, {
346
352
  ref: rightColumns,
347
- ownerState: {
353
+ ownerState: _extends({}, ownerState, {
348
354
  side: GridPinnedPosition.right,
349
355
  showCellVerticalBorder: rootProps.showCellVerticalBorder
350
- },
356
+ }),
351
357
  className: classes.rightPinnedColumns,
352
358
  style: pinnedColumnsStyle,
353
359
  children: getRows({
@@ -360,13 +366,14 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
360
366
  })
361
367
  }), detailPanels.length > 0 && /*#__PURE__*/_jsx(VirtualScrollerDetailPanels, {
362
368
  className: classes.detailPanels,
369
+ ownerState: ownerState,
363
370
  children: detailPanels
364
371
  })]
365
372
  })), bottomPinnedRowsData.length > 0 ? /*#__PURE__*/_jsxs(VirtualScrollerPinnedRows, {
366
373
  className: classes.bottomPinnedRows,
367
- ownerState: {
368
- position: 'bottom'
369
- },
374
+ ownerState: _extends({}, ownerState, {
375
+ position: PinnedRowsPosition.bottom
376
+ }),
370
377
  style: {
371
378
  width: contentProps.style.width,
372
379
  height: pinnedRowsHeight.bottom
@@ -374,10 +381,10 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
374
381
  role: "rowgroup",
375
382
  children: [leftRenderContext && /*#__PURE__*/_jsx(VirtualScrollerPinnedColumns, {
376
383
  className: classes.leftPinnedColumns,
377
- ownerState: {
384
+ ownerState: _extends({}, ownerState, {
378
385
  side: GridPinnedPosition.left,
379
386
  showCellVerticalBorder: rootProps.showCellVerticalBorder
380
- },
387
+ }),
381
388
  children: getRows({
382
389
  renderContext: leftRenderContext,
383
390
  minFirstColumn: leftRenderContext.firstColumnIndex,
@@ -394,10 +401,10 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
394
401
  children: bottomPinnedRows
395
402
  }), rightRenderContext && /*#__PURE__*/_jsx(VirtualScrollerPinnedColumns, {
396
403
  className: classes.rightPinnedColumns,
397
- ownerState: {
404
+ ownerState: _extends({}, ownerState, {
398
405
  side: GridPinnedPosition.right,
399
406
  showCellVerticalBorder: rootProps.showCellVerticalBorder
400
- },
407
+ }),
401
408
  children: getRows({
402
409
  renderContext: rightRenderContext,
403
410
  minFirstColumn: rightRenderContext.firstColumnIndex,
@@ -1,14 +1,15 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["style", "className", "innerRef"];
3
+ const _excluded = ["style", "className", "innerRef", "visibleColumns", "sortColumnLookup", "filterColumnLookup", "columnPositions", "columnHeaderTabIndexState", "columnGroupHeaderTabIndexState", "columnHeaderFocus", "columnGroupHeaderFocus", "densityFactor", "headerGroupingMaxDepth", "columnMenuState", "columnVisibility", "columnGroupsHeaderStructure", "hasOtherElementInTabSequence", "pinnedColumns"];
4
4
  import * as React from 'react';
5
+ import PropTypes from 'prop-types';
5
6
  import { unstable_composeClasses as composeClasses, unstable_useEventCallback as useEventCallback } from '@mui/utils';
6
7
  import { styled, alpha, useTheme } from '@mui/material/styles';
7
- import { getDataGridUtilityClass, gridClasses, useGridSelector, useGridApiEventHandler, gridVisibleColumnFieldsSelector, GridColumnHeaderSeparatorSides } from '@mui/x-data-grid';
8
- import { GridColumnHeaders, GridColumnHeadersInner, useGridColumnHeaders } from '@mui/x-data-grid/internals';
8
+ import { getDataGridUtilityClass, gridClasses, useGridApiEventHandler, GridColumnHeaderSeparatorSides } from '@mui/x-data-grid';
9
+ import { GridBaseColumnHeaders, GridColumnHeadersInner, useGridColumnHeaders } from '@mui/x-data-grid/internals';
9
10
  import { useGridRootProps } from '../hooks/utils/useGridRootProps';
10
11
  import { useGridApiContext } from '../hooks/utils/useGridApiContext';
11
- import { gridPinnedColumnsSelector, GridPinnedPosition } from '../hooks/features/columnPinning';
12
+ import { GridPinnedPosition } from '../hooks/features/columnPinning';
12
13
  import { filterColumns } from './DataGridProVirtualScroller';
13
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
15
  const useUtilityClasses = ownerState => {
@@ -65,15 +66,36 @@ const GridColumnHeadersPinnedColumnHeaders = styled('div', {
65
66
  borderLeftWidth: '1px',
66
67
  borderLeftStyle: 'solid'
67
68
  }));
68
- export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function DataGridProColumnHeaders(props, ref) {
69
+ GridColumnHeadersPinnedColumnHeaders.propTypes = {
70
+ // ----------------------------- Warning --------------------------------
71
+ // | These PropTypes are generated from the TypeScript type definitions |
72
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
73
+ // ----------------------------------------------------------------------
74
+ ownerState: PropTypes.object.isRequired
75
+ };
76
+ const GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnHeaders(props, ref) {
69
77
  const {
70
78
  className,
71
- innerRef
79
+ innerRef,
80
+ visibleColumns,
81
+ sortColumnLookup,
82
+ filterColumnLookup,
83
+ columnPositions,
84
+ columnHeaderTabIndexState,
85
+ columnGroupHeaderTabIndexState,
86
+ columnHeaderFocus,
87
+ columnGroupHeaderFocus,
88
+ densityFactor,
89
+ headerGroupingMaxDepth,
90
+ columnMenuState,
91
+ columnVisibility,
92
+ columnGroupsHeaderStructure,
93
+ hasOtherElementInTabSequence,
94
+ pinnedColumns
72
95
  } = props,
73
96
  other = _objectWithoutPropertiesLoose(props, _excluded);
74
97
  const rootProps = useGridRootProps();
75
98
  const apiRef = useGridApiContext();
76
- const visibleColumnFields = useGridSelector(apiRef, gridVisibleColumnFieldsSelector);
77
99
  const [scrollbarSize, setScrollbarSize] = React.useState(0);
78
100
  const theme = useTheme();
79
101
  const handleContentSizeChange = useEventCallback(() => {
@@ -87,7 +109,9 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
87
109
  }
88
110
  });
89
111
  useGridApiEventHandler(apiRef, 'virtualScrollerContentSizeChange', handleContentSizeChange);
90
- const pinnedColumns = useGridSelector(apiRef, gridPinnedColumnsSelector);
112
+ const visibleColumnFields = React.useMemo(() => visibleColumns.map(({
113
+ field
114
+ }) => field), [visibleColumns]);
91
115
  const [leftPinnedColumns, rightPinnedColumns] = filterColumns(pinnedColumns, visibleColumnFields, theme.direction === 'rtl');
92
116
  const {
93
117
  isDragging,
@@ -98,13 +122,27 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
98
122
  getColumnGroupHeaders
99
123
  } = useGridColumnHeaders({
100
124
  innerRef,
125
+ visibleColumns,
126
+ sortColumnLookup,
127
+ filterColumnLookup,
128
+ columnPositions,
129
+ columnHeaderTabIndexState,
130
+ hasOtherElementInTabSequence,
131
+ columnGroupHeaderTabIndexState,
132
+ columnHeaderFocus,
133
+ columnGroupHeaderFocus,
134
+ densityFactor,
135
+ headerGroupingMaxDepth,
136
+ columnMenuState,
137
+ columnVisibility,
138
+ columnGroupsHeaderStructure,
101
139
  minColumnIndex: leftPinnedColumns.length
102
140
  });
103
- const ownerState = {
141
+ const ownerState = _extends({}, rootProps, {
104
142
  leftPinnedColumns,
105
143
  rightPinnedColumns,
106
144
  classes: rootProps.classes
107
- };
145
+ });
108
146
  const classes = useUtilityClasses(ownerState);
109
147
  const leftRenderContext = renderContext && leftPinnedColumns.length ? _extends({}, renderContext, {
110
148
  firstColumnIndex: 0,
@@ -118,16 +156,16 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
118
156
  const pinnedColumnHeadersProps = {
119
157
  role: innerProps.role
120
158
  };
121
- return /*#__PURE__*/_jsxs(GridColumnHeaders, _extends({
159
+ return /*#__PURE__*/_jsxs(GridBaseColumnHeaders, _extends({
122
160
  ref: ref,
123
161
  className: className
124
162
  }, getRootProps(other), {
125
163
  children: [leftRenderContext && /*#__PURE__*/_jsxs(GridColumnHeadersPinnedColumnHeaders, _extends({
126
164
  className: classes.leftPinnedColumns,
127
- ownerState: {
165
+ ownerState: _extends({}, ownerState, {
128
166
  side: GridPinnedPosition.left,
129
167
  showCellVerticalBorder: rootProps.showCellVerticalBorder
130
- }
168
+ })
131
169
  }, pinnedColumnHeadersProps, {
132
170
  children: [getColumnGroupHeaders({
133
171
  renderContext: leftRenderContext,
@@ -153,10 +191,10 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
153
191
  maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
154
192
  })]
155
193
  })), rightRenderContext && /*#__PURE__*/_jsxs(GridColumnHeadersPinnedColumnHeaders, _extends({
156
- ownerState: {
194
+ ownerState: _extends({}, ownerState, {
157
195
  side: GridPinnedPosition.right,
158
196
  showCellVerticalBorder: rootProps.showCellVerticalBorder
159
- },
197
+ }),
160
198
  className: classes.rightPinnedColumns,
161
199
  style: {
162
200
  paddingRight: scrollbarSize
@@ -176,4 +214,49 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
176
214
  })]
177
215
  }))]
178
216
  }));
179
- });
217
+ });
218
+ process.env.NODE_ENV !== "production" ? GridColumnHeaders.propTypes = {
219
+ // ----------------------------- Warning --------------------------------
220
+ // | These PropTypes are generated from the TypeScript type definitions |
221
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
222
+ // ----------------------------------------------------------------------
223
+ columnGroupHeaderFocus: PropTypes.shape({
224
+ depth: PropTypes.number.isRequired,
225
+ field: PropTypes.string.isRequired
226
+ }),
227
+ columnGroupHeaderTabIndexState: PropTypes.shape({
228
+ depth: PropTypes.number.isRequired,
229
+ field: PropTypes.string.isRequired
230
+ }),
231
+ columnGroupsHeaderStructure: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.shape({
232
+ columnFields: PropTypes.arrayOf(PropTypes.string).isRequired,
233
+ groupId: PropTypes.string
234
+ }))).isRequired,
235
+ columnHeaderFocus: PropTypes.shape({
236
+ field: PropTypes.string.isRequired
237
+ }),
238
+ columnHeaderTabIndexState: PropTypes.shape({
239
+ field: PropTypes.string.isRequired
240
+ }),
241
+ columnMenuState: PropTypes.shape({
242
+ field: PropTypes.string,
243
+ open: PropTypes.bool.isRequired
244
+ }).isRequired,
245
+ columnPositions: PropTypes.arrayOf(PropTypes.number).isRequired,
246
+ columnVisibility: PropTypes.object.isRequired,
247
+ densityFactor: PropTypes.number.isRequired,
248
+ filterColumnLookup: PropTypes.object.isRequired,
249
+ hasOtherElementInTabSequence: PropTypes.bool.isRequired,
250
+ headerGroupingMaxDepth: PropTypes.number.isRequired,
251
+ innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
252
+ current: PropTypes.object
253
+ })]),
254
+ minColumnIndex: PropTypes.number,
255
+ pinnedColumns: PropTypes.shape({
256
+ left: PropTypes.arrayOf(PropTypes.string),
257
+ right: PropTypes.arrayOf(PropTypes.string)
258
+ }).isRequired,
259
+ sortColumnLookup: PropTypes.object.isRequired,
260
+ visibleColumns: PropTypes.arrayOf(PropTypes.object).isRequired
261
+ } : void 0;
262
+ export { GridColumnHeaders };
@@ -28,7 +28,7 @@ function GridColumnMenuPinningItem(props) {
28
28
  const pinToLeftMenuItem = /*#__PURE__*/_jsxs(MenuItem, {
29
29
  onClick: pinColumn(GridPinnedPosition.left),
30
30
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
31
- children: /*#__PURE__*/_jsx(rootProps.components.ColumnMenuPinLeftIcon, {
31
+ children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuPinLeftIcon, {
32
32
  fontSize: "small"
33
33
  })
34
34
  }), /*#__PURE__*/_jsx(ListItemText, {
@@ -38,7 +38,7 @@ function GridColumnMenuPinningItem(props) {
38
38
  const pinToRightMenuItem = /*#__PURE__*/_jsxs(MenuItem, {
39
39
  onClick: pinColumn(GridPinnedPosition.right),
40
40
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
41
- children: /*#__PURE__*/_jsx(rootProps.components.ColumnMenuPinRightIcon, {
41
+ children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuPinRightIcon, {
42
42
  fontSize: "small"
43
43
  })
44
44
  }), /*#__PURE__*/_jsx(ListItemText, {
@@ -52,7 +52,7 @@ function GridColumnMenuPinningItem(props) {
52
52
  if (side) {
53
53
  const otherSide = side === GridPinnedPosition.right ? GridPinnedPosition.left : GridPinnedPosition.right;
54
54
  const label = otherSide === GridPinnedPosition.right ? 'pinToRight' : 'pinToLeft';
55
- const Icon = side === GridPinnedPosition.right ? rootProps.components.ColumnMenuPinLeftIcon : rootProps.components.ColumnMenuPinRightIcon;
55
+ const Icon = side === GridPinnedPosition.right ? rootProps.slots.columnMenuPinLeftIcon : rootProps.slots.columnMenuPinRightIcon;
56
56
  return /*#__PURE__*/_jsxs(React.Fragment, {
57
57
  children: [/*#__PURE__*/_jsxs(MenuItem, {
58
58
  onClick: pinColumn(otherSide),
@@ -4,6 +4,7 @@ const _excluded = ["rowId", "height", "style"];
4
4
  import * as React from 'react';
5
5
  import Box from '@mui/material/Box';
6
6
  import { styled } from '@mui/material/styles';
7
+ import { useGridRootProps } from '@mui/x-data-grid';
7
8
  import { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
10
  const DetailPanel = styled(Box, {
@@ -28,6 +29,8 @@ function GridDetailPanel(props) {
28
29
  other = _objectWithoutPropertiesLoose(props, _excluded);
29
30
  const apiRef = useGridPrivateApiContext();
30
31
  const ref = React.useRef();
32
+ const rootProps = useGridRootProps();
33
+ const ownerState = rootProps;
31
34
  React.useLayoutEffect(() => {
32
35
  if (height === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
33
36
  // Fallback for IE
@@ -52,6 +55,7 @@ function GridDetailPanel(props) {
52
55
  });
53
56
  return /*#__PURE__*/_jsx(DetailPanel, _extends({
54
57
  ref: ref,
58
+ ownerState: ownerState,
55
59
  style: style
56
60
  }, other));
57
61
  }
@@ -31,14 +31,14 @@ function GridDetailPanelToggleCell(props) {
31
31
  const classes = useUtilityClasses(ownerState);
32
32
  const contentCache = useGridSelector(apiRef, gridDetailPanelExpandedRowsContentCacheSelector);
33
33
  const hasContent = /*#__PURE__*/React.isValidElement(contentCache[id]);
34
- const Icon = isExpanded ? rootProps.components.DetailPanelCollapseIcon : rootProps.components.DetailPanelExpandIcon;
35
- return /*#__PURE__*/_jsx(rootProps.components.BaseIconButton, _extends({
34
+ const Icon = isExpanded ? rootProps.slots.detailPanelCollapseIcon : rootProps.slots.detailPanelExpandIcon;
35
+ return /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
36
36
  size: "small",
37
37
  tabIndex: -1,
38
38
  disabled: !hasContent,
39
39
  className: classes.root,
40
40
  "aria-label": isExpanded ? apiRef.current.getLocaleText('collapseDetailPanel') : apiRef.current.getLocaleText('expandDetailPanel')
41
- }, rootProps.componentsProps?.baseIconButton, {
41
+ }, rootProps.slotProps?.baseIconButton, {
42
42
  children: /*#__PURE__*/_jsx(Icon, {
43
43
  fontSize: "inherit"
44
44
  })
@@ -62,7 +62,7 @@ function GridRowReorderCell(params) {
62
62
  className: classes.root,
63
63
  draggable: isDraggable
64
64
  }, draggableEventHandlers, {
65
- children: [/*#__PURE__*/_jsx(rootProps.components.RowReorderIcon, {}), /*#__PURE__*/_jsx("div", {
65
+ children: [/*#__PURE__*/_jsx(rootProps.slots.rowReorderIcon, {}), /*#__PURE__*/_jsx("div", {
66
66
  className: classes.placeholder,
67
67
  children: cellValue
68
68
  })]
@@ -35,7 +35,7 @@ function GridTreeDataGroupingCell(props) {
35
35
  const classes = useUtilityClasses(ownerState);
36
36
  const filteredDescendantCountLookup = useGridSelector(apiRef, gridFilteredDescendantCountLookupSelector);
37
37
  const filteredDescendantCount = filteredDescendantCountLookup[rowNode.id] ?? 0;
38
- const Icon = rowNode.childrenExpanded ? rootProps.components.TreeDataCollapseIcon : rootProps.components.TreeDataExpandIcon;
38
+ const Icon = rowNode.childrenExpanded ? rootProps.slots.treeDataCollapseIcon : rootProps.slots.treeDataExpandIcon;
39
39
  const handleClick = event => {
40
40
  apiRef.current.setRowChildrenExpansion(id, !rowNode.childrenExpanded);
41
41
  apiRef.current.setCellFocus(id, field);
@@ -49,12 +49,12 @@ function GridTreeDataGroupingCell(props) {
49
49
  },
50
50
  children: [/*#__PURE__*/_jsx("div", {
51
51
  className: classes.toggle,
52
- children: filteredDescendantCount > 0 && /*#__PURE__*/_jsx(rootProps.components.BaseIconButton, _extends({
52
+ children: filteredDescendantCount > 0 && /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
53
53
  size: "small",
54
54
  onClick: handleClick,
55
55
  tabIndex: -1,
56
56
  "aria-label": rowNode.childrenExpanded ? apiRef.current.getLocaleText('treeDataCollapse') : apiRef.current.getLocaleText('treeDataExpand')
57
- }, rootProps?.componentsProps?.baseIconButton, {
57
+ }, rootProps?.slotProps?.baseIconButton, {
58
58
  children: /*#__PURE__*/_jsx(Icon, {
59
59
  fontSize: "inherit"
60
60
  })
@@ -2,4 +2,4 @@
2
2
  export * from './GridTreeDataGroupingCell';
3
3
  export * from './GridColumnMenuPinningItem';
4
4
  export * from './GridDetailPanelToggleCell';
5
- export * from './icons';
5
+ export * from '../material/icons';
@@ -1,11 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from '@mui/x-data-grid/internals';
3
- import { GridPushPinRightIcon, GridPushPinLeftIcon } from '../components';
4
3
  import { GridProColumnMenu } from '../components/GridProColumnMenu';
5
- export const DEFAULT_GRID_PRO_ICON_SLOTS_COMPONENTS = {
6
- ColumnMenuPinRightIcon: GridPushPinRightIcon,
7
- ColumnMenuPinLeftIcon: GridPushPinLeftIcon
8
- };
9
- export const DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS = _extends({}, DATA_GRID_DEFAULT_SLOTS_COMPONENTS, DEFAULT_GRID_PRO_ICON_SLOTS_COMPONENTS, {
10
- ColumnMenu: GridProColumnMenu
4
+ import { GridColumnHeaders } from '../components/GridColumnHeaders';
5
+ import materialSlots from '../material';
6
+ export const DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS = _extends({}, DATA_GRID_DEFAULT_SLOTS_COMPONENTS, materialSlots, {
7
+ ColumnMenu: GridProColumnMenu,
8
+ ColumnHeaders: GridColumnHeaders
11
9
  });
@@ -21,9 +21,6 @@ function createPinnedRowsInternalCache(pinnedRows, getRowId) {
21
21
  return cache;
22
22
  }
23
23
  export const rowPinningStateInitializer = (state, props, apiRef) => {
24
- if (!props.experimentalFeatures?.rowPinning) {
25
- return state;
26
- }
27
24
  apiRef.current.caches.pinnedRows = createPinnedRowsInternalCache(props.pinnedRows, props.getRowId);
28
25
  return _extends({}, state, {
29
26
  rows: _extends({}, state.rows, {
@@ -38,12 +35,9 @@ export const rowPinningStateInitializer = (state, props, apiRef) => {
38
35
  };
39
36
  export const useGridRowPinning = (apiRef, props) => {
40
37
  const setPinnedRows = React.useCallback(newPinnedRows => {
41
- if (!props.experimentalFeatures?.rowPinning) {
42
- return;
43
- }
44
38
  apiRef.current.caches.pinnedRows = createPinnedRowsInternalCache(newPinnedRows, props.getRowId);
45
39
  apiRef.current.requestPipeProcessorsApplication('hydrateRows');
46
- }, [apiRef, props.experimentalFeatures?.rowPinning, props.getRowId]);
40
+ }, [apiRef, props.getRowId]);
47
41
  useGridApiMethod(apiRef, {
48
42
  unstable_setPinnedRows: setPinnedRows
49
43
  }, 'public');
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-pro v6.0.0-beta.4
2
+ * @mui/x-data-grid-pro v6.0.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -21,4 +21,5 @@ export * from './models';
21
21
  export * from './components';
22
22
  export * from './utils';
23
23
  export { useGridApiContext, useGridApiRef, useGridRootProps } from './typeOverloads/reexports';
24
- export { GridColumnMenu, GRID_COLUMN_MENU_COMPONENTS, GRID_COLUMN_MENU_COMPONENTS_PROPS } from './components/reexports';
24
+ export { GridColumnMenu, GRID_COLUMN_MENU_COMPONENTS, GRID_COLUMN_MENU_COMPONENTS_PROPS } from './components/reexports';
25
+ export { GridColumnHeaders } from './components/GridColumnHeaders';