@mui/x-data-grid-pro 6.5.0 → 6.7.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 (123) hide show
  1. package/CHANGELOG.md +150 -2
  2. package/DataGridPro/DataGridPro.js +10 -3
  3. package/README.md +2 -2
  4. package/components/DataGridProVirtualScroller.js +12 -12
  5. package/components/GridColumnHeaders.js +9 -3
  6. package/components/GridColumnMenuPinningItem.d.ts +2 -2
  7. package/components/GridDetailPanel.d.ts +1 -1
  8. package/components/GridDetailPanelToggleCell.d.ts +2 -2
  9. package/components/GridRowReorderCell.d.ts +3 -3
  10. package/components/GridScrollArea.d.ts +10 -0
  11. package/components/GridScrollArea.js +140 -0
  12. package/components/GridTreeDataGroupingCell.d.ts +2 -2
  13. package/components/headerFiltering/GridHeaderFilterCell.d.ts +0 -1
  14. package/components/headerFiltering/GridHeaderFilterCell.js +36 -23
  15. package/components/headerFiltering/GridHeaderFilterClearButton.d.ts +2 -2
  16. package/components/headerFiltering/GridHeaderFilterClearButton.js +1 -1
  17. package/components/headerFiltering/GridHeaderFilterMenu.d.ts +5 -2
  18. package/components/headerFiltering/GridHeaderFilterMenu.js +36 -15
  19. package/components/headerFiltering/{GridHeaderFilterAdornment.d.ts → GridHeaderFilterMenuContainer.d.ts} +4 -4
  20. package/{modern/components/headerFiltering/GridHeaderFilterAdornment.js → components/headerFiltering/GridHeaderFilterMenuContainer.js} +23 -24
  21. package/components/headerFiltering/index.d.ts +2 -1
  22. package/components/headerFiltering/index.js +3 -2
  23. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +3 -3
  24. package/hooks/features/columnHeaders/useGridColumnHeaders.js +16 -8
  25. package/hooks/features/columnResize/useGridColumnResize.js +11 -12
  26. package/hooks/features/detailPanel/useGridDetailPanel.js +4 -6
  27. package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -2
  28. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -6
  29. package/hooks/features/treeData/gridTreeDataUtils.js +0 -8
  30. package/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -0
  31. package/index.js +1 -1
  32. package/internals/index.d.ts +1 -1
  33. package/internals/index.js +1 -1
  34. package/legacy/DataGridPro/DataGridPro.js +10 -3
  35. package/legacy/components/DataGridProVirtualScroller.js +12 -12
  36. package/legacy/components/GridColumnHeaders.js +9 -3
  37. package/legacy/components/GridScrollArea.js +143 -0
  38. package/legacy/components/headerFiltering/GridHeaderFilterCell.js +39 -27
  39. package/legacy/components/headerFiltering/GridHeaderFilterClearButton.js +1 -1
  40. package/legacy/components/headerFiltering/GridHeaderFilterMenu.js +36 -15
  41. package/legacy/components/headerFiltering/{GridHeaderFilterAdornment.js → GridHeaderFilterMenuContainer.js} +23 -25
  42. package/legacy/components/headerFiltering/index.js +3 -2
  43. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +14 -8
  44. package/legacy/hooks/features/columnResize/useGridColumnResize.js +11 -12
  45. package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +4 -6
  46. package/legacy/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -2
  47. package/legacy/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -6
  48. package/legacy/hooks/features/treeData/gridTreeDataUtils.js +0 -8
  49. package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -0
  50. package/legacy/index.js +1 -1
  51. package/legacy/internals/index.js +1 -1
  52. package/legacy/material/icons.js +1 -4
  53. package/legacy/material/index.js +2 -3
  54. package/legacy/utils/releaseInfo.js +1 -1
  55. package/legacy/utils/tree/insertDataRowInTree.js +8 -24
  56. package/legacy/utils/tree/sortRowTree.js +78 -18
  57. package/legacy/utils/tree/utils.js +55 -37
  58. package/material/icons.d.ts +0 -3
  59. package/material/icons.js +1 -4
  60. package/material/index.d.ts +0 -1
  61. package/material/index.js +2 -3
  62. package/models/gridProIconSlotsComponent.d.ts +0 -5
  63. package/modern/DataGridPro/DataGridPro.js +10 -3
  64. package/modern/components/DataGridProVirtualScroller.js +12 -12
  65. package/modern/components/GridColumnHeaders.js +9 -3
  66. package/modern/components/GridScrollArea.js +140 -0
  67. package/modern/components/headerFiltering/GridHeaderFilterCell.js +36 -23
  68. package/modern/components/headerFiltering/GridHeaderFilterClearButton.js +1 -1
  69. package/modern/components/headerFiltering/GridHeaderFilterMenu.js +36 -15
  70. package/{components/headerFiltering/GridHeaderFilterAdornment.js → modern/components/headerFiltering/GridHeaderFilterMenuContainer.js} +22 -25
  71. package/modern/components/headerFiltering/index.js +3 -2
  72. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +16 -8
  73. package/modern/hooks/features/columnResize/useGridColumnResize.js +11 -12
  74. package/modern/hooks/features/detailPanel/useGridDetailPanel.js +4 -6
  75. package/modern/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -2
  76. package/modern/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -6
  77. package/modern/hooks/features/treeData/gridTreeDataUtils.js +0 -8
  78. package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -0
  79. package/modern/index.js +1 -1
  80. package/modern/internals/index.js +1 -1
  81. package/modern/material/icons.js +1 -4
  82. package/modern/material/index.js +2 -3
  83. package/modern/utils/releaseInfo.js +1 -1
  84. package/modern/utils/tree/insertDataRowInTree.js +8 -24
  85. package/modern/utils/tree/sortRowTree.js +64 -18
  86. package/modern/utils/tree/utils.js +43 -26
  87. package/node/DataGridPro/DataGridPro.js +10 -3
  88. package/node/components/DataGridProVirtualScroller.js +12 -12
  89. package/node/components/GridColumnHeaders.js +8 -3
  90. package/node/components/GridScrollArea.js +149 -0
  91. package/node/components/headerFiltering/GridHeaderFilterCell.js +36 -23
  92. package/node/components/headerFiltering/GridHeaderFilterClearButton.js +1 -1
  93. package/node/components/headerFiltering/GridHeaderFilterMenu.js +36 -14
  94. package/node/components/headerFiltering/{GridHeaderFilterAdornment.js → GridHeaderFilterMenuContainer.js} +22 -24
  95. package/node/components/headerFiltering/index.js +15 -4
  96. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +15 -7
  97. package/node/hooks/features/columnResize/useGridColumnResize.js +11 -12
  98. package/node/hooks/features/detailPanel/useGridDetailPanel.js +4 -6
  99. package/node/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -2
  100. package/node/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -6
  101. package/node/hooks/features/treeData/gridTreeDataUtils.js +0 -8
  102. package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -0
  103. package/node/index.js +1 -1
  104. package/node/internals/index.js +8 -1
  105. package/node/material/icons.js +2 -6
  106. package/node/material/index.js +1 -2
  107. package/node/utils/releaseInfo.js +1 -1
  108. package/node/utils/tree/insertDataRowInTree.js +7 -23
  109. package/node/utils/tree/sortRowTree.js +64 -18
  110. package/node/utils/tree/utils.js +46 -28
  111. package/package.json +6 -6
  112. package/themeAugmentation/overrides.d.ts +1 -1
  113. package/typeOverloads/modules.d.ts +6 -6
  114. package/utils/releaseInfo.js +1 -1
  115. package/utils/tree/insertDataRowInTree.js +8 -24
  116. package/utils/tree/sortRowTree.js +64 -18
  117. package/utils/tree/utils.d.ts +7 -38
  118. package/utils/tree/utils.js +43 -26
  119. package/components/headerFiltering/constants.d.ts +0 -3
  120. package/components/headerFiltering/constants.js +0 -30
  121. package/legacy/components/headerFiltering/constants.js +0 -30
  122. package/modern/components/headerFiltering/constants.js +0 -30
  123. package/node/components/headerFiltering/constants.js +0 -37
package/CHANGELOG.md CHANGED
@@ -3,6 +3,154 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 6.7.0
7
+
8
+ _Jun 9, 2023_
9
+
10
+ We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Improve the default `format` prop value on the pickers.
13
+
14
+ Here are a few examples:
15
+
16
+ ```tsx
17
+ <TimePicker views={['hours', 'minutes', 'seconds']} ampm />
18
+ // Format before v6.7.0: `hh:mm aa`
19
+ // Format after v6.7.0: `hh:mm:ss aa`
20
+
21
+ <DatePicker views={['year']} />
22
+ // Format before v6.7.0: `MM/DD/YYYY`
23
+ // Format after v6.7.0: `YYYY`
24
+
25
+ <DateTimePicker views={['day', 'hours', 'minutes']} ampm />
26
+ // Format before v6.7.0: `MM/DD/YYYY hh:mm aa`
27
+ // Format after v6.7.0: `DD hh:mm aa`
28
+ ```
29
+
30
+ - 🌍 Add Romanian (ro-RO) locale on the pickers
31
+ - 🌍 Improve German (de-DE) locale on the pickers
32
+ - 🌍 Improve Czech (cs-CZ), German (de-DE) and Turkish (tr-TR) locales on the data grid
33
+ - 🚀 Performance improvements
34
+ - 🐞 Bugfixes
35
+ - 📚 Documentation improvements
36
+
37
+ ### `@mui/x-data-grid@v6.7.0` / `@mui/x-data-grid-pro@v6.7.0` / `@mui/x-data-grid-premium@v6.7.0`
38
+
39
+ #### Changes
40
+
41
+ - [DataGrid] Allow overflowing grid root element (#9179) @cherniavskii
42
+ - [DataGrid] Fix module augmentation error when using `@mui/lab` (#9235) @cherniavskii
43
+ - [DataGrid] Fix row with ids matching `Object` prototype (#9265) @romgrk
44
+ - [DataGrid] Fix `sortModel` and `filterModel` resetting when columns change (#9239) @alexgonch
45
+ - [DataGrid] Improve grouping performance for large datasets (#9200) @romgrk
46
+ - [DataGrid] Increase threshold to trigger memory leak warning (#9263) @m4theushw
47
+ - [DataGrid] Update data grid migration guide to include updated type (#9272) @MBilalShafi
48
+ - [DataGridPro] Improve header filter menu visuals (#9181) @MBilalShafi
49
+ - [DataGridPremium] Remove last line break on clipboard paste (#9163) @cherniavskii
50
+ - [l10n] Improve Czech (cs-CZ) locale (#9266) @MartinSkarpa
51
+ - [l10n] Improve German (de-DE) locale (#9259) @ximex
52
+ - [l10n] Improve Turkish (tr-TR) locale (#9237) @MCErtan
53
+
54
+ ### `@mui/x-date-pickers@v6.7.0` / `@mui/x-date-pickers-pro@v6.7.0`
55
+
56
+ #### Changes
57
+
58
+ - [l10n] Add Romanian (ro-RO) locale (#9257) @ximex
59
+ - [l10n] Improve German (de-DE) locale (#9258) @ximex
60
+ - [pickers] Apply dynamic default format depending on views for all desktop and mobile pickers (#9126) @flaviendelangle
61
+ - [pickers] Update `DateRangePickerDay` props JSDoc (#9191) @stevus
62
+
63
+ ### Docs
64
+
65
+ - [docs] Fix missing props on the `GridFilterPanel` API page (#9180) @cherniavskii
66
+ - [docs] Fix overview page typo (#9230) @LukasTy
67
+ - [docs] Fix version redirect (#9273) @alexfauquette
68
+
69
+ ### Core
70
+
71
+ - [core] Temporarily remove the Argos upload on the regression testing (#9267) @flaviendelangle
72
+ - [charts] Add clip-path to avoid charts overflow (#9012) @alexfauquette
73
+ - [charts] Add style customization on bar (#8935) @alexfauquette
74
+ - [charts] Enforce axis `min`/`max` over the `nice()` method (#9189) @alexfauquette
75
+ - [charts] Improve axis label and ticks label alignements (#9190) @alexfauquette
76
+ - [charts] Simplify the switch between responsive and fix dimensions (#9151) @alexfauquette
77
+
78
+ ## 6.6.0
79
+
80
+ _Jun 1, 2023_
81
+
82
+ We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
83
+
84
+ - 🚀 New date time picking UI on [`DesktopDateTimePicker`](https://mui.com/x/react-date-pickers/date-time-picker/)
85
+
86
+ <img src="https://user-images.githubusercontent.com/4941090/242533399-2b106390-8158-4aba-9ca4-b621c6310977.gif" width="628" />
87
+
88
+ - 🚀 Performance improvements
89
+ - 🐞 Bugfixes
90
+ - 📚 Documentation improvements
91
+ - 🌍 Improve Dutch (nl-NL) and French (fr-FR) locales on the data grid
92
+ - 🌍 Add Vietnamese (vi-VN) locale on the pickers
93
+
94
+ ### `@mui/x-data-grid@v6.6.0` / `@mui/x-data-grid-pro@v6.6.0` / `@mui/x-data-grid-premium@v6.6.0`
95
+
96
+ #### Changes
97
+
98
+ - [DataGrid] Support data attributes (#8845) @romgrk
99
+ - [DataGrid] Avoid allocations in `hydrateRowsMeta` (#9121) @romgrk
100
+ - [DataGrid] Fix filter input select accessibility (#9018) @Jul13nT
101
+ - [DataGrid] Fix accessibility issues in panels and toolbar buttons (#8862) @romgrk
102
+ - [DataGrid] Fix `onCellEditStop` not invoked (#8857) @romgrk
103
+ - [DataGridPro] Fix auto-scroll when reordering columns (#8856) @m4theushw
104
+ - [DataGridPro] Fix row ID type casting in detail panels lookup (#8976) @minchaej
105
+ - [DataGridPro] Emit `columnWidthChange` event on `touchEnd` of column resize (#8669) @MBilalShafi
106
+ - [DataGridPro] Do not apply filters on `rowExpansionChange` (#8671) @cherniavskii
107
+ - [DataGridPro] Prevent click event on sorting after a resize (#9117) @romgrk
108
+ - [DataGridPremium] Improve Excel export interface (#9128) @TiagoPortfolio
109
+ - [l10n] Improve Dutch (nl-NL) locale (#9043) @thedutchruben
110
+ - [l10n] Improve French (fr-FR) locale (#9109) @Jul13nT
111
+
112
+ ### `@mui/x-date-pickers@v6.6.0` / `@mui/x-date-pickers-pro@v6.6.0`
113
+
114
+ #### Changes
115
+
116
+ - [fields] Allow to explicitly define the reference value and improve its default value (#9019) @flaviendelangle
117
+ - [l10n] Add Vietnamese (vi-VN) locale (#9099) @nhannt201
118
+ - [pickers] Add `DigitalClock` to `DesktopDateTimePicker` (#8946) @LukasTy
119
+ - [pickers] Add support for timezones on the adapters (#9068) @flaviendelangle
120
+ - [pickers] Fix `MonthCalendar` and `YearCalendar` disabled validation (#9149) @LukasTy
121
+ - [pickers] Fix bug when fields have a unique section (#9110) @alexfauquette
122
+ - [pickers] Fix focus jumping on Safari (#9072) @LukasTy
123
+ - [pickers] Use the locale start of the week in `getWeekArray` (#9176) @flaviendelangle
124
+
125
+ ### Docs
126
+
127
+ - [docs] Add single input range picker demo (#9159) @LukasTy
128
+ - [docs] Align `DateCalendar` demo views with labels (#9152) @LukasTy
129
+ - [docs] Clarify the peer dependency with React (#9067) @oliviertassinari
130
+ - [docs] Fix Norwegian locale typo (#9168) @LukasTy
131
+ - [docs] Fix column menu item demo (#9071) @MBilalShafi
132
+ - [docs] Improve localization table progress bars (#9033) @noraleonte
133
+ - [docs] Smooth performance animation (#8986) @oliviertassinari
134
+ - [docs] Use responsive time and date time pickers and the views sections (#9127) @flaviendelangle
135
+ - [docs] Reduce layout shift in grid demo (#9132) @oliviertassinari
136
+ - [docs] Fix tree data children lazy-loading demo (#8840) @yaredtsy
137
+ - [docs] Improve filtering docs discoverability (#9074) @MBilalShafi
138
+
139
+ ### Core
140
+
141
+ - [core] Allow string literals as keys in `localesText` (#9045) @MBilalShafi
142
+ - [core] Fix `randomInt` producing values exceeding `max` value (#9086) @cherniavskii
143
+ - [core] Fix flaky test on `dateWithTimezone` adapter test (#9129) @flaviendelangle
144
+ - [core] Lock `@types/node` on v18 (#9107) @LukasTy
145
+ - [core] Remove `cross-fetch` dependency (#9108) @LukasTy
146
+ - [core] Remove `createDetectElementResize()` replaced with `ResizeObserver` (#9015) @oliviertassinari
147
+ - [core] Upgrade monorepo (#9027) @m4theushw
148
+ - [core] Upgrade monorepo (#9106) @LukasTy
149
+ - [charts] Fix proptypes (#9125) @LukasTy
150
+ - [charts] Generate the charts proptypes (#9010) @alexfauquette
151
+ - [charts] Manage series stacking (#8888) @alexfauquette
152
+ - [license] List side effects in the license package (#9092) @cherniavskii
153
+
6
154
  ## v6.5.0
7
155
 
8
156
  _May 19, 2023_
@@ -102,7 +250,7 @@ We'd like to offer a big thanks to the 12 contributors who made this release pos
102
250
 
103
251
  ### Docs
104
252
 
105
- - [docs] Fix date pickers typo in the docs (#8939) @richbustos
253
+ - [docs] Fix date pickers typo in the docs (#8939) @richbustos
106
254
  - [docs] Fix master detail demo (#8894) @m4theushw
107
255
  - [docs] Fix typo in clipboard docs (#8971) @MBilalShafi
108
256
  - [docs] Reduce list of dependencies in Codesandbox/Stackblitz demos (#8535) @cherniavskii
@@ -4440,7 +4588,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
4440
4588
 
4441
4589
  - 👔 **Excel export**. You can find this new Premium feature at: https://mui.com/x/react-data-grid/export/#excel-export.
4442
4590
 
4443
- - 🔎 **Quick filtering**. You can now add a quick filtering search bar to your grid. To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar. More information about how to customize the filtering logic is in the [documentation](https://mui.com/x/react-data-grid/filtering/#quick-filter).
4591
+ - 🔎 **Quick filtering**. You can now add a quick filtering search bar to your grid. To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar. More information about how to customize the filtering logic is in the [documentation](https://mui.com/x/react-data-grid/filtering/quick-filter/).
4444
4592
 
4445
4593
  <img src="https://user-images.githubusercontent.com/13808724/167700105-5a5acc7c-5463-4871-8514-3d09e2f365ae.png" width="724">
4446
4594
 
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import * as React from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import { useLicenseVerifier, Watermark } from '@mui/x-license-pro';
@@ -19,11 +20,12 @@ const DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProp
19
20
  return /*#__PURE__*/_jsx(GridContextProvider, {
20
21
  privateApiRef: privateApiRef,
21
22
  props: props,
22
- children: /*#__PURE__*/_jsxs(GridRoot, {
23
+ children: /*#__PURE__*/_jsxs(GridRoot, _extends({
23
24
  className: props.className,
24
25
  style: props.style,
25
26
  sx: props.sx,
26
- ref: ref,
27
+ ref: ref
28
+ }, props.forwardedProps, {
27
29
  children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {
28
30
  VirtualScrollerComponent: DataGridProVirtualScroller,
29
31
  ColumnHeadersProps: {
@@ -34,7 +36,7 @@ const DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProp
34
36
  releaseInfo: releaseInfo
35
37
  })
36
38
  }), /*#__PURE__*/_jsx(GridFooterPlaceholder, {})]
37
- })
39
+ }))
38
40
  });
39
41
  });
40
42
  export const DataGridPro = /*#__PURE__*/React.memo(DataGridProRaw);
@@ -255,6 +257,11 @@ DataGridProRaw.propTypes = {
255
257
  quickFilterLogicOperator: PropTypes.oneOf(['and', 'or']),
256
258
  quickFilterValues: PropTypes.array
257
259
  }),
260
+ /**
261
+ * Forwarded props for the grid root element.
262
+ * @ignore - do not document.
263
+ */
264
+ forwardedProps: PropTypes.object,
258
265
  /**
259
266
  * Function that applies CSS classes dynamically on cells.
260
267
  * @param {GridCellParams} params With all properties from [[GridCellParams]].
package/README.md CHANGED
@@ -21,8 +21,8 @@ This component has the following peer dependencies that you will need to install
21
21
  "peerDependencies": {
22
22
  "@mui/material": "^5.4.1",
23
23
  "@mui/system": "^5.4.1",
24
- "react": "^17.0.2 || ^18.0.0",
25
- "react-dom": "^17.0.2 || ^18.0.0"
24
+ "react": "^17.0.0 || ^18.0.0",
25
+ "react-dom": "^17.0.0 || ^18.0.0"
26
26
  },
27
27
  ```
28
28
 
@@ -179,8 +179,17 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
179
179
  bottomPinnedRowsRenderZoneRef.current.style.transform = `translate3d(${left}px, 0px, 0px)`;
180
180
  }
181
181
  }, []);
182
+
183
+ // Create a lookup for faster check if the row is expanded
184
+ const expandedRowIdsLookup = React.useMemo(() => {
185
+ const lookup = new Set();
186
+ expandedRowIds.forEach(id => {
187
+ lookup.add(id);
188
+ });
189
+ return lookup;
190
+ }, [expandedRowIds]);
182
191
  const getRowProps = React.useCallback(id => {
183
- if (!expandedRowIds.includes(id)) {
192
+ if (!expandedRowIdsLookup.has(id)) {
184
193
  return null;
185
194
  }
186
195
  const height = detailPanelsHeights[id];
@@ -189,7 +198,7 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
189
198
  marginBottom: height
190
199
  }
191
200
  };
192
- }, [detailPanelsHeights, expandedRowIds]);
201
+ }, [detailPanelsHeights, expandedRowIdsLookup]);
193
202
  const pinnedColumns = useGridSelector(apiRef, gridPinnedColumnsSelector);
194
203
  const [leftPinnedColumns, rightPinnedColumns] = filterColumns(pinnedColumns, visibleColumnFields, theme.direction === 'rtl');
195
204
  const pinnedRows = useGridSelector(apiRef, gridPinnedRowsSelector);
@@ -229,15 +238,6 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
229
238
  firstColumnIndex: visibleColumnFields.length - rightPinnedColumns.length,
230
239
  lastColumnIndex: visibleColumnFields.length
231
240
  }) : null;
232
-
233
- // Create a lookup for faster check if the row is expanded
234
- const expandedRowIdsLookup = React.useMemo(() => {
235
- const lookup = {};
236
- expandedRowIds.forEach(id => {
237
- lookup[id] = true;
238
- });
239
- return lookup;
240
- }, [expandedRowIds]);
241
241
  const getDetailPanel = rowId => {
242
242
  const rowsMeta = gridRowsMetaSelector(apiRef.current.state);
243
243
  const content = detailPanelsContent[rowId];
@@ -278,7 +278,7 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
278
278
  if (rootProps.getDetailPanelContent == null) {
279
279
  return;
280
280
  }
281
- if (!expandedRowIdsLookup[rowId]) {
281
+ if (!expandedRowIdsLookup.has(rowId)) {
282
282
  return;
283
283
  }
284
284
  const detailPanel = getDetailPanel(rowId);
@@ -10,9 +10,11 @@ import { GridBaseColumnHeaders, GridColumnHeadersInner } from '@mui/x-data-grid/
10
10
  import { useGridRootProps } from '../hooks/utils/useGridRootProps';
11
11
  import { useGridApiContext } from '../hooks/utils/useGridApiContext';
12
12
  import { GridPinnedPosition } from '../hooks/features/columnPinning';
13
- import { filterColumns } from './DataGridProVirtualScroller';
14
13
  import { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
14
+ import { filterColumns } from './DataGridProVirtualScroller';
15
+ import { GridScrollArea } from './GridScrollArea';
15
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
17
+ import { jsx as _jsx } from "react/jsx-runtime";
16
18
  const useUtilityClasses = ownerState => {
17
19
  const {
18
20
  leftPinnedColumns,
@@ -187,7 +189,9 @@ const GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnHeade
187
189
  minFirstColumn: leftRenderContext.firstColumnIndex,
188
190
  maxLastColumn: leftRenderContext.lastColumnIndex
189
191
  })]
190
- })), /*#__PURE__*/_jsxs(GridColumnHeadersInner, _extends({
192
+ })), /*#__PURE__*/_jsx(GridScrollArea, {
193
+ scrollDirection: "left"
194
+ }), /*#__PURE__*/_jsxs(GridColumnHeadersInner, _extends({
191
195
  isDragging: isDragging
192
196
  }, innerProps, {
193
197
  children: [getColumnGroupHeaders({
@@ -203,7 +207,9 @@ const GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnHeade
203
207
  minFirstColumn: leftPinnedColumns.length,
204
208
  maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
205
209
  })]
206
- })), rightRenderContext && /*#__PURE__*/_jsxs(GridColumnHeadersPinnedColumnHeaders, _extends({
210
+ })), /*#__PURE__*/_jsx(GridScrollArea, {
211
+ scrollDirection: "right"
212
+ }), rightRenderContext && /*#__PURE__*/_jsxs(GridColumnHeadersPinnedColumnHeaders, _extends({
207
213
  ownerState: _extends({}, ownerState, {
208
214
  side: GridPinnedPosition.right,
209
215
  showCellVerticalBorder: rootProps.showCellVerticalBorder
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { GridColumnMenuItemProps } from '@mui/x-data-grid';
3
- declare function GridColumnMenuPinningItem(props: GridColumnMenuItemProps): JSX.Element | null;
3
+ declare function GridColumnMenuPinningItem(props: GridColumnMenuItemProps): React.JSX.Element | null;
4
4
  declare namespace GridColumnMenuPinningItem {
5
5
  var propTypes: any;
6
6
  }
@@ -15,5 +15,5 @@ interface GridDetailPanelProps extends React.HTMLAttributes<HTMLDivElement> {
15
15
  */
16
16
  rowId: GridRowId;
17
17
  }
18
- declare function GridDetailPanel(props: GridDetailPanelProps): JSX.Element;
18
+ declare function GridDetailPanel(props: GridDetailPanelProps): React.JSX.Element;
19
19
  export { GridDetailPanel };
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { GridRenderCellParams } from '@mui/x-data-grid';
3
- declare function GridDetailPanelToggleCell(props: GridRenderCellParams): JSX.Element;
3
+ declare function GridDetailPanelToggleCell(props: GridRenderCellParams): React.JSX.Element;
4
4
  declare namespace GridDetailPanelToggleCell {
5
5
  var propTypes: any;
6
6
  }
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { GridRenderCellParams } from '@mui/x-data-grid';
3
- declare function GridRowReorderCell(params: GridRenderCellParams): JSX.Element | null;
3
+ declare function GridRowReorderCell(params: GridRenderCellParams): React.JSX.Element | null;
4
4
  export { GridRowReorderCell };
5
- export declare const renderRowReorderCell: (params: GridRenderCellParams) => JSX.Element | null;
5
+ export declare const renderRowReorderCell: (params: GridRenderCellParams) => React.JSX.Element | null;
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ interface ScrollAreaProps {
3
+ scrollDirection: 'left' | 'right';
4
+ }
5
+ declare function GridScrollAreaRaw(props: ScrollAreaProps): React.JSX.Element | null;
6
+ declare namespace GridScrollAreaRaw {
7
+ var propTypes: any;
8
+ }
9
+ declare const GridScrollArea: React.MemoExoticComponent<typeof GridScrollAreaRaw>;
10
+ export { GridScrollArea };
@@ -0,0 +1,140 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import clsx from 'clsx';
5
+ import { unstable_composeClasses as composeClasses, unstable_useEventCallback as useEventCallback } from '@mui/utils';
6
+ import { styled } from '@mui/system';
7
+ import { getTotalHeaderHeight } from '@mui/x-data-grid/internals';
8
+ import { getDataGridUtilityClass, gridClasses, gridDensityFactorSelector, useGridApiContext, useGridApiEventHandler, useGridSelector, gridColumnsTotalWidthSelector } from '@mui/x-data-grid';
9
+ import { useGridRootProps } from '../hooks/utils/useGridRootProps';
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ const CLIFF = 1;
12
+ const SLOP = 1.5;
13
+ const useUtilityClasses = ownerState => {
14
+ const {
15
+ scrollDirection,
16
+ classes
17
+ } = ownerState;
18
+ const slots = {
19
+ root: ['scrollArea', `scrollArea--${scrollDirection}`]
20
+ };
21
+ return composeClasses(slots, getDataGridUtilityClass, classes);
22
+ };
23
+ const GridScrollAreaRawRoot = styled('div', {
24
+ name: 'MuiDataGrid',
25
+ slot: 'ScrollArea',
26
+ overridesResolver: (props, styles) => [{
27
+ [`&.${gridClasses['scrollArea--left']}`]: styles['scrollArea--left']
28
+ }, {
29
+ [`&.${gridClasses['scrollArea--right']}`]: styles['scrollArea--right']
30
+ }, styles.scrollArea]
31
+ })(() => ({
32
+ position: 'absolute',
33
+ top: 0,
34
+ zIndex: 101,
35
+ width: 20,
36
+ bottom: 0,
37
+ [`&.${gridClasses['scrollArea--left']}`]: {
38
+ left: 0
39
+ },
40
+ [`&.${gridClasses['scrollArea--right']}`]: {
41
+ right: 0
42
+ }
43
+ }));
44
+ function GridScrollAreaRaw(props) {
45
+ const {
46
+ scrollDirection
47
+ } = props;
48
+ const rootRef = React.useRef(null);
49
+ const apiRef = useGridApiContext();
50
+ const timeout = React.useRef();
51
+ const [dragging, setDragging] = React.useState(false);
52
+ const [canScrollMore, setCanScrollMore] = React.useState(true);
53
+ const densityFactor = useGridSelector(apiRef, gridDensityFactorSelector);
54
+ const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
55
+ const scrollPosition = React.useRef({
56
+ left: 0,
57
+ top: 0
58
+ });
59
+ const rootProps = useGridRootProps();
60
+ const ownerState = _extends({}, rootProps, {
61
+ scrollDirection
62
+ });
63
+ const classes = useUtilityClasses(ownerState);
64
+ const totalHeaderHeight = getTotalHeaderHeight(apiRef, rootProps.columnHeaderHeight);
65
+ const headerHeight = Math.floor(rootProps.columnHeaderHeight * densityFactor);
66
+ const handleScrolling = React.useCallback(newScrollPosition => {
67
+ scrollPosition.current = newScrollPosition;
68
+ const dimensions = apiRef.current.getRootDimensions();
69
+ setCanScrollMore(() => {
70
+ if (scrollDirection === 'left') {
71
+ // Only render if the user has not reached yet the start of the list
72
+ return scrollPosition.current.left > 0;
73
+ }
74
+ if (scrollDirection === 'right') {
75
+ // Only render if the user has not reached yet the end of the list
76
+ const maxScrollLeft = columnsTotalWidth - dimensions.viewportInnerSize.width;
77
+ return scrollPosition.current.left < maxScrollLeft;
78
+ }
79
+ return false;
80
+ });
81
+ }, [apiRef, columnsTotalWidth, scrollDirection]);
82
+ const handleDragOver = React.useCallback(event => {
83
+ let offset;
84
+
85
+ // Prevents showing the forbidden cursor
86
+ event.preventDefault();
87
+ if (scrollDirection === 'left') {
88
+ offset = event.clientX - rootRef.current.getBoundingClientRect().right;
89
+ } else if (scrollDirection === 'right') {
90
+ offset = Math.max(1, event.clientX - rootRef.current.getBoundingClientRect().left);
91
+ } else {
92
+ throw new Error('MUI: Wrong drag direction');
93
+ }
94
+ offset = (offset - CLIFF) * SLOP + CLIFF;
95
+ clearTimeout(timeout.current);
96
+ // Avoid freeze and inertia.
97
+ timeout.current = setTimeout(() => {
98
+ apiRef.current.scroll({
99
+ left: scrollPosition.current.left + offset,
100
+ top: scrollPosition.current.top
101
+ });
102
+ });
103
+ }, [scrollDirection, apiRef]);
104
+ React.useEffect(() => {
105
+ return () => {
106
+ clearTimeout(timeout.current);
107
+ };
108
+ }, []);
109
+ const handleColumnHeaderDragStart = useEventCallback(() => {
110
+ setDragging(true);
111
+ });
112
+ const handleColumnHeaderDragEnd = useEventCallback(() => {
113
+ setDragging(false);
114
+ });
115
+ useGridApiEventHandler(apiRef, 'scrollPositionChange', handleScrolling);
116
+ useGridApiEventHandler(apiRef, 'columnHeaderDragStart', handleColumnHeaderDragStart);
117
+ useGridApiEventHandler(apiRef, 'columnHeaderDragEnd', handleColumnHeaderDragEnd);
118
+ if (!dragging || !canScrollMore) {
119
+ return null;
120
+ }
121
+ return /*#__PURE__*/_jsx(GridScrollAreaRawRoot, {
122
+ ref: rootRef,
123
+ className: clsx(classes.root),
124
+ ownerState: ownerState,
125
+ onDragOver: handleDragOver,
126
+ style: {
127
+ height: headerHeight,
128
+ top: totalHeaderHeight - headerHeight
129
+ }
130
+ });
131
+ }
132
+ process.env.NODE_ENV !== "production" ? GridScrollAreaRaw.propTypes = {
133
+ // ----------------------------- Warning --------------------------------
134
+ // | These PropTypes are generated from the TypeScript type definitions |
135
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
136
+ // ----------------------------------------------------------------------
137
+ scrollDirection: PropTypes.oneOf(['left', 'right']).isRequired
138
+ } : void 0;
139
+ const GridScrollArea = /*#__PURE__*/React.memo(GridScrollAreaRaw);
140
+ export { GridScrollArea };
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { GridRenderCellParams, GridGroupNode } from '@mui/x-data-grid';
3
3
  interface GridTreeDataGroupingCellProps extends GridRenderCellParams<any, any, any, GridGroupNode> {
4
4
  hideDescendantCount?: boolean;
@@ -8,7 +8,7 @@ interface GridTreeDataGroupingCellProps extends GridRenderCellParams<any, any, a
8
8
  */
9
9
  offsetMultiplier?: number;
10
10
  }
11
- declare function GridTreeDataGroupingCell(props: GridTreeDataGroupingCellProps): JSX.Element;
11
+ declare function GridTreeDataGroupingCell(props: GridTreeDataGroupingCellProps): React.JSX.Element;
12
12
  declare namespace GridTreeDataGroupingCell {
13
13
  var propTypes: any;
14
14
  }
@@ -7,7 +7,6 @@ export interface GridHeaderFilterCellProps extends Pick<GridStateColDef, 'header
7
7
  sortIndex?: number;
8
8
  hasFocus?: boolean;
9
9
  tabIndex: 0 | -1;
10
- headerFilterComponent?: React.ReactNode;
11
10
  filterOperators?: GridFilterOperator[];
12
11
  width: number;
13
12
  colDef: GridColDef;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["colIndex", "height", "hasFocus", "headerFilterComponent", "filterOperators", "width", "headerClassName", "colDef", "item", "headerFilterMenuRef", "InputComponentProps", "showClearIcon"];
3
+ const _excluded = ["colIndex", "height", "hasFocus", "filterOperators", "width", "headerClassName", "colDef", "item", "headerFilterMenuRef", "InputComponentProps", "showClearIcon"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
@@ -8,7 +8,7 @@ import { unstable_useForkRef as useForkRef, unstable_composeClasses as composeCl
8
8
  import { gridVisibleColumnFieldsSelector, getDataGridUtilityClass } from '@mui/x-data-grid';
9
9
  import { useGridPrivateApiContext, unstable_gridHeaderFilteringEditFieldSelector, unstable_gridHeaderFilteringMenuSelector, isNavigationKey } from '@mui/x-data-grid/internals';
10
10
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
11
- import { GridHeaderFilterAdornment } from './GridHeaderFilterAdornment';
11
+ import { GridHeaderFilterMenuContainer } from './GridHeaderFilterMenuContainer';
12
12
  import { GridHeaderFilterClearButton } from './GridHeaderFilterClearButton';
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -23,13 +23,17 @@ const useUtilityClasses = ownerState => {
23
23
  };
24
24
  return composeClasses(slots, getDataGridUtilityClass, classes);
25
25
  };
26
+ const dateSx = {
27
+ [`& input[value=""]:not(:focus)`]: {
28
+ color: 'transparent'
29
+ }
30
+ };
26
31
  const GridHeaderFilterCell = /*#__PURE__*/React.forwardRef((props, ref) => {
27
32
  var _filterOperators$find, _currentOperator$head, _colDef$headerName;
28
33
  const {
29
34
  colIndex,
30
35
  height,
31
36
  hasFocus,
32
- headerFilterComponent,
33
37
  filterOperators,
34
38
  width,
35
39
  headerClassName,
@@ -61,6 +65,10 @@ const GridHeaderFilterCell = /*#__PURE__*/React.forwardRef((props, ref) => {
61
65
  const clearFilterItem = React.useCallback(() => {
62
66
  apiRef.current.deleteFilterItem(item);
63
67
  }, [apiRef, item]);
68
+ let headerFilterComponent;
69
+ if (colDef.renderHeaderFilter) {
70
+ headerFilterComponent = colDef.renderHeaderFilter(props);
71
+ }
64
72
  React.useLayoutEffect(() => {
65
73
  if (hasFocus && !isMenuOpen) {
66
74
  let focusableElement = cellRef.current.querySelector('[tabindex="0"]');
@@ -131,7 +139,8 @@ const GridHeaderFilterCell = /*#__PURE__*/React.forwardRef((props, ref) => {
131
139
  const mouseEventsHandlers = React.useMemo(() => ({
132
140
  onKeyDown: publish('headerFilterKeyDown', onKeyDown),
133
141
  onClick: publish('headerFilterClick'),
134
- onMouseDown: publish('headerFilterMouseDown', onMouseDown)
142
+ onMouseDown: publish('headerFilterMouseDown', onMouseDown),
143
+ onBlur: publish('headerFilterBlur')
135
144
  }), [onMouseDown, onKeyDown, publish]);
136
145
  const ownerState = _extends({}, rootProps, {
137
146
  colDef
@@ -156,30 +165,35 @@ const GridHeaderFilterCell = /*#__PURE__*/React.forwardRef((props, ref) => {
156
165
  "aria-colindex": colIndex + 1,
157
166
  "aria-label": headerFilterComponent == null ? (_colDef$headerName = colDef.headerName) != null ? _colDef$headerName : colDef.field : undefined
158
167
  }, other, mouseEventsHandlers, {
159
- children: [headerFilterComponent, InputComponent && headerFilterComponent === undefined ? /*#__PURE__*/_jsx(InputComponent, _extends({
160
- apiRef: apiRef,
161
- item: item,
162
- inputRef: inputRef,
163
- applyValue: applyFilterChanges,
164
- onFocus: () => apiRef.current.startHeaderFilterEditMode(colDef.field),
165
- onBlur: () => apiRef.current.stopHeaderFilterEditMode(),
166
- placeholder: apiRef.current.getLocaleText('columnMenuFilter'),
167
- label: isFilterActive ? capitalize(label) : ' ',
168
- isFilterActive: isFilterActive,
169
- headerFilterMenu: /*#__PURE__*/_jsx(GridHeaderFilterAdornment, {
168
+ children: [headerFilterComponent, InputComponent && headerFilterComponent === undefined ? /*#__PURE__*/_jsxs(React.Fragment, {
169
+ children: [/*#__PURE__*/_jsx(InputComponent, _extends({
170
+ apiRef: apiRef,
171
+ item: item,
172
+ inputRef: inputRef,
173
+ applyValue: applyFilterChanges,
174
+ onFocus: () => apiRef.current.startHeaderFilterEditMode(colDef.field),
175
+ onBlur: () => apiRef.current.stopHeaderFilterEditMode(),
176
+ label: capitalize(label),
177
+ placeholder: "",
178
+ isFilterActive: isFilterActive,
179
+ clearButton: showClearIcon && isApplied ? /*#__PURE__*/_jsx(GridHeaderFilterClearButton, {
180
+ onClick: clearFilterItem
181
+ }) : null,
182
+ disabled: isNoInputOperator,
183
+ tabIndex: -1,
184
+ InputLabelProps: null,
185
+ sx: colDef.type === 'date' || colDef.type === 'dateTime' ? dateSx : undefined
186
+ }, isNoInputOperator ? {
187
+ value: ''
188
+ } : {}, currentOperator == null ? void 0 : currentOperator.InputComponentProps, InputComponentProps)), /*#__PURE__*/_jsx(GridHeaderFilterMenuContainer, {
170
189
  operators: filterOperators,
171
190
  item: item,
172
191
  field: colDef.field,
173
192
  applyFilterChanges: applyFilterChanges,
174
193
  headerFilterMenuRef: headerFilterMenuRef,
175
194
  buttonRef: buttonRef
176
- }),
177
- clearButton: showClearIcon && isApplied ? /*#__PURE__*/_jsx(GridHeaderFilterClearButton, {
178
- onClick: clearFilterItem
179
- }) : null,
180
- disabled: isNoInputOperator,
181
- tabIndex: -1
182
- }, currentOperator == null ? void 0 : currentOperator.InputComponentProps, InputComponentProps)) : null]
195
+ })]
196
+ }) : null]
183
197
  }));
184
198
  });
185
199
  process.env.NODE_ENV !== "production" ? GridHeaderFilterCell.propTypes = {
@@ -204,7 +218,6 @@ process.env.NODE_ENV !== "production" ? GridHeaderFilterCell.propTypes = {
204
218
  * Class name that will be added in the column header cell.
205
219
  */
206
220
  headerClassName: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
207
- headerFilterComponent: PropTypes.node,
208
221
  headerFilterMenuRef: PropTypes.shape({
209
222
  current: PropTypes.object
210
223
  }).isRequired,
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  interface GridHeaderFilterClearIconProps {
3
3
  onClick: () => void;
4
4
  }
5
- declare function GridHeaderFilterClearButton({ onClick }: GridHeaderFilterClearIconProps): JSX.Element;
5
+ declare function GridHeaderFilterClearButton({ onClick }: GridHeaderFilterClearIconProps): React.JSX.Element;
6
6
  export { GridHeaderFilterClearButton };