fix rebase & reference dialog back in list component
This commit is contained in:
parent
fb859ece19
commit
d688a73291
@ -88,8 +88,8 @@
|
||||
></iqser-circle-button>
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="this.annotationReferencesService.show()"
|
||||
*ngIf="(annotationReferencesService.hasReferences$ | async) && !multiSelectService.isActive"
|
||||
(action)="this.annotationReferencesService.show(annotations)"
|
||||
*ngIf="hasReferences && !multiSelectService.isActive"
|
||||
[tooltipPosition]="tooltipPosition"
|
||||
[tooltip]="'annotation-actions.see-references.label' | translate"
|
||||
[type]="buttonType"
|
||||
|
||||
@ -65,6 +65,10 @@ export class AnnotationActionsComponent implements OnChanges {
|
||||
this._annotations = value.filter(a => a !== undefined);
|
||||
}
|
||||
|
||||
get hasReferences(): boolean {
|
||||
return !!this.annotations[0].reference && this.annotations[0].reference.length !== 0;
|
||||
}
|
||||
|
||||
get viewerAnnotations() {
|
||||
if (this.viewer?.Core.annotationManager) {
|
||||
return this._annotations.map(a => this.viewer?.Core.annotationManager?.getAnnotationById(a.id));
|
||||
|
||||
@ -20,13 +20,3 @@
|
||||
<iqser-round-checkbox *ngIf="(multiSelectService.active$ | async) && isSelected" [active]="true"></iqser-round-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ng-container *ngIf="annotationReferencesService.showReferences$ | async">
|
||||
<redaction-annotation-references-dialog
|
||||
(referenceClicked)="referenceClicked($event)"
|
||||
*ngIf="annotationReferencesService.hasReferences$ | async"
|
||||
[annotation]="annotationReferencesService.annotation$ | async"
|
||||
[fileData]="fileData"
|
||||
[file]="file"
|
||||
></redaction-annotation-references-dialog>
|
||||
</ng-container>
|
||||
|
||||
@ -2,31 +2,17 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||
import { AnnotationWrapper } from '../../../../../../models/file/annotation.wrapper';
|
||||
import { File } from '@red/domain';
|
||||
import { MultiSelectService } from '../../services/multi-select.service';
|
||||
import { AnnotationReferencesService } from '../../services/annotation-references.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-annotation-card',
|
||||
templateUrl: './annotation-card.component.html',
|
||||
styleUrls: ['./annotation-card.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
providers: [AnnotationReferencesService],
|
||||
})
|
||||
export class AnnotationCardComponent {
|
||||
@Input() annotation: AnnotationWrapper;
|
||||
@Input() file: File;
|
||||
@Input() isSelected = false;
|
||||
|
||||
constructor(
|
||||
readonly multiSelectService: MultiSelectService,
|
||||
private readonly _annotationReferenceService: AnnotationReferencesService,
|
||||
) {
|
||||
this._annotationReferenceService.setAnnotation([this.annotation]);
|
||||
}
|
||||
|
||||
/*referenceClicked(annotation: AnnotationWrapper): void {
|
||||
this.annotationClicked(annotation, null);
|
||||
if (this._filterService.filtersEnabled('primaryFilters')) {
|
||||
this._filterService.toggleFilter('primaryFilters', annotation.superType, true);
|
||||
}
|
||||
}*/
|
||||
constructor(readonly multiSelectService: MultiSelectService) {}
|
||||
}
|
||||
|
||||
@ -43,3 +43,13 @@
|
||||
|
||||
<redaction-annotation-details [annotation]="annotation"></redaction-annotation-details>
|
||||
</div>
|
||||
|
||||
<ng-container *ngIf="annotationReferencesService.annotation$ | async as annotation">
|
||||
<redaction-annotation-references-dialog
|
||||
(referenceClicked)="referenceClicked($event)"
|
||||
*ngIf="annotationReferencesService.showReferences$ | async"
|
||||
[annotation]="annotation"
|
||||
[fileData]="fileData"
|
||||
[file]="file"
|
||||
></redaction-annotation-references-dialog>
|
||||
</ng-container>
|
||||
|
||||
@ -53,6 +53,13 @@ export class AnnotationsListComponent implements OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
referenceClicked(annotation: AnnotationWrapper): void {
|
||||
this.annotationClicked(annotation, null);
|
||||
if (this._filterService.filtersEnabled('primaryFilters')) {
|
||||
this._filterService.toggleFilter('primaryFilters', annotation.superType, true);
|
||||
}
|
||||
}
|
||||
|
||||
isSelected(annotationId: string): boolean {
|
||||
return !!this.selectedAnnotations?.find(a => a?.annotationId === annotationId);
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@ import { SkippedService } from './services/skipped.service';
|
||||
import { AnnotationActionsService } from './services/annotation-actions.service';
|
||||
import { FilePreviewStateService } from './services/file-preview-state.service';
|
||||
import { FileDataModel } from '../../../../models/file/file-data.model';
|
||||
import { AnnotationReferencesService } from './services/annotation-references.service';
|
||||
import Annotation = Core.Annotations.Annotation;
|
||||
import PDFNet = Core.PDFNet;
|
||||
|
||||
@ -154,19 +155,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
return this._stateService.fileData;
|
||||
}
|
||||
|
||||
private _setActiveViewerPage() {
|
||||
const currentPage = this._instance?.Core.documentViewer?.getCurrentPage();
|
||||
if (!currentPage) {
|
||||
this.activeViewerPage = 1;
|
||||
} else {
|
||||
this.activeViewerPage = this.viewModeService.isCompare
|
||||
? currentPage % 2 === 0
|
||||
? currentPage / 2
|
||||
: (currentPage + 1) / 2
|
||||
: currentPage;
|
||||
}
|
||||
}
|
||||
|
||||
private get _viewDocumentInfo$() {
|
||||
return this.documentInfoService.shown$.pipe(
|
||||
tap(value => {
|
||||
|
||||
@ -2,12 +2,10 @@ import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { shareDistinctLast } from '@iqser/common-ui';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Injectable()
|
||||
export class AnnotationReferencesService {
|
||||
readonly annotation$: Observable<AnnotationWrapper>;
|
||||
readonly hasReferences$: Observable<boolean>;
|
||||
readonly showReferences$: Observable<boolean>;
|
||||
private readonly _annotation$: BehaviorSubject<AnnotationWrapper> = new BehaviorSubject<AnnotationWrapper>(null);
|
||||
private readonly _showReferences$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
@ -15,18 +13,15 @@ export class AnnotationReferencesService {
|
||||
constructor() {
|
||||
this.annotation$ = this._annotation$.asObservable().pipe(shareDistinctLast());
|
||||
this.showReferences$ = this._showReferences$.asObservable().pipe(shareDistinctLast());
|
||||
this.hasReferences$ = this.annotation$.pipe(map(annotation => !!annotation.reference && annotation.reference.length !== 0));
|
||||
}
|
||||
|
||||
setAnnotation(annotation: AnnotationWrapper[]): void {
|
||||
this._annotation$.next(annotation[0]);
|
||||
}
|
||||
|
||||
show() {
|
||||
show(annotations: AnnotationWrapper[]) {
|
||||
this._annotation$.next(annotations[0]);
|
||||
this._showReferences$.next(true);
|
||||
}
|
||||
|
||||
hide() {
|
||||
this._annotation$.next(null);
|
||||
this._showReferences$.next(false);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user