Completely rewrite change detection, add back remove operations

This commit is contained in:
Michael Shamoon
2020-12-22 02:08:36 -08:00
parent 6c5d607c6f
commit dddceed451
6 changed files with 143 additions and 30 deletions

View File

@@ -19,6 +19,12 @@
<input class="form-control" type="text" [(ngModel)]="filterText" placeholder="Filter {{title}}" (keyup.enter)="listFilterEnter()" #listFilterTextInput>
</div>
</div>
<button *ngIf="showRemoveAll" role="menuitem" class="list-group-item list-group-item-action d-flex align-items-center p-2 border-top-0 border-left-0 border-right-0 border-bottom" (click)="removeAll.next()">
<svg class="toolbaricon text-danger" fill="currentColor">
<use xlink:href="assets/bootstrap-icons.svg#x" />
</svg>
<small class="my-1">Remove All</small>
</button>
<div *ngIf="toggleableItems" class="items">
<ng-container *ngFor="let toggleableItem of toggleableItems | filter: filterText">
<app-toggleable-dropdown-button [toggleableItem]="toggleableItem" [showCounts]="showCounts" (toggle)="toggleItem($event)"></app-toggleable-dropdown-button>

View File

@@ -69,12 +69,18 @@ export class FilterableDropdownComponent {
@Input()
singular: boolean = false
@Input()
showRemoveAll: boolean = false
@Output()
toggle = new EventEmitter()
@Output()
open = new EventEmitter()
@Output()
removeAll = new EventEmitter()
@Output()
editingComplete = new EventEmitter()
@@ -110,7 +116,7 @@ export class FilterableDropdownComponent {
this.open.next()
} else {
this.filterText = ''
if (this.type == FilterableDropdownType.Editing) this.editingComplete.emit(this.itemsSelected)
if (this.type == FilterableDropdownType.Editing) this.editingComplete.emit(this.toggleableItems)
}
}