RED-6973: Fix multiple editing.

This commit is contained in:
Nicoleta Panaghiu 2023-07-20 16:11:53 +03:00
parent 32dba8e609
commit 3afabf5a10
4 changed files with 15 additions and 8 deletions

View File

@ -26,14 +26,14 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr
closedDatepicker = true;
readonly #subscriptions = new Subscription();
readonly shouldClose$ = this.fileAttributesService.isEditingFileAttribute$.pipe(
filter(value => value === true),
tap(value => {
if (
value &&
!!this.file &&
!!this.fileAttribute &&
(this.fileAttribute.id !== this.fileAttributesService.openAttributeEdit$.value ||
this.file.fileId !== this.fileAttributesService.fileEdit$.value)
(value &&
!!this.file &&
!!this.fileAttribute &&
(this.fileAttribute.id !== this.fileAttributesService.openAttributeEdit$.value ||
this.file.fileId !== this.fileAttributesService.fileEdit$.value)) ||
!this.fileAttributesService.openAttributeEdits$.value.length
) {
this.close();
}

View File

@ -1,4 +1,4 @@
<div class="workflow-item">
<div class="workflow-item" (mousedown)="fileAttributesService.resetEdit()">
<div class="details-wrapper">
<div class="details">
<div [matTooltip]="file.filename" [routerLink]="file.routerLink" class="filename pointer" matTooltipPosition="above">

View File

@ -1,6 +1,7 @@
import { ChangeDetectorRef, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
import { Dossier, File, IFileAttributeConfig } from '@red/domain';
import { Debounce } from '@iqser/common-ui';
import { FileAttributesService } from '@services/entity-services/file-attributes.service';
@Component({
selector: 'redaction-workflow-item [file] [dossier] [displayedAttributes]',
@ -15,7 +16,7 @@ export class WorkflowItemComponent implements OnInit {
@ViewChild('actionsWrapper', { static: true }) private _actionsWrapper: ElementRef;
constructor(private readonly _changeRef: ChangeDetectorRef) {}
constructor(readonly fileAttributesService: FileAttributesService, private readonly _changeRef: ChangeDetectorRef) {}
ngOnInit(): void {
const _observer = new ResizeObserver((entries: ResizeObserverEntry[]) => {

View File

@ -35,6 +35,12 @@ export class FileAttributesService extends EntitiesService<IFileAttributeConfig,
setFileEdit(fileId: string) {
this.fileEdit$.next(fileId);
}
resetEdit() {
this.openAttributeEdits$.next([]);
this.fileEdit$.next('');
this.openAttributeEdit$.next('');
}
/**
* Get the file attributes that can be used at importing csv.
*/