Skip to content

Commit

Permalink
NAS-133431: PR update
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKarpov98 committed Jan 8, 2025
1 parent 193d2b7 commit d58bce1
Showing 1 changed file with 2 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export class IxInputComponent implements ControlValueAccessor, OnInit, OnChanges
showPassword = false;
invalid = false;
filteredOptions: Option[];
private lastKnownValue: string | number = this._value;

onChange: (value: string | number) => void = (): void => {};
onTouch: () => void = (): void => {};
Expand Down Expand Up @@ -118,10 +117,6 @@ export class IxInputComponent implements ControlValueAccessor, OnInit, OnChanges
set value(val: string | number) {
if (this.type() === 'number') {
this._value = (val || val === 0) ? Number(val) : null;

if (this._value === null) {
this.lastKnownValue = val;
}
return;
}
this._value = val;
Expand Down Expand Up @@ -156,17 +151,8 @@ export class IxInputComponent implements ControlValueAccessor, OnInit, OnChanges
});
}

registerOnChange(onChange: (value: string | number) => void): void {
this.onChange = (changedValue) => {
if (this.lastKnownValue !== changedValue) {
onChange(changedValue);
}

this.controlDirective.control.markAsTouched();
this.controlDirective.control.updateValueAndValidity();

this.lastKnownValue = changedValue;
};
registerOnChange(onChanged: () => void): void {
this.onChange = onChanged;
}

registerOnTouched(onTouched: () => void): void {
Expand Down Expand Up @@ -234,11 +220,6 @@ export class IxInputComponent implements ControlValueAccessor, OnInit, OnChanges
}
}

if (this.value !== this.lastKnownValue) {
this.lastKnownValue = this.value;
this.onChange(this.value);
}

if (this.autocompleteOptions() && !this.findExistingOption(this.value)) {
this.writeValue('');
this.onChange('');
Expand Down

0 comments on commit d58bce1

Please sign in to comment.