From ca5622180ca189ad4c1256ab5b86a07dd618193d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kov=C3=A1=C4=8Dik?= <kovacik@netgrif.com>
Date: Fri, 5 Apr 2024 12:12:56 +0200
Subject: [PATCH 1/2] [NAE-1960] Enumeration Map does not propagate changes
 when selecting "---" value  - fix the problem with null value on enum and
 autocomplete enum  - fix the scrollbar of filelist field  - fix the scrollbar
 on i18n field

---
 .../abstract-user-default-field.component.ts                 | 2 +-
 .../src/lib/task-content/services/field-converter.service.ts | 5 ++++-
 .../src/lib/task/services/task-data.service.ts               | 2 +-
 .../file-list-default-field.component.html                   | 1 +
 .../file-list-default-field.component.scss                   | 5 +++++
 .../i18n-text-field/i18n-text-field.component.scss           | 1 +
 6 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/projects/netgrif-components-core/src/lib/data-fields/user-field/user-default-field/abstract-user-default-field.component.ts b/projects/netgrif-components-core/src/lib/data-fields/user-field/user-default-field/abstract-user-default-field.component.ts
index dc2a7e1b4..5a62b55a1 100644
--- a/projects/netgrif-components-core/src/lib/data-fields/user-field/user-default-field/abstract-user-default-field.component.ts
+++ b/projects/netgrif-components-core/src/lib/data-fields/user-field/user-default-field/abstract-user-default-field.component.ts
@@ -60,7 +60,7 @@ export abstract class AbstractUserDefaultFieldComponent extends AbstractBaseData
     }
 
     public deleteUser() {
-        this.dataField.value = undefined;
+        this.dataField.value = null;
     }
 
     public getCutProperty(i18nLabel): string {
diff --git a/projects/netgrif-components-core/src/lib/task-content/services/field-converter.service.ts b/projects/netgrif-components-core/src/lib/task-content/services/field-converter.service.ts
index 30bead05b..aec119d6e 100644
--- a/projects/netgrif-components-core/src/lib/task-content/services/field-converter.service.ts
+++ b/projects/netgrif-components-core/src/lib/task-content/services/field-converter.service.ts
@@ -163,7 +163,10 @@ export class FieldConverterService {
         if (this.resolveType(field) === FieldTypeResource.TEXT && field.component && field.component.name === 'password') {
             return encodeBase64(value);
         }
-        if (value === undefined || value === null) {
+        if (value === null) {
+            return null;
+        }
+        if (value === undefined) {
             return;
         }
         if (this.resolveType(field) === FieldTypeResource.DATE) {
diff --git a/projects/netgrif-components-core/src/lib/task/services/task-data.service.ts b/projects/netgrif-components-core/src/lib/task/services/task-data.service.ts
index b34013884..73b3b00af 100644
--- a/projects/netgrif-components-core/src/lib/task/services/task-data.service.ts
+++ b/projects/netgrif-components-core/src/lib/task/services/task-data.service.ts
@@ -348,7 +348,7 @@ export class TaskDataService extends TaskHandlingService implements OnDestroy {
     }
 
     protected isAutocompleteEnumException(field: DataField<unknown>): boolean{
-        return (field instanceof EnumerationField) && (field.getComponentType() === 'autocomplete') && !field.valid;
+        return (field instanceof EnumerationField) && (field.getComponentType() === 'autocomplete') && !(field.valid || field.value === null);
     }
 
     /**
diff --git a/projects/netgrif-components/src/lib/data-fields/file-list-field/file-list-default-field/file-list-default-field.component.html b/projects/netgrif-components/src/lib/data-fields/file-list-field/file-list-default-field/file-list-default-field.component.html
index c98986c56..49158098b 100644
--- a/projects/netgrif-components/src/lib/data-fields/file-list-field/file-list-default-field/file-list-default-field.component.html
+++ b/projects/netgrif-components/src/lib/data-fields/file-list-field/file-list-default-field/file-list-default-field.component.html
@@ -10,6 +10,7 @@
                     'clip-path': getCutProperty(fileLabel)
             }">
         <button mat-icon-button matPrefix
+                class="file-button-size"
                 [disabled]="formControlRef.disabled"
                 color="primary"
                 (click)="chooseFile()"
diff --git a/projects/netgrif-components/src/lib/data-fields/file-list-field/file-list-default-field/file-list-default-field.component.scss b/projects/netgrif-components/src/lib/data-fields/file-list-field/file-list-default-field/file-list-default-field.component.scss
index c2294c350..64aa7a338 100644
--- a/projects/netgrif-components/src/lib/data-fields/file-list-field/file-list-default-field/file-list-default-field.component.scss
+++ b/projects/netgrif-components/src/lib/data-fields/file-list-field/file-list-default-field/file-list-default-field.component.scss
@@ -109,3 +109,8 @@
     padding-bottom: 13px;
     position: relative;
 }
+
+.file-button-size {
+    height: 38px;
+    width: 38px;
+}
diff --git a/projects/netgrif-components/src/lib/data-fields/i18n-field/i18n-text-field/i18n-text-field.component.scss b/projects/netgrif-components/src/lib/data-fields/i18n-field/i18n-text-field/i18n-text-field.component.scss
index 4f80a9f60..63556224b 100644
--- a/projects/netgrif-components/src/lib/data-fields/i18n-field/i18n-text-field/i18n-text-field.component.scss
+++ b/projects/netgrif-components/src/lib/data-fields/i18n-field/i18n-text-field/i18n-text-field.component.scss
@@ -48,6 +48,7 @@
 .i18n-hint-error {
     padding: 0 1em;
     font-size: 75%;
+    width: auto !important;
 }
 
 .language-svg-wrapper {

From 2c35f2357c52a42bb875e977ab59204c4f597630 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kov=C3=A1=C4=8Dik?= <kovacik@netgrif.com>
Date: Fri, 5 Apr 2024 13:37:58 +0200
Subject: [PATCH 2/2] [NAE-1960] Enumeration Map does not propagate changes
 when selecting "---" value  - fix test

---
 .../lib/task-content/services/field-converter.service.spec.ts   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/projects/netgrif-components-core/src/lib/task-content/services/field-converter.service.spec.ts b/projects/netgrif-components-core/src/lib/task-content/services/field-converter.service.spec.ts
index 4c1ae1f4f..7b85e07da 100644
--- a/projects/netgrif-components-core/src/lib/task-content/services/field-converter.service.spec.ts
+++ b/projects/netgrif-components-core/src/lib/task-content/services/field-converter.service.spec.ts
@@ -52,7 +52,7 @@ describe('FieldConvertorService', () => {
 
         const date = moment();
         dataField.type = FieldTypeResource.DATE;
-        expect(service.formatValueForBackend(service.toClass(dataField), null)).toEqual(undefined);
+        expect(service.formatValueForBackend(service.toClass(dataField), null)).toEqual(null);
         expect(service.formatValueForBackend(service.toClass(dataField), date))
             .toEqual(date.format('YYYY-MM-DD'));
 
