Prevent exclude click in editing (bulk editor) mode

This commit is contained in:
Michael Shamoon 2021-01-21 11:09:59 -08:00
parent 29a7737829
commit 795dbc16d2
2 changed files with 9 additions and 3 deletions

View File

@ -19,7 +19,7 @@
</div>
<div *ngIf="selectionModel.items" class="items">
<ng-container *ngFor="let item of selectionModel.itemsSorted | filter: filterText">
<app-toggleable-dropdown-button *ngIf="allowSelectNone || item.id" [item]="item" [state]="selectionModel.get(item.id)" (toggle)="selectionModel.toggle(item.id)" (exclude)="selectionModel.exclude(item.id)"></app-toggleable-dropdown-button>
<app-toggleable-dropdown-button *ngIf="allowSelectNone || item.id" [item]="item" [state]="selectionModel.get(item.id)" (toggle)="selectionModel.toggle(item.id)" (exclude)="excludeClicked(item.id)"></app-toggleable-dropdown-button>
</ng-container>
</div>
<button *ngIf="editing" class="list-group-item list-group-item-action bg-light" (click)="applyClicked()" [disabled]="!selectionModel.isDirty()">

View File

@ -91,8 +91,6 @@ export class FilterableDropdownSelectionModel {
}
exclude(id: number, fireEvent:boolean = true) {
console.log('exclude', id, fireEvent);
let state = this.temporarySelectionStates.get(id)
if (state == null || state != ToggleableItemState.Excluded) {
this.temporarySelectionStates.set(id, ToggleableItemState.Excluded)
@ -296,4 +294,12 @@ export class FilterableDropdownComponent {
}
}
}
excludeClicked(itemID: number) {
if (this.editing) {
this.selectionModel.toggle(itemID)
} else {
this.selectionModel.exclude(itemID)
}
}
}