RED-7340 - Rectangle redactions: Use bulk-local redactions + New dialog design
This commit is contained in:
parent
33ed133f9f
commit
4593b09bf3
@ -170,10 +170,6 @@ export class RectangleAnnotationDialog
|
||||
}
|
||||
|
||||
for (let page = startPage; page <= endPage; page++) {
|
||||
if (page === wrapper.manualRedactionEntry.positions[0].page) {
|
||||
continue;
|
||||
}
|
||||
|
||||
wrapper.manualRedactionEntry.pageNumbers.push(page);
|
||||
}
|
||||
});
|
||||
|
||||
@ -112,7 +112,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
|
||||
readonly redactedTexts = this.data.redactions.map(annotation => annotation.value);
|
||||
form: UntypedFormGroup = this._formBuilder.group({
|
||||
comment: [null],
|
||||
option: [this.defaultOption, validatePageRange()],
|
||||
option: [this.defaultOption, validatePageRange(true)],
|
||||
});
|
||||
|
||||
readonly selectedOption = toSignal(this.form.get('option').valueChanges.pipe(map(value => value.value)));
|
||||
@ -177,6 +177,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
|
||||
}
|
||||
|
||||
save(): void {
|
||||
const optionValue = this.form.controls.option.value.value;
|
||||
const pageNumbers = parseSelectedPageNumbers(
|
||||
this.form.get('option').value.additionalInput?.value,
|
||||
this.data.file,
|
||||
@ -186,7 +187,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
|
||||
|
||||
this.close({
|
||||
...this.form.getRawValue(),
|
||||
bulkLocal: this.form.controls.option.value.value === ResizeOptions.IN_DOCUMENT,
|
||||
bulkLocal: optionValue === ResizeOptions.IN_DOCUMENT || optionValue === RectangleRedactOptions.MULTIPLE_PAGES,
|
||||
pageNumbers,
|
||||
position,
|
||||
});
|
||||
|
||||
@ -596,20 +596,13 @@ export class AnnotationActionsService {
|
||||
): List<IRemoveRedactionRequest> | IBulkLocalRemoveRequest {
|
||||
if (dialogResult.bulkLocal || !!dialogResult.pageNumbers.length) {
|
||||
const redaction = redactions[0];
|
||||
if (redaction.value === NON_READABLE_CONTENT) {
|
||||
return {
|
||||
value: redaction.value,
|
||||
rectangle: true,
|
||||
originTypes: [redaction.entry.type],
|
||||
pageNumbers: dialogResult.pageNumbers,
|
||||
position: dialogResult.position,
|
||||
comment: dialogResult.comment,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
value: redaction.value,
|
||||
rectangle: false,
|
||||
rectangle: redaction.value === NON_READABLE_CONTENT,
|
||||
originTypes: [redaction.entry.type],
|
||||
originLegalBases: [redaction.legalBasis],
|
||||
pageNumbers: dialogResult.pageNumbers,
|
||||
position: dialogResult.position,
|
||||
comment: dialogResult.comment,
|
||||
};
|
||||
}
|
||||
|
||||
@ -65,10 +65,6 @@ export const parseSelectedPageNumbers = (inputValue: string, file: File, annotat
|
||||
}
|
||||
|
||||
for (let page = startPage; page <= endPage; page++) {
|
||||
if (page === annotation.positions[0].page) {
|
||||
continue;
|
||||
}
|
||||
|
||||
pageNumbers.push(page);
|
||||
}
|
||||
});
|
||||
@ -77,12 +73,9 @@ export const parseSelectedPageNumbers = (inputValue: string, file: File, annotat
|
||||
};
|
||||
|
||||
export const parseRectanglePosition = (annotation: AnnotationWrapper) => {
|
||||
if (annotation.AREA) {
|
||||
const position = annotation.positions[0];
|
||||
return {
|
||||
rectangle: [position.topLeft.x, position.topLeft.y, position.width, position.height],
|
||||
pageNumber: position.page,
|
||||
} as IEntityLogEntryPosition;
|
||||
}
|
||||
return null;
|
||||
const position = annotation.positions[0];
|
||||
return {
|
||||
rectangle: [position.topLeft.x, position.topLeft.y, position.width, position.height],
|
||||
pageNumber: position.page,
|
||||
} as IEntityLogEntryPosition;
|
||||
};
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
import { AbstractControl, ValidatorFn } from '@angular/forms';
|
||||
|
||||
export const validatePageRange = (): ValidatorFn => {
|
||||
export const validatePageRange = (allowEmpty = false): ValidatorFn => {
|
||||
return (control: AbstractControl): { [key: string]: any } | null => {
|
||||
const option = control.value;
|
||||
if (option?.additionalInput) {
|
||||
const validRange = /^(\d+(-\d+)?)(,\d+(-\d+)?)*$/.test(option.additionalInput.value);
|
||||
return validRange ? null : { invalidRange: true };
|
||||
const value = option.additionalInput.value;
|
||||
const validRange = /^(\d+(-\d+)?)(,\d+(-\d+)?)*$/.test(value);
|
||||
return validRange || (!value.length && allowEmpty) ? null : { invalidRange: true };
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user