using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Dynamic; using System.Text; using Microsoft.AspNetCore.Components; using OneOf; namespace AntDesign { public class NotificationConfig { /// /// 控制出现与消失的动画 /// internal string AnimationClass { get; set; } = AnimationType.Enter; /// /// 自定义关闭按钮 /// public RenderFragment Btn { get; set; } = null; /// /// 自定义 CSS class /// public string ClassName { get; set; } = null; /// /// 自定义关闭图标 /// public RenderFragment CloseIcon { get; set; } = null; /// /// 通知提醒标题,必选,string 或者 RenderFragment /// [NotNull] public OneOf Message { get; set; } /// /// 通知提醒内容,必选,string 或者 RenderFragment /// [NotNull] public OneOf Description { get; set; } /// /// 自动关闭的延时,单位为秒。默认 4.5 秒后自动关闭,配置为 null 则不自动关闭 /// public double? Duration { get; set; } = null; /// /// 自定义图标 /// public RenderFragment Icon { get; set; } = null; /// /// 当前通知唯一标志 /// public string Key { get; set; } = null; /// /// 当通知关闭时触发 /// public event Action OnClose; internal void InvokeOnClose() { OnClose?.Invoke(); } /// /// 点击通知时触发的回调函数 /// public event Action OnClick; internal void InvokeOnClick() { OnClick?.Invoke(); } /// /// 自定义内联样式 /// public string Style { get; set; } = null; /// /// 弹出位置 /// public NotificationPlacement? Placement { get; set; } = null; /// /// 通知提醒框左侧的图标类型 /// public NotificationType NotificationType { get; set; } = NotificationType.None; } }