From 48c31e47b9743baedc64424d69130430fd41e1e7 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 14 Jan 2026 12:59:23 +0200 Subject: [PATCH 1/3] UI: Fixed autofill country autocomplete and improved validation --- ui-ngx/src/app/core/utils.ts | 14 ++++++- .../country-autocomplete.component.html | 13 ++++++- .../country-autocomplete.component.scss | 27 +++++++++++++ .../country-autocomplete.component.ts | 39 ++++++++++++++++--- .../assets/locale/locale.constant-en_US.json | 1 + 5 files changed, 85 insertions(+), 9 deletions(-) create mode 100644 ui-ngx/src/app/shared/components/country-autocomplete.component.scss diff --git a/ui-ngx/src/app/core/utils.ts b/ui-ngx/src/app/core/utils.ts index f1a0671a52..e0665d4eb1 100644 --- a/ui-ngx/src/app/core/utils.ts +++ b/ui-ngx/src/app/core/utils.ts @@ -27,13 +27,14 @@ import { serverErrorCodesTranslations } from '@shared/models/constants'; import { SubscriptionEntityInfo } from '@core/api/widget-api.models'; import { CompiledTbFunction, - compileTbFunction, GenericFunction, + compileTbFunction, + GenericFunction, isNotEmptyTbFunction, TbFunction } from '@shared/models/js-function.models'; import { DomSanitizer } from '@angular/platform-browser'; import { SecurityContext } from '@angular/core'; -import { AbstractControl, ValidationErrors, Validators } from '@angular/forms'; +import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms'; const varsRegex = /\${([^}]*)}/g; const emailRegex = /^[A-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i; @@ -998,3 +999,12 @@ export const validateEmail = (control: AbstractControl): ValidationErrors | null return emailRegex.test(control.value) ? null : {email: true}; }; +export const requireMatch = (): ValidatorFn => { + return (control: AbstractControl): ValidationErrors | null => { + const value = control.value; + if (value && typeof value === 'string') { + return { requireMatch: { value: value } }; + } + return null; + }; +} diff --git a/ui-ngx/src/app/shared/components/country-autocomplete.component.html b/ui-ngx/src/app/shared/components/country-autocomplete.component.html index 9b3857cafb..61a874431a 100644 --- a/ui-ngx/src/app/shared/components/country-autocomplete.component.html +++ b/ui-ngx/src/app/shared/components/country-autocomplete.component.html @@ -15,13 +15,19 @@ limitations under the License. --> - + {{ labelText }} + @if (countryFormGroup.get('country').value?.flag) { + + {{ countryFormGroup.get('country').value.flag }} + + }