mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Implement missing function for password field
This commit is contained in:
parent
77abfd3e61
commit
7ab1133b45
@ -1,10 +1,17 @@
|
|||||||
import { TextAreaCharCounter } from "@material/mwc-textfield/mwc-textfield-base";
|
import { TextAreaCharCounter } from "@material/mwc-textfield/mwc-textfield-base";
|
||||||
import { mdiEye, mdiEyeOff } from "@mdi/js";
|
import { mdiEye, mdiEyeOff } from "@mdi/js";
|
||||||
import { LitElement, css, html } from "lit";
|
import { LitElement, css, html } from "lit";
|
||||||
import { customElement, eventOptions, property, state } from "lit/decorators";
|
import {
|
||||||
|
customElement,
|
||||||
|
eventOptions,
|
||||||
|
property,
|
||||||
|
query,
|
||||||
|
state,
|
||||||
|
} from "lit/decorators";
|
||||||
import { HomeAssistant } from "../types";
|
import { HomeAssistant } from "../types";
|
||||||
import "./ha-icon-button";
|
import "./ha-icon-button";
|
||||||
import "./ha-textfield";
|
import "./ha-textfield";
|
||||||
|
import type { HaTextField } from "./ha-textfield";
|
||||||
|
|
||||||
@customElement("ha-password-field")
|
@customElement("ha-password-field")
|
||||||
export class HaPasswordField extends LitElement {
|
export class HaPasswordField extends LitElement {
|
||||||
@ -75,6 +82,8 @@ export class HaPasswordField extends LitElement {
|
|||||||
|
|
||||||
@state() private _unmaskedPassword = false;
|
@state() private _unmaskedPassword = false;
|
||||||
|
|
||||||
|
@query("ha-textfield") private _textField!: HaTextField;
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
return html`<ha-textfield
|
return html`<ha-textfield
|
||||||
.invalid=${this.invalid}
|
.invalid=${this.invalid}
|
||||||
@ -122,6 +131,22 @@ export class HaPasswordField extends LitElement {
|
|||||||
></ha-icon-button>`;
|
></ha-icon-button>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public checkValidity(): boolean {
|
||||||
|
return this._textField.checkValidity();
|
||||||
|
}
|
||||||
|
|
||||||
|
public reportValidity(): boolean {
|
||||||
|
return this._textField.reportValidity();
|
||||||
|
}
|
||||||
|
|
||||||
|
public setCustomValidity(message: string): void {
|
||||||
|
return this._textField.setCustomValidity(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public layout(): Promise<void> {
|
||||||
|
return this._textField.layout();
|
||||||
|
}
|
||||||
|
|
||||||
private _toggleUnmaskedPassword(): void {
|
private _toggleUnmaskedPassword(): void {
|
||||||
this._unmaskedPassword = !this._unmaskedPassword;
|
this._unmaskedPassword = !this._unmaskedPassword;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import "@material/mwc-list/mwc-list";
|
import "@material/mwc-list/mwc-list";
|
||||||
|
import { mdiDeleteForever, mdiDotsVertical } from "@mdi/js";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import { css, html, LitElement, TemplateResult } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { mdiDeleteForever, mdiDotsVertical } from "@mdi/js";
|
|
||||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||||
import { navigate } from "../../../../common/navigate";
|
import { navigate } from "../../../../common/navigate";
|
||||||
import "../../../../components/buttons/ha-progress-button";
|
import "../../../../components/buttons/ha-progress-button";
|
||||||
@ -10,8 +10,11 @@ import "../../../../components/ha-alert";
|
|||||||
import "../../../../components/ha-card";
|
import "../../../../components/ha-card";
|
||||||
import "../../../../components/ha-icon-next";
|
import "../../../../components/ha-icon-next";
|
||||||
import "../../../../components/ha-list-item";
|
import "../../../../components/ha-list-item";
|
||||||
import type { HaTextField } from "../../../../components/ha-textfield";
|
import "../../../../components/ha-password-field";
|
||||||
|
import type { HaPasswordField } from "../../../../components/ha-password-field";
|
||||||
import "../../../../components/ha-textfield";
|
import "../../../../components/ha-textfield";
|
||||||
|
import type { HaTextField } from "../../../../components/ha-textfield";
|
||||||
|
import { setAssistPipelinePreferred } from "../../../../data/assist_pipeline";
|
||||||
import { cloudLogin, removeCloudData } from "../../../../data/cloud";
|
import { cloudLogin, removeCloudData } from "../../../../data/cloud";
|
||||||
import {
|
import {
|
||||||
showAlertDialog,
|
showAlertDialog,
|
||||||
@ -21,8 +24,6 @@ import "../../../../layouts/hass-subpage";
|
|||||||
import { haStyle } from "../../../../resources/styles";
|
import { haStyle } from "../../../../resources/styles";
|
||||||
import { HomeAssistant } from "../../../../types";
|
import { HomeAssistant } from "../../../../types";
|
||||||
import "../../ha-config-section";
|
import "../../ha-config-section";
|
||||||
import { setAssistPipelinePreferred } from "../../../../data/assist_pipeline";
|
|
||||||
import "../../../../components/ha-password-field";
|
|
||||||
|
|
||||||
@customElement("cloud-login")
|
@customElement("cloud-login")
|
||||||
export class CloudLogin extends LitElement {
|
export class CloudLogin extends LitElement {
|
||||||
@ -44,7 +45,7 @@ export class CloudLogin extends LitElement {
|
|||||||
|
|
||||||
@query("#email", true) private _emailField!: HaTextField;
|
@query("#email", true) private _emailField!: HaTextField;
|
||||||
|
|
||||||
@query("#password", true) private _passwordField!: HaTextField;
|
@query("#password", true) private _passwordField!: HaPasswordField;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user