From cefb3c3f010bbb5fb942083767557840a616cc98 Mon Sep 17 00:00:00 2001 From: Zack Arnett Date: Sat, 12 Dec 2020 16:00:14 -0600 Subject: [PATCH] Layout Structs --- .../editor/config-elements/hui-alarm-panel-card-editor.ts | 1 + .../editor/config-elements/hui-button-card-editor.ts | 1 + .../editor/config-elements/hui-calendar-card-editor.ts | 1 + .../editor/config-elements/hui-conditional-card-editor.ts | 1 + .../editor/config-elements/hui-entities-card-editor.ts | 1 + .../editor/config-elements/hui-entity-card-editor.ts | 1 + .../lovelace/editor/config-elements/hui-gauge-card-editor.ts | 1 + .../editor/config-elements/hui-glance-card-editor.ts | 1 + .../editor/config-elements/hui-history-graph-card-editor.ts | 1 + .../editor/config-elements/hui-humidifier-card-editor.ts | 1 + .../editor/config-elements/hui-iframe-card-editor.ts | 1 + .../lovelace/editor/config-elements/hui-light-card-editor.ts | 1 + .../editor/config-elements/hui-logbook-card-editor.ts | 1 + .../lovelace/editor/config-elements/hui-map-card-editor.ts | 1 + .../editor/config-elements/hui-markdown-card-editor.ts | 1 + .../editor/config-elements/hui-media-control-card-editor.ts | 5 +++-- .../editor/config-elements/hui-picture-card-editor.ts | 1 + .../editor/config-elements/hui-picture-entity-card-editor.ts | 1 + .../editor/config-elements/hui-picture-glance-card-editor.ts | 1 + .../editor/config-elements/hui-plant-status-card-editor.ts | 1 + .../editor/config-elements/hui-sensor-card-editor.ts | 1 + .../editor/config-elements/hui-shopping-list-editor.ts | 5 +++-- .../lovelace/editor/config-elements/hui-stack-card-editor.ts | 5 +++-- .../editor/config-elements/hui-thermostat-card-editor.ts | 1 + .../config-elements/hui-weather-forecast-card-editor.ts | 3 ++- 25 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/panels/lovelace/editor/config-elements/hui-alarm-panel-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-alarm-panel-card-editor.ts index f21af05f04..d646857793 100644 --- a/src/panels/lovelace/editor/config-elements/hui-alarm-panel-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-alarm-panel-card-editor.ts @@ -28,6 +28,7 @@ const cardConfigStruct = object({ name: optional(string()), states: optional(array()), theme: optional(string()), + layout: optional(object()), }); const includeDomains = ["alarm_control_panel"]; diff --git a/src/panels/lovelace/editor/config-elements/hui-button-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-button-card-editor.ts index 544f5af0f0..26cbd82f70 100644 --- a/src/panels/lovelace/editor/config-elements/hui-button-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-button-card-editor.ts @@ -37,6 +37,7 @@ const cardConfigStruct = object({ hold_action: optional(actionConfigStruct), theme: optional(string()), show_state: optional(boolean()), + layout: optional(object()), }); const actions = [ diff --git a/src/panels/lovelace/editor/config-elements/hui-calendar-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-calendar-card-editor.ts index 0dad4b531b..ac1c8ed9fb 100644 --- a/src/panels/lovelace/editor/config-elements/hui-calendar-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-calendar-card-editor.ts @@ -32,6 +32,7 @@ const cardConfigStruct = object({ initial_view: optional(string()), theme: optional(string()), entities: array(string()), + layout: optional(object()), }); const views = ["dayGridMonth", "dayGridDay", "listWeek"]; diff --git a/src/panels/lovelace/editor/config-elements/hui-conditional-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-conditional-card-editor.ts index be9b8e943b..95c8407a26 100644 --- a/src/panels/lovelace/editor/config-elements/hui-conditional-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-conditional-card-editor.ts @@ -36,6 +36,7 @@ const cardConfigStruct = object({ type: string(), card: any(), conditions: optional(array(conditionStruct)), + layout: optional(object()), }); @customElement("hui-conditional-card-editor") diff --git a/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts index 8fbbcc7a6b..9aa864d224 100644 --- a/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts @@ -55,6 +55,7 @@ const cardConfigStruct = object({ entities: array(entitiesConfigStruct), header: optional(headerFooterConfigStructs), footer: optional(headerFooterConfigStructs), + layout: optional(object()), }); @customElement("hui-entities-card-editor") diff --git a/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts index 1c1e0aeb0b..dce2354453 100644 --- a/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts @@ -32,6 +32,7 @@ const cardConfigStruct = object({ unit: optional(string()), theme: optional(string()), footer: optional(headerFooterConfigStructs), + layout: optional(object()), }); @customElement("hui-entity-card-editor") diff --git a/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts index 613a278f01..64149b74c5 100644 --- a/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts @@ -31,6 +31,7 @@ const cardConfigStruct = object({ max: optional(number()), severity: optional(object()), theme: optional(string()), + layout: optional(object()), }); const includeDomains = ["sensor"]; diff --git a/src/panels/lovelace/editor/config-elements/hui-glance-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-glance-card-editor.ts index 9372cba30b..78cbf15f8d 100644 --- a/src/panels/lovelace/editor/config-elements/hui-glance-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-glance-card-editor.ts @@ -50,6 +50,7 @@ const cardConfigStruct = object({ show_icon: optional(boolean()), state_color: optional(boolean()), entities: array(entitiesConfigStruct), + layout: optional(object()), }); @customElement("hui-glance-card-editor") diff --git a/src/panels/lovelace/editor/config-elements/hui-history-graph-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-history-graph-card-editor.ts index f7bf34b99b..c25b7ca53c 100644 --- a/src/panels/lovelace/editor/config-elements/hui-history-graph-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-history-graph-card-editor.ts @@ -42,6 +42,7 @@ const cardConfigStruct = object({ title: optional(string()), hours_to_show: optional(number()), refresh_interval: optional(number()), + layout: optional(object()), }); @customElement("hui-history-graph-card-editor") diff --git a/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts index a6ebb008b1..74559789c6 100644 --- a/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts @@ -23,6 +23,7 @@ const cardConfigStruct = object({ entity: string(), name: optional(string()), theme: optional(string()), + layout: optional(object()), }); const includeDomains = ["humidifier"]; diff --git a/src/panels/lovelace/editor/config-elements/hui-iframe-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-iframe-card-editor.ts index a4b64e1894..e2a4a6515a 100644 --- a/src/panels/lovelace/editor/config-elements/hui-iframe-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-iframe-card-editor.ts @@ -21,6 +21,7 @@ const cardConfigStruct = object({ title: optional(string()), url: optional(string()), aspect_ratio: optional(string()), + layout: optional(object()), }); @customElement("hui-iframe-card-editor") diff --git a/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts index 3a21299e95..a4fff5e704 100644 --- a/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts @@ -30,6 +30,7 @@ const cardConfigStruct = object({ icon: optional(string()), hold_action: optional(actionConfigStruct), double_tap_action: optional(actionConfigStruct), + layout: optional(object()), }); const includeDomains = ["light"]; diff --git a/src/panels/lovelace/editor/config-elements/hui-logbook-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-logbook-card-editor.ts index a0a83acd35..e4ba209bc0 100644 --- a/src/panels/lovelace/editor/config-elements/hui-logbook-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-logbook-card-editor.ts @@ -26,6 +26,7 @@ const cardConfigStruct = object({ title: optional(string()), hours_to_show: optional(number()), theme: optional(string()), + layout: optional(object()), }); @customElement("hui-logbook-card-editor") diff --git a/src/panels/lovelace/editor/config-elements/hui-map-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-map-card-editor.ts index ff7d92d3ab..6cfcab057c 100644 --- a/src/panels/lovelace/editor/config-elements/hui-map-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-map-card-editor.ts @@ -46,6 +46,7 @@ const cardConfigStruct = object({ entities: array(entitiesConfigStruct), hours_to_show: optional(number()), geo_location_sources: optional(array()), + layout: optional(object()), }); @customElement("hui-map-card-editor") diff --git a/src/panels/lovelace/editor/config-elements/hui-markdown-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-markdown-card-editor.ts index 1fde251a1d..085656dfdd 100644 --- a/src/panels/lovelace/editor/config-elements/hui-markdown-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-markdown-card-editor.ts @@ -23,6 +23,7 @@ const cardConfigStruct = object({ title: optional(string()), content: string(), theme: optional(string()), + layout: optional(object()), }); @customElement("hui-markdown-card-editor") diff --git a/src/panels/lovelace/editor/config-elements/hui-media-control-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-media-control-card-editor.ts index fa13a3c860..2f519ccf61 100644 --- a/src/panels/lovelace/editor/config-elements/hui-media-control-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-media-control-card-editor.ts @@ -1,22 +1,23 @@ import { customElement, html, + internalProperty, LitElement, property, - internalProperty, TemplateResult, } from "lit-element"; +import { assert, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/entity/ha-entity-picker"; import { HomeAssistant } from "../../../../types"; import { MediaControlCardConfig } from "../../cards/types"; import { LovelaceCardEditor } from "../../types"; import { EditorTarget, EntitiesEditorEvent } from "../types"; -import { assert, object, string, optional } from "superstruct"; const cardConfigStruct = object({ type: string(), entity: optional(string()), + layout: optional(object()), }); const includeDomains = ["media_player"]; diff --git a/src/panels/lovelace/editor/config-elements/hui-picture-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-picture-card-editor.ts index 26d66d2baf..ab88b751e3 100644 --- a/src/panels/lovelace/editor/config-elements/hui-picture-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-picture-card-editor.ts @@ -25,6 +25,7 @@ const cardConfigStruct = object({ tap_action: optional(actionConfigStruct), hold_action: optional(actionConfigStruct), theme: optional(string()), + layout: optional(object()), }); @customElement("hui-picture-card-editor") diff --git a/src/panels/lovelace/editor/config-elements/hui-picture-entity-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-picture-entity-card-editor.ts index 927d233888..0def950984 100644 --- a/src/panels/lovelace/editor/config-elements/hui-picture-entity-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-picture-entity-card-editor.ts @@ -39,6 +39,7 @@ const cardConfigStruct = object({ show_name: optional(boolean()), show_state: optional(boolean()), theme: optional(string()), + layout: optional(object()), }); const includeDomains = ["camera"]; diff --git a/src/panels/lovelace/editor/config-elements/hui-picture-glance-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-picture-glance-card-editor.ts index 43d4816e03..5fd39828a8 100644 --- a/src/panels/lovelace/editor/config-elements/hui-picture-glance-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-picture-glance-card-editor.ts @@ -42,6 +42,7 @@ const cardConfigStruct = object({ hold_action: optional(actionConfigStruct), entities: array(entitiesConfigStruct), theme: optional(string()), + layout: optional(object()), }); const includeDomains = ["camera"]; diff --git a/src/panels/lovelace/editor/config-elements/hui-plant-status-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-plant-status-card-editor.ts index 5c89dfd149..a102bb2b84 100644 --- a/src/panels/lovelace/editor/config-elements/hui-plant-status-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-plant-status-card-editor.ts @@ -24,6 +24,7 @@ const cardConfigStruct = object({ entity: string(), name: optional(string()), theme: optional(string()), + layout: optional(object()), }); const includeDomains = ["plant"]; diff --git a/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts index a625fc5829..d9559de43e 100644 --- a/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts @@ -35,6 +35,7 @@ const cardConfigStruct = object({ detail: optional(number()), theme: optional(string()), hours_to_show: optional(number()), + layout: optional(object()), }); const includeDomains = ["sensor"]; diff --git a/src/panels/lovelace/editor/config-elements/hui-shopping-list-editor.ts b/src/panels/lovelace/editor/config-elements/hui-shopping-list-editor.ts index f82fb7e9bb..aca696582e 100644 --- a/src/panels/lovelace/editor/config-elements/hui-shopping-list-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-shopping-list-editor.ts @@ -4,11 +4,12 @@ import { CSSResult, customElement, html, + internalProperty, LitElement, property, - internalProperty, TemplateResult, } from "lit-element"; +import { assert, object, optional, string } from "superstruct"; import { isComponentLoaded } from "../../../../common/config/is_component_loaded"; import { fireEvent } from "../../../../common/dom/fire_event"; import { HomeAssistant } from "../../../../types"; @@ -16,12 +17,12 @@ import { ShoppingListCardConfig } from "../../cards/types"; import "../../components/hui-theme-select-editor"; import { LovelaceCardEditor } from "../../types"; import { EditorTarget, EntitiesEditorEvent } from "../types"; -import { string, assert, object, optional } from "superstruct"; const cardConfigStruct = object({ type: string(), title: optional(string()), theme: optional(string()), + layout: optional(object()), }); @customElement("hui-shopping-list-card-editor") diff --git a/src/panels/lovelace/editor/config-elements/hui-stack-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-stack-card-editor.ts index 20519718df..b69a6afee7 100644 --- a/src/panels/lovelace/editor/config-elements/hui-stack-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-stack-card-editor.ts @@ -16,11 +16,11 @@ import { any, array, assert, + boolean, + number, object, optional, string, - boolean, - number, } from "superstruct"; import { fireEvent, HASSDomEvent } from "../../../../common/dom/fire_event"; import { LovelaceCardConfig, LovelaceConfig } from "../../../../data/lovelace"; @@ -39,6 +39,7 @@ const cardConfigStruct = object({ title: optional(string()), square: optional(boolean()), columns: optional(number()), + layout: optional(object()), }); @customElement("hui-stack-card-editor") diff --git a/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts index 775b2c8e20..2cd89a671b 100644 --- a/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts @@ -23,6 +23,7 @@ const cardConfigStruct = object({ entity: string(), name: optional(string()), theme: optional(string()), + layout: optional(object()), }); const includeDomains = ["climate"]; diff --git a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts index 614a83c41b..0820c274fd 100644 --- a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts @@ -10,10 +10,10 @@ import { import { assert, boolean, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; import { computeRTLDirection } from "../../../../common/util/compute_rtl"; +import "../../../../components/entity/ha-entity-attribute-picker"; import "../../../../components/entity/ha-entity-picker"; import "../../../../components/ha-formfield"; import "../../../../components/ha-switch"; -import "../../../../components/entity/ha-entity-attribute-picker"; import { HomeAssistant } from "../../../../types"; import { WeatherForecastCardConfig } from "../../cards/types"; import "../../components/hui-theme-select-editor"; @@ -28,6 +28,7 @@ const cardConfigStruct = object({ theme: optional(string()), show_forecast: optional(boolean()), secondary_info_attribute: optional(string()), + layout: optional(object()), }); const includeDomains = ["weather"];