mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Take column span into account to determine the max number of columns (#21827)
This commit is contained in:
parent
87b58b0bbd
commit
2a18706a13
@ -47,7 +47,7 @@ export class SectionsView extends LitElement implements LovelaceViewElement {
|
|||||||
|
|
||||||
@state() private _config?: LovelaceViewConfig;
|
@state() private _config?: LovelaceViewConfig;
|
||||||
|
|
||||||
@state() private _sectionCount = 0;
|
@state() private _sectionColumnCount = 0;
|
||||||
|
|
||||||
@state() _dragging = false;
|
@state() _dragging = false;
|
||||||
|
|
||||||
@ -89,9 +89,10 @@ export class SectionsView extends LitElement implements LovelaceViewElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _computeSectionsCount() {
|
private _computeSectionsCount() {
|
||||||
this._sectionCount = this.sections.filter(
|
this._sectionColumnCount = this.sections
|
||||||
(section) => !section.hidden
|
.filter((section) => !section.hidden)
|
||||||
).length;
|
.map((section) => section.config.column_span ?? 1)
|
||||||
|
.reduce((acc, val) => acc + val, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _sectionVisibilityChanged = () => {
|
private _sectionVisibilityChanged = () => {
|
||||||
@ -125,7 +126,7 @@ export class SectionsView extends LitElement implements LovelaceViewElement {
|
|||||||
|
|
||||||
const sections = this.sections;
|
const sections = this.sections;
|
||||||
const totalSectionCount =
|
const totalSectionCount =
|
||||||
this._sectionCount + (this.lovelace?.editMode ? 1 : 0);
|
this._sectionColumnCount + (this.lovelace?.editMode ? 1 : 0);
|
||||||
const editMode = this.lovelace.editMode;
|
const editMode = this.lovelace.editMode;
|
||||||
|
|
||||||
const maxColumnCount = this._columnsController.value ?? 1;
|
const maxColumnCount = this._columnsController.value ?? 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user