Skip to content

Commit c899055

Browse files
David Martínez RosDavid Martínez Ros
authored andcommitted
first version with some visualization errors and without styles and functionality
1 parent 0c460bc commit c899055

File tree

6 files changed

+29
-17
lines changed

6 files changed

+29
-17
lines changed

src/app/app.component.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ table, th, td {
33
padding:1px 3px;
44
font:15px Verdana;
55
}
6-
th {
7-
font-weight:bold;
8-
}
Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
<div id="{{ node.id }}">
2-
<img *ngIf="!last" src="../assets/line_node_and_continue.png" (click)="clickExpandCollapse()"/>
3-
<img *ngIf="last" src="../assets/line_node_and_end.png" (click)="clickExpandCollapse()"/>
2+
<span *ngIf="countParents > 0">
3+
<img *ngIf="!lastParentNode" src="../assets/line_continue.png"/>
4+
<img *ngIf="lastParentNode" src="../assets/blank_node.png"/>
5+
<img *ngFor="let i of getNumber(countParents -1)" src="../assets/line_continue.png"/>
6+
</span>
7+
8+
<img *ngIf="!lastNode" src="../assets/line_node_and_continue.png"/>
9+
<img *ngIf="lastNode" src="../assets/line_node_and_end.png"/>
410
<img *ngIf="!node.sheet && node.expand" src="../assets/collapse_icon.png" (click)="clickExpandCollapse()"/>
511
<img *ngIf="!node.sheet && !node.expand" src="../assets/expand_icon.png" (click)="clickExpandCollapse()"/>
612
<img *ngIf="node.sheet" src="../assets/line_sheet.png" (click)="clickExpandCollapse()"/>
713

814
<span><b>{{ node.name }}</b> el seu pare es: {{ node.idParent }}</span>
9-
</div>
15+
</div>
16+
<div *ngIf="!node.sheet">
17+
<div *ngIf="node.expand">
18+
<div *ngFor="let child of node.childs; let lastNodeChild = last">
19+
<app-node-tree [node]="child" [lastParentNode]="lastNode" [countParents]="countParents + 1" [lastNode]="lastNodeChild"></app-node-tree>
20+
</div>
21+
</div>
22+
</div>

src/app/node-tree/node-tree.component.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ export class NodeTreeComponent implements OnInit {
1111

1212
@Input() node: Node;
1313

14-
@Input() last: boolean;
14+
@Input() lastNode: boolean;
15+
16+
@Input() lastParentNode: boolean;
17+
18+
@Input() countParents: number;
1519

1620
constructor() { }
1721

@@ -22,4 +26,8 @@ export class NodeTreeComponent implements OnInit {
2226
this.node.expand = !this.node.expand;
2327
}
2428

29+
getNumber(num: number) {
30+
return new Array(num);
31+
}
32+
2533
}

src/app/tree/tree.component.html

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
<div *ngFor="let node of tree | async; let i of index">
2-
<app-node-tree [node]="node" [last]="i == tree.length"></app-node-tree>
3-
<div *ngIf="!node.sheet">
4-
<div *ngIf="node.expand" style="padding-left:10px">
5-
<div *ngFor="let child of node.childs; let j of index">
6-
<app-node-tree [node]="child" [last]="j == node.childs.length"></app-node-tree>
7-
</div>
8-
</div>
9-
</div>
1+
<div *ngFor="let node of tree | async; let lastParentNode = last">
2+
<app-node-tree [node]="node" [lastParentNode]="true" [countParents]="0" [lastNode]="lastParentNode"></app-node-tree>
3+
104
<!--
115
haure de fer algo aixi
126
<app-node-tree [node]="node" [lastParentNode]="lastParentNode" [lastNode]="lastNode"></app-node-tree>

src/assets/blank_node.png

162 Bytes
Loading

src/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/* You can add global styles to this file, and also import other style files */
1+
/* You can add global styles to this file, and also import other style files */

0 commit comments

Comments
 (0)