mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Use correct close dialog function for dialog event editor
` (#14604)
* Use correct close dialog function for `dialog event editor`` * Update dialog-calendar-event-editor.ts
This commit is contained in:
parent
8c69c772d1
commit
b581b95d9d
@ -11,6 +11,7 @@ import {
|
|||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
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-textarea";
|
||||||
@ -94,6 +95,21 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public closeDialog(): void {
|
||||||
|
if (!this._params) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._calendars = [];
|
||||||
|
this._calendarId = undefined;
|
||||||
|
this._params = undefined;
|
||||||
|
this._dtstart = undefined;
|
||||||
|
this._dtend = undefined;
|
||||||
|
this._summary = "";
|
||||||
|
this._description = "";
|
||||||
|
this._rrule = undefined;
|
||||||
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
if (!this._params) {
|
if (!this._params) {
|
||||||
return html``;
|
return html``;
|
||||||
@ -108,7 +124,7 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
return html`
|
return html`
|
||||||
<ha-dialog
|
<ha-dialog
|
||||||
open
|
open
|
||||||
@closed=${this._close}
|
@closed=${this.closeDialog}
|
||||||
scrimClickAction
|
scrimClickAction
|
||||||
escapeKeyAction
|
escapeKeyAction
|
||||||
.heading=${html`
|
.heading=${html`
|
||||||
@ -437,7 +453,7 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
this._submitting = false;
|
this._submitting = false;
|
||||||
}
|
}
|
||||||
await this._params!.updated();
|
await this._params!.updated();
|
||||||
this._params = undefined;
|
this.closeDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _saveEvent() {
|
private async _saveEvent() {
|
||||||
@ -491,18 +507,7 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
this._submitting = false;
|
this._submitting = false;
|
||||||
}
|
}
|
||||||
await this._params!.updated();
|
await this._params!.updated();
|
||||||
this._close();
|
this.closeDialog();
|
||||||
}
|
|
||||||
|
|
||||||
private _close(): void {
|
|
||||||
this._calendars = [];
|
|
||||||
this._calendarId = undefined;
|
|
||||||
this._params = undefined;
|
|
||||||
this._dtstart = undefined;
|
|
||||||
this._dtend = undefined;
|
|
||||||
this._summary = "";
|
|
||||||
this._description = "";
|
|
||||||
this._rrule = undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user