@mui/x-data-grid 7.0.0-alpha.2 → 7.0.0-alpha.3

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 (126) hide show
  1. package/CHANGELOG.md +241 -0
  2. package/DataGrid/DataGrid.d.ts +0 -10
  3. package/DataGrid/DataGrid.js +11 -23
  4. package/DataGrid/useDataGridProps.js +1 -1
  5. package/README.md +0 -1
  6. package/components/GridHeader.js +3 -2
  7. package/components/GridRow.js +2 -4
  8. package/components/cell/GridCell.js +3 -3
  9. package/components/cell/GridEditDateCell.js +1 -20
  10. package/components/columnHeaders/GridColumnGroupHeader.js +2 -1
  11. package/components/columnHeaders/GridColumnHeaderItem.js +2 -1
  12. package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
  13. package/components/panel/filterPanel/GridFilterForm.js +2 -2
  14. package/components/panel/filterPanel/GridFilterInputValue.js +1 -1
  15. package/components/panel/index.d.ts +0 -1
  16. package/components/panel/index.js +0 -1
  17. package/constants/defaultGridSlotsComponents.js +1 -2
  18. package/hooks/features/clipboard/useGridClipboard.d.ts +1 -1
  19. package/hooks/features/clipboard/useGridClipboard.js +1 -1
  20. package/hooks/features/editing/useGridCellEditing.js +8 -21
  21. package/hooks/features/editing/useGridRowEditing.js +7 -21
  22. package/hooks/features/export/useGridCsvExport.d.ts +1 -1
  23. package/hooks/features/export/useGridCsvExport.js +1 -1
  24. package/hooks/features/filter/gridFilterUtils.d.ts +1 -0
  25. package/hooks/features/filter/gridFilterUtils.js +7 -4
  26. package/hooks/features/filter/useGridFilter.js +2 -2
  27. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -1
  28. package/hooks/features/rowSelection/useGridRowSelection.js +2 -1
  29. package/hooks/features/sorting/useGridSorting.js +6 -5
  30. package/index.js +1 -1
  31. package/internals/index.d.ts +1 -1
  32. package/internals/index.js +1 -1
  33. package/legacy/DataGrid/DataGrid.js +11 -23
  34. package/legacy/DataGrid/useDataGridProps.js +1 -1
  35. package/legacy/components/GridHeader.js +3 -2
  36. package/legacy/components/GridRow.js +2 -4
  37. package/legacy/components/cell/GridCell.js +3 -3
  38. package/legacy/components/cell/GridEditDateCell.js +1 -20
  39. package/legacy/components/columnHeaders/GridColumnGroupHeader.js +2 -1
  40. package/legacy/components/columnHeaders/GridColumnHeaderItem.js +2 -1
  41. package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
  42. package/legacy/components/panel/filterPanel/GridFilterForm.js +2 -2
  43. package/legacy/components/panel/filterPanel/GridFilterInputValue.js +1 -1
  44. package/legacy/components/panel/index.js +0 -1
  45. package/legacy/constants/defaultGridSlotsComponents.js +1 -2
  46. package/legacy/hooks/features/clipboard/useGridClipboard.js +1 -1
  47. package/legacy/hooks/features/editing/useGridCellEditing.js +8 -21
  48. package/legacy/hooks/features/editing/useGridRowEditing.js +7 -23
  49. package/legacy/hooks/features/export/useGridCsvExport.js +1 -1
  50. package/legacy/hooks/features/filter/gridFilterUtils.js +7 -4
  51. package/legacy/hooks/features/filter/useGridFilter.js +2 -2
  52. package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -1
  53. package/legacy/hooks/features/rowSelection/useGridRowSelection.js +2 -1
  54. package/legacy/hooks/features/sorting/useGridSorting.js +6 -5
  55. package/legacy/index.js +1 -1
  56. package/legacy/internals/index.js +1 -1
  57. package/legacy/locales/bgBG.js +33 -37
  58. package/legacy/models/params/gridEditCellParams.js +1 -0
  59. package/legacy/utils/domUtils.js +10 -1
  60. package/locales/bgBG.js +33 -37
  61. package/models/api/gridEditingApi.d.ts +2 -4
  62. package/models/api/gridSortApi.d.ts +2 -2
  63. package/models/gridFilterModel.d.ts +2 -2
  64. package/models/gridSlotsComponent.d.ts +0 -5
  65. package/models/gridSlotsComponentsProps.d.ts +0 -3
  66. package/models/params/gridEditCellParams.d.ts +3 -1
  67. package/models/params/gridEditCellParams.js +1 -0
  68. package/models/params/gridRowParams.d.ts +1 -0
  69. package/models/props/DataGridProps.d.ts +1 -1
  70. package/modern/DataGrid/DataGrid.js +11 -23
  71. package/modern/DataGrid/useDataGridProps.js +1 -1
  72. package/modern/components/GridHeader.js +2 -1
  73. package/modern/components/GridRow.js +2 -4
  74. package/modern/components/cell/GridCell.js +2 -2
  75. package/modern/components/cell/GridEditDateCell.js +1 -20
  76. package/modern/components/columnHeaders/GridColumnGroupHeader.js +2 -1
  77. package/modern/components/columnHeaders/GridColumnHeaderItem.js +2 -1
  78. package/modern/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
  79. package/modern/components/panel/filterPanel/GridFilterForm.js +2 -2
  80. package/modern/components/panel/filterPanel/GridFilterInputValue.js +1 -1
  81. package/modern/components/panel/index.js +0 -1
  82. package/modern/constants/defaultGridSlotsComponents.js +1 -2
  83. package/modern/hooks/features/clipboard/useGridClipboard.js +1 -1
  84. package/modern/hooks/features/editing/useGridCellEditing.js +8 -21
  85. package/modern/hooks/features/editing/useGridRowEditing.js +7 -21
  86. package/modern/hooks/features/export/useGridCsvExport.js +1 -1
  87. package/modern/hooks/features/filter/gridFilterUtils.js +4 -2
  88. package/modern/hooks/features/filter/useGridFilter.js +2 -2
  89. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -1
  90. package/modern/hooks/features/rowSelection/useGridRowSelection.js +2 -1
  91. package/modern/hooks/features/sorting/useGridSorting.js +6 -5
  92. package/modern/index.js +1 -1
  93. package/modern/internals/index.js +1 -1
  94. package/modern/locales/bgBG.js +33 -37
  95. package/modern/models/params/gridEditCellParams.js +1 -0
  96. package/modern/utils/domUtils.js +10 -1
  97. package/node/DataGrid/DataGrid.js +11 -23
  98. package/node/DataGrid/useDataGridProps.js +1 -1
  99. package/node/components/GridHeader.js +2 -1
  100. package/node/components/GridRow.js +1 -3
  101. package/node/components/cell/GridCell.js +2 -2
  102. package/node/components/cell/GridEditDateCell.js +1 -20
  103. package/node/components/columnHeaders/GridColumnGroupHeader.js +2 -1
  104. package/node/components/columnHeaders/GridColumnHeaderItem.js +2 -1
  105. package/node/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
  106. package/node/components/panel/filterPanel/GridFilterForm.js +2 -2
  107. package/node/components/panel/filterPanel/GridFilterInputValue.js +1 -1
  108. package/node/components/panel/index.js +0 -11
  109. package/node/constants/defaultGridSlotsComponents.js +0 -1
  110. package/node/hooks/features/clipboard/useGridClipboard.js +1 -1
  111. package/node/hooks/features/editing/useGridCellEditing.js +7 -20
  112. package/node/hooks/features/editing/useGridRowEditing.js +6 -20
  113. package/node/hooks/features/export/useGridCsvExport.js +1 -1
  114. package/node/hooks/features/filter/gridFilterUtils.js +6 -3
  115. package/node/hooks/features/filter/useGridFilter.js +1 -1
  116. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -1
  117. package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -1
  118. package/node/hooks/features/sorting/useGridSorting.js +6 -5
  119. package/node/index.js +1 -1
  120. package/node/internals/index.js +7 -0
  121. package/node/locales/bgBG.js +33 -37
  122. package/node/models/params/gridEditCellParams.js +1 -0
  123. package/node/utils/domUtils.js +11 -1
  124. package/package.json +2 -2
  125. package/utils/domUtils.d.ts +2 -0
  126. package/utils/domUtils.js +10 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,188 @@
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
+ ## 7.0.0-alpha.3
7
+
8
+ _Dec 4, 2023_
9
+
10
+ We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🚀 Support localized start of the week on pickers' `AdapterLuxon`
13
+
14
+ When using Luxon 3.4.4 or higher, the start of the week will be defined by the date locale (e.g.: Sunday for `en-US`, Monday for `fr-FR`).
15
+
16
+ - 📈 Fix a lot of Charts package issues
17
+ - 🎉 The Data Grid features Cell selection and Clipboard paste are now stable
18
+ - 🌍 Improve Bulgarian (bg-BG) locale on Data Grid
19
+ - 🐞 Bugfixes
20
+ - 📚 Documentation improvements
21
+
22
+ ### Data Grid
23
+
24
+ #### Breaking changes
25
+
26
+ - The clipboard paste feature is now enabled by default. The flag `clipboardPaste` is no longer needed to be passed to the `experimentalFeatures` prop.
27
+
28
+ - The clipboard related exports `ignoreValueFormatterDuringExport` and `splitClipboardPastedText` are no longer prefixed with `unstable_`.
29
+
30
+ - The deprecated constants `SUBMIT_FILTER_STROKE_TIME` and `SUBMIT_FILTER_DATE_STROKE_TIME` have been removed from the `DataGrid` exports. Use the [`filterDebounceMs`](https://next.mui.com/x/api/data-grid/data-grid/#DataGrid-prop-filterDebounceMs) prop to customize filter debounce time.
31
+
32
+ - The `slots.preferencesPanel` slot and the `slotProps.preferencesPanel` prop were removed. Use `slots.panel` and `slotProps.panel` instead.
33
+
34
+ - The `GridPreferencesPanel` component is not exported anymore as it wasn't meant to be used outside of the Data Grid.
35
+
36
+ - The `unstable_` prefix has been removed from the cell selection props listed below.
37
+
38
+ | Old name | New name |
39
+ | :------------------------------------ | :--------------------------- |
40
+ | `unstable_cellSelection` | `cellSelection` |
41
+ | `unstable_cellSelectionModel` | `cellSelectionModel` |
42
+ | `unstable_onCellSelectionModelChange` | `onCellSelectionModelChange` |
43
+
44
+ - The `unstable_` prefix has been removed from the cell selection API methods listed below.
45
+
46
+ | Old name | New name |
47
+ | :--------------------------------- | :------------------------ |
48
+ | `unstable_getCellSelectionModel` | `getCellSelectionModel` |
49
+ | `unstable_getSelectedCellsAsArray` | `getSelectedCellsAsArray` |
50
+ | `unstable_isCellSelected` | `isCellSelected` |
51
+ | `unstable_selectCellRange` | `selectCellRange` |
52
+ | `unstable_setCellSelectionModel` | `setCellSelectionModel` |
53
+
54
+ - The Quick Filter now ignores hidden columns by default.
55
+ See [including hidden columns](https://next.mui.com/x/react-data-grid/filtering/quick-filter/#including-hidden-columns) section for more details.
56
+
57
+ #### `@mui/x-data-grid@7.0.0-alpha.3`
58
+
59
+ - [DataGrid] Fix cell editing adding a leading "v" on paste (#9205) @prasad5795
60
+ - [DataGrid] Exclude hidden columns from quick filtering by default (#11229) @cherniavskii
61
+ - [DataGrid] Fix `onFilterModelChange` being fired with stale field value (#11000) @gitstart
62
+ - [DataGrid] Fix handling of event target in portal (#11174) @cherniavskii
63
+ - [DataGrid] Remove deprecated constants (#11233) @michelengelen
64
+ - [DataGrid] Remove the `preferencesPanel` slot (#11228) @cherniavskii
65
+ - [l10n] Improve Bulgarian (bg-BG) locale (#10856) @Kristiqn95
66
+
67
+ #### `@mui/x-data-grid-pro@7.0.0-alpha.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
68
+
69
+ Same changes as in `@mui/x-data-grid@7.0.0-alpha.3`.
70
+
71
+ #### `@mui/x-data-grid-premium@7.0.0-alpha.3` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
72
+
73
+ Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.3`, plus:
74
+
75
+ - [DataGridPremium] Fix aggregated column ignoring column definition changes (#11129) @cherniavskii
76
+ - [DataGridPremium] Make Cell selection feature stable (#11246) @MBilalShafi
77
+ - [DataGridPremium] Make Clipboard paste feature stable (#11248) @MBilalShafi
78
+
79
+ ### Date Pickers
80
+
81
+ #### Breaking changes
82
+
83
+ - The Date and Time Pickers now use the localized week when using `AdapterLuxon` and Luxon v3.4.4 or higher is installed.
84
+ This new behavior allows `AdapterLuxon` to have the same behavior as the other adapters.
85
+ If you want to keep the start of the week on Monday even if your locale says otherwise, you can hardcode the week settings as follows:
86
+ The Firefox browser currently does not support this behavior because the [getWeekInfo](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo) API is not yet implemented.
87
+
88
+ ```ts
89
+ import { Settings } from 'luxon';
90
+
91
+ Settings.defaultWeekSettings = {
92
+ firstDay: 1,
93
+ minimalDays: Info.getMinimumDaysInFirstWeek(),
94
+ weekend: [6, 7],
95
+ };
96
+ ```
97
+
98
+ - Add new parameters to the `shortcuts` slot `onChange` callback
99
+
100
+ The `onChange` callback fired when selecting a shortcut now requires two new parameters (previously they were optional):
101
+
102
+ - The [`changeImportance`](/x/react-date-pickers/shortcuts/#behavior-when-selecting-a-shortcut) of the shortcut.
103
+ - The `item` containing the entire shortcut object.
104
+
105
+ ```diff
106
+ const CustomShortcuts = (props) => {
107
+ return (
108
+ <React.Fragment>
109
+ {props.items.map(item => {
110
+ const value = item.getValue({ isValid: props.isValid });
111
+ return (
112
+ <button
113
+ - onClick={() => onChange(value)}
114
+ + onClick={() => onChange(value, props.changeImportance ?? 'accept', item)}
115
+ >
116
+ {value}
117
+ </button>
118
+ )
119
+ }}
120
+ </React.Fragment>
121
+ )
122
+ }
123
+
124
+ <DatePicker slots={{ shortcuts: CustomShortcuts }} />
125
+ ```
126
+
127
+ - Usage of `AdapterDayjs` with the `customParseFormat` plugin
128
+ The call to `dayjs.extend(customParseFormatPlugin)` has been moved to the `AdapterDayjs` constructor. This allows users to pass custom options to this plugin before the adapter uses it.
129
+
130
+ If you are using this plugin before the rendering of the first `LocalizationProvider` component and did not call `dayjs.extend` in your own codebase, you will need to manually extend `dayjs`:
131
+
132
+ ```tsx
133
+ import dayjs from 'dayjs';
134
+ import customParseFormatPlugin from 'dayjs/plugin/customParseFormat';
135
+
136
+ dayjs.extend(customParseFormatPlugin);
137
+ ```
138
+
139
+ The other plugins are still added before the adapter initialization.
140
+
141
+ #### `@mui/x-date-pickers@7.0.0-alpha.3`
142
+
143
+ - [pickers] Expand field placeholder methods flexibility by providing `format` parameter (#11130) @LukasTy
144
+ - [pickers] Make `changeImportance` and `shortcut` mandatory in `PickersShortcuts` (#10941) @flaviendelangle
145
+ - [pickers] Moved extend with `customParseFormat` to constructor (#11151) @michelengelen
146
+ - [pickers] POC: `PickersTextField` styling - outlined variant (#10778) @noraleonte
147
+ - [pickers] Support localized start of the week on `AdapterLuxon` (#10964) @flaviendelangle
148
+ - [pickers] Use adapter methods instead of date library ones whenever possible (#11142) @flaviendelangle
149
+
150
+ #### `@mui/x-date-pickers-pro@7.0.0-alpha.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
151
+
152
+ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.3`.
153
+
154
+ ### Charts / `@mui/x-charts@7.0.0-alpha.3`
155
+
156
+ - [charts] Adjusted `defaultizeValueFormatter` util to accept an optional `series.valueFormatter` value (#11144) @michelengelen
157
+ - [charts] Apply `labelStyle` and `tickLabelStyle` props on `<ChartsYAxis />` (#11180) @akamfoad
158
+ - [charts] Fix TS config (#11259) @alexfauquette
159
+ - [charts] Fix error with empty dataset (#11063) @alexfauquette
160
+ - [charts] Fix export strategy (#11235) @alexfauquette
161
+ - [charts] Remove outdated prop-types (#11045) @alexfauquette
162
+
163
+ ### Docs
164
+
165
+ - [docs] Add `TextField` styling example to customization playground (#10812) @noraleonte
166
+ - [docs] Add a card grid to the installation page (#11177) @danilo-leal
167
+ - [docs] Add end v6 blogpost to whats new page (#10999) @joserodolfofreitas
168
+ - [docs] Add small formatting improvements to the licensing page (#11178) @danilo-leal
169
+ - [docs] Document charts composition (#10710) (#11239) @alexfauquette
170
+ - [docs] Fix <title> generation (#11182) @oliviertassinari
171
+ - [docs] Fix dead anchor link (#11265) @oliviertassinari
172
+ - [docs] Improve Data Grid togglable columns example (#11238) @MBilalShafi
173
+ - [docs] Improve the prop descriptions of `DayCalendar` (#11158) @flaviendelangle
174
+ - [docs] Move the adapter breaking changes in a collapsable block (#11205) @flaviendelangle
175
+ - [docs] Polish Next.js header description @oliviertassinari
176
+ - [docs] Remove the `newFeature` flag on v6 features (#11168) @flaviendelangle
177
+ - [docs] Simplify a bit chart demo (#11173) @oliviertassinari
178
+ - [docs] Standardize the usage of callouts in the MUI X docs (#7127) @samuelsycamore
179
+ - [docs] Adjust the Data Grid demo page design (#11231) @danilo-leal
180
+
181
+ ### Core
182
+
183
+ - [core] Make `@mui/system` a direct dependency (#11128) @LukasTy
184
+ - [core] Remove blank lines, coding style @oliviertassinari
185
+ - [core] Remove outdated `ENABLE_AD` env variable (#11181) @oliviertassinari
186
+ - [github] Do not add `plan: Pro` and `plan: Premium` labels on pro / premium issue templates (#10183) @flaviendelangle
187
+
6
188
  ## 7.0.0-alpha.2
7
189
 
8
190
  _Nov 23, 2023_
@@ -684,6 +866,65 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
684
866
  - [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
685
867
  - [license] Correctly throw errors (#10924) @oliviertassinari
686
868
 
869
+ ## 6.18.3
870
+
871
+ _Dec 4, 2023_
872
+
873
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
874
+
875
+ - 📈 Fix a lot of Charts package issues
876
+ - 🌍 Improve Bulgarian (bg-BG) locale on Data Grid
877
+ - 🐞 Bugfixes
878
+ - 📚 Documentation improvements
879
+
880
+ ### Data Grid
881
+
882
+ #### `@mui/x-data-grid@6.18.3`
883
+
884
+ - [DataGrid] Fix cell editing adding a leading "v" on paste (#11166) @prasad5795
885
+ - [DataGrid] Fix handling of event target in portal (#11209) @cherniavskii
886
+ - [DataGrid] Fix `onFilterModelChange` being fired with stale field value (#11244) @gitstart
887
+ - [l10n] Improve Bulgarian (bg-BG) locale (#10856) (#11206) @Kristiqn95
888
+
889
+ #### `@mui/x-data-grid-pro@6.18.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
890
+
891
+ Same changes as in `@mui/x-data-grid@6.18.3`.
892
+
893
+ #### `@mui/x-data-grid-premium@6.18.3` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
894
+
895
+ Same changes as in `@mui/x-data-grid-pro@6.18.3`, plus:
896
+
897
+ - [DataGridPremium] Fix aggregated column ignoring column definition changes (#11176) @cherniavskii
898
+ - [DataGridPremium] Fix custom filter operators not working on aggregated column (#11201) @cherniavskii
899
+
900
+ ### Date Pickers
901
+
902
+ #### `@mui/x-date-pickers@6.18.3`
903
+
904
+ - [pickers] Correctly format `MultiSectionDigitalClock` number sections (#11297) @LukasTy
905
+ - [pickers] Expand field placeholder methods flexibility by providing `format` parameter (#11254) @LukasTy
906
+
907
+ #### `@mui/x-date-pickers-pro@6.18.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
908
+
909
+ Same changes as in `@mui/x-date-pickers@6.18.3`.
910
+
911
+ ### Charts / `@mui/x-charts@6.18.3`
912
+
913
+ - [charts] Adjusted `defaultizeValueFormatter` util to accept an optional `series.valueFormatter` value (#11213) @michelengelen
914
+ - [charts] Apply `labelStyle` and `tickLabelStyle` props on `<ChartsYAxis />` (#11180) @akamfoad
915
+ - [charts] Fix TS config (#11259) @alexfauquette
916
+ - [charts] Fix error with empty dataset (#11063) @alexfauquette
917
+ - [charts] Fix export strategy (#11235) @alexfauquette
918
+
919
+ ### Docs
920
+
921
+ - [docs] Add LTS section to support page (#11300) @joserodolfofreitas
922
+ - [docs] Add end v6 blogpost to whats new page (#11299) @joserodolfofreitas
923
+ - [docs] Document charts composition (#10710) @alexfauquette
924
+ - [docs] Fix version links (#11167) @LukasTy
925
+ - [docs] Improve Data Grid togglable columns example (#11241) @MBilalShafi
926
+ - [docs] Split charts overview and getting started in distinct pages (#10910) @alexfauquette
927
+
687
928
  ## 6.18.2
688
929
 
689
930
  _Nov 23, 2023_
@@ -13,14 +13,4 @@ interface DataGridComponent {
13
13
  * - [DataGrid API](https://mui.com/x/api/data-grid/data-grid/)
14
14
  */
15
15
  export declare const DataGrid: DataGridComponent;
16
- /**
17
- * Remove at v7
18
- * @deprecated
19
- */
20
- export declare const SUBMIT_FILTER_STROKE_TIME: number;
21
- /**
22
- * Remove at v7
23
- * @deprecated
24
- */
25
- export declare const SUBMIT_FILTER_DATE_STROKE_TIME: number;
26
16
  export {};
@@ -5,7 +5,7 @@ import { chainPropTypes } from '@mui/utils';
5
5
  import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot } from '../components';
6
6
  import { GridContextProvider } from '../context/GridContextProvider';
7
7
  import { useDataGridComponent } from './useDataGridComponent';
8
- import { useDataGridProps, DATA_GRID_PROPS_DEFAULT_VALUES } from './useDataGridProps';
8
+ import { useDataGridProps } from './useDataGridProps';
9
9
  import { DataGridVirtualScroller } from '../components/DataGridVirtualScroller';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -35,18 +35,6 @@ const DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref
35
35
  * - [DataGrid API](https://mui.com/x/api/data-grid/data-grid/)
36
36
  */
37
37
  export const DataGrid = /*#__PURE__*/React.memo(DataGridRaw);
38
-
39
- /**
40
- * Remove at v7
41
- * @deprecated
42
- */
43
- export const SUBMIT_FILTER_STROKE_TIME = DATA_GRID_PROPS_DEFAULT_VALUES.filterDebounceMs;
44
-
45
- /**
46
- * Remove at v7
47
- * @deprecated
48
- */
49
- export const SUBMIT_FILTER_DATE_STROKE_TIME = DATA_GRID_PROPS_DEFAULT_VALUES.filterDebounceMs;
50
38
  DataGridRaw.propTypes = {
51
39
  // ----------------------------- Warning --------------------------------
52
40
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -274,6 +262,15 @@ DataGridRaw.propTypes = {
274
262
  * @default false
275
263
  */
276
264
  ignoreDiacritics: PropTypes.bool,
265
+ /**
266
+ * If `true`, the grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
267
+ * If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
268
+ * @default false
269
+ */
270
+ ignoreValueFormatterDuringExport: PropTypes.oneOfType([PropTypes.shape({
271
+ clipboardExport: PropTypes.bool,
272
+ csvExport: PropTypes.bool
273
+ }), PropTypes.bool]),
277
274
  /**
278
275
  * The initial state of the DataGrid.
279
276
  * The data in it will be set in the state on initialization but will not be controlled.
@@ -666,14 +663,5 @@ DataGridRaw.propTypes = {
666
663
  /**
667
664
  * The system prop that allows defining system overrides as well as additional CSS styles.
668
665
  */
669
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
670
- /**
671
- * If `true`, the grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
672
- * If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
673
- * @default false
674
- */
675
- unstable_ignoreValueFormatterDuringExport: PropTypes.oneOfType([PropTypes.shape({
676
- clipboardExport: PropTypes.bool,
677
- csvExport: PropTypes.bool
678
- }), PropTypes.bool])
666
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
679
667
  };
@@ -68,7 +68,7 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
68
68
  disableColumnResize: false,
69
69
  keepNonExistentRowsSelected: false,
70
70
  keepColumnPositionIfDraggedOutside: false,
71
- unstable_ignoreValueFormatterDuringExport: false,
71
+ ignoreValueFormatterDuringExport: false,
72
72
  clipboardCopyCellDelimiter: '\t',
73
73
  rowPositionsDebounceMs: 166
74
74
  };
package/README.md CHANGED
@@ -16,7 +16,6 @@ This component has the following peer dependencies that you will need to install
16
16
  ```json
17
17
  "peerDependencies": {
18
18
  "@mui/material": "^5.4.1",
19
- "@mui/system": "^5.4.1",
20
19
  "react": "^17.0.0 || ^18.0.0",
21
20
  "react-dom": "^17.0.0 || ^18.0.0"
22
21
  },
@@ -1,12 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { useGridRootProps } from '../hooks/utils/useGridRootProps';
4
+ import { GridPreferencesPanel } from './panel/GridPreferencesPanel';
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
6
7
  export function GridHeader() {
7
- var _rootProps$slotProps, _rootProps$slotProps2;
8
+ var _rootProps$slotProps;
8
9
  const rootProps = useGridRootProps();
9
10
  return /*#__PURE__*/_jsxs(React.Fragment, {
10
- children: [/*#__PURE__*/_jsx(rootProps.slots.preferencesPanel, _extends({}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.preferencesPanel)), rootProps.slots.toolbar && /*#__PURE__*/_jsx(rootProps.slots.toolbar, _extends({}, (_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.toolbar))]
11
+ children: [/*#__PURE__*/_jsx(GridPreferencesPanel, {}), rootProps.slots.toolbar && /*#__PURE__*/_jsx(rootProps.slots.toolbar, _extends({}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.toolbar))]
11
12
  });
12
13
  }
@@ -13,7 +13,7 @@ import { useGridRootProps } from '../hooks/utils/useGridRootProps';
13
13
  import { gridColumnsTotalWidthSelector } from '../hooks/features/columns/gridColumnsSelector';
14
14
  import { useGridSelector, objectShallowCompare } from '../hooks/utils/useGridSelector';
15
15
  import { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
16
- import { findParentElementFromClassName } from '../utils/domUtils';
16
+ import { findParentElementFromClassName, isEventTargetInPortal } from '../utils/domUtils';
17
17
  import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../colDef/gridCheckboxSelectionColDef';
18
18
  import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
19
19
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelToggleField';
@@ -137,9 +137,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
137
137
  }, [apiRef, currentPage.range, index, rowHeight, rowId, position]);
138
138
  const publish = React.useCallback((eventName, propHandler) => event => {
139
139
  // Ignore portal
140
- // The target is not an element when triggered by a Select inside the cell
141
- // See https://github.com/mui/material-ui/issues/10534
142
- if (event.target.nodeType === 1 && !event.currentTarget.contains(event.target)) {
140
+ if (isEventTargetInPortal(event)) {
143
141
  return;
144
142
  }
145
143
 
@@ -386,7 +386,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
386
386
  } : void 0;
387
387
  export { MemoizedCellWrapper as GridCellWrapper, GridCell };
388
388
  const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
389
- var _getActions, _ref, _rootProps$unstable_c, _rootProps$experiment3, _rootProps$experiment4;
389
+ var _getActions, _ref, _rootProps$cellSelect, _rootProps$experiment3, _rootProps$experiment4;
390
390
  const {
391
391
  column,
392
392
  rowId,
@@ -461,8 +461,8 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
461
461
  const cellRef = React.useRef(null);
462
462
  const handleRef = useForkRef(ref, cellRef);
463
463
  const focusElementRef = React.useRef(null);
464
- // @ts-expect-error To access `unstable_cellSelection` flag as it's a `premium` feature
465
- const isSelectionMode = (_rootProps$unstable_c = rootProps.unstable_cellSelection) != null ? _rootProps$unstable_c : false;
464
+ // @ts-expect-error To access `cellSelection` flag as it's a `premium` feature
465
+ const isSelectionMode = (_rootProps$cellSelect = rootProps.cellSelection) != null ? _rootProps$cellSelect : false;
466
466
  const ownerState = {
467
467
  align,
468
468
  showRightBorder,
@@ -63,7 +63,6 @@ function GridEditDateCell(props) {
63
63
  classes: rootProps.classes
64
64
  };
65
65
  const classes = useUtilityClasses(ownerState);
66
- const hasUpdatedEditValueOnMount = React.useRef(false);
67
66
  const parseValueToDate = React.useCallback(value => {
68
67
  if (value === '') {
69
68
  return null;
@@ -109,26 +108,8 @@ function GridEditDateCell(props) {
109
108
  inputRef.current.focus();
110
109
  }
111
110
  }, [hasFocus]);
112
- const meta = apiRef.current.unstable_getEditCellMeta(id, field);
113
- const handleInputRef = el => {
114
- inputRef.current = el;
115
- if (meta != null && meta.unstable_updateValueOnRender && !hasUpdatedEditValueOnMount.current) {
116
- const inputValue = inputRef.current.value;
117
- const parsedDate = parseValueToDate(inputValue);
118
- setValueState({
119
- parsed: parsedDate,
120
- formatted: inputValue
121
- });
122
- apiRef.current.setEditCellValue({
123
- id,
124
- field,
125
- value: parsedDate
126
- });
127
- hasUpdatedEditValueOnMount.current = true;
128
- }
129
- };
130
111
  return /*#__PURE__*/_jsx(StyledInputBase, _extends({
131
- inputRef: handleInputRef,
112
+ inputRef: inputRef,
132
113
  fullWidth: true,
133
114
  className: classes.root,
134
115
  type: isDateTime ? 'datetime-local' : 'date',
@@ -7,6 +7,7 @@ import { gridColumnGroupsLookupSelector } from '../../hooks/features/columnGroup
7
7
  import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
8
8
  import { useGridSelector } from '../../hooks/utils/useGridSelector';
9
9
  import { GridGenericColumnHeaderItem } from './GridGenericColumnHeaderItem';
10
+ import { isEventTargetInPortal } from '../../utils/domUtils';
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
12
  const useUtilityClasses = ownerState => {
12
13
  const {
@@ -85,7 +86,7 @@ function GridColumnGroupHeader(props) {
85
86
  const publish = React.useCallback(eventName => event => {
86
87
  // Ignore portal
87
88
  // See https://github.com/mui/mui-x/issues/1721
88
- if (!event.currentTarget.contains(event.target)) {
89
+ if (isEventTargetInPortal(event)) {
89
90
  return;
90
91
  }
91
92
  apiRef.current.publishEvent(eventName, renderParams, event);
@@ -9,6 +9,7 @@ import { GridColumnHeaderMenu } from '../menu/columnMenu/GridColumnHeaderMenu';
9
9
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
10
10
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
11
11
  import { GridGenericColumnHeaderItem } from './GridGenericColumnHeaderItem';
12
+ import { isEventTargetInPortal } from '../../utils/domUtils';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
15
  const useUtilityClasses = ownerState => {
@@ -68,7 +69,7 @@ function GridColumnHeaderItem(props) {
68
69
  const publish = React.useCallback(eventName => event => {
69
70
  // Ignore portal
70
71
  // See https://github.com/mui/mui-x/issues/1721
71
- if (!event.currentTarget.contains(event.target)) {
72
+ if (isEventTargetInPortal(event)) {
72
73
  return;
73
74
  }
74
75
  apiRef.current.publishEvent(eventName, apiRef.current.getColumnHeaderParams(colDef.field), event);
@@ -29,7 +29,7 @@ function GridColumnMenuSortItem(props) {
29
29
  const onSortMenuItemClick = React.useCallback(event => {
30
30
  onClick(event);
31
31
  const direction = event.currentTarget.getAttribute('data-value') || null;
32
- apiRef.current.sortColumn(colDef, direction === sortDirection ? null : direction);
32
+ apiRef.current.sortColumn(colDef.field, direction === sortDirection ? null : direction);
33
33
  }, [apiRef, colDef, onClick, sortDirection]);
34
34
  if (!colDef || !colDef.sortable || !sortingOrder.some(item => !!item)) {
35
35
  return null;
@@ -178,8 +178,8 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
178
178
  // try to keep the same operator when column change
179
179
  const newOperator = column.filterOperators.find(operator => operator.value === item.operator) || column.filterOperators[0];
180
180
 
181
- // Erase filter value if the input component is modified
182
- const eraseItemValue = !newOperator.InputComponent || newOperator.InputComponent !== (currentOperator == null ? void 0 : currentOperator.InputComponent);
181
+ // Erase filter value if the input component or filtered column type is modified
182
+ const eraseItemValue = !newOperator.InputComponent || newOperator.InputComponent !== (currentOperator == null ? void 0 : currentOperator.InputComponent) || column.type !== currentColumn.type;
183
183
  applyFilterChanges(_extends({}, item, {
184
184
  field,
185
185
  operator: newOperator.value,
@@ -43,7 +43,7 @@ function GridFilterInputValue(props) {
43
43
  }, [id, applyValue, item, rootProps.filterDebounceMs, filterTimeout]);
44
44
  React.useEffect(() => {
45
45
  const itemPlusTag = item;
46
- if (itemPlusTag.fromInput !== id) {
46
+ if (itemPlusTag.fromInput !== id || item.value === undefined) {
47
47
  var _item$value2;
48
48
  setFilterValueState(String((_item$value2 = item.value) != null ? _item$value2 : ''));
49
49
  }
@@ -4,5 +4,4 @@ export * from './GridPanelContent';
4
4
  export * from './GridPanelFooter';
5
5
  export * from './GridPanelHeader';
6
6
  export * from './GridPanelWrapper';
7
- export * from './GridPreferencesPanel';
8
7
  export * from './filterPanel';
@@ -4,5 +4,4 @@ export * from './GridPanelContent';
4
4
  export * from './GridPanelFooter';
5
5
  export * from './GridPanelHeader';
6
6
  export * from './GridPanelWrapper';
7
- export * from './GridPreferencesPanel';
8
7
  export * from './filterPanel';
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { GridSkeletonCell, GridColumnsPanel, GridFilterPanel, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridPreferencesPanel, GridRow, GridColumnHeaderFilterIconButton, GridRowCount } from '../components';
2
+ import { GridSkeletonCell, GridColumnsPanel, GridFilterPanel, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridRow, GridColumnHeaderFilterIconButton, GridRowCount } from '../components';
3
3
  import { GridCellV7 } from '../components/cell/GridCell';
4
4
  import { GridColumnHeaders } from '../components/GridColumnHeaders';
5
5
  import { GridColumnMenu } from '../components/menu/columnMenu/GridColumnMenu';
@@ -17,7 +17,6 @@ export const DATA_GRID_DEFAULT_SLOTS_COMPONENTS = _extends({}, materialSlots, {
17
17
  footer: GridFooter,
18
18
  footerRowCount: GridRowCount,
19
19
  toolbar: null,
20
- preferencesPanel: GridPreferencesPanel,
21
20
  loadingOverlay: GridLoadingOverlay,
22
21
  noResultsOverlay: GridNoResultsOverlay,
23
22
  noRowsOverlay: GridNoRowsOverlay,
@@ -5,4 +5,4 @@ import type { DataGridProcessedProps } from '../../../models/props/DataGridProps
5
5
  * @requires useGridCsvExport (method)
6
6
  * @requires useGridSelection (method)
7
7
  */
8
- export declare const useGridClipboard: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'unstable_ignoreValueFormatterDuringExport' | 'onClipboardCopy' | 'clipboardCopyCellDelimiter'>) => void;
8
+ export declare const useGridClipboard: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'ignoreValueFormatterDuringExport' | 'onClipboardCopy' | 'clipboardCopyCellDelimiter'>) => void;
@@ -50,7 +50,7 @@ function hasNativeSelection(element) {
50
50
  * @requires useGridSelection (method)
51
51
  */
52
52
  export const useGridClipboard = (apiRef, props) => {
53
- const ignoreValueFormatterProp = props.unstable_ignoreValueFormatterDuringExport;
53
+ const ignoreValueFormatterProp = props.ignoreValueFormatterDuringExport;
54
54
  const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp == null ? void 0 : ignoreValueFormatterProp.clipboardExport : ignoreValueFormatterProp) || false;
55
55
  const clipboardCopyCellDelimiter = props.clipboardCopyCellDelimiter;
56
56
  const handleCopy = React.useCallback(event => {
@@ -4,7 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  const _excluded = ["id", "field"],
5
5
  _excluded2 = ["id", "field"];
6
6
  import * as React from 'react';
7
- import { unstable_useEventCallback as useEventCallback } from '@mui/utils';
7
+ import { unstable_useEventCallback as useEventCallback, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
8
8
  import { useGridApiEventHandler, useGridApiOptionHandler } from '../../utils/useGridApiEventHandler';
9
9
  import { GridEditModes, GridCellModes } from '../../../models/gridEditRowModel';
10
10
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
@@ -101,7 +101,7 @@ export const useGridCellEditing = (apiRef, props) => {
101
101
  if (isPrintableKey(event)) {
102
102
  reason = GridCellEditStartReasons.printableKeyDown;
103
103
  } else if ((event.ctrlKey || event.metaKey) && event.key === 'v') {
104
- reason = GridCellEditStartReasons.printableKeyDown;
104
+ reason = GridCellEditStartReasons.pasteKeyDown;
105
105
  } else if (event.key === 'Enter') {
106
106
  reason = GridCellEditStartReasons.enterKeyDown;
107
107
  } else if (event.key === 'Delete' || event.key === 'Backspace') {
@@ -121,24 +121,13 @@ export const useGridCellEditing = (apiRef, props) => {
121
121
  const {
122
122
  id,
123
123
  field,
124
- reason,
125
- key,
126
- colDef
124
+ reason
127
125
  } = params;
128
126
  const startCellEditModeParams = {
129
127
  id,
130
128
  field
131
129
  };
132
- if (reason === GridCellEditStartReasons.printableKeyDown) {
133
- if (React.version.startsWith('17')) {
134
- // In React 17, cleaning the input is enough.
135
- // The sequence of events makes the key pressed by the end-users update the textbox directly.
136
- startCellEditModeParams.deleteValue = true;
137
- } else {
138
- const initialValue = colDef.valueParser ? colDef.valueParser(key) : key;
139
- startCellEditModeParams.initialValue = initialValue;
140
- }
141
- } else if (reason === GridCellEditStartReasons.deleteKeyDown) {
130
+ if (reason === GridCellEditStartReasons.printableKeyDown || reason === GridCellEditStartReasons.deleteKeyDown || reason === GridCellEditStartReasons.pasteKeyDown) {
142
131
  startCellEditModeParams.deleteValue = true;
143
132
  }
144
133
  apiRef.current.startCellEditMode(startCellEditModeParams);
@@ -248,17 +237,13 @@ export const useGridCellEditing = (apiRef, props) => {
248
237
  initialValue
249
238
  } = params;
250
239
  let newValue = apiRef.current.getCellValue(id, field);
251
- // eslint-disable-next-line @typescript-eslint/naming-convention
252
- let unstable_updateValueOnRender = false;
253
240
  if (deleteValue || initialValue) {
254
241
  newValue = deleteValue ? '' : initialValue;
255
- unstable_updateValueOnRender = true;
256
242
  }
257
243
  const newProps = {
258
244
  value: newValue,
259
245
  error: false,
260
- isProcessingProps: false,
261
- unstable_updateValueOnRender
246
+ isProcessingProps: false
262
247
  };
263
248
  updateOrDeleteFieldState(id, field, newProps);
264
249
  apiRef.current.setCellFocus(id, field);
@@ -423,7 +408,9 @@ export const useGridCellEditing = (apiRef, props) => {
423
408
  updateCellModesModel(cellModesModelProp);
424
409
  }
425
410
  }, [cellModesModelProp, updateCellModesModel]);
426
- React.useEffect(() => {
411
+
412
+ // Run this effect synchronously so that the keyboard event can impact the yet-to-be-rendered input.
413
+ useEnhancedEffect(() => {
427
414
  const idToIdLookup = gridRowsDataRowIdToIdLookupSelector(apiRef);
428
415
 
429
416
  // Update the ref here because updateStateToStopCellEditMode may change it later