@mui/x-tree-view 7.10.0 → 7.11.1
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 +169 -0
- package/RichTreeView/RichTreeView.js +2 -3
- package/SimpleTreeView/SimpleTreeView.js +2 -3
- package/TreeItem2/TreeItem2.d.ts +1 -1
- package/index.js +1 -1
- package/internals/corePlugins/useTreeViewInstanceEvents/useTreeViewInstanceEvents.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/internals/models/index.d.ts +1 -0
- package/internals/models/index.js +1 -0
- package/internals/models/itemPlugin.d.ts +36 -0
- package/internals/models/itemPlugin.js +1 -0
- package/internals/models/plugin.d.ts +1 -14
- package/internals/useTreeView/useTreeView.js +7 -62
- package/internals/useTreeView/useTreeViewBuildContext.d.ts +10 -0
- package/internals/useTreeView/useTreeViewBuildContext.js +95 -0
- package/internals/useTreeView/useTreeViewPlugins.d.ts +0 -0
- package/internals/useTreeView/useTreeViewPlugins.js +0 -0
- package/internals/utils/warning.d.ts +2 -1
- package/internals/utils/warning.js +19 -12
- package/modern/RichTreeView/RichTreeView.js +2 -3
- package/modern/SimpleTreeView/SimpleTreeView.js +2 -3
- package/modern/index.js +1 -1
- package/modern/internals/corePlugins/useTreeViewInstanceEvents/useTreeViewInstanceEvents.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/internals/models/index.js +1 -0
- package/modern/internals/models/itemPlugin.js +1 -0
- package/modern/internals/useTreeView/useTreeView.js +7 -62
- package/modern/internals/useTreeView/useTreeViewBuildContext.js +95 -0
- package/modern/internals/useTreeView/useTreeViewPlugins.js +0 -0
- package/modern/internals/utils/warning.js +19 -12
- package/node/RichTreeView/RichTreeView.js +1 -2
- package/node/SimpleTreeView/SimpleTreeView.js +1 -2
- package/node/index.js +1 -1
- package/node/internals/corePlugins/useTreeViewInstanceEvents/useTreeViewInstanceEvents.js +1 -1
- package/node/internals/index.js +6 -6
- package/node/internals/models/index.js +11 -0
- package/node/internals/models/itemPlugin.js +5 -0
- package/node/internals/useTreeView/useTreeView.js +7 -62
- package/node/internals/useTreeView/useTreeViewBuildContext.js +102 -0
- package/node/internals/useTreeView/useTreeViewPlugins.js +1 -0
- package/node/internals/utils/warning.js +21 -14
- package/package.json +6 -5
- package/useTreeItem2/index.d.ts +1 -1
- package/internals/utils/EventManager.d.ts +0 -29
- package/internals/utils/EventManager.js +0 -69
- package/modern/internals/utils/EventManager.js +0 -69
- package/node/internals/utils/EventManager.js +0 -76
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,175 @@
|
|
|
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.11.1
|
|
7
|
+
|
|
8
|
+
_Jul 25, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 18 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🔎 Allow `Zoom` to be controllable for charts (#13858) @JCQuintas
|
|
13
|
+
- 🌍 Add Icelandic (is-IS) and Norwegian Nynorsk (nn-NO) locales on the Data Grid
|
|
14
|
+
- 🌍 Improve Norwegian Bokmål (nb-NO) and German (de-DE) locales on the Data Grid
|
|
15
|
+
- 🌍 Add Norwegian Nynorsk (nn-NO) locale on the Date and Time Pickers
|
|
16
|
+
- 🐞 Bugfixes
|
|
17
|
+
- 📚 Documentation improvements
|
|
18
|
+
|
|
19
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
20
|
+
|
|
21
|
+
### Data Grid
|
|
22
|
+
|
|
23
|
+
#### `@mui/x-data-grid@7.11.1`
|
|
24
|
+
|
|
25
|
+
- [DataGrid] Remove dead code in internal `GridPreferencesPanel` (#13934) @k-rajat19
|
|
26
|
+
- [DataGrid] Do not miss to escape formulas in CSV export (#13888) @arminmeh
|
|
27
|
+
- [l10n] Add Icelandic (is-IS) locale (#13283) @magnimarels
|
|
28
|
+
- [l10n] Add Norwegian nynorsk (nn-NO) locale and improve Norwegian bokmål (nb-NO) locale (#13588) @AnderzL7
|
|
29
|
+
- [l10n] Improve German (de-DE) locale (#13910) @lhilgert9
|
|
30
|
+
|
|
31
|
+
#### `@mui/x-data-grid-pro@7.11.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
32
|
+
|
|
33
|
+
Same changes as in `@mui/x-data-grid@7.11.1`.
|
|
34
|
+
|
|
35
|
+
#### `@mui/x-data-grid-premium@7.11.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
36
|
+
|
|
37
|
+
Same changes as in `@mui/x-data-grid-pro@7.11.1`, plus:
|
|
38
|
+
|
|
39
|
+
- [DataGridPremium] Pass the `api` object to events (#13893) @pcorpet
|
|
40
|
+
- [DataGridPremium] Fix paste to selected cells (#13967) @romgrk
|
|
41
|
+
|
|
42
|
+
### Date and Time Pickers
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-date-pickers@7.11.1`
|
|
45
|
+
|
|
46
|
+
- [fields] Prevent keyboard editing when disabled (#13900) @arthurbalduini
|
|
47
|
+
- [l10n] Add Norwegian Nynorsk (nn-NO) locale (#13946) @AnderzL7
|
|
48
|
+
|
|
49
|
+
#### `@mui/x-date-pickers-pro@7.11.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
50
|
+
|
|
51
|
+
Same changes as in `@mui/x-date-pickers@7.11.1`.
|
|
52
|
+
|
|
53
|
+
### Charts
|
|
54
|
+
|
|
55
|
+
#### `@mui/x-charts@7.11.1`
|
|
56
|
+
|
|
57
|
+
- [charts] Add `ownerState` function to `slotProps` typing when available (#13965) @alexfauquette
|
|
58
|
+
- [charts] Allow `Zoom` to be controllable (#13858) @JCQuintas
|
|
59
|
+
- [charts] Deprecate `xAxisKey` /`zAxisKey` in favor of `xAxisId`/`zAxisId` (#13940) @alexfauquette
|
|
60
|
+
- [charts] Hide empty arcs in the PieChart (#13897) @alexfauquette
|
|
61
|
+
- [charts] Limit the trigger of exit charts (#13682) @alexfauquette
|
|
62
|
+
|
|
63
|
+
### Tree View
|
|
64
|
+
|
|
65
|
+
#### `@mui/x-tree-view@7.11.1`
|
|
66
|
+
|
|
67
|
+
- [TreeView] Allow the plugins to enrich the props passed to the item slots (#13953) @flaviendelangle
|
|
68
|
+
|
|
69
|
+
### Docs
|
|
70
|
+
|
|
71
|
+
- [docs] Bump pnpm priority as a package manager (#13894) @oliviertassinari
|
|
72
|
+
- [docs] Explicitly mark charts pro as not released (#13905) @alexfauquette
|
|
73
|
+
- [docs] Fix dot consistency a11y table @oliviertassinari
|
|
74
|
+
- [docs] Fix some typos in charts docs (#13906) @cratiu222
|
|
75
|
+
- [docs] Fix spelling (#13902) @nnsW3
|
|
76
|
+
- [docs] Improve error message when moving between plans (#13874) @oliviertassinari
|
|
77
|
+
- [docs] Update `SparkLineChart` reference not being correctly capitalised (#13960) @duckboy81
|
|
78
|
+
- [docs] Fix scroll demos disorientation (#13909) @oliviertassinari
|
|
79
|
+
|
|
80
|
+
### Core
|
|
81
|
+
|
|
82
|
+
- [core] Add `@mui/material-nextjs` to `MUI Core` renovate group (#13966) @LukasTy
|
|
83
|
+
- [core] Remove warning message in production (#13911) @oliviertassinari
|
|
84
|
+
- [code-infra] Reuse `useReactVersion` script from the monorepo (#13710) @cherniavskii
|
|
85
|
+
- [infra] Adds order id validation action (#13957) @michelengelen
|
|
86
|
+
- [infra] Fix order id validator action (#13971) @michelengelen
|
|
87
|
+
- [infra] Fix regex in order id validation (#13976) @michelengelen
|
|
88
|
+
- [infra] Issue template improvement (#13954) @michelengelen
|
|
89
|
+
|
|
90
|
+
## 7.11.0
|
|
91
|
+
|
|
92
|
+
_Jul 18, 2024_
|
|
93
|
+
|
|
94
|
+
We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
|
|
95
|
+
|
|
96
|
+
- 🎨 Add [color legend](https://mui.com/x/react-charts/legend/#color-legend) for charts (#13700) @alexfauquette
|
|
97
|
+
- 🌍 Improve Korean (ko-KR) locale on the Date and Time Pickers
|
|
98
|
+
- 🌍 Improve Russian (ru-RU) locale on the Date and Time Pickers and Data Grid
|
|
99
|
+
- 🐞 Bugfixes
|
|
100
|
+
- 📚 Documentation improvements
|
|
101
|
+
|
|
102
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
103
|
+
|
|
104
|
+
### Data Grid
|
|
105
|
+
|
|
106
|
+
#### `@mui/x-data-grid@7.11.0`
|
|
107
|
+
|
|
108
|
+
- [DataGrid] Expose `gridEditRowsStateSelector` (#13877) @romgrk
|
|
109
|
+
- [DataGrid] Fix `columnResizeStop` event not emitted when column is not resized (#13307) @mateuseap
|
|
110
|
+
- [DataGrid] Fix delete filter inconsistent behavior (#13353) @oukunan
|
|
111
|
+
- [DataGrid] Enable flip on preferences panel (#13803) @romgrk
|
|
112
|
+
- [DataGrid] Support `date` and `datetime-local` input types in `GridFilterInputMultipleValue` type (#13411) @karudedios
|
|
113
|
+
- [l10n] Improve Russian (ru-RU) locale (#13735) @diro-atk
|
|
114
|
+
|
|
115
|
+
#### `@mui/x-data-grid-pro@7.11.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
116
|
+
|
|
117
|
+
Same changes as in `@mui/x-data-grid@7.11.0`.
|
|
118
|
+
|
|
119
|
+
#### `@mui/x-data-grid-premium@7.11.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
120
|
+
|
|
121
|
+
Same changes as in `@mui/x-data-grid-pro@7.11.0`.
|
|
122
|
+
|
|
123
|
+
### Date and Time Pickers
|
|
124
|
+
|
|
125
|
+
#### `@mui/x-date-pickers@7.11.0`
|
|
126
|
+
|
|
127
|
+
- [l10n] Improve Korean (ko-KR) locale (#13651) @100pearlcent
|
|
128
|
+
- [l10n] Improve Russian (ru-RU) locale (#13871) @Inv1x
|
|
129
|
+
- [pickers] Add more conformance tests improving API docs precision (#13800) @LukasTy
|
|
130
|
+
- [TimePicker] Add `Mui-selected` class to `TimeClock` meridiem buttons (#13848) @LukasTy
|
|
131
|
+
|
|
132
|
+
#### `@mui/x-date-pickers-pro@7.11.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
133
|
+
|
|
134
|
+
Same changes as in `@mui/x-date-pickers@7.11.0`, plus:
|
|
135
|
+
|
|
136
|
+
- [DateRangePicker] Fix `name` prop propagation regression (#13821) @LukasTy
|
|
137
|
+
|
|
138
|
+
### Charts
|
|
139
|
+
|
|
140
|
+
#### `@mui/x-charts@7.11.0`
|
|
141
|
+
|
|
142
|
+
- [charts] Create color legend (#13700) @alexfauquette
|
|
143
|
+
- [charts] Defaultize axis on top level `useChartContainerProps` (#13817) @JCQuintas
|
|
144
|
+
- [charts] Fix charts not passing `className` to root element (#13647) @JCQuintas
|
|
145
|
+
- [charts] Generate API documentation for pro components (#13822) @alexfauquette
|
|
146
|
+
- [charts] Improve zoomed highlight behaviour (unreleased) (#13868) @JCQuintas
|
|
147
|
+
- [charts] Allow zoom on Y axis and add zoom options to configure zooming behaviour (unreleased) (#13726) @JCQuintas
|
|
148
|
+
- [charts] Disable animations while zooming (unreleased) (#13807) @JCQuintas
|
|
149
|
+
|
|
150
|
+
### Tree View
|
|
151
|
+
|
|
152
|
+
#### `@mui/x-tree-view@7.11.0`
|
|
153
|
+
|
|
154
|
+
- [TreeView] Extract some logic outside of the `useTreeView` hook (#13845) @flaviendelangle
|
|
155
|
+
|
|
156
|
+
### Docs
|
|
157
|
+
|
|
158
|
+
- [docs] Add warning about `process.env.NODE_ENV` in production (#13869) @cherniavskii
|
|
159
|
+
- [docs] Allow controlling the demo form from the example (#13796) @JCQuintas
|
|
160
|
+
- [docs] Clarify Pickers clearable behavior not working on mobile (#13786) @lnhrdt
|
|
161
|
+
- [docs] Improve the documentation of the picker's `onChange` and `onAccept` props (#13543) @flaviendelangle
|
|
162
|
+
- [docs] Replace company name with project name @oliviertassinari
|
|
163
|
+
- [docs] Sort Pickers & Charts API slots alphabetically (#13843) @LukasTy
|
|
164
|
+
|
|
165
|
+
### Core
|
|
166
|
+
|
|
167
|
+
- [core] Add MUI Internal `renovate` group (#13846) @LukasTy
|
|
168
|
+
- [core] Link GitHub issue for `import/prefer-default-export` rule @oliviertassinari
|
|
169
|
+
- [core] Normalize `...other` and test imports in charts (#13844) @JCQuintas
|
|
170
|
+
- [core] Normalize rest / other to match the most common used @oliviertassinari
|
|
171
|
+
- [code-infra] Follow `next` tag for `@mui/docs` package bumps (#13813) @LukasTy
|
|
172
|
+
- [code-infra] Use specific version for `@mui/docs` dependency (#13760) @LukasTy
|
|
173
|
+
- [internals] Move `EventManager` to `@mui/x-internals` package (#13815) @flaviendelangle
|
|
174
|
+
|
|
6
175
|
## 7.10.0
|
|
7
176
|
|
|
8
177
|
_Jul 11, 2024_
|
|
@@ -9,7 +9,7 @@ import { useTreeView } from '../internals/useTreeView';
|
|
|
9
9
|
import { TreeViewProvider } from '../internals/TreeViewProvider';
|
|
10
10
|
import { RICH_TREE_VIEW_PLUGINS } from './RichTreeView.plugins';
|
|
11
11
|
import { TreeItem } from '../TreeItem';
|
|
12
|
-
import {
|
|
12
|
+
import { warnOnce } from '../internals/utils/warning';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
const useThemeProps = createUseThemeProps('MuiRichTreeView');
|
|
15
15
|
const useUtilityClasses = ownerState => {
|
|
@@ -58,7 +58,6 @@ function WrappedTreeItem({
|
|
|
58
58
|
children: children
|
|
59
59
|
}));
|
|
60
60
|
}
|
|
61
|
-
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://mui.com/x/react-tree-view/rich-tree-view/items/']);
|
|
62
61
|
|
|
63
62
|
/**
|
|
64
63
|
*
|
|
@@ -77,7 +76,7 @@ const RichTreeView = /*#__PURE__*/React.forwardRef(function RichTreeView(inProps
|
|
|
77
76
|
});
|
|
78
77
|
if (process.env.NODE_ENV !== 'production') {
|
|
79
78
|
if (props.children != null) {
|
|
80
|
-
|
|
79
|
+
warnOnce(['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://mui.com/x/react-tree-view/rich-tree-view/items/.']);
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
82
|
const {
|
|
@@ -8,7 +8,7 @@ import { getSimpleTreeViewUtilityClass } from './simpleTreeViewClasses';
|
|
|
8
8
|
import { useTreeView } from '../internals/useTreeView';
|
|
9
9
|
import { TreeViewProvider } from '../internals/TreeViewProvider';
|
|
10
10
|
import { SIMPLE_TREE_VIEW_PLUGINS } from './SimpleTreeView.plugins';
|
|
11
|
-
import {
|
|
11
|
+
import { warnOnce } from '../internals/utils/warning';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
const useThemeProps = createUseThemeProps('MuiSimpleTreeView');
|
|
14
14
|
const useUtilityClasses = ownerState => {
|
|
@@ -32,7 +32,6 @@ export const SimpleTreeViewRoot = styled('ul', {
|
|
|
32
32
|
position: 'relative'
|
|
33
33
|
});
|
|
34
34
|
const EMPTY_ITEMS = [];
|
|
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/']);
|
|
36
35
|
|
|
37
36
|
/**
|
|
38
37
|
*
|
|
@@ -52,7 +51,7 @@ const SimpleTreeView = /*#__PURE__*/React.forwardRef(function SimpleTreeView(inP
|
|
|
52
51
|
const ownerState = props;
|
|
53
52
|
if (process.env.NODE_ENV !== 'production') {
|
|
54
53
|
if (props.items != null) {
|
|
55
|
-
|
|
54
|
+
warnOnce(['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/.']);
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
const {
|
package/TreeItem2/TreeItem2.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const TreeItem2GroupTransition: import("@emotion/styled").StyledC
|
|
|
14
14
|
}, {}, {}>;
|
|
15
15
|
export declare const TreeItem2Checkbox: import("@emotion/styled").StyledComponent<Pick<Omit<CheckboxProps & {
|
|
16
16
|
visible: boolean;
|
|
17
|
-
}, "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" | "onPointerLeave" | "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" | "
|
|
17
|
+
}, "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" | "onPointerLeave" | "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" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "checkedIcon" | "inputProps" | "inputRef" | "indeterminate" | "indeterminateIcon" | keyof React.RefAttributes<HTMLButtonElement>> & import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
18
18
|
type TreeItem2Component = ((props: TreeItem2Props & React.RefAttributes<HTMLLIElement>) => React.JSX.Element) & {
|
|
19
19
|
propTypes?: any;
|
|
20
20
|
};
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -17,4 +17,4 @@ export { useTreeViewItems } from './plugins/useTreeViewItems';
|
|
|
17
17
|
export type { UseTreeViewItemsSignature, UseTreeViewItemsParameters, } from './plugins/useTreeViewItems';
|
|
18
18
|
export { useTreeViewJSXItems } from './plugins/useTreeViewJSXItems';
|
|
19
19
|
export type { UseTreeViewJSXItemsSignature, UseTreeViewJSXItemsParameters, } from './plugins/useTreeViewJSXItems';
|
|
20
|
-
export {
|
|
20
|
+
export { warnOnce } from './utils/warning';
|
package/internals/index.js
CHANGED
|
@@ -12,4 +12,4 @@ export { useTreeViewKeyboardNavigation } from './plugins/useTreeViewKeyboardNavi
|
|
|
12
12
|
export { useTreeViewIcons } from './plugins/useTreeViewIcons';
|
|
13
13
|
export { useTreeViewItems } from './plugins/useTreeViewItems';
|
|
14
14
|
export { useTreeViewJSXItems } from './plugins/useTreeViewJSXItems';
|
|
15
|
-
export {
|
|
15
|
+
export { warnOnce } from './utils/warning';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { EventHandlers } from '@mui/base/utils';
|
|
3
|
+
import type { UseTreeItem2ContentSlotOwnProps, UseTreeItem2RootSlotOwnProps } from '../../useTreeItem2';
|
|
4
|
+
export interface TreeViewItemPluginSlotPropsEnhancerParams {
|
|
5
|
+
rootRefObject: React.MutableRefObject<HTMLLIElement | null>;
|
|
6
|
+
contentRefObject: React.MutableRefObject<HTMLDivElement | null>;
|
|
7
|
+
externalEventHandlers: EventHandlers;
|
|
8
|
+
}
|
|
9
|
+
type TreeViewItemPluginSlotPropsEnhancer<TSlotProps> = (params: TreeViewItemPluginSlotPropsEnhancerParams) => Partial<TSlotProps>;
|
|
10
|
+
export interface TreeViewItemPluginSlotPropsEnhancers {
|
|
11
|
+
root?: TreeViewItemPluginSlotPropsEnhancer<UseTreeItem2RootSlotOwnProps>;
|
|
12
|
+
content?: TreeViewItemPluginSlotPropsEnhancer<UseTreeItem2ContentSlotOwnProps>;
|
|
13
|
+
}
|
|
14
|
+
export interface TreeViewItemPluginResponse {
|
|
15
|
+
/**
|
|
16
|
+
* Root of the `content` slot enriched by the plugin.
|
|
17
|
+
*/
|
|
18
|
+
contentRef?: React.RefCallback<HTMLElement> | null;
|
|
19
|
+
/**
|
|
20
|
+
* Ref of the `root` slot enriched by the plugin
|
|
21
|
+
*/
|
|
22
|
+
rootRef?: React.RefCallback<HTMLLIElement> | null;
|
|
23
|
+
/**
|
|
24
|
+
* Callback to enhance the slot props of the Tree Item.
|
|
25
|
+
*
|
|
26
|
+
* Not all slots are enabled by default,
|
|
27
|
+
* if a new plugin needs to pass to an unconfigured slot,
|
|
28
|
+
* it just needs to be added to `TreeViewItemPluginSlotPropsEnhancers`
|
|
29
|
+
*/
|
|
30
|
+
propsEnhancers?: TreeViewItemPluginSlotPropsEnhancers;
|
|
31
|
+
}
|
|
32
|
+
export interface TreeViewItemPluginOptions<TProps extends {}> extends Omit<TreeViewItemPluginResponse, 'propsEnhancers'> {
|
|
33
|
+
props: TProps;
|
|
34
|
+
}
|
|
35
|
+
export type TreeViewItemPlugin<TProps extends {}> = (options: TreeViewItemPluginOptions<TProps>) => void | TreeViewItemPluginResponse;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,6 +4,7 @@ import { TreeViewExperimentalFeatures, TreeViewInstance, TreeViewModel } from '.
|
|
|
4
4
|
import type { MergeSignaturesProperty, OptionalIfEmpty } from './helpers';
|
|
5
5
|
import { TreeViewEventLookupElement } from './events';
|
|
6
6
|
import type { TreeViewCorePluginSignatures } from '../corePlugins';
|
|
7
|
+
import { TreeViewItemPlugin } from './itemPlugin';
|
|
7
8
|
import { TreeViewItemId } from '../../models';
|
|
8
9
|
export interface TreeViewPluginOptions<TSignature extends TreeViewAnyPluginSignature> {
|
|
9
10
|
instance: TreeViewUsedInstance<TSignature>;
|
|
@@ -126,20 +127,6 @@ type RemoveSetValue<Models extends Record<string, TreeViewModel<any>>> = {
|
|
|
126
127
|
};
|
|
127
128
|
export type TreeViewUsedModels<TSignature extends TreeViewAnyPluginSignature> = TSignature['models'] & RemoveSetValue<MergeSignaturesProperty<TreeViewRequiredPlugins<TSignature>, 'models'>>;
|
|
128
129
|
export type TreeViewUsedEvents<TSignature extends TreeViewAnyPluginSignature> = TSignature['events'] & MergeSignaturesProperty<TreeViewRequiredPlugins<TSignature>, 'events'>;
|
|
129
|
-
export interface TreeViewItemPluginOptions<TProps extends {}> extends TreeViewItemPluginResponse {
|
|
130
|
-
props: TProps;
|
|
131
|
-
}
|
|
132
|
-
export interface TreeViewItemPluginResponse {
|
|
133
|
-
/**
|
|
134
|
-
* Root of the `content` slot enriched by the plugin.
|
|
135
|
-
*/
|
|
136
|
-
contentRef?: React.RefCallback<HTMLElement> | null;
|
|
137
|
-
/**
|
|
138
|
-
* Ref of the `root` slot enriched by the plugin
|
|
139
|
-
*/
|
|
140
|
-
rootRef?: React.RefCallback<HTMLLIElement> | null;
|
|
141
|
-
}
|
|
142
|
-
export type TreeViewItemPlugin<TProps extends {}> = (options: TreeViewItemPluginOptions<TProps>) => void | TreeViewItemPluginResponse;
|
|
143
130
|
export type TreeItemWrapper<TSignatures extends readonly TreeViewAnyPluginSignature[]> = (params: {
|
|
144
131
|
itemId: TreeViewItemId;
|
|
145
132
|
children: React.ReactNode;
|
|
@@ -4,6 +4,7 @@ import useForkRef from '@mui/utils/useForkRef';
|
|
|
4
4
|
import { useTreeViewModels } from './useTreeViewModels';
|
|
5
5
|
import { TREE_VIEW_CORE_PLUGINS } from '../corePlugins';
|
|
6
6
|
import { extractPluginParamsFromProps } from './extractPluginParamsFromProps';
|
|
7
|
+
import { useTreeViewBuildContext } from './useTreeViewBuildContext';
|
|
7
8
|
export function useTreeViewApiInitialization(inputApiRef) {
|
|
8
9
|
const fallbackPublicApiRef = React.useRef({});
|
|
9
10
|
if (inputApiRef) {
|
|
@@ -37,6 +38,12 @@ export const useTreeView = ({
|
|
|
37
38
|
const publicAPI = useTreeViewApiInitialization(apiRef);
|
|
38
39
|
const innerRootRef = React.useRef(null);
|
|
39
40
|
const handleRootRef = useForkRef(innerRootRef, rootRef);
|
|
41
|
+
const contextValue = useTreeViewBuildContext({
|
|
42
|
+
plugins,
|
|
43
|
+
instance,
|
|
44
|
+
publicAPI,
|
|
45
|
+
rootRef: innerRootRef
|
|
46
|
+
});
|
|
40
47
|
const [state, setState] = React.useState(() => {
|
|
41
48
|
const temp = {};
|
|
42
49
|
plugins.forEach(plugin => {
|
|
@@ -46,68 +53,6 @@ export const useTreeView = ({
|
|
|
46
53
|
});
|
|
47
54
|
return temp;
|
|
48
55
|
});
|
|
49
|
-
const itemWrappers = plugins.map(plugin => plugin.wrapItem).filter(wrapItem => !!wrapItem);
|
|
50
|
-
const wrapItem = ({
|
|
51
|
-
itemId,
|
|
52
|
-
children
|
|
53
|
-
}) => {
|
|
54
|
-
let finalChildren = children;
|
|
55
|
-
itemWrappers.forEach(itemWrapper => {
|
|
56
|
-
finalChildren = itemWrapper({
|
|
57
|
-
itemId,
|
|
58
|
-
children: finalChildren,
|
|
59
|
-
instance
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
return finalChildren;
|
|
63
|
-
};
|
|
64
|
-
const rootWrappers = plugins.map(plugin => plugin.wrapRoot).filter(wrapRoot => !!wrapRoot)
|
|
65
|
-
// The wrappers are reversed to ensure that the first wrapper is the outermost one.
|
|
66
|
-
.reverse();
|
|
67
|
-
const wrapRoot = ({
|
|
68
|
-
children
|
|
69
|
-
}) => {
|
|
70
|
-
let finalChildren = children;
|
|
71
|
-
rootWrappers.forEach(rootWrapper => {
|
|
72
|
-
finalChildren = rootWrapper({
|
|
73
|
-
children: finalChildren,
|
|
74
|
-
instance
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
return finalChildren;
|
|
78
|
-
};
|
|
79
|
-
const runItemPlugins = itemPluginProps => {
|
|
80
|
-
let finalRootRef = null;
|
|
81
|
-
let finalContentRef = null;
|
|
82
|
-
plugins.forEach(plugin => {
|
|
83
|
-
if (!plugin.itemPlugin) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const itemPluginResponse = plugin.itemPlugin({
|
|
87
|
-
props: itemPluginProps,
|
|
88
|
-
rootRef: finalRootRef,
|
|
89
|
-
contentRef: finalContentRef
|
|
90
|
-
});
|
|
91
|
-
if (itemPluginResponse?.rootRef) {
|
|
92
|
-
finalRootRef = itemPluginResponse.rootRef;
|
|
93
|
-
}
|
|
94
|
-
if (itemPluginResponse?.contentRef) {
|
|
95
|
-
finalContentRef = itemPluginResponse.contentRef;
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
return {
|
|
99
|
-
contentRef: finalContentRef,
|
|
100
|
-
rootRef: finalRootRef
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
const contextValue = {
|
|
104
|
-
publicAPI,
|
|
105
|
-
wrapItem,
|
|
106
|
-
wrapRoot,
|
|
107
|
-
runItemPlugins,
|
|
108
|
-
instance: instance,
|
|
109
|
-
rootRef: innerRootRef
|
|
110
|
-
};
|
|
111
56
|
const rootPropsGetters = [];
|
|
112
57
|
const runPlugin = plugin => {
|
|
113
58
|
const pluginResponse = plugin({
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TreeViewContextValue } from '../TreeViewProvider';
|
|
3
|
+
import { ConvertSignaturesIntoPlugins, TreeViewAnyPluginSignature, TreeViewInstance, TreeViewPublicAPI } from '../models';
|
|
4
|
+
import { TreeViewCorePluginSignatures } from '../corePlugins';
|
|
5
|
+
export declare const useTreeViewBuildContext: <TSignatures extends readonly TreeViewAnyPluginSignature[]>({ plugins, instance, publicAPI, rootRef, }: {
|
|
6
|
+
plugins: ConvertSignaturesIntoPlugins<readonly [...TreeViewCorePluginSignatures, ...TSignatures]>;
|
|
7
|
+
instance: TreeViewInstance<TSignatures>;
|
|
8
|
+
publicAPI: TreeViewPublicAPI<TSignatures>;
|
|
9
|
+
rootRef: React.RefObject<HTMLUListElement>;
|
|
10
|
+
}) => TreeViewContextValue<TSignatures>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export const useTreeViewBuildContext = ({
|
|
2
|
+
plugins,
|
|
3
|
+
instance,
|
|
4
|
+
publicAPI,
|
|
5
|
+
rootRef
|
|
6
|
+
}) => {
|
|
7
|
+
const runItemPlugins = itemPluginProps => {
|
|
8
|
+
let finalRootRef = null;
|
|
9
|
+
let finalContentRef = null;
|
|
10
|
+
const pluginPropEnhancers = [];
|
|
11
|
+
const pluginPropEnhancersNames = {};
|
|
12
|
+
plugins.forEach(plugin => {
|
|
13
|
+
if (!plugin.itemPlugin) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const itemPluginResponse = plugin.itemPlugin({
|
|
17
|
+
props: itemPluginProps,
|
|
18
|
+
rootRef: finalRootRef,
|
|
19
|
+
contentRef: finalContentRef
|
|
20
|
+
});
|
|
21
|
+
if (itemPluginResponse?.rootRef) {
|
|
22
|
+
finalRootRef = itemPluginResponse.rootRef;
|
|
23
|
+
}
|
|
24
|
+
if (itemPluginResponse?.contentRef) {
|
|
25
|
+
finalContentRef = itemPluginResponse.contentRef;
|
|
26
|
+
}
|
|
27
|
+
if (itemPluginResponse?.propsEnhancers) {
|
|
28
|
+
pluginPropEnhancers.push(itemPluginResponse.propsEnhancers);
|
|
29
|
+
|
|
30
|
+
// Prepare a list of all the slots which are enhanced by at least one plugin
|
|
31
|
+
Object.keys(itemPluginResponse.propsEnhancers).forEach(propsEnhancerName => {
|
|
32
|
+
pluginPropEnhancersNames[propsEnhancerName] = true;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const resolvePropsEnhancer = currentSlotName => currentSlotParams => {
|
|
37
|
+
const enhancedProps = {};
|
|
38
|
+
pluginPropEnhancers.forEach(propsEnhancersForCurrentPlugin => {
|
|
39
|
+
const propsEnhancerForCurrentPluginAndSlot = propsEnhancersForCurrentPlugin[currentSlotName];
|
|
40
|
+
if (propsEnhancerForCurrentPluginAndSlot != null) {
|
|
41
|
+
Object.assign(enhancedProps, propsEnhancerForCurrentPluginAndSlot(currentSlotParams));
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return enhancedProps;
|
|
45
|
+
};
|
|
46
|
+
const propsEnhancers = Object.fromEntries(Object.keys(pluginPropEnhancersNames).map(propEnhancerName => [propEnhancerName, resolvePropsEnhancer(propEnhancerName)]));
|
|
47
|
+
return {
|
|
48
|
+
contentRef: finalContentRef,
|
|
49
|
+
rootRef: finalRootRef,
|
|
50
|
+
propsEnhancers
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
const wrapItem = ({
|
|
54
|
+
itemId,
|
|
55
|
+
children
|
|
56
|
+
}) => {
|
|
57
|
+
let finalChildren = children;
|
|
58
|
+
// The wrappers are reversed to ensure that the first wrapper is the outermost one.
|
|
59
|
+
for (let i = plugins.length - 1; i >= 0; i -= 1) {
|
|
60
|
+
const plugin = plugins[i];
|
|
61
|
+
if (plugin.wrapItem) {
|
|
62
|
+
finalChildren = plugin.wrapItem({
|
|
63
|
+
itemId,
|
|
64
|
+
children: finalChildren,
|
|
65
|
+
instance
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return finalChildren;
|
|
70
|
+
};
|
|
71
|
+
const wrapRoot = ({
|
|
72
|
+
children
|
|
73
|
+
}) => {
|
|
74
|
+
let finalChildren = children;
|
|
75
|
+
// The wrappers are reversed to ensure that the first wrapper is the outermost one.
|
|
76
|
+
for (let i = plugins.length - 1; i >= 0; i -= 1) {
|
|
77
|
+
const plugin = plugins[i];
|
|
78
|
+
if (plugin.wrapRoot) {
|
|
79
|
+
finalChildren = plugin.wrapRoot({
|
|
80
|
+
children: finalChildren,
|
|
81
|
+
instance
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return finalChildren;
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
runItemPlugins,
|
|
89
|
+
wrapItem,
|
|
90
|
+
wrapRoot,
|
|
91
|
+
instance,
|
|
92
|
+
rootRef,
|
|
93
|
+
publicAPI
|
|
94
|
+
};
|
|
95
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function warnOnce(message: string | string[], gravity?: 'warning' | 'error'): void;
|
|
2
|
+
export declare function clearWarningsCache(): void;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const warnedOnceCache = new Set();
|
|
2
|
+
|
|
3
|
+
// TODO move to @mui/x-internals
|
|
4
|
+
// TODO eventually move to @base_ui/internals. Base UI, etc. too need this helper.
|
|
5
|
+
export function warnOnce(message, gravity = 'warning') {
|
|
6
|
+
if (process.env.NODE_ENV === 'production') {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
3
9
|
const cleanMessage = Array.isArray(message) ? message.join('\n') : message;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
console.warn(cleanMessage);
|
|
11
|
-
}
|
|
10
|
+
if (!warnedOnceCache.has(cleanMessage)) {
|
|
11
|
+
warnedOnceCache.add(cleanMessage);
|
|
12
|
+
if (gravity === 'error') {
|
|
13
|
+
console.error(cleanMessage);
|
|
14
|
+
} else {
|
|
15
|
+
console.warn(cleanMessage);
|
|
12
16
|
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function clearWarningsCache() {
|
|
20
|
+
warnedOnceCache.clear();
|
|
21
|
+
}
|
|
@@ -9,7 +9,7 @@ import { useTreeView } from '../internals/useTreeView';
|
|
|
9
9
|
import { TreeViewProvider } from '../internals/TreeViewProvider';
|
|
10
10
|
import { RICH_TREE_VIEW_PLUGINS } from './RichTreeView.plugins';
|
|
11
11
|
import { TreeItem } from '../TreeItem';
|
|
12
|
-
import {
|
|
12
|
+
import { warnOnce } from '../internals/utils/warning';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
const useThemeProps = createUseThemeProps('MuiRichTreeView');
|
|
15
15
|
const useUtilityClasses = ownerState => {
|
|
@@ -58,7 +58,6 @@ function WrappedTreeItem({
|
|
|
58
58
|
children: children
|
|
59
59
|
}));
|
|
60
60
|
}
|
|
61
|
-
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://mui.com/x/react-tree-view/rich-tree-view/items/']);
|
|
62
61
|
|
|
63
62
|
/**
|
|
64
63
|
*
|
|
@@ -77,7 +76,7 @@ const RichTreeView = /*#__PURE__*/React.forwardRef(function RichTreeView(inProps
|
|
|
77
76
|
});
|
|
78
77
|
if (process.env.NODE_ENV !== 'production') {
|
|
79
78
|
if (props.children != null) {
|
|
80
|
-
|
|
79
|
+
warnOnce(['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://mui.com/x/react-tree-view/rich-tree-view/items/.']);
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
82
|
const {
|