RED-9788 - Adapt Annotation column to display only annotations per component if component is selected

This commit is contained in:
Valentin Mihai 2024-08-09 08:58:36 +03:00
parent b623449efb
commit 4f955bcd50
9 changed files with 45 additions and 55 deletions

View File

@ -185,26 +185,19 @@
>.
</ng-container>
<ng-container
*ngIf="(fileDataService.allLength$ | async) === 0 || state.componentReferenceIds?.length === 0"
>
{{ 'file-preview.tabs.annotations.no-annotations' | translate }}
</ng-container>
<ng-container
*ngIf="
(fileDataService.allLength$ | async) > 0 &&
displayedPages.length === 0 &&
!filterService.noAnnotationsFilterChecked
"
>{{ 'file-preview.tabs.annotations.wrong-filters' | translate }}
<a
(click)="filterService.reset()"
class="with-underline"
translate="file-preview.tabs.annotations.reset"
></a>
{{ 'file-preview.tabs.annotations.the-filters' | translate }}
</ng-container>
@if ((fileDataService.allLength$ | async) > 0 && displayedPages.length === 0) {
@if (this.enabledFilters?.length) {
{{ 'file-preview.tabs.annotations.wrong-filters' | translate }}
<a
(click)="filterService.reset()"
class="with-underline"
translate="file-preview.tabs.annotations.reset"
></a>
{{ 'file-preview.tabs.annotations.the-filters' | translate }}
} @else if (state.componentReferenceIds?.length === 0) {
{{ 'file-preview.tabs.annotations.no-annotations' | translate }}
}
}
</iqser-empty-state>
<div *ngIf="displayedPages.length" class="no-annotations-buttons-container mt-32">

View File

@ -90,9 +90,10 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
protected readonly currentPageIsExcluded = computed(() => this.state.file().excludedPages.includes(this.pdf.currentPage()));
protected readonly translations = workloadTranslations;
protected readonly isDocumine = getConfig().IS_DOCUMINE;
displayedAnnotations = new Map<number, AnnotationWrapper[]>();
displayedPages: number[] = [];
pagesPanelActive = true;
protected displayedAnnotations = new Map<number, AnnotationWrapper[]>();
protected displayedPages: number[] = [];
protected pagesPanelActive = true;
protected enabledFilters = [];
constructor(
readonly filterService: FilterService,
@ -425,15 +426,15 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
this.displayedAnnotations = this._annotationProcessingService.filterAndGroupAnnotations(annotations, primary, secondary);
const pagesThatDisplayAnnotations = [...this.displayedAnnotations.keys()];
const enabledFilters = this.filterService.enabledFlatFilters;
if (enabledFilters.some(f => f.id === 'pages-without-annotations')) {
if (enabledFilters.length === 1 && !onlyPageWithAnnotations) {
this.enabledFilters = this.filterService.enabledFlatFilters;
if (this.enabledFilters.some(f => f.id === 'pages-without-annotations')) {
if (this.enabledFilters.length === 1 && !onlyPageWithAnnotations) {
this.displayedPages = this.#allPages.filter(page => !pagesThatDisplayAnnotations.includes(page));
} else {
this.displayedPages = [];
}
this.displayedAnnotations.clear();
} else if (enabledFilters.length || onlyPageWithAnnotations || componentReferenceIds) {
} else if (this.enabledFilters.length || onlyPageWithAnnotations || componentReferenceIds) {
this.displayedPages = pagesThatDisplayAnnotations;
} else {
this.displayedPages = this.#allPages;

View File

@ -141,10 +141,6 @@ export class AnnotationProcessingService {
}
}
if (this.#isDocumine) {
this.#createNoAnnotationsFilter(filterMap, filters);
}
return filters.sort((a, b) => SuperTypeSorter[a.id] - SuperTypeSorter[b.id]);
}
@ -272,19 +268,4 @@ export class AnnotationProcessingService {
return first.pageNumber < second.pageNumber ? -1 : 1;
});
}
#createNoAnnotationsFilter(filterMap: Map<string, INestedFilter>, filters: INestedFilter[]) {
const childFilter: IFilter = {
id: 'no-annotations-filter',
label: 'no-annotations-filter',
checked: false,
matches: 1,
skipTranslation: true,
hidden: true,
};
const newChildFilter = new Filter(childFilter);
filterMap.set('no-annotations-filter', newChildFilter);
filters[0]?.children.push(newChildFilter);
}
}

View File

@ -1,4 +1,8 @@
<div [style.visibility]="documentViewer.loaded() ? 'visible' : 'hidden'" class="pagination noselect">
<div
[style.visibility]="documentViewer.loaded() ? 'visible' : 'hidden'"
class="pagination noselect"
[class.documine-pagination]="isDocumine"
>
<div (click)="pdf.navigatePreviousPage()">
<mat-icon class="chevron-icon" svgIcon="iqser:nav-prev"></mat-icon>
</div>

View File

@ -13,6 +13,10 @@
justify-content: center;
align-items: center;
&.documine-pagination {
left: calc(100% - (var(--documine-viewer-width) / 2) - var(--qiuck-navigation-width));
}
> div {
height: 16px;
cursor: default;

View File

@ -1,6 +1,7 @@
import { Component } from '@angular/core';
import { PdfViewer } from '../../services/pdf-viewer.service';
import { REDDocumentViewer } from '../../services/document-viewer.service';
import { getConfig } from '@iqser/common-ui';
@Component({
selector: 'redaction-paginator',
@ -8,5 +9,9 @@ import { REDDocumentViewer } from '../../services/document-viewer.service';
styleUrls: ['./paginator.component.scss'],
})
export class PaginatorComponent {
constructor(readonly pdf: PdfViewer, readonly documentViewer: REDDocumentViewer) {}
protected readonly isDocumine = getConfig().IS_DOCUMINE;
constructor(
readonly pdf: PdfViewer,
readonly documentViewer: REDDocumentViewer,
) {}
}

View File

@ -1,3 +1,3 @@
<redaction-compare-file-input></redaction-compare-file-input>
<redaction-paginator *ngIf="!isDocumine"></redaction-paginator>
<redaction-paginator></redaction-paginator>

View File

@ -169,12 +169,16 @@ body {
--iqser-app-name-font-family: OpenSans Extrabold, sans-serif;
--iqser-app-name-font-size: 13px;
--iqser-logo-size: 28px;
--documine-viewer-width: calc(
100% - var(--structured-component-management-width) - var(--documine-workload-content-width) - var(--qiuck-navigation-width) - 3px
);
--viewer-height: calc(100% - calc(var(--iqser-top-bar-height) + 50px));
}
.redaction-viewer {
visibility: hidden;
width: calc(100% - var(--workload-width));
height: calc(100% - calc(var(--iqser-top-bar-height) + 50px));
height: var(--viewer-height);
bottom: 0;
left: 0;
position: absolute;
@ -182,10 +186,8 @@ body {
.documine-viewer {
visibility: hidden;
width: calc(
100% - var(--structured-component-management-width) - var(--documine-workload-content-width) - var(--qiuck-navigation-width) - 3px
);
height: calc(100% - calc(var(--iqser-top-bar-height) + 50px));
width: var(--documine-viewer-width);
height: var(--viewer-height);
bottom: 0;
right: calc(var(--qiuck-navigation-width) + 3px);
position: absolute;

@ -1 +1 @@
Subproject commit 00b1b40a3112dc168046ca3bc261dd8dbbc02538
Subproject commit 5b51eb85a161fccf878041abf93c607415e2f476