| 144 | } |
| 145 | |
| 146 | ngOnInit() { |
| 147 | const treePattern = computed(() => this.tree()._pattern); |
| 148 | const parentPattern = computed(() => { |
| 149 | if (this.parent() instanceof Tree) { |
| 150 | return treePattern(); |
| 151 | } |
| 152 | return (this.parent() as TreeItemGroup<V>).ownedBy()._pattern; |
| 153 | }); |
| 154 | this._pattern = new TreeItemPattern<V>({ |
| 155 | ...this, |
| 156 | tree: treePattern, |
| 157 | parent: parentPattern, |
| 158 | children: computed(() => this._group()?._childPatterns()), |
| 159 | hasChildren: computed(() => !!this._group()), |
| 160 | element: () => this.element, |
| 161 | searchTerm: () => this.searchTerm() ?? '', |
| 162 | }); |
| 163 | } |
| 164 | |
| 165 | _register(group: TreeItemGroup<V>) { |
| 166 | this._group.set(group); |