1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 02:38:53 +00:00

Exclude conditional elements

This commit is contained in:
Petar Petrov
2025-12-18 17:05:54 +02:00
parent 5c9e052030
commit bb36e4aa42
2 changed files with 7 additions and 3 deletions

View File

@@ -78,7 +78,8 @@ export class HuiPictureElementsCardEditor
private _handlePositionClick(x: number, y: number): void { private _handlePositionClick(x: number, y: number): void {
if ( if (
!this._subElementEditorConfig?.elementConfig || !this._subElementEditorConfig?.elementConfig ||
this._subElementEditorConfig.type !== "element" this._subElementEditorConfig.type !== "element" ||
this._subElementEditorConfig.elementConfig.type === "conditional"
) { ) {
return; return;
} }
@@ -178,7 +179,8 @@ export class HuiPictureElementsCardEditor
if (this._subElementEditorConfig) { if (this._subElementEditorConfig) {
return html` return html`
${this._subElementEditorConfig.type === "element" ${this._subElementEditorConfig.type === "element" &&
this._subElementEditorConfig.elementConfig?.type !== "conditional"
? html` ? html`
<ha-alert alert-type="info"> <ha-alert alert-type="info">
${this.hass.localize( ${this.hass.localize(

View File

@@ -10,7 +10,9 @@ export const getElementStubConfig = async (
): Promise<LovelaceElementConfig> => { ): Promise<LovelaceElementConfig> => {
let elementConfig: LovelaceElementConfig = { type }; let elementConfig: LovelaceElementConfig = { type };
if (type !== "conditional") { if (type === "conditional") {
elementConfig = { type, conditions: [], elements: [] };
} else {
elementConfig.style = { left: "50%", top: "50%" }; elementConfig.style = { left: "50%", top: "50%" };
} }