mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-03 11:29:28 -05:00
Disable any / all toggle when excluded items
This commit is contained in:
parent
ec4fc3a2f3
commit
f62d881f1a
@ -15,10 +15,10 @@
|
|||||||
<div *ngIf="!editing && multiple" class="list-group-item d-flex">
|
<div *ngIf="!editing && multiple" class="list-group-item d-flex">
|
||||||
<div class="btn-group btn-group-xs btn-group-toggle flex-fill" ngbRadioGroup [(ngModel)]="selectionModel.logicalOperator" (change)="selectionModel.toggleOperator()">
|
<div class="btn-group btn-group-xs btn-group-toggle flex-fill" ngbRadioGroup [(ngModel)]="selectionModel.logicalOperator" (change)="selectionModel.toggleOperator()">
|
||||||
<label ngbButtonLabel class="btn btn-outline-primary">
|
<label ngbButtonLabel class="btn btn-outline-primary">
|
||||||
<input ngbButton type="radio" name="logicalOperator" value="and" [disabled]="selectionModel.selectionSize() < 2"> All
|
<input ngbButton type="radio" name="logicalOperator" value="and" [disabled]="!operatorToggleEnabled"> All
|
||||||
</label>
|
</label>
|
||||||
<label ngbButtonLabel class="btn btn-outline-primary">
|
<label ngbButtonLabel class="btn btn-outline-primary">
|
||||||
<input ngbButton type="radio" name="logicalOperator" value="or" [disabled]="selectionModel.selectionSize() < 2"> Any
|
<input ngbButton type="radio" name="logicalOperator" value="or" [disabled]="!operatorToggleEnabled"> Any
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -95,6 +95,7 @@ export class FilterableDropdownSelectionModel {
|
|||||||
let state = this.temporarySelectionStates.get(id)
|
let state = this.temporarySelectionStates.get(id)
|
||||||
if (state == null || state != ToggleableItemState.Excluded) {
|
if (state == null || state != ToggleableItemState.Excluded) {
|
||||||
this.temporarySelectionStates.set(id, ToggleableItemState.Excluded)
|
this.temporarySelectionStates.set(id, ToggleableItemState.Excluded)
|
||||||
|
this.temporaryLogicalOperator = this._logicalOperator = 'and'
|
||||||
} else if (state == ToggleableItemState.Excluded) {
|
} else if (state == ToggleableItemState.Excluded) {
|
||||||
this.temporarySelectionStates.delete(id)
|
this.temporarySelectionStates.delete(id)
|
||||||
}
|
}
|
||||||
@ -270,6 +271,10 @@ export class FilterableDropdownComponent {
|
|||||||
@Output()
|
@Output()
|
||||||
open = new EventEmitter()
|
open = new EventEmitter()
|
||||||
|
|
||||||
|
get operatorToggleEnabled(): boolean {
|
||||||
|
return this.selectionModel.selectionSize() > 1 && this.selectionModel.getExcludedItems().length == 0
|
||||||
|
}
|
||||||
|
|
||||||
constructor(private filterPipe: FilterPipe) {
|
constructor(private filterPipe: FilterPipe) {
|
||||||
this.selectionModel = new FilterableDropdownSelectionModel()
|
this.selectionModel = new FilterableDropdownSelectionModel()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user