mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-28 03:46:06 -05:00 
			
		
		
		
	fixes #307
This commit is contained in:
		| @@ -20,7 +20,7 @@ | ||||
|         </div> | ||||
|       </div> | ||||
|       <div *ngIf="selectionModel.items" class="items"> | ||||
|         <ng-container *ngFor="let item of (editing ? selectionModel.itemsSorted : selectionModel.items) | filter: filterText"> | ||||
|         <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)"></app-toggleable-dropdown-button> | ||||
|         </ng-container> | ||||
|       </div> | ||||
|   | ||||
| @@ -19,8 +19,13 @@ export class FilterableDropdownSelectionModel { | ||||
|   items: MatchingModel[] = [] | ||||
|  | ||||
|   get itemsSorted(): MatchingModel[] { | ||||
|     // TODO: this is getting called very often | ||||
|     return this.items.sort((a,b) => { | ||||
|       if (this.getNonTemporary(a.id) == ToggleableItemState.NotSelected && this.getNonTemporary(b.id) != ToggleableItemState.NotSelected) { | ||||
|       if (a.id == null && b.id != null) { | ||||
|         return -1 | ||||
|       } else if (a.id != null && b.id == null) { | ||||
|         return 1 | ||||
|       } else if (this.getNonTemporary(a.id) == ToggleableItemState.NotSelected && this.getNonTemporary(b.id) != ToggleableItemState.NotSelected) { | ||||
|         return 1 | ||||
|       } else if (this.getNonTemporary(a.id) != ToggleableItemState.NotSelected && this.getNonTemporary(b.id) == ToggleableItemState.NotSelected) { | ||||
|         return -1 | ||||
|   | ||||
| @@ -14,17 +14,20 @@ | ||||
|           [(selectionModel)]="tagSelectionModel" | ||||
|           (selectionModelChange)="updateRules()" | ||||
|           [multiple]="true" | ||||
|           (open)="onTagsDropdownOpen()" | ||||
|           [allowSelectNone]="true"></app-filterable-dropdown> | ||||
|         <app-filterable-dropdown class="mr-2 mr-md-3" title="Correspondent" icon="person-fill" i18n-title | ||||
|           filterPlaceholder="Filter correspondents" i18n-filterPlaceholder | ||||
|           [items]="correspondents" | ||||
|           [(selectionModel)]="correspondentSelectionModel" | ||||
|           (selectionModelChange)="updateRules()" | ||||
|           (open)="onCorrespondentDropdownOpen()" | ||||
|           [allowSelectNone]="true"></app-filterable-dropdown> | ||||
|         <app-filterable-dropdown class="mr-2 mr-md-3" title="Document type" icon="file-earmark-fill" i18n-title | ||||
|           filterPlaceholder="Filter document types" i18n-filterPlaceholder | ||||
|           [items]="documentTypes" | ||||
|           [(selectionModel)]="documentTypeSelectionModel" | ||||
|           (open)="onDocumentTypeDropdownOpen()" | ||||
|           (selectionModelChange)="updateRules()" | ||||
|           [allowSelectNone]="true"></app-filterable-dropdown> | ||||
|         <app-date-dropdown class="mr-2 mr-md-3" | ||||
|   | ||||
| @@ -210,4 +210,15 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | ||||
|     this.documentTypeSelectionModel.toggle(documentTypeId) | ||||
|   } | ||||
|  | ||||
|   onTagsDropdownOpen() { | ||||
|     this.tagSelectionModel.apply() | ||||
|   } | ||||
|  | ||||
|   onCorrespondentDropdownOpen() { | ||||
|     this.correspondentSelectionModel.apply() | ||||
|   } | ||||
|  | ||||
|   onDocumentTypeDropdownOpen() { | ||||
|     this.documentTypeSelectionModel.apply() | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 jonaswinkler
					jonaswinkler