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>
|
||||||
|
|
||||||
<iqser-circle-button
|
<iqser-circle-button
|
||||||
(action)="this.annotationReferencesService.show()"
|
(action)="this.annotationReferencesService.show(annotations)"
|
||||||
*ngIf="(annotationReferencesService.hasReferences$ | async) && !multiSelectService.isActive"
|
*ngIf="hasReferences && !multiSelectService.isActive"
|
||||||
[tooltipPosition]="tooltipPosition"
|
[tooltipPosition]="tooltipPosition"
|
||||||
[tooltip]="'annotation-actions.see-references.label' | translate"
|
[tooltip]="'annotation-actions.see-references.label' | translate"
|
||||||
[type]="buttonType"
|
[type]="buttonType"
|
||||||
|
|||||||
@ -65,6 +65,10 @@ export class AnnotationActionsComponent implements OnChanges {
|
|||||||
this._annotations = value.filter(a => a !== undefined);
|
this._annotations = value.filter(a => a !== undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get hasReferences(): boolean {
|
||||||
|
return !!this.annotations[0].reference && this.annotations[0].reference.length !== 0;
|
||||||
|
}
|
||||||
|
|
||||||
get viewerAnnotations() {
|
get viewerAnnotations() {
|
||||||
if (this.viewer?.Core.annotationManager) {
|
if (this.viewer?.Core.annotationManager) {
|
||||||
return this._annotations.map(a => this.viewer?.Core.annotationManager?.getAnnotationById(a.id));
|
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>
|
<iqser-round-checkbox *ngIf="(multiSelectService.active$ | async) && isSelected" [active]="true"></iqser-round-checkbox>
|
||||||
</div>
|
</div>
|
||||||
</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 { AnnotationWrapper } from '../../../../../../models/file/annotation.wrapper';
|
||||||
import { File } from '@red/domain';
|
import { File } from '@red/domain';
|
||||||
import { MultiSelectService } from '../../services/multi-select.service';
|
import { MultiSelectService } from '../../services/multi-select.service';
|
||||||
import { AnnotationReferencesService } from '../../services/annotation-references.service';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-annotation-card',
|
selector: 'redaction-annotation-card',
|
||||||
templateUrl: './annotation-card.component.html',
|
templateUrl: './annotation-card.component.html',
|
||||||
styleUrls: ['./annotation-card.component.scss'],
|
styleUrls: ['./annotation-card.component.scss'],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
providers: [AnnotationReferencesService],
|
|
||||||
})
|
})
|
||||||
export class AnnotationCardComponent {
|
export class AnnotationCardComponent {
|
||||||
@Input() annotation: AnnotationWrapper;
|
@Input() annotation: AnnotationWrapper;
|
||||||
@Input() file: File;
|
@Input() file: File;
|
||||||
@Input() isSelected = false;
|
@Input() isSelected = false;
|
||||||
|
|
||||||
constructor(
|
constructor(readonly multiSelectService: MultiSelectService) {}
|
||||||
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);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,3 +43,13 @@
|
|||||||
|
|
||||||
<redaction-annotation-details [annotation]="annotation"></redaction-annotation-details>
|
<redaction-annotation-details [annotation]="annotation"></redaction-annotation-details>
|
||||||
</div>
|
</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 {
|
isSelected(annotationId: string): boolean {
|
||||||
return !!this.selectedAnnotations?.find(a => a?.annotationId === annotationId);
|
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 { AnnotationActionsService } from './services/annotation-actions.service';
|
||||||
import { FilePreviewStateService } from './services/file-preview-state.service';
|
import { FilePreviewStateService } from './services/file-preview-state.service';
|
||||||
import { FileDataModel } from '../../../../models/file/file-data.model';
|
import { FileDataModel } from '../../../../models/file/file-data.model';
|
||||||
|
import { AnnotationReferencesService } from './services/annotation-references.service';
|
||||||
import Annotation = Core.Annotations.Annotation;
|
import Annotation = Core.Annotations.Annotation;
|
||||||
import PDFNet = Core.PDFNet;
|
import PDFNet = Core.PDFNet;
|
||||||
|
|
||||||
@ -154,19 +155,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
|||||||
return this._stateService.fileData;
|
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$() {
|
private get _viewDocumentInfo$() {
|
||||||
return this.documentInfoService.shown$.pipe(
|
return this.documentInfoService.shown$.pipe(
|
||||||
tap(value => {
|
tap(value => {
|
||||||
|
|||||||
@ -2,12 +2,10 @@ import { Injectable } from '@angular/core';
|
|||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
import { shareDistinctLast } from '@iqser/common-ui';
|
import { shareDistinctLast } from '@iqser/common-ui';
|
||||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||||
import { map } from 'rxjs/operators';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AnnotationReferencesService {
|
export class AnnotationReferencesService {
|
||||||
readonly annotation$: Observable<AnnotationWrapper>;
|
readonly annotation$: Observable<AnnotationWrapper>;
|
||||||
readonly hasReferences$: Observable<boolean>;
|
|
||||||
readonly showReferences$: Observable<boolean>;
|
readonly showReferences$: Observable<boolean>;
|
||||||
private readonly _annotation$: BehaviorSubject<AnnotationWrapper> = new BehaviorSubject<AnnotationWrapper>(null);
|
private readonly _annotation$: BehaviorSubject<AnnotationWrapper> = new BehaviorSubject<AnnotationWrapper>(null);
|
||||||
private readonly _showReferences$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
private readonly _showReferences$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||||
@ -15,18 +13,15 @@ export class AnnotationReferencesService {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.annotation$ = this._annotation$.asObservable().pipe(shareDistinctLast());
|
this.annotation$ = this._annotation$.asObservable().pipe(shareDistinctLast());
|
||||||
this.showReferences$ = this._showReferences$.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 {
|
show(annotations: AnnotationWrapper[]) {
|
||||||
this._annotation$.next(annotation[0]);
|
this._annotation$.next(annotations[0]);
|
||||||
}
|
|
||||||
|
|
||||||
show() {
|
|
||||||
this._showReferences$.next(true);
|
this._showReferences$.next(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
hide() {
|
hide() {
|
||||||
|
this._annotation$.next(null);
|
||||||
this._showReferences$.next(false);
|
this._showReferences$.next(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user