@mui/x-tree-view-pro 8.9.2 → 8.10.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 +217 -6
- package/RichTreeViewPro/RichTreeViewPro.js +1 -1
- package/esm/RichTreeViewPro/RichTreeViewPro.js +1 -1
- package/esm/index.js +1 -1
- package/esm/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.js +16 -6
- package/esm/internals/plugins/useTreeViewLazyLoading/utils.js +55 -57
- package/index.js +1 -1
- package/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.js +15 -5
- package/internals/plugins/useTreeViewLazyLoading/utils.js +55 -57
- package/package.json +17 -19
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,217 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## 8.10.1
|
|
9
|
+
|
|
10
|
+
_Aug 15, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to extend a big thank you to the 8 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 📊 Y-axes can now be grouped by category when using `band` and `point` scales.
|
|
15
|
+
- 📚 Documentation improvements
|
|
16
|
+
|
|
17
|
+
The following are all team members who have contributed to this release:
|
|
18
|
+
@alexfauquette, @bernardobelchior, @Janpot, @JCQuintas, @mnajdova, @oliviertassinari, @prakhargupta1, @romgrk
|
|
19
|
+
|
|
20
|
+
### Data Grid
|
|
21
|
+
|
|
22
|
+
#### `@mui/x-data-grid@8.10.1`
|
|
23
|
+
|
|
24
|
+
- [DataGrid] Fix scroll jumping (#19156) @romgrk
|
|
25
|
+
- [DataGrid] Fix scroll restoration (#19182) @romgrk
|
|
26
|
+
- [DataGrid] Fix "no row with id" error (#19193) @romgrk
|
|
27
|
+
|
|
28
|
+
#### `@mui/x-data-grid-pro@8.10.1` [](https://mui.com/r/x-pro-svg-link "Pro plan")
|
|
29
|
+
|
|
30
|
+
Same changes as in `@mui/x-data-grid@8.10.1`.
|
|
31
|
+
|
|
32
|
+
#### `@mui/x-data-grid-premium@8.10.1` [](https://mui.com/r/x-premium-svg-link "Premium plan")
|
|
33
|
+
|
|
34
|
+
Same changes as in `@mui/x-data-grid-pro@8.10.1`.
|
|
35
|
+
|
|
36
|
+
### Date and Time Pickers
|
|
37
|
+
|
|
38
|
+
#### `@mui/x-date-pickers@8.10.0`
|
|
39
|
+
|
|
40
|
+
Internal changes.
|
|
41
|
+
|
|
42
|
+
#### `@mui/x-date-pickers-pro@8.10.0` [](https://mui.com/r/x-pro-svg-link "Pro plan")
|
|
43
|
+
|
|
44
|
+
Same changes as in `@mui/x-date-pickers@8.10.0`.
|
|
45
|
+
|
|
46
|
+
### Charts
|
|
47
|
+
|
|
48
|
+
- Axes can now be grouped by category when using `band` and `point` scales
|
|
49
|
+
|
|
50
|
+
<img width="643" height="455" alt="Bar chart with y-axis grouped per categories" src="https://github.com/user-attachments/assets/59044afe-bcc5-4152-8bf1-225db0635025" />
|
|
51
|
+
|
|
52
|
+
#### `@mui/x-charts@8.10.1`
|
|
53
|
+
|
|
54
|
+
- [charts] Allow y-axis to be grouped (#19081) @JCQuintas
|
|
55
|
+
- [charts] Fix default axis highlight for axes without data attribute (#18985) @alexfauquette
|
|
56
|
+
- [charts] Fix tooltip mark unexpected wrapping in mobile (#19122) @bernardobelchior
|
|
57
|
+
- [charts] Prevent overflow on charts tooltip (#19123) @bernardobelchior
|
|
58
|
+
|
|
59
|
+
#### `@mui/x-charts-pro@8.10.1` [](https://mui.com/r/x-pro-svg-link "Pro plan")
|
|
60
|
+
|
|
61
|
+
Same changes as in `@mui/x-charts@8.10.1`.
|
|
62
|
+
|
|
63
|
+
### Tree View
|
|
64
|
+
|
|
65
|
+
#### `@mui/x-tree-view@8.10.1`
|
|
66
|
+
|
|
67
|
+
Internal changes.
|
|
68
|
+
|
|
69
|
+
#### `@mui/x-tree-view-pro@8.10.1` [](https://mui.com/r/x-pro-svg-link "Pro plan")
|
|
70
|
+
|
|
71
|
+
Same changes as in `@mui/x-tree-view@8.10.1`.
|
|
72
|
+
|
|
73
|
+
### Codemod
|
|
74
|
+
|
|
75
|
+
#### `@mui/x-codemod@8.10.1`
|
|
76
|
+
|
|
77
|
+
Internal changes.
|
|
78
|
+
|
|
79
|
+
### Docs
|
|
80
|
+
|
|
81
|
+
- [docs] Add all planned charts on the overview page (#19077) @prakhargupta1
|
|
82
|
+
- [docs] Add future charts components link in the sidebar (#19140) @prakhargupta1
|
|
83
|
+
- [docs] Fix Heatmap docs duplicate text (#19138) @JCQuintas
|
|
84
|
+
- [docs] Remove preview from Toolbar & Funnel (#19131) @mnajdova
|
|
85
|
+
- [docs] Reproduce npm sparkline (#19089) @alexfauquette
|
|
86
|
+
|
|
87
|
+
### Core
|
|
88
|
+
|
|
89
|
+
- [core] Fix licensing model name (#19025) @oliviertassinari
|
|
90
|
+
- [core] Fix usage of `:catalog` for `@babel/runtime` (#19028) @oliviertassinari
|
|
91
|
+
- [core] Refactor virtualizer API (#18995) @romgrk
|
|
92
|
+
|
|
93
|
+
### Miscellaneous
|
|
94
|
+
|
|
95
|
+
- [code-infra] Remove namespaces (#19071) @Janpot
|
|
96
|
+
- [code-infra] Fix `fs-extra` removal from `formattedTSDemos` script (#19132) @bernardobelchior
|
|
97
|
+
- [code-infra] Remove unused code and dependency (#19139) @bernardobelchior
|
|
98
|
+
- [code-infra] Replace `fs-extra` with `node:fs` where possible (#19127) @bernardobelchior
|
|
99
|
+
- [internal] Edit, keep `lockFileMaintenance` simple @oliviertassinari
|
|
100
|
+
- [internal] Fix writing style action name @oliviertassinari
|
|
101
|
+
- [internal] Make it clear that `lockFileMaintenance` is enabled @oliviertassinari
|
|
102
|
+
- [support-infra] Remove default issue label (#19104) @oliviertassinari
|
|
103
|
+
|
|
104
|
+
## 8.10.0
|
|
105
|
+
|
|
106
|
+
_Aug 8, 2025_
|
|
107
|
+
|
|
108
|
+
We'd like to extend a big thank you to the 17 contributors who made this release possible. Here are some highlights ✨:
|
|
109
|
+
|
|
110
|
+
- 📊 [`FunnelChart`](https://mui.com/x/react-charts/funnel/) marked as stable
|
|
111
|
+
- 📈 [Zoom slider](https://mui.com/x/react-charts/zoom-and-pan/#zoom-slider) and [Preview](https://mui.com/x/react-charts/zoom-and-pan/#preview) marked as stable
|
|
112
|
+
- 📈 Supporting [label groups](https://mui.com/x/react-charts/axis/#grouped-axes) in band and point axis
|
|
113
|
+
- 🌎 Improve Norwegian Nynorsk (nn-NO) locale on the Data Grid
|
|
114
|
+
- 🐞 Bugfixes
|
|
115
|
+
- 📚 Documentation improvements
|
|
116
|
+
|
|
117
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
118
|
+
@AnderzL7, @aqeelat, @dwrth, @noobyogi0010, @nusr, @sai6855
|
|
119
|
+
|
|
120
|
+
The following are all team members who have contributed to this release:
|
|
121
|
+
@arminmeh, @bernardobelchior, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @mapache-salvaje, @MBilalShafi, @oliviertassinari, @rita-codes, @romgrk
|
|
122
|
+
|
|
123
|
+
### Data Grid
|
|
124
|
+
|
|
125
|
+
#### `@mui/x-data-grid@8.10.0`
|
|
126
|
+
|
|
127
|
+
- [DataGrid] Move spread operator in `BaseSelect` to allow `variant` change (#19026) @dwrth
|
|
128
|
+
- [DataGrid] Use `use-sync-external-store` shim (#19063) @romgrk
|
|
129
|
+
- [DataGrid] Allow skipping cache in `dataSource.fetchRows()` API method (#18904) @MBilalShafi
|
|
130
|
+
- [DataGrid] Do not call `preProcessEditCellProps()` if cell is not editable based on `isCellEditable()` (#18405) @nusr
|
|
131
|
+
- [DataGrid] Fix `renderCountry` throwing an error when used in tree data (#19068) @cherniavskii
|
|
132
|
+
- [DataGrid] Fix performance issue for root level "select all" (#19015) @MBilalShafi
|
|
133
|
+
- [DataGrid] Fix pagination `slotProps` being ignored by the grid (#19095) @romgrk
|
|
134
|
+
- [l10n] Improve Norwegian Nynorsk (nn-NO) locale (#19076) @AnderzL7
|
|
135
|
+
|
|
136
|
+
#### `@mui/x-data-grid-pro@8.10.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
137
|
+
|
|
138
|
+
Same changes as in `@mui/x-data-grid@8.10.0`, plus:
|
|
139
|
+
|
|
140
|
+
- [DataGridPro] Fix row reorder not working with column reorder disabled (#19016) @MBilalShafi
|
|
141
|
+
- [DataGridPro] Fix header filters cache sharing issue (#19090) @MBilalShafi
|
|
142
|
+
|
|
143
|
+
#### `@mui/x-data-grid-premium@8.10.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
144
|
+
|
|
145
|
+
Same changes as in `@mui/x-data-grid-pro@8.10.0`, plus:
|
|
146
|
+
|
|
147
|
+
- [DataGridPremium] Allow additional derived columns customization via `valueFormatter` (#18982) @arminmeh
|
|
148
|
+
- [DataGridPremium] Fix complex `singleSelect` columns not working in pivot model (#18971) @cherniavskii
|
|
149
|
+
|
|
150
|
+
### Date and Time Pickers
|
|
151
|
+
|
|
152
|
+
#### `@mui/x-date-pickers@8.10.0`
|
|
153
|
+
|
|
154
|
+
- [pickers] `MuiPickersLayout-toolbar` is overlapping the Calendar in RTL `MobileDatePicker` variant (#18981) @rita-codes
|
|
155
|
+
|
|
156
|
+
#### `@mui/x-date-pickers-pro@8.10.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
157
|
+
|
|
158
|
+
Same changes as in `@mui/x-date-pickers@8.10.0`.
|
|
159
|
+
|
|
160
|
+
### Charts
|
|
161
|
+
|
|
162
|
+
#### `@mui/x-charts@8.10.0`
|
|
163
|
+
|
|
164
|
+
- [charts] Add `groups` to `band` and `point` axis config (#18766) @JCQuintas
|
|
165
|
+
- [charts] Animation example using `motion` library (#18993) @JCQuintas
|
|
166
|
+
- [charts] Deprecate `Unstable_` radar exports (#19079) @JCQuintas
|
|
167
|
+
- [charts] Improve grouped axis logic (#19069) @JCQuintas
|
|
168
|
+
- [charts] Fix type assertion in axis highlight components (#19060) @sai6855
|
|
169
|
+
- [charts] Remove unnecessary type assertion in tooltip `valueFormatter` in heatmap (#19047) @sai6855
|
|
170
|
+
|
|
171
|
+
#### `@mui/x-charts-pro@8.10.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
172
|
+
|
|
173
|
+
Same changes as in `@mui/x-charts@8.10.0`, plus:
|
|
174
|
+
|
|
175
|
+
- [charts-pro] Fix `slotProps.tooltip.trigger` not respected in `ScatterChartPro` and `FunnelChart` (#18902) @bernardobelchior
|
|
176
|
+
- [charts-pro] Fix zoom filtering adjusting axis too soon (#18992) @bernardobelchior
|
|
177
|
+
- [charts-pro] Mark `FunnelChart` as stable (#19048) @JCQuintas
|
|
178
|
+
- [charts-pro] Mark zoom slider and preview as stable (#19049) @JCQuintas
|
|
179
|
+
- [charts-pro] Refactor `createAxisFilterMapper` (#18998) @bernardobelchior
|
|
180
|
+
|
|
181
|
+
### Tree View
|
|
182
|
+
|
|
183
|
+
#### `@mui/x-tree-view@8.10.0`
|
|
184
|
+
|
|
185
|
+
Internal changes.
|
|
186
|
+
|
|
187
|
+
#### `@mui/x-tree-view-pro@8.10.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
188
|
+
|
|
189
|
+
Same changes as in `@mui/x-tree-view@8.10.0`.
|
|
190
|
+
|
|
191
|
+
### Codemod
|
|
192
|
+
|
|
193
|
+
#### `@mui/x-codemod@8.10.0`
|
|
194
|
+
|
|
195
|
+
Internal changes.
|
|
196
|
+
|
|
197
|
+
### Docs
|
|
198
|
+
|
|
199
|
+
- [docs] Add CSS bundler breaking change to migration guide (#17436) @romgrk
|
|
200
|
+
- [docs] `RichTreeViewPro` demo for dragging via custom drag-handle is not working properly (#19008) @rita-codes
|
|
201
|
+
- [docs] Fix broken link to D3 in Charts (#19020) @oliviertassinari
|
|
202
|
+
- [docs] Revise the Charts Animation doc (#18990) @mapache-salvaje
|
|
203
|
+
- [docs] Fix incorrect code in line chart preview (#19023) @noobyogi0010
|
|
204
|
+
- [docs] Improve bundling instructions for the Data Grid (#19065) @romgrk
|
|
205
|
+
- [docs] Reduce image size in the inventory grid demo (#19004) @arminmeh
|
|
206
|
+
|
|
207
|
+
### Core
|
|
208
|
+
|
|
209
|
+
- [core] Fix ESLint reference name @oliviertassinari
|
|
210
|
+
|
|
211
|
+
### Miscellaneous
|
|
212
|
+
|
|
213
|
+
- [infra] Remove bundle size tracking for subpaths (#19072) @Janpot
|
|
214
|
+
- [infra] Accept `PORT` env on `docs:dev` script (#19014) @JCQuintas
|
|
215
|
+
- [infra] Skip codesandbox iframe demos in regressions tests (#18970) @cherniavskii
|
|
216
|
+
- [infra] Remove package.json `module` field (#18961) @Janpot
|
|
217
|
+
- [internal] Remove peer dependency on `@mui/system` (#19062) @aqeelat
|
|
218
|
+
|
|
8
219
|
## 8.9.2
|
|
9
220
|
|
|
10
221
|
_Jul 31, 2025_
|
|
@@ -418,8 +629,8 @@ Same changes as in `@mui/x-tree-view@8.7.0`, plus:
|
|
|
418
629
|
|
|
419
630
|
- [code-infra] Bump code-infra version and fix breaking changes (#18653) @brijeshb42
|
|
420
631
|
- [code-infra] Ensure `material-ui/disallow-react-api-in-server-components` ESLint rule is applied (#18570) @LukasTy
|
|
421
|
-
- [code-infra] Migrate to flat
|
|
422
|
-
- [code-infra] Refactor
|
|
632
|
+
- [code-infra] Migrate to flat ESLint config (#18562) @brijeshb42
|
|
633
|
+
- [code-infra] Refactor ESLint config (#18643) @LukasTy
|
|
423
634
|
- [infra] Add renovatebot rule for latest infra packages (#18609) @Janpot
|
|
424
635
|
- [infra] Move pushArgos script to code-infra (#18667) @Janpot
|
|
425
636
|
- [infra] Updates release script to fetch latest major version from upstream (#18552) @michelengelen
|
|
@@ -1333,7 +1544,7 @@ Same changes as in `@mui/x-tree-view@8.2.0`.
|
|
|
1333
1544
|
- [core] Fix all Vale errors @oliviertassinari
|
|
1334
1545
|
- [core] Move `loadStyleSheets` to internals and use it in data grid and charts (#17548) @bernardobelchior
|
|
1335
1546
|
- [core] Remove empty version (#17582) @oliviertassinari
|
|
1336
|
-
- [core] Remove
|
|
1547
|
+
- [core] Remove ESLint from codemod spec files (#17443) @alexfauquette
|
|
1337
1548
|
- [core] Remove unnecessary versions (#17597) @oliviertassinari
|
|
1338
1549
|
- [code-infra] Allow postinstall scripts for packages requesting it (#17635) @LukasTy
|
|
1339
1550
|
- [code-infra] Data Grid `vitest` changes (#17619) @JCQuintas
|
|
@@ -6827,7 +7038,7 @@ Same changes as in `@mui/x-date-pickers@7.8.0`.
|
|
|
6827
7038
|
|
|
6828
7039
|
### Core
|
|
6829
7040
|
|
|
6830
|
-
- [core] Add
|
|
7041
|
+
- [core] Add ESLint rule to restrict import from `../internals` root (#13633) @JCQuintas
|
|
6831
7042
|
- [docs-infra] Sync `\_app` folder with monorepo (#13582) @Janpot
|
|
6832
7043
|
- [license] Allow usage of Charts and Tree View Pro package for old premium licenses (#13619) @flaviendelangle
|
|
6833
7044
|
|
|
@@ -6965,7 +7176,7 @@ Same changes as in `@mui/x-date-pickers@7.7.0`.
|
|
|
6965
7176
|
|
|
6966
7177
|
- [charts] Add watermark on the pro `ResponsiveChartContainer` (#13398) @alexfauquette
|
|
6967
7178
|
- [charts] Allow to specify y-axis configuration (#13438) @alexfauquette
|
|
6968
|
-
- [charts] Fix
|
|
7179
|
+
- [charts] Fix ESLint for react compiler (#13444) @alexfauquette
|
|
6969
7180
|
- [charts] Improve themeAugmentation typing (#13433) @noraleonte
|
|
6970
7181
|
- [charts] Move the `ZAxisContextProvider` by default in the `ChartContainer` (#13465) @alexfauquette
|
|
6971
7182
|
- [charts] Use plugins to define series extremum and colors (#13397) @alexfauquette
|
|
@@ -7512,7 +7723,7 @@ Same changes as in `@mui/x-date-pickers@7.3.1`.
|
|
|
7512
7723
|
- [core] Use `describeTreeView` for focus tests (#12698) @flaviendelangle
|
|
7513
7724
|
- [core] Use `describeTreeView` for type-ahead tests (#12811) @flaviendelangle
|
|
7514
7725
|
- [code-infra] Change package manager to `pnpm` (#11875) @LukasTy
|
|
7515
|
-
- [code-infra] Closer sync with
|
|
7726
|
+
- [code-infra] Closer sync with ESLint config of codebase (#12864) @oliviertassinari
|
|
7516
7727
|
- [support-infra] Add release announcement to GitHub workflows (#11867) (#12843) @michelengelen
|
|
7517
7728
|
|
|
7518
7729
|
## 7.3.0
|
package/esm/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import useLazyRef from '@mui/utils/useLazyRef';
|
|
6
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
7
|
-
import { selectorItemMeta, selectorIsItemSelected, useInstanceEventHandler, selectorDataSourceState, selectorGetTreeItemError } from '@mui/x-tree-view/internals';
|
|
7
|
+
import { selectorItemMeta, selectorIsItemSelected, useInstanceEventHandler, selectorDataSourceState, selectorGetTreeItemError, selectorExpandedItems } from '@mui/x-tree-view/internals';
|
|
8
8
|
import { DataSourceCacheDefault } from '@mui/x-tree-view/utils';
|
|
9
9
|
import { NestedDataManager } from "./utils.js";
|
|
10
10
|
const INITIAL_STATE = {
|
|
@@ -99,19 +99,23 @@ export const useTreeViewLazyLoading = ({
|
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
101
|
nestedDataManager.clear();
|
|
102
|
-
|
|
102
|
+
// handle loading here
|
|
103
|
+
instance.setTreeViewLoading(true);
|
|
103
104
|
// reset the state if we are refetching the first visible items
|
|
104
105
|
if (selectorDataSourceState(store.value) !== INITIAL_STATE) {
|
|
105
106
|
resetDataSourceState();
|
|
106
107
|
}
|
|
107
108
|
// handle caching here
|
|
108
109
|
const cachedData = cacheRef.current.get('root');
|
|
109
|
-
if (cachedData !== undefined) {
|
|
110
|
+
if (cachedData !== undefined && cachedData !== -1) {
|
|
111
|
+
instance.addItems({
|
|
112
|
+
items: cachedData,
|
|
113
|
+
depth: 0,
|
|
114
|
+
getChildrenCount
|
|
115
|
+
});
|
|
116
|
+
instance.setTreeViewLoading(false);
|
|
110
117
|
return;
|
|
111
118
|
}
|
|
112
|
-
|
|
113
|
-
// handle loading here
|
|
114
|
-
instance.setTreeViewLoading(true);
|
|
115
119
|
try {
|
|
116
120
|
const getTreeItemsResponse = await getTreeItems();
|
|
117
121
|
|
|
@@ -206,6 +210,8 @@ export const useTreeViewLazyLoading = ({
|
|
|
206
210
|
if (!isLazyLoadingEnabled || !eventParameters.shouldBeExpanded) {
|
|
207
211
|
return;
|
|
208
212
|
}
|
|
213
|
+
// prevent the default expansion behavior
|
|
214
|
+
|
|
209
215
|
eventParameters.isExpansionPrevented = true;
|
|
210
216
|
await instance.fetchItems([eventParameters.itemId]);
|
|
211
217
|
const fetchErrors = Boolean(selectorGetTreeItemError(store.value, eventParameters.itemId));
|
|
@@ -241,6 +247,10 @@ export const useTreeViewLazyLoading = ({
|
|
|
241
247
|
getChildrenCount
|
|
242
248
|
});
|
|
243
249
|
} else {
|
|
250
|
+
const expandedItems = selectorExpandedItems(store.value);
|
|
251
|
+
if (expandedItems.length > 0) {
|
|
252
|
+
instance.resetItemExpansion();
|
|
253
|
+
}
|
|
244
254
|
instance.fetchItems();
|
|
245
255
|
}
|
|
246
256
|
firstRenderRef.current = false;
|
|
@@ -21,65 +21,63 @@ export let RequestStatus = /*#__PURE__*/function (RequestStatus) {
|
|
|
21
21
|
* Uses `ParentId` to uniquely identify a request
|
|
22
22
|
*/
|
|
23
23
|
export class NestedDataManager {
|
|
24
|
+
pendingRequests = (() => new Set())();
|
|
25
|
+
queuedRequests = (() => new Set())();
|
|
26
|
+
settledRequests = (() => new Set())();
|
|
24
27
|
constructor(instance, maxConcurrentRequests = MAX_CONCURRENT_REQUESTS) {
|
|
25
|
-
this.pendingRequests = new Set();
|
|
26
|
-
this.queuedRequests = new Set();
|
|
27
|
-
this.settledRequests = new Set();
|
|
28
|
-
this.instance = void 0;
|
|
29
|
-
this.maxConcurrentRequests = void 0;
|
|
30
|
-
this.processQueue = async () => {
|
|
31
|
-
if (this.queuedRequests.size === 0 || this.pendingRequests.size >= this.maxConcurrentRequests) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const loopLength = Math.min(this.maxConcurrentRequests - this.pendingRequests.size, this.queuedRequests.size);
|
|
35
|
-
if (loopLength === 0) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const fetchQueue = Array.from(this.queuedRequests);
|
|
39
|
-
const fetchPromises = [];
|
|
40
|
-
for (let i = 0; i < loopLength; i += 1) {
|
|
41
|
-
const id = fetchQueue[i];
|
|
42
|
-
this.queuedRequests.delete(id);
|
|
43
|
-
this.pendingRequests.add(id);
|
|
44
|
-
fetchPromises.push(this.instance.fetchItemChildren(id));
|
|
45
|
-
}
|
|
46
|
-
await Promise.all(fetchPromises);
|
|
47
|
-
};
|
|
48
|
-
this.queue = async ids => {
|
|
49
|
-
const loadingIds = {};
|
|
50
|
-
ids.forEach(id => {
|
|
51
|
-
this.queuedRequests.add(id);
|
|
52
|
-
loadingIds[id] = true;
|
|
53
|
-
});
|
|
54
|
-
await this.processQueue();
|
|
55
|
-
};
|
|
56
|
-
this.setRequestSettled = async id => {
|
|
57
|
-
this.pendingRequests.delete(id);
|
|
58
|
-
this.settledRequests.add(id);
|
|
59
|
-
await this.processQueue();
|
|
60
|
-
};
|
|
61
|
-
this.clear = () => {
|
|
62
|
-
this.queuedRequests.clear();
|
|
63
|
-
Array.from(this.pendingRequests).forEach(id => this.clearPendingRequest(id));
|
|
64
|
-
};
|
|
65
|
-
this.clearPendingRequest = async id => {
|
|
66
|
-
this.pendingRequests.delete(id);
|
|
67
|
-
await this.processQueue();
|
|
68
|
-
};
|
|
69
|
-
this.getRequestStatus = id => {
|
|
70
|
-
if (this.pendingRequests.has(id)) {
|
|
71
|
-
return RequestStatus.PENDING;
|
|
72
|
-
}
|
|
73
|
-
if (this.queuedRequests.has(id)) {
|
|
74
|
-
return RequestStatus.QUEUED;
|
|
75
|
-
}
|
|
76
|
-
if (this.settledRequests.has(id)) {
|
|
77
|
-
return RequestStatus.SETTLED;
|
|
78
|
-
}
|
|
79
|
-
return RequestStatus.UNKNOWN;
|
|
80
|
-
};
|
|
81
|
-
this.getActiveRequestsCount = () => this.pendingRequests.size + this.queuedRequests.size;
|
|
82
28
|
this.instance = instance;
|
|
83
29
|
this.maxConcurrentRequests = maxConcurrentRequests;
|
|
84
30
|
}
|
|
31
|
+
processQueue = async () => {
|
|
32
|
+
if (this.queuedRequests.size === 0 || this.pendingRequests.size >= this.maxConcurrentRequests) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const loopLength = Math.min(this.maxConcurrentRequests - this.pendingRequests.size, this.queuedRequests.size);
|
|
36
|
+
if (loopLength === 0) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const fetchQueue = Array.from(this.queuedRequests);
|
|
40
|
+
const fetchPromises = [];
|
|
41
|
+
for (let i = 0; i < loopLength; i += 1) {
|
|
42
|
+
const id = fetchQueue[i];
|
|
43
|
+
this.queuedRequests.delete(id);
|
|
44
|
+
this.pendingRequests.add(id);
|
|
45
|
+
fetchPromises.push(this.instance.fetchItemChildren(id));
|
|
46
|
+
}
|
|
47
|
+
await Promise.all(fetchPromises);
|
|
48
|
+
};
|
|
49
|
+
queue = async ids => {
|
|
50
|
+
const loadingIds = {};
|
|
51
|
+
ids.forEach(id => {
|
|
52
|
+
this.queuedRequests.add(id);
|
|
53
|
+
loadingIds[id] = true;
|
|
54
|
+
});
|
|
55
|
+
await this.processQueue();
|
|
56
|
+
};
|
|
57
|
+
setRequestSettled = async id => {
|
|
58
|
+
this.pendingRequests.delete(id);
|
|
59
|
+
this.settledRequests.add(id);
|
|
60
|
+
await this.processQueue();
|
|
61
|
+
};
|
|
62
|
+
clear = () => {
|
|
63
|
+
this.queuedRequests.clear();
|
|
64
|
+
Array.from(this.pendingRequests).forEach(id => this.clearPendingRequest(id));
|
|
65
|
+
};
|
|
66
|
+
clearPendingRequest = async id => {
|
|
67
|
+
this.pendingRequests.delete(id);
|
|
68
|
+
await this.processQueue();
|
|
69
|
+
};
|
|
70
|
+
getRequestStatus = id => {
|
|
71
|
+
if (this.pendingRequests.has(id)) {
|
|
72
|
+
return RequestStatus.PENDING;
|
|
73
|
+
}
|
|
74
|
+
if (this.queuedRequests.has(id)) {
|
|
75
|
+
return RequestStatus.QUEUED;
|
|
76
|
+
}
|
|
77
|
+
if (this.settledRequests.has(id)) {
|
|
78
|
+
return RequestStatus.SETTLED;
|
|
79
|
+
}
|
|
80
|
+
return RequestStatus.UNKNOWN;
|
|
81
|
+
};
|
|
82
|
+
getActiveRequestsCount = () => this.pendingRequests.size + this.queuedRequests.size;
|
|
85
83
|
}
|
package/index.js
CHANGED
|
@@ -106,19 +106,23 @@ const useTreeViewLazyLoading = ({
|
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
nestedDataManager.clear();
|
|
109
|
-
|
|
109
|
+
// handle loading here
|
|
110
|
+
instance.setTreeViewLoading(true);
|
|
110
111
|
// reset the state if we are refetching the first visible items
|
|
111
112
|
if ((0, _internals.selectorDataSourceState)(store.value) !== INITIAL_STATE) {
|
|
112
113
|
resetDataSourceState();
|
|
113
114
|
}
|
|
114
115
|
// handle caching here
|
|
115
116
|
const cachedData = cacheRef.current.get('root');
|
|
116
|
-
if (cachedData !== undefined) {
|
|
117
|
+
if (cachedData !== undefined && cachedData !== -1) {
|
|
118
|
+
instance.addItems({
|
|
119
|
+
items: cachedData,
|
|
120
|
+
depth: 0,
|
|
121
|
+
getChildrenCount
|
|
122
|
+
});
|
|
123
|
+
instance.setTreeViewLoading(false);
|
|
117
124
|
return;
|
|
118
125
|
}
|
|
119
|
-
|
|
120
|
-
// handle loading here
|
|
121
|
-
instance.setTreeViewLoading(true);
|
|
122
126
|
try {
|
|
123
127
|
const getTreeItemsResponse = await getTreeItems();
|
|
124
128
|
|
|
@@ -213,6 +217,8 @@ const useTreeViewLazyLoading = ({
|
|
|
213
217
|
if (!isLazyLoadingEnabled || !eventParameters.shouldBeExpanded) {
|
|
214
218
|
return;
|
|
215
219
|
}
|
|
220
|
+
// prevent the default expansion behavior
|
|
221
|
+
|
|
216
222
|
eventParameters.isExpansionPrevented = true;
|
|
217
223
|
await instance.fetchItems([eventParameters.itemId]);
|
|
218
224
|
const fetchErrors = Boolean((0, _internals.selectorGetTreeItemError)(store.value, eventParameters.itemId));
|
|
@@ -248,6 +254,10 @@ const useTreeViewLazyLoading = ({
|
|
|
248
254
|
getChildrenCount
|
|
249
255
|
});
|
|
250
256
|
} else {
|
|
257
|
+
const expandedItems = (0, _internals.selectorExpandedItems)(store.value);
|
|
258
|
+
if (expandedItems.length > 0) {
|
|
259
|
+
instance.resetItemExpansion();
|
|
260
|
+
}
|
|
251
261
|
instance.fetchItems();
|
|
252
262
|
}
|
|
253
263
|
firstRenderRef.current = false;
|
|
@@ -24,66 +24,64 @@ let RequestStatus = exports.RequestStatus = /*#__PURE__*/function (RequestStatus
|
|
|
24
24
|
* Uses `ParentId` to uniquely identify a request
|
|
25
25
|
*/
|
|
26
26
|
class NestedDataManager {
|
|
27
|
+
pendingRequests = new Set();
|
|
28
|
+
queuedRequests = new Set();
|
|
29
|
+
settledRequests = new Set();
|
|
27
30
|
constructor(instance, maxConcurrentRequests = MAX_CONCURRENT_REQUESTS) {
|
|
28
|
-
this.pendingRequests = new Set();
|
|
29
|
-
this.queuedRequests = new Set();
|
|
30
|
-
this.settledRequests = new Set();
|
|
31
|
-
this.instance = void 0;
|
|
32
|
-
this.maxConcurrentRequests = void 0;
|
|
33
|
-
this.processQueue = async () => {
|
|
34
|
-
if (this.queuedRequests.size === 0 || this.pendingRequests.size >= this.maxConcurrentRequests) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const loopLength = Math.min(this.maxConcurrentRequests - this.pendingRequests.size, this.queuedRequests.size);
|
|
38
|
-
if (loopLength === 0) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const fetchQueue = Array.from(this.queuedRequests);
|
|
42
|
-
const fetchPromises = [];
|
|
43
|
-
for (let i = 0; i < loopLength; i += 1) {
|
|
44
|
-
const id = fetchQueue[i];
|
|
45
|
-
this.queuedRequests.delete(id);
|
|
46
|
-
this.pendingRequests.add(id);
|
|
47
|
-
fetchPromises.push(this.instance.fetchItemChildren(id));
|
|
48
|
-
}
|
|
49
|
-
await Promise.all(fetchPromises);
|
|
50
|
-
};
|
|
51
|
-
this.queue = async ids => {
|
|
52
|
-
const loadingIds = {};
|
|
53
|
-
ids.forEach(id => {
|
|
54
|
-
this.queuedRequests.add(id);
|
|
55
|
-
loadingIds[id] = true;
|
|
56
|
-
});
|
|
57
|
-
await this.processQueue();
|
|
58
|
-
};
|
|
59
|
-
this.setRequestSettled = async id => {
|
|
60
|
-
this.pendingRequests.delete(id);
|
|
61
|
-
this.settledRequests.add(id);
|
|
62
|
-
await this.processQueue();
|
|
63
|
-
};
|
|
64
|
-
this.clear = () => {
|
|
65
|
-
this.queuedRequests.clear();
|
|
66
|
-
Array.from(this.pendingRequests).forEach(id => this.clearPendingRequest(id));
|
|
67
|
-
};
|
|
68
|
-
this.clearPendingRequest = async id => {
|
|
69
|
-
this.pendingRequests.delete(id);
|
|
70
|
-
await this.processQueue();
|
|
71
|
-
};
|
|
72
|
-
this.getRequestStatus = id => {
|
|
73
|
-
if (this.pendingRequests.has(id)) {
|
|
74
|
-
return RequestStatus.PENDING;
|
|
75
|
-
}
|
|
76
|
-
if (this.queuedRequests.has(id)) {
|
|
77
|
-
return RequestStatus.QUEUED;
|
|
78
|
-
}
|
|
79
|
-
if (this.settledRequests.has(id)) {
|
|
80
|
-
return RequestStatus.SETTLED;
|
|
81
|
-
}
|
|
82
|
-
return RequestStatus.UNKNOWN;
|
|
83
|
-
};
|
|
84
|
-
this.getActiveRequestsCount = () => this.pendingRequests.size + this.queuedRequests.size;
|
|
85
31
|
this.instance = instance;
|
|
86
32
|
this.maxConcurrentRequests = maxConcurrentRequests;
|
|
87
33
|
}
|
|
34
|
+
processQueue = async () => {
|
|
35
|
+
if (this.queuedRequests.size === 0 || this.pendingRequests.size >= this.maxConcurrentRequests) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const loopLength = Math.min(this.maxConcurrentRequests - this.pendingRequests.size, this.queuedRequests.size);
|
|
39
|
+
if (loopLength === 0) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const fetchQueue = Array.from(this.queuedRequests);
|
|
43
|
+
const fetchPromises = [];
|
|
44
|
+
for (let i = 0; i < loopLength; i += 1) {
|
|
45
|
+
const id = fetchQueue[i];
|
|
46
|
+
this.queuedRequests.delete(id);
|
|
47
|
+
this.pendingRequests.add(id);
|
|
48
|
+
fetchPromises.push(this.instance.fetchItemChildren(id));
|
|
49
|
+
}
|
|
50
|
+
await Promise.all(fetchPromises);
|
|
51
|
+
};
|
|
52
|
+
queue = async ids => {
|
|
53
|
+
const loadingIds = {};
|
|
54
|
+
ids.forEach(id => {
|
|
55
|
+
this.queuedRequests.add(id);
|
|
56
|
+
loadingIds[id] = true;
|
|
57
|
+
});
|
|
58
|
+
await this.processQueue();
|
|
59
|
+
};
|
|
60
|
+
setRequestSettled = async id => {
|
|
61
|
+
this.pendingRequests.delete(id);
|
|
62
|
+
this.settledRequests.add(id);
|
|
63
|
+
await this.processQueue();
|
|
64
|
+
};
|
|
65
|
+
clear = () => {
|
|
66
|
+
this.queuedRequests.clear();
|
|
67
|
+
Array.from(this.pendingRequests).forEach(id => this.clearPendingRequest(id));
|
|
68
|
+
};
|
|
69
|
+
clearPendingRequest = async id => {
|
|
70
|
+
this.pendingRequests.delete(id);
|
|
71
|
+
await this.processQueue();
|
|
72
|
+
};
|
|
73
|
+
getRequestStatus = id => {
|
|
74
|
+
if (this.pendingRequests.has(id)) {
|
|
75
|
+
return RequestStatus.PENDING;
|
|
76
|
+
}
|
|
77
|
+
if (this.queuedRequests.has(id)) {
|
|
78
|
+
return RequestStatus.QUEUED;
|
|
79
|
+
}
|
|
80
|
+
if (this.settledRequests.has(id)) {
|
|
81
|
+
return RequestStatus.SETTLED;
|
|
82
|
+
}
|
|
83
|
+
return RequestStatus.UNKNOWN;
|
|
84
|
+
};
|
|
85
|
+
getActiveRequestsCount = () => this.pendingRequests.size + this.queuedRequests.size;
|
|
88
86
|
}
|
|
89
87
|
exports.NestedDataManager = NestedDataManager;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-tree-view-pro",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.10.1",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Pro plan edition of the MUI X Tree View components.",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/runtime": "^7.28.2",
|
|
36
|
-
"@mui/utils": "^7.
|
|
36
|
+
"@mui/utils": "^7.3.1",
|
|
37
37
|
"@types/react-transition-group": "^4.4.12",
|
|
38
38
|
"clsx": "^2.1.1",
|
|
39
39
|
"prop-types": "^15.8.1",
|
|
40
40
|
"react-transition-group": "^4.4.5",
|
|
41
41
|
"reselect": "^5.1.1",
|
|
42
42
|
"use-sync-external-store": "^1.5.0",
|
|
43
|
-
"@mui/x-internals": "8.
|
|
44
|
-
"@mui/x-
|
|
45
|
-
"@mui/x-
|
|
43
|
+
"@mui/x-internals": "8.10.0",
|
|
44
|
+
"@mui/x-license": "8.10.1",
|
|
45
|
+
"@mui/x-tree-view": "8.10.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@emotion/react": "^11.9.0",
|
|
@@ -63,32 +63,30 @@
|
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=14.0.0"
|
|
65
65
|
},
|
|
66
|
-
"
|
|
67
|
-
"
|
|
66
|
+
"type": "commonjs",
|
|
67
|
+
"types": "./index.d.ts",
|
|
68
68
|
"exports": {
|
|
69
69
|
"./package.json": "./package.json",
|
|
70
70
|
".": {
|
|
71
|
-
"require": {
|
|
72
|
-
"types": "./index.d.ts",
|
|
73
|
-
"default": "./index.js"
|
|
74
|
-
},
|
|
75
71
|
"import": {
|
|
76
72
|
"types": "./esm/index.d.ts",
|
|
77
73
|
"default": "./esm/index.js"
|
|
74
|
+
},
|
|
75
|
+
"require": {
|
|
76
|
+
"types": "./index.d.ts",
|
|
77
|
+
"default": "./index.js"
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
"./*": {
|
|
81
|
-
"require": {
|
|
82
|
-
"types": "./*/index.d.ts",
|
|
83
|
-
"default": "./*/index.js"
|
|
84
|
-
},
|
|
85
81
|
"import": {
|
|
86
82
|
"types": "./esm/*/index.d.ts",
|
|
87
83
|
"default": "./esm/*/index.js"
|
|
84
|
+
},
|
|
85
|
+
"require": {
|
|
86
|
+
"types": "./*/index.d.ts",
|
|
87
|
+
"default": "./*/index.js"
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
|
-
"./esm": null
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
"types": "./index.d.ts"
|
|
90
|
+
"./esm": null
|
|
91
|
+
}
|
|
94
92
|
}
|