thomasloven / lovelace-layout-card

🔹 Get more control over the placement of lovelace cards.
MIT License
1.08k stars 127 forks source link

View Layout Grid - Differences between v2.1.1 and v2.2 #126

Closed woodmj74 closed 3 years ago

woodmj74 commented 3 years ago

My Home Assistant version: 2021.3.4

Layout-card version (FROM BROWSER CONSOLE): v2.2 (and tested in v2.1.1)

What I am doing:

Using the Grid Layout at view level, the alignment of grid-cells has changed between v2.1.1 and v2.2. In the earlier version the grid cells were distributed from a central alignment, in v2.2 this has moved to a left alignment.

Happy to accept this is now expected behaviour but reporting as it has changed between minor versions within v2.

What I expected to happen:

The layout behaviour to be common between the two versions. Screen shot of v2.1.1: image

What happened instead:

The alignment of the grid cells moved to the left. Screen shot of v2.2 (with necessary YAML revisions made): image

Minimal steps to reproduce:

View configuration - common between v2.1.1 and v2.2:

    panel: false
    type: 'custom:grid-layout'
    layout:
      grid-template-columns: 30% 30% 30%
      grid-template-rows: 10px auto
      grid-template-areas: |
        ". . ."
        "p11 p12 p13"
        "p21 p21 p23"
        "p31 p32 p33"
      mediaquery:
        '(max-width: 800px)':
          grid-template-columns: 95%
          grid-template-areas: |
            "p11"
            "p12"
            "p13"
            "p21"
            "p22"
            "p23"
            "p31"
            "p32"
            "p33"

Sample card configuration in v2.1.1:

type: 'custom:mini-graph-card'
name: Temperature
entities:
  - entity: sensor.lounge_temperature
  - entity: sensor.landing_temperature
  - entity: sensor.roof_temperature
show:
  state: false
  fill: false
layout:
  grid-area: p21
style: |
  ha-card {
    opacity: 80%
  }

The same card configured in v2.2:

type: 'custom:mini-graph-card'
name: Temperature
entities:
  - entity: sensor.lounge_temperature
  - entity: sensor.landing_temperature
  - entity: sensor.roof_temperature
show:
  state: false
  fill: false
view_layout:
  grid-area: p21
style: |
  ha-card {
    opacity: 80%
  }

Error messages from the browser console:

Seen in both v2.1.1 and v2.2:

layout-card.js:40 Uncaught (in promise) TypeError: Cannot read property 'style' of null
    at HTMLElement._setGridStyles (:8123/hacsfiles/lovelace-layout-card/layout-card.js:40)
    at HTMLElement.setConfig (:8123/hacsfiles/lovelace-layout-card/layout-card.js:40)

By putting an X in the boxes ([X]) below, I indicate that I:

thomasloven commented 3 years ago

Since 2.2.0, the layout is stretched to the entire width rather than centered. Trust me, that fixes more issues than it causes.

You'll need a 5% width column to the left to get it like before.

Release 2.2.0 is also titled as being breaking.