@etsoo/notificationbase 1.1.9 → 1.1.11
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/README.md +8 -0
- package/lib/Notification.d.ts +14 -0
- package/lib/Notification.js +14 -0
- package/package.json +4 -4
- package/src/Notification.ts +22 -0
package/README.md
CHANGED
package/lib/Notification.d.ts
CHANGED
|
@@ -212,6 +212,13 @@ export interface INotification<UI, C extends NotificationCallProps> extends INot
|
|
|
212
212
|
* @param options Other options
|
|
213
213
|
*/
|
|
214
214
|
render(props: NotificationRenderProps, className?: string): UI | undefined;
|
|
215
|
+
/**
|
|
216
|
+
* Return value
|
|
217
|
+
* Dismiss first, then run callback
|
|
218
|
+
* @param value
|
|
219
|
+
* @returns
|
|
220
|
+
*/
|
|
221
|
+
returnValue(value: any): Promise<void>;
|
|
215
222
|
}
|
|
216
223
|
/**
|
|
217
224
|
* Notification class
|
|
@@ -305,4 +312,11 @@ export declare abstract class Notification<UI, C extends NotificationCallProps>
|
|
|
305
312
|
* @param className Style class name
|
|
306
313
|
*/
|
|
307
314
|
abstract render(props: NotificationRenderProps, className?: string): UI | undefined;
|
|
315
|
+
/**
|
|
316
|
+
* Return value
|
|
317
|
+
* Dismiss first, then run callback
|
|
318
|
+
* @param value
|
|
319
|
+
* @returns
|
|
320
|
+
*/
|
|
321
|
+
returnValue(value: any): Promise<void>;
|
|
308
322
|
}
|
package/lib/Notification.js
CHANGED
|
@@ -124,4 +124,18 @@ export class Notification {
|
|
|
124
124
|
dispose() {
|
|
125
125
|
this.removeTimeout();
|
|
126
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Return value
|
|
129
|
+
* Dismiss first, then run callback
|
|
130
|
+
* @param value
|
|
131
|
+
* @returns
|
|
132
|
+
*/
|
|
133
|
+
async returnValue(value) {
|
|
134
|
+
if (this.onReturn) {
|
|
135
|
+
const result = await this.onReturn(value);
|
|
136
|
+
if (result === false)
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
this.dismiss();
|
|
140
|
+
}
|
|
127
141
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/notificationbase",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
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",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"@etsoo/shared": "^1.1.58"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@babel/core": "^7.19.
|
|
51
|
+
"@babel/core": "^7.19.3",
|
|
52
52
|
"@babel/plugin-transform-runtime": "^7.19.1",
|
|
53
|
-
"@babel/preset-env": "^7.19.
|
|
53
|
+
"@babel/preset-env": "^7.19.3",
|
|
54
54
|
"@babel/runtime-corejs3": "^7.19.1",
|
|
55
55
|
"@types/jest": "^29.0.3",
|
|
56
56
|
"@typescript-eslint/eslint-plugin": "^5.38.1",
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
"jest": "^29.0.3",
|
|
63
63
|
"jest-environment-jsdom": "^29.0.3",
|
|
64
64
|
"ts-jest": "^29.0.2",
|
|
65
|
-
"typescript": "^4.8.
|
|
65
|
+
"typescript": "^4.8.4"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/Notification.ts
CHANGED
|
@@ -244,6 +244,14 @@ export interface INotification<UI, C extends NotificationCallProps>
|
|
|
244
244
|
* @param options Other options
|
|
245
245
|
*/
|
|
246
246
|
render(props: NotificationRenderProps, className?: string): UI | undefined;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Return value
|
|
250
|
+
* Dismiss first, then run callback
|
|
251
|
+
* @param value
|
|
252
|
+
* @returns
|
|
253
|
+
*/
|
|
254
|
+
returnValue(value: any): Promise<void>;
|
|
247
255
|
}
|
|
248
256
|
|
|
249
257
|
/**
|
|
@@ -425,4 +433,18 @@ export abstract class Notification<UI, C extends NotificationCallProps>
|
|
|
425
433
|
props: NotificationRenderProps,
|
|
426
434
|
className?: string
|
|
427
435
|
): UI | undefined;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Return value
|
|
439
|
+
* Dismiss first, then run callback
|
|
440
|
+
* @param value
|
|
441
|
+
* @returns
|
|
442
|
+
*/
|
|
443
|
+
async returnValue(value: any) {
|
|
444
|
+
if (this.onReturn) {
|
|
445
|
+
const result = await this.onReturn(value);
|
|
446
|
+
if (result === false) return;
|
|
447
|
+
}
|
|
448
|
+
this.dismiss();
|
|
449
|
+
}
|
|
428
450
|
}
|