RED-10515: fixed multi select for hidden annotations.

This commit is contained in:
Nicoleta Panaghiu 2024-11-24 12:18:19 +02:00
parent 4dbfba1c7b
commit 182a11ce5b
2 changed files with 12 additions and 21 deletions

View File

@ -1,9 +1,8 @@
import { ActivatedRouteSnapshot, NavigationExtras, Router, RouterLink } from '@angular/router';
import { ChangeDetectorRef, Component, effect, NgZone, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { ActivatedRouteSnapshot, NavigationExtras, Router } from '@angular/router';
import { ChangeDetectorRef, Component, effect, NgZone, OnDestroy, OnInit, TemplateRef, untracked, ViewChild } from '@angular/core';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { ComponentCanDeactivate } from '@guards/can-deactivate.guard';
import {
CircleButtonComponent,
CircleButtonTypes,
ConfirmOption,
ConfirmOptions,
@ -12,7 +11,6 @@ import {
ErrorService,
getConfig,
IConfirmationDialogData,
IqserAllowDirective,
IqserDialog,
LoadingService,
Toaster,
@ -60,12 +58,7 @@ import { ViewModeService } from './services/view-mode.service';
import { RedactTextData } from './utils/dialog-types';
import { MultiSelectService } from './services/multi-select.service';
import { NgIf } from '@angular/common';
import { ViewSwitchComponent } from './components/view-switch/view-switch.component';
import { ProcessingIndicatorComponent } from '@shared/components/processing-indicator/processing-indicator.component';
import { UserManagementComponent } from './components/user-management/user-management.component';
import { TranslateModule } from '@ngx-translate/core';
import { InitialsAvatarComponent } from '@common-ui/users';
import { FileActionsComponent } from '../shared-dossiers/components/file-actions/file-actions.component';
import { FilePreviewRightContainerComponent } from './components/right-container/file-preview-right-container.component';
import { TypeFilterComponent } from '@shared/components/type-filter/type-filter.component';
import { FileHeaderComponent } from './components/file-header/file-header.component';
@ -80,16 +73,8 @@ import { ANNOTATION_ACTION_ICONS, ANNOTATION_ACTIONS } from './utils/constants';
standalone: true,
imports: [
NgIf,
ViewSwitchComponent,
ProcessingIndicatorComponent,
UserManagementComponent,
TranslateModule,
InitialsAvatarComponent,
CircleButtonComponent,
IqserAllowDirective,
FileActionsComponent,
DisableStopPropagationDirective,
RouterLink,
FilePreviewRightContainerComponent,
TypeFilterComponent,
FileHeaderComponent,
@ -101,13 +86,13 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
readonly roles = Roles;
readonly fileId = this.state.fileId;
readonly dossierId = this.state.dossierId;
protected readonly isDocumine = getConfig().IS_DOCUMINE;
@ViewChild('annotationFilterTemplate', {
read: TemplateRef,
static: false,
})
private readonly _filterTemplate: TemplateRef<unknown>;
#loadAllAnnotationsEnabled = false;
protected readonly isDocumine = getConfig().IS_DOCUMINE;
constructor(
readonly pdf: PdfViewer,
@ -180,6 +165,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
effect(() => {
this._viewModeService.viewMode();
this.pdf.currentPage();
this.updateViewMode().then();
});
@ -251,7 +237,8 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
switch (this._viewModeService.viewMode()) {
case ViewModes.STANDARD: {
const wrappers = this._fileDataService.annotations();
const wrappers = untracked(this._fileDataService.annotations);
const multiSelectActive = untracked(this._multiSelectService.active);
const ocrAnnotationIds = wrappers.filter(a => a.isOCR).map(a => a.id);
const standardEntries = annotations
.filter(a => !bool(a.getCustomData('changeLogRemoved')) && !this._annotationManager.isHidden(a.Id))
@ -265,7 +252,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
this._readableRedactionsService.setAnnotationsColor(standardEntries, 'annotationColor');
this._readableRedactionsService.setAnnotationsOpacity(standardEntries, true);
this._annotationManager.show(standardEntries);
this._annotationManager.hide(nonStandardEntries);
this._annotationManager.hide(nonStandardEntries, multiSelectActive);
break;
}
case ViewModes.DELTA: {

View File

@ -106,7 +106,11 @@ export class REDAnnotationManager {
this.deselect(this.selected.map(annotation => annotation.Id));
}
hide(annotations: Annotation[]): void {
hide(annotations: Annotation[], multiSelectActive = false): void {
if (multiSelectActive) {
annotations.forEach(a => (a['Opacity'] = 0));
return;
}
this.#manager.hideAnnotations(annotations);
}