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,
&.help-mode {
&:hover {
background-color: var(--iqser-annotation-hover);
::ng-deep .annotation-actions {
display: flex;
}
}
&.active {
background-color: var(--iqser-annotation-hover);
}
}
.hide-comments {

View File

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

View File

@ -94,6 +94,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
protected displayedPages: number[] = [];
protected pagesPanelActive = true;
protected enabledFilters = [];
#displayedPagesChanged = false;
constructor(
readonly filterService: FilterService,
@ -407,7 +408,8 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
): Map<number, AnnotationWrapper[]> {
const onlyPageWithAnnotations = this.viewModeService.onlyPagesWithAnnotations();
if (!primary || primary.length === 0) {
this.displayedPages = onlyPageWithAnnotations ? [] : this.#allPages;
const pages = onlyPageWithAnnotations ? [] : this.#allPages;
this.#setDisplayedPages(pages);
return;
}
@ -429,15 +431,16 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
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));
const pages = this.#allPages.filter(page => !pagesThatDisplayAnnotations.includes(page));
this.#setDisplayedPages(pages);
} else {
this.displayedPages = [];
this.#setDisplayedPages([]);
}
this.displayedAnnotations.clear();
} else if (this.enabledFilters.length || onlyPageWithAnnotations || componentReferenceIds) {
this.displayedPages = pagesThatDisplayAnnotations;
this.#setDisplayedPages(pagesThatDisplayAnnotations);
} else {
this.displayedPages = this.#allPages;
this.#setDisplayedPages(this.#allPages);
}
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>[]>) {
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;
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])
);
}
}