Fix dropdown selection in General Settings (#16754)

This commit is contained in:
Simon Lamon 2023-06-05 13:57:20 +02:00 committed by GitHub
parent b337074758
commit ddaf403378
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 11 deletions

View File

@ -128,9 +128,9 @@ class OnboardingCoreConfig extends LitElement {
</div> </div>
<div class="row"> <div class="row">
<ha-country-picker <ha-country-picker
class="flex" class="flex"
.language=${this.hass.locale.language} .language=${this.hass.locale.language}
.label=${ .label=${
this.hass.localize( this.hass.localize(
"ui.panel.config.core.section.core.core_config.country" "ui.panel.config.core.section.core.core_config.country"
@ -335,12 +335,12 @@ class OnboardingCoreConfig extends LitElement {
] ]
); );
private _handleValueChanged(ev) { private _handleValueChanged(ev: ValueChangedEvent<string>) {
const target = ev.currentTarget; const target = ev.currentTarget as HTMLElement;
this[`_${target.getAttribute("name")}`] = ev.detail.value; this[`_${target.getAttribute("name")}`] = ev.detail.value;
} }
private _handleChange(ev: ValueChangedEvent<string>) { private _handleChange(ev: Event) {
const target = ev.currentTarget as HaTextField; const target = ev.currentTarget as HaTextField;
this[`_${target.name}`] = target.value; this[`_${target.name}`] = target.value;
} }

View File

@ -27,7 +27,8 @@ import { ConfigUpdateValues, saveCoreConfig } from "../../../data/core";
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
import "../../../layouts/hass-subpage"; import "../../../layouts/hass-subpage";
import { haStyle } from "../../../resources/styles"; import { haStyle } from "../../../resources/styles";
import type { HomeAssistant } from "../../../types"; import type { HomeAssistant, ValueChangedEvent } from "../../../types";
import type { HaTextField } from "../../../components/ha-textfield";
@customElement("ha-config-section-general") @customElement("ha-config-section-general")
class HaConfigSectionGeneral extends LitElement { class HaConfigSectionGeneral extends LitElement {
@ -301,13 +302,13 @@ class HaConfigSectionGeneral extends LitElement {
this._updateUnits = true; this._updateUnits = true;
} }
private _handleValueChanged(ev) { private _handleValueChanged(ev: ValueChangedEvent<string>) {
const target = ev.currentTarget; const target = ev.currentTarget as HTMLElement;
this[`_${target.name}`] = ev.detail.value; this[`_${target.getAttribute("name")}`] = ev.detail.value;
} }
private _handleChange(ev) { private _handleChange(ev: Event) {
const target = ev.currentTarget; const target = ev.currentTarget as HaTextField;
this[`_${target.name}`] = target.value; this[`_${target.name}`] = target.value;
} }