Lovelace alarm panel respects the code_format attribute on the alarm entity (#2379)

This commit is contained in:
Emil Stjerneman 2019-01-03 23:09:07 +01:00 committed by Paulus Schoutsen
parent 38a2627227
commit adf0c6d891

View File

@ -138,32 +138,46 @@ class HuiAlarmPanelCard extends hassLocalizeLitMixin(LitElement)
}) })
} }
</div> </div>
<paper-input ${
label="Alarm Code" !stateObj.attributes.code_format
type="password" ? html``
.value="${this._code}" : html`
></paper-input> <paper-input
<div id="keypad"> label="Alarm Code"
${ type="password"
BUTTONS.map((value) => { .value="${this._code}"
return value === "" ></paper-input>
? html` `
<paper-button disabled></paper-button> }
` ${
: html` stateObj.attributes.code_format !== "Number"
<paper-button ? html``
noink : html`
raised <div id="keypad">
.value="${value}" ${
@click="${this._handlePadClick}" BUTTONS.map((value) => {
>${ return value === ""
value === "clear" ? this._label("clear_code") : value ? html`
}</paper-button <paper-button disabled></paper-button>
> `
`; : html`
}) <paper-button
} noink
</div> raised
.value="${value}"
@click="${this._handlePadClick}"
>${
value === "clear"
? this._label("clear_code")
: value
}</paper-button
>
`;
})
}
</div>
`
}
</ha-card> </ha-card>
`; `;
} }