|
17 | 17 | <div class="job-list-item-container">
|
18 | 18 | <mat-tree [dataSource]="dataSource" [treeControl]="treeControl">
|
19 | 19 | <!-- Tree node for lois -->
|
20 |
| - <mat-tree-node *matTreeNodeDef="let node" matTreeNodePadding [class.tree-node-selected]="isSelectedLoi(node)" |
21 |
| - class="loi-tree-node" role="button" tabindex="0" mat-button (click)="selectLoi(node)" |
22 |
| - [style.padding-left]="isSidePanelExpanded() ? '40px' : '16px'"> |
23 |
| - <mat-icon svgIcon="{{ node.iconName }}" class="{{ node.jobId }} loi-icon" [ngStyle]="{color: node.iconColor}" |
24 |
| - [style.padding-left]="isSidePanelExpanded() ? '10px' : '0'"></mat-icon> |
25 |
| - <div class="loi-name" *ngIf="isSidePanelExpanded()"> |
26 |
| - {{ node.name }} |
27 |
| - </div> |
28 |
| - </mat-tree-node> |
29 |
| - <!-- Tree node for jobs --> |
30 | 20 | <mat-tree-node
|
| 21 | + *matTreeNodeDef="let node" |
| 22 | + matTreeNodePadding |
| 23 | + mat-button |
| 24 | + class="loi-tree-node" |
| 25 | + tabindex="0" |
| 26 | + role="button" |
| 27 | + (click)="selectLoi(node)" |
31 | 28 | [class.tree-node-selected]="isSelectedLoi(node)"
|
32 |
| - *matTreeNodeDef="let node; when: hasChild" |
33 |
| - matTreeNodePadding class="expandable-node" |
| 29 | + [style.padding-left]="isSidePanelExpanded() ? '50px' : '0px'" |
34 | 30 | >
|
35 |
| - <div class="expandable-node-start" *ngIf="isSidePanelExpanded()"> |
| 31 | + <ng-container *ngIf="isSidePanelExpanded()"> |
| 32 | + <mat-icon svgIcon="{{ node.iconName }}" class="loi-icon" [ngStyle]="{color: node.iconColor}"></mat-icon> |
| 33 | + |
| 34 | + <div class="loi-name">{{ node.name }}</div> |
| 35 | + </ng-container> |
| 36 | + |
| 37 | + <ng-container *ngIf="!isSidePanelExpanded()"> |
36 | 38 | <button mat-icon-button [attr.aria-label]="'Toggle ' + node.item" matTreeNodeToggle>
|
37 |
| - <mat-icon class="mat-icon-rtl-mirror"> |
38 |
| - chevron_right |
39 |
| - </mat-icon> |
| 39 | + <mat-icon svgIcon="{{ node.iconName }}" class="loi-icon" [ngStyle]="{color: node.iconColor}"></mat-icon> |
40 | 40 | </button>
|
| 41 | + </ng-container> |
| 42 | + </mat-tree-node> |
| 43 | + <!-- Tree node for jobs --> |
| 44 | + <mat-tree-node |
| 45 | + *matTreeNodeDef="let node; when: isJob" |
| 46 | + matTreeNodePadding |
| 47 | + class="job-tree-node" |
| 48 | + > |
| 49 | + <ng-container *ngIf="isSidePanelExpanded()"> |
| 50 | + <ng-container *ngIf="hasChild(node)"> |
| 51 | + <button mat-icon-button [attr.aria-label]="'Toggle ' + node.item" matTreeNodeToggle> |
| 52 | + <mat-icon class="mat-icon-rtl-mirror"> |
| 53 | + {{treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'}} |
| 54 | + </mat-icon> |
| 55 | + </button> |
| 56 | + </ng-container> |
41 | 57 |
|
42 |
| - <mat-icon class="job-icon" [ngStyle]="{color: node.iconColor}"> |
43 |
| - {{ node.iconName }} |
44 |
| - </mat-icon> |
| 58 | + <ng-container *ngIf="!hasChild(node)"> |
| 59 | + <div style="width: 40px; visibility: hidden;"></div> |
| 60 | + </ng-container> |
45 | 61 |
|
46 |
| - <div class="job-name">{{ node.name }}</div> |
47 |
| - </div> |
| 62 | + <div class="job-tree-node-label"> |
| 63 | + <ng-container *ngTemplateOutlet="jobLabel; context: { node: node }"></ng-container> |
| 64 | + </div> |
| 65 | + |
| 66 | + <div [ngSwitch]="actionsType"> |
| 67 | + <div *ngSwitchCase="jobListItemActionsType.MENU"> |
| 68 | + <button mat-icon-button [matMenuTriggerFor]="jobMenu"> |
| 69 | + <mat-icon>more_vert</mat-icon> |
| 70 | + </button> |
| 71 | + <mat-menu #jobMenu="matMenu"> |
| 72 | + <a (click)="onDownloadCsvClick()" target="_blank"> |
| 73 | + <button mat-menu-item> |
| 74 | + <span>Download job data (CSV)</span> |
| 75 | + </button> |
| 76 | + </a> |
| 77 | + <a (click)="onDownloadGeoJsonClick()" target="_blank"> |
| 78 | + <button mat-menu-item> |
| 79 | + <span>Download site locations (GeoJSON)</span> |
| 80 | + </button> |
| 81 | + </a> |
| 82 | + </mat-menu> |
| 83 | + </div> |
| 84 | + <div *ngSwitchCase="jobListItemActionsType.BACK"> |
| 85 | + <button mat-icon-button aria-label="back" (click)="onGoBackClick()"> |
| 86 | + <mat-icon>close</mat-icon> |
| 87 | + </button> |
| 88 | + </div> |
| 89 | + </div> |
| 90 | + </ng-container> |
48 | 91 |
|
49 |
| - <div class="expandable-node-start" *ngIf="!isSidePanelExpanded()"> |
| 92 | + <ng-container *ngIf="!isSidePanelExpanded()"> |
50 | 93 | <button mat-icon-button [attr.aria-label]="'Toggle ' + node.item" matTreeNodeToggle>
|
51 |
| - <mat-icon class="job-icon" [ngStyle]="{color: node.iconColor}" |
52 |
| - (click)="treeControl.toggle(node)"> |
| 94 | + <mat-icon class="job-icon" [ngStyle]="{color: node.iconColor}"> |
53 | 95 | {{ node.iconName }}
|
54 | 96 | </mat-icon>
|
55 | 97 | </button>
|
56 |
| - </div> |
57 |
| - |
58 |
| - <div [ngSwitch]="actionsType" *ngIf="isSidePanelExpanded()"> |
59 |
| - <div *ngSwitchCase="jobListItemActionsType.MENU"> |
60 |
| - <button mat-icon-button [matMenuTriggerFor]="jobMenu"> |
61 |
| - <mat-icon>more_vert</mat-icon> |
62 |
| - </button> |
63 |
| - <mat-menu #jobMenu="matMenu"> |
64 |
| - <a (click)="onDownloadCsvClick()" target="_blank"> |
65 |
| - <button mat-menu-item> |
66 |
| - <span>Download job data (CSV)</span> |
67 |
| - </button> |
68 |
| - </a> |
69 |
| - <a (click)="onDownloadGeoJsonClick()" target="_blank"> |
70 |
| - <button mat-menu-item> |
71 |
| - <span>Download site locations (GeoJSON)</span> |
72 |
| - </button> |
73 |
| - </a> |
74 |
| - </mat-menu> |
75 |
| - </div> |
76 |
| - <div *ngSwitchCase="jobListItemActionsType.BACK"> |
77 |
| - <button mat-icon-button aria-label="back" (click)="onGoBackClick()"> |
78 |
| - <mat-icon>close</mat-icon> |
79 |
| - </button> |
80 |
| - </div> |
81 |
| - </div> |
| 98 | + </ng-container> |
82 | 99 | </mat-tree-node>
|
83 | 100 | </mat-tree>
|
84 | 101 | </div>
|
| 102 | + |
| 103 | +<ng-template #jobLabel let-node="node"> |
| 104 | + <mat-icon class="job-icon" [ngStyle]="{color: node.iconColor}"> |
| 105 | + {{ node.iconName }} |
| 106 | + </mat-icon> |
| 107 | + |
| 108 | + <div class="job-name">{{ node.name }}</div> |
| 109 | +</ng-template> |
0 commit comments