feat: tweak error onBlur/touched/untouched behavior (#5292)
This commit is contained in:
parent
a9ab32b476
commit
e13dd1dfef
|
@ -78,15 +78,9 @@ export class BitInputDirective implements BitFormFieldControl {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
private isActive = true;
|
|
||||||
@HostListener("blur")
|
|
||||||
onBlur() {
|
|
||||||
this.isActive = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@HostListener("input")
|
@HostListener("input")
|
||||||
onInput() {
|
onInput() {
|
||||||
this.isActive = false;
|
this.ngControl?.control?.markAsUntouched();
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasError() {
|
get hasError() {
|
||||||
|
@ -97,7 +91,7 @@ export class BitInputDirective implements BitFormFieldControl {
|
||||||
this.ngControl?.errors != null
|
this.ngControl?.errors != null
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return this.ngControl?.status === "INVALID" && this.ngControl?.touched && this.isActive;
|
return this.ngControl?.status === "INVALID" && this.ngControl?.touched;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue