mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
Allow card editors to use card picker again (#5067)
This commit is contained in:
parent
2b8b9f8311
commit
196540afc7
@ -12,7 +12,7 @@ import { safeDump, safeLoad } from "js-yaml";
|
||||
|
||||
import "@material/mwc-button";
|
||||
import { HomeAssistant } from "../../../../types";
|
||||
import { LovelaceCardConfig } from "../../../../data/lovelace";
|
||||
import { LovelaceCardConfig, LovelaceConfig } from "../../../../data/lovelace";
|
||||
import { LovelaceCardEditor } from "../../types";
|
||||
import { computeRTL } from "../../../../common/util/compute_rtl";
|
||||
|
||||
@ -45,6 +45,7 @@ export interface UIConfigChangedEvent extends Event {
|
||||
@customElement("hui-card-editor")
|
||||
export class HuiCardEditor extends LitElement {
|
||||
@property() public hass!: HomeAssistant;
|
||||
@property() public lovelace?: LovelaceConfig;
|
||||
|
||||
@property() private _yaml?: string;
|
||||
@property() private _config?: LovelaceCardConfig;
|
||||
@ -239,6 +240,7 @@ export class HuiCardEditor extends LitElement {
|
||||
|
||||
// Perform final setup
|
||||
this._configElement!.hass = this.hass;
|
||||
this._configElement!.lovelace = this.lovelace;
|
||||
this._configElement!.addEventListener("config-changed", (ev) =>
|
||||
this._handleUIConfigChanged(ev as UIConfigChangedEvent)
|
||||
);
|
||||
|
@ -109,6 +109,7 @@ export class HuiDialogEditCard extends LitElement {
|
||||
<div class="element-editor">
|
||||
<hui-card-editor
|
||||
.hass=${this.hass}
|
||||
.lovelace="${this._params.lovelaceConfig}"
|
||||
.value="${this._cardConfig}"
|
||||
@config-changed="${this._handleConfigChanged}"
|
||||
></hui-card-editor>
|
||||
|
@ -14,6 +14,7 @@ import { HomeAssistant } from "../../../../types";
|
||||
import { LovelaceCardEditor } from "../../types";
|
||||
import { StackCardConfig } from "../../cards/types";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { LovelaceConfig } from "../../../../data/lovelace";
|
||||
|
||||
const cardConfigStruct = struct({
|
||||
type: "string",
|
||||
@ -25,6 +26,7 @@ const cardConfigStruct = struct({
|
||||
export class HuiStackCardEditor extends LitElement
|
||||
implements LovelaceCardEditor {
|
||||
@property() public hass?: HomeAssistant;
|
||||
@property() public lovelace?: LovelaceConfig;
|
||||
@property() private _config?: StackCardConfig;
|
||||
@property() private _selectedCard: number = 0;
|
||||
|
||||
@ -102,6 +104,7 @@ export class HuiStackCardEditor extends LitElement
|
||||
: html`
|
||||
<hui-card-picker
|
||||
.hass=${this.hass}
|
||||
.lovelace=${this.lovelace}
|
||||
@config-changed="${this._handleCardPicked}"
|
||||
></hui-card-picker>
|
||||
`
|
||||
|
@ -54,5 +54,6 @@ export interface LovelaceHeaderFooter extends HTMLElement {
|
||||
|
||||
export interface LovelaceCardEditor extends HTMLElement {
|
||||
hass?: HomeAssistant;
|
||||
lovelace?: LovelaceConfig;
|
||||
setConfig(config: LovelaceCardConfig): void;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user