@mui/x-tree-view-pro 8.27.2 → 8.28.5

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 CHANGED
@@ -5,6 +5,470 @@
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.28.5
9
+
10
+ _May 8, 2026_
11
+
12
+ We'd like to extend a big thank you to the 2 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 🐞 Bugfixes
15
+
16
+ The following team members contributed to this release:
17
+ @LukasTy, @MBilalShafi
18
+
19
+ ### Data Grid
20
+
21
+ #### `@mui/x-data-grid@8.28.5`
22
+
23
+ - [DataGrid] Fix active filter detection for array values (#22357) @MBilalShafi
24
+ - [DataGrid] Fix crash when grouping/tree-data values match `Object.prototype` property names (#22343) @LukasTy
25
+
26
+ #### `@mui/x-data-grid-pro@8.28.5` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
27
+
28
+ Same changes as in `@mui/x-data-grid@8.28.5`.
29
+
30
+ #### `@mui/x-data-grid-premium@8.28.5` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
31
+
32
+ Same changes as in `@mui/x-data-grid-pro@8.28.5`.
33
+
34
+ ### Date and Time Pickers
35
+
36
+ #### `@mui/x-date-pickers@8.28.5`
37
+
38
+ - [pickers] Fix duplicate hour label in `MultiSectionDigitalClock` on DST day (#22350) @LukasTy
39
+
40
+ #### `@mui/x-date-pickers-pro@8.28.5` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
41
+
42
+ Same changes as in `@mui/x-date-pickers@8.28.5`.
43
+
44
+ ### Tree View
45
+
46
+ #### `@mui/x-tree-view@8.28.5`
47
+
48
+ - [tree view] Fix stale Tree View `apiRef` after keyed remount (#22355) @MBilalShafi
49
+
50
+ #### `@mui/x-tree-view-pro@8.28.5` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
51
+
52
+ Same changes as in `@mui/x-tree-view@8.28.5`.
53
+
54
+ ### Core
55
+
56
+ - [code-infra] Fix broken `valelint` and docs build (#22362) @LukasTy
57
+
58
+ ## 8.28.4
59
+
60
+ _Apr 27, 2026_
61
+
62
+ We'd like to extend a big thank you to the 3 contributors who made this release possible. Here are some highlights ✨:
63
+
64
+ - 🐞 Bugfixes
65
+
66
+ Special thanks go out to these community members for their valuable contributions:
67
+ @supunsathsara
68
+
69
+ The following team members contributed to this release:
70
+ @LukasTy, @michelengelen
71
+
72
+ ### Date and Time Pickers
73
+
74
+ #### `@mui/x-date-pickers@8.28.4`
75
+
76
+ - [pickers] Fix `DateRangeCalendar` drag with `AdapterDayjs` plain-constructor values (#22170) @LukasTy
77
+ - [pickers] Fix disabled state not overriding error border color (#22186) @supunsathsara
78
+ - [pickers] Use `convertToMeridiem` utility in `transferDateSectionValue` (#22132) @michelengelen
79
+
80
+ #### `@mui/x-date-pickers-pro@8.28.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
81
+
82
+ Same changes as in `@mui/x-date-pickers@8.28.4`.
83
+
84
+ ### Docs
85
+
86
+ - [docs] Remove obsolete v7 deprecation warning for `dayOfWeekFormatter` (#22120) @LukasTy
87
+ - [docs] Use mui.com for broken links checker known targets (#22171) @LukasTy
88
+
89
+ ## 8.28.3
90
+
91
+ _Apr 15, 2026_
92
+
93
+ We'd like to extend a big thank you to the 6 contributors who made this release possible. Here are some highlights ✨:
94
+
95
+ - 🐞 Bugfixes
96
+
97
+ Special thanks go out to this community member for their valuable contribution:
98
+ @nk10nikhil
99
+
100
+ The following team members contributed to this release:
101
+ @flaviendelangle, @LukasTy, @MBilalShafi, @michelengelen, @sai6855
102
+
103
+ ### Data Grid
104
+
105
+ #### `@mui/x-data-grid@8.28.2`
106
+
107
+ Internal changes.
108
+
109
+ #### `@mui/x-data-grid-pro@8.28.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
110
+
111
+ Same changes as in `@mui/x-data-grid@8.28.2`, plus:
112
+
113
+ - [DataGridPro] Improve trigger for nested row reordering (#21996) @MBilalShafi
114
+
115
+ #### `@mui/x-data-grid-premium@8.28.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
116
+
117
+ Same changes as in `@mui/x-data-grid-pro@8.28.2`.
118
+
119
+ ### Date and Time Pickers
120
+
121
+ #### `@mui/x-date-pickers@8.28.3`
122
+
123
+ - [pickers] Ensure correct `display` property on Day component (#21980) @LukasTy
124
+
125
+ #### `@mui/x-date-pickers-pro@8.28.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
126
+
127
+ Same changes as in `@mui/x-date-pickers@8.28.3`.
128
+
129
+ ### Charts
130
+
131
+ #### `@mui/x-charts@8.28.2`
132
+
133
+ - [charts] Add missing export for `ChartsBrushOverlay` (#21993) (#22008) @nk10nikhil
134
+
135
+ #### `@mui/x-charts-pro@8.28.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
136
+
137
+ Same changes as in `@mui/x-charts@8.28.2`.
138
+
139
+ #### `@mui/x-charts-premium@8.28.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
140
+
141
+ Same changes as in `@mui/x-charts-pro@8.28.2`.
142
+
143
+ ### Tree View
144
+
145
+ #### `@mui/x-tree-view@8.28.3`
146
+
147
+ - [tree view] Move `lazyLoadedItems` initialization to state initializer (#22087) @michelengelen
148
+
149
+ #### `@mui/x-tree-view-pro@8.28.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
150
+
151
+ Same changes as in `@mui/x-tree-view@8.28.3`, plus:
152
+
153
+ - [RichTreeViewPro] Allow to auto-expand lazy loaded items (#21957) @flaviendelangle
154
+
155
+ ### Docs
156
+
157
+ - [docs] Fix `TreeDataFullExample` data grid demo crash (#22007) @sai6855
158
+
159
+ ### Miscellaneous
160
+
161
+ - [core] Post v9 stable updates (#22035) @LukasTy
162
+
163
+ ## 8.28.2
164
+
165
+ _Apr 1, 2026_
166
+
167
+ We'd like to extend a big thank you to the 4 contributors who made this release possible.
168
+
169
+ Special thanks go out to this community member for their valuable contribution:
170
+ @mixelburg, @sibananda485
171
+
172
+ The following team members contributed to this release:
173
+ @dav-is, @JCQuintas
174
+
175
+ ### Data Grid
176
+
177
+ #### `@mui/x-data-grid@8.28.2`
178
+
179
+ - [DataGrid] Export `GridColumnUnsortedIconProps` for custom column icon slots (#21898) @mixelburg
180
+
181
+ #### `@mui/x-data-grid-pro@8.28.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
182
+
183
+ Same changes as in `@mui/x-data-grid@8.28.2`.
184
+
185
+ #### `@mui/x-data-grid-premium@8.28.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
186
+
187
+ Same changes as in `@mui/x-data-grid-pro@8.28.2`, plus:
188
+
189
+ - [DataGridPremium] Fix clipboard paste issue in portal (#21949) @sibananda485
190
+
191
+ ### Charts
192
+
193
+ #### `@mui/x-charts@8.28.2`
194
+
195
+ - [charts] Fix zoom slider preview with discard filter mode (#21906) @JCQuintas
196
+
197
+ #### `@mui/x-charts-pro@8.28.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
198
+
199
+ Same changes as in `@mui/x-charts@8.28.2`.
200
+
201
+ #### `@mui/x-charts-premium@8.28.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
202
+
203
+ Same changes as in `@mui/x-charts-pro@8.28.2`.
204
+
205
+ ### Docs
206
+
207
+ - [docs] Fix JSDOM → jsdom casing (#21908) @JCQuintas
208
+
209
+ ### Core
210
+
211
+ - [docs-infra] Set `SEARCH_INDEX` Env for v8 (#21875) @dav-is
212
+
213
+ ## 8.28.1
214
+
215
+ _Mar 26, 2026_
216
+
217
+ We'd like to extend a big thank you to the 2 contributors who made this release possible.
218
+
219
+ The following team members contributed to this release:
220
+ @arminmeh, @cherniavskii
221
+
222
+ ### Data Grid
223
+
224
+ #### `@mui/x-data-grid@8.28.1`
225
+
226
+ - [DataGrid] Prevent repeated `hasScrollbar` state updates (#21847) @arminmeh
227
+
228
+ #### `@mui/x-data-grid-pro@8.28.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
229
+
230
+ Same changes as in `@mui/x-data-grid@8.28.1`, plus:
231
+
232
+ - [DataGridPro] `fetchRows()` API's default `start` and `end` params based on scroll position with lazy loading (#21811) @arminmeh
233
+
234
+ #### `@mui/x-data-grid-premium@8.28.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
235
+
236
+ Same changes as in `@mui/x-data-grid-pro@8.28.1`.
237
+
238
+ ### Core
239
+
240
+ - [internal] Remove headless data grid packages (#21848) @cherniavskii
241
+
242
+ ## 8.28.0
243
+
244
+ _Mar 19, 2026_
245
+
246
+ We'd like to extend a big thank you to the 5 contributors who made this release possible.
247
+
248
+ The following team members contributed to this release:
249
+ @alexfauquette, @brijeshb42, @Janpot, @JCQuintas, @sai6855
250
+
251
+ ### Data Grid
252
+
253
+ #### `@mui/x-data-grid@8.28.0`
254
+
255
+ - [DataGrid] Move `elementOverrides` to constants and remove duplicates (@sai6855) (#21752) @github-actions[bot]
256
+
257
+ #### `@mui/x-data-grid-pro@8.28.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
258
+
259
+ Same changes as in `@mui/x-data-grid@8.28.0`.
260
+
261
+ #### `@mui/x-data-grid-premium@8.28.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
262
+
263
+ Same changes as in `@mui/x-data-grid-pro@8.28.0`.
264
+
265
+ ### Date and Time Pickers
266
+
267
+ #### `@mui/x-date-pickers@8.27.2`
268
+
269
+ Internal changes.
270
+
271
+ #### `@mui/x-date-pickers-pro@8.27.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
272
+
273
+ Same changes as in `@mui/x-date-pickers@8.27.2`.
274
+
275
+ ### Charts
276
+
277
+ #### `@mui/x-charts@8.28.0`
278
+
279
+ - [charts] Improve deprecation warnings (#21760) (#21767) @alexfauquette
280
+ - [charts] Refactor `FunnelChart` classes structure (@JCQuintas) (#21763) @github-actions[bot]
281
+ - [charts] Refactor `Heatmap` classes structure (#21653) (#21745) @JCQuintas
282
+ - [charts] Refactor `PieChart` classes structure (@JCQuintas) (#21715) @github-actions[bot]
283
+ - [charts] Refactor `RadarChart` classes structure (@JCQuintas) (#21730) @github-actions[bot]
284
+ - [charts] Refactor `SankeyChart` classes structure (#21654) (#21726) @JCQuintas
285
+ - [charts] Rename `data-series-id` by `data-series` (#21761) (#21772) @alexfauquette
286
+
287
+ #### `@mui/x-charts-pro@8.28.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
288
+
289
+ Same changes as in `@mui/x-charts@8.28.0`, plus:
290
+
291
+ - [charts-pro] Allow `brush` interaction to accept `requiredKeys/pointerMode` (#21723) @JCQuintas
292
+
293
+ #### `@mui/x-charts-premium@8.28.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
294
+
295
+ Same changes as in `@mui/x-charts-pro@8.28.0`.
296
+
297
+ ### Tree View
298
+
299
+ #### `@mui/x-tree-view@8.27.2`
300
+
301
+ Internal changes.
302
+
303
+ #### `@mui/x-tree-view-pro@8.27.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
304
+
305
+ Same changes as in `@mui/x-tree-view@8.27.2`.
306
+
307
+ ### Codemod
308
+
309
+ #### `@mui/x-codemod@8.27.0`
310
+
311
+ Internal changes.
312
+
313
+ ### Core
314
+
315
+ - [code-infra] Fix contributor generation in changelog (#21712) @brijeshb42
316
+ - [code-infra] Install pkg-pr-new (#21778) @Janpot
317
+
318
+ ## 8.27.5
319
+
320
+ _Mar 11, 2026_
321
+
322
+ We'd like to extend a big thank you to the 7 contributors who made this release possible. Here are some highlights ✨:
323
+
324
+ - 🐞 Bugfixes
325
+
326
+ The following team members contributed to this release:
327
+ @bernardobelchior, @JCQuintas, @MBilalShafi, @michelengelen, @mj12albert, @sai6855, @siriwatknp
328
+
329
+ ### Data Grid
330
+
331
+ #### `@mui/x-data-grid@8.27.5`
332
+
333
+ - [DataGrid] Fix crash when `rows` and `rowModesModel` are updated simultaneously (#21684) @michelengelen
334
+ - [DataGrid] Forward rest props in `GridFilterInputMultipleValue` (#21444) @siriwatknp
335
+ - [DataGrid] Remove double rtl inversion logic for columns pinning (#21443) @siriwatknp
336
+ - [DataGrid] Add missing `resizablePanelHandle` classes to `gridClasses` object (#21632) @sai6855
337
+ - [DataGrid] Refactor `headerAlign` style calls (#21633) @sai6855
338
+ - [DataGrid] Fix keyboard navigation with single-row checkbox selection (#21529) @mj12albert
339
+
340
+ #### `@mui/x-data-grid-pro@8.27.5` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
341
+
342
+ Same changes as in `@mui/x-data-grid@8.27.5`, plus:
343
+
344
+ - [DataGridPro] Add `role="presentation"` to detail panel toggle header content (#21691) @michelengelen
345
+ - [DataGridPro] Fix sorting not reflected in nested server-side data (#21641) @MBilalShafi
346
+
347
+ #### `@mui/x-data-grid-premium@8.27.5` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
348
+
349
+ Same changes as in `@mui/x-data-grid-pro@8.27.5`.
350
+
351
+ ### Charts
352
+
353
+ #### `@mui/x-charts@8.27.5`
354
+
355
+ - [charts] Refactor `BarChart` classes structure (#21601) (#21644) @JCQuintas
356
+ - [charts] Refactor `LineChart` classes structure (#21672) @JCQuintas
357
+ - [charts] Refactor `ScatterChart` classes structure (#21706) @JCQuintas
358
+
359
+ #### `@mui/x-charts-pro@8.27.5` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
360
+
361
+ Same changes as in `@mui/x-charts@8.27.5`, plus:
362
+
363
+ - [charts-pro] Fix image export truncated when page is zoomed out (#21696) @bernardobelchior
364
+
365
+ #### `@mui/x-charts-premium@8.27.5` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
366
+
367
+ Same changes as in `@mui/x-charts-pro@8.27.5`.
368
+
369
+ ### Docs
370
+
371
+ - [docs] Fix `AssistantWithDataSource` demo crashing (#21631) @sai6855
372
+ - [docs] Move Range Bar Chart to existing charts (#21122) @bernardobelchior
373
+
374
+ ### Core
375
+
376
+ - [code-infra] Fix datagrid test flakyness (#21657) @JCQuintas
377
+ - [code-infra] Removed `getTeamMembers` function and usage from the release script (#21608) @michelengelen
378
+
379
+ ### Miscellaneous
380
+
381
+ - [test] Add missing tests for forwarding props to filter operators in DataGrid (#21700) @siriwatknp
382
+
383
+ ## 8.27.4
384
+
385
+ _Mar 5, 2026_
386
+
387
+ We'd like to extend a big thank you to the 6 contributors who made this release possible. Here are some highlights ✨:
388
+
389
+ - 🐞 Bugfixes
390
+ - 🌎 Improve Ukrainian (uk-UA) locale
391
+
392
+ Special thanks go out to this community member for their valuable contribution:
393
+ @lion1963
394
+
395
+ The following team members contributed to this release:
396
+ @arminmeh, @brijeshb42, @dav-is, @JCQuintas, @sai6855
397
+
398
+ ### Data Grid
399
+
400
+ #### `@mui/x-data-grid@8.27.4`
401
+
402
+ - [DataGrid] Prevent unnecessary row selection checkbox rerendering (#21571) @arminmeh
403
+ - [DataGrid] Make `GridScrollArea` overrides resolver dynamic (#21612) @sai6855
404
+ - [l10n] Improve Ukrainian (uk-UA) locale (#21381) @lion1963
405
+
406
+ #### `@mui/x-data-grid-pro@8.27.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
407
+
408
+ Same changes as in `@mui/x-data-grid@8.27.4`, plus:
409
+
410
+ - [DataGridPro] Use `getRowId` prop to calculate the tree data row update (#21544) @arminmeh
411
+
412
+ #### `@mui/x-data-grid-premium@8.27.4` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
413
+
414
+ Same changes as in `@mui/x-data-grid-pro@8.27.4`.
415
+
416
+ ### Charts
417
+
418
+ #### `@mui/x-charts@8.27.4`
419
+
420
+ - [charts] Deprecate `ChartDataProvider` in favour of `ChartsDataProvider` (#21549) @JCQuintas
421
+ - [charts] Rename `ChartContainer` to `ChartsContainer` (#21186) @JCQuintas
422
+ - [charts] Rename `ChartZoomSlider` to `ChartsZoomSlider` (#21572) @JCQuintas
423
+
424
+ #### `@mui/x-charts-pro@8.27.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
425
+
426
+ Same changes as in `@mui/x-charts@8.27.4`.
427
+
428
+ #### `@mui/x-charts-premium@8.27.4` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
429
+
430
+ Same changes as in `@mui/x-charts-pro@8.27.4`.
431
+
432
+ ### Core
433
+
434
+ - [code-infra] Add eslint rule to prevent `Math.random` in docs (#21505) (#21563) @JCQuintas
435
+ - [code-infra] V8 Dedupe (#21561) @JCQuintas
436
+ - [docs-infra] Apply Cookie Banner to v8.x Branch (#21448) @dav-is
437
+ - [code-infra] Setup checkout to do full clone for non master branches (#21624) @brijeshb42
438
+
439
+ ## 8.27.3
440
+
441
+ _Feb 25, 2026_
442
+
443
+ We'd like to extend a big thank you to the 4 contributors who made this release possible. Here are some highlights ✨:
444
+
445
+ - 🐞 Bugfixes
446
+ - ⚡️ Improved dynamic data support and cache invalidation in lazy loading for Data Grid Pro
447
+
448
+ The following team members contributed to this release:
449
+ @cherniavskii, @michelengelen, @MBilalShafi, @arminmeh
450
+
451
+ ### Data Grid
452
+
453
+ #### `@mui/x-data-grid@8.27.3`
454
+
455
+ - [DataGrid] Preserve key input during row edit when using `rowModesModel` (#21457) @michelengelen
456
+
457
+ #### `@mui/x-data-grid-pro@8.27.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
458
+
459
+ Same changes as in `@mui/x-data-grid@8.27.3`, plus:
460
+
461
+ - [DataGridPro] Improve dynamic data support and cache invalidation in lazy loading (#21465) @MBilalShafi
462
+
463
+ #### `@mui/x-data-grid-premium@8.27.3` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
464
+
465
+ Same changes as in `@mui/x-data-grid-pro@8.27.3`.
466
+
467
+ ### Core
468
+
469
+ - [code-infra] Do not append `x` to the last version for the compare API (#21422) @arminmeh
470
+ - [docs-infra] Fix current version detection logic (#21415) @cherniavskii
471
+
8
472
  ## 8.27.2
9
473
 
10
474
  _Feb 20, 2026_
@@ -52,7 +52,7 @@ const RichTreeViewProRoot = exports.RichTreeViewProRoot = (0, _zeroStyled.styled
52
52
  outline: 0,
53
53
  position: 'relative'
54
54
  });
55
- const releaseInfo = "MTc3MTU0NTYwMDAwMA==";
55
+ const releaseInfo = "MTc3ODE5ODQwMDAwMA==";
56
56
 
57
57
  /**
58
58
  *
@@ -332,6 +332,15 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
332
332
  * @param {boolean} isSelected `true` if the item has just been selected, `false` if it has just been deselected.
333
333
  */
334
334
  onItemSelectionToggle: _propTypes.default.func,
335
+ /**
336
+ * Callback fired when the children of an item are loaded from the data source.
337
+ * Only relevant for lazy-loaded tree views.
338
+ * @param {object} parameters The parameters of the callback.
339
+ * @param {R[]} parameters.items The items that were loaded.
340
+ * @param {TreeViewItemId | null} parameters.parentId The id of the parent item whose children were loaded. `null` if the root items were loaded.
341
+ * @param {boolean} parameters.isCacheHit `true` if the items were loaded from the cache, `false` if they were fetched from the data source.
342
+ */
343
+ onItemsLazyLoaded: _propTypes.default.func,
335
344
  /**
336
345
  * Callback fired when Tree Items are selected/deselected.
337
346
  * @param {React.SyntheticEvent} event The DOM event that triggered the change. Can be null when the change is caused by the `publicAPI.setItemSelection()` method.
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.useExtractRichTreeViewProParameters = useExtractRichTreeViewProParameters;
9
9
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
10
  var React = _interopRequireWildcard(require("react"));
11
- const _excluded = ["apiRef", "slots", "slotProps", "disabledItemsFocusable", "items", "isItemDisabled", "isItemSelectionDisabled", "getItemLabel", "getItemChildren", "getItemId", "onItemClick", "itemChildrenIndentation", "id", "expandedItems", "defaultExpandedItems", "onExpandedItemsChange", "onItemExpansionToggle", "expansionTrigger", "disableSelection", "selectedItems", "defaultSelectedItems", "multiSelect", "checkboxSelection", "selectionPropagation", "onSelectedItemsChange", "onItemSelectionToggle", "onItemFocus", "onItemLabelChange", "isItemEditable", "dataSource", "dataSourceCache", "itemsReordering", "isItemReorderable", "canMoveItemToNewPosition", "onItemPositionChange"];
11
+ const _excluded = ["apiRef", "slots", "slotProps", "disabledItemsFocusable", "items", "isItemDisabled", "isItemSelectionDisabled", "getItemLabel", "getItemChildren", "getItemId", "onItemClick", "itemChildrenIndentation", "id", "expandedItems", "defaultExpandedItems", "onExpandedItemsChange", "onItemExpansionToggle", "expansionTrigger", "disableSelection", "selectedItems", "defaultSelectedItems", "multiSelect", "checkboxSelection", "selectionPropagation", "onSelectedItemsChange", "onItemSelectionToggle", "onItemFocus", "onItemLabelChange", "isItemEditable", "dataSource", "dataSourceCache", "onItemsLazyLoaded", "itemsReordering", "isItemReorderable", "canMoveItemToNewPosition", "onItemPositionChange"];
12
12
  function useExtractRichTreeViewProParameters(props) {
13
13
  const {
14
14
  // Props for Provider
@@ -46,6 +46,7 @@ function useExtractRichTreeViewProParameters(props) {
46
46
  // RichTreeViewProStore parameters
47
47
  dataSource,
48
48
  dataSourceCache,
49
+ onItemsLazyLoaded,
49
50
  itemsReordering,
50
51
  isItemReorderable,
51
52
  canMoveItemToNewPosition,
@@ -86,6 +87,7 @@ function useExtractRichTreeViewProParameters(props) {
86
87
  // RichTreeViewProStore parameters
87
88
  dataSource,
88
89
  dataSourceCache,
90
+ onItemsLazyLoaded,
89
91
  itemsReordering,
90
92
  isItemReorderable,
91
93
  canMoveItemToNewPosition,
@@ -96,7 +98,7 @@ function useExtractRichTreeViewProParameters(props) {
96
98
  // RichTreeViewStore parameters
97
99
  onItemLabelChange, isItemEditable,
98
100
  // RichTreeViewProStore parameters
99
- dataSource, dataSourceCache, itemsReordering, isItemReorderable, canMoveItemToNewPosition, onItemPositionChange]);
101
+ dataSource, dataSourceCache, onItemsLazyLoaded, itemsReordering, isItemReorderable, canMoveItemToNewPosition, onItemPositionChange]);
100
102
  return {
101
103
  apiRef,
102
104
  slots,
@@ -45,7 +45,7 @@ export const RichTreeViewProRoot = styled('ul', {
45
45
  outline: 0,
46
46
  position: 'relative'
47
47
  });
48
- const releaseInfo = "MTc3MTU0NTYwMDAwMA==";
48
+ const releaseInfo = "MTc3ODE5ODQwMDAwMA==";
49
49
 
50
50
  /**
51
51
  *
@@ -325,6 +325,15 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
325
325
  * @param {boolean} isSelected `true` if the item has just been selected, `false` if it has just been deselected.
326
326
  */
327
327
  onItemSelectionToggle: PropTypes.func,
328
+ /**
329
+ * Callback fired when the children of an item are loaded from the data source.
330
+ * Only relevant for lazy-loaded tree views.
331
+ * @param {object} parameters The parameters of the callback.
332
+ * @param {R[]} parameters.items The items that were loaded.
333
+ * @param {TreeViewItemId | null} parameters.parentId The id of the parent item whose children were loaded. `null` if the root items were loaded.
334
+ * @param {boolean} parameters.isCacheHit `true` if the items were loaded from the cache, `false` if they were fetched from the data source.
335
+ */
336
+ onItemsLazyLoaded: PropTypes.func,
328
337
  /**
329
338
  * Callback fired when Tree Items are selected/deselected.
330
339
  * @param {React.SyntheticEvent} event The DOM event that triggered the change. Can be null when the change is caused by the `publicAPI.setItemSelection()` method.
@@ -1,5 +1,5 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
- const _excluded = ["apiRef", "slots", "slotProps", "disabledItemsFocusable", "items", "isItemDisabled", "isItemSelectionDisabled", "getItemLabel", "getItemChildren", "getItemId", "onItemClick", "itemChildrenIndentation", "id", "expandedItems", "defaultExpandedItems", "onExpandedItemsChange", "onItemExpansionToggle", "expansionTrigger", "disableSelection", "selectedItems", "defaultSelectedItems", "multiSelect", "checkboxSelection", "selectionPropagation", "onSelectedItemsChange", "onItemSelectionToggle", "onItemFocus", "onItemLabelChange", "isItemEditable", "dataSource", "dataSourceCache", "itemsReordering", "isItemReorderable", "canMoveItemToNewPosition", "onItemPositionChange"];
2
+ const _excluded = ["apiRef", "slots", "slotProps", "disabledItemsFocusable", "items", "isItemDisabled", "isItemSelectionDisabled", "getItemLabel", "getItemChildren", "getItemId", "onItemClick", "itemChildrenIndentation", "id", "expandedItems", "defaultExpandedItems", "onExpandedItemsChange", "onItemExpansionToggle", "expansionTrigger", "disableSelection", "selectedItems", "defaultSelectedItems", "multiSelect", "checkboxSelection", "selectionPropagation", "onSelectedItemsChange", "onItemSelectionToggle", "onItemFocus", "onItemLabelChange", "isItemEditable", "dataSource", "dataSourceCache", "onItemsLazyLoaded", "itemsReordering", "isItemReorderable", "canMoveItemToNewPosition", "onItemPositionChange"];
3
3
  import * as React from 'react';
4
4
  export function useExtractRichTreeViewProParameters(props) {
5
5
  const {
@@ -38,6 +38,7 @@ export function useExtractRichTreeViewProParameters(props) {
38
38
  // RichTreeViewProStore parameters
39
39
  dataSource,
40
40
  dataSourceCache,
41
+ onItemsLazyLoaded,
41
42
  itemsReordering,
42
43
  isItemReorderable,
43
44
  canMoveItemToNewPosition,
@@ -78,6 +79,7 @@ export function useExtractRichTreeViewProParameters(props) {
78
79
  // RichTreeViewProStore parameters
79
80
  dataSource,
80
81
  dataSourceCache,
82
+ onItemsLazyLoaded,
81
83
  itemsReordering,
82
84
  isItemReorderable,
83
85
  canMoveItemToNewPosition,
@@ -88,7 +90,7 @@ export function useExtractRichTreeViewProParameters(props) {
88
90
  // RichTreeViewStore parameters
89
91
  onItemLabelChange, isItemEditable,
90
92
  // RichTreeViewProStore parameters
91
- dataSource, dataSourceCache, itemsReordering, isItemReorderable, canMoveItemToNewPosition, onItemPositionChange]);
93
+ dataSource, dataSourceCache, onItemsLazyLoaded, itemsReordering, isItemReorderable, canMoveItemToNewPosition, onItemPositionChange]);
92
94
  return {
93
95
  apiRef,
94
96
  slots,
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-tree-view-pro v8.27.2
2
+ * @mui/x-tree-view-pro v8.28.5
3
3
  *
4
4
  * @license SEE LICENSE IN LICENSE
5
5
  * This source code is licensed under the SEE LICENSE IN LICENSE license found in the
@@ -4,8 +4,9 @@ import { RichTreeViewProStoreParameters, RichTreeViewProState } from "./RichTree
4
4
  import { TreeViewLazyLoadingPlugin } from "../plugins/lazyLoading/index.js";
5
5
  import { TreeViewItemsReorderingPlugin } from "../plugins/itemsReordering/index.js";
6
6
  export declare class RichTreeViewProStore<R extends TreeViewValidItem<R>, Multiple extends boolean | undefined> extends ExtendableRichTreeViewStore<R, Multiple, RichTreeViewProState<R, Multiple>, RichTreeViewProStoreParameters<R, Multiple>> {
7
- lazyLoading: TreeViewLazyLoadingPlugin;
7
+ lazyLoading: TreeViewLazyLoadingPlugin<R>;
8
8
  itemsReordering: TreeViewItemsReorderingPlugin;
9
+ disposeEffect: () => () => void;
9
10
  constructor(parameters: RichTreeViewProStoreParameters<R, Multiple>);
10
11
  buildPublicAPI(): {
11
12
  updateItemChildren: (itemId: import("@mui/x-tree-view").TreeViewItemId | null) => Promise<void>;
@@ -5,6 +5,10 @@ import { TreeViewItemsReorderingPlugin } from "../plugins/itemsReordering/index.
5
5
  import { parametersToStateMapper } from "./RichTreeViewProStore.utils.js";
6
6
  export class RichTreeViewProStore extends ExtendableRichTreeViewStore {
7
7
  itemsReordering = (() => new TreeViewItemsReorderingPlugin(this))();
8
+ disposeEffect = () => {
9
+ this.lazyLoading.initEffect();
10
+ return this.timeoutManager.clearAll;
11
+ };
8
12
  constructor(parameters) {
9
13
  super(parameters, 'RichTreeViewPro', parametersToStateMapper);
10
14
  this.lazyLoading = new TreeViewLazyLoadingPlugin(this);
@@ -28,7 +28,7 @@ export interface RichTreeViewProStoreParameters<R extends TreeViewValidItem<R>,
28
28
  /**
29
29
  * The data source cache object.
30
30
  */
31
- dataSourceCache?: DataSourceCache;
31
+ dataSourceCache?: DataSourceCache<R>;
32
32
  /**
33
33
  * If `true`, the reordering of items is enabled.
34
34
  * @default false
@@ -54,6 +54,19 @@ export interface RichTreeViewProStoreParameters<R extends TreeViewValidItem<R>,
54
54
  oldPosition: TreeViewItemReorderPosition;
55
55
  newPosition: TreeViewItemReorderPosition;
56
56
  }) => boolean;
57
+ /**
58
+ * Callback fired when the children of an item are loaded from the data source.
59
+ * Only relevant for lazy-loaded tree views.
60
+ * @param {object} parameters The parameters of the callback.
61
+ * @param {R[]} parameters.items The items that were loaded.
62
+ * @param {TreeViewItemId | null} parameters.parentId The id of the parent item whose children were loaded. `null` if the root items were loaded.
63
+ * @param {boolean} parameters.isCacheHit `true` if the items were loaded from the cache, `false` if they were fetched from the data source.
64
+ */
65
+ onItemsLazyLoaded?: (parameters: {
66
+ items: R[];
67
+ parentId: TreeViewItemId | null;
68
+ isCacheHit: boolean;
69
+ }) => void;
57
70
  /**
58
71
  * Callback fired when a Tree Item is moved in the tree.
59
72
  * @param {object} parameters The params describing the item re-ordering.
@@ -4,12 +4,13 @@ import { TREE_VIEW_LAZY_LOADED_ITEMS_INITIAL_STATE } from "../plugins/lazyLoadin
4
4
  const DEFAULT_IS_ITEM_REORDERABLE_WHEN_ENABLED = () => true;
5
5
  const DEFAULT_IS_ITEM_REORDERABLE_WHEN_DISABLED = () => false;
6
6
  const deriveStateFromParameters = parameters => ({
7
- lazyLoadedItems: parameters.dataSource ? TREE_VIEW_LAZY_LOADED_ITEMS_INITIAL_STATE : null,
8
7
  currentReorder: null,
9
8
  isItemReorderable: parameters.itemsReordering ? parameters.isItemReorderable ?? DEFAULT_IS_ITEM_REORDERABLE_WHEN_ENABLED : DEFAULT_IS_ITEM_REORDERABLE_WHEN_DISABLED
10
9
  });
11
10
  export const parametersToStateMapper = {
12
- getInitialState: (minimalInitialState, parameters) => _extends({}, ExtendableRichTreeViewStore.rawMapper.getInitialState(minimalInitialState, parameters), deriveStateFromParameters(parameters)),
11
+ getInitialState: (minimalInitialState, parameters) => _extends({}, ExtendableRichTreeViewStore.rawMapper.getInitialState(minimalInitialState, parameters), {
12
+ lazyLoadedItems: parameters.dataSource ? TREE_VIEW_LAZY_LOADED_ITEMS_INITIAL_STATE : null
13
+ }, deriveStateFromParameters(parameters)),
13
14
  updateStateFromParameters: (newMinimalState, parameters, updateModel) => {
14
15
  const newState = _extends({}, ExtendableRichTreeViewStore.rawMapper.updateStateFromParameters(newMinimalState, parameters, updateModel), deriveStateFromParameters(parameters));
15
16
  return newState;
@@ -1,18 +1,27 @@
1
- import { TreeViewItemId } from '@mui/x-tree-view/models';
1
+ import { TreeViewItemId, TreeViewValidItem } from '@mui/x-tree-view/models';
2
2
  import { RichTreeViewProStore } from "../../RichTreeViewProStore/RichTreeViewProStore.js";
3
3
  export declare const TREE_VIEW_LAZY_LOADED_ITEMS_INITIAL_STATE: {
4
4
  loading: {};
5
5
  errors: {};
6
6
  };
7
- export declare class TreeViewLazyLoadingPlugin {
7
+ export declare class TreeViewLazyLoadingPlugin<R extends TreeViewValidItem<R>> {
8
8
  private store;
9
9
  private nestedDataManager;
10
10
  private cache;
11
- constructor(store: RichTreeViewProStore<any, any>);
11
+ private isInsideOnItemsLazyLoaded;
12
+ private initStarted;
13
+ constructor(store: RichTreeViewProStore<R, any>);
14
+ /**
15
+ * Initialize lazy loading.
16
+ * Called from the store's disposeEffect (inside a useEffect) to avoid side effects during render.
17
+ * Uses a flag to ensure initialization only happens once (handles React 18 StrictMode double-firing effects).
18
+ */
19
+ initEffect: () => void;
12
20
  private init;
13
21
  private handleBeforeItemToggleExpansion;
14
22
  private setItemLoading;
15
23
  private setItemError;
24
+ private callOnItemsLazyLoaded;
16
25
  buildPublicAPI: () => {
17
26
  updateItemChildren: (itemId: TreeViewItemId | null) => Promise<void>;
18
27
  };
@@ -41,6 +50,9 @@ export declare class TreeViewLazyLoadingPlugin {
41
50
  * @param {boolean} [parameters.forceRefresh] Whether to force a refresh of the children when the cache already contains some data.
42
51
  * @returns {Promise<void>} The promise resolved when the items are fetched.
43
52
  */
53
+ private getItemId;
54
+ private getInlineChildren;
55
+ private processNestedItemChildren;
44
56
  fetchItemChildren: ({
45
57
  itemId,
46
58
  forceRefresh
@@ -8,14 +8,28 @@ export const TREE_VIEW_LAZY_LOADED_ITEMS_INITIAL_STATE = {
8
8
  };
9
9
  export class TreeViewLazyLoadingPlugin {
10
10
  nestedDataManager = (() => new NestedDataManager(this))();
11
+ isInsideOnItemsLazyLoaded = false;
12
+ initStarted = false;
11
13
  constructor(store) {
12
14
  this.store = store;
13
15
  this.cache = store.parameters.dataSourceCache ?? new DataSourceCacheDefault({});
14
16
  if (store.parameters.dataSource != null) {
15
- this.init();
16
17
  store.subscribeEvent('beforeItemToggleExpansion', this.handleBeforeItemToggleExpansion);
17
18
  }
18
19
  }
20
+
21
+ /**
22
+ * Initialize lazy loading.
23
+ * Called from the store's disposeEffect (inside a useEffect) to avoid side effects during render.
24
+ * Uses a flag to ensure initialization only happens once (handles React 18 StrictMode double-firing effects).
25
+ */
26
+ initEffect = () => {
27
+ if (this.store.parameters.dataSource == null || this.initStarted) {
28
+ return;
29
+ }
30
+ this.initStarted = true;
31
+ this.init();
32
+ };
19
33
  init = () => {
20
34
  const store = this.store;
21
35
  // eslint-disable-next-line consistent-this
@@ -108,6 +122,21 @@ export class TreeViewLazyLoadingPlugin {
108
122
  errors
109
123
  }));
110
124
  };
125
+ callOnItemsLazyLoaded(items, parentId, isCacheHit) {
126
+ if (this.isInsideOnItemsLazyLoaded) {
127
+ return;
128
+ }
129
+ this.isInsideOnItemsLazyLoaded = true;
130
+ try {
131
+ this.store.parameters.onItemsLazyLoaded?.({
132
+ items,
133
+ parentId,
134
+ isCacheHit
135
+ });
136
+ } finally {
137
+ this.isInsideOnItemsLazyLoaded = false;
138
+ }
139
+ }
111
140
  buildPublicAPI = () => {
112
141
  return {
113
142
  updateItemChildren: this.updateItemChildren
@@ -144,6 +173,27 @@ export class TreeViewLazyLoadingPlugin {
144
173
  * @param {boolean} [parameters.forceRefresh] Whether to force a refresh of the children when the cache already contains some data.
145
174
  * @returns {Promise<void>} The promise resolved when the items are fetched.
146
175
  */
176
+ getItemId = item => this.store.parameters.getItemId ? this.store.parameters.getItemId(item) : item.id;
177
+ getInlineChildren = item => (this.store.parameters.getItemChildren ? this.store.parameters.getItemChildren(item) : item.children) ?? [];
178
+ processNestedItemChildren = items => {
179
+ const {
180
+ getChildrenCount
181
+ } = this.store.parameters.dataSource;
182
+ for (const item of items) {
183
+ const children = this.getInlineChildren(item);
184
+ if (children.length === 0) {
185
+ continue;
186
+ }
187
+ const itemId = this.getItemId(item);
188
+ this.cache.set(itemId, children);
189
+ this.store.items.setItemChildren({
190
+ items: children,
191
+ parentId: itemId,
192
+ getChildrenCount
193
+ });
194
+ this.processNestedItemChildren(children);
195
+ }
196
+ };
147
197
  fetchItemChildren = async ({
148
198
  itemId,
149
199
  forceRefresh
@@ -179,6 +229,7 @@ export class TreeViewLazyLoadingPlugin {
179
229
  getChildrenCount
180
230
  });
181
231
  this.setItemLoading(itemId, false);
232
+ this.callOnItemsLazyLoaded(cachedData, itemId, true);
182
233
  return;
183
234
  }
184
235
 
@@ -209,6 +260,10 @@ export class TreeViewLazyLoadingPlugin {
209
260
  parentId: itemId,
210
261
  getChildrenCount
211
262
  });
263
+ // pre-cache any inline nested children so expanding them requires no extra network call
264
+ this.processNestedItemChildren(response);
265
+ // notify the user that new items have been loaded
266
+ this.callOnItemsLazyLoaded(response, itemId, false);
212
267
  } catch (error) {
213
268
  const childrenFetchError = error;
214
269
  // set the item error in the state
@@ -1,4 +1,4 @@
1
- import { TreeViewItemId } from '@mui/x-tree-view/models';
1
+ import { TreeViewItemId, TreeViewValidItem } from '@mui/x-tree-view/models';
2
2
  import { TreeViewLazyLoadingPlugin } from "./TreeViewLazyLoadingPlugin.js";
3
3
  export declare enum RequestStatus {
4
4
  QUEUED = 0,
@@ -17,7 +17,7 @@ export declare class NestedDataManager {
17
17
  private settledRequests;
18
18
  private lazyLoadingPlugin;
19
19
  private maxConcurrentRequests;
20
- constructor(lazyLoadingPlugin: TreeViewLazyLoadingPlugin, maxConcurrentRequests?: number);
20
+ constructor(lazyLoadingPlugin: TreeViewLazyLoadingPlugin<TreeViewValidItem<any>>, maxConcurrentRequests?: number);
21
21
  private processQueue;
22
22
  queue: (ids: TreeViewItemId[]) => Promise<void>;
23
23
  setRequestSettled: (id: TreeViewItemId) => Promise<void>;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-tree-view-pro v8.27.2
2
+ * @mui/x-tree-view-pro v8.28.5
3
3
  *
4
4
  * @license SEE LICENSE IN LICENSE
5
5
  * This source code is licensed under the SEE LICENSE IN LICENSE license found in the
@@ -4,8 +4,9 @@ import { RichTreeViewProStoreParameters, RichTreeViewProState } from "./RichTree
4
4
  import { TreeViewLazyLoadingPlugin } from "../plugins/lazyLoading/index.js";
5
5
  import { TreeViewItemsReorderingPlugin } from "../plugins/itemsReordering/index.js";
6
6
  export declare class RichTreeViewProStore<R extends TreeViewValidItem<R>, Multiple extends boolean | undefined> extends ExtendableRichTreeViewStore<R, Multiple, RichTreeViewProState<R, Multiple>, RichTreeViewProStoreParameters<R, Multiple>> {
7
- lazyLoading: TreeViewLazyLoadingPlugin;
7
+ lazyLoading: TreeViewLazyLoadingPlugin<R>;
8
8
  itemsReordering: TreeViewItemsReorderingPlugin;
9
+ disposeEffect: () => () => void;
9
10
  constructor(parameters: RichTreeViewProStoreParameters<R, Multiple>);
10
11
  buildPublicAPI(): {
11
12
  updateItemChildren: (itemId: import("@mui/x-tree-view").TreeViewItemId | null) => Promise<void>;
@@ -12,6 +12,10 @@ var _itemsReordering = require("../plugins/itemsReordering");
12
12
  var _RichTreeViewProStore = require("./RichTreeViewProStore.utils");
13
13
  class RichTreeViewProStore extends _internals.ExtendableRichTreeViewStore {
14
14
  itemsReordering = new _itemsReordering.TreeViewItemsReorderingPlugin(this);
15
+ disposeEffect = () => {
16
+ this.lazyLoading.initEffect();
17
+ return this.timeoutManager.clearAll;
18
+ };
15
19
  constructor(parameters) {
16
20
  super(parameters, 'RichTreeViewPro', _RichTreeViewProStore.parametersToStateMapper);
17
21
  this.lazyLoading = new _lazyLoading.TreeViewLazyLoadingPlugin(this);
@@ -28,7 +28,7 @@ export interface RichTreeViewProStoreParameters<R extends TreeViewValidItem<R>,
28
28
  /**
29
29
  * The data source cache object.
30
30
  */
31
- dataSourceCache?: DataSourceCache;
31
+ dataSourceCache?: DataSourceCache<R>;
32
32
  /**
33
33
  * If `true`, the reordering of items is enabled.
34
34
  * @default false
@@ -54,6 +54,19 @@ export interface RichTreeViewProStoreParameters<R extends TreeViewValidItem<R>,
54
54
  oldPosition: TreeViewItemReorderPosition;
55
55
  newPosition: TreeViewItemReorderPosition;
56
56
  }) => boolean;
57
+ /**
58
+ * Callback fired when the children of an item are loaded from the data source.
59
+ * Only relevant for lazy-loaded tree views.
60
+ * @param {object} parameters The parameters of the callback.
61
+ * @param {R[]} parameters.items The items that were loaded.
62
+ * @param {TreeViewItemId | null} parameters.parentId The id of the parent item whose children were loaded. `null` if the root items were loaded.
63
+ * @param {boolean} parameters.isCacheHit `true` if the items were loaded from the cache, `false` if they were fetched from the data source.
64
+ */
65
+ onItemsLazyLoaded?: (parameters: {
66
+ items: R[];
67
+ parentId: TreeViewItemId | null;
68
+ isCacheHit: boolean;
69
+ }) => void;
57
70
  /**
58
71
  * Callback fired when a Tree Item is moved in the tree.
59
72
  * @param {object} parameters The params describing the item re-ordering.
@@ -11,12 +11,13 @@ var _lazyLoading = require("../plugins/lazyLoading");
11
11
  const DEFAULT_IS_ITEM_REORDERABLE_WHEN_ENABLED = () => true;
12
12
  const DEFAULT_IS_ITEM_REORDERABLE_WHEN_DISABLED = () => false;
13
13
  const deriveStateFromParameters = parameters => ({
14
- lazyLoadedItems: parameters.dataSource ? _lazyLoading.TREE_VIEW_LAZY_LOADED_ITEMS_INITIAL_STATE : null,
15
14
  currentReorder: null,
16
15
  isItemReorderable: parameters.itemsReordering ? parameters.isItemReorderable ?? DEFAULT_IS_ITEM_REORDERABLE_WHEN_ENABLED : DEFAULT_IS_ITEM_REORDERABLE_WHEN_DISABLED
17
16
  });
18
17
  const parametersToStateMapper = exports.parametersToStateMapper = {
19
- getInitialState: (minimalInitialState, parameters) => (0, _extends2.default)({}, _internals.ExtendableRichTreeViewStore.rawMapper.getInitialState(minimalInitialState, parameters), deriveStateFromParameters(parameters)),
18
+ getInitialState: (minimalInitialState, parameters) => (0, _extends2.default)({}, _internals.ExtendableRichTreeViewStore.rawMapper.getInitialState(minimalInitialState, parameters), {
19
+ lazyLoadedItems: parameters.dataSource ? _lazyLoading.TREE_VIEW_LAZY_LOADED_ITEMS_INITIAL_STATE : null
20
+ }, deriveStateFromParameters(parameters)),
20
21
  updateStateFromParameters: (newMinimalState, parameters, updateModel) => {
21
22
  const newState = (0, _extends2.default)({}, _internals.ExtendableRichTreeViewStore.rawMapper.updateStateFromParameters(newMinimalState, parameters, updateModel), deriveStateFromParameters(parameters));
22
23
  return newState;
@@ -1,18 +1,27 @@
1
- import { TreeViewItemId } from '@mui/x-tree-view/models';
1
+ import { TreeViewItemId, TreeViewValidItem } from '@mui/x-tree-view/models';
2
2
  import { RichTreeViewProStore } from "../../RichTreeViewProStore/RichTreeViewProStore.js";
3
3
  export declare const TREE_VIEW_LAZY_LOADED_ITEMS_INITIAL_STATE: {
4
4
  loading: {};
5
5
  errors: {};
6
6
  };
7
- export declare class TreeViewLazyLoadingPlugin {
7
+ export declare class TreeViewLazyLoadingPlugin<R extends TreeViewValidItem<R>> {
8
8
  private store;
9
9
  private nestedDataManager;
10
10
  private cache;
11
- constructor(store: RichTreeViewProStore<any, any>);
11
+ private isInsideOnItemsLazyLoaded;
12
+ private initStarted;
13
+ constructor(store: RichTreeViewProStore<R, any>);
14
+ /**
15
+ * Initialize lazy loading.
16
+ * Called from the store's disposeEffect (inside a useEffect) to avoid side effects during render.
17
+ * Uses a flag to ensure initialization only happens once (handles React 18 StrictMode double-firing effects).
18
+ */
19
+ initEffect: () => void;
12
20
  private init;
13
21
  private handleBeforeItemToggleExpansion;
14
22
  private setItemLoading;
15
23
  private setItemError;
24
+ private callOnItemsLazyLoaded;
16
25
  buildPublicAPI: () => {
17
26
  updateItemChildren: (itemId: TreeViewItemId | null) => Promise<void>;
18
27
  };
@@ -41,6 +50,9 @@ export declare class TreeViewLazyLoadingPlugin {
41
50
  * @param {boolean} [parameters.forceRefresh] Whether to force a refresh of the children when the cache already contains some data.
42
51
  * @returns {Promise<void>} The promise resolved when the items are fetched.
43
52
  */
53
+ private getItemId;
54
+ private getInlineChildren;
55
+ private processNestedItemChildren;
44
56
  fetchItemChildren: ({
45
57
  itemId,
46
58
  forceRefresh
@@ -15,14 +15,28 @@ const TREE_VIEW_LAZY_LOADED_ITEMS_INITIAL_STATE = exports.TREE_VIEW_LAZY_LOADED_
15
15
  };
16
16
  class TreeViewLazyLoadingPlugin {
17
17
  nestedDataManager = new _utils2.NestedDataManager(this);
18
+ isInsideOnItemsLazyLoaded = false;
19
+ initStarted = false;
18
20
  constructor(store) {
19
21
  this.store = store;
20
22
  this.cache = store.parameters.dataSourceCache ?? new _utils.DataSourceCacheDefault({});
21
23
  if (store.parameters.dataSource != null) {
22
- this.init();
23
24
  store.subscribeEvent('beforeItemToggleExpansion', this.handleBeforeItemToggleExpansion);
24
25
  }
25
26
  }
27
+
28
+ /**
29
+ * Initialize lazy loading.
30
+ * Called from the store's disposeEffect (inside a useEffect) to avoid side effects during render.
31
+ * Uses a flag to ensure initialization only happens once (handles React 18 StrictMode double-firing effects).
32
+ */
33
+ initEffect = () => {
34
+ if (this.store.parameters.dataSource == null || this.initStarted) {
35
+ return;
36
+ }
37
+ this.initStarted = true;
38
+ this.init();
39
+ };
26
40
  init = () => {
27
41
  const store = this.store;
28
42
  // eslint-disable-next-line consistent-this
@@ -115,6 +129,21 @@ class TreeViewLazyLoadingPlugin {
115
129
  errors
116
130
  }));
117
131
  };
132
+ callOnItemsLazyLoaded(items, parentId, isCacheHit) {
133
+ if (this.isInsideOnItemsLazyLoaded) {
134
+ return;
135
+ }
136
+ this.isInsideOnItemsLazyLoaded = true;
137
+ try {
138
+ this.store.parameters.onItemsLazyLoaded?.({
139
+ items,
140
+ parentId,
141
+ isCacheHit
142
+ });
143
+ } finally {
144
+ this.isInsideOnItemsLazyLoaded = false;
145
+ }
146
+ }
118
147
  buildPublicAPI = () => {
119
148
  return {
120
149
  updateItemChildren: this.updateItemChildren
@@ -151,6 +180,27 @@ class TreeViewLazyLoadingPlugin {
151
180
  * @param {boolean} [parameters.forceRefresh] Whether to force a refresh of the children when the cache already contains some data.
152
181
  * @returns {Promise<void>} The promise resolved when the items are fetched.
153
182
  */
183
+ getItemId = item => this.store.parameters.getItemId ? this.store.parameters.getItemId(item) : item.id;
184
+ getInlineChildren = item => (this.store.parameters.getItemChildren ? this.store.parameters.getItemChildren(item) : item.children) ?? [];
185
+ processNestedItemChildren = items => {
186
+ const {
187
+ getChildrenCount
188
+ } = this.store.parameters.dataSource;
189
+ for (const item of items) {
190
+ const children = this.getInlineChildren(item);
191
+ if (children.length === 0) {
192
+ continue;
193
+ }
194
+ const itemId = this.getItemId(item);
195
+ this.cache.set(itemId, children);
196
+ this.store.items.setItemChildren({
197
+ items: children,
198
+ parentId: itemId,
199
+ getChildrenCount
200
+ });
201
+ this.processNestedItemChildren(children);
202
+ }
203
+ };
154
204
  fetchItemChildren = async ({
155
205
  itemId,
156
206
  forceRefresh
@@ -186,6 +236,7 @@ class TreeViewLazyLoadingPlugin {
186
236
  getChildrenCount
187
237
  });
188
238
  this.setItemLoading(itemId, false);
239
+ this.callOnItemsLazyLoaded(cachedData, itemId, true);
189
240
  return;
190
241
  }
191
242
 
@@ -216,6 +267,10 @@ class TreeViewLazyLoadingPlugin {
216
267
  parentId: itemId,
217
268
  getChildrenCount
218
269
  });
270
+ // pre-cache any inline nested children so expanding them requires no extra network call
271
+ this.processNestedItemChildren(response);
272
+ // notify the user that new items have been loaded
273
+ this.callOnItemsLazyLoaded(response, itemId, false);
219
274
  } catch (error) {
220
275
  const childrenFetchError = error;
221
276
  // set the item error in the state
@@ -1,4 +1,4 @@
1
- import { TreeViewItemId } from '@mui/x-tree-view/models';
1
+ import { TreeViewItemId, TreeViewValidItem } from '@mui/x-tree-view/models';
2
2
  import { TreeViewLazyLoadingPlugin } from "./TreeViewLazyLoadingPlugin.js";
3
3
  export declare enum RequestStatus {
4
4
  QUEUED = 0,
@@ -17,7 +17,7 @@ export declare class NestedDataManager {
17
17
  private settledRequests;
18
18
  private lazyLoadingPlugin;
19
19
  private maxConcurrentRequests;
20
- constructor(lazyLoadingPlugin: TreeViewLazyLoadingPlugin, maxConcurrentRequests?: number);
20
+ constructor(lazyLoadingPlugin: TreeViewLazyLoadingPlugin<TreeViewValidItem<any>>, maxConcurrentRequests?: number);
21
21
  private processQueue;
22
22
  queue: (ids: TreeViewItemId[]) => Promise<void>;
23
23
  setRequestSettled: (id: TreeViewItemId) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-tree-view-pro",
3
- "version": "8.27.2",
3
+ "version": "8.28.5",
4
4
  "author": "MUI Team",
5
5
  "description": "The Pro plan edition of the MUI X Tree View components.",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -40,9 +40,9 @@
40
40
  "react-transition-group": "^4.4.5",
41
41
  "reselect": "^5.1.1",
42
42
  "use-sync-external-store": "^1.6.0",
43
- "@mui/x-internals": "8.26.0",
44
43
  "@mui/x-license": "8.26.0",
45
- "@mui/x-tree-view": "8.27.2"
44
+ "@mui/x-internals": "8.26.0",
45
+ "@mui/x-tree-view": "8.28.5"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@emotion/react": "^11.9.0",