/// <summary>
 /// 
 /// </summary>
 /// <param name="config"></param>
 public async Task Info(AntNotificationConfig config)
 {
     if (config != null)
     {
         config.NotificationType = AntNotificationType.Info;
         await Open(config);
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="config"></param>
 public async Task Warning(AntNotificationConfig config)
 {
     if (config != null)
     {
         config.NotificationType = AntNotificationType.Warning;
         await Open(config);
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="config"></param>
 public async Task Error(AntNotificationConfig config)
 {
     if (config != null)
     {
         config.NotificationType = AntNotificationType.Error;
         await Open(config);
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="config"></param>
 public async Task Success(AntNotificationConfig config)
 {
     if (config != null)
     {
         config.NotificationType = AntNotificationType.Success;
         await Open(config);
     }
 }
 /// <summary>
 /// create notification box html from NotificationItem Component
 /// </summary>
 /// <param name="config"></param>
 /// <returns></returns>
 private async ValueTask<string> CreateNotificationItem(AntNotificationConfig config)
 {
     RenderFragment renderFragment = (builder) =>
     {
         builder.OpenComponent<AntNotificationItem>(0);
         builder.AddAttribute(1, "Config", config);
         builder.CloseComponent();
     };
     string htmlStr = await RenderAsync(renderFragment);
     return htmlStr;
 }
        private AntNotificationConfig ExtendConfig(AntNotificationConfig config)
        {
            config.Placement ??= _defaultPlacement;
            config.Duration ??= _defaultDuration;
            config.CloseIcon ??= _defaultCloseIcon;

            if (string.IsNullOrWhiteSpace(config.Key))
            {
                config.Key = Guid.NewGuid().ToString();
            }

            return config;
        }
        /// <summary>
        /// Open a notification box
        /// </summary>
        /// <param name="config"></param>
        public async Task Open([NotNull]AntNotificationConfig config)
        {
            if (config == null)
            {
                return;
            }

            await CheckInit();

            config = ExtendConfig(config);
            Debug.Assert(config.Placement != null);
            string container = await GetContainer(config.Placement.Value);
            string notificationHtmlStr = await CreateNotificationItem(config);

            await _jsRuntime.InvokeVoidAsync(JSInteropConstants.addNotification,
                notificationHtmlStr,
                container, config.Key, config.Duration);

            _configDict.Add(config.Key, config);
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="config"></param>
 public async Task Warn(AntNotificationConfig config)
 {
     await Warning(config);
 }