mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Support typing negative values for ha-form-float (#13940)
This commit is contained in:
parent
200fff506c
commit
952b433b2c
@ -26,6 +26,7 @@ export class HaFormFloat extends LitElement implements HaFormElement {
|
|||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<ha-textfield
|
<ha-textfield
|
||||||
|
type="numeric"
|
||||||
inputMode="decimal"
|
inputMode="decimal"
|
||||||
.label=${this.label}
|
.label=${this.label}
|
||||||
.value=${this.data !== undefined ? this.data : ""}
|
.value=${this.data !== undefined ? this.data : ""}
|
||||||
@ -55,6 +56,11 @@ export class HaFormFloat extends LitElement implements HaFormElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allow user to start typing a negative value
|
||||||
|
if (rawValue === "-") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (rawValue !== "") {
|
if (rawValue !== "") {
|
||||||
value = parseFloat(rawValue);
|
value = parseFloat(rawValue);
|
||||||
if (isNaN(value)) {
|
if (isNaN(value)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user