Merge branch 'VM/RED-8748' into 'master'

RED-8748 - Integrated component view in DocuMine

Closes RED-8748

See merge request redactmanager/red-ui!533
This commit is contained in:
Nicoleta Panaghiu 2024-08-12 10:29:02 +02:00
commit 954fba26f7
3 changed files with 30 additions and 9 deletions

View File

@ -58,14 +58,17 @@
} }
} }
&:hover, &:hover {
&.help-mode {
background-color: var(--iqser-annotation-hover); background-color: var(--iqser-annotation-hover);
::ng-deep .annotation-actions { ::ng-deep .annotation-actions {
display: flex; display: flex;
} }
} }
&.active {
background-color: var(--iqser-annotation-hover);
}
} }
.hide-comments { .hide-comments {

View File

@ -162,7 +162,6 @@
#annotationsElement #annotationsElement
(keydown)="preventKeyDefault($event)" (keydown)="preventKeyDefault($event)"
(keyup)="preventKeyDefault($event)" (keyup)="preventKeyDefault($event)"
[class.active-panel]="!pagesPanelActive"
[hidden]="excludedPagesService.shown()" [hidden]="excludedPagesService.shown()"
class="annotations" class="annotations"
id="annotations-list" id="annotations-list"

View File

@ -94,6 +94,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
protected displayedPages: number[] = []; protected displayedPages: number[] = [];
protected pagesPanelActive = true; protected pagesPanelActive = true;
protected enabledFilters = []; protected enabledFilters = [];
#displayedPagesChanged = false;
constructor( constructor(
readonly filterService: FilterService, readonly filterService: FilterService,
@ -407,7 +408,8 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
): Map<number, AnnotationWrapper[]> { ): Map<number, AnnotationWrapper[]> {
const onlyPageWithAnnotations = this.viewModeService.onlyPagesWithAnnotations(); const onlyPageWithAnnotations = this.viewModeService.onlyPagesWithAnnotations();
if (!primary || primary.length === 0) { if (!primary || primary.length === 0) {
this.displayedPages = onlyPageWithAnnotations ? [] : this.#allPages; const pages = onlyPageWithAnnotations ? [] : this.#allPages;
this.#setDisplayedPages(pages);
return; return;
} }
@ -429,15 +431,16 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
this.enabledFilters = this.filterService.enabledFlatFilters; this.enabledFilters = this.filterService.enabledFlatFilters;
if (this.enabledFilters.some(f => f.id === 'pages-without-annotations')) { if (this.enabledFilters.some(f => f.id === 'pages-without-annotations')) {
if (this.enabledFilters.length === 1 && !onlyPageWithAnnotations) { if (this.enabledFilters.length === 1 && !onlyPageWithAnnotations) {
this.displayedPages = this.#allPages.filter(page => !pagesThatDisplayAnnotations.includes(page)); const pages = this.#allPages.filter(page => !pagesThatDisplayAnnotations.includes(page));
this.#setDisplayedPages(pages);
} else { } else {
this.displayedPages = []; this.#setDisplayedPages([]);
} }
this.displayedAnnotations.clear(); this.displayedAnnotations.clear();
} else if (this.enabledFilters.length || onlyPageWithAnnotations || componentReferenceIds) { } else if (this.enabledFilters.length || onlyPageWithAnnotations || componentReferenceIds) {
this.displayedPages = pagesThatDisplayAnnotations; this.#setDisplayedPages(pagesThatDisplayAnnotations);
} else { } else {
this.displayedPages = this.#allPages; this.#setDisplayedPages(this.#allPages);
} }
this.displayedPages.sort((a, b) => a - b); this.displayedPages.sort((a, b) => a - b);
@ -533,9 +536,25 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
} }
#scrollToFirstAnnotationPage(annotations: Map<number, ListItem<AnnotationWrapper>[]>) { #scrollToFirstAnnotationPage(annotations: Map<number, ListItem<AnnotationWrapper>[]>) {
if (this.isDocumine && annotations.size && !this.displayedPages.includes(this.pdf.currentPage())) { if (this.isDocumine && annotations.size && this.#displayedPagesChanged && !this.displayedPages.includes(this.pdf.currentPage())) {
const page = annotations.keys().next().value; const page = annotations.keys().next().value;
this.pdf.navigateTo(page); this.pdf.navigateTo(page);
} }
} }
#setDisplayedPages(newDisplayedPages: number[]) {
if (!this.#samePages(newDisplayedPages)) {
this.displayedPages = newDisplayedPages;
this.#displayedPagesChanged = true;
return;
}
this.#displayedPagesChanged = false;
}
#samePages(newDisplayedPages: number[]) {
return (
this.displayedPages.length === newDisplayedPages.length &&
this.displayedPages.every((value, index) => value === newDisplayedPages[index])
);
}
} }