Skip to content

Commit

Permalink
fix: BIM-47711 fixed blur/focus issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jmksm96 committed Apr 22, 2024
1 parent c825125 commit 123390f
Showing 1 changed file with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,21 @@ export class InputNumberComponent extends InputBase<ValueType> {
}

public updateValue(updatedValue: ValueType): void {
this.value$.pipe(take(1)).subscribe((value: ValueType) => {
if (value === updatedValue) {
return;
}

super.updateValue(updatedValue);
});
}

private handleFocusOrBlurEvent(isFocused: boolean, event: FocusEvent): void {
const serializedValue: string = this.convertValue(this.inputElementRef.nativeElement.value);
this.value$
.pipe(
take(1),
filter((value: ValueType) => value !== serializedValue && serializedValue !== DEFAULT_VALUE)
filter((value: ValueType) => value !== updatedValue)
)
.subscribe(() => {
this.updateValue(serializedValue);
this.inputElementRef.nativeElement.value = serializedValue;
this.isFocused$.next(isFocused);
isFocused ? this.focus.emit(event) : this.blur.emit(event);
});
.subscribe(() => super.updateValue(updatedValue));
}

private handleFocusOrBlurEvent(isFocused: boolean, event: FocusEvent): void {
const serializedValue: string = this.convertValue(this.inputElementRef.nativeElement.value);
this.value$.pipe(take(1)).subscribe(() => {
this.updateValue(serializedValue);
this.inputElementRef.nativeElement.value = serializedValue;
this.isFocused$.next(isFocused);
isFocused ? this.focus.emit(event) : this.blur.emit(event);
});
}
}

0 comments on commit 123390f

Please sign in to comment.