@mui/x-tree-view 7.0.0-alpha.7 → 7.0.0-alpha.8
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 +175 -49
- package/RichTreeView/RichTreeView.js +18 -57
- package/SimpleTreeView/SimpleTreeView.js +20 -53
- package/TreeView/TreeView.js +1 -1
- package/index.js +1 -1
- package/internals/TreeViewProvider/useTreeViewContext.js +1 -1
- package/internals/corePlugins/useTreeViewInstanceEvents/useTreeViewInstanceEvents.js +2 -1
- package/internals/models/MuiCancellableEvent.d.ts +4 -0
- package/internals/models/MuiCancellableEvent.js +1 -0
- package/internals/models/plugin.d.ts +1 -0
- package/internals/plugins/useTreeViewContextValueBuilder/useTreeViewContextValueBuilder.js +6 -0
- package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +6 -0
- package/internals/plugins/useTreeViewFocus/useTreeViewFocus.js +3 -0
- package/internals/plugins/useTreeViewId/useTreeViewId.js +3 -0
- package/internals/plugins/useTreeViewJSXNodes/useTreeViewJSXNodes.js +2 -1
- package/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +155 -112
- package/internals/plugins/useTreeViewNodes/useTreeViewNodes.js +10 -3
- package/internals/plugins/useTreeViewSelection/useTreeViewSelection.js +8 -0
- package/internals/useTreeView/useTreeViewModels.js +2 -2
- package/internals/utils/extractPluginParamsFromProps.d.ts +13 -0
- package/internals/utils/extractPluginParamsFromProps.js +27 -0
- package/legacy/RichTreeView/RichTreeView.js +17 -55
- package/legacy/SimpleTreeView/SimpleTreeView.js +15 -47
- package/legacy/TreeView/TreeView.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/TreeViewProvider/useTreeViewContext.js +1 -1
- package/legacy/internals/corePlugins/useTreeViewInstanceEvents/useTreeViewInstanceEvents.js +2 -1
- package/legacy/internals/models/MuiCancellableEvent.js +1 -0
- package/legacy/internals/plugins/useTreeViewContextValueBuilder/useTreeViewContextValueBuilder.js +6 -0
- package/legacy/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +6 -0
- package/legacy/internals/plugins/useTreeViewFocus/useTreeViewFocus.js +3 -0
- package/legacy/internals/plugins/useTreeViewId/useTreeViewId.js +3 -0
- package/legacy/internals/plugins/useTreeViewJSXNodes/useTreeViewJSXNodes.js +2 -1
- package/legacy/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +157 -110
- package/legacy/internals/plugins/useTreeViewNodes/useTreeViewNodes.js +9 -2
- package/legacy/internals/plugins/useTreeViewSelection/useTreeViewSelection.js +8 -0
- package/legacy/internals/useTreeView/useTreeViewModels.js +2 -2
- package/legacy/internals/utils/extractPluginParamsFromProps.js +27 -0
- package/modern/RichTreeView/RichTreeView.js +18 -57
- package/modern/SimpleTreeView/SimpleTreeView.js +20 -53
- package/modern/TreeView/TreeView.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/TreeViewProvider/useTreeViewContext.js +1 -1
- package/modern/internals/corePlugins/useTreeViewInstanceEvents/useTreeViewInstanceEvents.js +2 -1
- package/modern/internals/models/MuiCancellableEvent.js +1 -0
- package/modern/internals/plugins/useTreeViewContextValueBuilder/useTreeViewContextValueBuilder.js +6 -0
- package/modern/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +7 -1
- package/modern/internals/plugins/useTreeViewFocus/useTreeViewFocus.js +4 -1
- package/modern/internals/plugins/useTreeViewId/useTreeViewId.js +3 -0
- package/modern/internals/plugins/useTreeViewJSXNodes/useTreeViewJSXNodes.js +2 -1
- package/modern/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +155 -112
- package/modern/internals/plugins/useTreeViewNodes/useTreeViewNodes.js +10 -3
- package/modern/internals/plugins/useTreeViewSelection/useTreeViewSelection.js +9 -1
- package/modern/internals/useTreeView/useTreeViewModels.js +2 -2
- package/modern/internals/utils/extractPluginParamsFromProps.js +27 -0
- package/node/RichTreeView/RichTreeView.js +18 -57
- package/node/SimpleTreeView/SimpleTreeView.js +20 -53
- package/node/TreeView/TreeView.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/TreeViewProvider/useTreeViewContext.js +1 -1
- package/node/internals/corePlugins/useTreeViewInstanceEvents/useTreeViewInstanceEvents.js +2 -1
- package/node/internals/models/MuiCancellableEvent.js +5 -0
- package/node/internals/plugins/useTreeViewContextValueBuilder/useTreeViewContextValueBuilder.js +7 -1
- package/node/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +7 -1
- package/node/internals/plugins/useTreeViewFocus/useTreeViewFocus.js +4 -1
- package/node/internals/plugins/useTreeViewId/useTreeViewId.js +4 -1
- package/node/internals/plugins/useTreeViewJSXNodes/useTreeViewJSXNodes.js +2 -1
- package/node/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +155 -112
- package/node/internals/plugins/useTreeViewNodes/useTreeViewNodes.js +10 -3
- package/node/internals/plugins/useTreeViewSelection/useTreeViewSelection.js +9 -1
- package/node/internals/useTreeView/useTreeViewModels.js +2 -2
- package/node/internals/utils/extractPluginParamsFromProps.js +34 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,90 @@
|
|
|
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.8
|
|
7
|
+
|
|
8
|
+
_Jan 11, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- ⏰ Support date-fns v3 (#11659) @LukasTy
|
|
13
|
+
Pickers support both v2 and v3 of date-fns. For v3 use `AdapterDateFnsV3`.
|
|
14
|
+
```js
|
|
15
|
+
// with date-fns v2.x
|
|
16
|
+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
17
|
+
import de from 'date-fns/locale/de';
|
|
18
|
+
```
|
|
19
|
+
```js
|
|
20
|
+
// with date-fns v3.x
|
|
21
|
+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
|
|
22
|
+
import { de } from 'date-fns/locale/de';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Data Grid
|
|
26
|
+
|
|
27
|
+
#### Breaking changes
|
|
28
|
+
|
|
29
|
+
- The import path for locales has been changed:
|
|
30
|
+
|
|
31
|
+
```diff
|
|
32
|
+
-import { enUS } from '@mui/x-data-grid';
|
|
33
|
+
+import { enUS } from '@mui/x-data-grid/locales';
|
|
34
|
+
|
|
35
|
+
-import { enUS } from '@mui/x-data-grid-pro';
|
|
36
|
+
+import { enUS } from '@mui/x-data-grid-pro/locales';
|
|
37
|
+
|
|
38
|
+
-import { enUS } from '@mui/x-data-grid-premium';
|
|
39
|
+
+import { enUS } from '@mui/x-data-grid-premium/locales';
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
#### `@mui/x-data-grid@7.0.0-alpha.8`
|
|
43
|
+
|
|
44
|
+
- [DataGrid] Stop exporting locales from the package root (#11614) @cherniavskii
|
|
45
|
+
|
|
46
|
+
#### `@mui/x-data-grid-pro@7.0.0-alpha.8` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
47
|
+
|
|
48
|
+
Same changes as in `@mui/x-data-grid@7.0.0-alpha.8`.
|
|
49
|
+
|
|
50
|
+
#### `@mui/x-data-grid-premium@7.0.0-alpha.8` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
51
|
+
|
|
52
|
+
Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.8`.
|
|
53
|
+
|
|
54
|
+
### Date Pickers
|
|
55
|
+
|
|
56
|
+
#### `@mui/x-date-pickers@7.0.0-alpha.8`
|
|
57
|
+
|
|
58
|
+
- [pickers] Add `date-fns@3.x` adapter (#11462) @LukasTy
|
|
59
|
+
- [pickers] Avoid deeper than 2nd level imports (#11588) @LukasTy
|
|
60
|
+
- [pickers] Fix clearable behavior blocking focus return to `OpenPickerButton` (#11642) @noraleonte
|
|
61
|
+
- [pickers] Move `DateRange` to `@mui/x-date-pickers-pro/models` (#11611) @flaviendelangle
|
|
62
|
+
- [l10n] Add missing Danish (da-DK) locale export (#11640) @etlos
|
|
63
|
+
|
|
64
|
+
#### `@mui/x-date-pickers-pro@7.0.0-alpha.8` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
65
|
+
|
|
66
|
+
Same changes as in `@mui/x-date-pickers@7.0.0-alpha.8`.
|
|
67
|
+
|
|
68
|
+
### Tree View / `@mui/x-tree-view@7.0.0-alpha.8`
|
|
69
|
+
|
|
70
|
+
- [tree view] Cleanup `onKeyDown` handler (#11481) @flaviendelangle
|
|
71
|
+
- [tree view] Define the parameters used by each plugin to avoid listing them in each component (#11473) @flaviendelangle
|
|
72
|
+
|
|
73
|
+
### Docs
|
|
74
|
+
|
|
75
|
+
- [docs] Fix parsing of `x-date-pickers-pro` demo adapter imports (#11628) @LukasTy
|
|
76
|
+
- [docs] Improve `git diff` format @oliviertassinari
|
|
77
|
+
- [docs] Push up the MUI X brand (#11533) @oliviertassinari
|
|
78
|
+
- [docs] Remove old data grid translation files (#11646) @cherniavskii
|
|
79
|
+
- [docs] Improve Server-side data grid docs (#11589) @oliviertassinari
|
|
80
|
+
- [docs] Improve charts landing page (#11570) @oliviertassinari
|
|
81
|
+
|
|
82
|
+
### Core
|
|
83
|
+
|
|
84
|
+
- [core] Lock `jsdom` version (#11652) @cherniavskii
|
|
85
|
+
- [core] Remove PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD (#11608) @oliviertassinari
|
|
86
|
+
- [core] Simplify isSsr logic (#11606) @oliviertassinari
|
|
87
|
+
- [core] Sync playwright cache between MUI X and Material UI (#11607) @oliviertassinari
|
|
88
|
+
- [core] Use MUI X official name in errors (#11645) @oliviertassinari
|
|
89
|
+
|
|
6
90
|
## 7.0.0-alpha.7
|
|
7
91
|
|
|
8
92
|
_Jan 5, 2024_
|
|
@@ -28,7 +112,7 @@ We'd like to offer a big thanks to the 7 contributors who made this release poss
|
|
|
28
112
|
label: 'Node 2',
|
|
29
113
|
},
|
|
30
114
|
];
|
|
31
|
-
|
|
115
|
+
|
|
32
116
|
<RichTreeView
|
|
33
117
|
items={MUI_X_PRODUCTS}
|
|
34
118
|
defaultCollapseIcon={<ExpandMoreIcon />}
|
|
@@ -88,10 +172,10 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.7`.
|
|
|
88
172
|
<TreeView
|
|
89
173
|
- onNodeToggle={handleExpansionChange}
|
|
90
174
|
+ onExpandedNodesChange={handleExpansionChange}
|
|
91
|
-
|
|
175
|
+
|
|
92
176
|
- expanded={expandedNodes}
|
|
93
177
|
+ expandedNodes={expandedNodes}
|
|
94
|
-
|
|
178
|
+
|
|
95
179
|
- defaultExpanded={defaultExpandedNodes}
|
|
96
180
|
+ defaultExpandedNodes={defaultExpandedNodes}
|
|
97
181
|
/>
|
|
@@ -274,10 +358,10 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.5`.
|
|
|
274
358
|
The `SlotsComponent` suffix has been replaced with `Slots` and `SlotsComponentsProps` with `SlotProps`.
|
|
275
359
|
|
|
276
360
|
```diff
|
|
277
|
-
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
+
|
|
361
|
+
-DateCalendarSlotsComponent
|
|
362
|
+
-DateCalendarSlotsComponentsProps
|
|
363
|
+
+DateCalendarSlots
|
|
364
|
+
+DateCalendarSlotProps
|
|
281
365
|
```
|
|
282
366
|
|
|
283
367
|
- Move `inputRef` inside the props passed to the field hooks
|
|
@@ -285,26 +369,26 @@ The `SlotsComponent` suffix has been replaced with `Slots` and `SlotsComponentsP
|
|
|
285
369
|
The field hooks now only receive the props instead of an object containing both the props and the `inputRef`.
|
|
286
370
|
|
|
287
371
|
```diff
|
|
288
|
-
-
|
|
289
|
-
-
|
|
290
|
-
+
|
|
372
|
+
-const { inputRef, ...otherProps } = props
|
|
373
|
+
-const fieldResponse = useDateField({ props: otherProps, inputRef });
|
|
374
|
+
+const fieldResponse = useDateField(props);
|
|
291
375
|
```
|
|
292
376
|
|
|
293
377
|
If you are using a multi input range field hook, the same applies to `startInputRef` and `endInputRef` params
|
|
294
378
|
|
|
295
379
|
```diff
|
|
296
|
-
-
|
|
297
|
-
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
-
|
|
302
|
-
-
|
|
303
|
-
-
|
|
304
|
-
-
|
|
305
|
-
+
|
|
306
|
-
+
|
|
307
|
-
|
|
380
|
+
-const { inputRef: startInputRef, ...otherStartTextFieldProps } = startTextFieldProps
|
|
381
|
+
-const { inputRef: endInputRef, ...otherEndTextFieldProps } = endTextFieldProps
|
|
382
|
+
|
|
383
|
+
const fieldResponse = useMultiInputDateRangeField({
|
|
384
|
+
sharedProps,
|
|
385
|
+
- startTextFieldProps: otherStartTextFieldProps,
|
|
386
|
+
- endTextFieldProps: otherEndTextFieldProps,
|
|
387
|
+
- startInputRef
|
|
388
|
+
- endInputRef,
|
|
389
|
+
+ startTextFieldProps,
|
|
390
|
+
+ endTextFieldProps
|
|
391
|
+
});
|
|
308
392
|
```
|
|
309
393
|
|
|
310
394
|
- Rename the ref returned by the field hooks to `inputRef`
|
|
@@ -313,26 +397,26 @@ The `SlotsComponent` suffix has been replaced with `Slots` and `SlotsComponentsP
|
|
|
313
397
|
This ref was previously named `ref` and has been renamed `inputRef` for extra clarity.
|
|
314
398
|
|
|
315
399
|
```diff
|
|
316
|
-
|
|
400
|
+
const fieldResponse = useDateField(props);
|
|
317
401
|
|
|
318
|
-
-
|
|
319
|
-
+
|
|
402
|
+
-return <input ref={fieldResponse.ref} />
|
|
403
|
+
+return <input ref={fieldResponse.inputRef} />
|
|
320
404
|
```
|
|
321
405
|
|
|
322
406
|
If you are using a multi input range field hook, the same applies to the ref in the `startDate` and `endDate` objects
|
|
323
407
|
|
|
324
408
|
```diff
|
|
325
|
-
|
|
409
|
+
const fieldResponse = useDateField(props);
|
|
326
410
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
-
|
|
330
|
-
+
|
|
331
|
-
|
|
332
|
-
-
|
|
333
|
-
+
|
|
334
|
-
|
|
335
|
-
|
|
411
|
+
return (
|
|
412
|
+
<div>
|
|
413
|
+
- <input ref={fieldResponse.startDate.ref} />
|
|
414
|
+
+ <input ref={fieldResponse.startDate.inputRef} />
|
|
415
|
+
<span>–</span>
|
|
416
|
+
- <input ref={fieldResponse.endDate.ref} />
|
|
417
|
+
+ <input ref={fieldResponse.endDate.inputRef} />
|
|
418
|
+
</div>
|
|
419
|
+
)
|
|
336
420
|
```
|
|
337
421
|
|
|
338
422
|
- Restructure the API of `useClearableField`
|
|
@@ -342,23 +426,23 @@ The `SlotsComponent` suffix has been replaced with `Slots` and `SlotsComponentsP
|
|
|
342
426
|
You should now be able to directly pass the returned value from your field hook (e.g: `useDateField`) to `useClearableField`
|
|
343
427
|
|
|
344
428
|
```diff
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
-
|
|
348
|
-
-
|
|
349
|
-
-
|
|
350
|
-
-
|
|
351
|
-
-
|
|
352
|
-
-
|
|
353
|
-
-
|
|
354
|
-
-
|
|
355
|
-
-
|
|
429
|
+
const fieldResponse = useDateField(props);
|
|
430
|
+
|
|
431
|
+
-const { InputProps, onClear, clearable, slots, slotProps, ...otherFieldProps } = fieldResponse
|
|
432
|
+
-const { InputProps: ProcessedInputProps, fieldProps: processedFieldProps } = useClearableField({
|
|
433
|
+
- fieldProps: otherFieldProps,
|
|
434
|
+
- InputProps,
|
|
435
|
+
- clearable,
|
|
436
|
+
- onClear,
|
|
437
|
+
- slots,
|
|
438
|
+
- slotProps,
|
|
439
|
+
-});
|
|
356
440
|
-
|
|
357
|
-
-
|
|
441
|
+
- return <MyCustomTextField {...processedFieldProps} InputProps={ProcessedInputProps} />
|
|
358
442
|
|
|
359
|
-
+
|
|
443
|
+
+const processedFieldProps = useClearableField(fieldResponse);
|
|
360
444
|
+
|
|
361
|
-
+
|
|
445
|
+
+return <MyCustomTextField {...processedFieldProps} />
|
|
362
446
|
```
|
|
363
447
|
|
|
364
448
|
#### `@mui/x-date-pickers@7.0.0-alpha.5`
|
|
@@ -1340,6 +1424,48 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
|
|
|
1340
1424
|
- [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
|
|
1341
1425
|
- [license] Correctly throw errors (#10924) @oliviertassinari
|
|
1342
1426
|
|
|
1427
|
+
## 6.19.0
|
|
1428
|
+
|
|
1429
|
+
_Jan 11, 2024_
|
|
1430
|
+
|
|
1431
|
+
We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
|
|
1432
|
+
|
|
1433
|
+
- ⏰ Support date-fns v3 (#11659) @LukasTy
|
|
1434
|
+
Pickers support both v2 and v3 of date-fns. For v3 use `AdapterDateFnsV3`.
|
|
1435
|
+
```js
|
|
1436
|
+
// with date-fns v2.x
|
|
1437
|
+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
1438
|
+
import de from 'date-fns/locale/de';
|
|
1439
|
+
```
|
|
1440
|
+
```js
|
|
1441
|
+
// with date-fns v3.x
|
|
1442
|
+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
|
|
1443
|
+
import { de } from 'date-fns/locale/de';
|
|
1444
|
+
```
|
|
1445
|
+
|
|
1446
|
+
### Date Pickers
|
|
1447
|
+
|
|
1448
|
+
#### `@mui/x-date-pickers@6.19.0`
|
|
1449
|
+
|
|
1450
|
+
- [pickers] Add date-fns@3.x adapter (#11659) @LukasTy
|
|
1451
|
+
- [pickers] Fix clearable behavior blocking focus return to `OpenPickerButton` (#11643) @noraleonte
|
|
1452
|
+
- [l10n] Add missing Danish (da-DK) locale export (#11641) @etlos
|
|
1453
|
+
|
|
1454
|
+
#### `@mui/x-date-pickers-pro@6.19.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
1455
|
+
|
|
1456
|
+
Same changes as in `@mui/x-date-pickers@6.19.0`.
|
|
1457
|
+
|
|
1458
|
+
### Docs
|
|
1459
|
+
|
|
1460
|
+
- [docs] Add missing component @oliviertassinari
|
|
1461
|
+
- [docs] Fix parsing of `x-date-pickers-pro` demo adapter imports (#11637) @LukasTy
|
|
1462
|
+
- [docs] Push up the MUI X brand (#11533) @oliviertassinari
|
|
1463
|
+
- [docs] Improve Server-side data grid docs (#11589) @oliviertassinari
|
|
1464
|
+
- [docs] Add demo to the charts overview page (#11586) @danilo-leal
|
|
1465
|
+
- [docs] Fix 404 links in the docs @oliviertassinari
|
|
1466
|
+
- [docs] Improve landing page (#11570) @oliviertassinari
|
|
1467
|
+
- [docs] Give a general revision to the docs (#11249) @danilo-leal
|
|
1468
|
+
|
|
1343
1469
|
## 6.18.7
|
|
1344
1470
|
|
|
1345
1471
|
_Jan 5, 2024_
|
|
@@ -1,6 +1,6 @@
|
|
|
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 = ["slots", "slotProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
@@ -12,6 +12,7 @@ import { TreeViewProvider } from '../internals/TreeViewProvider';
|
|
|
12
12
|
import { DEFAULT_TREE_VIEW_PLUGINS } from '../internals/plugins';
|
|
13
13
|
import { TreeItem } from '../TreeItem';
|
|
14
14
|
import { buildWarning } from '../internals/utils/warning';
|
|
15
|
+
import { extractPluginParamsFromProps } from '../internals/utils/extractPluginParamsFromProps';
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
const useUtilityClasses = ownerState => {
|
|
17
18
|
const {
|
|
@@ -59,7 +60,7 @@ function WrappedTreeItem({
|
|
|
59
60
|
children: children
|
|
60
61
|
}));
|
|
61
62
|
}
|
|
62
|
-
const childrenWarning = buildWarning(['MUI: The `RichTreeView` component does not support JSX children.', 'If you want to add items, you need to use the `items` prop', 'Check the documentation for more details: https://next.mui.com/x/react-tree-view/rich-tree-view/items/']);
|
|
63
|
+
const childrenWarning = buildWarning(['MUI X: The `RichTreeView` component does not support JSX children.', 'If you want to add items, you need to use the `items` prop', 'Check the documentation for more details: https://next.mui.com/x/react-tree-view/rich-tree-view/items/']);
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
66
|
*
|
|
@@ -77,75 +78,35 @@ const RichTreeView = /*#__PURE__*/React.forwardRef(function RichTreeView(inProps
|
|
|
77
78
|
props: inProps,
|
|
78
79
|
name: 'MuiRichTreeView'
|
|
79
80
|
});
|
|
80
|
-
const _ref = props,
|
|
81
|
-
{
|
|
82
|
-
// Headless implementation
|
|
83
|
-
disabledItemsFocusable,
|
|
84
|
-
expandedNodes,
|
|
85
|
-
defaultExpandedNodes,
|
|
86
|
-
onExpandedNodesChange,
|
|
87
|
-
onNodeExpansionToggle,
|
|
88
|
-
onNodeFocus,
|
|
89
|
-
disableSelection,
|
|
90
|
-
defaultSelectedNodes,
|
|
91
|
-
selectedNodes,
|
|
92
|
-
multiSelect,
|
|
93
|
-
onSelectedNodesChange,
|
|
94
|
-
onNodeSelectionToggle,
|
|
95
|
-
id: treeId,
|
|
96
|
-
defaultCollapseIcon,
|
|
97
|
-
defaultEndIcon,
|
|
98
|
-
defaultExpandIcon,
|
|
99
|
-
defaultParentIcon,
|
|
100
|
-
items,
|
|
101
|
-
getItemId,
|
|
102
|
-
getItemLabel,
|
|
103
|
-
isItemDisabled,
|
|
104
|
-
// Component implementation
|
|
105
|
-
slots,
|
|
106
|
-
slotProps
|
|
107
|
-
} = _ref,
|
|
108
|
-
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
109
81
|
if (process.env.NODE_ENV !== 'production') {
|
|
110
82
|
if (props.children != null) {
|
|
111
83
|
childrenWarning();
|
|
112
84
|
}
|
|
113
85
|
}
|
|
86
|
+
const _extractPluginParamsF = extractPluginParamsFromProps({
|
|
87
|
+
props,
|
|
88
|
+
plugins: DEFAULT_TREE_VIEW_PLUGINS,
|
|
89
|
+
rootRef: ref
|
|
90
|
+
}),
|
|
91
|
+
{
|
|
92
|
+
pluginParams,
|
|
93
|
+
otherProps: {
|
|
94
|
+
slots,
|
|
95
|
+
slotProps
|
|
96
|
+
}
|
|
97
|
+
} = _extractPluginParamsF,
|
|
98
|
+
otherProps = _objectWithoutPropertiesLoose(_extractPluginParamsF.otherProps, _excluded);
|
|
114
99
|
const {
|
|
115
100
|
getRootProps,
|
|
116
101
|
contextValue,
|
|
117
102
|
instance
|
|
118
|
-
} = useTreeView(
|
|
119
|
-
disabledItemsFocusable,
|
|
120
|
-
expandedNodes,
|
|
121
|
-
defaultExpandedNodes,
|
|
122
|
-
onExpandedNodesChange,
|
|
123
|
-
onNodeExpansionToggle,
|
|
124
|
-
onNodeFocus,
|
|
125
|
-
disableSelection,
|
|
126
|
-
defaultSelectedNodes,
|
|
127
|
-
selectedNodes,
|
|
128
|
-
multiSelect,
|
|
129
|
-
onSelectedNodesChange,
|
|
130
|
-
onNodeSelectionToggle,
|
|
131
|
-
id: treeId,
|
|
132
|
-
defaultCollapseIcon,
|
|
133
|
-
defaultEndIcon,
|
|
134
|
-
defaultExpandIcon,
|
|
135
|
-
defaultParentIcon,
|
|
136
|
-
items,
|
|
137
|
-
getItemId,
|
|
138
|
-
getItemLabel,
|
|
139
|
-
isItemDisabled,
|
|
140
|
-
plugins: DEFAULT_TREE_VIEW_PLUGINS,
|
|
141
|
-
rootRef: ref
|
|
142
|
-
});
|
|
103
|
+
} = useTreeView(pluginParams);
|
|
143
104
|
const classes = useUtilityClasses(props);
|
|
144
105
|
const Root = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : RichTreeViewRoot;
|
|
145
106
|
const rootProps = useSlotProps({
|
|
146
107
|
elementType: Root,
|
|
147
108
|
externalSlotProps: slotProps == null ? void 0 : slotProps.root,
|
|
148
|
-
externalForwardedProps:
|
|
109
|
+
externalForwardedProps: otherProps,
|
|
149
110
|
className: classes.root,
|
|
150
111
|
getSlotProps: getRootProps,
|
|
151
112
|
ownerState: props
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["slots", "slotProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
@@ -11,6 +11,7 @@ import { useTreeView } from '../internals/useTreeView';
|
|
|
11
11
|
import { TreeViewProvider } from '../internals/TreeViewProvider';
|
|
12
12
|
import { SIMPLE_TREE_VIEW_PLUGINS } from './SimpleTreeView.plugins';
|
|
13
13
|
import { buildWarning } from '../internals/utils/warning';
|
|
14
|
+
import { extractPluginParamsFromProps } from '../internals/utils/extractPluginParamsFromProps';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
const useUtilityClasses = ownerState => {
|
|
16
17
|
const {
|
|
@@ -32,7 +33,7 @@ export const SimpleTreeViewRoot = styled('ul', {
|
|
|
32
33
|
outline: 0
|
|
33
34
|
});
|
|
34
35
|
const EMPTY_ITEMS = [];
|
|
35
|
-
const itemsPropWarning = buildWarning(['MUI: 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://next.mui.com/x/react-tree-view/simple-tree-view/items/']);
|
|
36
|
+
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://next.mui.com/x/react-tree-view/simple-tree-view/items/']);
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
*
|
|
@@ -51,76 +52,42 @@ const SimpleTreeView = /*#__PURE__*/React.forwardRef(function SimpleTreeView(inP
|
|
|
51
52
|
name: 'MuiSimpleTreeView'
|
|
52
53
|
});
|
|
53
54
|
const ownerState = props;
|
|
54
|
-
const _ref = props,
|
|
55
|
-
{
|
|
56
|
-
// Headless implementation
|
|
57
|
-
disabledItemsFocusable,
|
|
58
|
-
expandedNodes,
|
|
59
|
-
defaultExpandedNodes,
|
|
60
|
-
onExpandedNodesChange,
|
|
61
|
-
onNodeExpansionToggle,
|
|
62
|
-
onNodeFocus,
|
|
63
|
-
disableSelection,
|
|
64
|
-
defaultSelectedNodes,
|
|
65
|
-
selectedNodes,
|
|
66
|
-
multiSelect,
|
|
67
|
-
onSelectedNodesChange,
|
|
68
|
-
onNodeSelectionToggle,
|
|
69
|
-
id,
|
|
70
|
-
defaultCollapseIcon,
|
|
71
|
-
defaultEndIcon,
|
|
72
|
-
defaultExpandIcon,
|
|
73
|
-
defaultParentIcon,
|
|
74
|
-
// Component implementation
|
|
75
|
-
children,
|
|
76
|
-
slots
|
|
77
|
-
} = _ref,
|
|
78
|
-
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
79
55
|
if (process.env.NODE_ENV !== 'production') {
|
|
80
56
|
if (props.items != null) {
|
|
81
57
|
itemsPropWarning();
|
|
82
58
|
}
|
|
83
59
|
}
|
|
60
|
+
const _extractPluginParamsF = extractPluginParamsFromProps({
|
|
61
|
+
props: _extends({}, props, {
|
|
62
|
+
items: EMPTY_ITEMS
|
|
63
|
+
}),
|
|
64
|
+
plugins: SIMPLE_TREE_VIEW_PLUGINS,
|
|
65
|
+
rootRef: ref
|
|
66
|
+
}),
|
|
67
|
+
{
|
|
68
|
+
pluginParams,
|
|
69
|
+
otherProps: {
|
|
70
|
+
slots
|
|
71
|
+
}
|
|
72
|
+
} = _extractPluginParamsF,
|
|
73
|
+
otherProps = _objectWithoutPropertiesLoose(_extractPluginParamsF.otherProps, _excluded);
|
|
84
74
|
const {
|
|
85
75
|
getRootProps,
|
|
86
76
|
contextValue
|
|
87
|
-
} = useTreeView(
|
|
88
|
-
disabledItemsFocusable,
|
|
89
|
-
expandedNodes,
|
|
90
|
-
defaultExpandedNodes,
|
|
91
|
-
onExpandedNodesChange,
|
|
92
|
-
onNodeExpansionToggle,
|
|
93
|
-
onNodeFocus,
|
|
94
|
-
disableSelection,
|
|
95
|
-
defaultSelectedNodes,
|
|
96
|
-
selectedNodes,
|
|
97
|
-
multiSelect,
|
|
98
|
-
onSelectedNodesChange,
|
|
99
|
-
onNodeSelectionToggle,
|
|
100
|
-
id,
|
|
101
|
-
defaultCollapseIcon,
|
|
102
|
-
defaultEndIcon,
|
|
103
|
-
defaultExpandIcon,
|
|
104
|
-
defaultParentIcon,
|
|
105
|
-
items: EMPTY_ITEMS,
|
|
106
|
-
plugins: SIMPLE_TREE_VIEW_PLUGINS,
|
|
107
|
-
rootRef: ref
|
|
108
|
-
});
|
|
77
|
+
} = useTreeView(pluginParams);
|
|
109
78
|
const classes = useUtilityClasses(props);
|
|
110
79
|
const Root = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : SimpleTreeViewRoot;
|
|
111
80
|
const rootProps = useSlotProps({
|
|
112
81
|
elementType: Root,
|
|
113
82
|
externalSlotProps: {},
|
|
114
|
-
externalForwardedProps:
|
|
83
|
+
externalForwardedProps: otherProps,
|
|
115
84
|
className: classes.root,
|
|
116
85
|
getSlotProps: getRootProps,
|
|
117
86
|
ownerState
|
|
118
87
|
});
|
|
119
88
|
return /*#__PURE__*/_jsx(TreeViewProvider, {
|
|
120
89
|
value: contextValue,
|
|
121
|
-
children: /*#__PURE__*/_jsx(Root, _extends({}, rootProps
|
|
122
|
-
children: children
|
|
123
|
-
}))
|
|
90
|
+
children: /*#__PURE__*/_jsx(Root, _extends({}, rootProps))
|
|
124
91
|
});
|
|
125
92
|
});
|
|
126
93
|
process.env.NODE_ENV !== "production" ? SimpleTreeView.propTypes = {
|
package/TreeView/TreeView.js
CHANGED
|
@@ -23,7 +23,7 @@ const TreeViewRoot = styled(SimpleTreeViewRoot, {
|
|
|
23
23
|
let warnedOnce = false;
|
|
24
24
|
const warn = () => {
|
|
25
25
|
if (!warnedOnce) {
|
|
26
|
-
console.warn(['MUI: The TreeView component was renamed SimpleTreeView.', 'The component with the old naming will be removed in the version v8.0.0.', '', "You should use `import { SimpleTreeView } from '@mui/x-tree-view'`", "or `import { SimpleTreeView } from '@mui/x-tree-view/TreeView'`"].join('\n'));
|
|
26
|
+
console.warn(['MUI X: The TreeView component was renamed SimpleTreeView.', 'The component with the old naming will be removed in the version v8.0.0.', '', "You should use `import { SimpleTreeView } from '@mui/x-tree-view'`", "or `import { SimpleTreeView } from '@mui/x-tree-view/TreeView'`"].join('\n'));
|
|
27
27
|
warnedOnce = true;
|
|
28
28
|
}
|
|
29
29
|
};
|
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { TreeViewContext } from './TreeViewContext';
|
|
|
3
3
|
export const useTreeViewContext = () => {
|
|
4
4
|
const context = React.useContext(TreeViewContext);
|
|
5
5
|
if (context == null) {
|
|
6
|
-
throw new Error(['MUI: Could not find the Tree View context.', 'It looks like you rendered your component outside of a SimpleTreeView or RichTreeView parent component.', 'This can also happen if you are bundling multiple versions of the Tree View.'].join('\n'));
|
|
6
|
+
throw new Error(['MUI X: Could not find the Tree View context.', 'It looks like you rendered your component outside of a SimpleTreeView or RichTreeView parent component.', 'This can also happen if you are bundling multiple versions of the Tree View.'].join('\n'));
|
|
7
7
|
}
|
|
8
8
|
return context;
|
|
9
9
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -87,6 +87,7 @@ export type TreeViewPlugin<TSignature extends TreeViewAnyPluginSignature> = {
|
|
|
87
87
|
getDefaultizedParams?: (params: TreeViewUsedParams<TSignature>) => TSignature['defaultizedParams'];
|
|
88
88
|
getInitialState?: (params: TreeViewUsedDefaultizedParams<TSignature>) => TSignature['state'];
|
|
89
89
|
models?: TreeViewModelsInitializer<TSignature>;
|
|
90
|
+
params: Record<keyof TSignature['params'], true>;
|
|
90
91
|
itemPlugin?: TreeViewItemPlugin;
|
|
91
92
|
};
|
|
92
93
|
export {};
|
|
@@ -69,4 +69,10 @@ useTreeViewExpansion.getDefaultizedParams = params => {
|
|
|
69
69
|
return _extends({}, params, {
|
|
70
70
|
defaultExpandedNodes: (_params$defaultExpand = params.defaultExpandedNodes) != null ? _params$defaultExpand : DEFAULT_EXPANDED_NODES
|
|
71
71
|
});
|
|
72
|
+
};
|
|
73
|
+
useTreeViewExpansion.params = {
|
|
74
|
+
expandedNodes: true,
|
|
75
|
+
defaultExpandedNodes: true,
|
|
76
|
+
onExpandedNodesChange: true,
|
|
77
|
+
onNodeExpansionToggle: true
|
|
72
78
|
};
|
|
@@ -93,4 +93,7 @@ useTreeViewFocus.getDefaultizedParams = params => {
|
|
|
93
93
|
return _extends({}, params, {
|
|
94
94
|
disabledItemsFocusable: (_params$disabledItems = params.disabledItemsFocusable) != null ? _params$disabledItems : false
|
|
95
95
|
});
|
|
96
|
+
};
|
|
97
|
+
useTreeViewFocus.params = {
|
|
98
|
+
onNodeFocus: true
|
|
96
99
|
};
|