Logbook card: fix height in Panel view (#24745)

* fix height in Panel

* Update src/panels/lovelace/cards/hui-logbook-card.ts

Co-authored-by: Paul Bottein <paul.bottein@gmail.com>

* prettier

---------

Co-authored-by: Paul Bottein <paul.bottein@gmail.com>
This commit is contained in:
ildar170975 2025-03-24 12:43:47 +03:00 committed by GitHub
parent b24f185d62
commit 8dab7c598e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,6 +52,8 @@ export class HuiLogbookCard extends LitElement implements LovelaceCard {
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ attribute: false }) public layout?: string;
@state() private _config?: LogbookCardConfig;
@state() private _time?: HaLogbook["time"];
@ -139,6 +141,13 @@ export class HuiLogbookCard extends LitElement implements LovelaceCard {
resolveEntityIDs(this.hass, targetPickerValue, entities, devices, areas)
);
protected update(changedProperties) {
super.update(changedProperties);
if (changedProperties.has("layout")) {
this.toggleAttribute("ispanel", this.layout === "panel");
}
}
protected updated(changedProperties: PropertyValues) {
super.updated(changedProperties);
if (!this._config || !this.hass) {
@ -214,6 +223,11 @@ export class HuiLogbookCard extends LitElement implements LovelaceCard {
height: 385px;
display: block;
}
:host([ispanel]) .content,
:host([ispanel]) ha-logbook {
height: 100%;
}
`,
];
}