mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Save columns as string (#2214)
* save columns as string * set type to number to convert to number before save
This commit is contained in:
parent
48220b67ed
commit
baeda622de
@ -93,6 +93,7 @@ export class HuiGlanceCardEditor extends hassLocalizeLitMixin(LitElement)
|
||||
></hui-theme-select-editor>
|
||||
<paper-input
|
||||
label="Columns"
|
||||
type="number"
|
||||
value="${this._columns}"
|
||||
.configValue="${"columns"}"
|
||||
@value-changed="${this._valueChanged}"
|
||||
@ -127,22 +128,21 @@ export class HuiGlanceCardEditor extends hassLocalizeLitMixin(LitElement)
|
||||
}
|
||||
const target = ev.target! as EditorTarget;
|
||||
|
||||
if (
|
||||
(target.configValue! === "title" && target.value === this._title) ||
|
||||
(target.configValue! === "theme" && target.value === this._theme) ||
|
||||
(target.configValue! === "columns" && target.value === this._columns)
|
||||
) {
|
||||
if (this[`_${target.configValue}`] === target.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev.detail && ev.detail.entities) {
|
||||
this._config.entities = ev.detail.entities;
|
||||
this._configEntities = processEditorEntities(this._config.entities);
|
||||
} else if (target.configValue) {
|
||||
let value: any = target.value;
|
||||
if (target.type === "number") {
|
||||
value = Number(value);
|
||||
}
|
||||
this._config = {
|
||||
...this._config,
|
||||
[target.configValue!]:
|
||||
target.checked !== undefined ? target.checked : target.value,
|
||||
target.checked !== undefined ? target.checked : value,
|
||||
};
|
||||
}
|
||||
fireEvent(this, "config-changed", { config: this._config });
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { LovelaceCardConfig, LovelaceViewConfig } from "../../../data/lovelace";
|
||||
import { EntityConfig } from "../entity-rows/types";
|
||||
import { InputType } from "zlib";
|
||||
|
||||
export interface YamlChangedEvent extends Event {
|
||||
detail: {
|
||||
@ -41,6 +42,7 @@ export interface EditorTarget extends EventTarget {
|
||||
index?: number;
|
||||
checked?: boolean;
|
||||
configValue?: string;
|
||||
type?: InputType;
|
||||
}
|
||||
|
||||
export interface CardPickTarget extends EventTarget {
|
||||
|
Loading…
x
Reference in New Issue
Block a user