Use card-tools. Should fix the problems that sometimes nesting with card-modder doesn't work.
This commit is contained in:
parent
7db164aac9
commit
bd7e5a91c1
@ -16,6 +16,8 @@ Get more control over the placement of cards
|
|||||||
|
|
||||||
## Instructions
|
## Instructions
|
||||||
|
|
||||||
|
This card requires [card-tools](https://github.com/thomasloven/lovelace-card-tools) to be installed.
|
||||||
|
|
||||||
This card takes other cards and place them in different layouts.
|
This card takes other cards and place them in different layouts.
|
||||||
|
|
||||||
The card works best if used in a view with `panel: true`.
|
The card works best if used in a view with `panel: true`.
|
||||||
|
@ -26,18 +26,10 @@ class LayoutCard extends Polymer.Element {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
makeCard(config) {
|
|
||||||
let tag = config.type;
|
|
||||||
if(tag.startsWith("custom:"))
|
|
||||||
tag = tag.substr(7);
|
|
||||||
else
|
|
||||||
tag = `hui-${tag}-card`;
|
|
||||||
let card = document.createElement(tag);
|
|
||||||
card.setConfig(config);
|
|
||||||
return card;
|
|
||||||
}
|
|
||||||
|
|
||||||
setConfig(config) {
|
setConfig(config) {
|
||||||
|
if(!window.cardTools) throw new Error(`Can't find card-tools. See https://github.com/thomasloven/lovelace-card-tools`);
|
||||||
|
window.cardTools.checkVersion(0.1);
|
||||||
|
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
||||||
this.colnum = 0;
|
this.colnum = 0;
|
||||||
@ -83,7 +75,7 @@ class LayoutCard extends Polymer.Element {
|
|||||||
|
|
||||||
this._cards = this.config.cards.map((c) => {
|
this._cards = this.config.cards.map((c) => {
|
||||||
if (typeof c === 'string') return c;
|
if (typeof c === 'string') return c;
|
||||||
let el = this.makeCard(c);
|
let el = cardTools.createCard(c);
|
||||||
if (this._hass) el.hass = this._hass;
|
if (this._hass) el.hass = this._hass;
|
||||||
return el;
|
return el;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user