@etsoo/notificationbase 1.0.96 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -67,18 +67,12 @@ export interface NotifictionRenderSetup {
67
67
  }
68
68
  /**
69
69
  * On return callback
70
+ * T = string | undefined, Undefined value means cancel
70
71
  * return false will prevent default action
72
+ * return string is the error message to show
71
73
  */
72
74
  export interface NotificationReturn<T> {
73
- (value: T): boolean | void | PromiseLike<boolean | void>;
74
- }
75
- /**
76
- * On prompt return callback
77
- * return false will prevent default action
78
- * return tuple second parameter is the error message to show
79
- */
80
- export interface NotificationPromptReturn<T> extends NotificationReturn<T> {
81
- (value: T): boolean | [boolean, string?] | void | PromiseLike<boolean | [boolean, string?] | void>;
75
+ (value: T): boolean | string | void | PromiseLike<boolean | string | void>;
82
76
  }
83
77
  /**
84
78
  * Notification message parameters
@@ -251,7 +245,7 @@ export declare abstract class Notification<UI, C extends NotificationCallProps>
251
245
  /**
252
246
  * On return value
253
247
  */
254
- onReturn?: NotificationReturn<any>;
248
+ onReturn?: NotificationReturn<unknown>;
255
249
  private _open;
256
250
  /**
257
251
  * Is open or not
@@ -1,4 +1,4 @@
1
- import { INotificaseBase, INotification, NotificationAlign, NotificationCallProps, NotificationContent, NotificationMessageType, NotificationParameters, NotificationPromptReturn, NotificationReturn } from './Notification';
1
+ import { INotificaseBase, INotification, NotificationAlign, NotificationCallProps, NotificationContent, NotificationMessageType, NotificationParameters, NotificationReturn } from './Notification';
2
2
  /**
3
3
  * Notification action
4
4
  */
@@ -95,7 +95,7 @@ export interface INotifier<UI, C extends NotificationCallProps> {
95
95
  * @param title Title
96
96
  * @param props More properties
97
97
  */
98
- prompt<T = string>(message: NotificationContent<UI>, callback: NotificationPromptReturn<T>, title?: NotificationContent<UI>, props?: C): INotification<UI, C>;
98
+ prompt<T = string | undefined>(message: NotificationContent<UI>, callback: NotificationReturn<T>, title?: NotificationContent<UI>, props?: C): INotification<UI, C>;
99
99
  /**
100
100
  * Show loading
101
101
  * @param title Title
@@ -218,7 +218,7 @@ export declare abstract class NotificationContainer<UI, C extends NotificationCa
218
218
  * @param title Title
219
219
  * @param props More properties
220
220
  */
221
- prompt<T>(message: NotificationContent<UI>, callback: NotificationPromptReturn<T>, title?: string, props?: C): INotification<UI, C>;
221
+ prompt<T = string | undefined>(message: NotificationContent<UI>, callback: NotificationReturn<T>, title?: string, props?: C): INotification<UI, C>;
222
222
  /**
223
223
  * Show loading
224
224
  * @param title Title
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/notificationbase",
3
- "version": "1.0.96",
3
+ "version": "1.1.0",
4
4
  "description": "TypeScript notification component for extending with all features described and partially implemented",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -71,23 +71,12 @@ export interface NotifictionRenderSetup {
71
71
 
72
72
  /**
73
73
  * On return callback
74
+ * T = string | undefined, Undefined value means cancel
74
75
  * return false will prevent default action
76
+ * return string is the error message to show
75
77
  */
76
78
  export interface NotificationReturn<T> {
77
- (value: T): boolean | void | PromiseLike<boolean | void>;
78
- }
79
-
80
- /**
81
- * On prompt return callback
82
- * return false will prevent default action
83
- * return tuple second parameter is the error message to show
84
- */
85
- export interface NotificationPromptReturn<T> extends NotificationReturn<T> {
86
- (value: T):
87
- | boolean
88
- | [boolean, string?]
89
- | void
90
- | PromiseLike<boolean | [boolean, string?] | void>;
79
+ (value: T): boolean | string | void | PromiseLike<boolean | string | void>;
91
80
  }
92
81
 
93
82
  /**
@@ -297,7 +286,7 @@ export abstract class Notification<UI, C extends NotificationCallProps>
297
286
  /**
298
287
  * On return value
299
288
  */
300
- onReturn?: NotificationReturn<any>;
289
+ onReturn?: NotificationReturn<unknown>;
301
290
 
302
291
  private _open: boolean = true;
303
292
  /**
@@ -7,7 +7,6 @@ import {
7
7
  NotificationMessageType,
8
8
  NotificationModalType,
9
9
  NotificationParameters,
10
- NotificationPromptReturn,
11
10
  NotificationReturn,
12
11
  NotificationType
13
12
  } from './Notification';
@@ -139,9 +138,9 @@ export interface INotifier<UI, C extends NotificationCallProps> {
139
138
  * @param title Title
140
139
  * @param props More properties
141
140
  */
142
- prompt<T = string>(
141
+ prompt<T = string | undefined>(
143
142
  message: NotificationContent<UI>,
144
- callback: NotificationPromptReturn<T>,
143
+ callback: NotificationReturn<T>,
145
144
  title?: NotificationContent<UI>,
146
145
  props?: C
147
146
  ): INotification<UI, C>;
@@ -456,9 +455,9 @@ export abstract class NotificationContainer<UI, C extends NotificationCallProps>
456
455
  * @param title Title
457
456
  * @param props More properties
458
457
  */
459
- prompt<T>(
458
+ prompt<T = string | undefined>(
460
459
  message: NotificationContent<UI>,
461
- callback: NotificationPromptReturn<T>,
460
+ callback: NotificationReturn<T>,
462
461
  title?: string,
463
462
  props?: C
464
463
  ) {