Add timed forced rebuilding. #17
This commit is contained in:
parent
226f86debe
commit
d4acb7de58
@ -165,6 +165,7 @@ cards:
|
|||||||
max_width: <max width>
|
max_width: <max width>
|
||||||
min_height: <min height>
|
min_height: <min height>
|
||||||
ltr: <ltr>
|
ltr: <ltr>
|
||||||
|
rebuild: <rebuild>
|
||||||
cards:
|
cards:
|
||||||
<cards>
|
<cards>
|
||||||
```
|
```
|
||||||
@ -214,6 +215,11 @@ Optional. Default: false
|
|||||||
|
|
||||||
If set to true, columns will be placed right-to-left.
|
If set to true, columns will be placed right-to-left.
|
||||||
|
|
||||||
|
### `<rebuild>`
|
||||||
|
Optional. Default: false
|
||||||
|
|
||||||
|
If set, a rebuild of the layout will be triggered after this many milliseconds. May be useful if your layout looks different after a page reload or when you return to the view, but it will cause your screen to flash once.
|
||||||
|
|
||||||
### `<cards>`
|
### `<cards>`
|
||||||
Required.
|
Required.
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ class LayoutCard extends cardTools.LitElement {
|
|||||||
this.layout = config.layout || 'auto';
|
this.layout = config.layout || 'auto';
|
||||||
this.minCols = config.column_num || 1;
|
this.minCols = config.column_num || 1;
|
||||||
this.maxCols = config.max_columns || 100;
|
this.maxCols = config.max_columns || 100;
|
||||||
this.colWidth = config.column_width || 300;
|
this.colWidth = config.column_width || 400;
|
||||||
this.maxWidth = config.max_width || 500;
|
this.maxWidth = config.max_width || 500;
|
||||||
this.minHeight = config.min_height || 5;
|
this.minHeight = config.min_height || 5;
|
||||||
this.rtl = config.rtl || false;
|
this.rtl = config.rtl || false;
|
||||||
@ -16,6 +16,8 @@ class LayoutCard extends cardTools.LitElement {
|
|||||||
window.addEventListener('resize', () => this.build());
|
window.addEventListener('resize', () => this.build());
|
||||||
window.addEventListener('hass-open-menu', () => setTimeout(() => this.build(), 100));
|
window.addEventListener('hass-open-menu', () => setTimeout(() => this.build(), 100));
|
||||||
window.addEventListener('hass-close-menu', () => setTimeout(() => this.build(), 100));
|
window.addEventListener('hass-close-menu', () => setTimeout(() => this.build(), 100));
|
||||||
|
if(config.rebuild)
|
||||||
|
window.setTimeout(() => this.build(), config.rebuild);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user