From ac102dab4ea92980dc7772cad03b999dade61f69 Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Fri, 1 Sep 2023 15:43:27 +0300 Subject: [PATCH] RED-7275: Fixed enter. --- .../components/file-attribute/file-attribute.component.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.ts b/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.ts index 796034632..c1dc6725b 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.ts +++ b/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.ts @@ -80,6 +80,10 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr @HostListener('document:click', ['$event']) clickOutside($event: MouseEvent) { const clickCalendarCell = ($event.target as HTMLElement).classList?.contains('mat-calendar-body-cell-content'); + if (this.isDate) { + this.#focusOnEditInput(); + } + if (this.isInEditMode && this.closedDatepicker && !clickCalendarCell) { this.close(); } @@ -201,7 +205,9 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr #focusOnEditInput(): void { setTimeout(() => { - const input = document.getElementById(this.fileAttribute.id); + const input = document.getElementById(this.fileAttribute.id) as HTMLInputElement; + const end = input.value.length; + input?.setSelectionRange(end, end); input?.focus(); }, 100); }