mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-30 12:46:35 +00:00
Fix input number helper (#6988)
This commit is contained in:
parent
92ed14c0e4
commit
3030b8d476
@ -6,9 +6,9 @@ import {
|
|||||||
CSSResult,
|
CSSResult,
|
||||||
customElement,
|
customElement,
|
||||||
html,
|
html,
|
||||||
|
internalProperty,
|
||||||
LitElement,
|
LitElement,
|
||||||
property,
|
property,
|
||||||
internalProperty,
|
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||||
@ -48,12 +48,12 @@ class HaInputNumberForm extends LitElement {
|
|||||||
this._max = item.max ?? 100;
|
this._max = item.max ?? 100;
|
||||||
this._min = item.min ?? 0;
|
this._min = item.min ?? 0;
|
||||||
this._mode = item.mode || "slider";
|
this._mode = item.mode || "slider";
|
||||||
this._step = item.step || 1;
|
this._step = item.step ?? 1;
|
||||||
this._unit_of_measurement = item.unit_of_measurement;
|
this._unit_of_measurement = item.unit_of_measurement;
|
||||||
} else {
|
} else {
|
||||||
this._item = {
|
this._item = {
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 0,
|
max: 100,
|
||||||
};
|
};
|
||||||
this._name = "";
|
this._name = "";
|
||||||
this._icon = "";
|
this._icon = "";
|
||||||
@ -176,8 +176,10 @@ class HaInputNumberForm extends LitElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
const configValue = (ev.target as any).configValue;
|
const target = ev.target as any;
|
||||||
const value = ev.detail.value;
|
const configValue = target.configValue;
|
||||||
|
const value =
|
||||||
|
target.type === "number" ? Number(ev.detail.value) : ev.detail.value;
|
||||||
if (this[`_${configValue}`] === value) {
|
if (this[`_${configValue}`] === value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user