You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Components/Components/TextField/TextField.razor

95 lines
4.6 KiB

2 years ago
@namespace Connected.Components
@typeparam T
@inherits DebouncedInput<T>
<CascadingValue Name="SubscribeToParentForm" Value="@SubscribeToParentForm" IsFixed="true">
<InputControl Label="@Label"
Variant="@Variant"
HelperText="@HelperText"
HelperTextOnFocus="@HelperTextOnFocus"
CounterText="@GetCounterText()"
FullWidth="@FullWidth"
Class="@ClassList"
2 years ago
Error="@HasErrors"
ErrorText="@GetErrorText()"
ErrorId="@ErrorId"
Disabled="@Disabled"
Margin="@Margin"
Required="@Required"
ForId="@FieldId">
<InputContent>
<CascadingValue Name="SubscribeToParentForm" Value="false" IsFixed="true">
@if (_mask == null)
{
<Input T="string"
@ref="InputReference"
@attributes="UserAttributes"
InputType="@InputType"
Lines="@Lines"
Style="@Style"
Variant="@Variant"
TextUpdateSuppression="@TextUpdateSuppression"
Value="@Text"
ValueChanged="(s) => SetTextAsync(s)"
Placeholder="@Placeholder"
Disabled=@Disabled
DisableUnderLine="@DisableUnderLine"
ReadOnly="@ReadOnly"
MaxLength="@MaxLength"
Adornment="@Adornment"
AdornmentText="@AdornmentText"
AdornmentIcon="@AdornmentIcon"
AdornmentColor="@AdornmentColor"
AdornmentAriaLabel="@AdornmentAriaLabel"
IconSize="@IconSize"
OnAdornmentClick="@OnAdornmentClick"
Error="@HasError"
2 years ago
ErrorId="@ErrorId"
Immediate="@Immediate"
Margin="@Margin"
OnBlur="@OnBlurred"
OnKeyDown="@InvokeKeyDown"
OnInternalInputChanged="OnChange"
OnKeyPress="@InvokeKeyPress"
OnKeyUp="@InvokeKeyUp"
KeyDownPreventDefault="KeyDownPreventDefault"
KeyPressPreventDefault="KeyPressPreventDefault"
KeyUpPreventDefault="KeyUpPreventDefault"
HideSpinButtons="true"
Clearable="@Clearable"
OnClearButtonClick="@OnClearButtonClick"
Pattern="@Pattern"/>
}
else
{
<Mask @ref="_maskReference"
@attributes="UserAttributes"
Mask="@_mask"
InputType="@InputType"
Lines="@Lines"
Style="@Style"
Variant="@Variant"
TextUpdateSuppression="@TextUpdateSuppression"
Value="@Text"
ValueChanged="OnMaskedValueChanged"
Placeholder="@Placeholder"
Disabled=@Disabled
DisableUnderLine="@DisableUnderLine"
ReadOnly="@ReadOnly"
MaxLength="@MaxLength"
Adornment="@Adornment"
AdornmentText="@AdornmentText"
AdornmentIcon="@AdornmentIcon"
AdornmentColor="@AdornmentColor"
IconSize="@IconSize"
OnAdornmentClick="@OnAdornmentClick"
Error="@HasError"
2 years ago
Immediate="@Immediate"
Margin="@Margin" OnBlur="@OnBlurred"
Clearable="@Clearable"
OnClearButtonClick="@OnClearButtonClick"/>
}
</CascadingValue>
</InputContent>
</InputControl>
</CascadingValue>