You've already forked onecmonitor
mirror of
https://github.com/akpaevj/onecmonitor.git
synced 2026-06-13 21:18:17 +02:00
40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
@using System.Linq.Expressions
|
|
<MudTextField Class="@Class" For="For"
|
|
InputType="@_passwordInput"
|
|
Adornment="Adornment.End"
|
|
AdornmentIcon="@_passwordInputIcon"
|
|
OnAdornmentClick="ShowHidePassword"
|
|
Label="@(Label ?? "Пароль")"
|
|
@bind-Value="Value"
|
|
@bind-Value:after="@(() => ValueChanged.InvokeAsync(Value))"/>
|
|
|
|
@code {
|
|
|
|
private InputType _passwordInput = InputType.Password;
|
|
private string _passwordInputIcon = Icons.Material.Filled.VisibilityOff;
|
|
|
|
[Parameter] [Category("Validation")] public Expression<Func<string>>? For { get; set; }
|
|
|
|
[Parameter] [Category("Data")] public string? Value { get; set; }
|
|
|
|
[Parameter] public EventCallback<string> ValueChanged { get; set; }
|
|
|
|
[Parameter] public string? Class { get; set; }
|
|
|
|
[Parameter] public string? Label { get; set; }
|
|
|
|
void ShowHidePassword()
|
|
{
|
|
@if (_passwordInput == InputType.Text)
|
|
{
|
|
_passwordInputIcon = Icons.Material.Filled.VisibilityOff;
|
|
_passwordInput = InputType.Password;
|
|
}
|
|
else
|
|
{
|
|
_passwordInputIcon = Icons.Material.Filled.Visibility;
|
|
_passwordInput = InputType.Text;
|
|
}
|
|
}
|
|
|
|
} |