Add AppSelector following the Add-ons->Apps rename (#29209)

This commit is contained in:
Jan Čermák 2026-01-27 16:19:51 +01:00 committed by GitHub
parent 91c12605d3
commit c2c4e06915
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,45 @@
import { css, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators";
import type { AppSelector } from "../../data/selector";
import type { HomeAssistant } from "../../types";
import "../ha-addon-picker";
@customElement("ha-selector-app")
export class HaAppSelector extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ attribute: false }) public selector!: AppSelector;
@property() public value?: any;
@property() public label?: string;
@property() public helper?: string;
@property({ type: Boolean }) public disabled = false;
@property({ type: Boolean }) public required = true;
protected render() {
return html`<ha-addon-picker
.hass=${this.hass}
.value=${this.value}
.label=${this.label}
.helper=${this.helper}
.disabled=${this.disabled}
.required=${this.required}
></ha-addon-picker>`;
}
static styles = css`
ha-addon-picker {
width: 100%;
}
`;
}
declare global {
interface HTMLElementTagNameMap {
"ha-selector-app": HaAppSelector;
}
}

View File

@ -13,6 +13,7 @@ import type { HomeAssistant } from "../../types";
const LOAD_ELEMENTS = {
action: () => import("./ha-selector-action"),
addon: () => import("./ha-selector-addon"),
app: () => import("./ha-selector-app"),
area: () => import("./ha-selector-area"),
areas_display: () => import("./ha-selector-areas-display"),
attribute: () => import("./ha-selector-attribute"),

View File

@ -25,6 +25,7 @@ import type { EntitySources } from "./entity/entity_sources";
export type Selector =
| ActionSelector
| AddonSelector
| AppSelector
| AreaSelector
| AreasDisplaySelector
| AttributeSelector
@ -90,6 +91,13 @@ export interface AddonSelector {
} | null;
}
export interface AppSelector {
app: {
name?: string;
slug?: string;
} | null;
}
export interface AreaSelector {
area: {
entity?: EntitySelectorFilter | readonly EntitySelectorFilter[];