1
1
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js" ;
2
2
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js" ;
3
3
import TreeItem from "./TreeItem.js" ;
4
- import BusyIndicator from "./BusyIndicator.js" ;
5
4
import List from "./List.js" ;
6
5
import TreeListItem from "./TreeListItem.js" ;
7
6
import ListMode from "./types/ListMode.js" ;
@@ -48,7 +47,7 @@ const metadata = {
48
47
/**
49
48
* Defines the <code>ui5-tree</code> header text.
50
49
* <br><br>
51
- * <b>Note:</b> If <code>header</code> is set this property is ignored.
50
+ * <b>Note:</b> If the <code>header</code> slot is set, this property is ignored.
52
51
*
53
52
* @type {string }
54
53
* @defaultvalue ""
@@ -69,18 +68,6 @@ const metadata = {
69
68
type : String ,
70
69
} ,
71
70
72
- /**
73
- * When set to <code>true</code>, a busy indicator will be displayed on the <code>ui5-tree</code>, blocking any user interaction.
74
- * Use this when you need to dynamically load tree items.
75
- *
76
- * @type {boolean }
77
- * @defaultvalue false
78
- * @public
79
- */
80
- busy : {
81
- type : Boolean ,
82
- } ,
83
-
84
71
/**
85
72
* An array, containing a flat structure of list items to render
86
73
*
@@ -111,7 +98,7 @@ const metadata = {
111
98
/**
112
99
* Defines the <code>ui5-tree</code> header.
113
100
* <br><br>
114
- * <b>Note:</b> When <code>header</code> is set, the
101
+ * <b>Note:</b> When the <code>header</code> slot is set, the
115
102
* <code>headerText</code> property is ignored.
116
103
*
117
104
* @type {HTMLElement[] }
@@ -232,20 +219,23 @@ class Tree extends UI5Element {
232
219
233
220
static async onDefine ( ) {
234
221
await Promise . all ( [
235
- BusyIndicator . define ( ) ,
236
222
List . define ( ) ,
237
223
TreeListItem . define ( ) ,
238
224
TreeItem . define ( ) ,
239
225
] ) ;
240
226
}
241
227
228
+ constructor ( ) {
229
+ super ( ) ;
230
+ this . _observer = new MutationObserver ( this . onTreeStructureChange . bind ( this ) ) ;
231
+ }
232
+
242
233
onBeforeRendering ( ) {
243
234
this . _listItems = [ ] ;
244
235
buildTree ( this , 1 , this . _listItems ) ;
245
236
}
246
237
247
238
onEnterDOM ( ) {
248
- this . _observer = new MutationObserver ( this . onTreeStructureChange . bind ( this ) ) ;
249
239
this . _observer . observe ( this , { attributes : true , childList : true , subtree : true } ) ;
250
240
}
251
241
@@ -262,18 +252,14 @@ class Tree extends UI5Element {
262
252
}
263
253
264
254
get list ( ) {
265
- return this . shadowRoot . querySelector ( `ui5-list` ) ;
255
+ return this . getDomRef ( ) ;
266
256
}
267
257
268
258
get _role ( ) {
269
259
return "tree" ;
270
260
}
271
261
272
262
_onListItemStepIn ( event ) {
273
- if ( this . busy ) {
274
- return ;
275
- }
276
-
277
263
const listItem = event . detail . item ;
278
264
const treeItem = listItem . treeItem ;
279
265
if ( treeItem . items . length > 0 ) {
@@ -284,10 +270,6 @@ class Tree extends UI5Element {
284
270
}
285
271
286
272
_onListItemStepOut ( event ) {
287
- if ( this . busy ) {
288
- return ;
289
- }
290
-
291
273
const listItem = event . detail . item ;
292
274
const treeItem = listItem . treeItem ;
293
275
if ( treeItem . parentElement !== this ) {
@@ -298,10 +280,6 @@ class Tree extends UI5Element {
298
280
}
299
281
300
282
_onListItemToggle ( event ) {
301
- if ( this . busy ) {
302
- return ;
303
- }
304
-
305
283
const listItem = event . detail . item ;
306
284
const treeItem = listItem . treeItem ;
307
285
const defaultPrevented = ! this . fireEvent ( "itemToggle" , { item : treeItem } , true ) ;
0 commit comments