mirror of
https://github.com/home-assistant/frontend.git
synced 2026-04-17 23:54:28 +01:00
Revert "Show device name prefix in entity name field" (#30381)
Revert "Show device name prefix in entity name field (#30358)"
This reverts commit e1ac7e98b0.
This commit is contained in:
@@ -283,9 +283,6 @@ export class HaTextField extends LitElement {
|
||||
.prefix {
|
||||
padding-top: var(--ha-space-3);
|
||||
margin-inline-end: var(--text-field-prefix-padding-right);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -228,9 +228,6 @@ export class HaInput extends LitElement {
|
||||
@state()
|
||||
private _invalid = false;
|
||||
|
||||
@state()
|
||||
private _hasStartSlot = false;
|
||||
|
||||
@query("wa-input")
|
||||
private _input?: WaInput;
|
||||
|
||||
@@ -351,8 +348,7 @@ export class HaInput extends LitElement {
|
||||
invalid: this.invalid || this._invalid,
|
||||
"label-raised":
|
||||
(this.value !== undefined && this.value !== "") ||
|
||||
(this.label && this.placeholder) ||
|
||||
this._hasStartSlot,
|
||||
(this.label && this.placeholder),
|
||||
"no-label": !this.label,
|
||||
"hint-hidden":
|
||||
!this.hint &&
|
||||
@@ -372,7 +368,7 @@ export class HaInput extends LitElement {
|
||||
>${this._renderLabel(this.label, this.required)}</slot
|
||||
>`
|
||||
: nothing}
|
||||
<slot name="start" slot="start" @slotchange=${this._onStartSlotChange}>
|
||||
<slot name="start" slot="start" @slotchange=${this._syncStartSlotWidth}>
|
||||
${this.renderStartDefault()}
|
||||
</slot>
|
||||
<slot name="end" slot="end"> ${this.renderEndDefault()} </slot>
|
||||
@@ -437,12 +433,6 @@ export class HaInput extends LitElement {
|
||||
this._invalid = true;
|
||||
}
|
||||
|
||||
private _onStartSlotChange = (ev: Event) => {
|
||||
const slot = ev.target as HTMLSlotElement;
|
||||
this._hasStartSlot = slot.assignedNodes().length > 0;
|
||||
this._syncStartSlotWidth();
|
||||
};
|
||||
|
||||
private _syncStartSlotWidth = () => {
|
||||
const startEl = this._input?.shadowRoot?.querySelector(
|
||||
'[part~="start"]'
|
||||
@@ -589,12 +579,6 @@ export class HaInput extends LitElement {
|
||||
background-color: var(--ha-color-border-danger-normal);
|
||||
}
|
||||
|
||||
wa-input::part(start) {
|
||||
max-width: var(--ha-input-start-max-width, none);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
wa-input::part(input) {
|
||||
padding-top: var(--ha-space-3);
|
||||
padding-inline-start: var(--input-padding-inline-start, 0);
|
||||
|
||||
@@ -8,7 +8,6 @@ import { until } from "lit/directives/until";
|
||||
import memoizeOne from "memoize-one";
|
||||
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
import { computeDeviceName } from "../../../common/entity/compute_device_name";
|
||||
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||
import { computeObjectId } from "../../../common/entity/compute_object_id";
|
||||
import { supportsFeature } from "../../../common/entity/supports-feature";
|
||||
@@ -212,12 +211,6 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
||||
|
||||
protected willUpdate(changedProperties: PropertyValues) {
|
||||
super.willUpdate(changedProperties);
|
||||
if (changedProperties.has("hass") && this.entry.device_id) {
|
||||
const device = this.hass.devices[this.entry.device_id];
|
||||
if (device !== this._device) {
|
||||
this._device = device;
|
||||
}
|
||||
}
|
||||
if (
|
||||
!changedProperties.has("entry") ||
|
||||
changedProperties.get("entry")?.id === this.entry.id
|
||||
@@ -395,47 +388,27 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
||||
${this.hideName
|
||||
? nothing
|
||||
: html`<ha-textfield
|
||||
class="name"
|
||||
.value=${this._name ?? this.entry.original_name ?? ""}
|
||||
.prefix=${this.entry.has_entity_name && this._device
|
||||
? (computeDeviceName(this._device) ?? "")
|
||||
: ""}
|
||||
.label=${this.hass.localize(
|
||||
"ui.dialogs.entity_registry.editor.name"
|
||||
)}
|
||||
.disabled=${this.disabled}
|
||||
@input=${this._nameChanged}
|
||||
.iconTrailing=${this._name !== null}
|
||||
>
|
||||
${this._name !== null
|
||||
? html`<div class="layout horizontal" slot="trailingIcon">
|
||||
<ha-icon-button
|
||||
@click=${this._restoreName}
|
||||
.path=${mdiRestore}
|
||||
.label=${this.hass.localize(
|
||||
"ui.dialogs.entity_registry.editor.restore_name"
|
||||
)}
|
||||
></ha-icon-button>
|
||||
</div>`
|
||||
: nothing}
|
||||
</ha-textfield>
|
||||
${this.entry.has_entity_name && this._device
|
||||
? html`<span class="hint">
|
||||
${this.hass.localize(
|
||||
"ui.dialogs.entity_registry.editor.change_device_settings",
|
||||
{
|
||||
link: html`<button
|
||||
class="link"
|
||||
@click=${this._openDeviceSettings}
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.dialogs.entity_registry.editor.change_device_name_link"
|
||||
)}
|
||||
</button>`,
|
||||
}
|
||||
)}
|
||||
</span>`
|
||||
: nothing}`}
|
||||
class="name"
|
||||
.value=${this._name ?? this.entry.original_name ?? ""}
|
||||
.label=${this.hass.localize(
|
||||
"ui.dialogs.entity_registry.editor.name"
|
||||
)}
|
||||
.disabled=${this.disabled}
|
||||
@input=${this._nameChanged}
|
||||
.iconTrailing=${this._name !== null}
|
||||
>
|
||||
${this._name !== null
|
||||
? html`<div class="layout horizontal" slot="trailingIcon">
|
||||
<ha-icon-button
|
||||
@click=${this._restoreName}
|
||||
.path=${mdiRestore}
|
||||
.label=${this.hass.localize(
|
||||
"ui.dialogs.entity_registry.editor.restore_name"
|
||||
)}
|
||||
></ha-icon-button>
|
||||
</div>`
|
||||
: nothing}
|
||||
</ha-textfield>`}
|
||||
${this.hideIcon
|
||||
? nothing
|
||||
: html`
|
||||
@@ -1638,10 +1611,6 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
||||
ha-textfield.entityId {
|
||||
--text-field-prefix-padding-right: 0;
|
||||
}
|
||||
ha-textfield.name {
|
||||
--text-field-prefix-padding-right: var(--ha-space-1);
|
||||
--ha-input-start-max-width: 50%;
|
||||
}
|
||||
ha-textfield.entityId,
|
||||
ha-textfield.name {
|
||||
--textfield-icon-trailing-padding: 0;
|
||||
@@ -1668,16 +1637,6 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
||||
margin: var(--ha-space-2) 0;
|
||||
width: 100%;
|
||||
}
|
||||
.hint {
|
||||
display: block;
|
||||
color: var(--secondary-text-color);
|
||||
font-size: 12px;
|
||||
padding: 0 16px;
|
||||
margin-top: -4px;
|
||||
}
|
||||
.hint .link {
|
||||
direction: var(--direction);
|
||||
}
|
||||
.menu-item {
|
||||
border-radius: var(--ha-border-radius-sm);
|
||||
margin-top: 3px;
|
||||
|
||||
@@ -1869,7 +1869,6 @@
|
||||
},
|
||||
"update": "Update",
|
||||
"note": "Note: This might not work yet with all integrations.",
|
||||
"change_device_name_link": "change the device name",
|
||||
"use_device_area": "Use device area",
|
||||
"change_device_settings": "You can {link} in the device settings",
|
||||
"change_device_area_link": "change the device area",
|
||||
|
||||
Reference in New Issue
Block a user