From 1249c0eea9c7327c9b07032db1561f3183f61405 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 19 Nov 2019 21:06:52 +0100 Subject: [PATCH] Fix ha-form on edge (#4248) --- src/auth/ha-auth-flow.ts | 5 +++++ src/components/ha-form/ha-form-boolean.ts | 11 +++-------- src/components/ha-form/ha-form-float.ts | 11 +++-------- src/components/ha-form/ha-form-integer.ts | 11 +++-------- .../ha-form-positive_time_period_dict.ts | 19 +++++++------------ src/components/ha-form/ha-form-select.ts | 11 +++-------- src/components/ha-form/ha-form-string.ts | 11 +++-------- src/components/ha-form/ha-form.ts | 2 +- 8 files changed, 28 insertions(+), 53 deletions(-) diff --git a/src/auth/ha-auth-flow.ts b/src/auth/ha-auth-flow.ts index 5075c3963f..afebe018be 100644 --- a/src/auth/ha-auth-flow.ts +++ b/src/auth/ha-auth-flow.ts @@ -119,6 +119,7 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) { .error=${step.errors} .computeLabel=${this._computeLabelCallback(step)} .computeError=${this._computeErrorCallback(step)} + @value-changed=${this._stepDataChanged} > `; default: @@ -223,6 +224,10 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) { }, 100); } + private _stepDataChanged(ev: CustomEvent) { + this._stepData = ev.detail.value; + } + private _computeStepDescription(step: DataEntryFlowStepForm) { const resourceKey = `ui.panel.page-authorize.form.providers.${ step.handler[0] diff --git a/src/components/ha-form/ha-form-boolean.ts b/src/components/ha-form/ha-form-boolean.ts index 5921cd3e43..cfcda6c015 100644 --- a/src/components/ha-form/ha-form-boolean.ts +++ b/src/components/ha-form/ha-form-boolean.ts @@ -43,14 +43,9 @@ export class HaFormBoolean extends LitElement implements HaFormElement { } private _valueChanged(ev: Event) { - fireEvent( - this, - "value-changed", - { - value: (ev.target as PaperCheckboxElement).checked, - }, - { bubbles: false } - ); + fireEvent(this, "value-changed", { + value: (ev.target as PaperCheckboxElement).checked, + }); } static get styles(): CSSResult { diff --git a/src/components/ha-form/ha-form-float.ts b/src/components/ha-form/ha-form-float.ts index d2d41990aa..ce6056300f 100644 --- a/src/components/ha-form/ha-form-float.ts +++ b/src/components/ha-form/ha-form-float.ts @@ -51,14 +51,9 @@ export class HaFormFloat extends LitElement implements HaFormElement { if (this._value === value) { return; } - fireEvent( - this, - "value-changed", - { - value, - }, - { bubbles: false } - ); + fireEvent(this, "value-changed", { + value, + }); } } diff --git a/src/components/ha-form/ha-form-integer.ts b/src/components/ha-form/ha-form-integer.ts index 996110852b..f4877386e0 100644 --- a/src/components/ha-form/ha-form-integer.ts +++ b/src/components/ha-form/ha-form-integer.ts @@ -71,14 +71,9 @@ export class HaFormInteger extends LitElement implements HaFormElement { if (this._value === value) { return; } - fireEvent( - this, - "value-changed", - { - value, - }, - { bubbles: false } - ); + fireEvent(this, "value-changed", { + value, + }); } } diff --git a/src/components/ha-form/ha-form-positive_time_period_dict.ts b/src/components/ha-form/ha-form-positive_time_period_dict.ts index 5794f34d2e..8fcc6cbc36 100644 --- a/src/components/ha-form/ha-form-positive_time_period_dict.ts +++ b/src/components/ha-form/ha-form-positive_time_period_dict.ts @@ -96,19 +96,14 @@ export class HaFormTimePeriod extends LitElement implements HaFormElement { value %= 60; } - fireEvent( - this, - "value-changed", - { - value: { - hours, - minutes, - seconds: this._seconds, - ...{ [unit]: value }, - }, + fireEvent(this, "value-changed", { + value: { + hours, + minutes, + seconds: this._seconds, + ...{ [unit]: value }, }, - { bubbles: false } - ); + }); } } diff --git a/src/components/ha-form/ha-form-select.ts b/src/components/ha-form/ha-form-select.ts index 25a13abd23..d0a871af01 100644 --- a/src/components/ha-form/ha-form-select.ts +++ b/src/components/ha-form/ha-form-select.ts @@ -60,14 +60,9 @@ export class HaFormSelect extends LitElement implements HaFormElement { if (!ev.detail.value) { return; } - fireEvent( - this, - "value-changed", - { - value: ev.detail.value.itemValue, - }, - { bubbles: false } - ); + fireEvent(this, "value-changed", { + value: ev.detail.value.itemValue, + }); } } diff --git a/src/components/ha-form/ha-form-string.ts b/src/components/ha-form/ha-form-string.ts index 36db7fef75..474323f9bd 100644 --- a/src/components/ha-form/ha-form-string.ts +++ b/src/components/ha-form/ha-form-string.ts @@ -76,14 +76,9 @@ export class HaFormString extends LitElement implements HaFormElement { if (this.data === value) { return; } - fireEvent( - this, - "value-changed", - { - value, - }, - { bubbles: false } - ); + fireEvent(this, "value-changed", { + value, + }); } private _stringType() { diff --git a/src/components/ha-form/ha-form.ts b/src/components/ha-form/ha-form.ts index 8196f39adb..f62fd311a0 100644 --- a/src/components/ha-form/ha-form.ts +++ b/src/components/ha-form/ha-form.ts @@ -151,7 +151,7 @@ export class HaForm extends LitElement implements HaFormElement { ` : ""} -
+
`; }