@etsoo/notificationbase 1.0.85 → 1.0.89

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.
@@ -35,7 +35,7 @@ export interface INotifier<UI, C extends NotificationCallProps> {
35
35
  * @param callback Callback
36
36
  * @param props Props
37
37
  */
38
- alert(error: string, callback?: NotificationReturn<void>, props?: C): void;
38
+ alert(error: string, callback?: NotificationReturn<void>, props?: C): INotification<UI, C>;
39
39
  /**
40
40
  * Align all notification count
41
41
  * @param align Align
@@ -57,7 +57,7 @@ export interface INotifier<UI, C extends NotificationCallProps> {
57
57
  * @param callback Callback
58
58
  * @param props Props
59
59
  */
60
- confirm(message: string, title?: string, callback?: NotificationReturn<boolean>, props?: C): void;
60
+ confirm(message: string, title?: string, callback?: NotificationReturn<boolean>, props?: C): INotification<UI, C>;
61
61
  /**
62
62
  * Dispose all notifications
63
63
  */
@@ -93,7 +93,7 @@ export interface INotifier<UI, C extends NotificationCallProps> {
93
93
  * @param title Title
94
94
  * @param props More properties
95
95
  */
96
- prompt<T = string>(message: string, callback: NotificationReturn<T>, title?: string, props?: C): void;
96
+ prompt<T = string>(message: string, callback: NotificationReturn<T>, title?: string, props?: C): INotification<UI, C>;
97
97
  /**
98
98
  * Show loading
99
99
  * @param title Title
@@ -107,7 +107,7 @@ export interface INotifier<UI, C extends NotificationCallProps> {
107
107
  * @param timespan Timespan to close
108
108
  * @param props Props
109
109
  */
110
- succeed(message: string, title?: string, callback?: NotificationReturn<void>, timespan?: number, props?: C): void;
110
+ succeed(message: string, title?: string, callback?: NotificationReturn<void>, timespan?: number, props?: C): INotification<UI, C>;
111
111
  }
112
112
  /**
113
113
  * Notification container class
@@ -184,7 +184,7 @@ export declare abstract class NotificationContainer<UI, C extends NotificationCa
184
184
  * @param callback Callback
185
185
  * @param props Props
186
186
  */
187
- alert(error: string, callback?: NotificationReturn<void>, props?: C): void;
187
+ alert(error: string, callback?: NotificationReturn<void>, props?: C): INotification<UI, C>;
188
188
  /**
189
189
  * Confirm action
190
190
  * @param message Message
@@ -192,7 +192,7 @@ export declare abstract class NotificationContainer<UI, C extends NotificationCa
192
192
  * @param callback Callback
193
193
  * @param props Props
194
194
  */
195
- confirm(message: string, title?: string, callback?: NotificationReturn<boolean>, props?: C): void;
195
+ confirm(message: string, title?: string, callback?: NotificationReturn<boolean>, props?: C): INotification<UI, C>;
196
196
  /**
197
197
  * Hide loading
198
198
  */
@@ -213,7 +213,7 @@ export declare abstract class NotificationContainer<UI, C extends NotificationCa
213
213
  * @param title Title
214
214
  * @param props More properties
215
215
  */
216
- prompt<T>(message: string, callback: NotificationReturn<T>, title?: string, props?: C): void;
216
+ prompt<T>(message: string, callback: NotificationReturn<T>, title?: string, props?: C): INotification<UI, C>;
217
217
  /**
218
218
  * Show loading
219
219
  * @param title Title
@@ -227,5 +227,5 @@ export declare abstract class NotificationContainer<UI, C extends NotificationCa
227
227
  * @param timespan Timespan to close
228
228
  * @param props Props
229
229
  */
230
- succeed(message: string, title?: string, callback?: NotificationReturn<void>, timespan?: number, props?: C): void;
230
+ succeed(message: string, title?: string, callback?: NotificationReturn<void>, timespan?: number, props?: C): INotification<UI, C>;
231
231
  }
@@ -50,20 +50,10 @@ export class NotificationContainer {
50
50
  onDismiss();
51
51
  };
52
52
  // Add to the collection
53
- if (align === NotificationAlign.Unknown) {
54
- // Dismiss the last modal window
55
- const modalCount = alignItems.length;
56
- if (modalCount > 0) {
57
- alignItems[modalCount - 1].dismiss();
58
- }
53
+ if (top)
54
+ alignItems.unshift(notification);
55
+ else
59
56
  alignItems.push(notification);
60
- }
61
- else {
62
- if (top)
63
- alignItems.unshift(notification);
64
- else
65
- alignItems.push(notification);
66
- }
67
57
  // Call the registered callback
68
58
  this.doRegister(notification, false);
69
59
  // Auto dismiss in timespan seconds
@@ -160,7 +150,7 @@ export class NotificationContainer {
160
150
  onReturn: callback
161
151
  };
162
152
  // Add to the collection
163
- this.addRaw(n);
153
+ return this.addRaw(n);
164
154
  }
165
155
  /**
166
156
  * Confirm action
@@ -179,7 +169,7 @@ export class NotificationContainer {
179
169
  inputProps: props
180
170
  };
181
171
  // Add to the collection
182
- this.addRaw(n);
172
+ return this.addRaw(n);
183
173
  }
184
174
  /**
185
175
  * Hide loading
@@ -229,7 +219,7 @@ export class NotificationContainer {
229
219
  onReturn: callback
230
220
  };
231
221
  // Add to the collection
232
- this.addRaw(n);
222
+ return this.addRaw(n);
233
223
  }
234
224
  /**
235
225
  * Show loading
@@ -257,7 +247,7 @@ export class NotificationContainer {
257
247
  // Default to zero for constant
258
248
  timespan !== null && timespan !== void 0 ? timespan : (timespan = 0);
259
249
  // Create as message
260
- this.message(NotificationMessageType.Success, message, title, {
250
+ return this.message(NotificationMessageType.Success, message, title, {
261
251
  align: NotificationAlign.Center,
262
252
  modal: true,
263
253
  timespan,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/notificationbase",
3
- "version": "1.0.85",
3
+ "version": "1.0.89",
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",
@@ -31,7 +31,12 @@
31
31
  },
32
32
  "keywords": [
33
33
  "notification",
34
- "TypeScript"
34
+ "TypeScript",
35
+ "ETSOO",
36
+ "SmartERP",
37
+ "司友云平台",
38
+ "青岛亿速思维",
39
+ "上海亿商"
35
40
  ],
36
41
  "author": "Garry Xiao",
37
42
  "license": "MIT",
@@ -40,7 +45,7 @@
40
45
  },
41
46
  "homepage": "https://github.com/ETSOO/NotificationBase#readme",
42
47
  "dependencies": {
43
- "@etsoo/shared": "^1.0.52"
48
+ "@etsoo/shared": "^1.0.58"
44
49
  },
45
50
  "devDependencies": {
46
51
  "@babel/core": "^7.15.8",
@@ -48,13 +53,13 @@
48
53
  "@babel/preset-env": "^7.15.8",
49
54
  "@babel/runtime-corejs3": "^7.15.4",
50
55
  "@types/jest": "^27.0.2",
51
- "@typescript-eslint/eslint-plugin": "^5.0.0",
52
- "@typescript-eslint/parser": "^5.0.0",
53
- "babel-jest": "^27.2.5",
56
+ "@typescript-eslint/eslint-plugin": "^5.1.0",
57
+ "@typescript-eslint/parser": "^5.1.0",
58
+ "babel-jest": "^27.3.1",
54
59
  "eslint": "^8.0.1",
55
60
  "eslint-config-airbnb-base": "^14.2.1",
56
61
  "eslint-plugin-import": "^2.25.2",
57
- "jest": "^27.2.5",
62
+ "jest": "^27.3.1",
58
63
  "ts-jest": "^27.0.7",
59
64
  "typescript": "^4.4.4"
60
65
  }
@@ -51,7 +51,11 @@ export interface INotifier<UI, C extends NotificationCallProps> {
51
51
  * @param callback Callback
52
52
  * @param props Props
53
53
  */
54
- alert(error: string, callback?: NotificationReturn<void>, props?: C): void;
54
+ alert(
55
+ error: string,
56
+ callback?: NotificationReturn<void>,
57
+ props?: C
58
+ ): INotification<UI, C>;
55
59
 
56
60
  /**
57
61
  * Align all notification count
@@ -82,7 +86,7 @@ export interface INotifier<UI, C extends NotificationCallProps> {
82
86
  title?: string,
83
87
  callback?: NotificationReturn<boolean>,
84
88
  props?: C
85
- ): void;
89
+ ): INotification<UI, C>;
86
90
 
87
91
  /**
88
92
  * Dispose all notifications
@@ -135,7 +139,7 @@ export interface INotifier<UI, C extends NotificationCallProps> {
135
139
  callback: NotificationReturn<T>,
136
140
  title?: string,
137
141
  props?: C
138
- ): void;
142
+ ): INotification<UI, C>;
139
143
 
140
144
  /**
141
145
  * Show loading
@@ -157,7 +161,7 @@ export interface INotifier<UI, C extends NotificationCallProps> {
157
161
  callback?: NotificationReturn<void>,
158
162
  timespan?: number,
159
163
  props?: C
160
- ): void;
164
+ ): INotification<UI, C>;
161
165
  }
162
166
 
163
167
  /**
@@ -243,17 +247,8 @@ export abstract class NotificationContainer<UI, C extends NotificationCallProps>
243
247
  };
244
248
 
245
249
  // Add to the collection
246
- if (align === NotificationAlign.Unknown) {
247
- // Dismiss the last modal window
248
- const modalCount = alignItems.length;
249
- if (modalCount > 0) {
250
- alignItems[modalCount - 1].dismiss();
251
- }
252
- alignItems.push(notification);
253
- } else {
254
- if (top) alignItems.unshift(notification);
255
- else alignItems.push(notification);
256
- }
250
+ if (top) alignItems.unshift(notification);
251
+ else alignItems.push(notification);
257
252
 
258
253
  // Call the registered callback
259
254
  this.doRegister(notification, false);
@@ -364,7 +359,7 @@ export abstract class NotificationContainer<UI, C extends NotificationCallProps>
364
359
  };
365
360
 
366
361
  // Add to the collection
367
- this.addRaw(n);
362
+ return this.addRaw(n);
368
363
  }
369
364
 
370
365
  /**
@@ -390,7 +385,7 @@ export abstract class NotificationContainer<UI, C extends NotificationCallProps>
390
385
  };
391
386
 
392
387
  // Add to the collection
393
- this.addRaw(n);
388
+ return this.addRaw(n);
394
389
  }
395
390
 
396
391
  /**
@@ -456,7 +451,7 @@ export abstract class NotificationContainer<UI, C extends NotificationCallProps>
456
451
  };
457
452
 
458
453
  // Add to the collection
459
- this.addRaw(n);
454
+ return this.addRaw(n);
460
455
  }
461
456
 
462
457
  /**
@@ -494,7 +489,7 @@ export abstract class NotificationContainer<UI, C extends NotificationCallProps>
494
489
  timespan ??= 0;
495
490
 
496
491
  // Create as message
497
- this.message(
492
+ return this.message(
498
493
  NotificationMessageType.Success,
499
494
  message,
500
495
  title,