From 2c975d4f41ed7a70f9762abee528ef443e4683c9 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Tue, 3 Sep 2024 18:20:55 +0200 Subject: [PATCH] Add advanced yaml only row_span option for sections (#21833) --- src/data/lovelace/config/section.ts | 1 + src/panels/lovelace/views/hui-sections-view.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/data/lovelace/config/section.ts b/src/data/lovelace/config/section.ts index 4c57cc63e4..d9f1065530 100644 --- a/src/data/lovelace/config/section.ts +++ b/src/data/lovelace/config/section.ts @@ -6,6 +6,7 @@ export interface LovelaceBaseSectionConfig { title?: string; visibility?: Condition[]; column_span?: number; + row_span?: number; } export interface LovelaceSectionConfig extends LovelaceBaseSectionConfig { diff --git a/src/panels/lovelace/views/hui-sections-view.ts b/src/panels/lovelace/views/hui-sections-view.ts index eb806b625f..6a4851ab0e 100644 --- a/src/panels/lovelace/views/hui-sections-view.ts +++ b/src/panels/lovelace/views/hui-sections-view.ts @@ -166,6 +166,8 @@ export class SectionsView extends LitElement implements LovelaceViewElement { maxColumnCount ); + const rowSpan = sectionConfig?.row_span || 1; + (section as any).itemPath = [idx]; return html` @@ -173,6 +175,7 @@ export class SectionsView extends LitElement implements LovelaceViewElement { class="section" style=${styleMap({ "--column-span": columnSpan, + "--row-span": rowSpan, })} > ${ @@ -332,6 +335,7 @@ export class SectionsView extends LitElement implements LovelaceViewElement { .section { border-radius: var(--ha-card-border-radius, 12px); grid-column: span var(--column-span); + grid-row: span var(--row-span); } .section:has(hui-section[hidden]) {