Skip to content

Commit 358cc14

Browse files
committed
fix: update tree
1 parent a83e3a6 commit 358cc14

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

frontend/src/angular/src/app/function-search/function-search.component.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,8 @@
6666
@if (!!responseJson.at(0)?.value1) {
6767
<p class="result-text">
6868
<!-- {{responseJson | json}} -->
69-
<mat-tree
70-
[dataSource]="dataSource"
71-
[treeControl]="treeControl"
69+
<mat-tree #tree
70+
[dataSource]="dataSource"
7271
class="example-tree"
7372
>
7473
<mat-tree-node *matTreeNodeDef="let node" matTreeNodeToggle>
@@ -88,13 +87,13 @@
8887
matTreeNodeToggle
8988
>
9089
<mat-icon class="mat-icon-rtl-mirror">
91-
{{ treeControl.isExpanded(node) ? "expand_more" : "chevron_right" }}
90+
{{ tree.isExpanded(node) ? "expand_more" : "chevron_right" }}
9291
</mat-icon>
9392
</button>
9493
<span class="book-author" i18n="@@functionSearchAuthor">Author</span><span class="book-author">: {{ node.value1 }}</span>
9594
</div>
9695
<div
97-
[class.example-tree-invisible]="!treeControl.isExpanded(node)"
96+
[class.example-tree-invisible]="!tree.isExpanded(node)"
9897
role="group"
9998
>
10099
<ng-container matTreeNodeOutlet></ng-container>

frontend/src/angular/src/app/function-search/function-search.component.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ import {
2626
Validators,
2727
} from '@angular/forms';
2828
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
29-
import { Book, FunctionResponse, FunctionSearch, JsonBook, JsonResult } from '../model/functions';
29+
import { FunctionSearch, JsonBook, JsonResult } from '../model/functions';
3030
import { FunctionSearchService } from '../service/function-search.service';
3131
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
3232
import { Subscription, interval, map, tap } from 'rxjs';
33-
import { NestedTreeControl } from '@angular/cdk/tree';
3433
import { MatIconModule } from '@angular/material/icon';
3534
import { MatRadioModule } from '@angular/material/radio';
3635

@@ -66,10 +65,7 @@ export class FunctionSearchComponent {
6665
Validators.minLength(3),
6766
]);
6867
protected searching = false;
69-
protected msWorking = 0;
70-
protected treeControl = new NestedTreeControl<TreeNode>(
71-
(node) => node.children
72-
);
68+
protected msWorking = 0;
7369
protected dataSource = new MatTreeNestedDataSource<TreeNode>();
7470
protected responseText = '';
7571
protected responseJson = [{ value1: "", value2: "" } as TreeNode];

0 commit comments

Comments
 (0)