mirror of
https://github.com/home-assistant/frontend.git
synced 2026-01-13 02:37:29 +00:00
Compare commits
7 Commits
20260107.0
...
rc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
905435db3e | ||
|
|
ea73fd3f01 | ||
|
|
e519a0203e | ||
|
|
d98ee7e0b5 | ||
|
|
6fc8c17909 | ||
|
|
201169c3d8 | ||
|
|
303538ac21 |
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "home-assistant-frontend"
|
||||
version = "20260107.0"
|
||||
version = "20260107.1"
|
||||
license = "Apache-2.0"
|
||||
license-files = ["LICENSE*"]
|
||||
description = "The Home Assistant frontend"
|
||||
|
||||
@@ -79,7 +79,7 @@ export const generateColorPalette = (
|
||||
}
|
||||
|
||||
return steps.map((step) => {
|
||||
const name = `color-${label}-${step}`;
|
||||
const name = `ha-color-${label}-${step}`;
|
||||
|
||||
// Base color at 50%
|
||||
if (step === 50) {
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
import type { Selector } from "../../data/selector";
|
||||
import type { HaFormSchema } from "./types";
|
||||
import type { HaFormData, HaFormSchema } from "./types";
|
||||
|
||||
const setDefaultValue = (
|
||||
field: HaFormSchema,
|
||||
value: HaFormData | undefined
|
||||
) => {
|
||||
if ("selector" in field && "choose" in field.selector) {
|
||||
const firstChoice = Object.keys(field.selector.choose.choices)[0];
|
||||
if (firstChoice) {
|
||||
return {
|
||||
active_choice: firstChoice,
|
||||
[firstChoice]: value,
|
||||
};
|
||||
}
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
export const computeInitialHaFormData = (
|
||||
schema: HaFormSchema[] | readonly HaFormSchema[]
|
||||
@@ -10,9 +26,12 @@ export const computeInitialHaFormData = (
|
||||
field.description?.suggested_value !== undefined &&
|
||||
field.description?.suggested_value !== null
|
||||
) {
|
||||
data[field.name] = field.description.suggested_value;
|
||||
data[field.name] = setDefaultValue(
|
||||
field,
|
||||
field.description.suggested_value
|
||||
);
|
||||
} else if ("default" in field) {
|
||||
data[field.name] = field.default;
|
||||
data[field.name] = setDefaultValue(field, field.default);
|
||||
} else if (field.type === "expandable") {
|
||||
const expandableData = computeInitialHaFormData(field.schema);
|
||||
if (field.required || Object.keys(expandableData).length) {
|
||||
@@ -108,6 +127,21 @@ export const computeInitialHaFormData = (
|
||||
data[field.name] = {};
|
||||
} else if ("state" in selector) {
|
||||
data[field.name] = selector.state?.multiple ? [] : "";
|
||||
} else if ("choose" in selector) {
|
||||
const firstChoice = Object.keys(selector.choose.choices)[0];
|
||||
if (!firstChoice) {
|
||||
data[field.name] = {};
|
||||
} else {
|
||||
data[field.name] = {
|
||||
active_choice: firstChoice,
|
||||
[firstChoice]: computeInitialHaFormData([
|
||||
{
|
||||
name: firstChoice,
|
||||
selector: selector.choose.choices[firstChoice].selector,
|
||||
},
|
||||
])[firstChoice],
|
||||
};
|
||||
}
|
||||
} else {
|
||||
throw new Error(
|
||||
`Selector ${Object.keys(selector)[0]} not supported in initial form data`
|
||||
|
||||
@@ -38,6 +38,13 @@ export class HaChooseSelector extends LitElement {
|
||||
) {
|
||||
this._setActiveChoice();
|
||||
}
|
||||
if (
|
||||
changedProperties.has("value") &&
|
||||
changedProperties.get("value")?.active_choice &&
|
||||
changedProperties.get("value")?.active_choice !== this._activeChoice
|
||||
) {
|
||||
this._setActiveChoice();
|
||||
}
|
||||
}
|
||||
|
||||
protected render() {
|
||||
|
||||
@@ -57,6 +57,7 @@ export class HaSlider extends Slider {
|
||||
#thumb {
|
||||
border: none;
|
||||
background-color: var(--ha-slider-thumb-color, var(--primary-color));
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#thumb:after {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { ActionDetail } from "@material/mwc-list";
|
||||
import {
|
||||
mdiAlphaABoxOutline,
|
||||
mdiArrowLeft,
|
||||
mdiClose,
|
||||
mdiDotsVertical,
|
||||
mdiGrid,
|
||||
@@ -24,6 +23,7 @@ import type { HomeAssistant } from "../../types";
|
||||
import "../ha-dialog";
|
||||
import "../ha-dialog-header";
|
||||
import "../ha-list-item";
|
||||
import "../ha-icon-button-arrow-prev";
|
||||
import "./ha-media-manage-button";
|
||||
import "./ha-media-player-browse";
|
||||
import type {
|
||||
@@ -88,11 +88,10 @@ class DialogMediaPlayerBrowse extends LitElement {
|
||||
<ha-dialog-header show-border slot="heading">
|
||||
${this._navigateIds.length > (this._params.minimumNavigateLevel ?? 1)
|
||||
? html`
|
||||
<ha-icon-button
|
||||
<ha-icon-button-arrow-prev
|
||||
slot="navigationIcon"
|
||||
.path=${mdiArrowLeft}
|
||||
@click=${this._goBack}
|
||||
></ha-icon-button>
|
||||
></ha-icon-button-arrow-prev>
|
||||
`
|
||||
: nothing}
|
||||
<span slot="title">
|
||||
|
||||
@@ -7,6 +7,11 @@ const calcPoints = (
|
||||
height: number,
|
||||
limits?: { minX?: number; maxX?: number; minY?: number; maxY?: number }
|
||||
) => {
|
||||
// handling empty history (for example unavailable for long time)
|
||||
if (history.length === 0) {
|
||||
return { points: [], yAxisOrigin: height };
|
||||
}
|
||||
|
||||
let yAxisOrigin = height;
|
||||
let minY = limits?.minY ?? history[0][1];
|
||||
let maxY = limits?.maxY ?? history[0][1];
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { ActionDetail } from "@material/mwc-list";
|
||||
import {
|
||||
mdiAlphaABoxOutline,
|
||||
mdiArrowLeft,
|
||||
mdiDotsVertical,
|
||||
mdiGrid,
|
||||
mdiListBoxOutline,
|
||||
@@ -97,7 +96,6 @@ class PanelMediaBrowser extends LitElement {
|
||||
? html`
|
||||
<ha-icon-button-arrow-prev
|
||||
slot="navigationIcon"
|
||||
.path=${mdiArrowLeft}
|
||||
@click=${this._goBack}
|
||||
></ha-icon-button-arrow-prev>
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user