using Microsoft.AspNetCore.Components; namespace AntDesign { public abstract class AntDomComponentBase : AntComponentBase { [Inject] private IComponentIdGenerator ComponentIdGenerator { get; set; } [Parameter] public string Id { get; set; } [CascadingParameter] public ConfigProvider ConfigProvider { get; set; } protected bool RTL => ConfigProvider?.Direction == "RTL"; //[Parameter(CaptureUnmatchedValues = true)] //public Dictionary Attributes { get; set; } = new Dictionary(); private ElementReference _ref; /// /// Returned ElementRef reference for DOM element. /// public virtual ElementReference Ref { get => _ref; set { _ref = value; RefBack?.Set(value); } } protected ClassMapper ClassMapper { get; } = new ClassMapper(); protected AntDomComponentBase() { ClassMapper .Get(() => this.Class); } protected override void OnInitialized() { Id ??= ComponentIdGenerator.Generate(this); base.OnInitialized(); } /// /// Specifies one or more class names for an DOM element. /// [Parameter] public string Class { get => _class; set { _class = value; ClassMapper.OriginalClass = value; } } /// /// Specifies an inline style for an DOM element. /// [Parameter] public string Style { get => _style; set { _style = value; this.StateHasChanged(); } } protected virtual string GenerateStyle() { return Style; } private string _class; private string _style; } }