mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 18:56:39 +00:00
Add support for panels to cast (#3796)
* Add panel support to cast * Set background
This commit is contained in:
parent
a1b9a092d0
commit
2fe4a02b6b
@ -9,6 +9,7 @@ import {
|
|||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { LovelaceConfig } from "../../../../src/data/lovelace";
|
import { LovelaceConfig } from "../../../../src/data/lovelace";
|
||||||
import "../../../../src/panels/lovelace/views/hui-view";
|
import "../../../../src/panels/lovelace/views/hui-view";
|
||||||
|
import "../../../../src/panels/lovelace/views/hui-panel-view";
|
||||||
import { HomeAssistant } from "../../../../src/types";
|
import { HomeAssistant } from "../../../../src/types";
|
||||||
import { Lovelace } from "../../../../src/panels/lovelace/types";
|
import { Lovelace } from "../../../../src/panels/lovelace/types";
|
||||||
import "./hc-launch-screen";
|
import "./hc-launch-screen";
|
||||||
@ -40,14 +41,21 @@ class HcLovelace extends LitElement {
|
|||||||
saveConfig: async () => undefined,
|
saveConfig: async () => undefined,
|
||||||
setEditMode: () => undefined,
|
setEditMode: () => undefined,
|
||||||
};
|
};
|
||||||
return html`
|
return this.lovelaceConfig.views[index].panel
|
||||||
<hui-view
|
? html`
|
||||||
.hass=${this.hass}
|
<hui-panel-view
|
||||||
.lovelace=${lovelace}
|
.hass=${this.hass}
|
||||||
.index=${index}
|
.config=${this.lovelaceConfig.views[index]}
|
||||||
columns="2"
|
></hui-panel-view>
|
||||||
></hui-view>
|
`
|
||||||
`;
|
: html`
|
||||||
|
<hui-view
|
||||||
|
.hass=${this.hass}
|
||||||
|
.lovelace=${lovelace}
|
||||||
|
.index=${index}
|
||||||
|
columns="2"
|
||||||
|
></hui-view>
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected updated(changedProps) {
|
protected updated(changedProps) {
|
||||||
@ -62,7 +70,9 @@ class HcLovelace extends LitElement {
|
|||||||
this.lovelaceConfig.background;
|
this.lovelaceConfig.background;
|
||||||
|
|
||||||
if (configBackground) {
|
if (configBackground) {
|
||||||
this.shadowRoot!.querySelector("hui-view")!.style.setProperty(
|
(this.shadowRoot!.querySelector(
|
||||||
|
"hui-view, hui-panel-view"
|
||||||
|
) as HTMLElement)!.style.setProperty(
|
||||||
"--lovelace-background",
|
"--lovelace-background",
|
||||||
configBackground
|
configBackground
|
||||||
);
|
);
|
||||||
@ -94,7 +104,7 @@ class HcLovelace extends LitElement {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background: var(--primary-background-color);
|
background: var(--primary-background-color);
|
||||||
}
|
}
|
||||||
hui-view {
|
:host > * {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user