-
-
Notifications
You must be signed in to change notification settings - Fork 350
Expand file tree
/
Copy pathselectable-list.component.html
More file actions
73 lines (71 loc) · 2.58 KB
/
selectable-list.component.html
File metadata and controls
73 lines (71 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!-- Generic selectable list for teams or groups -->
<div class="selectable-list">
<div class="selectable-list-header">
<h2>{{ title }}</h2>
<div *ngIf="editMode" class="edit-hint">Click Accept when finished</div>
<div *ngIf="relationshipEditMode" class="edit-hint">Click to toggle relationship</div>
<button
mat-icon-button
*ngIf="canEdit && !editMode && !relationshipEditMode"
(click)="toggleEditMode()"
title="Edit {{ title }}">
<mat-icon>edit</mat-icon>
</button>
<span *ngIf="editMode">
<button mat-icon-button (click)="addItem.emit()" title="{{ addLabel }} {{ title }}">
<mat-icon>add</mat-icon>
</button>
<button mat-icon-button (click)="cancel.emit()" title="Cancel, forget changes">
<mat-icon>undo</mat-icon>
</button>
<button mat-icon-button (click)="save.emit()" title="Accept changes">
<mat-icon>check</mat-icon>
</button>
</span>
</div>
<ul>
<li
*ngFor="let name of items"
[class.selected]="name === selectedItem"
[class.highlighted]="highlightedItems.includes(name)"
(click)="onItemClicked(name)">
<span *ngIf="editMode && editingOrgName === name; then editItem; else displayItem"></span>
<ng-template #editItem>
<input
#editInput
[(ngModel)]="editingName"
(keydown.escape)="cancelEditItem(name)"
(keydown.enter)="saveEditedItem(name)"
(blur)="saveEditedItem(name)" />
</ng-template>
<ng-template #displayItem>
<span>{{ name }}</span>
</ng-template>
<span *ngIf="editMode">
<button
*ngIf="editingOrgName !== name"
mat-icon-button
(click)="startEditItem(name)"
title="Rename {{ name }}">
<mat-icon class="material-icons-outlined">edit</mat-icon>
</button>
<button
*ngIf="editingOrgName === name"
mat-icon-button
(click)="saveEditedItem(name)"
title="Accept edit for {{ name }}">
<mat-icon class="material-icons-outlined">check</mat-icon>
</button>
<button mat-icon-button (click)="deleteListItem(name)" title="Delete {{ name }}">
<mat-icon class="material-icons-outlined">delete</mat-icon>
</button>
</span>
<span *ngIf="relationshipEditMode">
<mat-icon *ngIf="highlightedItems.includes(name); else unselected" color="primary"
>check_box</mat-icon
>
<ng-template #unselected><mat-icon>check_box_outline_blank</mat-icon></ng-template>
</span>
</li>
</ul>
</div>