diff --git a/pyproject.toml b/pyproject.toml index 5d879a754a..5d0717ac3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20250506.0" +version = "20250507.0" license = "Apache-2.0" license-files = ["LICENSE*"] description = "The Home Assistant frontend" diff --git a/src/common/controllers/drag-scroll-controller.ts b/src/common/controllers/drag-scroll-controller.ts index cefb9adad5..c7f5349585 100644 --- a/src/common/controllers/drag-scroll-controller.ts +++ b/src/common/controllers/drag-scroll-controller.ts @@ -9,6 +9,7 @@ import type { LitElement } from "lit"; */ export interface DragScrollControllerConfig { selector: string; + enabled?: boolean; } export class DragScrollController implements ReactiveController { @@ -28,19 +29,47 @@ export class DragScrollController implements ReactiveController { private _scrollContainer?: HTMLElement | null; + private _enabled = true; + + public get enabled(): boolean { + return this._enabled; + } + + public set enabled(value: boolean) { + if (value === this._enabled) { + return; + } + this._enabled = value; + if (this._enabled) { + this._attach(); + } else { + this._detach(); + } + this._host.requestUpdate(); + } + constructor( host: ReactiveControllerHost & LitElement, - { selector }: DragScrollControllerConfig + { selector, enabled }: DragScrollControllerConfig ) { this._selector = selector; this._host = host; + this.enabled = enabled ?? true; host.addController(this); } hostUpdated() { - if (this._scrollContainer) { + if (!this.enabled || this._scrollContainer) { return; } + this._attach(); + } + + hostDisconnected() { + this._detach(); + } + + private _attach() { this._scrollContainer = this._host.renderRoot?.querySelector( this._selector ); @@ -49,9 +78,18 @@ export class DragScrollController implements ReactiveController { } } - hostDisconnected() { + private _detach() { window.removeEventListener("mousemove", this._mouseMove); window.removeEventListener("mouseup", this._mouseUp); + if (this._scrollContainer) { + this._scrollContainer.removeEventListener("mousedown", this._mouseDown); + this._scrollContainer = undefined; + } + this.scrolled = false; + this.scrolling = false; + this.mouseIsDown = false; + this.scrollStartX = 0; + this.scrollLeft = 0; } private _mouseDown = (event: MouseEvent) => { diff --git a/src/components/chart/ha-chart-base.ts b/src/components/chart/ha-chart-base.ts index 0fae4ecc53..fab103ebc2 100644 --- a/src/components/chart/ha-chart-base.ts +++ b/src/components/chart/ha-chart-base.ts @@ -600,12 +600,32 @@ export class HaChartBase extends LitElement { } private _getSeries() { - if (!Array.isArray(this.data)) { - return this.data; - } - return this.data.filter( + const series = ensureArray(this.data).filter( (d) => !this._hiddenDatasets.has(String(d.name ?? d.id)) ); + const yAxis = (this.options?.yAxis?.[0] ?? this.options?.yAxis) as + | YAXisOption + | undefined; + if (yAxis?.type === "log") { + // set <=0 values to null so they render as gaps on a log graph + return series.map((d) => + d.type === "line" + ? { + ...d, + data: d.data?.map((v) => + Array.isArray(v) + ? [ + v[0], + typeof v[1] !== "number" || v[1] > 0 ? v[1] : null, + ...v.slice(2), + ] + : v + ), + } + : d + ); + } + return series; } private _getDefaultHeight() { diff --git a/src/components/search-input-outlined.ts b/src/components/search-input-outlined.ts index bc43b88ecc..44eca97e29 100644 --- a/src/components/search-input-outlined.ts +++ b/src/components/search-input-outlined.ts @@ -85,7 +85,6 @@ class SearchInputOutlined extends LitElement { display: inline-flex; /* For iOS */ z-index: 0; - --mdc-icon-button-size: 24px; } ha-outlined-text-field { display: block; @@ -94,6 +93,8 @@ class SearchInputOutlined extends LitElement { } ha-svg-icon, ha-icon-button { + --mdc-icon-button-size: 24px; + height: var(--mdc-icon-button-size); display: flex; color: var(--primary-text-color); } diff --git a/src/panels/lovelace/badges/hui-view-badges.ts b/src/panels/lovelace/badges/hui-view-badges.ts index f04d33a59c..68d708fa2a 100644 --- a/src/panels/lovelace/badges/hui-view-badges.ts +++ b/src/panels/lovelace/badges/hui-view-badges.ts @@ -206,12 +206,29 @@ export class HuiViewBadges extends LitElement { margin: 0; } - .badges > * { - min-width: fit-content; + /* Use before and after because padding doesn't work well with scrolling */ + .badges::before, + .badges::after { + content: ""; + position: relative; + display: block; + min-width: var(--badge-padding, 0px); + height: 16px; + background-color: transparent; + } + .badges::before { + margin-left: -8px; + margin-inline-start: -8px; + margin-inline-end: 0; + } + .badges::after { + margin-right: -8px; + margin-inline-end: -8px; + margin-inline-start: 0; } - .badges > *:last-child:not(.add) { - padding-right: var(--badges-padding-right, 0); + .badges > * { + min-width: fit-content; } hui-badge-edit-mode { diff --git a/src/panels/lovelace/cards/hui-statistics-graph-card.ts b/src/panels/lovelace/cards/hui-statistics-graph-card.ts index 061f8f9b64..d7be2a06d2 100644 --- a/src/panels/lovelace/cards/hui-statistics-graph-card.ts +++ b/src/panels/lovelace/cards/hui-statistics-graph-card.ts @@ -268,6 +268,7 @@ export class HuiStatisticsGraphCard extends LitElement implements LovelaceCard {
0; @@ -258,10 +267,7 @@ export class HuiViewHeader extends LitElement { ${this.lovelace && (editMode || this.badges.length > 0) ? html`