mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-29 12:16:39 +00:00
Icon pickers (#5453)
This commit is contained in:
parent
6ca944b7ef
commit
764234f744
@ -10,6 +10,7 @@ import "@polymer/paper-input/paper-input";
|
|||||||
import "../../components/hui-action-editor";
|
import "../../components/hui-action-editor";
|
||||||
import "../../components/hui-theme-select-editor";
|
import "../../components/hui-theme-select-editor";
|
||||||
import "../../components/hui-entity-editor";
|
import "../../components/hui-entity-editor";
|
||||||
|
import "../../../../components/ha-icon-input";
|
||||||
|
|
||||||
import { struct } from "../../common/structs/struct";
|
import { struct } from "../../common/structs/struct";
|
||||||
import {
|
import {
|
||||||
@ -23,6 +24,7 @@ import { fireEvent } from "../../../../common/dom/fire_event";
|
|||||||
import { configElementStyle } from "./config-elements-style";
|
import { configElementStyle } from "./config-elements-style";
|
||||||
import { ActionConfig } from "../../../../data/lovelace";
|
import { ActionConfig } from "../../../../data/lovelace";
|
||||||
import { ButtonCardConfig } from "../../cards/types";
|
import { ButtonCardConfig } from "../../cards/types";
|
||||||
|
import { stateIcon } from "../../../../common/entity/state_icon";
|
||||||
|
|
||||||
const cardConfigStruct = struct({
|
const cardConfigStruct = struct({
|
||||||
type: "string",
|
type: "string",
|
||||||
@ -127,16 +129,18 @@ export class HuiButtonCardEditor extends LitElement
|
|||||||
.configValue="${"name"}"
|
.configValue="${"name"}"
|
||||||
@value-changed="${this._valueChanged}"
|
@value-changed="${this._valueChanged}"
|
||||||
></paper-input>
|
></paper-input>
|
||||||
<paper-input
|
<ha-icon-input
|
||||||
.label="${this.hass.localize(
|
.label="${this.hass.localize(
|
||||||
"ui.panel.lovelace.editor.card.generic.icon"
|
"ui.panel.lovelace.editor.card.generic.icon"
|
||||||
)} (${this.hass.localize(
|
)} (${this.hass.localize(
|
||||||
"ui.panel.lovelace.editor.card.config.optional"
|
"ui.panel.lovelace.editor.card.config.optional"
|
||||||
)})"
|
)})"
|
||||||
.value="${this._icon}"
|
.value=${this._icon}
|
||||||
.configValue="${"icon"}"
|
.placeholder=${this._icon ||
|
||||||
@value-changed="${this._valueChanged}"
|
stateIcon(this.hass.states[this._entity])}
|
||||||
></paper-input>
|
.configValue=${"icon"}
|
||||||
|
@value-changed=${this._valueChanged}
|
||||||
|
></ha-icon-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="side-by-side">
|
<div class="side-by-side">
|
||||||
<ha-switch
|
<ha-switch
|
||||||
|
@ -10,6 +10,7 @@ import "@polymer/paper-input/paper-input";
|
|||||||
import "../../components/hui-action-editor";
|
import "../../components/hui-action-editor";
|
||||||
import "../../components/hui-theme-select-editor";
|
import "../../components/hui-theme-select-editor";
|
||||||
import "../../components/hui-entity-editor";
|
import "../../components/hui-entity-editor";
|
||||||
|
import "../../../../components/ha-icon-input";
|
||||||
|
|
||||||
import { struct } from "../../common/structs/struct";
|
import { struct } from "../../common/structs/struct";
|
||||||
import { EntitiesEditorEvent, EditorTarget } from "../types";
|
import { EntitiesEditorEvent, EditorTarget } from "../types";
|
||||||
@ -19,6 +20,7 @@ import { fireEvent } from "../../../../common/dom/fire_event";
|
|||||||
import { configElementStyle } from "./config-elements-style";
|
import { configElementStyle } from "./config-elements-style";
|
||||||
import { EntityCardConfig } from "../../cards/types";
|
import { EntityCardConfig } from "../../cards/types";
|
||||||
import { headerFooterConfigStructs } from "../../header-footer/types";
|
import { headerFooterConfigStructs } from "../../header-footer/types";
|
||||||
|
import { stateIcon } from "../../../../common/entity/state_icon";
|
||||||
|
|
||||||
const cardConfigStruct = struct({
|
const cardConfigStruct = struct({
|
||||||
type: "string",
|
type: "string",
|
||||||
@ -28,7 +30,6 @@ const cardConfigStruct = struct({
|
|||||||
attribute: "string?",
|
attribute: "string?",
|
||||||
unit: "string?",
|
unit: "string?",
|
||||||
theme: "string?",
|
theme: "string?",
|
||||||
header: struct.optional(headerFooterConfigStructs),
|
|
||||||
footer: struct.optional(headerFooterConfigStructs),
|
footer: struct.optional(headerFooterConfigStructs),
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -99,16 +100,18 @@ export class HuiEntityCardEditor extends LitElement
|
|||||||
.configValue=${"name"}
|
.configValue=${"name"}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></paper-input>
|
></paper-input>
|
||||||
<paper-input
|
<ha-icon-input
|
||||||
.label="${this.hass.localize(
|
.label="${this.hass.localize(
|
||||||
"ui.panel.lovelace.editor.card.generic.icon"
|
"ui.panel.lovelace.editor.card.generic.icon"
|
||||||
)} (${this.hass.localize(
|
)} (${this.hass.localize(
|
||||||
"ui.panel.lovelace.editor.card.config.optional"
|
"ui.panel.lovelace.editor.card.config.optional"
|
||||||
)})"
|
)})"
|
||||||
.value=${this._icon}
|
.value=${this._icon}
|
||||||
|
.placeholder=${this._icon ||
|
||||||
|
stateIcon(this.hass.states[this._entity])}
|
||||||
.configValue=${"icon"}
|
.configValue=${"icon"}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></paper-input>
|
></ha-icon-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="side-by-side">
|
<div class="side-by-side">
|
||||||
<paper-input
|
<paper-input
|
||||||
|
@ -12,6 +12,7 @@ import "@polymer/paper-listbox/paper-listbox";
|
|||||||
|
|
||||||
import "../../components/hui-theme-select-editor";
|
import "../../components/hui-theme-select-editor";
|
||||||
import "../../../../components/entity/ha-entity-picker";
|
import "../../../../components/entity/ha-entity-picker";
|
||||||
|
import "../../../../components/ha-icon-input";
|
||||||
|
|
||||||
import { struct } from "../../common/structs/struct";
|
import { struct } from "../../common/structs/struct";
|
||||||
import { EntitiesEditorEvent, EditorTarget } from "../types";
|
import { EntitiesEditorEvent, EditorTarget } from "../types";
|
||||||
@ -20,6 +21,7 @@ import { LovelaceCardEditor } from "../../types";
|
|||||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||||
import { configElementStyle } from "./config-elements-style";
|
import { configElementStyle } from "./config-elements-style";
|
||||||
import { SensorCardConfig } from "../../cards/types";
|
import { SensorCardConfig } from "../../cards/types";
|
||||||
|
import { stateIcon } from "../../../../common/entity/state_icon";
|
||||||
|
|
||||||
const cardConfigStruct = struct({
|
const cardConfigStruct = struct({
|
||||||
type: "string",
|
type: "string",
|
||||||
@ -111,16 +113,18 @@ export class HuiSensorCardEditor extends LitElement
|
|||||||
@value-changed="${this._valueChanged}"
|
@value-changed="${this._valueChanged}"
|
||||||
></paper-input>
|
></paper-input>
|
||||||
<div class="side-by-side">
|
<div class="side-by-side">
|
||||||
<paper-input
|
<ha-icon-input
|
||||||
.label="${this.hass.localize(
|
.label="${this.hass.localize(
|
||||||
"ui.panel.lovelace.editor.card.generic.icon"
|
"ui.panel.lovelace.editor.card.generic.icon"
|
||||||
)} (${this.hass.localize(
|
)} (${this.hass.localize(
|
||||||
"ui.panel.lovelace.editor.card.config.optional"
|
"ui.panel.lovelace.editor.card.config.optional"
|
||||||
)})"
|
)})"
|
||||||
.value="${this._icon}"
|
.value=${this._icon}
|
||||||
.configValue="${"icon"}"
|
.placeholder=${this._icon ||
|
||||||
@value-changed="${this._valueChanged}"
|
stateIcon(this.hass.states[this._entity])}
|
||||||
></paper-input>
|
.configValue=${"icon"}
|
||||||
|
@value-changed=${this._valueChanged}
|
||||||
|
></ha-icon-input>
|
||||||
<paper-dropdown-menu
|
<paper-dropdown-menu
|
||||||
.label="${this.hass.localize(
|
.label="${this.hass.localize(
|
||||||
"ui.panel.lovelace.editor.card.sensor.graph_type"
|
"ui.panel.lovelace.editor.card.sensor.graph_type"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user