Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
94a1b39
First Commit - Adds Header & Footer Editor
zsarnett Aug 31, 2020
2ba5cc1
Merge branch 'dev' of https://github.com/home-assistant/frontend into…
zsarnett Aug 31, 2020
11f6327
fix what I broke in my last checks
zsarnett Aug 31, 2020
70cbbcd
Make the config changes go through same function
zsarnett Aug 31, 2020
12273ad
EntitiesEditorEvent to HassDomEvent Detail Type
zsarnett Aug 31, 2020
0197596
missed conversion
zsarnett Aug 31, 2020
5cfc984
Adds headers to header and footer sections
zsarnett Aug 31, 2020
38f525f
Merge branch 'dev' into footer-ui-config
zsarnett Sep 6, 2020
4abbd69
fix duplicate import
zsarnett Sep 6, 2020
bc0cb0c
Merge branch 'dev' of https://github.com/home-assistant/frontend into…
zsarnett Sep 18, 2020
04b1954
type
zsarnett Sep 18, 2020
795734e
Restore ha-automation-action-wait_template.ts
zsarnett Sep 21, 2020
5800889
remove unneeded type
zsarnett Sep 21, 2020
7a9c5aa
Merge branch 'dev' into footer-ui-config
zsarnett Sep 21, 2020
deb37ef
Use new detail toggle
zsarnett Sep 21, 2020
d826376
Merge branch 'dev' of https://github.com/home-assistant/frontend into…
zsarnett Oct 13, 2020
33c82ea
Restore hassio-system-metrics.ts
zsarnett Oct 13, 2020
ce0d17d
Restore ha-chart-base.js
zsarnett Oct 13, 2020
5d2df00
Restore ha-config-person.ts
zsarnett Oct 13, 2020
5dc0df1
Restore generate-lovelace-config.ts
zsarnett Oct 13, 2020
a84dd08
Restore hui-alarm-panel-card-editor.ts
zsarnett Oct 13, 2020
8af4404
Restore hui-calendar-card-editor.ts
zsarnett Oct 13, 2020
131fa4a
Restore hui-entity-card-editor.ts
zsarnett Oct 13, 2020
a003bc1
Restore hui-gauge-card-editor.ts
zsarnett Oct 13, 2020
dd80fe2
Restore hui-glance-card-editor.ts
zsarnett Oct 13, 2020
cab4455
Restore hui-history-graph-card-editor.ts
zsarnett Oct 13, 2020
f11da65
Restore hui-humidifier-card-editor.ts
zsarnett Oct 13, 2020
04eb1d5
Restore hui-iframe-card-editor.ts
zsarnett Oct 13, 2020
81416da
Restore hui-map-card-editor.ts
zsarnett Oct 13, 2020
5c66e95
Restore hui-markdown-card-editor.ts
zsarnett Oct 13, 2020
6a6c6ef
Restore hui-media-control-card-editor.ts
zsarnett Oct 13, 2020
df8ba89
Restore hui-picture-glance-card-editor.ts
zsarnett Oct 13, 2020
c56e720
Restore hui-plant-status-card-editor.ts
zsarnett Oct 13, 2020
d155b89
Restore hui-sensor-card-editor.ts
zsarnett Oct 13, 2020
7228ffb
Restore hui-shopping-list-editor.ts
zsarnett Oct 13, 2020
b8d3526
Restore hui-thermostat-card-editor.ts
zsarnett Oct 13, 2020
9c5eaec
Restore hui-weather-forecast-card-editor.ts
zsarnett Oct 13, 2020
26a7955
Restore hui-dialog-edit-view.ts
zsarnett Oct 13, 2020
a7bc422
Restore ha-refresh-tokens-card.ts
zsarnett Oct 13, 2020
8fb6f25
Restore bytes-to-string.ts
zsarnett Oct 13, 2020
3042a77
Restore hui-entities-card-editor.ts
zsarnett Oct 13, 2020
f58999f
Merge branch 'dev' of https://github.com/home-assistant/frontend into…
zsarnett Oct 13, 2020
5ca2a06
Some updates
zsarnett Oct 13, 2020
ecdc1d8
Getting better all the time
zsarnett Oct 15, 2020
cb84dbb
changes
zsarnett Oct 16, 2020
e686c91
Splitting the row and card editor out
zsarnett Oct 16, 2020
cfbdc9a
remove un needed css
zsarnett Oct 16, 2020
45540ca
add headerfooter editor
zsarnett Oct 16, 2020
1ab280b
keep working
zsarnett Oct 16, 2020
51771dd
remove not used translations
zsarnett Oct 16, 2020
4646bf3
more changes
zsarnett Oct 16, 2020
693fe16
Header and footer editor "works"
zsarnett Oct 16, 2020
414b481
simple
zsarnett Oct 16, 2020
2739099
continued improvements
zsarnett Oct 16, 2020
d30c09b
remove !
zsarnett Oct 16, 2020
c2667c2
Merge branch 'dev' into footer-ui-config
zsarnett Oct 16, 2020
9b652c3
remove update completed
zsarnett Oct 16, 2020
a851a6b
Merge branch 'footer-ui-config' of https://github.com/home-assistant/…
zsarnett Oct 16, 2020
c75c7f3
QOL
zsarnett Oct 17, 2020
f7b4c92
Finshed?
zsarnett Oct 19, 2020
483a542
cleanup
zsarnett Oct 19, 2020
65219b7
More cleanup
zsarnett Oct 19, 2020
29af611
lint
zsarnett Oct 19, 2020
eb253e9
fix saving to be less complicated
zsarnett Oct 19, 2020
eadeeda
Update loclaization
zsarnett Oct 19, 2020
293a991
Localize none
zsarnett Oct 19, 2020
b072c8b
comments
zsarnett Oct 21, 2020
a14c0ee
console.die
zsarnett Nov 9, 2020
628dac4
Typing updates
zsarnett Nov 9, 2020
3142e90
Header and footer types
zsarnett Nov 9, 2020
a4d6ef8
abstract class
zsarnett Nov 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/panels/lovelace/create-element/create-element-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
LovelaceCard,
LovelaceCardConstructor,
LovelaceHeaderFooter,
LovelaceHeaderFooterConstructor,
LovelaceRowConstructor,
} from "../types";

Expand Down Expand Up @@ -45,7 +46,7 @@ interface CreateElementConfigTypes {
"header-footer": {
config: LovelaceHeaderFooterConfig;
element: LovelaceHeaderFooter;
constructor: unknown;
constructor: LovelaceHeaderFooterConstructor;
};
view: {
config: LovelaceViewConfig;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { LovelaceHeaderFooterConfig } from "../header-footer/types";
import { createLovelaceElement } from "./create-element-base";
import {
createLovelaceElement,
getLovelaceElementClass,
} from "./create-element-base";

const LAZY_LOAD_TYPES = {
picture: () => import("../header-footer/hui-picture-header-footer"),
Expand All @@ -16,3 +19,6 @@ export const createHeaderFooterElement = (config: LovelaceHeaderFooterConfig) =>
undefined,
undefined
);

export const getHeaderFooterElementClass = (type: string) =>
getLovelaceElementClass(type, "header-footer", undefined, LAZY_LOAD_TYPES);
25 changes: 25 additions & 0 deletions src/panels/lovelace/editor/card-editor/hui-card-element-editor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { customElement } from "lit-element";
import type { LovelaceCardConfig } from "../../../../data/lovelace";
import { getCardElementClass } from "../../create-element/create-card-element";
import type { LovelaceCardEditor } from "../../types";
import { HuiElementEditor } from "../hui-element-editor";

@customElement("hui-card-element-editor")
export class HuiCardElementEditor extends HuiElementEditor<LovelaceCardConfig> {
protected async getConfigElement(): Promise<LovelaceCardEditor | undefined> {
const elClass = await getCardElementClass(this.configElementType!);

// Check if a GUI editor exists
if (elClass && elClass.getConfigElement) {
return elClass.getConfigElement();
}

return undefined;
}
}

declare global {
interface HTMLElementTagNameMap {
"hui-card-element-editor": HuiCardElementEditor;
}
}
15 changes: 7 additions & 8 deletions src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ import type { HomeAssistant } from "../../../../types";
import { showSaveSuccessToast } from "../../../../util/toast-saved-success";
import { addCard, replaceCard } from "../config-util";
import { getCardDocumentationURL } from "../get-card-documentation-url";
import "../hui-element-editor";
import type {
ConfigChangedEvent,
HuiElementEditor,
} from "../hui-element-editor";
import type { ConfigChangedEvent } from "../hui-element-editor";
import type { GUIModeChangedEvent } from "../types";
import "./hui-card-element-editor";
import type { HuiCardElementEditor } from "./hui-card-element-editor";
import "./hui-card-preview";
import type { EditCardDialogParams } from "./show-edit-card-dialog";

Expand Down Expand Up @@ -66,7 +64,8 @@ export class HuiDialogEditCard extends LitElement

@internalProperty() private _guiModeAvailable? = true;

@query("hui-element-editor") private _cardEditorEl?: HuiElementEditor;
@query("hui-card-element-editor")
private _cardEditorEl?: HuiCardElementEditor;

@internalProperty() private _GUImode = true;

Expand Down Expand Up @@ -184,14 +183,14 @@ export class HuiDialogEditCard extends LitElement
</div>
<div class="content">
<div class="element-editor">
<hui-element-editor
<hui-card-element-editor
.hass=${this.hass}
.lovelace=${this._params.lovelaceConfig}
.value=${this._cardConfig}
@config-changed=${this._handleConfigChanged}
@GUImode-changed=${this._handleGUIModeChanged}
@editor-save=${this._save}
></hui-element-editor>
></hui-card-element-editor>
</div>
<div class="element-preview">
<hui-card-preview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ import { LovelaceCardConfig, LovelaceConfig } from "../../../../data/lovelace";
import { HomeAssistant } from "../../../../types";
import { ConditionalCardConfig } from "../../cards/types";
import { LovelaceCardEditor } from "../../types";
import "../card-editor/hui-card-element-editor";
import type { HuiCardElementEditor } from "../card-editor/hui-card-element-editor";
import "../card-editor/hui-card-picker";
import "../hui-element-editor";
import type {
ConfigChangedEvent,
HuiElementEditor,
} from "../hui-element-editor";
import type { ConfigChangedEvent } from "../hui-element-editor";
import { GUIModeChangedEvent } from "../types";
import { configElementStyle } from "./config-elements-style";

Expand Down Expand Up @@ -53,7 +52,8 @@ export class HuiConditionalCardEditor extends LitElement

@internalProperty() private _cardTab = false;

@query("hui-element-editor") private _cardEditorEl?: HuiElementEditor;
@query("hui-card-element-editor")
private _cardEditorEl?: HuiCardElementEditor;

public setConfig(config: ConditionalCardConfig): void {
assert(config, cardConfigStruct);
Expand Down Expand Up @@ -108,13 +108,13 @@ export class HuiConditionalCardEditor extends LitElement
)}</mwc-button
>
</div>
<hui-element-editor
<hui-card-element-editor
.hass=${this.hass}
.value=${this._config.card}
.lovelace=${this.lovelace}
@config-changed=${this._handleCardChanged}
@GUImode-changed=${this._handleGUIModeChanged}
></hui-element-editor>
></hui-card-element-editor>
`
: html`
<hui-card-picker
Expand Down
Loading