Skip to content

Commit 3f50715

Browse files
authored
fix update cps-autocomplete component value (#408)
1 parent b9ba987 commit 3f50715

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

projects/cps-ui-kit/src/lib/components/cps-autocomplete/cps-autocomplete.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,8 @@ export class CpsAutocompleteComponent
651651

652652
onBlur() {
653653
if (!this.isOpened) {
654-
this._closeAndClear();
654+
this._confirmInput(this.inputText || '', false);
655655
}
656-
657656
this._checkErrors();
658657
this.blurred.emit();
659658
}
@@ -971,7 +970,10 @@ export class CpsAutocompleteComponent
971970
searchVal = searchVal.toLowerCase();
972971
if (!searchVal) {
973972
if (this.multiple) return;
974-
this.updateValue(this._getEmptyValue());
973+
// Only reset the value if the inputText was changed by the user
974+
if (this.inputText !== this._getValueLabel()) {
975+
this.updateValue(this._getEmptyValue());
976+
}
975977
this.cdRef.detectChanges();
976978
this._closeAndClear();
977979
return;

0 commit comments

Comments
 (0)