Merge branch 'dan' into 'master'
RED-7155 fix resize recommendations See merge request redactmanager/red-ui!42
This commit is contained in:
commit
2b5667dc29
@ -1,14 +1,13 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { DetailsRadioOption, IconButtonTypes, IqserPermissionsService } from '@iqser/common-ui';
|
||||
import { Dictionary, Dossier, IAddRedactionRequest } from '@red/domain';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { FormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { Roles } from '@users/roles';
|
||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||
import { DetailsRadioOption, IconButtonTypes, IqserDialogComponent, IqserPermissionsService } from '@iqser/common-ui';
|
||||
import { Dictionary, Dossier, IAddRedactionRequest } from '@red/domain';
|
||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||
import { Roles } from '@users/roles';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { IqserDialogComponent } from '@iqser/common-ui';
|
||||
import { getRedactOrHintOptions, RedactOrHintOption, RedactOrHintOptions } from '../../utils/dialog-options';
|
||||
import { AddHintData, AddHintResult } from '../../utils/dialog-types';
|
||||
|
||||
@ -16,6 +15,9 @@ import { AddHintData, AddHintResult } from '../../utils/dialog-types';
|
||||
templateUrl: './add-hint-dialog.component.html',
|
||||
})
|
||||
export class AddHintDialogComponent extends IqserDialogComponent<AddHintDialogComponent, AddHintData, AddHintResult> implements OnInit {
|
||||
#applyToAllDossiers: boolean;
|
||||
readonly #dossier: Dossier;
|
||||
readonly #isRss = this._iqserPermissionsService.has(Roles.getRss);
|
||||
readonly roles = Roles;
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly options: DetailsRadioOption<RedactOrHintOption>[];
|
||||
@ -23,11 +25,6 @@ export class AddHintDialogComponent extends IqserDialogComponent<AddHintDialogCo
|
||||
dictionaries: Dictionary[] = [];
|
||||
form!: UntypedFormGroup;
|
||||
|
||||
#applyToAllDossiers: boolean;
|
||||
|
||||
readonly #dossier: Dossier;
|
||||
readonly #isRss = this._iqserPermissionsService.has(Roles.getRss);
|
||||
|
||||
constructor(
|
||||
private readonly _justificationsService: JustificationsService,
|
||||
private readonly _activeDossiersService: ActiveDossiersService,
|
||||
@ -38,7 +35,7 @@ export class AddHintDialogComponent extends IqserDialogComponent<AddHintDialogCo
|
||||
super();
|
||||
this.#dossier = _activeDossiersService.find(this.data.dossierId);
|
||||
this.#applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
||||
this.options = getRedactOrHintOptions(this.#dossier, this.#isRss, true, this.#applyToAllDossiers, this.data.isApprover);
|
||||
this.options = getRedactOrHintOptions(this.#dossier, this.#applyToAllDossiers, this.data.isApprover, false, true, this.#isRss);
|
||||
|
||||
this.form = this.#getForm();
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<div [translate]="'redact-text.dialog.title'" class="dialog-header heading-l"></div>
|
||||
|
||||
<div class="dialog-content redaction">
|
||||
<div *ngIf="form.get('selectedText').value as selectedText" class="iqser-input-group w-450">
|
||||
<div *ngIf="form.controls.selectedText.value as selectedText" class="iqser-input-group w-450">
|
||||
<label [translate]="'redact-text.dialog.content.selected-text'" class="selected-text"></label>
|
||||
{{ selectedText }}
|
||||
</div>
|
||||
|
||||
@ -1,18 +1,17 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { FormBuilder } from '@angular/forms';
|
||||
import { DetailsRadioOption, IconButtonTypes, IqserDialogComponent } from '@iqser/common-ui';
|
||||
import { Dictionary, Dossier, IAddRedactionRequest, SuperTypes } from '@red/domain';
|
||||
import { FormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { Roles } from '@users/roles';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { Dictionary, IAddRedactionRequest, SuperTypes } from '@red/domain';
|
||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||
import { LegalBasisOption } from '../manual-redaction-dialog/manual-annotation-dialog.component';
|
||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { getRedactOrHintOptions, RedactOrHintOption, RedactOrHintOptions } from '../../utils/dialog-options';
|
||||
import { RedactRecommendationData, RedactRecommendationResult } from '../../utils/dialog-types';
|
||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { LegalBasisOption } from '../manual-redaction-dialog/manual-annotation-dialog.component';
|
||||
|
||||
@Component({
|
||||
templateUrl: './redact-recommendation-dialog.component.html',
|
||||
@ -21,40 +20,33 @@ export class RedactRecommendationDialogComponent
|
||||
extends IqserDialogComponent<RedactRecommendationDialogComponent, RedactRecommendationData, RedactRecommendationResult>
|
||||
implements OnInit
|
||||
{
|
||||
readonly roles = Roles;
|
||||
readonly #dossier = inject(ActiveDossiersService).find(this.data.dossierId);
|
||||
readonly #manualRedactionTypeExists = inject(DictionaryService).hasManualType(this.#dossier.dossierTemplateId);
|
||||
#applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly options: DetailsRadioOption<RedactOrHintOption>[];
|
||||
readonly firstEntry: AnnotationWrapper;
|
||||
readonly isMulti: boolean;
|
||||
readonly firstEntry = this.data.annotations[0];
|
||||
readonly isMulti = this.data.annotations.length > 1;
|
||||
dictionaryRequest = false;
|
||||
legalOptions: LegalBasisOption[] = [];
|
||||
dictionaries: Dictionary[] = [];
|
||||
form!: UntypedFormGroup;
|
||||
|
||||
#manualRedactionTypeExists = true;
|
||||
#applyToAllDossiers: boolean;
|
||||
|
||||
readonly #dossier: Dossier;
|
||||
readonly form = inject(FormBuilder).group({
|
||||
selectedText: this.isMulti ? null : this.firstEntry.value,
|
||||
comment: [null],
|
||||
dictionary: [null],
|
||||
option: [null],
|
||||
reason: [null],
|
||||
});
|
||||
|
||||
constructor(
|
||||
private readonly _justificationsService: JustificationsService,
|
||||
private readonly _activeDossiersService: ActiveDossiersService,
|
||||
private readonly _dictionaryService: DictionaryService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
) {
|
||||
super();
|
||||
this.#dossier = this._activeDossiersService.find(this.data.dossierId);
|
||||
this.#applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
||||
this.options = getRedactOrHintOptions(this.#dossier, false, false, this.#applyToAllDossiers, this.data.isApprover);
|
||||
this.#manualRedactionTypeExists = this._dictionaryService.hasManualType(this.#dossier.dossierTemplateId);
|
||||
this.firstEntry = this.data.annotations[0];
|
||||
this.isMulti = this.data.annotations.length > 1;
|
||||
this.options = getRedactOrHintOptions(this.#dossier, this.#applyToAllDossiers, this.data.isApprover, true);
|
||||
|
||||
this.form = this.#getForm();
|
||||
|
||||
this.form
|
||||
.get('option')
|
||||
.valueChanges.pipe(
|
||||
this.form.controls.option.valueChanges
|
||||
.pipe(
|
||||
tap((option: DetailsRadioOption<RedactOrHintOption>) => {
|
||||
this.dictionaryRequest = option.value === RedactOrHintOptions.IN_DOSSIER;
|
||||
this.#setDictionaries();
|
||||
@ -64,11 +56,11 @@ export class RedactRecommendationDialogComponent
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.form.get('option').setValue(this.options[1]);
|
||||
this.form.controls.option.setValue(this.options[0]);
|
||||
}
|
||||
|
||||
get displayedDictionaryLabel() {
|
||||
const dictType = this.form.get('dictionary').value;
|
||||
const dictType = this.form.controls.dictionary.value;
|
||||
if (dictType) {
|
||||
return this.dictionaries.find(d => d.type === dictType)?.label ?? null;
|
||||
}
|
||||
@ -76,7 +68,7 @@ export class RedactRecommendationDialogComponent
|
||||
}
|
||||
|
||||
get disabled() {
|
||||
return this.dictionaryRequest && !this.form.get('dictionary').value;
|
||||
return this.dictionaryRequest && !this.form.controls.dictionary.value;
|
||||
}
|
||||
|
||||
async ngOnInit(): Promise<void> {
|
||||
@ -96,26 +88,26 @@ export class RedactRecommendationDialogComponent
|
||||
this.#applyToAllDossiers = option.extraOption.checked;
|
||||
|
||||
this.#setDictionaries();
|
||||
if (this.#applyToAllDossiers && this.form.get('dictionary').value) {
|
||||
const selectedDictionaryLabel = this.form.get('dictionary').value;
|
||||
if (this.#applyToAllDossiers && this.form.controls.dictionary.value) {
|
||||
const selectedDictionaryLabel = this.form.controls.dictionary.value;
|
||||
const selectedDictionary = this.dictionaries.find(d => d.type === selectedDictionaryLabel);
|
||||
if (!selectedDictionary) {
|
||||
this.form.get('dictionary').setValue(null);
|
||||
this.form.controls.dictionary.setValue(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typeChanged() {
|
||||
if (!this.#applyToAllDossiers) {
|
||||
const selectedDictionaryType = this.form.get('dictionary').value;
|
||||
const selectedDictionaryType = this.form.controls.dictionary.value;
|
||||
const selectedDictionary = this.dictionaries.find(d => d.type === selectedDictionaryType);
|
||||
this.options[1].extraOption.disabled = selectedDictionary.dossierDictionaryOnly;
|
||||
this.options[0].extraOption.disabled = selectedDictionary.dossierDictionaryOnly;
|
||||
}
|
||||
}
|
||||
|
||||
save(): void {
|
||||
save() {
|
||||
const redaction = this.#convertRecommendationToRedaction(this.firstEntry);
|
||||
this.dialogRef.close({
|
||||
this.close({
|
||||
redaction,
|
||||
isMulti: this.isMulti,
|
||||
});
|
||||
@ -125,25 +117,16 @@ export class RedactRecommendationDialogComponent
|
||||
this.dictionaries = this._dictionaryService.getRedactTextDictionaries(this.#dossier.dossierTemplateId, !this.#applyToAllDossiers);
|
||||
}
|
||||
|
||||
#getForm(): UntypedFormGroup {
|
||||
return this._formBuilder.group({
|
||||
selectedText: this.isMulti ? null : this.firstEntry.value,
|
||||
comment: [null],
|
||||
dictionary: [null],
|
||||
option: [null],
|
||||
});
|
||||
}
|
||||
|
||||
#selectReason() {
|
||||
if (this.legalOptions.length === 1) {
|
||||
this.form.get('reason').setValue(this.legalOptions[0]);
|
||||
this.form.controls.reason.setValue(this.legalOptions[0]);
|
||||
}
|
||||
}
|
||||
|
||||
#convertRecommendationToRedaction(recommendation: AnnotationWrapper): IAddRedactionRequest {
|
||||
const addRedactionRequest: IAddRedactionRequest = { ...recommendation };
|
||||
addRedactionRequest.type = this.form.get('dictionary').value;
|
||||
addRedactionRequest.value = this.form.get('selectedText').value;
|
||||
addRedactionRequest.type = this.form.controls.dictionary.value;
|
||||
addRedactionRequest.value = this.form.controls.selectedText.value;
|
||||
|
||||
const selectedType = this.dictionaries.find(d => d.type === addRedactionRequest.type);
|
||||
|
||||
@ -153,7 +136,7 @@ export class RedactRecommendationDialogComponent
|
||||
addRedactionRequest.addToDictionary = this.dictionaryRequest && addRedactionRequest.type !== 'dossier_redaction';
|
||||
}
|
||||
|
||||
const commentValue = this.form.get('comment').value;
|
||||
const commentValue = this.form.controls.comment.value;
|
||||
addRedactionRequest.comment = commentValue ? { text: commentValue } : null;
|
||||
addRedactionRequest.addToAllDossiers = this.data.isApprover && this.dictionaryRequest && this.#applyToAllDossiers;
|
||||
return addRedactionRequest;
|
||||
@ -162,9 +145,9 @@ export class RedactRecommendationDialogComponent
|
||||
#resetValues() {
|
||||
this.#applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
||||
if (this.dictionaryRequest) {
|
||||
this.form.get('dictionary').setValue(this.firstEntry.type);
|
||||
this.form.controls.dictionary.setValue(this.firstEntry.type);
|
||||
return;
|
||||
}
|
||||
this.form.get('dictionary').setValue(this.#manualRedactionTypeExists ? SuperTypes.ManualRedaction : null);
|
||||
this.form.controls.dictionary.setValue(this.#manualRedactionTypeExists ? SuperTypes.ManualRedaction : null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { FormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { FormBuilder } from '@angular/forms';
|
||||
import { DetailsRadioOption, IconButtonTypes, IqserDialogComponent } from '@iqser/common-ui';
|
||||
import { Dictionary, Dossier, IAddRedactionRequest, SuperTypes } from '@red/domain';
|
||||
import { Dictionary, IAddRedactionRequest, SuperTypes } from '@red/domain';
|
||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||
@ -21,28 +21,25 @@ export class RedactTextDialogComponent
|
||||
extends IqserDialogComponent<RedactTextDialogComponent, RedactTextData, RedactTextResult>
|
||||
implements OnInit
|
||||
{
|
||||
#manualRedactionTypeExists = true;
|
||||
#applyToAllDossiers: boolean;
|
||||
readonly #dossier: Dossier;
|
||||
readonly #manualRedactionTypeExists: boolean;
|
||||
#applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
||||
readonly #dossier = inject(ActiveDossiersService).find(this.data.dossierId);
|
||||
readonly roles = Roles;
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly options: DetailsRadioOption<RedactOrHintOption>[];
|
||||
dictionaryRequest = false;
|
||||
legalOptions: LegalBasisOption[] = [];
|
||||
dictionaries: Dictionary[] = [];
|
||||
form!: UntypedFormGroup;
|
||||
readonly form;
|
||||
|
||||
constructor(
|
||||
private readonly _justificationsService: JustificationsService,
|
||||
private readonly _activeDossiersService: ActiveDossiersService,
|
||||
private readonly _dictionaryService: DictionaryService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
) {
|
||||
super();
|
||||
this.#dossier = _activeDossiersService.find(this.data.dossierId);
|
||||
this.#applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
||||
this.#manualRedactionTypeExists = this._dictionaryService.hasManualType(this.#dossier.dossierTemplateId);
|
||||
this.options = getRedactOrHintOptions(this.#dossier, false, false, this.#applyToAllDossiers, this.data.isApprover);
|
||||
this.options = getRedactOrHintOptions(this.#dossier, this.#applyToAllDossiers, this.data.isApprover);
|
||||
|
||||
this.form = this.#getForm();
|
||||
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { DetailsRadioOption, IconButtonTypes, IqserDialogComponent, IqserPermissionsService } from '@iqser/common-ui';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { Dictionary, Dossier } from '@red/domain';
|
||||
import { DetailsRadioOption, IconButtonTypes, IqserDialogComponent } from '@iqser/common-ui';
|
||||
import { Dictionary } from '@red/domain';
|
||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||
import { Roles } from '@users/roles';
|
||||
import { getResizeRedactionOptions, ResizeOptions, ResizeRedactionOption } from '../../utils/dialog-options';
|
||||
import { ResizeRedactionData, ResizeRedactionResult } from '../../utils/dialog-types';
|
||||
|
||||
@ -17,12 +15,11 @@ export class ResizeRedactionDialogComponent
|
||||
implements OnInit
|
||||
{
|
||||
readonly #applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
||||
readonly #dossier: Dossier;
|
||||
readonly #isRss = this._iqserPermissionsService.has(Roles.getRss);
|
||||
readonly #dossier = inject(ActiveDossiersService).find(this.data.dossierId);
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly options: DetailsRadioOption<ResizeRedactionOption>[];
|
||||
dictionaries: Dictionary[] = [];
|
||||
redaction: AnnotationWrapper;
|
||||
readonly redaction = this.data.redaction;
|
||||
form: FormGroup<{
|
||||
comment: FormControl<string>;
|
||||
dictionary: FormControl<string>;
|
||||
@ -30,21 +27,11 @@ export class ResizeRedactionDialogComponent
|
||||
}>;
|
||||
|
||||
constructor(
|
||||
private readonly _activeDossiersService: ActiveDossiersService,
|
||||
private readonly _iqserPermissionsService: IqserPermissionsService,
|
||||
private readonly _dictionariesMapService: DictionariesMapService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
) {
|
||||
super();
|
||||
this.#dossier = _activeDossiersService.find(this.data.dossierId);
|
||||
this.redaction = this.data.redaction;
|
||||
this.options = getResizeRedactionOptions(
|
||||
this.redaction,
|
||||
this.#dossier,
|
||||
this.#isRss,
|
||||
this.#applyToAllDossiers,
|
||||
this.data.isApprover,
|
||||
);
|
||||
this.options = getResizeRedactionOptions(this.redaction, this.#dossier, false, this.#applyToAllDossiers, this.data.isApprover);
|
||||
this.form = this.#getForm();
|
||||
}
|
||||
|
||||
|
||||
@ -523,15 +523,15 @@ export class FilePreviewScreenComponent
|
||||
|
||||
async #openRedactTextDialog(manualRedactionEntryWrapper: ManualRedactionEntryWrapper) {
|
||||
const file = this.state.file();
|
||||
const hint = manualRedactionEntryWrapper.type === ManualRedactionEntryTypes.HINT;
|
||||
|
||||
const data = this.#getRedactTextDialogData(manualRedactionEntryWrapper, file);
|
||||
const result = await this.#getRedactTextDialog(hint, data).result();
|
||||
const result = await this.#getRedactTextDialog(data).result();
|
||||
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
|
||||
const hint = manualRedactionEntryWrapper.type === ManualRedactionEntryTypes.HINT;
|
||||
const add$ = this._manualRedactionService.addAnnotation([result.redaction], this.dossierId, this.fileId, {
|
||||
hint,
|
||||
dictionaryLabel: result.dictionary?.label,
|
||||
@ -868,10 +868,12 @@ export class FilePreviewScreenComponent
|
||||
}
|
||||
}
|
||||
|
||||
#getRedactTextDialog(hint: boolean, data: RedactTextData) {
|
||||
#getRedactTextDialog(data: RedactTextData) {
|
||||
if (this.#isDocumine) {
|
||||
return this._iqserDialog.openDefault(AddAnnotationDialogComponent, { data });
|
||||
}
|
||||
|
||||
const hint = data.manualRedactionEntryWrapper.type === ManualRedactionEntryTypes.HINT;
|
||||
if (hint) {
|
||||
return this._iqserDialog.openDefault(AddHintDialogComponent, { data });
|
||||
}
|
||||
|
||||
@ -171,14 +171,13 @@ export class AnnotationActionsService {
|
||||
undoDirectAction(annotations: AnnotationWrapper[]) {
|
||||
const { dossierId, fileId } = this._state;
|
||||
const modifyDictionary = annotations[0].isModifyDictionary;
|
||||
this.#processObsAndEmit(
|
||||
this._manualRedactionService.undoRequest(
|
||||
annotations.map(a => a.id),
|
||||
dossierId,
|
||||
fileId,
|
||||
modifyDictionary,
|
||||
),
|
||||
).then();
|
||||
const request$ = this._manualRedactionService.undoRequest(
|
||||
annotations.map(a => a.id),
|
||||
dossierId,
|
||||
fileId,
|
||||
modifyDictionary,
|
||||
);
|
||||
this.#processObsAndEmit(request$).then();
|
||||
}
|
||||
|
||||
async convertRecommendationToAnnotation(recommendations: AnnotationWrapper[]) {
|
||||
@ -194,9 +193,8 @@ export class AnnotationActionsService {
|
||||
this.cancelResize(recommendations[0]).then();
|
||||
}
|
||||
|
||||
return this.#processObsAndEmit(
|
||||
this._manualRedactionService.addRecommendation(recommendations, result.redaction, dossierId, fileId),
|
||||
);
|
||||
const request$ = this._manualRedactionService.addRecommendation(recommendations, result.redaction, dossierId, fileId);
|
||||
return this.#processObsAndEmit(request$);
|
||||
}
|
||||
|
||||
resize(annotationWrapper: AnnotationWrapper) {
|
||||
|
||||
@ -288,6 +288,7 @@ export class PdfProxyService {
|
||||
|
||||
#processSelectedAnnotations(annotations: Annotation[], action: string) {
|
||||
let nextAnnotations: Annotation[];
|
||||
this._pdf.resetAnnotationActions();
|
||||
|
||||
if (action === 'deselected') {
|
||||
this.#cancelResizeIfIsResizing(annotations);
|
||||
@ -295,11 +296,11 @@ export class PdfProxyService {
|
||||
nextAnnotations = this._annotationManager.selected.filter(ann => !annotations.some(a => a.Id === ann.Id));
|
||||
this._pdf.disable(TextPopups.ADD_RECTANGLE);
|
||||
const currentPage = this._pdf.currentPage();
|
||||
|
||||
if (nextAnnotations.some(a => a.getPageNumber() === currentPage)) {
|
||||
this.#configureAnnotationSpecificActions(nextAnnotations);
|
||||
} else {
|
||||
this._pdf.resetAnnotationActions();
|
||||
}
|
||||
|
||||
return nextAnnotations.map(ann => ann.Id);
|
||||
}
|
||||
|
||||
@ -361,8 +362,6 @@ export class PdfProxyService {
|
||||
}
|
||||
|
||||
#configureAnnotationSpecificActions(viewerAnnotations: Annotation[]) {
|
||||
this._pdf.resetAnnotationActions();
|
||||
|
||||
if (!this.canPerformActions()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import { DetailsRadioOption } from '@iqser/common-ui';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { Dossier } from '@red/domain';
|
||||
import { addHintTranslations } from '@translations/add-hint-translations';
|
||||
import { editRedactionTranslations, redactTextTranslations } from '@translations/redact-text-translations';
|
||||
import { Dossier } from '@red/domain';
|
||||
import { removeRedactionTranslations } from '@translations/remove-redaction-translations';
|
||||
import { RemoveRedactionData } from './dialog-types';
|
||||
import { removeAnnotationTranslations } from '@translations/remove-annotation-translations';
|
||||
import { removeRedactionTranslations } from '@translations/remove-redaction-translations';
|
||||
import { resizeRedactionTranslations } from '@translations/resize-redaction-translations';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { RemoveRedactionData } from './dialog-types';
|
||||
|
||||
const PIN_ICON = 'red:push-pin';
|
||||
const FOLDER_ICON = 'red:folder';
|
||||
@ -67,34 +67,41 @@ export const getEditRedactionOptions = (
|
||||
|
||||
export const getRedactOrHintOptions = (
|
||||
dossier: Dossier,
|
||||
isRss: boolean,
|
||||
hint: boolean,
|
||||
applyToAllDossiers: boolean,
|
||||
isApprover: boolean,
|
||||
isRecommendation = false,
|
||||
isHint = false,
|
||||
isRss = false,
|
||||
): DetailsRadioOption<RedactOrHintOption>[] => {
|
||||
const translations = hint ? addHintTranslations : redactTextTranslations;
|
||||
const options: DetailsRadioOption<RedactOrHintOption>[] = [
|
||||
{
|
||||
const translations = isHint ? addHintTranslations : redactTextTranslations;
|
||||
const options: DetailsRadioOption<RedactOrHintOption>[] = [];
|
||||
|
||||
if (!isRecommendation) {
|
||||
options.push({
|
||||
label: translations.onlyHere.label,
|
||||
description: translations.onlyHere.description,
|
||||
icon: PIN_ICON,
|
||||
value: ResizeOptions.ONLY_HERE,
|
||||
},
|
||||
];
|
||||
if (!isRss) {
|
||||
options.push({
|
||||
label: translations.inDossier.label,
|
||||
description: translations.inDossier.description,
|
||||
descriptionParams: { dossierName: dossier.dossierName },
|
||||
icon: FOLDER_ICON,
|
||||
value: ResizeOptions.IN_DOSSIER,
|
||||
extraOption: {
|
||||
label: translations.inDossier.extraOptionLabel,
|
||||
checked: applyToAllDossiers,
|
||||
hidden: !isApprover,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (isRss) {
|
||||
return options;
|
||||
}
|
||||
|
||||
options.push({
|
||||
label: translations.inDossier.label,
|
||||
description: translations.inDossier.description,
|
||||
descriptionParams: { dossierName: dossier.dossierName },
|
||||
icon: FOLDER_ICON,
|
||||
value: ResizeOptions.IN_DOSSIER,
|
||||
extraOption: {
|
||||
label: translations.inDossier.extraOptionLabel,
|
||||
checked: applyToAllDossiers,
|
||||
hidden: !isApprover,
|
||||
},
|
||||
});
|
||||
|
||||
return options;
|
||||
};
|
||||
|
||||
@ -114,23 +121,26 @@ export const getResizeRedactionOptions = (
|
||||
value: RedactOrHintOptions.ONLY_HERE,
|
||||
},
|
||||
];
|
||||
if (!isRss) {
|
||||
const dictBasedType = redaction.isModifyDictionary;
|
||||
options.push({
|
||||
label: translations.inDossier.label,
|
||||
description: translations.inDossier.description,
|
||||
descriptionParams: { dossierName: dossier.dossierName },
|
||||
disabled: !dictBasedType,
|
||||
tooltip: !dictBasedType ? translations.inDossier.tooltip : null,
|
||||
icon: FOLDER_ICON,
|
||||
value: RedactOrHintOptions.IN_DOSSIER,
|
||||
extraOption: {
|
||||
label: translations.inDossier.extraOptionLabel,
|
||||
checked: applyToAllDossiers,
|
||||
hidden: !isApprover,
|
||||
},
|
||||
});
|
||||
|
||||
if (isRss) {
|
||||
return options;
|
||||
}
|
||||
|
||||
const dictBasedType = redaction.isModifyDictionary;
|
||||
options.push({
|
||||
label: translations.inDossier.label,
|
||||
description: translations.inDossier.description,
|
||||
descriptionParams: { dossierName: dossier.dossierName },
|
||||
disabled: !dictBasedType,
|
||||
tooltip: !dictBasedType ? translations.inDossier.tooltip : null,
|
||||
icon: FOLDER_ICON,
|
||||
value: RedactOrHintOptions.IN_DOSSIER,
|
||||
extraOption: {
|
||||
label: translations.inDossier.extraOptionLabel,
|
||||
checked: applyToAllDossiers,
|
||||
hidden: !isApprover,
|
||||
},
|
||||
});
|
||||
return options;
|
||||
};
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ export class REDAnnotationManager {
|
||||
|
||||
get(annotations: List | List<AnnotationWrapper>): Annotation[];
|
||||
|
||||
get(predicate?: (value: Annotation) => boolean): Annotation[];
|
||||
get(predicate?: AnnotationPredicate): Annotation[];
|
||||
|
||||
get(argument?: AnnotationPredicate | List<AnnotationWrapper> | List | AnnotationWrapper | string): Annotation | Annotation[] {
|
||||
if (isStringOrWrapper(argument)) {
|
||||
@ -68,7 +68,16 @@ export class REDAnnotationManager {
|
||||
}
|
||||
|
||||
const isList = argument instanceof Array;
|
||||
return isList ? this.#getByIds(argument) : this.#get(argument);
|
||||
if (isList) {
|
||||
return this.#getByIds(argument);
|
||||
}
|
||||
|
||||
const isNotPredicate = typeof argument !== 'function';
|
||||
if (isNotPredicate) {
|
||||
return this.#getById(argument);
|
||||
}
|
||||
|
||||
return this.#get(argument);
|
||||
}
|
||||
|
||||
deselect(annotation: string | AnnotationWrapper): void;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user