mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 01:36:49 +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 { html, LitElement, css, TemplateResult } from "lit";
|
||||
import { html, LitElement, css, TemplateResult, nothing } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element";
|
||||
import { fireEvent } from "../../../src/common/dom/fire_event";
|
||||
@ -9,7 +9,7 @@ import "../../../src/components/ha-card";
|
||||
class DemoBlackWhiteRow extends LitElement {
|
||||
@property() title!: string;
|
||||
|
||||
@property() value!: any;
|
||||
@property() value?: any;
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
@ -45,7 +45,9 @@ class DemoBlackWhiteRow extends LitElement {
|
||||
</mwc-button>
|
||||
</div>
|
||||
</ha-card>
|
||||
<pre>${JSON.stringify(this.value, undefined, 2)}</pre>
|
||||
${this.value
|
||||
? html`<pre>${JSON.stringify(this.value, undefined, 2)}</pre>`
|
||||
: nothing}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
@ -275,6 +275,14 @@ const SCHEMAS: {
|
||||
selector: { color_temp: {} },
|
||||
},
|
||||
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();
|
||||
};
|
||||
return html`
|
||||
<demo-black-white-row .title=${info.name} .value=${this.data[idx]}>
|
||||
<demo-black-white-row .title=${info.name}>
|
||||
${["light", "dark"].map((slot) =>
|
||||
Object.entries(info.input).map(
|
||||
([key, value]) => html`
|
||||
@ -534,8 +542,8 @@ class DemoHaSelector extends LitElement implements ProvideHassElement {
|
||||
}
|
||||
|
||||
static styles = css`
|
||||
ha-selector {
|
||||
width: 60;
|
||||
ha-settings-row {
|
||||
--paper-item-body-two-line-min-height: 0;
|
||||
}
|
||||
.options {
|
||||
max-width: 800px;
|
||||
|
Loading…
x
Reference in New Issue
Block a user