mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-17 23:54:26 +01:00
updates
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
@using System.Linq.Expressions
|
||||
@typeparam TValue
|
||||
@implements IDisposable
|
||||
|
||||
@foreach (var message in EditContext.GetValidationMessages(_fieldIdentifier))
|
||||
{
|
||||
<div @attributes="InputAttributes">
|
||||
@message
|
||||
</div>
|
||||
}
|
||||
|
||||
@code {
|
||||
|
||||
[CascadingParameter]
|
||||
private EditContext EditContext { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public Expression<Func<TValue>> For { get; set; }
|
||||
|
||||
[Parameter(CaptureUnmatchedValues = true)]
|
||||
public Dictionary<string, object>? InputAttributes { get; set; }
|
||||
|
||||
private FieldIdentifier _fieldIdentifier;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
_fieldIdentifier = FieldIdentifier.Create(For);
|
||||
EditContext.OnValidationStateChanged += HandleValidationStateChanged;
|
||||
}
|
||||
|
||||
private void HandleValidationStateChanged(object o, ValidationStateChangedEventArgs args) => StateHasChanged();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
EditContext.OnValidationStateChanged -= HandleValidationStateChanged;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user