Adds clear value handler (#4205)

* Adds clear value handler

* Add the same to device picker
This commit is contained in:
Joakim Sørensen 2019-11-10 19:23:27 +01:00 committed by Bram Kragten
parent 4f41508110
commit 9e2a0c77d5
2 changed files with 10 additions and 0 deletions

View File

@ -164,6 +164,7 @@ class HaDevicePicker extends SubscribeMixin(LitElement) {
slot="suffix"
class="clear-button"
icon="hass:close"
@click=${this._clearValue}
no-ripple
>
Clear
@ -189,6 +190,10 @@ class HaDevicePicker extends SubscribeMixin(LitElement) {
`;
}
private _clearValue() {
this.value = "";
}
private get _value() {
return this.value || "";
}

View File

@ -166,6 +166,7 @@ class HaEntityPicker extends LitElement {
slot="suffix"
class="clear-button"
icon="hass:close"
@click=${this._clearValue}
no-ripple
>
Clear
@ -191,6 +192,10 @@ class HaEntityPicker extends LitElement {
`;
}
private _clearValue() {
this.value = "";
}
private get _value() {
return this.value || "";
}