mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 23:36:36 +00:00
Update entity picker (#7343)
This commit is contained in:
parent
5269ff978b
commit
1f361b7b10
@ -1,3 +1,4 @@
|
|||||||
|
import { mdiClose, mdiMenuDown, mdiMenuUp } from "@mdi/js";
|
||||||
import "@polymer/paper-input/paper-input";
|
import "@polymer/paper-input/paper-input";
|
||||||
import "@polymer/paper-item/paper-icon-item";
|
import "@polymer/paper-item/paper-icon-item";
|
||||||
import "@polymer/paper-item/paper-item-body";
|
import "@polymer/paper-item/paper-item-body";
|
||||||
@ -20,8 +21,9 @@ import { computeDomain } from "../../common/entity/compute_domain";
|
|||||||
import { computeStateName } from "../../common/entity/compute_state_name";
|
import { computeStateName } from "../../common/entity/compute_state_name";
|
||||||
import { PolymerChangedEvent } from "../../polymer-types";
|
import { PolymerChangedEvent } from "../../polymer-types";
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
import "../ha-icon-button";
|
import "../ha-svg-icon";
|
||||||
import "./state-badge";
|
import "./state-badge";
|
||||||
|
import "@material/mwc-icon-button/mwc-icon-button";
|
||||||
|
|
||||||
export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;
|
export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;
|
||||||
|
|
||||||
@ -206,35 +208,35 @@ export class HaEntityPicker extends LitElement {
|
|||||||
autocorrect="off"
|
autocorrect="off"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
>
|
>
|
||||||
${this.value && !this.hideClearIcon
|
<div class="suffix" slot="suffix">
|
||||||
? html`
|
${this.value && !this.hideClearIcon
|
||||||
<ha-icon-button
|
? html`
|
||||||
aria-label=${this.hass.localize(
|
<mwc-icon-button
|
||||||
"ui.components.entity.entity-picker.clear"
|
.label=${this.hass.localize(
|
||||||
)}
|
"ui.components.entity.entity-picker.clear"
|
||||||
slot="suffix"
|
)}
|
||||||
class="clear-button"
|
class="clear-button"
|
||||||
icon="hass:close"
|
tabindex="-1"
|
||||||
tabindex="-1"
|
@click=${this._clearValue}
|
||||||
@click=${this._clearValue}
|
no-ripple
|
||||||
no-ripple
|
>
|
||||||
>
|
<ha-svg-icon .path=${mdiClose}></ha-svg-icon>
|
||||||
Clear
|
</mwc-icon-button>
|
||||||
</ha-icon-button>
|
`
|
||||||
`
|
: ""}
|
||||||
: ""}
|
|
||||||
|
|
||||||
<ha-icon-button
|
<mwc-icon-button
|
||||||
aria-label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.components.entity.entity-picker.show_entities"
|
"ui.components.entity.entity-picker.show_entities"
|
||||||
)}
|
)}
|
||||||
slot="suffix"
|
class="toggle-button"
|
||||||
class="toggle-button"
|
tabindex="-1"
|
||||||
.icon=${this._opened ? "hass:menu-up" : "hass:menu-down"}
|
>
|
||||||
tabindex="-1"
|
<ha-svg-icon
|
||||||
>
|
.path=${this._opened ? mdiMenuUp : mdiMenuDown}
|
||||||
Toggle
|
></ha-svg-icon>
|
||||||
</ha-icon-button>
|
</mwc-icon-button>
|
||||||
|
</div>
|
||||||
</paper-input>
|
</paper-input>
|
||||||
</vaadin-combo-box-light>
|
</vaadin-combo-box-light>
|
||||||
`;
|
`;
|
||||||
@ -270,7 +272,10 @@ export class HaEntityPicker extends LitElement {
|
|||||||
|
|
||||||
static get styles(): CSSResult {
|
static get styles(): CSSResult {
|
||||||
return css`
|
return css`
|
||||||
paper-input > ha-icon-button {
|
.suffix {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
mwc-icon-button {
|
||||||
--mdc-icon-button-size: 24px;
|
--mdc-icon-button-size: 24px;
|
||||||
padding: 0px 2px;
|
padding: 0px 2px;
|
||||||
color: var(--secondary-text-color);
|
color: var(--secondary-text-color);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user