@etsoo/notificationbase 1.1.25 → 1.1.26
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.
- package/lib/Notification.d.ts +4 -2
- package/lib/Notification.js +6 -3
- package/package.json +12 -12
- package/src/Notification.ts +10 -4
package/lib/Notification.d.ts
CHANGED
|
@@ -200,9 +200,10 @@ export interface INotification<UI, C extends NotificationCallProps> extends INot
|
|
|
200
200
|
/**
|
|
201
201
|
* Dismiss it
|
|
202
202
|
* @param delaySeconds Delay seconds
|
|
203
|
+
* @param noTrigger No onReturn trigger
|
|
203
204
|
* @returns Is delayed or not
|
|
204
205
|
*/
|
|
205
|
-
dismiss(delaySeconds?: number): boolean;
|
|
206
|
+
dismiss(delaySeconds?: number, noTrigger?: boolean): boolean;
|
|
206
207
|
/**
|
|
207
208
|
* Dispose it
|
|
208
209
|
*/
|
|
@@ -300,9 +301,10 @@ export declare abstract class Notification<UI, C extends NotificationCallProps>
|
|
|
300
301
|
/**
|
|
301
302
|
* Dismiss it
|
|
302
303
|
* @param delaySeconds Delay seconds
|
|
304
|
+
* @param noTrigger No onReturn trigger
|
|
303
305
|
* @returns Is delayed or not
|
|
304
306
|
*/
|
|
305
|
-
dismiss(delaySeconds?: number): boolean;
|
|
307
|
+
dismiss(delaySeconds?: number, noTrigger?: boolean): boolean;
|
|
306
308
|
private removeTimeout;
|
|
307
309
|
/**
|
|
308
310
|
* Dispose it
|
package/lib/Notification.js
CHANGED
|
@@ -88,9 +88,10 @@ export class Notification {
|
|
|
88
88
|
/**
|
|
89
89
|
* Dismiss it
|
|
90
90
|
* @param delaySeconds Delay seconds
|
|
91
|
+
* @param noTrigger No onReturn trigger
|
|
91
92
|
* @returns Is delayed or not
|
|
92
93
|
*/
|
|
93
|
-
dismiss(delaySeconds = 0) {
|
|
94
|
+
dismiss(delaySeconds = 0, noTrigger = false) {
|
|
94
95
|
// If it's closed, return
|
|
95
96
|
if (!this._open)
|
|
96
97
|
return false;
|
|
@@ -101,7 +102,9 @@ export class Notification {
|
|
|
101
102
|
return true;
|
|
102
103
|
}
|
|
103
104
|
// For message, call onReturn
|
|
104
|
-
if (
|
|
105
|
+
if (!noTrigger &&
|
|
106
|
+
this.onReturn != null &&
|
|
107
|
+
this.type in NotificationMessageType) {
|
|
105
108
|
this.onReturn(undefined);
|
|
106
109
|
}
|
|
107
110
|
// Indicate closed
|
|
@@ -136,6 +139,6 @@ export class Notification {
|
|
|
136
139
|
if (result === false)
|
|
137
140
|
return;
|
|
138
141
|
}
|
|
139
|
-
this.dismiss();
|
|
142
|
+
this.dismiss(0, true);
|
|
140
143
|
}
|
|
141
144
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/notificationbase",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.26",
|
|
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",
|
|
@@ -45,18 +45,18 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/ETSOO/NotificationBase#readme",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@etsoo/shared": "^1.2.
|
|
48
|
+
"@etsoo/shared": "^1.2.8"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@babel/core": "^7.
|
|
52
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
53
|
-
"@babel/preset-env": "^7.
|
|
54
|
-
"@babel/runtime-corejs3": "^7.
|
|
55
|
-
"@types/jest": "^29.5.
|
|
56
|
-
"babel-jest": "^29.
|
|
57
|
-
"jest": "^29.
|
|
58
|
-
"jest-environment-jsdom": "^29.
|
|
59
|
-
"ts-jest": "^29.1.
|
|
60
|
-
"typescript": "^5.
|
|
51
|
+
"@babel/core": "^7.22.10",
|
|
52
|
+
"@babel/plugin-transform-runtime": "^7.22.10",
|
|
53
|
+
"@babel/preset-env": "^7.22.10",
|
|
54
|
+
"@babel/runtime-corejs3": "^7.22.10",
|
|
55
|
+
"@types/jest": "^29.5.3",
|
|
56
|
+
"babel-jest": "^29.6.2",
|
|
57
|
+
"jest": "^29.6.2",
|
|
58
|
+
"jest-environment-jsdom": "^29.6.2",
|
|
59
|
+
"ts-jest": "^29.1.1",
|
|
60
|
+
"typescript": "^5.1.6"
|
|
61
61
|
}
|
|
62
62
|
}
|
package/src/Notification.ts
CHANGED
|
@@ -232,9 +232,10 @@ export interface INotification<UI, C extends NotificationCallProps>
|
|
|
232
232
|
/**
|
|
233
233
|
* Dismiss it
|
|
234
234
|
* @param delaySeconds Delay seconds
|
|
235
|
+
* @param noTrigger No onReturn trigger
|
|
235
236
|
* @returns Is delayed or not
|
|
236
237
|
*/
|
|
237
|
-
dismiss(delaySeconds?: number): boolean;
|
|
238
|
+
dismiss(delaySeconds?: number, noTrigger?: boolean): boolean;
|
|
238
239
|
|
|
239
240
|
/**
|
|
240
241
|
* Dispose it
|
|
@@ -382,9 +383,10 @@ export abstract class Notification<UI, C extends NotificationCallProps>
|
|
|
382
383
|
/**
|
|
383
384
|
* Dismiss it
|
|
384
385
|
* @param delaySeconds Delay seconds
|
|
386
|
+
* @param noTrigger No onReturn trigger
|
|
385
387
|
* @returns Is delayed or not
|
|
386
388
|
*/
|
|
387
|
-
dismiss(delaySeconds: number = 0): boolean {
|
|
389
|
+
dismiss(delaySeconds: number = 0, noTrigger: boolean = false): boolean {
|
|
388
390
|
// If it's closed, return
|
|
389
391
|
if (!this._open) return false;
|
|
390
392
|
|
|
@@ -399,7 +401,11 @@ export abstract class Notification<UI, C extends NotificationCallProps>
|
|
|
399
401
|
}
|
|
400
402
|
|
|
401
403
|
// For message, call onReturn
|
|
402
|
-
if (
|
|
404
|
+
if (
|
|
405
|
+
!noTrigger &&
|
|
406
|
+
this.onReturn != null &&
|
|
407
|
+
this.type in NotificationMessageType
|
|
408
|
+
) {
|
|
403
409
|
this.onReturn(undefined);
|
|
404
410
|
}
|
|
405
411
|
|
|
@@ -449,6 +455,6 @@ export abstract class Notification<UI, C extends NotificationCallProps>
|
|
|
449
455
|
const result = await this.onReturn(value);
|
|
450
456
|
if (result === false) return;
|
|
451
457
|
}
|
|
452
|
-
this.dismiss();
|
|
458
|
+
this.dismiss(0, true);
|
|
453
459
|
}
|
|
454
460
|
}
|