@@ -69,11 +69,11 @@ function sortDirectives(a: HasElement, b: HasElement) {
6969 'class' : 'ng-tree' ,
7070 'role' : 'tree' ,
7171 '[attr.id]' : 'id()' ,
72- '[attr.aria-orientation]' : '_pattern. orientation()' ,
73- '[attr.aria-multiselectable]' : '_pattern. multi()' ,
74- '[attr.aria-disabled]' : '_pattern. disabled()' ,
75- '[attr.aria-activedescendant]' : '_pattern. activedescendant()' ,
76- '[tabindex]' : '_pattern. tabindex()' ,
72+ '[attr.aria-orientation]' : 'orientation()' ,
73+ '[attr.aria-multiselectable]' : 'multi()' ,
74+ '[attr.aria-disabled]' : 'disabled()' ,
75+ '[attr.aria-activedescendant]' : 'activedescendant()' ,
76+ '[tabindex]' : 'tabindex()' ,
7777 '(keydown)' : '_pattern.onKeydown($event)' ,
7878 '(pointerdown)' : '_pattern.onPointerdown($event)' ,
7979 '(focusin)' : 'onFocus()' ,
@@ -132,6 +132,21 @@ export class Tree<V> {
132132 /** Whether the tree is in navigation mode. */
133133 readonly nav = input ( false ) ;
134134
135+ /** The id of the current active item. */
136+ readonly activedescendant = computed ( ( ) => this . _pattern . activedescendant ( ) ) ;
137+
138+ /** The direct children of the root (top-level tree items). */
139+ readonly children = computed ( ( ) => this . _pattern . children ( ) ) ;
140+
141+ /** Whether the tree selection follows focus. */
142+ readonly followFocus = computed ( ( ) => this . _pattern . followFocus ( ) ) ;
143+
144+ /** The tabindex of the tree. */
145+ readonly tabindex = computed ( ( ) => this . _pattern . tabindex ( ) ) ;
146+
147+ /** All currently visible tree items. An item is visible if their parent is expanded. */
148+ readonly visibleItems = computed ( ( ) => this . _pattern . visible ( ) ) ;
149+
135150 /** The aria-current type. */
136151 readonly currentType = input < 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false' > (
137152 'page' ,
@@ -215,17 +230,17 @@ export class Tree<V> {
215230 exportAs : 'ngTreeItem' ,
216231 host : {
217232 'class' : 'ng-treeitem' ,
218- '[attr.data-active]' : '_pattern. active()' ,
233+ '[attr.data-active]' : 'active()' ,
219234 'role' : 'treeitem' ,
220235 '[id]' : '_pattern.id()' ,
221- '[attr.aria-expanded]' : '_pattern.expandable() ? _pattern. expanded() : null ' ,
222- '[attr.aria-selected]' : '_pattern. selected()' ,
223- '[attr.aria-current]' : '_pattern. current()' ,
224- '[attr.aria-disabled]' : '_pattern. disabled()' ,
225- '[attr.aria-level]' : '_pattern. level()' ,
226- '[attr.aria-setsize]' : '_pattern. setsize()' ,
227- '[attr.aria-posinset]' : '_pattern. posinset()' ,
228- '[attr.tabindex]' : '_pattern. tabindex()' ,
236+ '[attr.aria-expanded]' : 'expanded()' ,
237+ '[attr.aria-selected]' : 'selected()' ,
238+ '[attr.aria-current]' : 'current()' ,
239+ '[attr.aria-disabled]' : 'disabled()' ,
240+ '[attr.aria-level]' : 'level()' ,
241+ '[attr.aria-setsize]' : 'setsize()' ,
242+ '[attr.aria-posinset]' : 'posinset()' ,
243+ '[attr.tabindex]' : 'tabindex()' ,
229244 } ,
230245} )
231246export class TreeItem < V > extends DeferredContentAware implements OnInit , OnDestroy , HasElement {
@@ -267,6 +282,35 @@ export class TreeItem<V> extends DeferredContentAware implements OnInit, OnDestr
267282 return ( this . parent ( ) as TreeItemGroup < V > ) . ownedBy ( ) . tree ( ) ;
268283 } ) ;
269284
285+ /** Whether the item is active. */
286+ readonly active = computed ( ( ) => this . _pattern . active ( ) ) ;
287+
288+ /** The current type of this item. */
289+ readonly current = computed ( ( ) => this . _pattern . current ( ) ) ;
290+
291+ /** Whether this item is currently expanded, returning null if not expandable. */
292+ readonly expanded = computed ( ( ) =>
293+ this . _pattern . expandable ( ) ? this . _pattern . expanded ( ) : null ,
294+ ) ;
295+
296+ /** The level of the current item in a tree. */
297+ readonly level = computed ( ( ) => this . _pattern . level ( ) ) ;
298+
299+ /** The position of this item among its siblings (1-based). */
300+ readonly posinset = computed ( ( ) => this . _pattern . posinset ( ) ) ;
301+
302+ /** Whether the item is selected. */
303+ readonly selected = computed ( ( ) => this . _pattern . selected ( ) ) ;
304+
305+ /** The number of items under the same parent at the same level. */
306+ readonly setsize = computed ( ( ) => this . _pattern . setsize ( ) ) ;
307+
308+ /** The tabindex of the item. */
309+ readonly tabindex = computed ( ( ) => this . _pattern . tabindex ( ) ) ;
310+
311+ /** Whether this item is visible. */
312+ readonly visible = computed ( ( ) => this . _pattern . visible ( ) ) ;
313+
270314 /** The UI pattern for this item. */
271315 _pattern : TreeItemPattern < V > ;
272316
0 commit comments