Refactor and cleanup device picker (#18804)

This commit is contained in:
Paul Bottein
2023-11-29 10:01:54 +01:00
committed by GitHub
parent 150a5571cf
commit 2acd1ff5e8
4 changed files with 29 additions and 385 deletions

View File

@@ -1,4 +1,3 @@
import "@material/mwc-list/mwc-list-item";
import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
import { HassEntity } from "home-assistant-js-websocket";
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
@@ -25,21 +24,22 @@ import {
showAlertDialog,
showPromptDialog,
} from "../dialogs/generic/show-dialog-box";
import { ValueChangedEvent, HomeAssistant } from "../types";
import { HomeAssistant, ValueChangedEvent } from "../types";
import type { HaDevicePickerDeviceFilterFunc } from "./device/ha-device-picker";
import "./ha-combo-box";
import type { HaComboBox } from "./ha-combo-box";
import "./ha-icon-button";
import "./ha-list-item";
import "./ha-svg-icon";
type ScorableAreaRegistryEntry = ScorableTextItem & AreaRegistryEntry;
const rowRenderer: ComboBoxLitRenderer<AreaRegistryEntry> = (item) =>
html`<mwc-list-item
html`<ha-list-item
class=${classMap({ "add-new": item.area_id === "add_new" })}
>
${item.name}
</mwc-list-item>`;
</ha-list-item>`;
@customElement("ha-area-picker")
export class HaAreaPicker extends LitElement {