Enable full day event mode in calendar card day grid (#14716)

This commit is contained in:
Philip Allgaier 2022-12-12 15:48:26 +01:00 committed by GitHub
parent d74fb8717c
commit b939978de1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -234,6 +234,10 @@ export class HAFullCalendar extends LitElement {
this._fireViewChanged();
}
if (changedProps.has("eventDisplay")) {
this.calendar!.setOption("eventDisplay", this.eventDisplay);
}
const oldHass = changedProps.get("hass") as HomeAssistant;
if (oldHass && oldHass.language !== this.hass.language) {
@ -322,6 +326,7 @@ export class HAFullCalendar extends LitElement {
this._activeView = "dayGridDay";
this.calendar!.changeView("dayGridDay");
this.calendar!.gotoDate(info.dateStr);
this._fireViewChanged();
}
private _handleNext(): void {

View File

@ -66,6 +66,8 @@ export class HuiCalendarCard extends LitElement implements LovelaceCard {
@state() private _calendars: Calendar[] = [];
@state() private _eventDisplay = "list-item";
@state() private _narrow = false;
@state() private _veryNarrow = false;
@ -134,7 +136,7 @@ export class HuiCalendarCard extends LitElement implements LovelaceCard {
.hass=${this.hass}
.views=${views}
.initialView=${this._config.initial_view!}
.eventDisplay=${"list-item"}
.eventDisplay=${this._eventDisplay}
.error=${this._error}
@view-changed=${this._handleViewChanged}
></ha-full-calendar>
@ -164,6 +166,8 @@ export class HuiCalendarCard extends LitElement implements LovelaceCard {
}
private _handleViewChanged(ev: HASSDomEvent<CalendarViewChanged>): void {
this._eventDisplay =
ev.detail.view === "dayGridMonth" ? "list-item" : "auto";
this._startDate = ev.detail.start;
this._endDate = ev.detail.end;
this._fetchCalendarEvents();