RED-6973 & RED-6382

This commit is contained in:
Nicoleta Panaghiu 2023-08-10 15:54:09 +03:00
parent 6da253d0f8
commit 240f08493c
4 changed files with 20 additions and 15 deletions

View File

@ -1,6 +1,6 @@
<ng-container *ngIf="configService.listingMode$ | async as mode">
<div
(mousedown)="handleControlClick($event)"
(mousedown)="handleClick($event)"
(click)="editFileAttribute($event)"
[ngClass]="{ 'workflow-attribute': mode === 'workflow' }"
class="file-attribute"

View File

@ -19,12 +19,6 @@ import { Debounce } from '@iqser/common-ui/lib/utils';
styleUrls: ['./file-attribute.component.scss'],
})
export class FileAttributeComponent extends BaseFormComponent implements OnDestroy {
@Input() fileAttribute!: IFileAttributeConfig;
@Input() file!: File;
@Input() dossier!: Dossier;
isInEditMode = false;
closedDatepicker = true;
readonly #subscriptions = new Subscription();
readonly #shouldClose = computed(
() =>
@ -36,6 +30,13 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr
!this.fileAttributesService.openAttributeEdits().length,
);
isInEditMode = false;
closedDatepicker = true;
@Input() fileAttribute!: IFileAttributeConfig;
@Input() file!: File;
@Input() dossier!: Dossier;
constructor(
router: Router,
private readonly _toaster: Toaster,
@ -83,10 +84,8 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr
}
}
handleControlClick($event: MouseEvent) {
if ($event.ctrlKey) {
$event.stopPropagation();
}
handleClick($event: MouseEvent) {
$event.stopPropagation();
}
ngOnDestroy() {
@ -158,7 +157,10 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr
});
return this._formBuilder.group(config, {
validators: control =>
!control.get(this.fileAttribute.id)?.value?.trim().length && !this.fileAttributeValue ? { emptyString: true } : null,
(!control.get(this.fileAttribute.id)?.value?.trim().length && !this.fileAttributeValue) ||
control.get(this.fileAttribute.id)?.value === this.fileAttributeValue
? { emptyString: true }
: null,
});
}

View File

@ -23,7 +23,7 @@
</div>
</div>
<div *ngFor="let config of displayedAttributes" class="small-label mt-8 attribute">
<div *ngFor="let config of displayedAttributes; trackBy: trackBy" class="small-label mt-8 attribute">
<redaction-file-attribute [dossier]="dossier" [fileAttribute]="config" [file]="file"></redaction-file-attribute>
</div>

View File

@ -1,7 +1,7 @@
import { ChangeDetectorRef, Component, ElementRef, Input, OnInit, Optional, ViewChild } from '@angular/core';
import { Dossier, File, IFileAttributeConfig } from '@red/domain';
import { HelpModeService } from '@iqser/common-ui';
import { Debounce } from '@iqser/common-ui/lib/utils';
import { Debounce, trackByFactory } from '@iqser/common-ui/lib/utils';
import { FileAttributesService } from '@services/entity-services/file-attributes.service';
@Component({
@ -10,11 +10,14 @@ import { FileAttributesService } from '@services/entity-services/file-attributes
styleUrls: ['./workflow-item.component.scss'],
})
export class WorkflowItemComponent implements OnInit {
width: number;
trackBy = trackByFactory();
@ViewChild('actionsWrapper', { static: true }) private _actionsWrapper: ElementRef;
@Input() file: File;
@Input() dossier: Dossier;
@Input() displayedAttributes: IFileAttributeConfig[];
width: number;
constructor(
readonly fileAttributesService: FileAttributesService,