Use new functions of cardTools

This commit is contained in:
Thomas Lovén 2019-03-21 01:21:18 +01:00
parent 6d11d3cc65
commit ba95882408

View File

@ -1,5 +1,5 @@
customElements.whenDefined('card-tools').then(() => { customElements.whenDefined('card-tools').then(() => {
class FoldEntityRow extends cardTools.litElement() { class FoldEntityRow extends cardTools.LitElement {
static get properties() { static get properties() {
return { return {
@ -8,7 +8,7 @@ class FoldEntityRow extends cardTools.litElement() {
} }
render() { render() {
return cardTools.litHtml()` return cardTools.LitHtml`
${this._renderStyle()} ${this._renderStyle()}
<div id=head> <div id=head>
<div id=entity> <div id=entity>
@ -25,7 +25,7 @@ class FoldEntityRow extends cardTools.litElement() {
} }
_renderStyle() { _renderStyle() {
return cardTools.litHtml()` return cardTools.LitHtml`
<style> <style>
#items { #items {
padding: 0 0 0 40px; padding: 0 0 0 40px;
@ -101,7 +101,7 @@ class FoldEntityRow extends cardTools.litElement() {
_renderItem(conf, options) { _renderItem(conf, options) {
const element = this._renderElement(conf, options); const element = this._renderElement(conf, options);
return cardTools.litHtml()`<div> ${element} </div>`; return cardTools.LitHtml`<div> ${element} </div>`;
} }
setConfig(config) { setConfig(config) {
@ -119,7 +119,7 @@ class FoldEntityRow extends cardTools.litElement() {
if (config.entities) if (config.entities)
items = config.entities; items = config.entities;
if (head && head.split('.')[0] === "group") if (head && head.split('.')[0] === "group")
items = cardTools.hass().states[head].attributes.entity_id; items = cardTools.hass.states[head].attributes.entity_id;
if(items) if(items)
this._entities = items.map((e) => this._renderItem(e, config.group_config)); this._entities = items.map((e) => this._renderItem(e, config.group_config));