@@ -3,16 +3,23 @@ import { RdNotificationGlobalConfig, RdNotificationProps, RdNotificationStaticFn
33
44let notification : RdNotificationProps = { } as RdNotificationProps ;
55
6- const rdNotificationStaticFunc : RdNotificationStaticFn = ( rdNotificationArgsProps , type ) => {
6+ /**
7+ * This is Internal Function. Do not use in your production.
8+ */
9+ export const __rdNotificationStaticFunc : RdNotificationStaticFn = (
10+ rdNotificationArgsProps ,
11+ notificationInstance
12+ ) => {
713 let message = rdNotificationArgsProps . message ;
14+
815 if ( notification . globalConfigExtend . defaultMessage ) {
916 typeof notification . globalConfigExtend . defaultMessage === 'string' &&
1017 ( message = notification . globalConfigExtend . defaultMessage ) ;
1118
1219 if ( typeof notification . globalConfigExtend . defaultMessage === 'object' ) {
1320 const { success, info, warning, error } =
1421 notification . globalConfigExtend . defaultMessage ;
15- switch ( type ) {
22+ switch ( rdNotificationArgsProps . type ) {
1623 case 'success' :
1724 message = success || message ;
1825 break ;
@@ -35,9 +42,11 @@ const rdNotificationStaticFunc: RdNotificationStaticFn = (rdNotificationArgsProp
3542 ...rdNotificationArgsProps ,
3643 } ;
3744
38- antdNotification . open ( {
45+ const currentNotification = notificationInstance ?? antdNotification ;
46+
47+ currentNotification . open ( {
3948 ...notificationArgsProps ,
40- type,
49+ type : rdNotificationArgsProps . type ,
4150 } ) ;
4251} ;
4352
@@ -54,19 +63,31 @@ notification.destroy = config => {
5463 antdNotification . destroy ( config ) ;
5564} ;
5665notification . open = config => {
57- rdNotificationStaticFunc ( config ) ;
66+ __rdNotificationStaticFunc ( config ) ;
5867} ;
5968notification . error = config => {
60- rdNotificationStaticFunc ( config , 'error' ) ;
69+ __rdNotificationStaticFunc ( {
70+ ...config ,
71+ type : 'error' ,
72+ } ) ;
6173} ;
6274notification . info = config => {
63- rdNotificationStaticFunc ( config , 'info' ) ;
75+ __rdNotificationStaticFunc ( {
76+ ...config ,
77+ type : 'info' ,
78+ } ) ;
6479} ;
6580notification . success = config => {
66- rdNotificationStaticFunc ( config , 'success' ) ;
81+ __rdNotificationStaticFunc ( {
82+ ...config ,
83+ type : 'success' ,
84+ } ) ;
6785} ;
6886notification . warning = config => {
69- rdNotificationStaticFunc ( config , 'warning' ) ;
87+ __rdNotificationStaticFunc ( {
88+ ...config ,
89+ type : 'warning' ,
90+ } ) ;
7091} ;
7192notification . useNotification = antdNotification . useNotification ;
7293notification . _InternalPanelDoNotUseOrYouWillBeFired =
0 commit comments