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