Skip to content

Commit

Permalink
Update tree component
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikriemer committed Feb 7, 2025
1 parent eca4bb8 commit 1db713c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class StaticRuntimeResolvableTreeInputComponent
) {
if (
staticProperty.latestFetchedNodes &&
staticProperty.latestFetchedNodes.length > 0
staticProperty.nextBaseNodeToResolve !== null
) {
this.latestFetchedNodes = staticProperty.latestFetchedNodes;
if (node) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<mat-tree
[dataSource]="dataSource"
[treeControl]="treeControl"
[childrenAccessor]="childrenAccessor"
#tree
class="sp-tree"
[ngClass]="largeView ? 'tree-large-height' : 'tree-normal-height'"
Expand Down Expand Up @@ -86,32 +86,28 @@
matTreeNodeToggle
[attr.data-cy]="'expand-' + node.nodeName"
[attr.aria-label]="'Toggle ' + node.nodeName"
(click)="loadChildren(node, treeControl.isExpanded(node))"
(click)="loadChildren(node, tree.isExpanded(node))"
>
<mat-icon class="mat-icon-rtl-mirror">
{{
treeControl.isExpanded(node)
? 'expand_more'
: 'chevron_right'
tree.isExpanded(node) ? 'expand_more' : 'chevron_right'
}}
</mat-icon>
</button>
<div fxLayoutAlign="start center">
<i
class="material-icons color-primary pr-5"
*ngIf="!treeControl.isExpanded(node)"
*ngIf="!tree.isExpanded(node)"
>folder</i
>
<i
class="material-icons color-primary pr-5"
*ngIf="treeControl.isExpanded(node)"
*ngIf="tree.isExpanded(node)"
>folder_open</i
>
<i
class="material-icons pr-5 icon-button"
*ngIf="
treeControl.isExpanded(node) && hasDataChildren(node)
"
*ngIf="tree.isExpanded(node) && hasDataChildren(node)"
matTooltip="Add all direct children"
(click)="addAllDirectChildren(node)"
>add_circle</i
Expand All @@ -135,7 +131,7 @@
<span class="node-name pr-5">&nbsp;{{ node.nodeName }}</span>
</div>
</div>
<div *ngIf="treeControl.isExpanded(node)" role="group">
<div *ngIf="tree.isExpanded(node)" role="group">
<ng-container matTreeNodeOutlet></ng-container>
</div>
</mat-nested-tree-node>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class StaticTreeInputBrowseNodesComponent implements OnInit {
tree: MatTree<TreeInputNode>;

largeView = false;
treeControl = new NestedTreeControl<TreeInputNode>(node => node.children);
childrenAccessor = node => node.children;
dataSource = new MatTreeNestedDataSource<TreeInputNode>();

selectedNodeId: string;
Expand All @@ -70,10 +70,6 @@ export class StaticTreeInputBrowseNodesComponent implements OnInit {
) {}

ngOnInit(): void {
this.treeControl = new NestedTreeControl<TreeInputNode>(
node => node.children,
);

this.dataSource = new MatTreeNestedDataSource<TreeInputNode>();
this.dataSource.data = [];
}
Expand Down

0 comments on commit 1db713c

Please sign in to comment.