Fix floor details area picker (#27827)

This commit is contained in:
Wendelin
2025-11-06 11:42:30 +01:00
committed by GitHub
parent c89fc35578
commit cb0f59b26d
2 changed files with 13 additions and 11 deletions

View File

@@ -87,6 +87,8 @@ export class HaAreaPicker extends LitElement {
@property({ type: Boolean }) public required = false; @property({ type: Boolean }) public required = false;
@property({ attribute: "add-button-label" }) public addButtonLabel?: string;
@query("ha-generic-picker") private _picker?: HaGenericPicker; @query("ha-generic-picker") private _picker?: HaGenericPicker;
public async open() { public async open() {
@@ -375,6 +377,7 @@ export class HaAreaPicker extends LitElement {
.getItems=${this._getItems} .getItems=${this._getItems}
.getAdditionalItems=${this._getAdditionalItems} .getAdditionalItems=${this._getAdditionalItems}
.valueRenderer=${valueRenderer} .valueRenderer=${valueRenderer}
.addButtonLabel=${this.addButtonLabel}
@value-changed=${this._valueChanged} @value-changed=${this._valueChanged}
> >
</ha-generic-picker> </ha-generic-picker>

View File

@@ -8,24 +8,24 @@ import { fireEvent } from "../../../common/dom/fire_event";
import "../../../components/chips/ha-chip-set"; import "../../../components/chips/ha-chip-set";
import "../../../components/chips/ha-input-chip"; import "../../../components/chips/ha-input-chip";
import "../../../components/ha-alert"; import "../../../components/ha-alert";
import "../../../components/ha-button";
import "../../../components/ha-aliases-editor"; import "../../../components/ha-aliases-editor";
import "../../../components/ha-area-picker";
import "../../../components/ha-button";
import { createCloseHeading } from "../../../components/ha-dialog"; import { createCloseHeading } from "../../../components/ha-dialog";
import "../../../components/ha-icon-picker"; import "../../../components/ha-icon-picker";
import "../../../components/ha-picture-upload"; import "../../../components/ha-picture-upload";
import "../../../components/ha-settings-row"; import "../../../components/ha-settings-row";
import "../../../components/ha-svg-icon"; import "../../../components/ha-svg-icon";
import "../../../components/ha-textfield"; import "../../../components/ha-textfield";
import "../../../components/ha-area-picker"; import { updateAreaRegistryEntry } from "../../../data/area_registry";
import type { import type {
FloorRegistryEntry, FloorRegistryEntry,
FloorRegistryEntryMutableParams, FloorRegistryEntryMutableParams,
} from "../../../data/floor_registry"; } from "../../../data/floor_registry";
import { haStyle, haStyleDialog } from "../../../resources/styles"; import { haStyle, haStyleDialog } from "../../../resources/styles";
import type { HomeAssistant } from "../../../types"; import type { HomeAssistant } from "../../../types";
import type { FloorRegistryDetailDialogParams } from "./show-dialog-floor-registry-detail";
import { showAreaRegistryDetailDialog } from "./show-dialog-area-registry-detail"; import { showAreaRegistryDetailDialog } from "./show-dialog-area-registry-detail";
import { updateAreaRegistryEntry } from "../../../data/area_registry"; import type { FloorRegistryDetailDialogParams } from "./show-dialog-floor-registry-detail";
class DialogFloorDetail extends LitElement { class DialogFloorDetail extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant; @property({ attribute: false }) public hass!: HomeAssistant;
@@ -168,11 +168,6 @@ class DialogFloorDetail extends LitElement {
)} )}
</h3> </h3>
<p class="description">
${this.hass.localize(
"ui.panel.config.floors.editor.areas_description"
)}
</p>
${areas.length ${areas.length
? html`<ha-chip-set> ? html`<ha-chip-set>
${repeat( ${repeat(
@@ -197,13 +192,17 @@ class DialogFloorDetail extends LitElement {
</ha-input-chip>` </ha-input-chip>`
)} )}
</ha-chip-set>` </ha-chip-set>`
: nothing} : html`<p class="description">
${this.hass.localize(
"ui.panel.config.floors.editor.areas_description"
)}
</p>`}
<ha-area-picker <ha-area-picker
no-add no-add
.hass=${this.hass} .hass=${this.hass}
@value-changed=${this._addArea} @value-changed=${this._addArea}
.excludeAreas=${areas.map((a) => a.area_id)} .excludeAreas=${areas.map((a) => a.area_id)}
.label=${this.hass.localize( .addButtonLabel=${this.hass.localize(
"ui.panel.config.floors.editor.add_area" "ui.panel.config.floors.editor.add_area"
)} )}
></ha-area-picker> ></ha-area-picker>