mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 19:56:42 +00:00
Merge pull request #12045 from home-assistant/hot-fix-03142022
This commit is contained in:
commit
f9ccfa00a2
@ -78,6 +78,9 @@ class DemoCards extends LitElement {
|
|||||||
ha-formfield {
|
ha-formfield {
|
||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
}
|
}
|
||||||
|
#container {
|
||||||
|
background-color: var(--primary-background-color);
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,8 @@ export class HassioMain extends SupervisorBaseElement {
|
|||||||
this.parentElement,
|
this.parentElement,
|
||||||
this.hass.themes,
|
this.hass.themes,
|
||||||
themeName,
|
themeName,
|
||||||
themeSettings
|
themeSettings,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = home-assistant-frontend
|
name = home-assistant-frontend
|
||||||
version = 20220301.1
|
version = 20220301.2
|
||||||
author = The Home Assistant Authors
|
author = The Home Assistant Authors
|
||||||
author_email = hello@home-assistant.io
|
author_email = hello@home-assistant.io
|
||||||
license = Apache-2.0
|
license = Apache-2.0
|
||||||
|
@ -101,13 +101,19 @@ class HaAuthorize extends litLocalizeLiteMixin(LitElement) {
|
|||||||
this._fetchAuthProviders();
|
this._fetchAuthProviders();
|
||||||
|
|
||||||
if (matchMedia("(prefers-color-scheme: dark)").matches) {
|
if (matchMedia("(prefers-color-scheme: dark)").matches) {
|
||||||
applyThemesOnElement(document.documentElement, {
|
applyThemesOnElement(
|
||||||
default_theme: "default",
|
document.documentElement,
|
||||||
default_dark_theme: null,
|
{
|
||||||
themes: {},
|
default_theme: "default",
|
||||||
darkMode: true,
|
default_dark_theme: null,
|
||||||
theme: "default",
|
themes: {},
|
||||||
});
|
darkMode: true,
|
||||||
|
theme: "default",
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.redirectUri) {
|
if (!this.redirectUri) {
|
||||||
|
@ -31,11 +31,12 @@ export const applyThemesOnElement = (
|
|||||||
element,
|
element,
|
||||||
themes: HomeAssistant["themes"],
|
themes: HomeAssistant["themes"],
|
||||||
selectedTheme?: string,
|
selectedTheme?: string,
|
||||||
themeSettings?: Partial<HomeAssistant["selectedTheme"]>
|
themeSettings?: Partial<HomeAssistant["selectedTheme"]>,
|
||||||
|
main?: boolean
|
||||||
) => {
|
) => {
|
||||||
// If there is no explicitly desired theme provided, we automatically
|
// If there is no explicitly desired theme provided, and the element is the main element we automatically
|
||||||
// use the active one from `themes`.
|
// use the active one from `themes`.
|
||||||
const themeToApply = selectedTheme || themes.theme;
|
const themeToApply = selectedTheme || (main ? themes.theme : undefined);
|
||||||
|
|
||||||
// If there is no explicitly desired dark mode provided, we automatically
|
// If there is no explicitly desired dark mode provided, we automatically
|
||||||
// use the active one from `themes`.
|
// use the active one from `themes`.
|
||||||
@ -47,7 +48,7 @@ export const applyThemesOnElement = (
|
|||||||
let cacheKey = themeToApply;
|
let cacheKey = themeToApply;
|
||||||
let themeRules: Partial<ThemeVars> = {};
|
let themeRules: Partial<ThemeVars> = {};
|
||||||
|
|
||||||
if (darkMode) {
|
if (themeToApply && darkMode) {
|
||||||
cacheKey = `${cacheKey}__dark`;
|
cacheKey = `${cacheKey}__dark`;
|
||||||
themeRules = { ...darkStyles };
|
themeRules = { ...darkStyles };
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,9 @@ export const provideHass = (
|
|||||||
applyThemesOnElement(
|
applyThemesOnElement(
|
||||||
document.documentElement,
|
document.documentElement,
|
||||||
themes,
|
themes,
|
||||||
selectedTheme!.theme
|
selectedTheme!.theme,
|
||||||
|
undefined,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -101,7 +101,8 @@ class SupervisorErrorScreen extends LitElement {
|
|||||||
this.parentElement,
|
this.parentElement,
|
||||||
this.hass.themes,
|
this.hass.themes,
|
||||||
themeName,
|
themeName,
|
||||||
themeSettings
|
themeSettings,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,13 +133,19 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
|
|||||||
import("./particles");
|
import("./particles");
|
||||||
}
|
}
|
||||||
if (matchMedia("(prefers-color-scheme: dark)").matches) {
|
if (matchMedia("(prefers-color-scheme: dark)").matches) {
|
||||||
applyThemesOnElement(document.documentElement, {
|
applyThemesOnElement(
|
||||||
default_theme: "default",
|
document.documentElement,
|
||||||
default_dark_theme: null,
|
{
|
||||||
themes: {},
|
default_theme: "default",
|
||||||
darkMode: true,
|
default_dark_theme: null,
|
||||||
theme: "default",
|
themes: {},
|
||||||
});
|
darkMode: true,
|
||||||
|
theme: "default",
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ export class HaBlueprintAutomationEditor extends LitElement {
|
|||||||
if (!name) {
|
if (!name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const newVal = ev.detail.value;
|
const newVal = target.value;
|
||||||
if ((this.config![name] || "") === newVal) {
|
if ((this.config![name] || "") === newVal) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ export class DialogEnergyGridFlowSettings
|
|||||||
this._costStat = null;
|
this._costStat = null;
|
||||||
this._source = {
|
this._source = {
|
||||||
...this._source!,
|
...this._source!,
|
||||||
number_energy_price: Number(ev.detail.value),
|
number_energy_price: Number((ev.target as any).value),
|
||||||
entity_energy_price: null,
|
entity_energy_price: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { fireEvent } from "../../../common/dom/fire_event";
|
import { fireEvent } from "../../../common/dom/fire_event";
|
||||||
|
import { stopPropagation } from "../../../common/dom/stop_propagation";
|
||||||
import { computeDomain } from "../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||||
import { domainIcon } from "../../../common/entity/domain_icon";
|
import { domainIcon } from "../../../common/entity/domain_icon";
|
||||||
import "../../../components/ha-alert";
|
import "../../../components/ha-alert";
|
||||||
@ -166,7 +167,10 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
|
|||||||
"ui.dialogs.entity_registry.editor.device_class"
|
"ui.dialogs.entity_registry.editor.device_class"
|
||||||
)}
|
)}
|
||||||
.value=${this._deviceClass}
|
.value=${this._deviceClass}
|
||||||
|
naturalMenuWidth
|
||||||
|
fixedMenuPosition
|
||||||
@selected=${this._deviceClassChanged}
|
@selected=${this._deviceClassChanged}
|
||||||
|
@closed=${stopPropagation}
|
||||||
>
|
>
|
||||||
${OVERRIDE_DEVICE_CLASSES[domain].map(
|
${OVERRIDE_DEVICE_CLASSES[domain].map(
|
||||||
(deviceClass: string) => html`
|
(deviceClass: string) => html`
|
||||||
@ -422,6 +426,7 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
|
|||||||
}
|
}
|
||||||
ha-select {
|
ha-select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin: 8px 0;
|
||||||
}
|
}
|
||||||
ha-switch {
|
ha-switch {
|
||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
|
@ -85,7 +85,7 @@ class HaInputSelectForm extends LitElement {
|
|||||||
${this._options.length
|
${this._options.length
|
||||||
? this._options.map(
|
? this._options.map(
|
||||||
(option, index) => html`
|
(option, index) => html`
|
||||||
<mwc-list-item class="option" hasMeta noninteractive>
|
<mwc-list-item class="option" hasMeta>
|
||||||
${option}
|
${option}
|
||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
slot="meta"
|
slot="meta"
|
||||||
|
@ -237,8 +237,10 @@ class ZWaveJSConfigDashboard extends LitElement {
|
|||||||
<mwc-button
|
<mwc-button
|
||||||
@click=${this._removeNodeClicked}
|
@click=${this._removeNodeClicked}
|
||||||
.disabled=${this._status !== "connected" ||
|
.disabled=${this._status !== "connected" ||
|
||||||
this._network?.controller.inclusion_state !==
|
(this._network?.controller.inclusion_state !==
|
||||||
InclusionState.Idle}
|
InclusionState.Idle &&
|
||||||
|
this._network?.controller.inclusion_state !==
|
||||||
|
InclusionState.SmartStart)}
|
||||||
>
|
>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.zwave_js.common.remove_node"
|
"ui.panel.config.zwave_js.common.remove_node"
|
||||||
@ -304,7 +306,9 @@ class ZWaveJSConfigDashboard extends LitElement {
|
|||||||
?rtl=${computeRTL(this.hass)}
|
?rtl=${computeRTL(this.hass)}
|
||||||
@click=${this._addNodeClicked}
|
@click=${this._addNodeClicked}
|
||||||
.disabled=${this._status !== "connected" ||
|
.disabled=${this._status !== "connected" ||
|
||||||
this._network?.controller.inclusion_state !== InclusionState.Idle}
|
(this._network?.controller.inclusion_state !== InclusionState.Idle &&
|
||||||
|
this._network?.controller.inclusion_state !==
|
||||||
|
InclusionState.SmartStart)}
|
||||||
>
|
>
|
||||||
<ha-svg-icon slot="icon" .path=${mdiPlus}></ha-svg-icon>
|
<ha-svg-icon slot="icon" .path=${mdiPlus}></ha-svg-icon>
|
||||||
</ha-fab>
|
</ha-fab>
|
||||||
|
@ -289,7 +289,7 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
<div class="flex">
|
<div class="flex">
|
||||||
<ha-select
|
<ha-select
|
||||||
.disabled=${!item.metadata.writeable}
|
.disabled=${!item.metadata.writeable}
|
||||||
.value=${item.value}
|
.value=${item.value?.toString()}
|
||||||
.key=${id}
|
.key=${id}
|
||||||
.property=${item.property}
|
.property=${item.property}
|
||||||
.propertyKey=${item.property_key}
|
.propertyKey=${item.property_key}
|
||||||
@ -345,7 +345,7 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
if (ev.target === undefined || this._config![ev.target.key] === undefined) {
|
if (ev.target === undefined || this._config![ev.target.key] === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this._config![ev.target.key].value === ev.target.value) {
|
if (this._config![ev.target.key].value?.toString() === ev.target.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setResult(ev.target.key, undefined);
|
this.setResult(ev.target.key, undefined);
|
||||||
|
@ -11,6 +11,7 @@ import { CoreFrontendUserData } from "../../../../data/frontend";
|
|||||||
import {
|
import {
|
||||||
LovelaceDashboard,
|
LovelaceDashboard,
|
||||||
LovelaceDashboardCreateParams,
|
LovelaceDashboardCreateParams,
|
||||||
|
LovelaceDashboardMutableParams,
|
||||||
} from "../../../../data/lovelace";
|
} from "../../../../data/lovelace";
|
||||||
import { DEFAULT_PANEL, setDefaultPanel } from "../../../../data/panel";
|
import { DEFAULT_PANEL, setDefaultPanel } from "../../../../data/panel";
|
||||||
import { haStyleDialog } from "../../../../resources/styles";
|
import { haStyleDialog } from "../../../../resources/styles";
|
||||||
@ -40,7 +41,7 @@ export class DialogLovelaceDashboardDetail extends LitElement {
|
|||||||
} else {
|
} else {
|
||||||
this._data = {
|
this._data = {
|
||||||
show_in_sidebar: true,
|
show_in_sidebar: true,
|
||||||
icon: "",
|
icon: undefined,
|
||||||
title: "",
|
title: "",
|
||||||
require_admin: false,
|
require_admin: false,
|
||||||
mode: "storage",
|
mode: "storage",
|
||||||
@ -264,7 +265,13 @@ export class DialogLovelaceDashboardDetail extends LitElement {
|
|||||||
this._submitting = true;
|
this._submitting = true;
|
||||||
try {
|
try {
|
||||||
if (this._params!.dashboard) {
|
if (this._params!.dashboard) {
|
||||||
await this._params!.updateDashboard(this._data as LovelaceDashboard);
|
const values: Partial<LovelaceDashboardMutableParams> = {
|
||||||
|
require_admin: this._data!.require_admin,
|
||||||
|
show_in_sidebar: this._data!.show_in_sidebar,
|
||||||
|
icon: this._data!.icon || undefined,
|
||||||
|
title: this._data!.title,
|
||||||
|
};
|
||||||
|
await this._params!.updateDashboard(values);
|
||||||
} else {
|
} else {
|
||||||
await this._params!.createDashboard(
|
await this._params!.createDashboard(
|
||||||
this._data as LovelaceDashboardCreateParams
|
this._data as LovelaceDashboardCreateParams
|
||||||
|
@ -569,9 +569,13 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _aliasChanged(alias: string) {
|
private _aliasChanged(alias: string) {
|
||||||
if (this.scriptEntityId || this._entityId) {
|
if (
|
||||||
|
this.scriptEntityId ||
|
||||||
|
(this._entityId && this._entityId !== slugify(this._config!.alias))
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const aliasSlugify = slugify(alias);
|
const aliasSlugify = slugify(alias);
|
||||||
let id = aliasSlugify;
|
let id = aliasSlugify;
|
||||||
let i = 2;
|
let i = 2;
|
||||||
@ -595,6 +599,7 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
private _valueChanged(ev: CustomEvent) {
|
private _valueChanged(ev: CustomEvent) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
const values = ev.detail.value as any;
|
const values = ev.detail.value as any;
|
||||||
|
const currentId = this._entityId;
|
||||||
|
|
||||||
for (const key of Object.keys(values)) {
|
for (const key of Object.keys(values)) {
|
||||||
if (key === "sequence") {
|
if (key === "sequence") {
|
||||||
@ -603,7 +608,10 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
|
|
||||||
const value = values[key];
|
const value = values[key];
|
||||||
|
|
||||||
if (value === this._config![key]) {
|
if (
|
||||||
|
value === this._config![key] ||
|
||||||
|
(key === "id" && currentId === value)
|
||||||
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ import {
|
|||||||
showAlertDialog,
|
showAlertDialog,
|
||||||
showPromptDialog,
|
showPromptDialog,
|
||||||
} from "../../../dialogs/generic/show-dialog-box";
|
} from "../../../dialogs/generic/show-dialog-box";
|
||||||
import { PolymerChangedEvent } from "../../../polymer-types";
|
|
||||||
import { haStyleDialog } from "../../../resources/styles";
|
import { haStyleDialog } from "../../../resources/styles";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { UserDetailDialogParams } from "./show-dialog-user-detail";
|
import { UserDetailDialogParams } from "./show-dialog-user-detail";
|
||||||
@ -212,9 +211,9 @@ class DialogUserDetail extends LitElement {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _nameChanged(ev: PolymerChangedEvent<string>) {
|
private _nameChanged(ev) {
|
||||||
this._error = undefined;
|
this._error = undefined;
|
||||||
this._name = ev.detail.value;
|
this._name = ev.target.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _adminChanged(ev): void {
|
private _adminChanged(ev): void {
|
||||||
|
@ -113,9 +113,9 @@ export class HuiPictureCardEditor
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const target = ev.target! as EditorTarget;
|
const target = ev.target! as EditorTarget;
|
||||||
const value = ev.detail.value;
|
const value = ev.detail?.value ?? target.value;
|
||||||
|
|
||||||
if (this[`_${target.configValue}`] === target.value) {
|
if (this[`_${target.configValue}`] === value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (target.configValue) {
|
if (target.configValue) {
|
||||||
|
@ -38,13 +38,19 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
|
|||||||
});
|
});
|
||||||
mql.addListener((ev) => this._applyTheme(ev.matches));
|
mql.addListener((ev) => this._applyTheme(ev.matches));
|
||||||
if (!this._themeApplied && mql.matches) {
|
if (!this._themeApplied && mql.matches) {
|
||||||
applyThemesOnElement(document.documentElement, {
|
applyThemesOnElement(
|
||||||
default_theme: "default",
|
document.documentElement,
|
||||||
default_dark_theme: null,
|
{
|
||||||
themes: {},
|
default_theme: "default",
|
||||||
darkMode: true,
|
default_dark_theme: null,
|
||||||
theme: "default",
|
themes: {},
|
||||||
});
|
darkMode: true,
|
||||||
|
theme: "default",
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +99,8 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
|
|||||||
document.documentElement,
|
document.documentElement,
|
||||||
this.hass.themes,
|
this.hass.themes,
|
||||||
themeName,
|
themeName,
|
||||||
themeSettings
|
themeSettings,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
if (darkMode !== this.hass.themes.darkMode) {
|
if (darkMode !== this.hass.themes.darkMode) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user