mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-17 06:16:33 +00:00
no need for memoize
This commit is contained in:
parent
940f5c0002
commit
ed9d886009
@ -73,13 +73,11 @@ export class HuiAlarmPanelCardEditor
|
|||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
|
|
||||||
const schema = this._schema(this.hass.localize);
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-form
|
<ha-form
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${this._config}
|
.data=${this._config}
|
||||||
.schema=${schema}
|
.schema=${this._schema(this.hass.localize)}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
import "../../../../components/ha-form/ha-form";
|
|
||||||
import { html, LitElement, TemplateResult } from "lit";
|
import { html, LitElement, TemplateResult } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { assert, assign, boolean, object, optional, string } from "superstruct";
|
import { assert, assign, boolean, object, optional, string } from "superstruct";
|
||||||
import memoizeOne from "memoize-one";
|
|
||||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||||
|
import "../../../../components/ha-form/ha-form";
|
||||||
|
import type { HaFormSchema } from "../../../../components/ha-form/types";
|
||||||
import type { HomeAssistant } from "../../../../types";
|
import type { HomeAssistant } from "../../../../types";
|
||||||
import type { AreaCardConfig } from "../../cards/types";
|
import type { AreaCardConfig } from "../../cards/types";
|
||||||
import type { LovelaceCardEditor } from "../../types";
|
import type { LovelaceCardEditor } from "../../types";
|
||||||
import { baseLovelaceCardConfig } from "../structs/base-card-struct";
|
import { baseLovelaceCardConfig } from "../structs/base-card-struct";
|
||||||
import type { HaFormSchema } from "../../../../components/ha-form/types";
|
|
||||||
|
|
||||||
const cardConfigStruct = assign(
|
const cardConfigStruct = assign(
|
||||||
baseLovelaceCardConfig,
|
baseLovelaceCardConfig,
|
||||||
@ -20,6 +19,19 @@ const cardConfigStruct = assign(
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const SCHEMA: HaFormSchema[] = [
|
||||||
|
{ name: "area", selector: { area: {} } },
|
||||||
|
{ name: "show_camera", required: false, selector: { boolean: {} } },
|
||||||
|
{
|
||||||
|
name: "",
|
||||||
|
type: "grid",
|
||||||
|
schema: [
|
||||||
|
{ name: "navigation_path", required: false, selector: { text: {} } },
|
||||||
|
{ name: "theme", required: false, selector: { theme: {} } },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
@customElement("hui-area-card-editor")
|
@customElement("hui-area-card-editor")
|
||||||
export class HuiAreaCardEditor
|
export class HuiAreaCardEditor
|
||||||
extends LitElement
|
extends LitElement
|
||||||
@ -34,19 +46,6 @@ export class HuiAreaCardEditor
|
|||||||
this._config = config;
|
this._config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _schema = memoizeOne((): HaFormSchema[] => [
|
|
||||||
{ name: "area", selector: { area: {} } },
|
|
||||||
{ name: "show_camera", required: false, selector: { boolean: {} } },
|
|
||||||
{
|
|
||||||
name: "",
|
|
||||||
type: "grid",
|
|
||||||
schema: [
|
|
||||||
{ name: "navigation_path", required: false, selector: { text: {} } },
|
|
||||||
{ name: "theme", required: false, selector: { theme: {} } },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
if (!this.hass || !this._config) {
|
if (!this.hass || !this._config) {
|
||||||
return html``;
|
return html``;
|
||||||
@ -56,7 +55,7 @@ export class HuiAreaCardEditor
|
|||||||
<ha-form
|
<ha-form
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${this._config}
|
.data=${this._config}
|
||||||
.schema=${this._schema()}
|
.schema=${SCHEMA}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user