fix hui-panel-view for a "warning_multiple_cards" (#25899)

This commit is contained in:
ildar170975 2025-06-25 18:20:14 +03:00 committed by GitHub
parent 93df473ad2
commit 6006e926a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,8 +10,8 @@ import type { LovelaceViewConfig } from "../../../data/lovelace/config/view";
import type { HomeAssistant } from "../../../types";
import type { HuiCard } from "../cards/hui-card";
import type { HuiCardOptions } from "../components/hui-card-options";
import type { HuiWarning } from "../components/hui-warning";
import type { Lovelace } from "../types";
import "../../../components/ha-alert";
let editCodeLoaded = false;
@ -26,7 +26,7 @@ export class PanelView extends LitElement implements LovelaceViewElement {
@property({ attribute: false }) public cards: HuiCard[] = [];
@state() private _card?: HuiCard | HuiWarning | HuiCardOptions;
@state() private _card?: HuiCard | HuiCardOptions;
// eslint-disable-next-line @typescript-eslint/no-empty-function
public setConfig(_config: LovelaceViewConfig): void {}
@ -63,11 +63,11 @@ export class PanelView extends LitElement implements LovelaceViewElement {
protected render(): TemplateResult {
return html`
${this.cards!.length > 1
? html`<hui-warning .hass=${this.hass}>
${this.hass!.localize(
? html`<ha-alert alert-type="warning"
>${this.hass!.localize(
"ui.panel.lovelace.editor.view.panel_mode.warning_multiple_cards"
)}
</hui-warning>`
)}</ha-alert
>`
: ""}
${this._card}
${this.lovelace?.editMode && this.cards.length === 0