</app-page-header>
<div class="row sticky-top pt-3 pt-sm-4 pb-2 pb-lg-4 bg-body">
- <app-filter-editor [hidden]="isBulkEditing" [(filterRules)]="list.filterRules" [unmodifiedFilterRules]="unmodifiedFilterRules" #filterEditor></app-filter-editor>
+ <app-filter-editor [hidden]="isBulkEditing" [(filterRules)]="list.filterRules" [unmodifiedFilterRules]="unmodifiedFilterRules" [selectionData]="list.selectionData" #filterEditor></app-filter-editor>
<app-bulk-editor [hidden]="!isBulkEditing"></app-bulk-editor>
</div>
<app-filterable-dropdown class="flex-fill" title="Tags" icon="tag-fill" i18n-title
filterPlaceholder="Filter tags" i18n-filterPlaceholder
[items]="tags"
+ [multiple]="true"
[(selectionModel)]="tagSelectionModel"
(selectionModelChange)="updateRules()"
- [multiple]="true"
(opened)="onTagsDropdownOpen()"
+ [documentCounts]="tagDocumentCounts"
[allowSelectNone]="true"></app-filterable-dropdown>
<app-filterable-dropdown class="flex-fill" title="Correspondent" icon="person-fill" i18n-title
filterPlaceholder="Filter correspondents" i18n-filterPlaceholder
[(selectionModel)]="correspondentSelectionModel"
(selectionModelChange)="updateRules()"
(opened)="onCorrespondentDropdownOpen()"
+ [documentCounts]="correspondentDocumentCounts"
[allowSelectNone]="true"></app-filterable-dropdown>
<app-filterable-dropdown class="flex-fill" title="Document type" icon="file-earmark-fill" i18n-title
filterPlaceholder="Filter document types" i18n-filterPlaceholder
[items]="documentTypes"
[(selectionModel)]="documentTypeSelectionModel"
- (opened)="onDocumentTypeDropdownOpen()"
(selectionModelChange)="updateRules()"
+ (opened)="onDocumentTypeDropdownOpen()"
+ [documentCounts]="documentTypeDocumentCounts"
[allowSelectNone]="true"></app-filterable-dropdown>
<app-filterable-dropdown class="me-2 flex-fill" title="Storage path" icon="folder-fill" i18n-title
filterPlaceholder="Filter storage paths" i18n-filterPlaceholder
[items]="storagePaths"
[(selectionModel)]="storagePathSelectionModel"
- (opened)="onStoragePathDropdownOpen()"
(selectionModelChange)="updateRules()"
+ (opened)="onStoragePathDropdownOpen()"
+ [documentCounts]="storagePathDocumentCounts"
[allowSelectNone]="true"></app-filterable-dropdown>
</div>
<div class="d-flex flex-wrap">
} from 'src/app/data/filter-rule-type'
import { FilterableDropdownSelectionModel } from '../../common/filterable-dropdown/filterable-dropdown.component'
import { ToggleableItemState } from '../../common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component'
-import { DocumentService } from 'src/app/services/rest/document.service'
+import {
+ DocumentService,
+ SelectionData,
+ SelectionDataItem,
+} from 'src/app/services/rest/document.service'
import { PaperlessDocument } from 'src/app/data/paperless-document'
import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path'
import { StoragePathService } from 'src/app/services/rest/storage-path.service'
documentTypes: PaperlessDocumentType[] = []
storagePaths: PaperlessStoragePath[] = []
+ tagDocumentCounts: SelectionDataItem[]
+ correspondentDocumentCounts: SelectionDataItem[]
+ documentTypeDocumentCounts: SelectionDataItem[]
+ storagePathDocumentCounts: SelectionDataItem[]
+
_textFilter = ''
_moreLikeId: number
_moreLikeDoc: PaperlessDocument
@Output()
filterRulesChange = new EventEmitter<FilterRule[]>()
+ @Input()
+ set selectionData(selectionData: SelectionData) {
+ this.tagDocumentCounts = selectionData?.selected_tags ?? null
+ this.documentTypeDocumentCounts =
+ selectionData?.selected_document_types ?? null
+ this.correspondentDocumentCounts =
+ selectionData?.selected_correspondents ?? null
+ this.storagePathDocumentCounts =
+ selectionData?.selected_storage_paths ?? null
+ }
+
rulesModified: boolean = false
updateRules() {
}
onCorrespondentDropdownOpen() {
+ console.log(this.correspondentSelectionModel)
+
this.correspondentSelectionModel.apply()
}
import { SETTINGS_KEYS } from '../data/paperless-uisettings'
import { DOCUMENT_LIST_SERVICE } from '../data/storage-keys'
import { paramsFromViewState, paramsToViewState } from '../utils/query-params'
-import { DocumentService, DOCUMENT_SORT_FIELDS } from './rest/document.service'
+import {
+ DocumentService,
+ DOCUMENT_SORT_FIELDS,
+ SelectionData,
+} from './rest/document.service'
import { SettingsService } from './settings.service'
/**
rangeSelectionAnchorIndex: number
lastRangeSelectionToIndex: number
+ selectionData?: SelectionData
+
currentPageSize: number = this.settings.get(SETTINGS_KEYS.DOCUMENT_LIST_SIZE)
private listViewStates: Map<number, ListViewState> = new Map()
this.isReloading = false
activeListViewState.collectionSize = result.count
activeListViewState.documents = result.results
+
+ this.documentService
+ .getSelectionData(result.results.map((d) => d.id))
+ .subscribe({
+ next: (selectionData) => {
+ this.selectionData = selectionData
+ },
+ error: () => {
+ this.selectionData = null
+ },
+ })
+
if (updateQueryParams && !this._activeSavedViewId) {
let base = ['/documents']
this.router.navigate(base, {
activeListViewState.currentPage = 1
this.reload()
} else {
+ this.selectionData = null
let errorMessage
if (
typeof error.error !== 'string' &&