mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-01 13:37:47 +00:00
save it
This commit is contained in:
parent
9b279632f8
commit
2fef57f0b2
@ -38,7 +38,6 @@ export class HuiGridCardOptions extends LitElement {
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<slot></slot>
|
||||
|
||||
<div class="parent-card-actions">
|
||||
<div class="overlay"></div>
|
||||
<div class="card-actions">
|
||||
@ -73,18 +72,17 @@ export class HuiGridCardOptions extends LitElement {
|
||||
aria-label=${this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.edit_card.options"
|
||||
)}
|
||||
title=${this.hass!.localize(
|
||||
.title=${this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.edit_card.options"
|
||||
)}
|
||||
>
|
||||
<ha-svg-icon path=${mdiDotsVertical}></ha-svg-icon>
|
||||
<ha-svg-icon .path=${mdiDotsVertical}></ha-svg-icon>
|
||||
</mwc-icon-button>
|
||||
|
||||
<mwc-list-item>
|
||||
${this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.edit_card.move"
|
||||
)}</mwc-list-item
|
||||
>
|
||||
)}
|
||||
</mwc-list-item>
|
||||
</ha-button-menu>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -26,6 +26,7 @@ import type { HomeAssistant } from "../../../types";
|
||||
import { computeCardSize } from "../common/compute-card-size";
|
||||
import { HuiCardOptions } from "../components/hui-card-options";
|
||||
import { showCreateCardDialog } from "../editor/card-editor/show-create-card-dialog";
|
||||
import { replaceView } from "../editor/config-util";
|
||||
import type { Lovelace, LovelaceBadge, LovelaceCard } from "../types";
|
||||
import { HuiGridCardOptions } from "./grid/hui-grid-card-options";
|
||||
|
||||
@ -113,7 +114,7 @@ export class GridView extends LitElement implements LovelaceViewElement {
|
||||
.columns=${this._columns}
|
||||
.dragDisabled=${!this.lovelace?.editMode}
|
||||
.resizeDisabled=${!this.lovelace?.editMode}
|
||||
@layout-changed=${(ev) => console.log(ev.detail)}
|
||||
@item-changed=${this._saveLayout}
|
||||
></lit-grid-layout>
|
||||
${this.lovelace?.editMode
|
||||
? html`
|
||||
@ -183,6 +184,18 @@ export class GridView extends LitElement implements LovelaceViewElement {
|
||||
}
|
||||
}
|
||||
|
||||
private async _saveLayout(ev: CustomEvent): Promise<void> {
|
||||
console.log("save");
|
||||
|
||||
const viewConf: LovelaceViewConfig = {
|
||||
...this._config,
|
||||
layout: ev.detail.layout,
|
||||
};
|
||||
await this.lovelace?.saveConfig(
|
||||
replaceView(this.lovelace!.config, this.index, viewConf)
|
||||
);
|
||||
}
|
||||
|
||||
private _itemRenderer = (key: string): TemplateResult => {
|
||||
if (!this._cards) {
|
||||
return html``;
|
||||
|
Loading…
x
Reference in New Issue
Block a user