// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;
namespace AntDesign
{
///
/// FormValidationMessage is copy from ValidationMessage.
/// Displays a list of validation messages for a specified field within a cascaded .
///
public partial class FormValidationMessage : ComponentBase, IDisposable
{
private EditContext _previousEditContext;
private Expression> _previousFieldAccessor;
//private readonly EventHandler _validationStateChangedHandler;
private FieldIdentifier _fieldIdentifier;
///
/// Gets or sets a collection of additional attributes that will be applied to the created div element.
///
[Parameter(CaptureUnmatchedValues = true)]
public IReadOnlyDictionary AdditionalAttributes { get; set; }
[CascadingParameter]
private EditContext CurrentEditContext { get; set; }
public AntInputComponentBase _control;
[Parameter]
public AntInputComponentBase Control
{
get
{
return _control;
}
set
{
if (value != null && _control != value)
{
_control = value;
_fieldIdentifier = _control.FieldIdentifier;
_previousFieldAccessor = _control.ValueExpression;
}
}
}
protected virtual void Dispose(bool disposing)
{
}
void IDisposable.Dispose()
{
Dispose(disposing: true);
}
}
}