@mui/x-tree-view 7.1.0 → 7.2.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 (98) hide show
  1. package/CHANGELOG.md +261 -4
  2. package/README.md +1 -1
  3. package/RichTreeView/RichTreeView.d.ts +2 -2
  4. package/RichTreeView/RichTreeView.js +7 -5
  5. package/RichTreeView/RichTreeView.types.d.ts +3 -3
  6. package/SimpleTreeView/SimpleTreeView.js +4 -2
  7. package/TreeItem/TreeItem.js +1 -1
  8. package/TreeItem2/TreeItem2.d.ts +5 -1
  9. package/TreeItem2/TreeItem2.js +0 -1
  10. package/TreeView/TreeView.js +2 -1
  11. package/index.js +1 -1
  12. package/internals/TreeViewProvider/TreeViewChildrenItemProvider.d.ts +16 -0
  13. package/internals/TreeViewProvider/TreeViewChildrenItemProvider.js +57 -0
  14. package/internals/TreeViewProvider/TreeViewContext.d.ts +2 -0
  15. package/internals/TreeViewProvider/TreeViewProvider.js +2 -3
  16. package/internals/TreeViewProvider/TreeViewProvider.types.d.ts +3 -1
  17. package/internals/corePlugins/useTreeViewInstanceEvents/useTreeViewInstanceEvents.js +7 -8
  18. package/internals/index.d.ts +18 -8
  19. package/internals/index.js +11 -0
  20. package/internals/models/plugin.d.ts +14 -6
  21. package/internals/models/treeView.d.ts +1 -2
  22. package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +33 -19
  23. package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.types.d.ts +12 -2
  24. package/internals/plugins/useTreeViewFocus/useTreeViewFocus.js +25 -26
  25. package/internals/plugins/useTreeViewFocus/useTreeViewFocus.types.d.ts +12 -4
  26. package/internals/plugins/useTreeViewId/useTreeViewId.js +5 -7
  27. package/internals/plugins/useTreeViewId/useTreeViewId.types.d.ts +1 -1
  28. package/internals/plugins/useTreeViewItems/useTreeViewItems.js +61 -51
  29. package/internals/plugins/useTreeViewItems/useTreeViewItems.types.d.ts +30 -21
  30. package/internals/plugins/useTreeViewItems/useTreeViewItems.utils.d.ts +4 -0
  31. package/internals/plugins/useTreeViewItems/useTreeViewItems.utils.js +8 -0
  32. package/internals/plugins/useTreeViewJSXItems/index.d.ts +1 -1
  33. package/internals/plugins/useTreeViewJSXItems/useTreeViewJSXItems.js +67 -42
  34. package/internals/plugins/useTreeViewJSXItems/useTreeViewJSXItems.types.d.ts +5 -4
  35. package/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +20 -18
  36. package/internals/plugins/useTreeViewSelection/useTreeViewSelection.js +11 -22
  37. package/internals/useTreeView/useTreeView.js +21 -3
  38. package/internals/useTreeView/useTreeViewModels.js +2 -2
  39. package/internals/utils/tree.d.ts +8 -0
  40. package/internals/utils/tree.js +137 -0
  41. package/modern/RichTreeView/RichTreeView.js +7 -5
  42. package/modern/SimpleTreeView/SimpleTreeView.js +4 -2
  43. package/modern/TreeItem/TreeItem.js +1 -1
  44. package/modern/TreeItem2/TreeItem2.js +0 -1
  45. package/modern/TreeView/TreeView.js +2 -1
  46. package/modern/index.js +1 -1
  47. package/modern/internals/TreeViewProvider/TreeViewChildrenItemProvider.js +57 -0
  48. package/modern/internals/TreeViewProvider/TreeViewProvider.js +2 -3
  49. package/modern/internals/corePlugins/useTreeViewInstanceEvents/useTreeViewInstanceEvents.js +7 -8
  50. package/modern/internals/index.js +11 -0
  51. package/modern/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +33 -19
  52. package/modern/internals/plugins/useTreeViewFocus/useTreeViewFocus.js +25 -26
  53. package/modern/internals/plugins/useTreeViewId/useTreeViewId.js +5 -7
  54. package/modern/internals/plugins/useTreeViewItems/useTreeViewItems.js +61 -51
  55. package/modern/internals/plugins/useTreeViewItems/useTreeViewItems.utils.js +8 -0
  56. package/modern/internals/plugins/useTreeViewJSXItems/useTreeViewJSXItems.js +67 -42
  57. package/modern/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +20 -18
  58. package/modern/internals/plugins/useTreeViewSelection/useTreeViewSelection.js +11 -22
  59. package/modern/internals/useTreeView/useTreeView.js +21 -3
  60. package/modern/internals/useTreeView/useTreeViewModels.js +2 -2
  61. package/modern/internals/utils/tree.js +137 -0
  62. package/modern/useTreeItem2/useTreeItem2.js +1 -1
  63. package/node/RichTreeView/RichTreeView.js +7 -5
  64. package/node/SimpleTreeView/SimpleTreeView.js +4 -2
  65. package/node/TreeItem/TreeItem.js +1 -1
  66. package/node/TreeItem2/TreeItem2.js +0 -1
  67. package/node/TreeView/TreeView.js +2 -1
  68. package/node/index.js +1 -1
  69. package/node/internals/TreeViewProvider/TreeViewChildrenItemProvider.js +67 -0
  70. package/node/internals/TreeViewProvider/TreeViewProvider.js +2 -3
  71. package/node/internals/corePlugins/useTreeViewInstanceEvents/useTreeViewInstanceEvents.js +7 -8
  72. package/node/internals/index.js +70 -0
  73. package/node/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +33 -19
  74. package/node/internals/plugins/useTreeViewFocus/useTreeViewFocus.js +25 -26
  75. package/node/internals/plugins/useTreeViewId/useTreeViewId.js +5 -7
  76. package/node/internals/plugins/useTreeViewItems/useTreeViewItems.js +61 -51
  77. package/node/internals/plugins/useTreeViewItems/useTreeViewItems.utils.js +15 -0
  78. package/node/internals/plugins/useTreeViewJSXItems/useTreeViewJSXItems.js +67 -42
  79. package/node/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +20 -18
  80. package/node/internals/plugins/useTreeViewSelection/useTreeViewSelection.js +11 -22
  81. package/node/internals/useTreeView/useTreeView.js +21 -3
  82. package/node/internals/useTreeView/useTreeViewModels.js +2 -2
  83. package/node/internals/utils/tree.js +148 -0
  84. package/node/useTreeItem2/useTreeItem2.js +1 -1
  85. package/package.json +2 -2
  86. package/useTreeItem2/useTreeItem2.js +1 -1
  87. package/internals/TreeViewProvider/DescendantProvider.d.ts +0 -38
  88. package/internals/TreeViewProvider/DescendantProvider.js +0 -176
  89. package/internals/plugins/useTreeViewSelection/useTreeViewSelection.utils.d.ts +0 -17
  90. package/internals/plugins/useTreeViewSelection/useTreeViewSelection.utils.js +0 -55
  91. package/internals/useTreeView/useTreeView.utils.d.ts +0 -9
  92. package/internals/useTreeView/useTreeView.utils.js +0 -46
  93. package/modern/internals/TreeViewProvider/DescendantProvider.js +0 -176
  94. package/modern/internals/plugins/useTreeViewSelection/useTreeViewSelection.utils.js +0 -55
  95. package/modern/internals/useTreeView/useTreeView.utils.js +0 -46
  96. package/node/internals/TreeViewProvider/DescendantProvider.js +0 -185
  97. package/node/internals/plugins/useTreeViewSelection/useTreeViewSelection.utils.js +0 -62
  98. package/node/internals/useTreeView/useTreeView.utils.js +0 -58
package/CHANGELOG.md CHANGED
@@ -3,6 +3,193 @@
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.2.0
7
+
8
+ _Apr 12, 2024_
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
+ - 🎨 Make grid colors customizable through the MUI themes API
13
+ - 🌍 Improve French (fr-FR), German (de-DE), and Swedish (sv-SE) locales on the Data Grid and Pickers
14
+ - 🐞 Bugfixes
15
+ - 📚 Documentation improvements
16
+
17
+ ### Data Grid
18
+
19
+ #### `@mui/x-data-grid@7.2.0`
20
+
21
+ - [DataGrid] Add missing `api` property to `GridCallbackDetails` (#12742) @sai6855
22
+ - [DataGrid] Do not escape double quotes when copying to clipboard (#12722) @cherniavskii
23
+ - [DataGrid] Fix column vertical border (#12741) @romgrk
24
+ - [DataGrid] Fix invalid date error when filtering `date`/`dateTime` columns (#12709) @cherniavskii
25
+ - [DataGrid] Fix overflow with dynamic row height (#12683) @romgrk
26
+ - [DataGrid] Make colors customizable (#12614) @romgrk
27
+ - [l10n] Improve French (fr-FR) locale (#12755) @derek-0000
28
+ - [l10n] Improve German (de-DE) locale (#12752) @Jens-Schoen
29
+ - [l10n] Improve Swedish (sv-SE) locale (#12731) @pontusdacke
30
+
31
+ #### `@mui/x-data-grid-pro@7.2.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
32
+
33
+ Same changes as in `@mui/x-data-grid@7.2.0`.
34
+
35
+ #### `@mui/x-data-grid-premium@7.2.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
36
+
37
+ Same changes as in `@mui/x-data-grid-pro@7.2.0`, plus:
38
+
39
+ - [DataGridPremium] Fix clipboard paste not working when cell loses focus (#12724) @cherniavskii
40
+
41
+ ### Date and Time Pickers
42
+
43
+ #### `@mui/x-date-pickers@7.2.0`
44
+
45
+ - [fields] Fix field editing after closing the picker (#12675) @LukasTy
46
+ - [l10n] Improve French (fr-FR) locale (#12692) @FaroukBel
47
+ - [l10n] Improve German (de-DE) locale (#12752) @Jens-Schoen
48
+ - [l10n] Improve Swedish (sv-SE) locale (#12731) @pontusdacke
49
+ - [pickers] Fix desktop date time Pickers grid layout (#12748) @LukasTy
50
+
51
+ #### `@mui/x-date-pickers-pro@7.2.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
52
+
53
+ Same changes as in `@mui/x-date-pickers@7.2.0`, plus:
54
+
55
+ - [DateTimeRangePicker] Fix desktop toolbar style (#12760) @LukasTy
56
+
57
+ ### Charts
58
+
59
+ #### `@mui/x-charts@7.2.0`
60
+
61
+ - [charts] Fix Bar chart with empty dataset throwing an error (#12708) @JCQuintas
62
+ - [charts] Fix `tickLabelInterval` not working on `YAxis` (#12746) @JCQuintas
63
+
64
+ ### Tree View
65
+
66
+ #### `@mui/x-tree-view@7.2.0`
67
+
68
+ - [TreeView] Add a new lookup to access an item index without expansive computation (#12729) @flaviendelangle
69
+ - [TreeView] Clean up usage of term "node" in internals (#12655) @noraleonte
70
+ - [TreeView] Improve performance by removing `getNavigableChildrenIds` method (#12713) @flaviendelangle
71
+ - [TreeView] Remove `state.items.itemTree` (#12717) @flaviendelangle
72
+ - [TreeView] Remove remaining occurences of the word "node" in the codebase (#12712) @flaviendelangle
73
+ - [TreeView] Return `instance` and `publicAPI` methods from plugin and populate the main objects inside `useTreeView` (#12650) @flaviendelangle
74
+ - [TreeView] Fix behaviors when the item order changes (#12369) @flaviendelangle
75
+
76
+ ### Docs
77
+
78
+ - [docs] Add `AxisFormatter` documentation for customizing tick/tooltip value formatting (#12700) @JCQuintas
79
+ - [docs] Add file explorer example to rich tree view customization docs (#12707) @noraleonte
80
+ - [docs] Do not use import of depth 3 in the doc (#12716) @flaviendelangle
81
+ - [docs] Explain how to clip plots with composition (#12679) @alexfauquette
82
+ - [docs] Fix typo in Data Grid v7 migration page (#12720) @bfaulk96
83
+ - [docs] Fix typo in Pickers v7 migration page (#12721) @bfaulk96
84
+
85
+ ### Core
86
+
87
+ - [core] Support multiple resolved `l10n` PR packages (#12735) @LukasTy
88
+ - [core] Update Netlify release references in release README (#12687) @LukasTy
89
+ - [core] Use `describeTreeView` for icons tests (#12672) @flaviendelangle
90
+ - [core] Use `describeTreeView` in existing tests for `useTreeViewItems` (#12732) @flaviendelangle
91
+
92
+ ## 7.1.1
93
+
94
+ _Apr 5, 2024_
95
+
96
+ We'd like to offer a big thanks to the 19 contributors who made this release possible. Here are some highlights ✨:
97
+
98
+ - 🚀 Add `setItemExpansion` Tree View API method (#12595) @flaviendelangle
99
+ - 🌍 Improve Persian (fa-IR), Portuguese (pt-BR), and Spanish (es-ES) locale on the Data Grid
100
+ - 🌍 Improve Persian (fa-IR), Portuguese (pt-BR), and Ukrainian (uk-UA) locale on the Pickers
101
+ - 🐞 Bugfixes
102
+ - 📚 Documentation improvements
103
+
104
+ ### Data Grid
105
+
106
+ #### `@mui/x-data-grid@7.1.1`
107
+
108
+ - [DataGrid] Allow higher packages' props to be used in MIT (#12365) @MBilalShafi
109
+ - [DataGrid] Fix RTL mode (#12583) @romgrk
110
+ - [DataGrid] Fix `ColDefChangesGridNoSnap` demo crash (#12663) @MBilalShafi
111
+ - [DataGrid] Fix server-side filter demo not working (#12662) @MBilalShafi
112
+ - [DataGrid] Log error if `rowCount` is used with client-side pagination (#12448) @michelengelen
113
+ - [DataGrid] Remove `GridFormatterParams` completely (#12660) @romgrk
114
+ - [DataGrid] Restore main slot (#12657) @romgrk
115
+ - [l10n] Improve Persian (fa-IR) locale (#12630) @amirhosseinzf
116
+ - [l10n] Improve Portuguese (pt-BR) locale (#12618) @hugoalkimim
117
+ - [l10n] Improve Spanish (es-ES) locale (#12606) @aitor40
118
+
119
+ #### `@mui/x-data-grid-pro@7.1.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
120
+
121
+ Same changes as in `@mui/x-data-grid@7.1.1`.
122
+
123
+ #### `@mui/x-data-grid-premium@7.1.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
124
+
125
+ Same changes as in `@mui/x-data-grid-pro@7.1.1`.
126
+
127
+ ### Date and Time Pickers
128
+
129
+ #### `@mui/x-date-pickers@7.1.1`
130
+
131
+ - [fields] Fix `readOnly` behavior (#12609) @LukasTy
132
+ - [l10n] Improve Persian (fa-IR) locale (#12632) @misafari
133
+ - [l10n] Improve Portuguese (pt-BR) locale (#12613) @cnHealth
134
+ - [l10n] Improve Ukrainian (uk-UA) locale (#12627) @alexkobylansky
135
+
136
+ #### `@mui/x-date-pickers-pro@7.1.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
137
+
138
+ Same changes as in `@mui/x-date-pickers@7.1.1`, plus:
139
+
140
+ - [DateTimeRangePicker] Fix selection on same day (#12604) @LukasTy
141
+
142
+ ### Charts
143
+
144
+ #### `@mui/x-charts@7.1.1`
145
+
146
+ - [charts] Fix `tickInterval` usage for y-axis (#12592) @alexfauquette
147
+ - [charts] Fix Scatter series highlight when `id` is a `number` (#12677) @JCQuintas
148
+ - [charts] Fix TS error when using `sx` property on `ChartsTooltip` (#12659) @JCQuintas
149
+
150
+ ### Tree View
151
+
152
+ #### `@mui/x-tree-view@7.1.1`
153
+
154
+ - [TreeView] Add JSDoc to all `publicAPI` methods (#12649) @flaviendelangle
155
+ - [TreeView] Create `RichTreeViewPro` component (not released yet) (#12610) @flaviendelangle
156
+ - [TreeView] Create pro package (not released yet) (#12240) @flaviendelangle
157
+ - [TreeView] Fix typo in errors (#12623) @alissa-tung
158
+ - [TreeView] New API method: `setItemExpansion` (#12595) @flaviendelangle
159
+
160
+ ### Docs
161
+
162
+ - [docs] Add a recipe for the `checkboxSelectionVisibleOnly` prop (#12646) @michelengelen
163
+ - [docs] Explain the use of `_action: 'delete'` in `processRowUpdate` (#12670) @michelengelen
164
+ - [docs] Fix formatting and typo on migration guide @oliviertassinari
165
+ - [docs] Fix formatting in changelog @oliviertassinari
166
+ - [docs] Fix grammar in TreeView migration doc (#12615) @joshkel
167
+ - [docs] Fix missing closing props in `PieShapeNoSnap` demo (#12636) @alp-ex
168
+ - [docs] Fix type arguments in Custom Field page (#12619) @Juneezee
169
+ - [docs] Fix typo in `getItemId` prop description (#12637) @flaviendelangle
170
+ - [docs] Make the Charts `margin` usage more visible (#12591) @alexfauquette
171
+ - [docs] Match IE 11 spacing with Material UI @oliviertassinari
172
+ - [docs] Move data grid interfaces to standard API page layout (#12016) @alexfauquette
173
+ - [docs] Remove ` around @default values (#12158) @alexfauquette
174
+ - [docs] Remove `day` from the default `dayOfWeekFormatter` function params (#12644) @LukasTy
175
+ - [docs] Use `TreeItem2` for icon expansion example on `RichTreeView` (#12563) @flaviendelangle
176
+
177
+ ### Core
178
+
179
+ - [core] Add cherry-pick `master` to `v6` action (#12648) @LukasTy
180
+ - [core] Fix typo in `@mui/x-tree-view-pro/themeAugmentation` (#12674) @flaviendelangle
181
+ - [core] Introduce `describeTreeView` to run test on `SimpleTreeView` and `RichTreeView`, using `TreeItem` and `TreeItem2` + migrate expansion tests (#12428) @flaviendelangle
182
+ - [core] Limit `test-types` CI step allowed memory (#12651) @LukasTy
183
+ - [core] Remove explicit `express` package (#12602) @LukasTy
184
+ - [core] Update to new embedded translations in the docs package (#12232) @Janpot
185
+ - [core] Use PR labels to identify the package a `l10n` PR belongs to (#12639) @LukasTy
186
+ - [core] Use `describeTreeView` for selection tests (#12647) @flaviendelangle
187
+ - [docs-infra] Adjust the links to search for issues (#11995) @michelengelen
188
+ - [infra] Polish support survey experience (#12624) @oliviertassinari
189
+ - [support-infra] Replace author association with a permission check in survey action (#12068) @michelengelen
190
+ - [support-infra] Fix user permission check (#12669) @michelengelen
191
+ - [test] Fix Tree View test import (#12668) @LukasTy
192
+
6
193
  ## 7.1.0
7
194
 
8
195
  _Mar 28, 2024_
@@ -74,7 +261,7 @@ Same changes as in `@mui/x-date-pickers@7.1.0`, plus:
74
261
  - [core] Include `DateTimeRangePicker` tag in `releaseChangelog` (#12526) @LukasTy
75
262
  - [core] Upgrade monorepo (#12536) @cherniavskii
76
263
 
77
- ## v7.0.0
264
+ ## 7.0.0
78
265
 
79
266
  _Mar 22, 2024_
80
267
 
@@ -530,13 +717,13 @@ We'd like to offer a big thanks to the 10 contributors who made this release pos
530
717
 
531
718
  - 🎁 Introduce a new DOM structure for the field components that provides a better accessibility
532
719
  - 🚀 Simplify Data Grid DOM structure for improved performance (#12013) @romgrk
533
- - 🕥 The support for IE11 has been removed (#12151) @flaviendelangle
720
+ - 🕥 The support for IE 11 has been removed (#12151) @flaviendelangle
534
721
  - 🐞 Bugfixes
535
722
  - 📚 Documentation improvements
536
723
 
537
724
  ### Breaking changes
538
725
 
539
- - The support for IE11 has been removed from all MUI X packages. The `legacy` bundle that used to support old browsers like IE11 is no longer included.
726
+ - The support for IE 11 has been removed from all MUI X packages. The `legacy` bundle that used to support old browsers like IE 11 is no longer included.
540
727
 
541
728
  ### Data Grid
542
729
 
@@ -641,7 +828,7 @@ These components are no longer exported from `@mui/x-charts`:
641
828
 
642
829
  ### Tree View / `@mui/x-tree-view@7.0.0-beta.4`
643
830
 
644
- - [TreeView] Stop using custom `findIndex` to support IE11 (#12129) @flaviendelangle
831
+ - [TreeView] Stop using custom `findIndex` to support IE 11 (#12129) @flaviendelangle
645
832
 
646
833
  ### Docs
647
834
 
@@ -2871,6 +3058,76 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
2871
3058
  - [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
2872
3059
  - [license] Correctly throw errors (#10924) @oliviertassinari
2873
3060
 
3061
+ ## 6.19.9
3062
+
3063
+ _Apr 5, 2024_
3064
+
3065
+ We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
3066
+
3067
+ - 🐞 Bugfixes
3068
+ - 📚 Documentation improvements
3069
+
3070
+ ### Data Grid
3071
+
3072
+ #### `@mui/x-data-grid@6.19.9`
3073
+
3074
+ - [DataGrid] Remove legacy editing API event: `rowEditCommit` (#12087) @MBilalShafi
3075
+
3076
+ #### `@mui/x-data-grid-pro@6.19.9` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
3077
+
3078
+ Same changes as in `@mui/x-data-grid@6.19.9`.
3079
+
3080
+ #### `@mui/x-data-grid-premium@6.19.9` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
3081
+
3082
+ Same changes as in `@mui/x-data-grid-pro@6.19.9`.
3083
+
3084
+ ### Date Pickers
3085
+
3086
+ #### `@mui/x-date-pickers@6.19.9`
3087
+
3088
+ No changes.
3089
+
3090
+ #### `@mui/x-date-pickers-pro@6.19.9` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
3091
+
3092
+ - [DateRangePicker] Fix selection behavior with single input field when `readOnly` (#12605) @LukasTy
3093
+
3094
+ ### Docs
3095
+
3096
+ - [docs] Add a recipe for the `checkboxSelectionVisibleOnly` prop (#12667) @michelengelen
3097
+ - [docs] Explain the use of `_action: 'delete'` in `processRowUpdate` (#12673) @michelengelen
3098
+
3099
+ ### Core
3100
+
3101
+ - [core] Use Circle CI context (#12607) @cherniavskii
3102
+
3103
+ ## 6.19.8
3104
+
3105
+ _Mar 20, 2024_
3106
+
3107
+ We'd like to offer a big thanks to the 3 contributors who made this release possible.
3108
+
3109
+ ### Data Grid
3110
+
3111
+ #### `@mui/x-data-grid@6.19.8`
3112
+
3113
+ - [DataGrid] Fix `ElementType` usage (#12505) @cherniavskii
3114
+ - [DataGrid] Fix cell value formatting on copy (#12483) @sai6855
3115
+ - [DataGrid] Fix checkbox selection when filtering (#12485) @g1mishra
3116
+
3117
+ #### `@mui/x-data-grid-pro@6.19.8` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
3118
+
3119
+ Same changes as in `@mui/x-data-grid@6.19.8`.
3120
+
3121
+ #### `@mui/x-data-grid-premium@6.19.8` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
3122
+
3123
+ Same changes as in `@mui/x-data-grid-pro@6.19.8`, plus:
3124
+
3125
+ - [DataGridPremium] Add support for confirmation before clipboard paste (#12466) @cherniavskii
3126
+
3127
+ ### Docs
3128
+
3129
+ - [docs] Update links to v7 (#12495) @cherniavskii
3130
+
2874
3131
  ## 6.19.7
2875
3132
 
2876
3133
  _Mar 14, 2024_
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MUI X Tree View
2
2
 
3
- This package is the community edition of the tree view components.
3
+ This package is the Community plan edition of the Tree View components.
4
4
  It's part of [MUI X](https://mui.com/x/), an open-core extension of MUI Core, with advanced components.
5
5
 
6
6
  ## Installation
@@ -3,7 +3,7 @@ import { RichTreeViewProps } from './RichTreeView.types';
3
3
  export declare const RichTreeViewRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
4
4
  ownerState: RichTreeViewProps<any, any>;
5
5
  }, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, keyof React.ClassAttributes<HTMLUListElement> | keyof React.HTMLAttributes<HTMLUListElement>>, {}>;
6
- type TreeViewComponent = (<R extends {}, Multiple extends boolean | undefined = undefined>(props: RichTreeViewProps<R, Multiple> & React.RefAttributes<HTMLUListElement>) => React.JSX.Element) & {
6
+ type RichTreeViewComponent = (<R extends {}, Multiple extends boolean | undefined = undefined>(props: RichTreeViewProps<R, Multiple> & React.RefAttributes<HTMLUListElement>) => React.JSX.Element) & {
7
7
  propTypes?: any;
8
8
  };
9
9
  /**
@@ -16,5 +16,5 @@ type TreeViewComponent = (<R extends {}, Multiple extends boolean | undefined =
16
16
  *
17
17
  * - [RichTreeView API](https://mui.com/x/api/tree-view/rich-tree-view/)
18
18
  */
19
- declare const RichTreeView: TreeViewComponent;
19
+ declare const RichTreeView: RichTreeViewComponent;
20
20
  export { RichTreeView };
@@ -29,7 +29,8 @@ export const RichTreeViewRoot = styled('ul', {
29
29
  padding: 0,
30
30
  margin: 0,
31
31
  listStyle: 'none',
32
- outline: 0
32
+ outline: 0,
33
+ position: 'relative'
33
34
  });
34
35
  function WrappedTreeItem({
35
36
  slots,
@@ -138,7 +139,8 @@ process.env.NODE_ENV !== "production" ? RichTreeView.propTypes = {
138
139
  apiRef: PropTypes.shape({
139
140
  current: PropTypes.shape({
140
141
  focusItem: PropTypes.func.isRequired,
141
- getItem: PropTypes.func.isRequired
142
+ getItem: PropTypes.func.isRequired,
143
+ setItemExpansion: PropTypes.func.isRequired
142
144
  })
143
145
  }),
144
146
  /**
@@ -174,12 +176,12 @@ process.env.NODE_ENV !== "production" ? RichTreeView.propTypes = {
174
176
  */
175
177
  expandedItems: PropTypes.arrayOf(PropTypes.string),
176
178
  /**
177
- * Used to determine the string label for a given item.
179
+ * Used to determine the id of a given item.
178
180
  *
179
181
  * @template R
180
182
  * @param {R} item The item to check.
181
183
  * @returns {string} The id of the item.
182
- * @default `(item) => item.id`
184
+ * @default (item) => item.id
183
185
  */
184
186
  getItemId: PropTypes.func,
185
187
  /**
@@ -188,7 +190,7 @@ process.env.NODE_ENV !== "production" ? RichTreeView.propTypes = {
188
190
  * @template R
189
191
  * @param {R} item The item to check.
190
192
  * @returns {string} The label of the item.
191
- * @default `(item) => item.label`
193
+ * @default (item) => item.label
192
194
  */
193
195
  getItemLabel: PropTypes.func,
194
196
  /**
@@ -4,10 +4,10 @@ import { SxProps } from '@mui/system';
4
4
  import { SlotComponentProps } from '@mui/base/utils';
5
5
  import { RichTreeViewClasses } from './richTreeViewClasses';
6
6
  import { DefaultTreeViewPluginParameters, DefaultTreeViewPluginSlotProps, DefaultTreeViewPluginSlots, DefaultTreeViewPlugins } from '../internals/plugins/defaultPlugins';
7
- import { TreeItem, TreeItemProps } from '../TreeItem';
7
+ import { TreeItemProps } from '../TreeItem';
8
8
  import { TreeItem2Props } from '../TreeItem2';
9
9
  import { TreeViewItemId } from '../models';
10
- import { TreeViewPublicAPI } from '../internals/models';
10
+ import { SlotComponentPropsFromProps, TreeViewPublicAPI } from '../internals/models';
11
11
  interface RichTreeViewItemSlotOwnerState {
12
12
  itemId: TreeViewItemId;
13
13
  label: string;
@@ -26,7 +26,7 @@ export interface RichTreeViewSlots extends DefaultTreeViewPluginSlots {
26
26
  }
27
27
  export interface RichTreeViewSlotProps<R extends {}, Multiple extends boolean | undefined> extends DefaultTreeViewPluginSlotProps {
28
28
  root?: SlotComponentProps<'ul', {}, RichTreeViewProps<R, Multiple>>;
29
- item?: SlotComponentProps<typeof TreeItem, {}, RichTreeViewItemSlotOwnerState>;
29
+ item?: SlotComponentPropsFromProps<TreeItemProps | TreeItem2Props, {}, RichTreeViewItemSlotOwnerState>;
30
30
  }
31
31
  export type RichTreeViewApiRef = React.MutableRefObject<TreeViewPublicAPI<DefaultTreeViewPlugins> | undefined>;
32
32
  export interface RichTreeViewPropsBase extends React.HTMLAttributes<HTMLUListElement> {
@@ -28,7 +28,8 @@ export const SimpleTreeViewRoot = styled('ul', {
28
28
  padding: 0,
29
29
  margin: 0,
30
30
  listStyle: 'none',
31
- outline: 0
31
+ outline: 0,
32
+ position: 'relative'
32
33
  });
33
34
  const EMPTY_ITEMS = [];
34
35
  const itemsPropWarning = buildWarning(['MUI X: The `SimpleTreeView` component does not support the `items` prop.', 'If you want to add items, you need to pass them as JSX children.', 'Check the documentation for more details: https://mui.com/x/react-tree-view/simple-tree-view/items/']);
@@ -96,7 +97,8 @@ process.env.NODE_ENV !== "production" ? SimpleTreeView.propTypes = {
96
97
  apiRef: PropTypes.shape({
97
98
  current: PropTypes.shape({
98
99
  focusItem: PropTypes.func.isRequired,
99
- getItem: PropTypes.func.isRequired
100
+ getItem: PropTypes.func.isRequired,
101
+ setItemExpansion: PropTypes.func.isRequired
100
102
  })
101
103
  }),
102
104
  /**
@@ -270,7 +270,7 @@ export const TreeItem = /*#__PURE__*/React.forwardRef(function TreeItem(inProps,
270
270
  onKeyDown?.(event);
271
271
  instance.handleItemKeyDown(event, itemId);
272
272
  };
273
- const idAttribute = instance.getTreeItemId(itemId, id);
273
+ const idAttribute = instance.getTreeItemIdAttribute(itemId, id);
274
274
  const tabIndex = instance.canItemBeTabbed(itemId) ? 0 : -1;
275
275
  return /*#__PURE__*/_jsx(TreeItem2Provider, {
276
276
  itemId: itemId,
@@ -5,6 +5,9 @@ export declare const TreeItem2Content: import("@emotion/styled").StyledComponent
5
5
  export declare const TreeItem2Label: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
6
6
  export declare const TreeItem2IconContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
7
7
  export declare const TreeItem2GroupTransition: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Collapse").CollapseProps, keyof import("@mui/material/Collapse").CollapseProps> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
8
+ type TreeItem2Component = ((props: TreeItem2Props & React.RefAttributes<HTMLLIElement>) => React.JSX.Element) & {
9
+ propTypes?: any;
10
+ };
8
11
  /**
9
12
  *
10
13
  * Demos:
@@ -15,4 +18,5 @@ export declare const TreeItem2GroupTransition: import("@emotion/styled").StyledC
15
18
  *
16
19
  * - [TreeItem2 API](https://mui.com/x/api/tree-view/tree-item-2/)
17
20
  */
18
- export declare const TreeItem2: React.ForwardRefExoticComponent<TreeItem2Props & React.RefAttributes<HTMLLIElement>>;
21
+ export declare const TreeItem2: TreeItem2Component;
22
+ export {};
@@ -147,7 +147,6 @@ const useUtilityClasses = ownerState => {
147
147
  };
148
148
  return composeClasses(slots, getTreeItemUtilityClass, classes);
149
149
  };
150
-
151
150
  /**
152
151
  *
153
152
  * Demos:
@@ -70,7 +70,8 @@ process.env.NODE_ENV !== "production" ? TreeView.propTypes = {
70
70
  apiRef: PropTypes.shape({
71
71
  current: PropTypes.shape({
72
72
  focusItem: PropTypes.func.isRequired,
73
- getItem: PropTypes.func.isRequired
73
+ getItem: PropTypes.func.isRequired,
74
+ setItemExpansion: PropTypes.func.isRequired
74
75
  })
75
76
  }),
76
77
  /**
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-tree-view v7.1.0
2
+ * @mui/x-tree-view v7.2.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ export declare const TreeViewChildrenItemContext: React.Context<TreeViewChildrenItemContextValue | null>;
3
+ interface TreeViewChildrenItemProviderProps {
4
+ itemId?: string;
5
+ children: React.ReactNode;
6
+ }
7
+ export declare function TreeViewChildrenItemProvider(props: TreeViewChildrenItemProviderProps): React.JSX.Element;
8
+ export declare namespace TreeViewChildrenItemProvider {
9
+ var propTypes: any;
10
+ }
11
+ interface TreeViewChildrenItemContextValue {
12
+ registerChild: (idAttribute: string, itemId: string) => void;
13
+ unregisterChild: (idAttribute: string) => void;
14
+ parentId: string | null;
15
+ }
16
+ export {};
@@ -0,0 +1,57 @@
1
+ import * as React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { useTreeViewContext } from './useTreeViewContext';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ export const TreeViewChildrenItemContext = /*#__PURE__*/React.createContext(null);
6
+ if (process.env.NODE_ENV !== 'production') {
7
+ TreeViewChildrenItemContext.displayName = 'TreeViewChildrenItemContext';
8
+ }
9
+ export function TreeViewChildrenItemProvider(props) {
10
+ const {
11
+ children,
12
+ itemId = null
13
+ } = props;
14
+ const {
15
+ instance,
16
+ rootRef
17
+ } = useTreeViewContext();
18
+ const childrenIdAttrToIdRef = React.useRef(new Map());
19
+ React.useEffect(() => {
20
+ if (!rootRef.current) {
21
+ return;
22
+ }
23
+ let idAttr = null;
24
+ if (itemId == null) {
25
+ idAttr = rootRef.current.id;
26
+ } else {
27
+ // Undefined during 1st render
28
+ const itemMeta = instance.getItemMeta(itemId);
29
+ if (itemMeta !== undefined) {
30
+ idAttr = instance.getTreeItemIdAttribute(itemId, itemMeta.idAttribute);
31
+ }
32
+ }
33
+ if (idAttr == null) {
34
+ return;
35
+ }
36
+ const previousChildrenIds = instance.getItemOrderedChildrenIds(itemId ?? null) ?? [];
37
+ const childrenElements = rootRef.current.querySelectorAll(`${itemId == null ? '' : `*[id="${idAttr}"] `}[role="treeitem"]:not(*[id="${idAttr}"] [role="treeitem"] [role="treeitem"])`);
38
+ const childrenIds = Array.from(childrenElements).map(child => childrenIdAttrToIdRef.current.get(child.id));
39
+ const hasChanged = childrenIds.length !== previousChildrenIds.length || childrenIds.some((childId, index) => childId !== previousChildrenIds[index]);
40
+ if (hasChanged) {
41
+ instance.setJSXItemsOrderedChildrenIds(itemId ?? null, childrenIds);
42
+ }
43
+ });
44
+ const value = React.useMemo(() => ({
45
+ registerChild: (childIdAttribute, childItemId) => childrenIdAttrToIdRef.current.set(childIdAttribute, childItemId),
46
+ unregisterChild: childIdAttribute => childrenIdAttrToIdRef.current.delete(childIdAttribute),
47
+ parentId: itemId
48
+ }), [itemId]);
49
+ return /*#__PURE__*/_jsx(TreeViewChildrenItemContext.Provider, {
50
+ value: value,
51
+ children: children
52
+ });
53
+ }
54
+ process.env.NODE_ENV !== "production" ? TreeViewChildrenItemProvider.propTypes = {
55
+ children: PropTypes.node,
56
+ id: PropTypes.string
57
+ } : void 0;
@@ -5,6 +5,8 @@ import * as React from 'react';
5
5
  export declare const TreeViewContext: React.Context<{
6
6
  instance: {};
7
7
  publicAPI: {};
8
+ rootRef: React.RefObject<HTMLUListElement>;
8
9
  wrapItem: import("../models").TreeItemWrapper;
10
+ wrapRoot: import("../models").TreeRootWrapper;
9
11
  runItemPlugins: <TProps extends {}>(props: TProps) => Required<import("../models").TreeViewItemPluginResponse>;
10
12
  } | null>;
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { TreeViewContext } from './TreeViewContext';
3
- import { DescendantProvider } from './DescendantProvider';
4
3
  import { jsx as _jsx } from "react/jsx-runtime";
5
4
  /**
6
5
  * Sets up the contexts for the underlying TreeItem components.
@@ -14,8 +13,8 @@ export function TreeViewProvider(props) {
14
13
  } = props;
15
14
  return /*#__PURE__*/_jsx(TreeViewContext.Provider, {
16
15
  value: value,
17
- children: /*#__PURE__*/_jsx(DescendantProvider, {
18
- children: children
16
+ children: value.wrapRoot({
17
+ children
19
18
  })
20
19
  });
21
20
  }
@@ -1,9 +1,11 @@
1
1
  import * as React from 'react';
2
- import { MergePluginsProperty, TreeItemWrapper, TreeViewAnyPluginSignature, TreeViewInstance, TreeViewItemPluginResponse, TreeViewPublicAPI } from '../models';
2
+ import { MergePluginsProperty, TreeItemWrapper, TreeRootWrapper, TreeViewAnyPluginSignature, TreeViewInstance, TreeViewItemPluginResponse, TreeViewPublicAPI } from '../models';
3
3
  export type TreeViewContextValue<TPlugins extends readonly TreeViewAnyPluginSignature[]> = MergePluginsProperty<TPlugins, 'contextValue'> & {
4
4
  instance: TreeViewInstance<TPlugins>;
5
5
  publicAPI: TreeViewPublicAPI<TPlugins>;
6
+ rootRef: React.RefObject<HTMLUListElement>;
6
7
  wrapItem: TreeItemWrapper;
8
+ wrapRoot: TreeRootWrapper;
7
9
  runItemPlugins: <TProps extends {}>(props: TProps) => Required<TreeViewItemPluginResponse>;
8
10
  };
9
11
  export interface TreeViewProviderProps<TPlugins extends readonly TreeViewAnyPluginSignature[]> {
@@ -1,12 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { EventManager } from '../../utils/EventManager';
3
- import { populateInstance } from '../../useTreeView/useTreeView.utils';
4
3
  const isSyntheticEvent = event => {
5
4
  return event.isPropagationStopped !== undefined;
6
5
  };
7
- export const useTreeViewInstanceEvents = ({
8
- instance
9
- }) => {
6
+ export const useTreeViewInstanceEvents = () => {
10
7
  const [eventManager] = React.useState(() => new EventManager());
11
8
  const publishEvent = React.useCallback((...args) => {
12
9
  const [name, params, event = {}] = args;
@@ -22,9 +19,11 @@ export const useTreeViewInstanceEvents = ({
22
19
  eventManager.removeListener(event, handler);
23
20
  };
24
21
  }, [eventManager]);
25
- populateInstance(instance, {
26
- $$publishEvent: publishEvent,
27
- $$subscribeEvent: subscribeEvent
28
- });
22
+ return {
23
+ instance: {
24
+ $$publishEvent: publishEvent,
25
+ $$subscribeEvent: subscribeEvent
26
+ }
27
+ };
29
28
  };
30
29
  useTreeViewInstanceEvents.params = {};
@@ -1,15 +1,25 @@
1
1
  export { useTreeView } from './useTreeView';
2
2
  export { TreeViewProvider } from './TreeViewProvider';
3
- export type { TreeViewPlugin, TreeViewPluginSignature } from './models';
3
+ export { unstable_resetCleanupTracking } from './hooks/useInstanceEventHandler';
4
+ export type { TreeViewPlugin, TreeViewPluginSignature, ConvertPluginsIntoSignatures, MergePluginsProperty, TreeViewPublicAPI, } from './models';
4
5
  export { DEFAULT_TREE_VIEW_PLUGINS } from './plugins/defaultPlugins';
5
6
  export type { DefaultTreeViewPlugins, DefaultTreeViewPluginSlots, DefaultTreeViewPluginSlotProps, } from './plugins/defaultPlugins';
6
7
  export type { DefaultTreeViewPluginParameters } from './plugins/defaultPlugins';
7
- export type { UseTreeViewExpansionSignature } from './plugins/useTreeViewExpansion';
8
- export type { UseTreeViewSelectionSignature } from './plugins/useTreeViewSelection';
9
- export type { UseTreeViewFocusSignature } from './plugins/useTreeViewFocus';
8
+ export { useTreeViewExpansion } from './plugins/useTreeViewExpansion';
9
+ export type { UseTreeViewExpansionSignature, UseTreeViewExpansionParameters, } from './plugins/useTreeViewExpansion';
10
+ export { useTreeViewSelection } from './plugins/useTreeViewSelection';
11
+ export type { UseTreeViewSelectionSignature, UseTreeViewSelectionParameters, } from './plugins/useTreeViewSelection';
12
+ export { useTreeViewFocus } from './plugins/useTreeViewFocus';
13
+ export type { UseTreeViewFocusSignature, UseTreeViewFocusParameters, } from './plugins/useTreeViewFocus';
14
+ export { useTreeViewKeyboardNavigation } from './plugins/useTreeViewKeyboardNavigation';
10
15
  export type { UseTreeViewKeyboardNavigationSignature } from './plugins/useTreeViewKeyboardNavigation';
11
- export type { UseTreeViewIdSignature } from './plugins/useTreeViewId';
12
- export type { UseTreeViewIconsSignature } from './plugins/useTreeViewIcons';
13
- export type { UseTreeViewItemsSignature } from './plugins/useTreeViewItems';
14
- export type { UseTreeViewJSXItemsSignature } from './plugins/useTreeViewJSXItems';
16
+ export { useTreeViewId } from './plugins/useTreeViewId';
17
+ export type { UseTreeViewIdSignature, UseTreeViewIdParameters } from './plugins/useTreeViewId';
18
+ export { useTreeViewIcons } from './plugins/useTreeViewIcons';
19
+ export type { UseTreeViewIconsSignature, UseTreeViewIconsParameters, } from './plugins/useTreeViewIcons';
20
+ export { useTreeViewItems } from './plugins/useTreeViewItems';
21
+ export type { UseTreeViewItemsSignature, UseTreeViewItemsParameters, } from './plugins/useTreeViewItems';
22
+ export { useTreeViewJSXItems } from './plugins/useTreeViewJSXItems';
23
+ export type { UseTreeViewJSXItemsSignature, UseTreeViewJSXItemsParameters, } from './plugins/useTreeViewJSXItems';
24
+ export { buildWarning } from './utils/warning';
15
25
  export { extractPluginParamsFromProps } from './utils/extractPluginParamsFromProps';