Skip to content

Commit 40fe989

Browse files
authored
MudPasswordField: Form Improvements (#602)
1 parent eb2df6f commit 40fe989

2 files changed

Lines changed: 6 additions & 22 deletions

File tree

src/CodeBeam.MudBlazor.Extensions/Components/PasswordField/MudPasswordField.razor

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
@typeparam T
33
@inherits MudDebouncedInput<T>
44

5-
<CascadingValue Name="Standalone" Value="@StandaloneEx" IsFixed="true">
5+
<CascadingValue Name="SubscribeToParentForm" Value="@SubscribeToParentForm" IsFixed="true">
66
<MudInputControl Label="@Label"
77
Variant="@Variant"
8+
HelperId="@GetHelperId()"
89
HelperText="@HelperText"
910
HelperTextOnFocus="@HelperTextOnFocus"
1011
CounterText="@GetCounterText()"
@@ -13,16 +14,17 @@
1314
Error="@HasErrors"
1415
ErrorText="@GetErrorText()"
1516
ErrorId="@ErrorIdState.Value"
16-
Disabled="@Disabled"
17+
Disabled="@GetDisabledState()"
1718
Margin="@Margin"
1819
Required="@Required"
19-
ForId="@FieldId">
20+
ForId="@InputElementId">
2021
<InputContent>
21-
<CascadingValue Name="Standalone" Value="false" IsFixed="true">
22+
<CascadingValue Name="SubscribeToParentForm" Value="false" IsFixed="true">
2223
<MudInputExtended T="string"
2324
@ref="InputReference"
2425
@attributes="UserAttributes"
2526
InputType="@GetPasswordInputType()"
27+
InputMode="@InputMode"
2628
Lines="@Lines"
2729
Label="@Label"
2830
Style="@Style"

src/CodeBeam.MudBlazor.Extensions/Components/PasswordField/MudPasswordField.razor.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,6 @@ public MudPasswordField()
3939
public MudInputExtended<string?> InputReference { get; private set; } = null!;
4040
private InputType GetPasswordInputType() => _passwordMode.Value ? InputType.Password : InputType.Text;
4141
private string? GetPasswordIcon() => _passwordMode.Value ? Icons.Material.Filled.Visibility : Icons.Material.Filled.VisibilityOff;
42-
//InputType _passwordInput = InputType.Password;
43-
//string? _passwordIcon = Icons.Material.Filled.VisibilityOff;
44-
45-
[CascadingParameter(Name = "Standalone")]
46-
internal bool StandaloneEx { get; set; } = true;
47-
48-
/// <summary>
49-
/// Type of the input element. It should be a valid HTML5 input type.
50-
/// </summary>
51-
[Parameter]
52-
[Category(CategoryTypes.FormComponent.Behavior)]
53-
public InputType InputType { get; set; } = InputType.Text;
54-
5542
private string GetCounterText() => Counter == null ? string.Empty : (Counter == 0 ? (string.IsNullOrEmpty(ReadText) ? "0" : $"{ReadText.Length}") : ((string.IsNullOrEmpty(ReadText) ? "0" : $"{ReadText.Length}") + $" / {Counter}"));
5643

5744
/// <summary>
@@ -158,11 +145,6 @@ public async Task SetText(string text)
158145
await InputReference.SetText(text);
159146
}
160147

161-
private async Task OnMaskedValueChanged(string s)
162-
{
163-
await SetTextCoreAsync(s);
164-
}
165-
166148
/// <summary>
167149
/// If true, masks text with password mode.
168150
/// </summary>

0 commit comments

Comments
 (0)