mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
20230301.0 (#15657)
This commit is contained in:
commit
db1f81e0ef
@ -119,7 +119,6 @@
|
|||||||
"lit/no-template-map": "off",
|
"lit/no-template-map": "off",
|
||||||
"lit/no-native-attributes": "warn",
|
"lit/no-native-attributes": "warn",
|
||||||
"lit/no-this-assign-in-render": "warn",
|
"lit/no-this-assign-in-render": "warn",
|
||||||
"lit/prefer-nothing": "warn",
|
|
||||||
"lit-a11y/click-events-have-key-events": ["off"],
|
"lit-a11y/click-events-have-key-events": ["off"],
|
||||||
"lit-a11y/no-autofocus": "off",
|
"lit-a11y/no-autofocus": "off",
|
||||||
"lit-a11y/alt-text": "warn",
|
"lit-a11y/alt-text": "warn",
|
||||||
|
1
.github/dependabot.yml
vendored
1
.github/dependabot.yml
vendored
@ -18,4 +18,3 @@ updates:
|
|||||||
# Ignore rollup and plugins until everything else is updated
|
# Ignore rollup and plugins until everything else is updated
|
||||||
- dependency-name: "*rollup*"
|
- dependency-name: "*rollup*"
|
||||||
- dependency-name: "@rollup/*"
|
- dependency-name: "@rollup/*"
|
||||||
- dependency-name: "serve"
|
|
||||||
|
@ -53,13 +53,25 @@ module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({
|
|||||||
...defineOverlay,
|
...defineOverlay,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const htmlMinifierOptions = {
|
||||||
|
caseSensitive: true,
|
||||||
|
collapseWhitespace: true,
|
||||||
|
conservativeCollapse: true,
|
||||||
|
decodeEntities: true,
|
||||||
|
removeComments: true,
|
||||||
|
removeRedundantAttributes: true,
|
||||||
|
minifyCSS: {
|
||||||
|
level: 0,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
module.exports.terserOptions = (latestBuild) => ({
|
module.exports.terserOptions = (latestBuild) => ({
|
||||||
safari10: !latestBuild,
|
safari10: !latestBuild,
|
||||||
ecma: latestBuild ? undefined : 5,
|
ecma: latestBuild ? undefined : 5,
|
||||||
output: { comments: false },
|
output: { comments: false },
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports.babelOptions = ({ latestBuild }) => ({
|
module.exports.babelOptions = ({ latestBuild, isProdBuild }) => ({
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
compact: false,
|
compact: false,
|
||||||
presets: [
|
presets: [
|
||||||
@ -67,7 +79,7 @@ module.exports.babelOptions = ({ latestBuild }) => ({
|
|||||||
"@babel/preset-env",
|
"@babel/preset-env",
|
||||||
{
|
{
|
||||||
useBuiltIns: "entry",
|
useBuiltIns: "entry",
|
||||||
corejs: { version: "3.28", proposals: true },
|
corejs: { version: "3.29", proposals: true },
|
||||||
bugfixes: true,
|
bugfixes: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -93,12 +105,26 @@ module.exports.babelOptions = ({ latestBuild }) => ({
|
|||||||
"@babel/plugin-syntax-import-meta",
|
"@babel/plugin-syntax-import-meta",
|
||||||
"@babel/plugin-syntax-dynamic-import",
|
"@babel/plugin-syntax-dynamic-import",
|
||||||
"@babel/plugin-syntax-top-level-await",
|
"@babel/plugin-syntax-top-level-await",
|
||||||
|
// Support various proposals
|
||||||
"@babel/plugin-proposal-optional-chaining",
|
"@babel/plugin-proposal-optional-chaining",
|
||||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||||
["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: true }],
|
["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: true }],
|
||||||
["@babel/plugin-proposal-private-methods", { loose: true }],
|
["@babel/plugin-proposal-private-methods", { loose: true }],
|
||||||
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
|
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
|
||||||
["@babel/plugin-proposal-class-properties", { loose: true }],
|
["@babel/plugin-proposal-class-properties", { loose: true }],
|
||||||
|
// Minify template literals for production
|
||||||
|
isProdBuild && [
|
||||||
|
"template-html-minifier",
|
||||||
|
{
|
||||||
|
modules: {
|
||||||
|
lit: ["html", "svg", { name: "css", encapsulation: "style" }],
|
||||||
|
"@polymer/polymer/lib/utils/html-tag": ["html"],
|
||||||
|
},
|
||||||
|
strictCSS: true,
|
||||||
|
htmlMinifier: htmlMinifierOptions,
|
||||||
|
failOnError: true, // we can turn this off in case of false positives
|
||||||
|
},
|
||||||
|
],
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
exclude: [
|
exclude: [
|
||||||
// \\ for Windows, / for Mac OS and Linux
|
// \\ for Windows, / for Mac OS and Linux
|
||||||
|
@ -43,7 +43,14 @@ const createRollupConfig = ({
|
|||||||
preserveEntrySignatures: false,
|
preserveEntrySignatures: false,
|
||||||
plugins: [
|
plugins: [
|
||||||
ignore({
|
ignore({
|
||||||
files: bundle.emptyPackages({ latestBuild }),
|
files: bundle
|
||||||
|
.emptyPackages({ latestBuild })
|
||||||
|
// TEMP HACK: Makes Rollup build work again
|
||||||
|
.concat(
|
||||||
|
require.resolve(
|
||||||
|
"@webcomponents/scoped-custom-element-registry/scoped-custom-element-registry.min"
|
||||||
|
)
|
||||||
|
),
|
||||||
}),
|
}),
|
||||||
resolve({
|
resolve({
|
||||||
extensions,
|
extensions,
|
||||||
@ -54,7 +61,7 @@ const createRollupConfig = ({
|
|||||||
commonjs(),
|
commonjs(),
|
||||||
json(),
|
json(),
|
||||||
babel({
|
babel({
|
||||||
...bundle.babelOptions({ latestBuild }),
|
...bundle.babelOptions({ latestBuild, isProdBuild }),
|
||||||
extensions,
|
extensions,
|
||||||
babelHelpers: isWDS ? "inline" : "bundled",
|
babelHelpers: isWDS ? "inline" : "bundled",
|
||||||
}),
|
}),
|
||||||
|
@ -51,7 +51,7 @@ const createWebpackConfig = ({
|
|||||||
use: {
|
use: {
|
||||||
loader: "babel-loader",
|
loader: "babel-loader",
|
||||||
options: {
|
options: {
|
||||||
...bundle.babelOptions({ latestBuild }),
|
...bundle.babelOptions({ latestBuild, isProdBuild }),
|
||||||
cacheDirectory: !isProdBuild,
|
cacheDirectory: !isProdBuild,
|
||||||
cacheCompression: false,
|
cacheCompression: false,
|
||||||
},
|
},
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { html, TemplateResult } from "lit";
|
import { html, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { mockHistory } from "../../../../demo/src/stubs/history";
|
import { mockHistory } from "../../../../demo/src/stubs/history";
|
||||||
import { LovelaceConfig } from "../../../../src/data/lovelace";
|
import { LovelaceConfig } from "../../../../src/data/lovelace";
|
||||||
@ -18,9 +18,9 @@ class HcDemo extends HassElement {
|
|||||||
|
|
||||||
@state() private _lovelaceConfig?: LovelaceConfig;
|
@state() private _lovelaceConfig?: LovelaceConfig;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._lovelaceConfig) {
|
if (!this._lovelaceConfig) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<hc-lovelace
|
<hc-lovelace
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { mdiTelevision } from "@mdi/js";
|
import { mdiTelevision } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { CastManager } from "../../../src/cast/cast_manager";
|
import { CastManager } from "../../../src/cast/cast_manager";
|
||||||
import { castSendShowDemo } from "../../../src/cast/receiver_messages";
|
import { castSendShowDemo } from "../../../src/cast/receiver_messages";
|
||||||
@ -20,12 +20,12 @@ class CastDemoRow extends LitElement implements LovelaceRow {
|
|||||||
// No config possible.
|
// No config possible.
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (
|
if (
|
||||||
!this._castManager ||
|
!this._castManager ||
|
||||||
this._castManager.castState === "NO_DEVICES_AVAILABLE"
|
this._castManager.castState === "NO_DEVICES_AVAILABLE"
|
||||||
) {
|
) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<ha-svg-icon .path=${mdiTelevision}></ha-svg-icon>
|
<ha-svg-icon .path=${mdiTelevision}></ha-svg-icon>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { until } from "lit/directives/until";
|
import { until } from "lit/directives/until";
|
||||||
import "../../../src/components/ha-card";
|
import "../../../src/components/ha-card";
|
||||||
@ -30,9 +30,9 @@ export class HADemoCard extends LitElement implements LovelaceCard {
|
|||||||
|
|
||||||
public setConfig(_config: LovelaceCardConfig) {}
|
public setConfig(_config: LovelaceCardConfig) {}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (this._hidden) {
|
if (this._hidden) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<ha-card>
|
<ha-card>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { html, css } from "lit";
|
import { css, html, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { until } from "lit/directives/until";
|
import { until } from "lit/directives/until";
|
||||||
import { HaMarkdown } from "../../../src/components/ha-markdown";
|
import { HaMarkdown } from "../../../src/components/ha-markdown";
|
||||||
@ -10,7 +10,7 @@ class PageDescription extends HaMarkdown {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (!PAGES[this.page].description) {
|
if (!PAGES[this.page].description) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { dump } from "js-yaml";
|
import { dump } from "js-yaml";
|
||||||
import { html, css, LitElement, TemplateResult } from "lit";
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
import "../../../../src/components/ha-yaml-editor";
|
import "../../../../src/components/ha-yaml-editor";
|
||||||
@ -127,9 +127,9 @@ export class DemoAutomationDescribeAction extends LitElement {
|
|||||||
|
|
||||||
@state() _action = initialAction;
|
@state() _action = initialAction;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<ha-card header="Actions">
|
<ha-card header="Actions">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { dump } from "js-yaml";
|
import { dump } from "js-yaml";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
import "../../../../src/components/ha-yaml-editor";
|
import "../../../../src/components/ha-yaml-editor";
|
||||||
@ -53,9 +53,9 @@ export class DemoAutomationDescribeCondition extends LitElement {
|
|||||||
|
|
||||||
@state() _condition = initialCondition;
|
@state() _condition = initialCondition;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { dump } from "js-yaml";
|
import { dump } from "js-yaml";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
import "../../../../src/components/ha-yaml-editor";
|
import "../../../../src/components/ha-yaml-editor";
|
||||||
@ -64,9 +64,9 @@ export class DemoAutomationDescribeTrigger extends LitElement {
|
|||||||
|
|
||||||
@state() _trigger = initialTrigger;
|
@state() _trigger = initialTrigger;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* eslint-disable lit/no-template-arrow */
|
/* eslint-disable lit/no-template-arrow */
|
||||||
import { html, css, LitElement, TemplateResult } from "lit";
|
|
||||||
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
import "../../../../src/components/trace/hat-script-graph";
|
import "../../../../src/components/trace/hat-script-graph";
|
||||||
@ -29,9 +30,9 @@ const traces: DemoTrace[] = [
|
|||||||
export class DemoAutomationTraceTimeline extends LitElement {
|
export class DemoAutomationTraceTimeline extends LitElement {
|
||||||
@property({ attribute: false }) hass?: HomeAssistant;
|
@property({ attribute: false }) hass?: HomeAssistant;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
${traces.map(
|
${traces.map(
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
/* eslint-disable lit/no-template-arrow */
|
/* eslint-disable lit/no-template-arrow */
|
||||||
import { html, css, LitElement, TemplateResult } from "lit";
|
|
||||||
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
import "../../../../src/components/trace/hat-script-graph";
|
import "../../../../src/components/trace/hat-script-graph";
|
||||||
import "../../../../src/components/trace/hat-trace-timeline";
|
import "../../../../src/components/trace/hat-trace-timeline";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
|
||||||
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
||||||
import { HomeAssistant } from "../../../../src/types";
|
import { HomeAssistant } from "../../../../src/types";
|
||||||
import { DemoTrace } from "../../data/traces/types";
|
|
||||||
import { basicTrace } from "../../data/traces/basic_trace";
|
import { basicTrace } from "../../data/traces/basic_trace";
|
||||||
import { motionLightTrace } from "../../data/traces/motion-light-trace";
|
import { motionLightTrace } from "../../data/traces/motion-light-trace";
|
||||||
|
import { DemoTrace } from "../../data/traces/types";
|
||||||
|
|
||||||
const traces: DemoTrace[] = [basicTrace, motionLightTrace];
|
const traces: DemoTrace[] = [basicTrace, motionLightTrace];
|
||||||
|
|
||||||
@ -18,9 +19,9 @@ export class DemoAutomationTrace extends LitElement {
|
|||||||
|
|
||||||
@state() private _selected = {};
|
@state() private _selected = {};
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
${traces.map(
|
${traces.map(
|
||||||
|
@ -2,7 +2,7 @@ import {
|
|||||||
HassEntity,
|
HassEntity,
|
||||||
HassEntityAttributeBase,
|
HassEntityAttributeBase,
|
||||||
} from "home-assistant-js-websocket";
|
} from "home-assistant-js-websocket";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { computeDomain } from "../../../../src/common/entity/compute_domain";
|
import { computeDomain } from "../../../../src/common/entity/compute_domain";
|
||||||
@ -387,9 +387,9 @@ export class DemoEntityState extends LitElement {
|
|||||||
hass.updateTranslations("config", "en");
|
hass.updateTranslations("config", "en");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
import { html, css, LitElement, TemplateResult } from "lit";
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import "../../../../src/components/ha-formfield";
|
import "../../../../src/components/ha-formfield";
|
||||||
import "../../../../src/components/ha-switch";
|
import "../../../../src/components/ha-switch";
|
||||||
|
|
||||||
import { classMap } from "lit/directives/class-map";
|
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
|
import { classMap } from "lit/directives/class-map";
|
||||||
import { IntegrationManifest } from "../../../../src/data/integration";
|
import { IntegrationManifest } from "../../../../src/data/integration";
|
||||||
|
|
||||||
|
import { DeviceRegistryEntry } from "../../../../src/data/device_registry";
|
||||||
|
import { EntityRegistryEntry } from "../../../../src/data/entity_registry";
|
||||||
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
||||||
import { HomeAssistant } from "../../../../src/types";
|
|
||||||
import "../../../../src/panels/config/integrations/ha-integration-card";
|
|
||||||
import "../../../../src/panels/config/integrations/ha-ignored-config-entry-card";
|
|
||||||
import "../../../../src/panels/config/integrations/ha-config-flow-card";
|
import "../../../../src/panels/config/integrations/ha-config-flow-card";
|
||||||
import type {
|
import type {
|
||||||
ConfigEntryExtended,
|
ConfigEntryExtended,
|
||||||
DataEntryFlowProgressExtended,
|
DataEntryFlowProgressExtended,
|
||||||
} from "../../../../src/panels/config/integrations/ha-config-integrations";
|
} from "../../../../src/panels/config/integrations/ha-config-integrations";
|
||||||
import { DeviceRegistryEntry } from "../../../../src/data/device_registry";
|
import "../../../../src/panels/config/integrations/ha-ignored-config-entry-card";
|
||||||
import { EntityRegistryEntry } from "../../../../src/data/entity_registry";
|
import "../../../../src/panels/config/integrations/ha-integration-card";
|
||||||
|
import { HomeAssistant } from "../../../../src/types";
|
||||||
|
|
||||||
const createConfigEntry = (
|
const createConfigEntry = (
|
||||||
title: string,
|
title: string,
|
||||||
@ -231,9 +231,9 @@ export class DemoIntegrationCard extends LitElement {
|
|||||||
|
|
||||||
@state() isCloud = false;
|
@state() isCloud = false;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
CSSResultGroup,
|
CSSResultGroup,
|
||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
|
nothing,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
@ -73,8 +74,8 @@ export class HassioAddonStore extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
let repos: TemplateResult[] = [];
|
let repos: (TemplateResult | typeof nothing)[] = [];
|
||||||
|
|
||||||
if (this.supervisor.store.repositories) {
|
if (this.supervisor.store.repositories) {
|
||||||
repos = this.addonRepositories(
|
repos = this.addonRepositories(
|
||||||
@ -173,7 +174,7 @@ export class HassioAddonStore extends LitElement {
|
|||||||
.supervisor=${this.supervisor}
|
.supervisor=${this.supervisor}
|
||||||
></hassio-addon-repository>
|
></hassio-addon-repository>
|
||||||
`
|
`
|
||||||
: html``;
|
: nothing;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import {
|
|||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
nothing,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
@ -47,9 +47,9 @@ class HassioAddonNetwork extends LitElement {
|
|||||||
this._setNetworkConfig();
|
this._setNetworkConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._config) {
|
if (!this._config) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasHiddenOptions = Object.keys(this._config).find(
|
const hasHiddenOptions = Object.keys(this._config).find(
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
nothing,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
@ -160,9 +160,9 @@ export class HassioBackups extends LitElement {
|
|||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.supervisor) {
|
if (!this.supervisor) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<hass-tabs-subpage-data-table
|
<hass-tabs-subpage-data-table
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
import { mdiFolder, mdiHomeAssistant, mdiPuzzle } from "@mdi/js";
|
import { mdiFolder, mdiHomeAssistant, mdiPuzzle } from "@mdi/js";
|
||||||
import { PaperInputElement } from "@polymer/paper-input/paper-input";
|
import { PaperInputElement } from "@polymer/paper-input/paper-input";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import {
|
||||||
|
css,
|
||||||
|
CSSResultGroup,
|
||||||
|
html,
|
||||||
|
LitElement,
|
||||||
|
TemplateResult,
|
||||||
|
nothing,
|
||||||
|
} from "lit";
|
||||||
import { customElement, property, query } from "lit/decorators";
|
import { customElement, property, query } from "lit/decorators";
|
||||||
import { atLeastVersion } from "../../../src/common/config/version";
|
import { atLeastVersion } from "../../../src/common/config/version";
|
||||||
import { formatDate } from "../../../src/common/datetime/format_date";
|
import { formatDate } from "../../../src/common/datetime/format_date";
|
||||||
@ -11,9 +18,9 @@ import "../../../src/components/ha-formfield";
|
|||||||
import "../../../src/components/ha-radio";
|
import "../../../src/components/ha-radio";
|
||||||
import type { HaRadio } from "../../../src/components/ha-radio";
|
import type { HaRadio } from "../../../src/components/ha-radio";
|
||||||
import {
|
import {
|
||||||
|
HassioBackupDetail,
|
||||||
HassioFullBackupCreateParams,
|
HassioFullBackupCreateParams,
|
||||||
HassioPartialBackupCreateParams,
|
HassioPartialBackupCreateParams,
|
||||||
HassioBackupDetail,
|
|
||||||
} from "../../../src/data/hassio/backup";
|
} from "../../../src/data/hassio/backup";
|
||||||
import { Supervisor } from "../../../src/data/supervisor/supervisor";
|
import { Supervisor } from "../../../src/data/supervisor/supervisor";
|
||||||
import { PolymerChangedEvent } from "../../../src/polymer-types";
|
import { PolymerChangedEvent } from "../../../src/polymer-types";
|
||||||
@ -115,9 +122,9 @@ export class SupervisorBackupContent extends LitElement {
|
|||||||
this.supervisor?.localize(`backup.${key}`) ||
|
this.supervisor?.localize(`backup.${key}`) ||
|
||||||
this.localize!(`ui.panel.page-onboarding.restore.${key}`);
|
this.localize!(`ui.panel.page-onboarding.restore.${key}`);
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.onboarding && !this.supervisor) {
|
if (!this.onboarding && !this.supervisor) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
const foldersSection =
|
const foldersSection =
|
||||||
this.backupType === "partial" ? this._getSection("folders") : undefined;
|
this.backupType === "partial" ? this._getSection("folders") : undefined;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import { mdiHomeAssistant } from "@mdi/js";
|
import { mdiHomeAssistant } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import "../../../src/components/buttons/ha-progress-button";
|
import "../../../src/components/buttons/ha-progress-button";
|
||||||
@ -33,14 +33,14 @@ export class HassioUpdate extends LitElement {
|
|||||||
).length
|
).length
|
||||||
);
|
);
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.supervisor) {
|
if (!this.supervisor) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const updatesAvailable = this._pendingUpdates(this.supervisor);
|
const updatesAvailable = this._pendingUpdates(this.supervisor);
|
||||||
if (!updatesAvailable) {
|
if (!updatesAvailable) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
@ -80,9 +80,9 @@ export class HassioUpdate extends LitElement {
|
|||||||
name: string,
|
name: string,
|
||||||
key: string,
|
key: string,
|
||||||
object: HassioHomeAssistantInfo | HassioSupervisorInfo | HassioHassOSInfo
|
object: HassioHomeAssistantInfo | HassioSupervisorInfo | HassioHassOSInfo
|
||||||
): TemplateResult {
|
) {
|
||||||
if (!object.update_available) {
|
if (!object.update_available) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<ha-card outlined>
|
<ha-card outlined>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { mdiClose } from "@mdi/js";
|
import { mdiClose } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
||||||
import "../../../../src/components/ha-header-bar";
|
import "../../../../src/components/ha-header-bar";
|
||||||
@ -36,9 +36,9 @@ export class DialogHassioBackupUpload
|
|||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._dialogParams) {
|
if (!this._dialogParams) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import { ActionDetail } from "@material/mwc-list";
|
import { ActionDetail } from "@material/mwc-list";
|
||||||
import "@material/mwc-list/mwc-list-item";
|
import "@material/mwc-list/mwc-list-item";
|
||||||
import { mdiClose, mdiDotsVertical } from "@mdi/js";
|
import { mdiClose, mdiDotsVertical } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
|
import { atLeastVersion } from "../../../../src/common/config/version";
|
||||||
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
||||||
|
import { stopPropagation } from "../../../../src/common/dom/stop_propagation";
|
||||||
import { slugify } from "../../../../src/common/string/slugify";
|
import { slugify } from "../../../../src/common/string/slugify";
|
||||||
import "../../../../src/components/buttons/ha-progress-button";
|
import "../../../../src/components/buttons/ha-progress-button";
|
||||||
import "../../../../src/components/ha-alert";
|
import "../../../../src/components/ha-alert";
|
||||||
@ -11,11 +13,11 @@ import "../../../../src/components/ha-button-menu";
|
|||||||
import "../../../../src/components/ha-header-bar";
|
import "../../../../src/components/ha-header-bar";
|
||||||
import "../../../../src/components/ha-icon-button";
|
import "../../../../src/components/ha-icon-button";
|
||||||
import { getSignedPath } from "../../../../src/data/auth";
|
import { getSignedPath } from "../../../../src/data/auth";
|
||||||
import { extractApiErrorMessage } from "../../../../src/data/hassio/common";
|
|
||||||
import {
|
import {
|
||||||
fetchHassioBackupInfo,
|
fetchHassioBackupInfo,
|
||||||
HassioBackupDetail,
|
HassioBackupDetail,
|
||||||
} from "../../../../src/data/hassio/backup";
|
} from "../../../../src/data/hassio/backup";
|
||||||
|
import { extractApiErrorMessage } from "../../../../src/data/hassio/common";
|
||||||
import {
|
import {
|
||||||
showAlertDialog,
|
showAlertDialog,
|
||||||
showConfirmationDialog,
|
showConfirmationDialog,
|
||||||
@ -27,8 +29,6 @@ import { fileDownload } from "../../../../src/util/file_download";
|
|||||||
import "../../components/supervisor-backup-content";
|
import "../../components/supervisor-backup-content";
|
||||||
import type { SupervisorBackupContent } from "../../components/supervisor-backup-content";
|
import type { SupervisorBackupContent } from "../../components/supervisor-backup-content";
|
||||||
import { HassioBackupDialogParams } from "./show-dialog-hassio-backup";
|
import { HassioBackupDialogParams } from "./show-dialog-hassio-backup";
|
||||||
import { atLeastVersion } from "../../../../src/common/config/version";
|
|
||||||
import { stopPropagation } from "../../../../src/common/dom/stop_propagation";
|
|
||||||
|
|
||||||
@customElement("dialog-hassio-backup")
|
@customElement("dialog-hassio-backup")
|
||||||
class HassioBackupDialog
|
class HassioBackupDialog
|
||||||
@ -62,9 +62,9 @@ class HassioBackupDialog
|
|||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._dialogParams || !this._backup) {
|
if (!this._dialogParams || !this._backup) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<ha-dialog
|
<ha-dialog
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
||||||
import "../../../../src/components/ha-alert";
|
|
||||||
import "../../../../src/components/buttons/ha-progress-button";
|
import "../../../../src/components/buttons/ha-progress-button";
|
||||||
|
import "../../../../src/components/ha-alert";
|
||||||
import { createCloseHeading } from "../../../../src/components/ha-dialog";
|
import { createCloseHeading } from "../../../../src/components/ha-dialog";
|
||||||
import { extractApiErrorMessage } from "../../../../src/data/hassio/common";
|
|
||||||
import {
|
import {
|
||||||
createHassioFullBackup,
|
createHassioFullBackup,
|
||||||
createHassioPartialBackup,
|
createHassioPartialBackup,
|
||||||
} from "../../../../src/data/hassio/backup";
|
} from "../../../../src/data/hassio/backup";
|
||||||
|
import { extractApiErrorMessage } from "../../../../src/data/hassio/common";
|
||||||
import { showAlertDialog } from "../../../../src/dialogs/generic/show-dialog-box";
|
import { showAlertDialog } from "../../../../src/dialogs/generic/show-dialog-box";
|
||||||
import { haStyle, haStyleDialog } from "../../../../src/resources/styles";
|
import { haStyle, haStyleDialog } from "../../../../src/resources/styles";
|
||||||
import { HomeAssistant } from "../../../../src/types";
|
import { HomeAssistant } from "../../../../src/types";
|
||||||
@ -42,9 +42,9 @@ class HassioCreateBackupDialog extends LitElement {
|
|||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._dialogParams) {
|
if (!this._dialogParams) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<ha-dialog
|
<ha-dialog
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import "@material/mwc-list/mwc-list-item";
|
import "@material/mwc-list/mwc-list-item";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
||||||
@ -55,9 +55,9 @@ class HassioDatadiskDialog extends LitElement {
|
|||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.dialogParams) {
|
if (!this.dialogParams) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<ha-dialog
|
<ha-dialog
|
||||||
|
8
hassio/src/dialogs/hardware/dialog-hassio-hardware.ts
Executable file → Normal file
8
hassio/src/dialogs/hardware/dialog-hassio-hardware.ts
Executable file → Normal file
@ -1,13 +1,13 @@
|
|||||||
import { mdiClose } from "@mdi/js";
|
import { mdiClose } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
||||||
import "../../../../src/components/search-input";
|
|
||||||
import { stringCompare } from "../../../../src/common/string/compare";
|
import { stringCompare } from "../../../../src/common/string/compare";
|
||||||
import "../../../../src/components/ha-dialog";
|
import "../../../../src/components/ha-dialog";
|
||||||
import "../../../../src/components/ha-expansion-panel";
|
import "../../../../src/components/ha-expansion-panel";
|
||||||
import "../../../../src/components/ha-icon-button";
|
import "../../../../src/components/ha-icon-button";
|
||||||
|
import "../../../../src/components/search-input";
|
||||||
import { HassioHardwareInfo } from "../../../../src/data/hassio/hardware";
|
import { HassioHardwareInfo } from "../../../../src/data/hassio/hardware";
|
||||||
import { dump } from "../../../../src/resources/js-yaml-dump";
|
import { dump } from "../../../../src/resources/js-yaml-dump";
|
||||||
import { haStyle, haStyleDialog } from "../../../../src/resources/styles";
|
import { haStyle, haStyleDialog } from "../../../../src/resources/styles";
|
||||||
@ -53,9 +53,9 @@ class HassioHardwareDialog extends LitElement {
|
|||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._dialogParams) {
|
if (!this._dialogParams) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const devices = _filterDevices(
|
const devices = _filterDevices(
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { createCloseHeading } from "../../../../src/components/ha-dialog";
|
import { createCloseHeading } from "../../../../src/components/ha-dialog";
|
||||||
import "../../../../src/components/ha-markdown";
|
import "../../../../src/components/ha-markdown";
|
||||||
@ -27,9 +27,9 @@ class HassioMarkdownDialog extends LitElement {
|
|||||||
this._opened = false;
|
this._opened = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._opened) {
|
if (!this._opened) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<ha-dialog
|
<ha-dialog
|
||||||
|
@ -5,7 +5,7 @@ import "@material/mwc-tab";
|
|||||||
import "@material/mwc-tab-bar";
|
import "@material/mwc-tab-bar";
|
||||||
import { mdiClose } from "@mdi/js";
|
import { mdiClose } from "@mdi/js";
|
||||||
import { PaperInputElement } from "@polymer/paper-input/paper-input";
|
import { PaperInputElement } from "@polymer/paper-input/paper-input";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { cache } from "lit/directives/cache";
|
import { cache } from "lit/directives/cache";
|
||||||
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
||||||
@ -83,9 +83,9 @@ export class DialogHassioNetwork
|
|||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._params || !this._interface) {
|
if (!this._params || !this._interface) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import "@polymer/paper-tooltip/paper-tooltip";
|
|
||||||
import "@material/mwc-button/mwc-button";
|
import "@material/mwc-button/mwc-button";
|
||||||
import { mdiDelete, mdiDeleteOff } from "@mdi/js";
|
import { mdiDelete, mdiDeleteOff } from "@mdi/js";
|
||||||
import "@polymer/paper-input/paper-input";
|
import "@polymer/paper-input/paper-input";
|
||||||
import type { PaperInputElement } from "@polymer/paper-input/paper-input";
|
import type { PaperInputElement } from "@polymer/paper-input/paper-input";
|
||||||
import "@polymer/paper-item/paper-item";
|
import "@polymer/paper-item/paper-item";
|
||||||
import "@polymer/paper-item/paper-item-body";
|
import "@polymer/paper-item/paper-item-body";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import "@polymer/paper-tooltip/paper-tooltip";
|
||||||
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
||||||
@ -19,14 +19,14 @@ import {
|
|||||||
HassioAddonRepository,
|
HassioAddonRepository,
|
||||||
} from "../../../../src/data/hassio/addon";
|
} from "../../../../src/data/hassio/addon";
|
||||||
import { extractApiErrorMessage } from "../../../../src/data/hassio/common";
|
import { extractApiErrorMessage } from "../../../../src/data/hassio/common";
|
||||||
import { haStyle, haStyleDialog } from "../../../../src/resources/styles";
|
|
||||||
import type { HomeAssistant } from "../../../../src/types";
|
|
||||||
import { HassioRepositoryDialogParams } from "./show-dialog-repositories";
|
|
||||||
import {
|
import {
|
||||||
addStoreRepository,
|
addStoreRepository,
|
||||||
fetchStoreRepositories,
|
fetchStoreRepositories,
|
||||||
removeStoreRepository,
|
removeStoreRepository,
|
||||||
} from "../../../../src/data/supervisor/store";
|
} from "../../../../src/data/supervisor/store";
|
||||||
|
import { haStyle, haStyleDialog } from "../../../../src/resources/styles";
|
||||||
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
|
import { HassioRepositoryDialogParams } from "./show-dialog-repositories";
|
||||||
|
|
||||||
@customElement("dialog-hassio-repositories")
|
@customElement("dialog-hassio-repositories")
|
||||||
class HassioRepositoriesDialog extends LitElement {
|
class HassioRepositoriesDialog extends LitElement {
|
||||||
@ -82,9 +82,9 @@ class HassioRepositoriesDialog extends LitElement {
|
|||||||
.map((repo) => repo.slug)
|
.map((repo) => repo.slug)
|
||||||
);
|
);
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._dialogParams?.supervisor || this._repositories === undefined) {
|
if (!this._dialogParams?.supervisor || this._repositories === undefined) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
const repositories = this._filteredRepositories(this._repositories);
|
const repositories = this._filteredRepositories(this._repositories);
|
||||||
const usedRepositories = this._filteredUsedRepositories(
|
const usedRepositories = this._filteredUsedRepositories(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { sanitizeUrl } from "@braintree/sanitize-url";
|
import { sanitizeUrl } from "@braintree/sanitize-url";
|
||||||
import { html, LitElement, TemplateResult } from "lit";
|
import { html, LitElement, TemplateResult, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { navigate } from "../../src/common/navigate";
|
import { navigate } from "../../src/common/navigate";
|
||||||
import {
|
import {
|
||||||
@ -101,13 +101,13 @@ class HassioMyRedirect extends LitElement {
|
|||||||
navigate(url, { replace: true });
|
navigate(url, { replace: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (this._error) {
|
if (this._error) {
|
||||||
return html`<hass-error-screen
|
return html`<hass-error-screen
|
||||||
.error=${this._error}
|
.error=${this._error}
|
||||||
></hass-error-screen>`;
|
></hass-error-screen>`;
|
||||||
}
|
}
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createRedirectUrl(redirect: Redirect): string {
|
private _createRedirectUrl(redirect: Redirect): string {
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
nothing,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
@ -116,12 +116,12 @@ class UpdateAvailableCard extends LitElement {
|
|||||||
storeAddons.find((addon) => addon.slug === slug)
|
storeAddons.find((addon) => addon.slug === slug)
|
||||||
);
|
);
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (
|
if (
|
||||||
!this._updateType ||
|
!this._updateType ||
|
||||||
(this._updateType === "addon" && !this._addonInfo)
|
(this._updateType === "addon" && !this._addonInfo)
|
||||||
) {
|
) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const changelog = changelogUrl(this._updateType, this._version_latest);
|
const changelog = changelogUrl(this._updateType, this._version_latest);
|
||||||
|
12
package.json
12
package.json
@ -100,7 +100,7 @@
|
|||||||
"app-datepicker": "^5.1.0",
|
"app-datepicker": "^5.1.0",
|
||||||
"chart.js": "^3.3.2",
|
"chart.js": "^3.3.2",
|
||||||
"comlink": "^4.4.1",
|
"comlink": "^4.4.1",
|
||||||
"core-js": "^3.28.0",
|
"core-js": "^3.29.0",
|
||||||
"cropperjs": "^1.5.13",
|
"cropperjs": "^1.5.13",
|
||||||
"date-fns": "^2.29.3",
|
"date-fns": "^2.29.3",
|
||||||
"date-fns-tz": "^2.0.0",
|
"date-fns-tz": "^2.0.0",
|
||||||
@ -108,7 +108,7 @@
|
|||||||
"deep-freeze": "^0.0.1",
|
"deep-freeze": "^0.0.1",
|
||||||
"fuse.js": "^6.6.2",
|
"fuse.js": "^6.6.2",
|
||||||
"google-timezones-json": "^1.0.2",
|
"google-timezones-json": "^1.0.2",
|
||||||
"hls.js": "^1.3.3",
|
"hls.js": "^1.3.4",
|
||||||
"home-assistant-js-websocket": "^8.0.1",
|
"home-assistant-js-websocket": "^8.0.1",
|
||||||
"idb-keyval": "^6.2.0",
|
"idb-keyval": "^6.2.0",
|
||||||
"intl-messageformat": "^10.3.1",
|
"intl-messageformat": "^10.3.1",
|
||||||
@ -178,14 +178,16 @@
|
|||||||
"@types/marked": "^4",
|
"@types/marked": "^4",
|
||||||
"@types/mocha": "^10",
|
"@types/mocha": "^10",
|
||||||
"@types/qrcode": "^1.5.0",
|
"@types/qrcode": "^1.5.0",
|
||||||
|
"@types/serve-handler": "^6",
|
||||||
"@types/sortablejs": "^1",
|
"@types/sortablejs": "^1",
|
||||||
"@types/tar": "^6",
|
"@types/tar": "^6",
|
||||||
"@types/webspeechapi": "^0.0.29",
|
"@types/webspeechapi": "^0.0.29",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
"@typescript-eslint/eslint-plugin": "^5.54.0",
|
||||||
"@typescript-eslint/parser": "^5.53.0",
|
"@typescript-eslint/parser": "^5.54.0",
|
||||||
"@web/dev-server": "^0.1.35",
|
"@web/dev-server": "^0.1.35",
|
||||||
"@web/dev-server-rollup": "^0.2.11",
|
"@web/dev-server-rollup": "^0.2.11",
|
||||||
"babel-loader": "^9.1.2",
|
"babel-loader": "^9.1.2",
|
||||||
|
"babel-plugin-template-html-minifier": "^4.1.0",
|
||||||
"chai": "^4.3.7",
|
"chai": "^4.3.7",
|
||||||
"del": "^7.0.0",
|
"del": "^7.0.0",
|
||||||
"eslint": "^8.35.0",
|
"eslint": "^8.35.0",
|
||||||
@ -229,7 +231,7 @@
|
|||||||
"rollup-plugin-string": "^3.0.0",
|
"rollup-plugin-string": "^3.0.0",
|
||||||
"rollup-plugin-terser": "^5.3.0",
|
"rollup-plugin-terser": "^5.3.0",
|
||||||
"rollup-plugin-visualizer": "^5.9.0",
|
"rollup-plugin-visualizer": "^5.9.0",
|
||||||
"serve": "^11.3.2",
|
"serve-handler": "^6.1.5",
|
||||||
"sinon": "^15.0.1",
|
"sinon": "^15.0.1",
|
||||||
"source-map-url": "^0.4.1",
|
"source-map-url": "^0.4.1",
|
||||||
"systemjs": "^6.14.0",
|
"systemjs": "^6.14.0",
|
||||||
|
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "home-assistant-frontend"
|
name = "home-assistant-frontend"
|
||||||
version = "20230227.0"
|
version = "20230301.0"
|
||||||
license = {text = "Apache-2.0"}
|
license = {text = "Apache-2.0"}
|
||||||
description = "The Home Assistant frontend"
|
description = "The Home Assistant frontend"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -5,8 +5,8 @@ import {
|
|||||||
CSSResultGroup,
|
CSSResultGroup,
|
||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
|
nothing,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import "../components/ha-alert";
|
import "../components/ha-alert";
|
||||||
@ -134,11 +134,11 @@ export class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
|
|||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _renderForm(): TemplateResult {
|
private _renderForm() {
|
||||||
switch (this._state) {
|
switch (this._state) {
|
||||||
case "step":
|
case "step":
|
||||||
if (this._step == null) {
|
if (this._step == null) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
${this._renderStep(this._step)}
|
${this._renderStep(this._step)}
|
||||||
@ -176,11 +176,11 @@ export class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
|
|||||||
</ha-alert>
|
</ha-alert>
|
||||||
`;
|
`;
|
||||||
default:
|
default:
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _renderStep(step: DataEntryFlowStep): TemplateResult {
|
private _renderStep(step: DataEntryFlowStep) {
|
||||||
switch (step.type) {
|
switch (step.type) {
|
||||||
case "abort":
|
case "abort":
|
||||||
return html`
|
return html`
|
||||||
@ -202,7 +202,7 @@ export class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
|
|||||||
.content=${this._computeStepDescription(step)}
|
.content=${this._computeStepDescription(step)}
|
||||||
></ha-markdown>
|
></ha-markdown>
|
||||||
`
|
`
|
||||||
: html``}
|
: nothing}
|
||||||
<ha-form
|
<ha-form
|
||||||
.data=${this._stepData}
|
.data=${this._stepData}
|
||||||
.schema=${autocompleteLoginFields(step.data_schema)}
|
.schema=${autocompleteLoginFields(step.data_schema)}
|
||||||
@ -228,7 +228,7 @@ export class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
|
|||||||
: ""}
|
: ""}
|
||||||
`;
|
`;
|
||||||
default:
|
default:
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/** Constants to be used in the frontend. */
|
/** Constants to be used in the frontend. */
|
||||||
|
|
||||||
import {
|
import {
|
||||||
mdiAccount,
|
|
||||||
mdiAirFilter,
|
mdiAirFilter,
|
||||||
mdiAlert,
|
mdiAlert,
|
||||||
mdiAngleAcute,
|
mdiAngleAcute,
|
||||||
@ -48,7 +47,6 @@ import {
|
|||||||
mdiProgressClock,
|
mdiProgressClock,
|
||||||
mdiRayVertex,
|
mdiRayVertex,
|
||||||
mdiRemote,
|
mdiRemote,
|
||||||
mdiRobot,
|
|
||||||
mdiRobotVacuum,
|
mdiRobotVacuum,
|
||||||
mdiScriptText,
|
mdiScriptText,
|
||||||
mdiSineWave,
|
mdiSineWave,
|
||||||
@ -59,15 +57,12 @@ import {
|
|||||||
mdiThermostat,
|
mdiThermostat,
|
||||||
mdiTimerOutline,
|
mdiTimerOutline,
|
||||||
mdiTransmissionTower,
|
mdiTransmissionTower,
|
||||||
mdiVideo,
|
|
||||||
mdiWater,
|
mdiWater,
|
||||||
mdiWaterPercent,
|
mdiWaterPercent,
|
||||||
mdiWeatherCloudy,
|
|
||||||
mdiWeatherPouring,
|
mdiWeatherPouring,
|
||||||
mdiWeatherRainy,
|
mdiWeatherRainy,
|
||||||
mdiWeatherWindy,
|
mdiWeatherWindy,
|
||||||
mdiWeight,
|
mdiWeight,
|
||||||
mdiWhiteBalanceSunny,
|
|
||||||
mdiWifi,
|
mdiWifi,
|
||||||
} from "@mdi/js";
|
} from "@mdi/js";
|
||||||
|
|
||||||
@ -82,9 +77,7 @@ export const DEFAULT_DOMAIN_ICON = mdiBookmark;
|
|||||||
export const FIXED_DOMAIN_ICONS = {
|
export const FIXED_DOMAIN_ICONS = {
|
||||||
alert: mdiAlert,
|
alert: mdiAlert,
|
||||||
air_quality: mdiAirFilter,
|
air_quality: mdiAirFilter,
|
||||||
automation: mdiRobot,
|
|
||||||
calendar: mdiCalendar,
|
calendar: mdiCalendar,
|
||||||
camera: mdiVideo,
|
|
||||||
climate: mdiThermostat,
|
climate: mdiThermostat,
|
||||||
configurator: mdiCog,
|
configurator: mdiCog,
|
||||||
conversation: mdiMicrophoneMessage,
|
conversation: mdiMicrophoneMessage,
|
||||||
@ -105,7 +98,6 @@ export const FIXED_DOMAIN_ICONS = {
|
|||||||
notify: mdiCommentAlert,
|
notify: mdiCommentAlert,
|
||||||
number: mdiRayVertex,
|
number: mdiRayVertex,
|
||||||
persistent_notification: mdiBell,
|
persistent_notification: mdiBell,
|
||||||
person: mdiAccount,
|
|
||||||
plant: mdiFlower,
|
plant: mdiFlower,
|
||||||
proximity: mdiAppleSafari,
|
proximity: mdiAppleSafari,
|
||||||
remote: mdiRemote,
|
remote: mdiRemote,
|
||||||
@ -116,13 +108,10 @@ export const FIXED_DOMAIN_ICONS = {
|
|||||||
sensor: mdiEye,
|
sensor: mdiEye,
|
||||||
siren: mdiBullhorn,
|
siren: mdiBullhorn,
|
||||||
simple_alarm: mdiBell,
|
simple_alarm: mdiBell,
|
||||||
sun: mdiWhiteBalanceSunny,
|
|
||||||
text: mdiFormTextbox,
|
text: mdiFormTextbox,
|
||||||
timer: mdiTimerOutline,
|
timer: mdiTimerOutline,
|
||||||
updater: mdiCloudUpload,
|
updater: mdiCloudUpload,
|
||||||
vacuum: mdiRobotVacuum,
|
vacuum: mdiRobotVacuum,
|
||||||
water_heater: mdiThermometer,
|
|
||||||
weather: mdiWeatherCloudy,
|
|
||||||
zone: mdiMapMarkerRadius,
|
zone: mdiMapMarkerRadius,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@ import {
|
|||||||
mdiPowerPlug,
|
mdiPowerPlug,
|
||||||
mdiPowerPlugOff,
|
mdiPowerPlugOff,
|
||||||
mdiRestart,
|
mdiRestart,
|
||||||
|
mdiRobot,
|
||||||
|
mdiRobotOff,
|
||||||
mdiSpeaker,
|
mdiSpeaker,
|
||||||
mdiSpeakerOff,
|
mdiSpeakerOff,
|
||||||
mdiSpeakerPause,
|
mdiSpeakerPause,
|
||||||
@ -41,7 +43,12 @@ import {
|
|||||||
mdiTelevisionPlay,
|
mdiTelevisionPlay,
|
||||||
mdiToggleSwitchVariant,
|
mdiToggleSwitchVariant,
|
||||||
mdiToggleSwitchVariantOff,
|
mdiToggleSwitchVariantOff,
|
||||||
|
mdiVideo,
|
||||||
|
mdiVideoOff,
|
||||||
|
mdiWaterBoiler,
|
||||||
|
mdiWaterBoilerOff,
|
||||||
mdiWeatherNight,
|
mdiWeatherNight,
|
||||||
|
mdiWhiteBalanceSunny,
|
||||||
} from "@mdi/js";
|
} from "@mdi/js";
|
||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { UpdateEntity, updateIsInstalling } from "../../data/update";
|
import { UpdateEntity, updateIsInstalling } from "../../data/update";
|
||||||
@ -83,6 +90,9 @@ export const domainIconWithoutDefault = (
|
|||||||
case "alarm_control_panel":
|
case "alarm_control_panel":
|
||||||
return alarmPanelIcon(compareState);
|
return alarmPanelIcon(compareState);
|
||||||
|
|
||||||
|
case "automation":
|
||||||
|
return compareState === "off" ? mdiRobotOff : mdiRobot;
|
||||||
|
|
||||||
case "binary_sensor":
|
case "binary_sensor":
|
||||||
return binarySensorIcon(compareState, stateObj);
|
return binarySensorIcon(compareState, stateObj);
|
||||||
|
|
||||||
@ -96,6 +106,9 @@ export const domainIconWithoutDefault = (
|
|||||||
return mdiGestureTapButton;
|
return mdiGestureTapButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "camera":
|
||||||
|
return compareState === "off" ? mdiVideoOff : mdiVideo;
|
||||||
|
|
||||||
case "cover":
|
case "cover":
|
||||||
return coverIcon(compareState, stateObj);
|
return coverIcon(compareState, stateObj);
|
||||||
|
|
||||||
@ -221,7 +234,7 @@ export const domainIconWithoutDefault = (
|
|||||||
|
|
||||||
case "sun":
|
case "sun":
|
||||||
return stateObj?.state === "above_horizon"
|
return stateObj?.state === "above_horizon"
|
||||||
? FIXED_DOMAIN_ICONS[domain]
|
? mdiWhiteBalanceSunny
|
||||||
: mdiWeatherNight;
|
: mdiWeatherNight;
|
||||||
|
|
||||||
case "switch_as_x":
|
case "switch_as_x":
|
||||||
@ -237,6 +250,9 @@ export const domainIconWithoutDefault = (
|
|||||||
: mdiPackageUp
|
: mdiPackageUp
|
||||||
: mdiPackage;
|
: mdiPackage;
|
||||||
|
|
||||||
|
case "water_heater":
|
||||||
|
return compareState === "off" ? mdiWaterBoilerOff : mdiWaterBoiler;
|
||||||
|
|
||||||
case "weather":
|
case "weather":
|
||||||
return weatherIcon(stateObj?.state);
|
return weatherIcon(stateObj?.state);
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,10 @@ export class StateHistoryChartTimeline extends LitElement {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
afterUpdate: (y) => {
|
afterUpdate: (y) => {
|
||||||
if (this._yWidth !== Math.floor(y.width)) {
|
if (
|
||||||
|
this._yWidth !== Math.floor(y.width) &&
|
||||||
|
y.ticks.length === this.data.length
|
||||||
|
) {
|
||||||
this._yWidth = Math.floor(y.width);
|
this._yWidth = Math.floor(y.width);
|
||||||
fireEvent(this, "y-width-changed", {
|
fireEvent(this, "y-width-changed", {
|
||||||
value: this._yWidth,
|
value: this._yWidth,
|
||||||
|
@ -4,11 +4,12 @@ import {
|
|||||||
CSSResultGroup,
|
CSSResultGroup,
|
||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
|
nothing,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, property, state, eventOptions } from "lit/decorators";
|
import { customElement, eventOptions, property, state } from "lit/decorators";
|
||||||
import { isComponentLoaded } from "../../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../../common/config/is_component_loaded";
|
||||||
|
import { restoreScroll } from "../../common/decorators/restore-scroll";
|
||||||
import {
|
import {
|
||||||
HistoryResult,
|
HistoryResult,
|
||||||
LineChartUnit,
|
LineChartUnit,
|
||||||
@ -17,7 +18,6 @@ import {
|
|||||||
import type { HomeAssistant } from "../../types";
|
import type { HomeAssistant } from "../../types";
|
||||||
import "./state-history-chart-line";
|
import "./state-history-chart-line";
|
||||||
import "./state-history-chart-timeline";
|
import "./state-history-chart-timeline";
|
||||||
import { restoreScroll } from "../../common/decorators/restore-scroll";
|
|
||||||
|
|
||||||
const CANVAS_TIMELINE_ROWS_CHUNK = 10; // Split up the canvases to avoid hitting the render limit
|
const CANVAS_TIMELINE_ROWS_CHUNK = 10; // Split up the canvases to avoid hitting the render limit
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ export class StateHistoryCharts extends LitElement {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@restoreScroll(".container") private _savedScrollPos?: number;
|
@restoreScroll(".container") private _savedScrollPos?: number;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!isComponentLoaded(this.hass, "history")) {
|
if (!isComponentLoaded(this.hass, "history")) {
|
||||||
return html`<div class="info">
|
return html`<div class="info">
|
||||||
${this.hass.localize("ui.components.history_charts.history_disabled")}
|
${this.hass.localize("ui.components.history_charts.history_disabled")}
|
||||||
@ -130,9 +130,9 @@ export class StateHistoryCharts extends LitElement {
|
|||||||
private _renderHistoryItem = (
|
private _renderHistoryItem = (
|
||||||
item: TimelineEntity[] | LineChartUnit,
|
item: TimelineEntity[] | LineChartUnit,
|
||||||
index: number
|
index: number
|
||||||
): TemplateResult => {
|
) => {
|
||||||
if (!item || index === undefined) {
|
if (!item || index === undefined) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
if (!Array.isArray(item)) {
|
if (!Array.isArray(item)) {
|
||||||
return html`<div class="entry-container">
|
return html`<div class="entry-container">
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
CSSResultGroup,
|
CSSResultGroup,
|
||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
|
nothing,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
@ -73,7 +74,7 @@ export interface DataTableColumnData<T = any> extends DataTableSortColumnData {
|
|||||||
title: TemplateResult | string;
|
title: TemplateResult | string;
|
||||||
label?: TemplateResult | string;
|
label?: TemplateResult | string;
|
||||||
type?: "numeric" | "icon" | "icon-button" | "overflow-menu";
|
type?: "numeric" | "icon" | "icon-button" | "overflow-menu";
|
||||||
template?: (data: any, row: T) => TemplateResult | string;
|
template?: (data: any, row: T) => TemplateResult | string | typeof nothing;
|
||||||
width?: string;
|
width?: string;
|
||||||
maxWidth?: string;
|
maxWidth?: string;
|
||||||
grows?: boolean;
|
grows?: boolean;
|
||||||
@ -352,13 +353,10 @@ export class HaDataTable extends LitElement {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _renderRow = (
|
private _renderRow = (row: DataTableRowData, index: number) => {
|
||||||
row: DataTableRowData,
|
|
||||||
index: number
|
|
||||||
): TemplateResult => {
|
|
||||||
// not sure how this happens...
|
// not sure how this happens...
|
||||||
if (!row) {
|
if (!row) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
if (row.append) {
|
if (row.append) {
|
||||||
return html` <div class="mdc-data-table__row">${row.content}</div> `;
|
return html` <div class="mdc-data-table__row">${row.content}</div> `;
|
||||||
|
@ -67,11 +67,11 @@ const sortData = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure "undefined" is always sorted to the bottom
|
// Ensure "undefined" and "null" are always sorted to the bottom
|
||||||
if (valA === undefined && valB !== undefined) {
|
if (valA == null && valB != null) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (valB === undefined && valA !== undefined) {
|
if (valB == null && valA != null) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import "@material/mwc-button/mwc-button";
|
import "@material/mwc-button/mwc-button";
|
||||||
import { UnsubscribeFunc } from "home-assistant-js-websocket";
|
|
||||||
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
|
|
||||||
import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
||||||
|
import { UnsubscribeFunc } from "home-assistant-js-websocket";
|
||||||
|
import { html, LitElement, PropertyValues, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
@ -230,9 +230,9 @@ export class HaAreaDevicesPicker extends SubscribeMixin(LitElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._devices || !this._areas || !this._entities) {
|
if (!this._devices || !this._areas || !this._entities) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
const areas = this._getAreasWithDevices(
|
const areas = this._getAreasWithDevices(
|
||||||
this._devices,
|
this._devices,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import "@material/mwc-list/mwc-list-item";
|
import "@material/mwc-list/mwc-list-item";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { property, state } from "lit/decorators";
|
import { property, state } from "lit/decorators";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
import {
|
import {
|
||||||
@ -85,9 +85,9 @@ export abstract class HaDeviceAutomationPicker<
|
|||||||
return `${this._automations[idx].device_id}_${idx}`;
|
return `${this._automations[idx].device_id}_${idx}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (this._renderEmpty) {
|
if (this._renderEmpty) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
const value = this._value;
|
const value = this._value;
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
import { PolymerChangedEvent } from "../../polymer-types";
|
import { PolymerChangedEvent } from "../../polymer-types";
|
||||||
@ -49,9 +49,9 @@ class HaDevicesPicker extends LitElement {
|
|||||||
|
|
||||||
@property() public entityFilter?: HaDevicePickerEntityFilterFunc;
|
@property() public entityFilter?: HaDevicePickerEntityFilterFunc;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentDevices = this._currentDevices;
|
const currentDevices = this._currentDevices;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { HassEntity } from "home-assistant-js-websocket";
|
import type { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
@ -76,9 +76,9 @@ class HaEntitiesPickerLight extends LitElement {
|
|||||||
|
|
||||||
@property() public entityFilter?: HaEntityPickerEntityFilterFunc;
|
@property() public entityFilter?: HaEntityPickerEntityFilterFunc;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentEntities = this._currentEntities;
|
const currentEntities = this._currentEntities;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
|
import { html, LitElement, PropertyValues, nothing } from "lit";
|
||||||
import { customElement, property, query } from "lit/decorators";
|
import { customElement, property, query } from "lit/decorators";
|
||||||
import { formatAttributeName } from "../../data/entity_attributes";
|
import { formatAttributeName } from "../../data/entity_attributes";
|
||||||
import { PolymerChangedEvent } from "../../polymer-types";
|
import { PolymerChangedEvent } from "../../polymer-types";
|
||||||
@ -60,9 +60,9 @@ class HaEntityAttributePicker extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
|
import { html, LitElement, PropertyValues, nothing } from "lit";
|
||||||
import { customElement, property, query } from "lit/decorators";
|
import { customElement, property, query } from "lit/decorators";
|
||||||
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
import { computeStateDisplay } from "../../common/entity/compute_state_display";
|
import { computeStateDisplay } from "../../common/entity/compute_state_display";
|
||||||
import { PolymerChangedEvent } from "../../polymer-types";
|
|
||||||
import { getStates } from "../../common/entity/get_states";
|
import { getStates } from "../../common/entity/get_states";
|
||||||
|
import { formatAttributeValue } from "../../data/entity_attributes";
|
||||||
|
import { PolymerChangedEvent } from "../../polymer-types";
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
import "../ha-combo-box";
|
import "../ha-combo-box";
|
||||||
import type { HaComboBox } from "../ha-combo-box";
|
import type { HaComboBox } from "../ha-combo-box";
|
||||||
import { formatAttributeValue } from "../../data/entity_attributes";
|
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
|
||||||
|
|
||||||
export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;
|
export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;
|
||||||
|
|
||||||
@ -64,9 +64,9 @@ class HaEntityStatePicker extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
import type { PolymerChangedEvent } from "../../polymer-types";
|
import type { PolymerChangedEvent } from "../../polymer-types";
|
||||||
@ -56,9 +56,9 @@ class HaStatisticsPicker extends LitElement {
|
|||||||
})
|
})
|
||||||
public ignoreRestrictionsOnFirstStatistic = false;
|
public ignoreRestrictionsOnFirstStatistic = false;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ignoreRestriction =
|
const ignoreRestriction =
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
nothing,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { property, state } from "lit/decorators";
|
import { property, state } from "lit/decorators";
|
||||||
import { ifDefined } from "lit/directives/if-defined";
|
import { ifDefined } from "lit/directives/if-defined";
|
||||||
@ -45,7 +45,7 @@ export class StateBadge extends LitElement {
|
|||||||
return this.stateColor || (domain === "light" && this.stateColor !== false);
|
return this.stateColor || (domain === "light" && this.stateColor !== false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
const stateObj = this.stateObj;
|
const stateObj = this.stateObj;
|
||||||
|
|
||||||
// We either need a `stateObj` or one override
|
// We either need a `stateObj` or one override
|
||||||
@ -56,7 +56,7 @@ export class StateBadge extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this._showIcon) {
|
if (!this._showIcon) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const domain = stateObj ? computeStateDomain(stateObj) : undefined;
|
const domain = stateObj ? computeStateDomain(stateObj) : undefined;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import "@polymer/paper-tooltip/paper-tooltip";
|
import "@polymer/paper-tooltip/paper-tooltip";
|
||||||
import type { HassEntity } from "home-assistant-js-websocket";
|
import type { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { computeStateName } from "../../common/entity/compute_state_name";
|
import { computeStateName } from "../../common/entity/compute_state_name";
|
||||||
import { computeRTL } from "../../common/util/compute_rtl";
|
import { computeRTL } from "../../common/util/compute_rtl";
|
||||||
@ -21,9 +21,9 @@ class StateInfo extends LitElement {
|
|||||||
|
|
||||||
@property() public color?: string;
|
@property() public color?: string;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass || !this.stateObj) {
|
if (!this.hass || !this.stateObj) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const name = computeStateName(this.stateObj);
|
const name = computeStateName(this.stateObj);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { html, LitElement, TemplateResult } from "lit";
|
|
||||||
import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
||||||
|
import { html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { isComponentLoaded } from "../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../common/config/is_component_loaded";
|
||||||
import { fireEvent } from "../common/dom/fire_event";
|
import { fireEvent } from "../common/dom/fire_event";
|
||||||
@ -54,9 +54,9 @@ class HaAddonPicker extends LitElement {
|
|||||||
this._getAddons();
|
this._getAddons();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._addons) {
|
if (!this._addons) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<ha-combo-box
|
<ha-combo-box
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { fireEvent } from "../common/dom/fire_event";
|
import { fireEvent } from "../common/dom/fire_event";
|
||||||
import { SubscribeMixin } from "../mixins/subscribe-mixin";
|
import { SubscribeMixin } from "../mixins/subscribe-mixin";
|
||||||
@ -60,9 +60,9 @@ export class HaAreasPicker extends SubscribeMixin(LitElement) {
|
|||||||
|
|
||||||
@property({ type: Boolean }) public required?: boolean;
|
@property({ type: Boolean }) public required?: boolean;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentAreas = this._currentAreas;
|
const currentAreas = this._currentAreas;
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import {
|
||||||
|
css,
|
||||||
|
CSSResultGroup,
|
||||||
|
html,
|
||||||
|
LitElement,
|
||||||
|
TemplateResult,
|
||||||
|
nothing,
|
||||||
|
} from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import {
|
import {
|
||||||
formatAttributeName,
|
formatAttributeName,
|
||||||
@ -21,9 +28,9 @@ class HaAttributes extends LitElement {
|
|||||||
|
|
||||||
@state() private _expanded = false;
|
@state() private _expanded = false;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.stateObj) {
|
if (!this.stateObj) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const attributes = this.computeDisplayAttributes(
|
const attributes = this.computeDisplayAttributes(
|
||||||
@ -32,7 +39,7 @@ class HaAttributes extends LitElement {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
if (attributes.length === 0) {
|
if (attributes.length === 0) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import "@material/mwc-list/mwc-list-item";
|
import "@material/mwc-list/mwc-list-item";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { fireEvent } from "../common/dom/fire_event";
|
import { fireEvent } from "../common/dom/fire_event";
|
||||||
@ -51,9 +51,9 @@ class HaBluePrintPicker extends LitElement {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<ha-select
|
<ha-select
|
||||||
|
@ -4,7 +4,7 @@ import {
|
|||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
nothing,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { isComponentLoaded } from "../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../common/config/is_component_loaded";
|
||||||
@ -76,9 +76,9 @@ export class HaCameraStream extends LitElement {
|
|||||||
this._connected = false;
|
this._connected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.stateObj) {
|
if (!this.stateObj) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
if (__DEMO__ || this._shouldRenderMJPEG) {
|
if (__DEMO__ || this._shouldRenderMJPEG) {
|
||||||
return html`<img
|
return html`<img
|
||||||
@ -102,7 +102,7 @@ export class HaCameraStream extends LitElement {
|
|||||||
.url=${this._url}
|
.url=${this._url}
|
||||||
.posterUrl=${this._posterUrl}
|
.posterUrl=${this._posterUrl}
|
||||||
></ha-hls-player>`
|
></ha-hls-player>`
|
||||||
: html``;
|
: nothing;
|
||||||
}
|
}
|
||||||
if (this.stateObj.attributes.frontend_stream_type === STREAM_TYPE_WEB_RTC) {
|
if (this.stateObj.attributes.frontend_stream_type === STREAM_TYPE_WEB_RTC) {
|
||||||
return html`<ha-web-rtc-player
|
return html`<ha-web-rtc-player
|
||||||
@ -115,7 +115,7 @@ export class HaCameraStream extends LitElement {
|
|||||||
.posterUrl=${this._posterUrl}
|
.posterUrl=${this._posterUrl}
|
||||||
></ha-web-rtc-player>`;
|
></ha-web-rtc-player>`;
|
||||||
}
|
}
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
private get _shouldRenderMJPEG() {
|
private get _shouldRenderMJPEG() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
|
|
||||||
@customElement("ha-card")
|
@customElement("ha-card")
|
||||||
@ -70,11 +70,11 @@ export class HaCard extends LitElement {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
return html`
|
return html`
|
||||||
${this.header
|
${this.header
|
||||||
? html`<h1 class="card-header">${this.header}</h1>`
|
? html`<h1 class="card-header">${this.header}</h1>`
|
||||||
: html``}
|
: nothing}
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import "@material/mwc-list/mwc-list-item";
|
import "@material/mwc-list/mwc-list-item";
|
||||||
import { html, LitElement, TemplateResult } from "lit";
|
|
||||||
import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
||||||
|
import { html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { fireEvent } from "../common/dom/fire_event";
|
import { fireEvent } from "../common/dom/fire_event";
|
||||||
import { PolymerChangedEvent } from "../polymer-types";
|
import { caseInsensitiveStringCompare } from "../common/string/compare";
|
||||||
import { HomeAssistant } from "../types";
|
|
||||||
import type { HaComboBox } from "./ha-combo-box";
|
|
||||||
import { ConfigEntry, getConfigEntries } from "../data/config_entries";
|
import { ConfigEntry, getConfigEntries } from "../data/config_entries";
|
||||||
import { domainToName } from "../data/integration";
|
import { domainToName } from "../data/integration";
|
||||||
import { caseInsensitiveStringCompare } from "../common/string/compare";
|
import { PolymerChangedEvent } from "../polymer-types";
|
||||||
|
import { HomeAssistant } from "../types";
|
||||||
import { brandsUrl } from "../util/brands-url";
|
import { brandsUrl } from "../util/brands-url";
|
||||||
import "./ha-combo-box";
|
import "./ha-combo-box";
|
||||||
|
import type { HaComboBox } from "./ha-combo-box";
|
||||||
|
|
||||||
export interface ConfigEntryExtended extends ConfigEntry {
|
export interface ConfigEntryExtended extends ConfigEntry {
|
||||||
localized_domain_name?: string;
|
localized_domain_name?: string;
|
||||||
@ -72,9 +72,9 @@ class HaConfigEntryPicker extends LitElement {
|
|||||||
/>
|
/>
|
||||||
</mwc-list-item>`;
|
</mwc-list-item>`;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._configEntries) {
|
if (!this._configEntries) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<ha-combo-box
|
<ha-combo-box
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { mdiStop } from "@mdi/js";
|
import { mdiStop } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
import { computeCloseIcon, computeOpenIcon } from "../common/entity/cover_icon";
|
import { computeCloseIcon, computeOpenIcon } from "../common/entity/cover_icon";
|
||||||
@ -20,9 +20,9 @@ class HaCoverControls extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public stateObj!: CoverEntity;
|
@property({ attribute: false }) public stateObj!: CoverEntity;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.stateObj) {
|
if (!this.stateObj) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { mdiArrowBottomLeft, mdiArrowTopRight, mdiStop } from "@mdi/js";
|
import { mdiArrowBottomLeft, mdiArrowTopRight, mdiStop } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
import { supportsFeature } from "../common/entity/supports-feature";
|
import { supportsFeature } from "../common/entity/supports-feature";
|
||||||
@ -19,9 +19,9 @@ class HaCoverTiltControls extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) stateObj!: CoverEntity;
|
@property({ attribute: false }) stateObj!: CoverEntity;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.stateObj) {
|
if (!this.stateObj) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html` <ha-icon-button
|
return html` <ha-icon-button
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import "@material/mwc-button/mwc-button";
|
import "@material/mwc-button/mwc-button";
|
||||||
import "app-datepicker";
|
import "app-datepicker";
|
||||||
import { css, html, LitElement } from "lit";
|
import { css, html, LitElement, nothing } 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 { nextRender } from "../common/util/render-status";
|
import { nextRender } from "../common/util/render-status";
|
||||||
@ -38,7 +38,7 @@ export class HaDialogDatePicker extends LitElement {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (!this._params) {
|
if (!this._params) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`<ha-dialog open @closed=${this.closeDialog}>
|
return html`<ha-dialog open @closed=${this.closeDialog}>
|
||||||
<app-datepicker
|
<app-datepicker
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
nothing,
|
||||||
} 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";
|
||||||
@ -156,9 +156,9 @@ export class HaIcon extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.icon) {
|
if (!this.icon) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
if (this._legacy) {
|
if (this._legacy) {
|
||||||
return html`<iron-icon .icon=${this.icon}></iron-icon>`;
|
return html`<iron-icon .icon=${this.icon}></iron-icon>`;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import "./ha-markdown-element";
|
import "./ha-markdown-element";
|
||||||
|
|
||||||
@ -15,9 +15,9 @@ export class HaMarkdown extends LitElement {
|
|||||||
|
|
||||||
@property({ type: Boolean }) public breaks = false;
|
@property({ type: Boolean }) public breaks = false;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.content) {
|
if (!this.content) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`<ha-markdown-element
|
return html`<ha-markdown-element
|
||||||
|
@ -54,9 +54,9 @@ export class HaNetwork extends LitElement {
|
|||||||
|
|
||||||
@state() private _expanded?: boolean;
|
@state() private _expanded?: boolean;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (this.networkConfig === undefined) {
|
if (this.networkConfig === undefined) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
const configured_adapters = this.networkConfig.configured_adapters || [];
|
const configured_adapters = this.networkConfig.configured_adapters || [];
|
||||||
return html`
|
return html`
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
nothing,
|
||||||
} 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";
|
||||||
@ -70,9 +70,9 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._related) {
|
if (!this._related) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
if (Object.keys(this._related).length === 0) {
|
if (Object.keys(this._related).length === 0) {
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
|
import { html, LitElement, PropertyValues, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { ensureArray } from "../../common/array/ensure-array";
|
import { ensureArray } from "../../common/array/ensure-array";
|
||||||
@ -61,9 +61,9 @@ export class HaAreaSelector extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (this._hasIntegration(this.selector) && !this._entitySources) {
|
if (this._hasIntegration(this.selector) && !this._entitySources) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.selector.area?.multiple) {
|
if (!this.selector.area?.multiple) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { html, LitElement } from "lit";
|
import { html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { ensureArray } from "../../common/array/ensure-array";
|
import { ensureArray } from "../../common/array/ensure-array";
|
||||||
@ -66,7 +66,7 @@ export class HaDeviceSelector extends LitElement {
|
|||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
if (this._hasIntegration(this.selector) && !this._entitySources) {
|
if (this._hasIntegration(this.selector) && !this._entitySources) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.selector.device?.multiple) {
|
if (!this.selector.device?.multiple) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { html, LitElement, PropertyValues } from "lit";
|
import { html, LitElement, PropertyValues, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { ensureArray } from "../../common/array/ensure-array";
|
import { ensureArray } from "../../common/array/ensure-array";
|
||||||
import {
|
import {
|
||||||
@ -39,7 +39,7 @@ export class HaEntitySelector extends LitElement {
|
|||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
if (this._hasIntegration(this.selector) && !this._entitySources) {
|
if (this._hasIntegration(this.selector) && !this._entitySources) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.selector.entity?.multiple) {
|
if (!this.selector.entity?.multiple) {
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
nothing,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
@ -70,9 +70,9 @@ export class HaTargetSelector extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (this._hasIntegration(this.selector) && !this._entitySources) {
|
if (this._hasIntegration(this.selector) && !this._entitySources) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`<ha-target-picker
|
return html`<ha-target-picker
|
||||||
|
@ -29,6 +29,7 @@ import {
|
|||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
|
nothing,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, eventOptions, property, state } from "lit/decorators";
|
import { customElement, eventOptions, property, state } from "lit/decorators";
|
||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
@ -241,7 +242,7 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
|||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
|
@ -12,7 +12,7 @@ import {
|
|||||||
import "@polymer/paper-tooltip/paper-tooltip";
|
import "@polymer/paper-tooltip/paper-tooltip";
|
||||||
import { ComboBoxLightOpenedChangedEvent } from "@vaadin/combo-box/vaadin-combo-box-light";
|
import { ComboBoxLightOpenedChangedEvent } from "@vaadin/combo-box/vaadin-combo-box-light";
|
||||||
import { HassEntity, HassServiceTarget } from "home-assistant-js-websocket";
|
import { HassEntity, HassServiceTarget } from "home-assistant-js-websocket";
|
||||||
import { css, CSSResultGroup, html, LitElement, unsafeCSS } from "lit";
|
import { css, CSSResultGroup, html, LitElement, unsafeCSS, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
import { ensureArray } from "../common/array/ensure-array";
|
import { ensureArray } from "../common/array/ensure-array";
|
||||||
@ -278,7 +278,7 @@ export class HaTargetPicker extends LitElement {
|
|||||||
|
|
||||||
private _renderPicker() {
|
private _renderPicker() {
|
||||||
if (!this._addMode) {
|
if (!this._addMode) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`<mwc-menu-surface
|
return html`<mwc-menu-surface
|
||||||
open
|
open
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { mdiLightbulbOutline } from "@mdi/js";
|
import { mdiLightbulbOutline } from "@mdi/js";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { property, customElement } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { HomeAssistant } from "../types";
|
import { HomeAssistant } from "../types";
|
||||||
|
|
||||||
import "./ha-svg-icon";
|
import "./ha-svg-icon";
|
||||||
@ -9,9 +9,9 @@ import "./ha-svg-icon";
|
|||||||
class HaTip extends LitElement {
|
class HaTip extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { DEFAULT_SCHEMA, dump, load, Schema } from "js-yaml";
|
import { DEFAULT_SCHEMA, dump, load, Schema } from "js-yaml";
|
||||||
import { html, LitElement, TemplateResult } from "lit";
|
import { html, LitElement, nothing } 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 type { HomeAssistant } from "../types";
|
import type { HomeAssistant } from "../types";
|
||||||
@ -56,9 +56,9 @@ export class HaYamlEditor extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (this._yaml === undefined) {
|
if (this._yaml === undefined) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
${this.label
|
${this.label
|
||||||
|
@ -2,7 +2,7 @@ import { animate } from "@lit-labs/motion";
|
|||||||
import "@material/mwc-list/mwc-list";
|
import "@material/mwc-list/mwc-list";
|
||||||
import "@material/mwc-list/mwc-list-item";
|
import "@material/mwc-list/mwc-list-item";
|
||||||
import { mdiClose, mdiDelete } from "@mdi/js";
|
import { mdiClose, mdiDelete } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { repeat } from "lit/directives/repeat";
|
import { repeat } from "lit/directives/repeat";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
@ -18,11 +18,11 @@ import {
|
|||||||
import { showConfirmationDialog } from "../../dialogs/generic/show-dialog-box";
|
import { showConfirmationDialog } from "../../dialogs/generic/show-dialog-box";
|
||||||
import { haStyleDialog } from "../../resources/styles";
|
import { haStyleDialog } from "../../resources/styles";
|
||||||
import type { HomeAssistant } from "../../types";
|
import type { HomeAssistant } from "../../types";
|
||||||
|
import "../ha-check-list-item";
|
||||||
import "../ha-circular-progress";
|
import "../ha-circular-progress";
|
||||||
import "../ha-dialog";
|
import "../ha-dialog";
|
||||||
import "../ha-header-bar";
|
import "../ha-header-bar";
|
||||||
import "../ha-svg-icon";
|
import "../ha-svg-icon";
|
||||||
import "../ha-check-list-item";
|
|
||||||
import "./ha-media-player-browse";
|
import "./ha-media-player-browse";
|
||||||
import "./ha-media-upload-button";
|
import "./ha-media-upload-button";
|
||||||
import type { MediaManageDialogParams } from "./show-media-manage-dialog";
|
import type { MediaManageDialogParams } from "./show-media-manage-dialog";
|
||||||
@ -60,9 +60,9 @@ class DialogMediaManage extends LitElement {
|
|||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._params) {
|
if (!this._params) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const children =
|
const children =
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import "../ha-header-bar";
|
|
||||||
import { mdiArrowLeft, mdiClose } from "@mdi/js";
|
import { mdiArrowLeft, mdiClose } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { fireEvent, HASSDomEvent } from "../../common/dom/fire_event";
|
import { fireEvent, HASSDomEvent } from "../../common/dom/fire_event";
|
||||||
import { computeRTLDirection } from "../../common/util/compute_rtl";
|
import { computeRTLDirection } from "../../common/util/compute_rtl";
|
||||||
@ -12,8 +11,9 @@ import type {
|
|||||||
import { haStyleDialog } from "../../resources/styles";
|
import { haStyleDialog } from "../../resources/styles";
|
||||||
import type { HomeAssistant } from "../../types";
|
import type { HomeAssistant } from "../../types";
|
||||||
import "../ha-dialog";
|
import "../ha-dialog";
|
||||||
import "./ha-media-player-browse";
|
import "../ha-header-bar";
|
||||||
import "./ha-media-manage-button";
|
import "./ha-media-manage-button";
|
||||||
|
import "./ha-media-player-browse";
|
||||||
import type {
|
import type {
|
||||||
HaMediaPlayerBrowse,
|
HaMediaPlayerBrowse,
|
||||||
MediaPlayerItemId,
|
MediaPlayerItemId,
|
||||||
@ -49,9 +49,9 @@ class DialogMediaPlayerBrowse extends LitElement {
|
|||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._params || !this._navigateIds) {
|
if (!this._params || !this._navigateIds) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import { mdiFolderEdit } from "@mdi/js";
|
|
||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import { mdiFolderEdit } from "@mdi/js";
|
||||||
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
import { MediaPlayerItem } from "../../data/media-player";
|
import { MediaPlayerItem } from "../../data/media-player";
|
||||||
import "../ha-svg-icon";
|
|
||||||
import { isLocalMediaSourceContentId } from "../../data/media_source";
|
import { isLocalMediaSourceContentId } from "../../data/media_source";
|
||||||
import type { HomeAssistant } from "../../types";
|
import type { HomeAssistant } from "../../types";
|
||||||
|
import "../ha-svg-icon";
|
||||||
import { showMediaManageDialog } from "./show-media-manage-dialog";
|
import { showMediaManageDialog } from "./show-media-manage-dialog";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HASSDomEvents {
|
interface HASSDomEvents {
|
||||||
@ -23,12 +23,12 @@ class MediaManageButton extends LitElement {
|
|||||||
|
|
||||||
@state() _uploading = 0;
|
@state() _uploading = 0;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (
|
if (
|
||||||
!this.currentItem ||
|
!this.currentItem ||
|
||||||
!isLocalMediaSourceContentId(this.currentItem.media_content_id || "")
|
!isLocalMediaSourceContentId(this.currentItem.media_content_id || "")
|
||||||
) {
|
) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<mwc-button
|
<mwc-button
|
||||||
|
@ -13,6 +13,7 @@ import {
|
|||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
|
nothing,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import {
|
import {
|
||||||
customElement,
|
customElement,
|
||||||
@ -311,7 +312,7 @@ export class HaMediaPlayerBrowse extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (this._error) {
|
if (this._error) {
|
||||||
return html`
|
return html`
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@ -388,7 +389,7 @@ export class HaMediaPlayerBrowse extends LitElement {
|
|||||||
: ""}
|
: ""}
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
: html``}
|
: nothing}
|
||||||
<div class="header-info">
|
<div class="header-info">
|
||||||
<div class="breadcrumb">
|
<div class="breadcrumb">
|
||||||
<h1 class="title">${currentItem.title}</h1>
|
<h1 class="title">${currentItem.title}</h1>
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
import { mdiUpload } from "@mdi/js";
|
|
||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import { mdiUpload } from "@mdi/js";
|
||||||
|
import { css, html, LitElement, nothing } 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 { MediaPlayerItem } from "../../data/media-player";
|
import { MediaPlayerItem } from "../../data/media-player";
|
||||||
import "../ha-circular-progress";
|
|
||||||
import "../ha-svg-icon";
|
|
||||||
import {
|
import {
|
||||||
isLocalMediaSourceContentId,
|
isLocalMediaSourceContentId,
|
||||||
uploadLocalMedia,
|
uploadLocalMedia,
|
||||||
} from "../../data/media_source";
|
} from "../../data/media_source";
|
||||||
import type { HomeAssistant } from "../../types";
|
|
||||||
import { showAlertDialog } from "../../dialogs/generic/show-dialog-box";
|
import { showAlertDialog } from "../../dialogs/generic/show-dialog-box";
|
||||||
|
import type { HomeAssistant } from "../../types";
|
||||||
|
import "../ha-circular-progress";
|
||||||
|
import "../ha-svg-icon";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HASSDomEvents {
|
interface HASSDomEvents {
|
||||||
@ -28,12 +28,12 @@ class MediaUploadButton extends LitElement {
|
|||||||
|
|
||||||
@state() _uploading = 0;
|
@state() _uploading = 0;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (
|
if (
|
||||||
!this.currentItem ||
|
!this.currentItem ||
|
||||||
!isLocalMediaSourceContentId(this.currentItem.media_content_id || "")
|
!isLocalMediaSourceContentId(this.currentItem.media_content_id || "")
|
||||||
) {
|
) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<mwc-button
|
<mwc-button
|
||||||
|
@ -14,6 +14,7 @@ import {
|
|||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
|
nothing,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { ifDefined } from "lit/directives/if-defined";
|
import { ifDefined } from "lit/directives/if-defined";
|
||||||
@ -595,9 +596,9 @@ export class HaAutomationTracer extends LitElement {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.trace) {
|
if (!this.trace) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const entries: TemplateResult[] = [];
|
const entries: TemplateResult[] = [];
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
import { styleMap } from "lit/directives/style-map";
|
import { styleMap } from "lit/directives/style-map";
|
||||||
@ -9,9 +9,9 @@ import { computeUserInitials } from "../../data/user";
|
|||||||
class PersonBadge extends LitElement {
|
class PersonBadge extends LitElement {
|
||||||
@property({ attribute: false }) public person?: Person;
|
@property({ attribute: false }) public person?: Person;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.person) {
|
if (!this.person) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const picture = this.person.picture;
|
const picture = this.person.picture;
|
||||||
|
@ -4,7 +4,7 @@ import {
|
|||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
nothing,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
@ -47,9 +47,9 @@ class UserBadge extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass || !this.user) {
|
if (!this.hass || !this.user) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
const picture = this._personPicture;
|
const picture = this._personPicture;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { mdiClose } from "@mdi/js";
|
import { mdiClose } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { guard } from "lit/directives/guard";
|
import { guard } from "lit/directives/guard";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
@ -34,9 +34,9 @@ class HaUsersPickerLight extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass || !this.users) {
|
if (!this.hass || !this.users) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const notSelectedUsers = this._notSelectedUsers(this.users, this.value);
|
const notSelectedUsers = this._notSelectedUsers(this.users, this.value);
|
||||||
|
@ -11,10 +11,8 @@ import {
|
|||||||
} from "date-fns/esm";
|
} from "date-fns/esm";
|
||||||
import { Collection, getCollection } from "home-assistant-js-websocket";
|
import { Collection, getCollection } from "home-assistant-js-websocket";
|
||||||
import { groupBy } from "../common/util/group-by";
|
import { groupBy } from "../common/util/group-by";
|
||||||
import { subscribeOne } from "../common/util/subscribe-one";
|
|
||||||
import { HomeAssistant } from "../types";
|
import { HomeAssistant } from "../types";
|
||||||
import { ConfigEntry, getConfigEntries } from "./config_entries";
|
import { ConfigEntry, getConfigEntries } from "./config_entries";
|
||||||
import { subscribeEntityRegistry } from "./entity_registry";
|
|
||||||
import {
|
import {
|
||||||
fetchStatistics,
|
fetchStatistics,
|
||||||
getStatisticMetadata,
|
getStatisticMetadata,
|
||||||
@ -341,9 +339,8 @@ const getEnergyData = async (
|
|||||||
end?: Date,
|
end?: Date,
|
||||||
compare?: boolean
|
compare?: boolean
|
||||||
): Promise<EnergyData> => {
|
): Promise<EnergyData> => {
|
||||||
const [configEntries, entityRegistryEntries, info] = await Promise.all([
|
const [configEntries, info] = await Promise.all([
|
||||||
getConfigEntries(hass, { domain: "co2signal" }),
|
getConfigEntries(hass, { domain: "co2signal" }),
|
||||||
subscribeOne(hass.connection, subscribeEntityRegistry),
|
|
||||||
getEnergyInfo(hass),
|
getEnergyInfo(hass),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -352,15 +349,14 @@ const getEnergyData = async (
|
|||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
let co2SignalEntity: string | undefined;
|
let co2SignalEntity: string | undefined;
|
||||||
|
|
||||||
if (co2SignalConfigEntry) {
|
if (co2SignalConfigEntry) {
|
||||||
for (const entry of entityRegistryEntries) {
|
for (const entity of Object.values(hass.entities)) {
|
||||||
if (entry.config_entry_id !== co2SignalConfigEntry.entry_id) {
|
if (entity.platform !== "co2signal") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The integration offers 2 entities. We want the % one.
|
// The integration offers 2 entities. We want the % one.
|
||||||
const co2State = hass.states[entry.entity_id];
|
const co2State = hass.states[entity.entity_id];
|
||||||
if (!co2State || co2State.attributes.unit_of_measurement !== "%") {
|
if (!co2State || co2State.attributes.unit_of_measurement !== "%") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -405,34 +401,35 @@ const getEnergyData = async (
|
|||||||
volume: lengthUnit === "km" ? "L" : "gal",
|
volume: lengthUnit === "km" ? "L" : "gal",
|
||||||
};
|
};
|
||||||
|
|
||||||
const stats = {
|
const _energyStats: Statistics | Promise<Statistics> = energyStatIds.length
|
||||||
...(energyStatIds.length
|
? fetchStatistics(
|
||||||
? await fetchStatistics(
|
hass!,
|
||||||
hass!,
|
startMinHour,
|
||||||
startMinHour,
|
end,
|
||||||
end,
|
energyStatIds,
|
||||||
energyStatIds,
|
period,
|
||||||
period,
|
energyUnits,
|
||||||
energyUnits,
|
["sum"]
|
||||||
["sum"]
|
)
|
||||||
)
|
: {};
|
||||||
: {}),
|
const _waterStats: Statistics | Promise<Statistics> = waterStatIds.length
|
||||||
...(waterStatIds.length
|
? fetchStatistics(
|
||||||
? await fetchStatistics(
|
hass!,
|
||||||
hass!,
|
startMinHour,
|
||||||
startMinHour,
|
end,
|
||||||
end,
|
waterStatIds,
|
||||||
waterStatIds,
|
period,
|
||||||
period,
|
waterUnits,
|
||||||
waterUnits,
|
["sum"]
|
||||||
["sum"]
|
)
|
||||||
)
|
: {};
|
||||||
: {}),
|
|
||||||
};
|
|
||||||
|
|
||||||
let statsCompare;
|
let statsCompare;
|
||||||
let startCompare;
|
let startCompare;
|
||||||
let endCompare;
|
let endCompare;
|
||||||
|
let _energyStatsCompare: Statistics | Promise<Statistics> = {};
|
||||||
|
let _waterStatsCompare: Statistics | Promise<Statistics> = {};
|
||||||
|
|
||||||
if (compare) {
|
if (compare) {
|
||||||
if (dayDifference > 27 && dayDifference < 32) {
|
if (dayDifference > 27 && dayDifference < 32) {
|
||||||
// When comparing a month, we want to start at the begining of the month
|
// When comparing a month, we want to start at the begining of the month
|
||||||
@ -443,38 +440,36 @@ const getEnergyData = async (
|
|||||||
|
|
||||||
const compareStartMinHour = addHours(startCompare, -1);
|
const compareStartMinHour = addHours(startCompare, -1);
|
||||||
endCompare = addMilliseconds(start, -1);
|
endCompare = addMilliseconds(start, -1);
|
||||||
|
if (energyStatIds.length) {
|
||||||
statsCompare = {
|
_energyStatsCompare = fetchStatistics(
|
||||||
...(energyStatIds.length
|
hass!,
|
||||||
? await fetchStatistics(
|
compareStartMinHour,
|
||||||
hass!,
|
endCompare,
|
||||||
compareStartMinHour,
|
energyStatIds,
|
||||||
endCompare,
|
period,
|
||||||
energyStatIds,
|
energyUnits,
|
||||||
period,
|
["sum"]
|
||||||
energyUnits,
|
);
|
||||||
["sum"]
|
}
|
||||||
)
|
if (waterStatIds.length) {
|
||||||
: {}),
|
_waterStatsCompare = fetchStatistics(
|
||||||
...(waterStatIds.length
|
hass!,
|
||||||
? await fetchStatistics(
|
compareStartMinHour,
|
||||||
hass!,
|
endCompare,
|
||||||
compareStartMinHour,
|
waterStatIds,
|
||||||
endCompare,
|
period,
|
||||||
waterStatIds,
|
waterUnits,
|
||||||
period,
|
["sum"]
|
||||||
waterUnits,
|
);
|
||||||
["sum"]
|
}
|
||||||
)
|
|
||||||
: {}),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let fossilEnergyConsumption: FossilEnergyConsumption | undefined;
|
let _fossilEnergyConsumption: undefined | Promise<FossilEnergyConsumption>;
|
||||||
let fossilEnergyConsumptionCompare: FossilEnergyConsumption | undefined;
|
let _fossilEnergyConsumptionCompare:
|
||||||
|
| undefined
|
||||||
|
| Promise<FossilEnergyConsumption>;
|
||||||
if (co2SignalEntity !== undefined) {
|
if (co2SignalEntity !== undefined) {
|
||||||
fossilEnergyConsumption = await getFossilEnergyConsumption(
|
_fossilEnergyConsumption = getFossilEnergyConsumption(
|
||||||
hass!,
|
hass!,
|
||||||
start,
|
start,
|
||||||
consumptionStatIDs,
|
consumptionStatIDs,
|
||||||
@ -483,7 +478,7 @@ const getEnergyData = async (
|
|||||||
dayDifference > 35 ? "month" : dayDifference > 2 ? "day" : "hour"
|
dayDifference > 35 ? "month" : dayDifference > 2 ? "day" : "hour"
|
||||||
);
|
);
|
||||||
if (compare) {
|
if (compare) {
|
||||||
fossilEnergyConsumptionCompare = await getFossilEnergyConsumption(
|
_fossilEnergyConsumptionCompare = getFossilEnergyConsumption(
|
||||||
hass!,
|
hass!,
|
||||||
startCompare,
|
startCompare,
|
||||||
consumptionStatIDs,
|
consumptionStatIDs,
|
||||||
@ -494,6 +489,39 @@ const getEnergyData = async (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const statsMetadata: Record<string, StatisticsMetaData> = {};
|
||||||
|
const _getStatisticMetadata:
|
||||||
|
| Promise<StatisticsMetaData[]>
|
||||||
|
| StatisticsMetaData[] = allStatIDs.length
|
||||||
|
? getStatisticMetadata(hass, allStatIDs)
|
||||||
|
: [];
|
||||||
|
const [
|
||||||
|
energyStats,
|
||||||
|
waterStats,
|
||||||
|
energyStatsCompare,
|
||||||
|
waterStatsCompare,
|
||||||
|
statsMetadataArray,
|
||||||
|
fossilEnergyConsumption,
|
||||||
|
fossilEnergyConsumptionCompare,
|
||||||
|
] = await Promise.all([
|
||||||
|
_energyStats,
|
||||||
|
_waterStats,
|
||||||
|
_energyStatsCompare,
|
||||||
|
_waterStatsCompare,
|
||||||
|
_getStatisticMetadata,
|
||||||
|
_fossilEnergyConsumption,
|
||||||
|
_fossilEnergyConsumptionCompare,
|
||||||
|
]);
|
||||||
|
const stats = { ...energyStats, ...waterStats };
|
||||||
|
if (compare) {
|
||||||
|
statsCompare = { ...energyStatsCompare, ...waterStatsCompare };
|
||||||
|
}
|
||||||
|
if (allStatIDs.length) {
|
||||||
|
statsMetadataArray.forEach((x) => {
|
||||||
|
statsMetadata[x.statistic_id] = x;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Object.values(stats).forEach((stat) => {
|
Object.values(stats).forEach((stat) => {
|
||||||
// if the start of the first value is after the requested period, we have the first data point, and should add a zero point
|
// if the start of the first value is after the requested period, we have the first data point, and should add a zero point
|
||||||
if (stat.length && new Date(stat[0].start) > startMinHour) {
|
if (stat.length && new Date(stat[0].start) > startMinHour) {
|
||||||
@ -507,12 +535,6 @@ const getEnergyData = async (
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const statsMetadataArray = await getStatisticMetadata(hass, allStatIDs);
|
|
||||||
const statsMetadata: Record<string, StatisticsMetaData> = {};
|
|
||||||
statsMetadataArray.forEach((x) => {
|
|
||||||
statsMetadata[x.statistic_id] = x;
|
|
||||||
});
|
|
||||||
|
|
||||||
const data: EnergyData = {
|
const data: EnergyData = {
|
||||||
start,
|
start,
|
||||||
end,
|
end,
|
||||||
|
@ -523,3 +523,18 @@ export const isForecastHourly = (
|
|||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type WeatherUnits = {
|
||||||
|
precipitation_unit: string[];
|
||||||
|
pressure_unit: string[];
|
||||||
|
temperature_unit: string[];
|
||||||
|
visibility_unit: string[];
|
||||||
|
wind_speed_unit: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getWeatherConvertibleUnits = (
|
||||||
|
hass: HomeAssistant
|
||||||
|
): Promise<{ units: WeatherUnits }> =>
|
||||||
|
hass.callWS({
|
||||||
|
type: "weather/convertible_units",
|
||||||
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import "@material/mwc-button/mwc-button";
|
import "@material/mwc-button/mwc-button";
|
||||||
import { mdiDeleteOutline, mdiPlus } from "@mdi/js";
|
import { mdiDeleteOutline, mdiPlus } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } 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 "../../components/ha-alert";
|
import "../../components/ha-alert";
|
||||||
@ -40,9 +40,9 @@ class DialogAliases extends LitElement {
|
|||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._params) {
|
if (!this._params) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import "@material/mwc-button/mwc-button";
|
import "@material/mwc-button/mwc-button";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } 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 { computeRTLDirection } from "../../common/util/compute_rtl";
|
import { computeRTLDirection } from "../../common/util/compute_rtl";
|
||||||
@ -45,9 +45,9 @@ class DialogConfigEntrySystemOptions extends LitElement {
|
|||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._params) {
|
if (!this._params) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
nothing,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { fireEvent, HASSDomEvent } from "../../common/dom/fire_event";
|
import { fireEvent, HASSDomEvent } from "../../common/dom/fire_event";
|
||||||
@ -202,9 +202,9 @@ class DataEntryFlowDialog extends LitElement {
|
|||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._params) {
|
if (!this._params) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,19 +1,13 @@
|
|||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import {
|
import { CSSResultGroup, html, LitElement, PropertyValues, nothing } from "lit";
|
||||||
CSSResultGroup,
|
|
||||||
html,
|
|
||||||
LitElement,
|
|
||||||
TemplateResult,
|
|
||||||
PropertyValues,
|
|
||||||
} from "lit";
|
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
import { DataEntryFlowStepAbort } from "../../data/data_entry_flow";
|
import { DataEntryFlowStepAbort } from "../../data/data_entry_flow";
|
||||||
import { HomeAssistant } from "../../types";
|
|
||||||
import { showAddApplicationCredentialDialog } from "../../panels/config/application_credentials/show-dialog-add-application-credential";
|
import { showAddApplicationCredentialDialog } from "../../panels/config/application_credentials/show-dialog-add-application-credential";
|
||||||
import { configFlowContentStyles } from "./styles";
|
import { HomeAssistant } from "../../types";
|
||||||
import { DataEntryFlowDialogParams } from "./show-dialog-data-entry-flow";
|
|
||||||
import { showConfigFlowDialog } from "./show-dialog-config-flow";
|
import { showConfigFlowDialog } from "./show-dialog-config-flow";
|
||||||
|
import { DataEntryFlowDialogParams } from "./show-dialog-data-entry-flow";
|
||||||
|
import { configFlowContentStyles } from "./styles";
|
||||||
|
|
||||||
@customElement("step-flow-abort")
|
@customElement("step-flow-abort")
|
||||||
class StepFlowAbort extends LitElement {
|
class StepFlowAbort extends LitElement {
|
||||||
@ -32,9 +26,9 @@ class StepFlowAbort extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (this.step.reason === "missing_credentials") {
|
if (this.step.reason === "missing_credentials") {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<h2>${this.hass.localize(`component.${this.domain}.title`)}</h2>
|
<h2>${this.hass.localize(`component.${this.domain}.title`)}</h2>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import "@material/mwc-button/mwc-button";
|
import "@material/mwc-button/mwc-button";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
import { createCloseHeading } from "../../components/ha-dialog";
|
import { createCloseHeading } from "../../components/ha-dialog";
|
||||||
@ -29,9 +29,9 @@ class DomainTogglerDialog
|
|||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._params) {
|
if (!this._params) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const domains = this._params.domains
|
const domains = this._params.domains
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import "@material/mwc-button/mwc-button";
|
import "@material/mwc-button/mwc-button";
|
||||||
import { mdiAlertOutline } from "@mdi/js";
|
import { mdiAlertOutline } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
import { ifDefined } from "lit/directives/if-defined";
|
import { ifDefined } from "lit/directives/if-defined";
|
||||||
@ -35,9 +35,9 @@ class DialogBox extends LitElement {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._params) {
|
if (!this._params) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const confirmPrompt = this._params.confirmation || this._params.prompt;
|
const confirmPrompt = this._params.confirmation || this._params.prompt;
|
||||||
|
@ -128,7 +128,9 @@ export class HaMoreInfoToggle extends LitElement {
|
|||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
return css`
|
return css`
|
||||||
ha-control-switch {
|
ha-control-switch {
|
||||||
height: 320px;
|
height: 45vh;
|
||||||
|
max-height: 320px;
|
||||||
|
min-height: 200px;
|
||||||
--control-switch-thickness: 100px;
|
--control-switch-thickness: 100px;
|
||||||
--control-switch-border-radius: 24px;
|
--control-switch-border-radius: 24px;
|
||||||
--control-switch-padding: 6px;
|
--control-switch-padding: 6px;
|
||||||
@ -138,7 +140,9 @@ export class HaMoreInfoToggle extends LitElement {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 320px;
|
height: 45vh;
|
||||||
|
max-height: 320px;
|
||||||
|
min-height: 200px;
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,9 @@ export class HaMoreInfoLightBrightness extends LitElement {
|
|||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
return css`
|
return css`
|
||||||
ha-control-slider {
|
ha-control-slider {
|
||||||
height: 320px;
|
height: 45vh;
|
||||||
|
max-height: 320px;
|
||||||
|
min-height: 200px;
|
||||||
--control-slider-thickness: 100px;
|
--control-slider-thickness: 100px;
|
||||||
--control-slider-border-radius: 24px;
|
--control-slider-border-radius: 24px;
|
||||||
--control-slider-color: var(--primary-color);
|
--control-slider-color: var(--primary-color);
|
||||||
|
@ -7,8 +7,8 @@ import {
|
|||||||
CSSResultGroup,
|
CSSResultGroup,
|
||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
|
nothing,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import "../../../../components/ha-button-toggle-group";
|
import "../../../../components/ha-button-toggle-group";
|
||||||
@ -62,9 +62,9 @@ class MoreInfoViewLightColorPicker extends LitElement {
|
|||||||
: undefined;
|
: undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.params || !this.stateObj) {
|
if (!this.params || !this.stateObj) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const supportsRgbww = lightSupportsColorMode(
|
const supportsRgbww = lightSupportsColorMode(
|
||||||
@ -97,15 +97,19 @@ class MoreInfoViewLightColorPicker extends LitElement {
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
${this._mode === LightColorMode.COLOR_TEMP
|
${this._mode === LightColorMode.COLOR_TEMP
|
||||||
? html`
|
? html`
|
||||||
|
<p class="color-temp-value">
|
||||||
|
${this._ctSliderValue ? `${this._ctSliderValue} K` : nothing}
|
||||||
|
</p>
|
||||||
<ha-control-slider
|
<ha-control-slider
|
||||||
vertical
|
vertical
|
||||||
class="color_temp"
|
class="color-temp"
|
||||||
label=${this.hass.localize("ui.card.light.color_temperature")}
|
label=${this.hass.localize("ui.card.light.color_temperature")}
|
||||||
min="1"
|
min="1"
|
||||||
max="100"
|
max="100"
|
||||||
mode="cursor"
|
mode="cursor"
|
||||||
.value=${this._ctSliderValue}
|
.value=${this._ctSliderValue}
|
||||||
@value-changed=${this._ctSliderChanged}
|
@value-changed=${this._ctSliderChanged}
|
||||||
|
@slider-moved=${this._ctSliderMoved}
|
||||||
.min=${this.stateObj.attributes.min_color_temp_kelvin!}
|
.min=${this.stateObj.attributes.min_color_temp_kelvin!}
|
||||||
.max=${this.stateObj.attributes.max_color_temp_kelvin!}
|
.max=${this.stateObj.attributes.max_color_temp_kelvin!}
|
||||||
>
|
>
|
||||||
@ -114,7 +118,7 @@ class MoreInfoViewLightColorPicker extends LitElement {
|
|||||||
: ""}
|
: ""}
|
||||||
${this._mode === "color"
|
${this._mode === "color"
|
||||||
? html`
|
? html`
|
||||||
<div class="segmentationContainer">
|
<div class="segmentation-container">
|
||||||
<ha-color-picker
|
<ha-color-picker
|
||||||
class="color"
|
class="color"
|
||||||
@colorselected=${this._colorPicked}
|
@colorselected=${this._colorPicked}
|
||||||
@ -127,7 +131,7 @@ class MoreInfoViewLightColorPicker extends LitElement {
|
|||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
.path=${mdiPalette}
|
.path=${mdiPalette}
|
||||||
@click=${this._segmentClick}
|
@click=${this._segmentClick}
|
||||||
class="segmentationButton"
|
class="segmentation-button"
|
||||||
></ha-icon-button>
|
></ha-icon-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -206,7 +210,11 @@ class MoreInfoViewLightColorPicker extends LitElement {
|
|||||||
this._brightnessAdjusted = maxVal;
|
this._brightnessAdjusted = maxVal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._ctSliderValue = stateObj.attributes.color_temp_kelvin;
|
this._ctSliderValue =
|
||||||
|
stateObj.attributes.color_mode === LightColorMode.COLOR_TEMP
|
||||||
|
? stateObj.attributes.color_temp_kelvin
|
||||||
|
: undefined;
|
||||||
|
|
||||||
this._wvSliderValue =
|
this._wvSliderValue =
|
||||||
stateObj.attributes.color_mode === LightColorMode.RGBW
|
stateObj.attributes.color_mode === LightColorMode.RGBW
|
||||||
? Math.round((stateObj.attributes.rgbw_color![3] * 100) / 255)
|
? Math.round((stateObj.attributes.rgbw_color![3] * 100) / 255)
|
||||||
@ -243,7 +251,7 @@ class MoreInfoViewLightColorPicker extends LitElement {
|
|||||||
public willUpdate(changedProps: PropertyValues) {
|
public willUpdate(changedProps: PropertyValues) {
|
||||||
super.willUpdate(changedProps);
|
super.willUpdate(changedProps);
|
||||||
|
|
||||||
if (!changedProps.has("params") || !changedProps.has("hass")) {
|
if (!changedProps.has("params") && !changedProps.has("hass")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,10 +272,11 @@ class MoreInfoViewLightColorPicker extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._modes = modes;
|
this._modes = modes;
|
||||||
this._mode =
|
this._mode = this.stateObj!.attributes.color_mode
|
||||||
this.stateObj!.attributes.color_mode === LightColorMode.COLOR_TEMP
|
? this.stateObj!.attributes.color_mode === LightColorMode.COLOR_TEMP
|
||||||
? LightColorMode.COLOR_TEMP
|
? LightColorMode.COLOR_TEMP
|
||||||
: "color";
|
: "color"
|
||||||
|
: this._modes[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
this._updateSliderValues();
|
this._updateSliderValues();
|
||||||
@ -281,6 +290,16 @@ class MoreInfoViewLightColorPicker extends LitElement {
|
|||||||
this._mode = newMode;
|
this._mode = newMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _ctSliderMoved(ev: CustomEvent) {
|
||||||
|
const ct = ev.detail.value;
|
||||||
|
|
||||||
|
if (isNaN(ct)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._ctSliderValue = ct;
|
||||||
|
}
|
||||||
|
|
||||||
private _ctSliderChanged(ev: CustomEvent) {
|
private _ctSliderChanged(ev: CustomEvent) {
|
||||||
const ct = ev.detail.value;
|
const ct = ev.detail.value;
|
||||||
|
|
||||||
@ -493,14 +512,14 @@ class MoreInfoViewLightColorPicker extends LitElement {
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.segmentationContainer {
|
.segmentation-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
max-height: 500px;
|
max-height: 500px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.segmentationButton {
|
.segmentation-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 5%;
|
top: 5%;
|
||||||
left: 0;
|
left: 0;
|
||||||
@ -516,17 +535,29 @@ class MoreInfoViewLightColorPicker extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ha-control-slider {
|
ha-control-slider {
|
||||||
height: 320px;
|
height: 45vh;
|
||||||
|
max-height: 320px;
|
||||||
|
min-height: 200px;
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
|
--control-slider-thickness: 100px;
|
||||||
|
--control-slider-border-radius: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
ha-labeled-slider {
|
ha-labeled-slider {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.color_temp {
|
.color-temp-value {
|
||||||
--control-slider-thickness: 100px;
|
font-style: normal;
|
||||||
--control-slider-border-radius: 24px;
|
font-weight: 500;
|
||||||
|
font-size: 16px;
|
||||||
|
height: 24px;
|
||||||
|
line-height: 24px;
|
||||||
|
letter-spacing: 0.1px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-temp {
|
||||||
--control-slider-background: -webkit-linear-gradient(
|
--control-slider-background: -webkit-linear-gradient(
|
||||||
top,
|
top,
|
||||||
rgb(166, 209, 255) 0%,
|
rgb(166, 209, 255) 0%,
|
||||||
@ -534,6 +565,7 @@ class MoreInfoViewLightColorPicker extends LitElement {
|
|||||||
rgb(255, 160, 0) 100%
|
rgb(255, 160, 0) 100%
|
||||||
);
|
);
|
||||||
--control-slider-background-opacity: 1;
|
--control-slider-background-opacity: 1;
|
||||||
|
margin-bottom: 44px;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr {
|
hr {
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import type { HassEntity } from "home-assistant-js-websocket";
|
import type { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { css, html, LitElement, PropertyValues, TemplateResult } from "lit";
|
import { css, html, LitElement, PropertyValues, nothing } from "lit";
|
||||||
import { customElement, property, state, query } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
import "../../../components/ha-textfield";
|
|
||||||
import { supportsFeature } from "../../../common/entity/supports-feature";
|
import { supportsFeature } from "../../../common/entity/supports-feature";
|
||||||
|
import "../../../components/ha-textfield";
|
||||||
import type { HaTextField } from "../../../components/ha-textfield";
|
import type { HaTextField } from "../../../components/ha-textfield";
|
||||||
import {
|
import {
|
||||||
|
AlarmControlPanelEntityFeature,
|
||||||
callAlarmAction,
|
callAlarmAction,
|
||||||
FORMAT_NUMBER,
|
FORMAT_NUMBER,
|
||||||
AlarmControlPanelEntityFeature,
|
|
||||||
} from "../../../data/alarm_control_panel";
|
} from "../../../data/alarm_control_panel";
|
||||||
import type { HomeAssistant } from "../../../types";
|
import type { HomeAssistant } from "../../../types";
|
||||||
|
|
||||||
@ -67,9 +67,9 @@ export class MoreInfoAlarmControlPanel extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass || !this.stateObj) {
|
if (!this.hass || !this.stateObj) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import "../../../components/ha-relative-time";
|
import "../../../components/ha-relative-time";
|
||||||
import { triggerAutomationActions } from "../../../data/automation";
|
import { triggerAutomationActions } from "../../../data/automation";
|
||||||
@ -13,9 +13,9 @@ class MoreInfoAutomation extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public stateObj?: HassEntity;
|
@property({ attribute: false }) public stateObj?: HassEntity;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass || !this.stateObj) {
|
if (!this.hass || !this.stateObj) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { property, state } from "lit/decorators";
|
import { property, state } from "lit/decorators";
|
||||||
import "../../../components/ha-camera-stream";
|
import "../../../components/ha-camera-stream";
|
||||||
import { CameraEntity } from "../../../data/camera";
|
import { CameraEntity } from "../../../data/camera";
|
||||||
@ -21,9 +21,9 @@ class MoreInfoCamera extends LitElement {
|
|||||||
this._attached = false;
|
this._attached = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this._attached || !this.hass || !this.stateObj) {
|
if (!this._attached || !this.hass || !this.stateObj) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
nothing,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { property } from "lit/decorators";
|
import { property } from "lit/decorators";
|
||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
@ -36,9 +36,9 @@ class MoreInfoClimate extends LitElement {
|
|||||||
|
|
||||||
private _resizeDebounce?: number;
|
private _resizeDebounce?: number;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.stateObj) {
|
if (!this.stateObj) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hass = this.hass;
|
const hass = this.hass;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import type { HassEntity } from "home-assistant-js-websocket";
|
import type { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import "../../../components/ha-alert";
|
import "../../../components/ha-alert";
|
||||||
import "../../../components/ha-circular-progress";
|
import "../../../components/ha-circular-progress";
|
||||||
@ -18,9 +18,9 @@ export class MoreInfoConfigurator extends LitElement {
|
|||||||
|
|
||||||
private _fieldInput = {};
|
private _fieldInput = {};
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (this.stateObj?.state !== "configure") {
|
if (this.stateObj?.state !== "configure") {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { isUnavailableState } from "../../../data/entity";
|
import { isUnavailableState } from "../../../data/entity";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
@ -11,9 +11,9 @@ class MoreInfoCounter extends LitElement {
|
|||||||
|
|
||||||
@property() public stateObj?: HassEntity;
|
@property() public stateObj?: HassEntity;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass || !this.stateObj) {
|
if (!this.hass || !this.stateObj) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const disabled = isUnavailableState(this.stateObj!.state);
|
const disabled = isUnavailableState(this.stateObj!.state);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { css, CSSResult, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResult, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { attributeClassNames } from "../../../common/entity/attribute_class_names";
|
import { attributeClassNames } from "../../../common/entity/attribute_class_names";
|
||||||
import {
|
import {
|
||||||
@ -30,9 +30,9 @@ class MoreInfoCover extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public stateObj!: CoverEntity;
|
@property({ attribute: false }) public stateObj!: CoverEntity;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.stateObj) {
|
if (!this.stateObj) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const _isTiltOnly = isTiltOnly(this.stateObj);
|
const _isTiltOnly = isTiltOnly(this.stateObj);
|
||||||
@ -71,7 +71,7 @@ class MoreInfoCover extends LitElement {
|
|||||||
slot="extra"
|
slot="extra"
|
||||||
.stateObj=${this.stateObj}
|
.stateObj=${this.stateObj}
|
||||||
></ha-cover-tilt-controls> `
|
></ha-cover-tilt-controls> `
|
||||||
: html``}
|
: nothing}
|
||||||
</ha-labeled-slider>`
|
</ha-labeled-slider>`
|
||||||
: !_isTiltOnly
|
: !_isTiltOnly
|
||||||
? html`
|
? html`
|
||||||
@ -83,7 +83,7 @@ class MoreInfoCover extends LitElement {
|
|||||||
.stateObj=${this.stateObj}
|
.stateObj=${this.stateObj}
|
||||||
></ha-cover-tilt-controls>
|
></ha-cover-tilt-controls>
|
||||||
`
|
`
|
||||||
: html``}
|
: nothing}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ha-attributes
|
<ha-attributes
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { html, LitElement, TemplateResult } from "lit";
|
import { html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import "../../../components/ha-attributes";
|
import "../../../components/ha-attributes";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
@ -10,9 +10,9 @@ class MoreInfoDefault extends LitElement {
|
|||||||
|
|
||||||
@property() public stateObj?: HassEntity;
|
@property() public stateObj?: HassEntity;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass || !this.stateObj) {
|
if (!this.hass || !this.stateObj) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`<ha-attributes
|
return html`<ha-attributes
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
nothing,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { property, state } from "lit/decorators";
|
import { property, state } from "lit/decorators";
|
||||||
import { dynamicElement } from "../../../common/dom/dynamic-element-directive";
|
import { dynamicElement } from "../../../common/dom/dynamic-element-directive";
|
||||||
@ -70,9 +70,9 @@ class MoreInfoGroup extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render() {
|
||||||
if (!this.hass || !this.stateObj) {
|
if (!this.hass || !this.stateObj) {
|
||||||
return html``;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`${this._moreInfoType
|
return html`${this._moreInfoType
|
||||||
? dynamicElement(this._moreInfoType, {
|
? dynamicElement(this._moreInfoType, {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user