mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-13 13:00:24 +00:00
Support email and url form input types (#4186)
* Support email and url form input types * Lint * Lint * Add types
This commit is contained in:
committed by
Bram Kragten
parent
920ee741f3
commit
1e217e8d2f
@@ -56,6 +56,7 @@ export class HaFormString extends LitElement implements HaFormElement {
|
||||
`
|
||||
: html`
|
||||
<paper-input
|
||||
.type=${this._stringType}
|
||||
.label=${this.label}
|
||||
.value=${this.data}
|
||||
.required=${this.schema.required}
|
||||
@@ -84,6 +85,18 @@ export class HaFormString extends LitElement implements HaFormElement {
|
||||
{ bubbles: false }
|
||||
);
|
||||
}
|
||||
|
||||
private _stringType() {
|
||||
if (this.schema.format) {
|
||||
if (["email", "url"].includes(this.schema.format)) {
|
||||
return this.schema.format;
|
||||
}
|
||||
if (this.schema.format === "fqdnurl") {
|
||||
return "url";
|
||||
}
|
||||
}
|
||||
return "text";
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
|
||||
Reference in New Issue
Block a user