Skip to content

Commit

Permalink
Update to use LitElement
Browse files Browse the repository at this point in the history
  • Loading branch information
gadgetchnnel committed Apr 30, 2023
1 parent 2b1e1ff commit 06f7410
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions lovelace-text-input-row.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
class TextInputRow extends Polymer.Element {
const LitElement = Object.getPrototypeOf(customElements.get("ha-panel-lovelace"));
const html = LitElement.prototype.html;
const css = LitElement.prototype.css;

static get template() {
return Polymer.html`
class TextInputRow extends LitElement {

render() {
return html`
<paper-input
label="[[label]]"
value="[[value]]"
minlength="[[minlength]]"
maxlength="[[maxlength]]"
autoValidate="[[pattern]]"
pattern="[[pattern]]"
type="[[mode]]"
on-change="valueChanged"
label="${this.label}"
value="${this.value}"
minlength="${this.minlength}"
maxlength="${this.maxlength}"
autoValidate="${this.pattern}"
pattern="${this.pattern}"
type="${this.mode}"
@change="${this.valueChanged}"
id="textinput"
placeholder=""
></paper-input>
Expand All @@ -27,7 +31,7 @@ class TextInputRow extends Polymer.Element {
}

valueChanged(ev) {
const newValue = this.$.textinput.value;
const newValue = this.shadowRoot.querySelector("#textinput").value;
const param = {
entity_id: this._config.entity,
value: newValue,
Expand Down

0 comments on commit 06f7410

Please sign in to comment.