mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Reduce calls to isDirty for filterable dropdowns
And make disabled more visually obvious
This commit is contained in:
		| @@ -35,8 +35,8 @@ | ||||
|           <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()"> | ||||
|         <small class="ms-2" [ngClass]="{'fw-bold': selectionModel.isDirty()}" i18n>Apply</small> | ||||
|       <button *ngIf="editing" class="list-group-item list-group-item-action bg-light" (click)="applyClicked()" [disabled]="!modelIsDirty"> | ||||
|         <small class="ms-2" [ngClass]="{'fw-bold': modelIsDirty}" i18n>Apply</small> | ||||
|         <svg width="1.5em" height="1em" viewBox="0 0 16 16" fill="currentColor"> | ||||
|           <use xlink:href="assets/bootstrap-icons.svg#arrow-right" /> | ||||
|         </svg> | ||||
|   | ||||
| @@ -13,6 +13,10 @@ | ||||
|     max-height: 400px; | ||||
|     overflow-y: scroll; | ||||
|   } | ||||
|  | ||||
|   button:disabled { | ||||
|     opacity: 0.2; | ||||
|   } | ||||
| } | ||||
|  | ||||
| .btn-group-xs { | ||||
|   | ||||
| @@ -275,8 +275,13 @@ export class FilterableDropdownComponent { | ||||
|     return this.selectionModel.selectionSize() > 1 && this.selectionModel.getExcludedItems().length == 0 | ||||
|   } | ||||
|  | ||||
|   modelIsDirty: boolean = false | ||||
|  | ||||
|   constructor(private filterPipe: FilterPipe) { | ||||
|     this.selectionModel = new FilterableDropdownSelectionModel() | ||||
|     this.selectionModelChange.subscribe(updatedModel => { | ||||
|       this.modelIsDirty = updatedModel.isDirty() | ||||
|     }) | ||||
|   } | ||||
|  | ||||
|   applyClicked() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon