@mui/x-tree-view 7.3.1 → 7.5.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.
- package/CHANGELOG.md +234 -5
- package/RichTreeView/RichTreeView.js +6 -1
- package/SimpleTreeView/SimpleTreeView.js +6 -1
- package/TreeItem/TreeItem.js +7 -2
- package/TreeItem/TreeItemContent.d.ts +2 -0
- package/TreeItem/TreeItemContent.js +18 -1
- package/TreeItem/treeItemClasses.d.ts +2 -0
- package/TreeItem/treeItemClasses.js +1 -1
- package/TreeItem/useTreeItemState.d.ts +4 -1
- package/TreeItem/useTreeItemState.js +18 -2
- package/TreeItem2/TreeItem2.d.ts +4 -0
- package/TreeItem2/TreeItem2.js +34 -4
- package/TreeItem2/TreeItem2.types.d.ts +6 -0
- package/TreeItem2/index.d.ts +1 -1
- package/TreeItem2/index.js +1 -1
- package/TreeView/TreeView.js +6 -1
- package/hooks/useTreeItem2Utils/useTreeItem2Utils.d.ts +1 -0
- package/hooks/useTreeItem2Utils/useTreeItem2Utils.js +11 -2
- package/index.js +1 -1
- package/internals/models/plugin.d.ts +0 -6
- package/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +3 -3
- package/internals/plugins/useTreeViewSelection/useTreeViewSelection.js +18 -6
- package/internals/plugins/useTreeViewSelection/useTreeViewSelection.types.d.ts +16 -4
- package/modern/RichTreeView/RichTreeView.js +6 -1
- package/modern/SimpleTreeView/SimpleTreeView.js +6 -1
- package/modern/TreeItem/TreeItem.js +7 -2
- package/modern/TreeItem/TreeItemContent.js +18 -1
- package/modern/TreeItem/treeItemClasses.js +1 -1
- package/modern/TreeItem/useTreeItemState.js +18 -2
- package/modern/TreeItem2/TreeItem2.js +34 -4
- package/modern/TreeItem2/index.js +1 -1
- package/modern/TreeView/TreeView.js +6 -1
- package/modern/hooks/useTreeItem2Utils/useTreeItem2Utils.js +11 -2
- package/modern/index.js +1 -1
- package/modern/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +3 -3
- package/modern/internals/plugins/useTreeViewSelection/useTreeViewSelection.js +18 -6
- package/modern/useTreeItem2/useTreeItem2.js +35 -6
- package/node/RichTreeView/RichTreeView.js +6 -1
- package/node/SimpleTreeView/SimpleTreeView.js +6 -1
- package/node/TreeItem/TreeItem.js +7 -2
- package/node/TreeItem/TreeItemContent.js +18 -1
- package/node/TreeItem/treeItemClasses.js +1 -1
- package/node/TreeItem/useTreeItemState.js +18 -2
- package/node/TreeItem2/TreeItem2.js +35 -5
- package/node/TreeItem2/index.js +6 -0
- package/node/TreeView/TreeView.js +6 -1
- package/node/hooks/useTreeItem2Utils/useTreeItem2Utils.js +11 -2
- package/node/index.js +1 -1
- package/node/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +3 -3
- package/node/internals/plugins/useTreeViewSelection/useTreeViewSelection.js +18 -6
- package/node/useTreeItem2/useTreeItem2.js +37 -6
- package/package.json +3 -3
- package/useTreeItem2/useTreeItem2.js +35 -6
- package/useTreeItem2/useTreeItem2.types.d.ts +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,213 @@
|
|
|
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
|
+
## v7.5.0
|
|
7
|
+
|
|
8
|
+
_May 17, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 Add support for checkbox selection on the Tree View components
|
|
13
|
+
- 🌍 Improve Norwegian (nb-NO) and Spanish (es-ES) locales on the Data Grid
|
|
14
|
+
- 🐞 Bugfixes
|
|
15
|
+
- 📚 Documentation improvements
|
|
16
|
+
|
|
17
|
+
### Data Grid
|
|
18
|
+
|
|
19
|
+
#### `@mui/x-data-grid@7.5.0`
|
|
20
|
+
|
|
21
|
+
- [DataGrid] Fix `rowModesModel` controlled prop (#13056) @Janpot
|
|
22
|
+
- [DataGrid] Reduce bundle size with error messages (#12992) @oliviertassinari
|
|
23
|
+
- [l10n] Improve Norwegian (nb-NO) locale (#13106) @oliverlaidma
|
|
24
|
+
- [l10n] Improve Spanish (es-ES) locale (#13133) @Jucabel
|
|
25
|
+
|
|
26
|
+
#### `@mui/x-data-grid-pro@7.5.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
27
|
+
|
|
28
|
+
Same changes as in `@mui/x-data-grid@7.5.0`.
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid-premium@7.5.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
31
|
+
|
|
32
|
+
Same changes as in `@mui/x-data-grid-pro@7.5.0`.
|
|
33
|
+
|
|
34
|
+
### Date and Time Pickers
|
|
35
|
+
|
|
36
|
+
#### `@mui/x-date-pickers@7.5.0`
|
|
37
|
+
|
|
38
|
+
- [fields] Allow empty `textField` slot placeholder value (#13148) @arthurbalduini
|
|
39
|
+
- [pickers] Fix `AdapterMomentJalaali` regression (#13144) @LukasTy
|
|
40
|
+
- [pickers] Fix field focusing when switching to view without a renderer (#13112) @LukasTy
|
|
41
|
+
- [pickers] Reuse `AdapterDateFnsBase` in Jalali adapters (#13075) @LukasTy
|
|
42
|
+
|
|
43
|
+
#### `@mui/x-date-pickers-pro@7.5.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
44
|
+
|
|
45
|
+
Same changes as in `@mui/x-date-pickers@7.5.0`.
|
|
46
|
+
|
|
47
|
+
### Charts
|
|
48
|
+
|
|
49
|
+
#### `@mui/x-charts@7.5.0`
|
|
50
|
+
|
|
51
|
+
- [charts] Tooltip with `trigger=axis` now follow touch on mobile (#13043) @wzdorowa
|
|
52
|
+
- [charts] Allow `series.label` property to receive a function with the "location" it is going to be displayed on (#12830) @JCQuintas
|
|
53
|
+
- [charts] Improve TypeScript performance (#13137) @alexfauquette
|
|
54
|
+
- [charts] Fix area order when overlapping (#13121) @alexfauquette
|
|
55
|
+
- [charts] Improve `useSlotProps` types (#13141) @alexfauquette
|
|
56
|
+
- [charts] Fix using the theme's font in the Overlay (#13107) @alexfauquette
|
|
57
|
+
|
|
58
|
+
### Tree View
|
|
59
|
+
|
|
60
|
+
#### `@mui/x-tree-view@7.5.0`
|
|
61
|
+
|
|
62
|
+
- [TreeView] Add support for checkbox selection (#11452) @flaviendelangle
|
|
63
|
+
- [TreeView] Remove unused code (#12917) @flaviendelangle
|
|
64
|
+
|
|
65
|
+
### Docs
|
|
66
|
+
|
|
67
|
+
- [docs] Document missing Charts API's (#12875) @alexfauquette
|
|
68
|
+
|
|
69
|
+
### Core
|
|
70
|
+
|
|
71
|
+
- [core] Avoid root level `@mui/x-date-pickers` imports (#13120) @LukasTy
|
|
72
|
+
- [core] Refactor ESLint config to disallow root level imports (#13130) @LukasTy
|
|
73
|
+
- [core] Simplify Danger's config (#13062) @oliviertassinari
|
|
74
|
+
- [core] Shift aliasing from babel to webpack (#13051) @Janpot
|
|
75
|
+
- [core] Reuse the `SectionTitle` component in the doc (#13139) @alexfauquette
|
|
76
|
+
|
|
77
|
+
## 7.4.0
|
|
78
|
+
|
|
79
|
+
_May 10, 2024_
|
|
80
|
+
|
|
81
|
+
We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
82
|
+
|
|
83
|
+
- ✨ Add optional `id` attribute on shortcut items of the Date and Time Pickers
|
|
84
|
+
- 🎁 Add support for `date-fns-jalali` v3 in the Date and Time Pickers
|
|
85
|
+
- 🚀 Support rounded corners on `BarChart`
|
|
86
|
+
- 🌍 Add accessibility page to TreeView docs
|
|
87
|
+
- 🐞 Bugfixes
|
|
88
|
+
- 📚 Documentation improvements
|
|
89
|
+
|
|
90
|
+
### Data Grid
|
|
91
|
+
|
|
92
|
+
#### `@mui/x-data-grid@7.4.0`
|
|
93
|
+
|
|
94
|
+
- [DataGrid] Fix error when focus moves from column header to `svg` element (#13028) @oukunan
|
|
95
|
+
- [DataGrid] Fix error on column groups change (#12965) @romgrk
|
|
96
|
+
|
|
97
|
+
#### `@mui/x-data-grid-pro@7.4.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
98
|
+
|
|
99
|
+
Same changes as in `@mui/x-data-grid@7.4.0`.
|
|
100
|
+
|
|
101
|
+
#### `@mui/x-data-grid-premium@7.4.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
102
|
+
|
|
103
|
+
Same changes as in `@mui/x-data-grid-pro@7.4.0`.
|
|
104
|
+
|
|
105
|
+
### Date and Time Pickers
|
|
106
|
+
|
|
107
|
+
#### `@mui/x-date-pickers@7.4.0`
|
|
108
|
+
|
|
109
|
+
- [fields] Fix regression preventing form submit on "Enter" click (#13065) @LukasTy
|
|
110
|
+
- [pickers] Add `AdapterDateFnsJalaliV3` adapter (#12891) @smmoosavi
|
|
111
|
+
- [pickers] Add optional `id` attribute on shortcut items (#12976) @noraleonte
|
|
112
|
+
|
|
113
|
+
#### `@mui/x-date-pickers-pro@7.4.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
114
|
+
|
|
115
|
+
Same changes as in `@mui/x-date-pickers@7.4.0`.
|
|
116
|
+
|
|
117
|
+
### Charts
|
|
118
|
+
|
|
119
|
+
#### `@mui/x-charts@7.4.0`
|
|
120
|
+
|
|
121
|
+
- [charts] Add `ChartsGrid` to `themeAugmentation` (#13026) @noraleonte
|
|
122
|
+
- [charts] Support rounded corners on `BarChart` (#12834) @JCQuintas
|
|
123
|
+
|
|
124
|
+
### Tree View
|
|
125
|
+
|
|
126
|
+
#### `@mui/x-tree-view@7.4.0`
|
|
127
|
+
|
|
128
|
+
- [TreeView] Fix props propagation and theme entry in `TreeItem2` (#12889) @flaviendelangle
|
|
129
|
+
|
|
130
|
+
### Docs
|
|
131
|
+
|
|
132
|
+
- [docs] Add accessibility page to TreeView docs (#12845) @noraleonte
|
|
133
|
+
- [docs] Fix Charts styling typos (#13061) @oliviertassinari
|
|
134
|
+
- [docs] Fix legal link to EULA free trial (#13013) @oliviertassinari
|
|
135
|
+
- [docs] Update interface name in pinned columns docs (#13070) @cherniavskii
|
|
136
|
+
|
|
137
|
+
### Core
|
|
138
|
+
|
|
139
|
+
- [core] Improve release process docs (#12977) @JCQuintas
|
|
140
|
+
- [core] Prepare React 19 (#12991) @oliviertassinari
|
|
141
|
+
- [docs-infra] Fix Netlify PR preview path (#12993) @oliviertassinari
|
|
142
|
+
- [infra] Automation: Add release PR reviewers (#12982) @michelengelen
|
|
143
|
+
|
|
144
|
+
## 7.3.2
|
|
145
|
+
|
|
146
|
+
_May 2, 2024_
|
|
147
|
+
|
|
148
|
+
We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
149
|
+
|
|
150
|
+
- 🎁 Add "no data" and "loading" states to charts, allowing users to create [custom visualizations for each state](https://mui.com/x/react-charts/styling/#overlay)
|
|
151
|
+
- 🌍 Improve Hebrew (he-IL) and Hungarian (hu-HU) locales on the Date and Time Pickers
|
|
152
|
+
- 🌍 Improve Danish (da-DK) and Slovak (sk-SK) locales on the Data Grid
|
|
153
|
+
- 📝 Fix a [typo](https://github.com/mui/mui-x/pull/12941/files/4bf4bffbc2799a01a96bc7458a17318cf41c1722#diff-26c31cc69d6f51110f89e339578ef9b3d4a3551f79077fff73f7babb81c5099f) in the auto-generated Charts gradient `id` attribute.
|
|
154
|
+
It should not affect you, but if you were relying on the gradient `id` attribute, please update your usage.
|
|
155
|
+
- 🐞 Bugfixes
|
|
156
|
+
- 📚 Documentation improvements
|
|
157
|
+
|
|
158
|
+
### Data Grid
|
|
159
|
+
|
|
160
|
+
#### `@mui/x-data-grid@7.3.2`
|
|
161
|
+
|
|
162
|
+
- [DataGrid] Allow to change reset text in the columns management panel (#12972) @MBilalShafi
|
|
163
|
+
- [DataGrid] Derive `formattedValue` from the edit value when passing to `renderEditCell` (#12870) @cherniavskii
|
|
164
|
+
- [DataGrid] Fix rows not being recomputed on `props.rowCount` change (#12833) @MBilalShafi
|
|
165
|
+
- [l10n] Improve Danish (da-DK) locale (#12844) @fosterbuster
|
|
166
|
+
- [l10n] Improve Slovak (sk-SK) locale (#12949) @stefikp
|
|
167
|
+
|
|
168
|
+
#### `@mui/x-data-grid-pro@7.3.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
169
|
+
|
|
170
|
+
Same changes as in `@mui/x-data-grid@7.3.2`.
|
|
171
|
+
|
|
172
|
+
#### `@mui/x-data-grid-premium@7.3.2` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
173
|
+
|
|
174
|
+
Same changes as in `@mui/x-data-grid-pro@7.3.2`, plus:
|
|
175
|
+
|
|
176
|
+
- [DataGridPremium] Fix print export not working with row grouping (#12957) @MBilalShafi
|
|
177
|
+
|
|
178
|
+
### Date and Time Pickers
|
|
179
|
+
|
|
180
|
+
#### `@mui/x-date-pickers@7.3.2`
|
|
181
|
+
|
|
182
|
+
- [l10n] Improve Hebrew (he-IL) locale (#12910) @michaelNXT1
|
|
183
|
+
- [l10n] Improve Hungarian (hu-HU) locale (#12930) @noherczeg
|
|
184
|
+
- [pickers] Fix typo on the `viewRenderers` prop description (#12915) @flaviendelangle
|
|
185
|
+
- [pickers] Improve TypeScript performance in `PickersDay` (#12920) @flaviendelangle
|
|
186
|
+
|
|
187
|
+
#### `@mui/x-date-pickers-pro@7.3.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
188
|
+
|
|
189
|
+
Same changes as in `@mui/x-date-pickers@7.3.2`.
|
|
190
|
+
|
|
191
|
+
### Charts
|
|
192
|
+
|
|
193
|
+
#### `@mui/x-charts@7.3.2`
|
|
194
|
+
|
|
195
|
+
- [charts] Add an overlay for "no data" or "loading" states (#12817) @alexfauquette
|
|
196
|
+
- [charts] Fix typos in documentation, translations and errors (#12941) @JCQuintas
|
|
197
|
+
- [charts] Fix `prop.slots` and `prop.slotProps` not passed to `<ChartsTooltip />` (#12939) @JCQuintas
|
|
198
|
+
|
|
199
|
+
### Docs
|
|
200
|
+
|
|
201
|
+
- [docs] Improve Data Grid migration guide (#12969) @MBilalShafi
|
|
202
|
+
- [docs] Polish references to the plans (#12922) @oliviertassinari
|
|
203
|
+
|
|
204
|
+
### Core
|
|
205
|
+
|
|
206
|
+
- [core] Fix dependencies (#12951) @LukasTy
|
|
207
|
+
- [core] Remove inconsistent blank lines (#12966) @oliviertassinari
|
|
208
|
+
- [code-infra] Bump node image used by CI in docker (#12961) @LukasTy
|
|
209
|
+
- [docs-infra] Remove no longer needed `next.config` settings (#12861) @oliviertassinari
|
|
210
|
+
- [docs-infra] Use the `@mui/docs/HighlightedCode` (#12848) @alexfauquette
|
|
211
|
+
- [test] Restore `t` command (#12948) @LukasTy
|
|
212
|
+
|
|
6
213
|
## 7.3.1
|
|
7
214
|
|
|
8
215
|
_Apr 26, 2024_
|
|
@@ -305,7 +512,7 @@ Same changes as in `@mui/x-date-pickers@7.1.1`, plus:
|
|
|
305
512
|
|
|
306
513
|
- [TreeView] Add JSDoc to all `publicAPI` methods (#12649) @flaviendelangle
|
|
307
514
|
- [TreeView] Create `RichTreeViewPro` component (not released yet) (#12610) @flaviendelangle
|
|
308
|
-
- [TreeView] Create
|
|
515
|
+
- [TreeView] Create Pro package (not released yet) (#12240) @flaviendelangle
|
|
309
516
|
- [TreeView] Fix typo in errors (#12623) @alissa-tung
|
|
310
517
|
- [TreeView] New API method: `setItemExpansion` (#12595) @flaviendelangle
|
|
311
518
|
|
|
@@ -2517,7 +2724,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.3`.
|
|
|
2517
2724
|
- [core] Make `@mui/system` a direct dependency (#11128) @LukasTy
|
|
2518
2725
|
- [core] Remove blank lines, coding style @oliviertassinari
|
|
2519
2726
|
- [core] Remove outdated `ENABLE_AD` env variable (#11181) @oliviertassinari
|
|
2520
|
-
- [github] Do not add `plan: Pro` and `plan: Premium` labels on
|
|
2727
|
+
- [github] Do not add `plan: Pro` and `plan: Premium` labels on Pro / Premium issue templates (#10183) @flaviendelangle
|
|
2521
2728
|
|
|
2522
2729
|
## 7.0.0-alpha.2
|
|
2523
2730
|
|
|
@@ -3210,6 +3417,28 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
|
|
|
3210
3417
|
- [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
|
|
3211
3418
|
- [license] Correctly throw errors (#10924) @oliviertassinari
|
|
3212
3419
|
|
|
3420
|
+
## 6.19.12
|
|
3421
|
+
|
|
3422
|
+
_May 17, 2024_
|
|
3423
|
+
|
|
3424
|
+
We'd like to offer a big thanks to the 2 contributors who made this release possible. Here are some highlights ✨:
|
|
3425
|
+
|
|
3426
|
+
- 🐞 Bugfixes
|
|
3427
|
+
|
|
3428
|
+
### Date Pickers
|
|
3429
|
+
|
|
3430
|
+
#### `@mui/x-date-pickers@6.19.12`
|
|
3431
|
+
|
|
3432
|
+
- [pickers] Fix `AdapterMomentJalaali` regression (#13150) @LukasTy
|
|
3433
|
+
|
|
3434
|
+
#### `@mui/x-date-pickers-pro@6.19.12` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
3435
|
+
|
|
3436
|
+
Same changes as in `@mui/x-date-pickers@6.19.12`.
|
|
3437
|
+
|
|
3438
|
+
### Docs
|
|
3439
|
+
|
|
3440
|
+
- [docs] Use MUI X v6 in Codesandbox and Stackblitz demos (#12838) @cherniavskii
|
|
3441
|
+
|
|
3213
3442
|
## 6.19.11
|
|
3214
3443
|
|
|
3215
3444
|
_Apr 18, 2024_
|
|
@@ -3440,10 +3669,10 @@ Same changes as in `@mui/x-date-pickers@6.19.5`.
|
|
|
3440
3669
|
- [docs] Fix the Treemap illustration (#12189) @danilo-leal
|
|
3441
3670
|
- [docs] Fix typo for `AdapterDateFnsV3` (#12037) @flaviendelangle
|
|
3442
3671
|
- [docs] Improve performance on Charts entry point @oliviertassinari
|
|
3443
|
-
- [docs] Move Heatmap to
|
|
3672
|
+
- [docs] Move Heatmap to Pro (#12170) @alexfauquette
|
|
3444
3673
|
- [docs] Remove Charts installation next tag call-out (#12133) @LukasTy
|
|
3445
3674
|
- [docs] Removed `focused` prop from demo (#12126) @michelengelen
|
|
3446
|
-
- [docs] Add missing Heatmap
|
|
3675
|
+
- [docs] Add missing Heatmap Pro icon @oliviertassinari
|
|
3447
3676
|
- [docs] Add more illustrations to the Overview page (#12041) @danilo-leal
|
|
3448
3677
|
- [docs] Avoid use of shorthand (#12009) @oliviertassinari
|
|
3449
3678
|
|
|
@@ -6170,7 +6399,7 @@ We'd like to offer a big thanks to the 11 contributors who made this release pos
|
|
|
6170
6399
|
- [docs] Create examples of pickers with custom fields (#8034) @flaviendelangle
|
|
6171
6400
|
- [docs] Fix 301 redirections @oliviertassinari
|
|
6172
6401
|
- [docs] Fix link to React's docs @oliviertassinari
|
|
6173
|
-
- [docs] Fix
|
|
6402
|
+
- [docs] Fix Pro license links to point to the same page (#8303) @LukasTy
|
|
6174
6403
|
- [docs] Give an incentive to upgrade (#8269) @oliviertassinari
|
|
6175
6404
|
- [docs] Improve contrast on data grid navigation (#8239) @oliviertassinari
|
|
6176
6405
|
- [docs] Update shortcuts page to use slotProps (#8288) @dcorb
|
|
@@ -143,6 +143,11 @@ process.env.NODE_ENV !== "production" ? RichTreeView.propTypes = {
|
|
|
143
143
|
setItemExpansion: PropTypes.func.isRequired
|
|
144
144
|
})
|
|
145
145
|
}),
|
|
146
|
+
/**
|
|
147
|
+
* If `true`, the tree view renders a checkbox at the left of its label that allows selecting it.
|
|
148
|
+
* @default false
|
|
149
|
+
*/
|
|
150
|
+
checkboxSelection: PropTypes.bool,
|
|
146
151
|
/**
|
|
147
152
|
* Override or extend the styles applied to the component.
|
|
148
153
|
*/
|
|
@@ -207,7 +212,7 @@ process.env.NODE_ENV !== "production" ? RichTreeView.propTypes = {
|
|
|
207
212
|
isItemDisabled: PropTypes.func,
|
|
208
213
|
items: PropTypes.array.isRequired,
|
|
209
214
|
/**
|
|
210
|
-
* If true `ctrl` and `shift` will trigger multiselect.
|
|
215
|
+
* If `true`, `ctrl` and `shift` will trigger multiselect.
|
|
211
216
|
* @default false
|
|
212
217
|
*/
|
|
213
218
|
multiSelect: PropTypes.bool,
|
|
@@ -101,6 +101,11 @@ process.env.NODE_ENV !== "production" ? SimpleTreeView.propTypes = {
|
|
|
101
101
|
setItemExpansion: PropTypes.func.isRequired
|
|
102
102
|
})
|
|
103
103
|
}),
|
|
104
|
+
/**
|
|
105
|
+
* If `true`, the tree view renders a checkbox at the left of its label that allows selecting it.
|
|
106
|
+
* @default false
|
|
107
|
+
*/
|
|
108
|
+
checkboxSelection: PropTypes.bool,
|
|
104
109
|
/**
|
|
105
110
|
* The content of the component.
|
|
106
111
|
*/
|
|
@@ -143,7 +148,7 @@ process.env.NODE_ENV !== "production" ? SimpleTreeView.propTypes = {
|
|
|
143
148
|
*/
|
|
144
149
|
id: PropTypes.string,
|
|
145
150
|
/**
|
|
146
|
-
* If true `ctrl` and `shift` will trigger multiselect.
|
|
151
|
+
* If `true`, `ctrl` and `shift` will trigger multiselect.
|
|
147
152
|
* @default false
|
|
148
153
|
*/
|
|
149
154
|
multiSelect: PropTypes.bool,
|
package/TreeItem/TreeItem.js
CHANGED
|
@@ -32,6 +32,7 @@ const useUtilityClasses = ownerState => {
|
|
|
32
32
|
focused: ['focused'],
|
|
33
33
|
disabled: ['disabled'],
|
|
34
34
|
iconContainer: ['iconContainer'],
|
|
35
|
+
checkbox: ['checkbox'],
|
|
35
36
|
label: ['label'],
|
|
36
37
|
groupTransition: ['groupTransition']
|
|
37
38
|
};
|
|
@@ -113,7 +114,10 @@ const StyledTreeItemContent = styled(TreeItemContent, {
|
|
|
113
114
|
// fixes overflow - see https://github.com/mui/material-ui/issues/27372
|
|
114
115
|
minWidth: 0,
|
|
115
116
|
position: 'relative'
|
|
116
|
-
}, theme.typography.body1)
|
|
117
|
+
}, theme.typography.body1),
|
|
118
|
+
[`& .${treeItemClasses.checkbox}`]: {
|
|
119
|
+
padding: 0
|
|
120
|
+
}
|
|
117
121
|
}));
|
|
118
122
|
const TreeItemGroup = styled(Collapse, {
|
|
119
123
|
name: 'MuiTreeItem',
|
|
@@ -296,7 +300,8 @@ export const TreeItem = /*#__PURE__*/React.forwardRef(function TreeItem(inProps,
|
|
|
296
300
|
focused: classes.focused,
|
|
297
301
|
disabled: classes.disabled,
|
|
298
302
|
iconContainer: classes.iconContainer,
|
|
299
|
-
label: classes.label
|
|
303
|
+
label: classes.label,
|
|
304
|
+
checkbox: classes.checkbox
|
|
300
305
|
},
|
|
301
306
|
label: label,
|
|
302
307
|
itemId: itemId,
|
|
@@ -19,6 +19,8 @@ export interface TreeItemContentProps extends React.HTMLAttributes<HTMLElement>
|
|
|
19
19
|
iconContainer: string;
|
|
20
20
|
/** Styles applied to the label element. */
|
|
21
21
|
label: string;
|
|
22
|
+
/** Styles applied to the checkbox element. */
|
|
23
|
+
checkbox: string;
|
|
22
24
|
};
|
|
23
25
|
/**
|
|
24
26
|
* The tree item label.
|
|
@@ -4,6 +4,7 @@ const _excluded = ["classes", "className", "displayIcon", "expansionIcon", "icon
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
+
import Checkbox from '@mui/material/Checkbox';
|
|
7
8
|
import { useTreeItemState } from './useTreeItemState';
|
|
8
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
/**
|
|
@@ -27,11 +28,15 @@ const TreeItemContent = /*#__PURE__*/React.forwardRef(function TreeItemContent(p
|
|
|
27
28
|
expanded,
|
|
28
29
|
selected,
|
|
29
30
|
focused,
|
|
31
|
+
disableSelection,
|
|
32
|
+
checkboxSelection,
|
|
30
33
|
handleExpansion,
|
|
31
34
|
handleSelection,
|
|
35
|
+
handleCheckboxSelection,
|
|
32
36
|
preventSelection
|
|
33
37
|
} = useTreeItemState(itemId);
|
|
34
38
|
const icon = iconProp || expansionIcon || displayIcon;
|
|
39
|
+
const checkboxRef = React.useRef(null);
|
|
35
40
|
const handleMouseDown = event => {
|
|
36
41
|
preventSelection(event);
|
|
37
42
|
if (onMouseDown) {
|
|
@@ -39,8 +44,13 @@ const TreeItemContent = /*#__PURE__*/React.forwardRef(function TreeItemContent(p
|
|
|
39
44
|
}
|
|
40
45
|
};
|
|
41
46
|
const handleClick = event => {
|
|
47
|
+
if (checkboxRef.current?.contains(event.target)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
42
50
|
handleExpansion(event);
|
|
43
|
-
|
|
51
|
+
if (!checkboxSelection) {
|
|
52
|
+
handleSelection(event);
|
|
53
|
+
}
|
|
44
54
|
if (onClick) {
|
|
45
55
|
onClick(event);
|
|
46
56
|
}
|
|
@@ -56,6 +66,13 @@ const TreeItemContent = /*#__PURE__*/React.forwardRef(function TreeItemContent(p
|
|
|
56
66
|
children: [/*#__PURE__*/_jsx("div", {
|
|
57
67
|
className: classes.iconContainer,
|
|
58
68
|
children: icon
|
|
69
|
+
}), checkboxSelection && /*#__PURE__*/_jsx(Checkbox, {
|
|
70
|
+
className: classes.checkbox,
|
|
71
|
+
checked: selected,
|
|
72
|
+
onChange: handleCheckboxSelection,
|
|
73
|
+
disabled: disabled || disableSelection,
|
|
74
|
+
ref: checkboxRef,
|
|
75
|
+
tabIndex: -1
|
|
59
76
|
}), /*#__PURE__*/_jsx("div", {
|
|
60
77
|
className: classes.label,
|
|
61
78
|
children: label
|
|
@@ -17,6 +17,8 @@ export interface TreeItemClasses {
|
|
|
17
17
|
iconContainer: string;
|
|
18
18
|
/** Styles applied to the label element. */
|
|
19
19
|
label: string;
|
|
20
|
+
/** Styles applied to the checkbox element. */
|
|
21
|
+
checkbox: string;
|
|
20
22
|
}
|
|
21
23
|
export type TreeItemClassKey = keyof TreeItemClasses;
|
|
22
24
|
export declare function getTreeItemUtilityClass(slot: string): string;
|
|
@@ -3,4 +3,4 @@ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
|
3
3
|
export function getTreeItemUtilityClass(slot) {
|
|
4
4
|
return generateUtilityClass('MuiTreeItem', slot);
|
|
5
5
|
}
|
|
6
|
-
export const treeItemClasses = generateUtilityClasses('MuiTreeItem', ['root', 'groupTransition', 'content', 'expanded', 'selected', 'focused', 'disabled', 'iconContainer', 'label']);
|
|
6
|
+
export const treeItemClasses = generateUtilityClasses('MuiTreeItem', ['root', 'groupTransition', 'content', 'expanded', 'selected', 'focused', 'disabled', 'iconContainer', 'label', 'checkbox']);
|
|
@@ -4,7 +4,10 @@ export declare function useTreeItemState(itemId: string): {
|
|
|
4
4
|
expanded: boolean;
|
|
5
5
|
selected: boolean;
|
|
6
6
|
focused: boolean;
|
|
7
|
+
disableSelection: boolean;
|
|
8
|
+
checkboxSelection: boolean;
|
|
7
9
|
handleExpansion: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
8
|
-
handleSelection: (event: React.MouseEvent
|
|
10
|
+
handleSelection: (event: React.MouseEvent) => void;
|
|
11
|
+
handleCheckboxSelection: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
9
12
|
preventSelection: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
10
13
|
};
|
|
@@ -3,7 +3,9 @@ export function useTreeItemState(itemId) {
|
|
|
3
3
|
const {
|
|
4
4
|
instance,
|
|
5
5
|
selection: {
|
|
6
|
-
multiSelect
|
|
6
|
+
multiSelect,
|
|
7
|
+
checkboxSelection,
|
|
8
|
+
disableSelection
|
|
7
9
|
}
|
|
8
10
|
} = useTreeViewContext();
|
|
9
11
|
const expandable = instance.isItemExpandable(itemId);
|
|
@@ -37,10 +39,21 @@ export function useTreeItemState(itemId) {
|
|
|
37
39
|
instance.selectItem(event, itemId, true);
|
|
38
40
|
}
|
|
39
41
|
} else {
|
|
40
|
-
instance.selectItem(event, itemId);
|
|
42
|
+
instance.selectItem(event, itemId, false);
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
};
|
|
46
|
+
const handleCheckboxSelection = event => {
|
|
47
|
+
if (disableSelection || disabled) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const hasShift = event.nativeEvent.shiftKey;
|
|
51
|
+
if (multiSelect && hasShift) {
|
|
52
|
+
instance.expandSelectionRange(event, itemId);
|
|
53
|
+
} else {
|
|
54
|
+
instance.selectItem(event, itemId, multiSelect, event.target.checked);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
44
57
|
const preventSelection = event => {
|
|
45
58
|
if (event.shiftKey || event.ctrlKey || event.metaKey || disabled) {
|
|
46
59
|
// Prevent text selection
|
|
@@ -52,8 +65,11 @@ export function useTreeItemState(itemId) {
|
|
|
52
65
|
expanded,
|
|
53
66
|
selected,
|
|
54
67
|
focused,
|
|
68
|
+
disableSelection,
|
|
69
|
+
checkboxSelection,
|
|
55
70
|
handleExpansion,
|
|
56
71
|
handleSelection,
|
|
72
|
+
handleCheckboxSelection,
|
|
57
73
|
preventSelection
|
|
58
74
|
};
|
|
59
75
|
}
|
package/TreeItem2/TreeItem2.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { CheckboxProps } from '@mui/material/Checkbox';
|
|
2
3
|
import { TreeItem2Props } from './TreeItem2.types';
|
|
3
4
|
export declare const TreeItem2Root: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, keyof React.ClassAttributes<HTMLLIElement> | keyof React.LiHTMLAttributes<HTMLLIElement>>, {}>;
|
|
4
5
|
export declare const TreeItem2Content: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
5
6
|
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
7
|
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
8
|
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>, {}, {}>;
|
|
9
|
+
export declare const TreeItem2Checkbox: import("@emotion/styled").StyledComponent<Pick<Omit<CheckboxProps & {
|
|
10
|
+
visible: boolean;
|
|
11
|
+
}, "ref"> & React.RefAttributes<HTMLButtonElement>, "hidden" | "visible" | "color" | "content" | "size" | "style" | "icon" | "translate" | "disabled" | "form" | "slot" | "title" | "suppressHydrationWarning" | "className" | "id" | "lang" | "name" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "nonce" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "readOnly" | "required" | "action" | "checked" | "component" | "sx" | "classes" | "onFocusVisible" | "inputRef" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "checkedIcon" | "inputProps" | "indeterminate" | "indeterminateIcon" | keyof React.RefAttributes<HTMLButtonElement>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
8
12
|
type TreeItem2Component = ((props: TreeItem2Props & React.RefAttributes<HTMLLIElement>) => React.JSX.Element) & {
|
|
9
13
|
propTypes?: any;
|
|
10
14
|
};
|
package/TreeItem2/TreeItem2.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["visible"],
|
|
4
|
+
_excluded2 = ["id", "itemId", "label", "disabled", "children", "slots", "slotProps"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import clsx from 'clsx';
|
|
7
8
|
import unsupportedProp from '@mui/utils/unsupportedProp';
|
|
8
9
|
import { alpha, styled, useThemeProps } from '@mui/material/styles';
|
|
9
10
|
import Collapse from '@mui/material/Collapse';
|
|
11
|
+
import MuiCheckbox from '@mui/material/Checkbox';
|
|
10
12
|
import { useSlotProps } from '@mui/base/utils';
|
|
11
13
|
import { shouldForwardProp } from '@mui/system';
|
|
12
14
|
import composeClasses from '@mui/utils/composeClasses';
|
|
@@ -121,7 +123,7 @@ export const TreeItem2IconContainer = styled('div', {
|
|
|
121
123
|
}
|
|
122
124
|
});
|
|
123
125
|
export const TreeItem2GroupTransition = styled(Collapse, {
|
|
124
|
-
name: '
|
|
126
|
+
name: 'MuiTreeItem2',
|
|
125
127
|
slot: 'GroupTransition',
|
|
126
128
|
overridesResolver: (props, styles) => styles.groupTransition
|
|
127
129
|
})({
|
|
@@ -129,6 +131,24 @@ export const TreeItem2GroupTransition = styled(Collapse, {
|
|
|
129
131
|
padding: 0,
|
|
130
132
|
paddingLeft: 12
|
|
131
133
|
});
|
|
134
|
+
export const TreeItem2Checkbox = styled( /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
135
|
+
const {
|
|
136
|
+
visible
|
|
137
|
+
} = props,
|
|
138
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
139
|
+
if (!visible) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
return /*#__PURE__*/_jsx(MuiCheckbox, _extends({}, other, {
|
|
143
|
+
ref: ref
|
|
144
|
+
}));
|
|
145
|
+
}), {
|
|
146
|
+
name: 'MuiTreeItem2',
|
|
147
|
+
slot: 'Checkbox',
|
|
148
|
+
overridesResolver: (props, styles) => styles.checkbox
|
|
149
|
+
})({
|
|
150
|
+
padding: 0
|
|
151
|
+
});
|
|
132
152
|
const useUtilityClasses = ownerState => {
|
|
133
153
|
const {
|
|
134
154
|
classes
|
|
@@ -141,6 +161,7 @@ const useUtilityClasses = ownerState => {
|
|
|
141
161
|
focused: ['focused'],
|
|
142
162
|
disabled: ['disabled'],
|
|
143
163
|
iconContainer: ['iconContainer'],
|
|
164
|
+
checkbox: ['checkbox'],
|
|
144
165
|
label: ['label'],
|
|
145
166
|
groupTransition: ['groupTransition']
|
|
146
167
|
};
|
|
@@ -170,11 +191,12 @@ export const TreeItem2 = /*#__PURE__*/React.forwardRef(function TreeItem2(inProp
|
|
|
170
191
|
slots = {},
|
|
171
192
|
slotProps = {}
|
|
172
193
|
} = props,
|
|
173
|
-
other = _objectWithoutPropertiesLoose(props,
|
|
194
|
+
other = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
174
195
|
const {
|
|
175
196
|
getRootProps,
|
|
176
197
|
getContentProps,
|
|
177
198
|
getIconContainerProps,
|
|
199
|
+
getCheckboxProps,
|
|
178
200
|
getLabelProps,
|
|
179
201
|
getGroupTransitionProps,
|
|
180
202
|
status
|
|
@@ -223,6 +245,14 @@ export const TreeItem2 = /*#__PURE__*/React.forwardRef(function TreeItem2(inProp
|
|
|
223
245
|
ownerState: {},
|
|
224
246
|
className: classes.label
|
|
225
247
|
});
|
|
248
|
+
const Checkbox = slots.checkbox ?? TreeItem2Checkbox;
|
|
249
|
+
const checkboxProps = useSlotProps({
|
|
250
|
+
elementType: Checkbox,
|
|
251
|
+
getSlotProps: getCheckboxProps,
|
|
252
|
+
externalSlotProps: slotProps.checkbox,
|
|
253
|
+
ownerState: {},
|
|
254
|
+
className: classes.checkbox
|
|
255
|
+
});
|
|
226
256
|
const GroupTransition = slots.groupTransition ?? undefined;
|
|
227
257
|
const groupTransitionProps = useSlotProps({
|
|
228
258
|
elementType: GroupTransition,
|
|
@@ -241,7 +271,7 @@ export const TreeItem2 = /*#__PURE__*/React.forwardRef(function TreeItem2(inProp
|
|
|
241
271
|
slots: slots,
|
|
242
272
|
slotProps: slotProps
|
|
243
273
|
})
|
|
244
|
-
})), /*#__PURE__*/_jsx(Label, _extends({}, labelProps))]
|
|
274
|
+
})), /*#__PURE__*/_jsx(Checkbox, _extends({}, checkboxProps)), /*#__PURE__*/_jsx(Label, _extends({}, labelProps))]
|
|
245
275
|
})), children && /*#__PURE__*/_jsx(TreeItem2GroupTransition, _extends({
|
|
246
276
|
as: GroupTransition
|
|
247
277
|
}, groupTransitionProps))]
|
|
@@ -25,6 +25,11 @@ export interface TreeItem2Slots extends TreeItem2IconSlots {
|
|
|
25
25
|
* @default TreeItem2IconContainer
|
|
26
26
|
*/
|
|
27
27
|
iconContainer?: React.ElementType;
|
|
28
|
+
/**
|
|
29
|
+
* The component that renders the item checkbox for selection.
|
|
30
|
+
* @default TreeItem2Checkbox
|
|
31
|
+
*/
|
|
32
|
+
checkbox?: React.ElementType;
|
|
28
33
|
/**
|
|
29
34
|
* The component that renders the item label.
|
|
30
35
|
* @default TreeItem2Label
|
|
@@ -36,6 +41,7 @@ export interface TreeItem2SlotProps extends TreeItem2IconSlotProps {
|
|
|
36
41
|
content?: SlotComponentProps<'div', {}, {}>;
|
|
37
42
|
groupTransition?: SlotComponentProps<'div', {}, {}>;
|
|
38
43
|
iconContainer?: SlotComponentProps<'div', {}, {}>;
|
|
44
|
+
checkbox?: SlotComponentProps<'button', {}, {}>;
|
|
39
45
|
label?: SlotComponentProps<'div', {}, {}>;
|
|
40
46
|
}
|
|
41
47
|
export interface TreeItem2Props extends Omit<UseTreeItem2Parameters, 'rootRef'>, Omit<React.HTMLAttributes<HTMLLIElement>, 'onFocus'> {
|
package/TreeItem2/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { TreeItem2, TreeItem2Root, TreeItem2Content, TreeItem2IconContainer, TreeItem2GroupTransition, TreeItem2Label, } from './TreeItem2';
|
|
1
|
+
export { TreeItem2, TreeItem2Root, TreeItem2Content, TreeItem2IconContainer, TreeItem2GroupTransition, TreeItem2Checkbox, TreeItem2Label, } from './TreeItem2';
|
|
2
2
|
export type { TreeItem2Props, TreeItem2Slots, TreeItem2SlotProps } from './TreeItem2.types';
|
package/TreeItem2/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { TreeItem2, TreeItem2Root, TreeItem2Content, TreeItem2IconContainer, TreeItem2GroupTransition, TreeItem2Label } from './TreeItem2';
|
|
1
|
+
export { TreeItem2, TreeItem2Root, TreeItem2Content, TreeItem2IconContainer, TreeItem2GroupTransition, TreeItem2Checkbox, TreeItem2Label } from './TreeItem2';
|