Fix input number helper (#6988)

This commit is contained in:
Bram Kragten 2020-09-14 17:00:56 +02:00 committed by GitHub
parent 92ed14c0e4
commit 3030b8d476
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,9 +6,9 @@ import {
CSSResult,
customElement,
html,
internalProperty,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { fireEvent } from "../../../../common/dom/fire_event";
@ -48,12 +48,12 @@ class HaInputNumberForm extends LitElement {
this._max = item.max ?? 100;
this._min = item.min ?? 0;
this._mode = item.mode || "slider";
this._step = item.step || 1;
this._step = item.step ?? 1;
this._unit_of_measurement = item.unit_of_measurement;
} else {
this._item = {
min: 0,
max: 0,
max: 100,
};
this._name = "";
this._icon = "";
@ -176,8 +176,10 @@ class HaInputNumberForm extends LitElement {
return;
}
ev.stopPropagation();
const configValue = (ev.target as any).configValue;
const value = ev.detail.value;
const target = ev.target as any;
const configValue = target.configValue;
const value =
target.type === "number" ? Number(ev.detail.value) : ev.detail.value;
if (this[`_${configValue}`] === value) {
return;
}