mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-08 09:56:36 +00:00
ha-form-integer to only show slider if < 256 steps (#10430)
This commit is contained in:
parent
8b5b21ae69
commit
4b44e197ae
@ -222,6 +222,30 @@ const SCHEMAS: {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "OctoPrint",
|
||||||
|
translations: {
|
||||||
|
username: "Username",
|
||||||
|
host: "Host",
|
||||||
|
port: "Port Number",
|
||||||
|
path: "Application Path",
|
||||||
|
ssl: "Use SSL",
|
||||||
|
},
|
||||||
|
schema: [
|
||||||
|
{ type: "string", name: "username", required: true, default: "" },
|
||||||
|
{ type: "string", name: "host", required: true, default: "" },
|
||||||
|
{
|
||||||
|
type: "integer",
|
||||||
|
valueMin: 1,
|
||||||
|
valueMax: 65535,
|
||||||
|
name: "port",
|
||||||
|
optional: true,
|
||||||
|
default: 80,
|
||||||
|
},
|
||||||
|
{ type: "string", name: "path", optional: true, default: "/" },
|
||||||
|
{ type: "boolean", name: "ssl", optional: true, default: false },
|
||||||
|
],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@customElement("demo-ha-form")
|
@customElement("demo-ha-form")
|
||||||
|
@ -36,7 +36,11 @@ export class HaFormInteger extends LitElement implements HaFormElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
if ("valueMin" in this.schema && "valueMax" in this.schema) {
|
if (
|
||||||
|
this.schema.valueMin !== undefined &&
|
||||||
|
this.schema.valueMax !== undefined &&
|
||||||
|
this.schema.valueMax - this.schema.valueMin < 256
|
||||||
|
) {
|
||||||
return html`
|
return html`
|
||||||
<div>
|
<div>
|
||||||
${this.label}
|
${this.label}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user