From dab4ead433b80e7469b1a3f8e50d216283872a07 Mon Sep 17 00:00:00 2001 From: Alex Karpov Date: Wed, 20 Nov 2024 13:43:20 +0200 Subject: [PATCH] NAS-131841: ACL Editor Group/User Search Bug (cherry picked from commit db3cfed40fbc41a4a14ad490b681b8f1bf71a11c) --- .../ix-combobox/ix-combobox.component.html | 2 +- .../ix-combobox/ix-combobox.component.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/app/modules/forms/ix-forms/components/ix-combobox/ix-combobox.component.html b/src/app/modules/forms/ix-forms/components/ix-combobox/ix-combobox.component.html index 37a2e9c369b..e0bf9d9703b 100644 --- a/src/app/modules/forms/ix-forms/components/ix-combobox/ix-combobox.component.html +++ b/src/app/modules/forms/ix-forms/components/ix-combobox/ix-combobox.component.html @@ -20,7 +20,7 @@ [ixTest]="controlDirective.name" [class.has-value]="selectedOption?.label || textContent" (input)="onChanged(ixInput.value)" - (blur)="onTouch()" + (blur)="inputBlurred()" /> @if (loading) { diff --git a/src/app/modules/forms/ix-forms/components/ix-combobox/ix-combobox.component.ts b/src/app/modules/forms/ix-forms/components/ix-combobox/ix-combobox.component.ts index b38f51ac701..ae7a4ae2dc5 100644 --- a/src/app/modules/forms/ix-forms/components/ix-combobox/ix-combobox.component.ts +++ b/src/app/modules/forms/ix-forms/components/ix-combobox/ix-combobox.component.ts @@ -74,10 +74,6 @@ export class IxComboboxComponent implements ControlValueAccessor, OnInit { if (this.value && this.options?.length) { this.selectedOption = { ...(this.options.find((option: Option) => option.value === this.value)) }; } - if (this.selectedOption) { - this.filterChanged$.next(''); - } - this.cdr.markForCheck(); } @@ -101,6 +97,14 @@ export class IxComboboxComponent implements ControlValueAccessor, OnInit { this.filterChanged$.next(''); } + inputBlurred(): void { + this.onTouch(); + + if (!this.allowCustomValue && !this.selectedOption) { + this.resetInput(); + } + } + filterOptions(filterValue: string): void { this.loading = true; this.cdr.markForCheck(); @@ -124,10 +128,6 @@ export class IxComboboxComponent implements ControlValueAccessor, OnInit { this.selectedOption = selectedOptionFromValue ? { ...selectedOptionFromValue } : { label: this.value as string, value: this.value }; - - if (this.selectedOption.value) { - this.filterChanged$.next(''); - } } this.loading = false; @@ -193,7 +193,7 @@ export class IxComboboxComponent implements ControlValueAccessor, OnInit { } onChanged(changedValue: string): void { - if (this.selectedOption || this.value) { + if (this.selectedOption?.value || this.value) { this.resetInput(); } this.textContent = changedValue;