mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Add support for calendar event description (#14522)
This commit is contained in:
parent
76a682fa28
commit
1105c92569
@ -29,6 +29,7 @@ export interface CalendarEventData {
|
|||||||
dtstart: string;
|
dtstart: string;
|
||||||
dtend: string;
|
dtend: string;
|
||||||
rrule?: string;
|
rrule?: string;
|
||||||
|
description?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CalendarEventMutableParams {
|
export interface CalendarEventMutableParams {
|
||||||
@ -36,6 +37,7 @@ export interface CalendarEventMutableParams {
|
|||||||
dtstart: string;
|
dtstart: string;
|
||||||
dtend: string;
|
dtend: string;
|
||||||
rrule?: string;
|
rrule?: string;
|
||||||
|
description?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The scope of a delete/update for a recurring event
|
// The scope of a delete/update for a recurring event
|
||||||
@ -84,6 +86,7 @@ export const fetchCalendarEvents = async (
|
|||||||
const eventData: CalendarEventData = {
|
const eventData: CalendarEventData = {
|
||||||
uid: ev.uid,
|
uid: ev.uid,
|
||||||
summary: ev.summary,
|
summary: ev.summary,
|
||||||
|
description: ev.description,
|
||||||
dtstart: eventStart,
|
dtstart: eventStart,
|
||||||
dtend: eventEnd,
|
dtend: eventEnd,
|
||||||
recurrence_id: ev.recurrence_id,
|
recurrence_id: ev.recurrence_id,
|
||||||
|
@ -87,6 +87,11 @@ class DialogCalendarEventDetail extends LitElement {
|
|||||||
${this._data!.rrule
|
${this._data!.rrule
|
||||||
? this._renderRruleAsText(this._data.rrule)
|
? this._renderRruleAsText(this._data.rrule)
|
||||||
: ""}
|
: ""}
|
||||||
|
${this._data.description
|
||||||
|
? html`<br />
|
||||||
|
<div class="description">${this._data.description}</div>
|
||||||
|
<br />`
|
||||||
|
: html``}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -239,6 +244,11 @@ class DialogCalendarEventDetail extends LitElement {
|
|||||||
.field {
|
.field {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
.description {
|
||||||
|
color: var(--secondary-text-color);
|
||||||
|
max-width: 300px;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
`,
|
`,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import { customElement, property, state } from "lit/decorators";
|
|||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { isDate } from "../../common/string/is_date";
|
import { isDate } from "../../common/string/is_date";
|
||||||
import "../../components/ha-date-input";
|
import "../../components/ha-date-input";
|
||||||
|
import "../../components/ha-textarea";
|
||||||
import "../../components/ha-time-input";
|
import "../../components/ha-time-input";
|
||||||
import {
|
import {
|
||||||
Calendar,
|
Calendar,
|
||||||
@ -42,6 +43,8 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
|
|
||||||
@state() private _summary = "";
|
@state() private _summary = "";
|
||||||
|
|
||||||
|
@state() private _description = "";
|
||||||
|
|
||||||
@state() private _rrule?: string;
|
@state() private _rrule?: string;
|
||||||
|
|
||||||
@state() private _allDay = false;
|
@state() private _allDay = false;
|
||||||
@ -127,6 +130,15 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
error-message=${this.hass.localize("ui.common.error_required")}
|
error-message=${this.hass.localize("ui.common.error_required")}
|
||||||
dialogInitialFocus
|
dialogInitialFocus
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
|
<ha-textarea
|
||||||
|
class="description"
|
||||||
|
name="description"
|
||||||
|
.label=${this.hass.localize(
|
||||||
|
"ui.components.calendar.event.description"
|
||||||
|
)}
|
||||||
|
@change=${this._handleDescriptionChanged}
|
||||||
|
autogrow
|
||||||
|
></ha-textarea>
|
||||||
<ha-combo-box
|
<ha-combo-box
|
||||||
name="calendar"
|
name="calendar"
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
@ -252,6 +264,10 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
this._summary = ev.target.value;
|
this._summary = ev.target.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _handleDescriptionChanged(ev) {
|
||||||
|
this._description = ev.target.value;
|
||||||
|
}
|
||||||
|
|
||||||
private _handleRRuleChanged(ev) {
|
private _handleRRuleChanged(ev) {
|
||||||
this._rrule = ev.detail.value;
|
this._rrule = ev.detail.value;
|
||||||
}
|
}
|
||||||
@ -291,6 +307,7 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
);
|
);
|
||||||
const data: CalendarEventMutableParams = {
|
const data: CalendarEventMutableParams = {
|
||||||
summary: this._summary,
|
summary: this._summary,
|
||||||
|
description: this._description,
|
||||||
rrule: this._rrule,
|
rrule: this._rrule,
|
||||||
dtstart: "",
|
dtstart: "",
|
||||||
dtend: "",
|
dtend: "",
|
||||||
@ -390,6 +407,7 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
this._dtstart = undefined;
|
this._dtstart = undefined;
|
||||||
this._dtend = undefined;
|
this._dtend = undefined;
|
||||||
this._summary = "";
|
this._summary = "";
|
||||||
|
this._description = "";
|
||||||
this._rrule = undefined;
|
this._rrule = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,9 +418,12 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
state-info {
|
state-info {
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
}
|
}
|
||||||
ha-textfield {
|
ha-textfield,
|
||||||
|
ha-textarea {
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 24px;
|
}
|
||||||
|
ha-textarea {
|
||||||
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
ha-formfield {
|
ha-formfield {
|
||||||
display: block;
|
display: block;
|
||||||
@ -435,7 +456,6 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
}
|
}
|
||||||
ha-combo-box {
|
ha-combo-box {
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
}
|
||||||
ha-svg-icon {
|
ha-svg-icon {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
|
@ -666,7 +666,8 @@
|
|||||||
"daily": "days"
|
"daily": "days"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"summary": "Summary"
|
"summary": "Summary",
|
||||||
|
"description": "Description"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"attributes": {
|
"attributes": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user