mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Add QR and constant selector to gallery (#19730)
* Add QR and constant selector to gallery * Update ha-selector.ts
This commit is contained in:
parent
c3b2ebf380
commit
6033f8b31a
@ -1,5 +1,5 @@
|
|||||||
import { Button } from "@material/mwc-button";
|
import { Button } from "@material/mwc-button";
|
||||||
import { html, LitElement, css, TemplateResult } from "lit";
|
import { html, LitElement, css, TemplateResult, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element";
|
import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element";
|
||||||
import { fireEvent } from "../../../src/common/dom/fire_event";
|
import { fireEvent } from "../../../src/common/dom/fire_event";
|
||||||
@ -9,7 +9,7 @@ import "../../../src/components/ha-card";
|
|||||||
class DemoBlackWhiteRow extends LitElement {
|
class DemoBlackWhiteRow extends LitElement {
|
||||||
@property() title!: string;
|
@property() title!: string;
|
||||||
|
|
||||||
@property() value!: any;
|
@property() value?: any;
|
||||||
|
|
||||||
@property({ type: Boolean }) public disabled = false;
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@ -45,7 +45,9 @@ class DemoBlackWhiteRow extends LitElement {
|
|||||||
</mwc-button>
|
</mwc-button>
|
||||||
</div>
|
</div>
|
||||||
</ha-card>
|
</ha-card>
|
||||||
<pre>${JSON.stringify(this.value, undefined, 2)}</pre>
|
${this.value
|
||||||
|
? html`<pre>${JSON.stringify(this.value, undefined, 2)}</pre>`
|
||||||
|
: nothing}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
@ -275,6 +275,14 @@ const SCHEMAS: {
|
|||||||
selector: { color_temp: {} },
|
selector: { color_temp: {} },
|
||||||
},
|
},
|
||||||
color_rgb: { name: "Color", selector: { color_rgb: {} } },
|
color_rgb: { name: "Color", selector: { color_rgb: {} } },
|
||||||
|
qr_code: {
|
||||||
|
name: "QR Code",
|
||||||
|
selector: { qr_code: { data: "https://home-assistant.io" } },
|
||||||
|
},
|
||||||
|
constant: {
|
||||||
|
name: "Constant",
|
||||||
|
selector: { constant: { value: true, label: "Yes!" } },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -501,7 +509,7 @@ class DemoHaSelector extends LitElement implements ProvideHassElement {
|
|||||||
this.requestUpdate();
|
this.requestUpdate();
|
||||||
};
|
};
|
||||||
return html`
|
return html`
|
||||||
<demo-black-white-row .title=${info.name} .value=${this.data[idx]}>
|
<demo-black-white-row .title=${info.name}>
|
||||||
${["light", "dark"].map((slot) =>
|
${["light", "dark"].map((slot) =>
|
||||||
Object.entries(info.input).map(
|
Object.entries(info.input).map(
|
||||||
([key, value]) => html`
|
([key, value]) => html`
|
||||||
@ -534,8 +542,8 @@ class DemoHaSelector extends LitElement implements ProvideHassElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static styles = css`
|
static styles = css`
|
||||||
ha-selector {
|
ha-settings-row {
|
||||||
width: 60;
|
--paper-item-body-two-line-min-height: 0;
|
||||||
}
|
}
|
||||||
.options {
|
.options {
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user