MCPcopy
hub / github.com/angular/components / TreeItemGroup

Class TreeItemGroup

src/aria/tree/tree-item-group.ts:47–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45 hostDirectives: [DeferredContent],
46})
47export class TreeItemGroup<V> implements OnInit, OnDestroy {
48 /** A reference to the host element. */
49 private readonly _elementRef = inject(ElementRef);
50
51 /** A reference to the host element. */
52 readonly element = this._elementRef.nativeElement as HTMLElement;
53
54 /** The DeferredContent host directive. */
55 private readonly _deferredContent = inject(DeferredContent);
56
57 /** All groupable items that are descendants of the group. */
58 private readonly _unorderedItems = signal(new Set<TreeItem<V>>());
59
60 /** Child items within this group. */
61 readonly _childPatterns = computed<TreeItemPattern<V>[]>(() =>
62 [...this._unorderedItems()].sort(sortDirectives).map(c => c._pattern),
63 );
64
65 /** Tree item that owns the group. */
66 readonly ownedBy = input.required<TreeItem<V>>();
67
68 ngOnInit() {
69 this._deferredContent.deferredContentAware.set(this.ownedBy());
70 this.ownedBy()._register(this);
71 }
72
73 ngOnDestroy() {
74 this.ownedBy()._unregister();
75 }
76
77 _register(child: TreeItem<V>) {
78 this._unorderedItems().add(child);
79 this._unorderedItems.set(new Set(this._unorderedItems()));
80 }
81
82 _unregister(child: TreeItem<V>) {
83 this._unorderedItems().delete(child);
84 this._unorderedItems.set(new Set(this._unorderedItems()));
85 }
86}

Callers

nothing calls this directly

Calls 4

signalFunction · 0.85
computedFunction · 0.85
sortMethod · 0.65
requiredMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…