mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-04 16:06:36 +00:00
Remove float value in float form when emptied (#9947)
This commit is contained in:
parent
61c8d23a7e
commit
8565a0d911
@ -32,17 +32,19 @@ export class HaFormFloat extends LitElement implements HaFormElement {
|
|||||||
.autoValidate=${this.schema.required}
|
.autoValidate=${this.schema.required}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
>
|
>
|
||||||
<span suffix="" slot="suffix">${this.suffix}</span>
|
<span suffix slot="suffix">${this.suffix}</span>
|
||||||
</paper-input>
|
</paper-input>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private get _value() {
|
private get _value() {
|
||||||
return this.data || 0;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _valueChanged(ev: Event) {
|
private _valueChanged(ev: Event) {
|
||||||
const value = Number((ev.target as PaperInputElement).value);
|
const value: number | undefined = (ev.target as PaperInputElement).value
|
||||||
|
? Number((ev.target as PaperInputElement).value)
|
||||||
|
: undefined;
|
||||||
if (this._value === value) {
|
if (this._value === value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user