mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Add apply button to dropdowns
This commit is contained in:
		| @@ -24,6 +24,12 @@ | |||||||
|           <app-toggleable-dropdown-button [toggleableItem]="toggleableItem" [showCounts]="showCounts" (toggle)="toggleItem($event)"></app-toggleable-dropdown-button> |           <app-toggleable-dropdown-button [toggleableItem]="toggleableItem" [showCounts]="showCounts" (toggle)="toggleItem($event)"></app-toggleable-dropdown-button> | ||||||
|         </ng-container> |         </ng-container> | ||||||
|       </div> |       </div> | ||||||
|  |       <button *ngIf="type == types.Editing" class="list-group-item list-group-item-action bg-light" (click)="dropdown.close()" [disabled]="!hasBeenToggled || (toggleableItems | filter: filterText).length == 0"> | ||||||
|  |         <small class="ml-1" [ngClass]="{'font-weight-bold': hasBeenToggled && (toggleableItems | filter: filterText).length > 0}">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> | ||||||
|  |       </button> | ||||||
|     </div> |     </div> | ||||||
|   </div> |   </div> | ||||||
| </div> | </div> | ||||||
|   | |||||||
| @@ -89,12 +89,15 @@ export class FilterableDropdownComponent { | |||||||
|     return this._showCounts && (this.type == FilterableDropdownType.Editing || (this.type == FilterableDropdownType.Filtering && this.itemsSelected.length == 0)) |     return this._showCounts && (this.type == FilterableDropdownType.Editing || (this.type == FilterableDropdownType.Filtering && this.itemsSelected.length == 0)) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   hasBeenToggled:boolean = false | ||||||
|  |  | ||||||
|   constructor(private filterPipe: FilterPipe) { } |   constructor(private filterPipe: FilterPipe) { } | ||||||
|  |  | ||||||
|   toggleItem(toggleableItem: ToggleableItem): void { |   toggleItem(toggleableItem: ToggleableItem): void { | ||||||
|     if (this.singular && toggleableItem.state == ToggleableItemState.Selected) { |     if (this.singular && toggleableItem.state == ToggleableItemState.Selected) { | ||||||
|       this._toggleableItems.filter(ti => ti.item.id !== toggleableItem.item.id).forEach(ti => ti.state = ToggleableItemState.NotSelected) |       this._toggleableItems.filter(ti => ti.item.id !== toggleableItem.item.id).forEach(ti => ti.state = ToggleableItemState.NotSelected) | ||||||
|     } |     } | ||||||
|  |     this.hasBeenToggled = true | ||||||
|     this.toggle.emit(toggleableItem.item) |     this.toggle.emit(toggleableItem.item) | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -103,6 +106,7 @@ export class FilterableDropdownComponent { | |||||||
|       setTimeout(() => { |       setTimeout(() => { | ||||||
|         this.listFilterTextInput.nativeElement.focus(); |         this.listFilterTextInput.nativeElement.focus(); | ||||||
|       }, 0) |       }, 0) | ||||||
|  |       this.hasBeenToggled = false | ||||||
|       this.open.next() |       this.open.next() | ||||||
|     } else { |     } else { | ||||||
|       this.filterText = '' |       this.filterText = '' | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon