mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Add panel mode (#1383)
This commit is contained in:
parent
66ae61374d
commit
66803cd4eb
@ -20,6 +20,8 @@ import '../../components/ha-start-voice-button.js';
|
|||||||
import { loadModule, loadJS } from '../../common/dom/load_resource.js';
|
import { loadModule, loadJS } from '../../common/dom/load_resource.js';
|
||||||
import './hui-view.js';
|
import './hui-view.js';
|
||||||
|
|
||||||
|
import createCardElement from './common/create-card-element.js';
|
||||||
|
|
||||||
// JS should only be imported once. Modules and HTML are safe.
|
// JS should only be imported once. Modules and HTML are safe.
|
||||||
const JS_CACHE = {};
|
const JS_CACHE = {};
|
||||||
|
|
||||||
@ -163,12 +165,20 @@ class HUIRoot extends NavigateMixin(EventsMixin(PolymerElement)) {
|
|||||||
if (root.lastChild) {
|
if (root.lastChild) {
|
||||||
root.removeChild(root.lastChild);
|
root.removeChild(root.lastChild);
|
||||||
}
|
}
|
||||||
const view = document.createElement('hui-view');
|
|
||||||
view.setProperties({
|
const viewConfig = this.config.views[this._curView];
|
||||||
hass: this.hass,
|
|
||||||
config: this.config.views[this._curView],
|
let view;
|
||||||
columns: this.columns,
|
|
||||||
});
|
if (viewConfig.panel) {
|
||||||
|
view = createCardElement(viewConfig.cards[0]);
|
||||||
|
} else {
|
||||||
|
view = document.createElement('hui-view');
|
||||||
|
view.config = viewConfig;
|
||||||
|
view.columns = this.columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
view.hass = this.hass;
|
||||||
root.appendChild(view);
|
root.appendChild(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user