mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix suffix in zwave config panel, send config on change instead of input (#15779)
This commit is contained in:
parent
3abc5c42d0
commit
1bc7bb0169
@ -18,7 +18,6 @@ import {
|
|||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { debounce } from "../../../../../common/util/debounce";
|
|
||||||
import "../../../../../components/ha-alert";
|
import "../../../../../components/ha-alert";
|
||||||
import "../../../../../components/ha-card";
|
import "../../../../../components/ha-card";
|
||||||
import "../../../../../components/ha-icon-next";
|
import "../../../../../components/ha-icon-next";
|
||||||
@ -210,7 +209,7 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
</em>`
|
</em>`
|
||||||
: ""}
|
: ""}
|
||||||
${result?.status
|
${result?.status
|
||||||
? html` <p
|
? html`<p
|
||||||
class="result ${classMap({
|
class="result ${classMap({
|
||||||
[result.status]: true,
|
[result.status]: true,
|
||||||
})}"
|
})}"
|
||||||
@ -264,11 +263,9 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
.propertyKey=${item.property_key}
|
.propertyKey=${item.property_key}
|
||||||
.key=${id}
|
.key=${id}
|
||||||
.disabled=${!item.metadata.writeable}
|
.disabled=${!item.metadata.writeable}
|
||||||
@input=${this._numericInputChanged}
|
@change=${this._numericInputChanged}
|
||||||
|
.suffix=${item.metadata.unit}
|
||||||
>
|
>
|
||||||
${item.metadata.unit
|
|
||||||
? html`<span slot="suffix">${item.metadata.unit}</span>`
|
|
||||||
: ""}
|
|
||||||
</ha-textfield>`;
|
</ha-textfield>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,12 +337,6 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
this._updateConfigParameter(ev.target, Number(ev.target.value));
|
this._updateConfigParameter(ev.target, Number(ev.target.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
private debouncedUpdate = debounce((target, value) => {
|
|
||||||
this._config![target.key].value = value;
|
|
||||||
|
|
||||||
this._updateConfigParameter(target, value);
|
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
private _numericInputChanged(ev) {
|
private _numericInputChanged(ev) {
|
||||||
if (ev.target === undefined || this._config![ev.target.key] === undefined) {
|
if (ev.target === undefined || this._config![ev.target.key] === undefined) {
|
||||||
return;
|
return;
|
||||||
@ -355,7 +346,7 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setResult(ev.target.key, undefined);
|
this.setResult(ev.target.key, undefined);
|
||||||
this.debouncedUpdate(ev.target, value);
|
this._updateConfigParameter(ev.target, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _updateConfigParameter(target, value) {
|
private async _updateConfigParameter(target, value) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user