mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-09 02:49:51 +00:00
Use right naming convention for ui_action and ui_color selector (#16235)
This commit is contained in:
@@ -42,10 +42,12 @@ const LOAD_ELEMENTS = {
|
||||
tts: () => import("./ha-selector-tts"),
|
||||
location: () => import("./ha-selector-location"),
|
||||
color_temp: () => import("./ha-selector-color-temp"),
|
||||
"ui-action": () => import("./ha-selector-ui-action"),
|
||||
"ui-color": () => import("./ha-selector-ui-color"),
|
||||
ui_action: () => import("./ha-selector-ui-action"),
|
||||
ui_color: () => import("./ha-selector-ui-color"),
|
||||
};
|
||||
|
||||
const LEGACY_UI_SELECTORS = new Set(["ui-action", "ui-color"]);
|
||||
|
||||
@customElement("ha-selector")
|
||||
export class HaSelector extends LitElement {
|
||||
@property() public hass!: HomeAssistant;
|
||||
@@ -75,7 +77,11 @@ export class HaSelector extends LitElement {
|
||||
}
|
||||
|
||||
private get _type() {
|
||||
return Object.keys(this.selector)[0];
|
||||
const type = Object.keys(this.selector)[0];
|
||||
if (LEGACY_UI_SELECTORS.has(type)) {
|
||||
return type.replace("-", "_");
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
protected willUpdate(changedProps: PropertyValues) {
|
||||
@@ -91,6 +97,10 @@ export class HaSelector extends LitElement {
|
||||
if ("device" in selector) {
|
||||
return handleLegacyDeviceSelector(selector);
|
||||
}
|
||||
const type = Object.keys(this.selector)[0];
|
||||
if (LEGACY_UI_SELECTORS.has(type)) {
|
||||
return { [type.replace("-", "_")]: selector[type] };
|
||||
}
|
||||
return selector;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user