@etsoo/notificationbase 1.0.93 → 1.0.94
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.
|
@@ -33,9 +33,10 @@ export interface INotifier<UI, C extends NotificationCallProps> {
|
|
|
33
33
|
* Report error
|
|
34
34
|
* @param error Error message
|
|
35
35
|
* @param callback Callback
|
|
36
|
+
* @param type Type, default is Error
|
|
36
37
|
* @param props Props
|
|
37
38
|
*/
|
|
38
|
-
alert(error: NotificationContent<UI>, callback?: NotificationReturn<void>, props?: C): INotification<UI, C>;
|
|
39
|
+
alert(error: NotificationContent<UI>, callback?: NotificationReturn<void>, type?: NotificationMessageType, props?: C): INotification<UI, C>;
|
|
39
40
|
/**
|
|
40
41
|
* Align all notification count
|
|
41
42
|
* @param align Align
|
|
@@ -183,9 +184,10 @@ export declare abstract class NotificationContainer<UI, C extends NotificationCa
|
|
|
183
184
|
* Report error
|
|
184
185
|
* @param error Error message
|
|
185
186
|
* @param callback Callback
|
|
187
|
+
* @param type Type, default is Error
|
|
186
188
|
* @param props Props
|
|
187
189
|
*/
|
|
188
|
-
alert(error: string, callback?: NotificationReturn<void>, props?: C): INotification<UI, C>;
|
|
190
|
+
alert(error: string, callback?: NotificationReturn<void>, type?: NotificationMessageType, props?: C): INotification<UI, C>;
|
|
189
191
|
/**
|
|
190
192
|
* Confirm action
|
|
191
193
|
* @param message Message
|
|
@@ -38,7 +38,7 @@ export class NotificationContainer {
|
|
|
38
38
|
// Align collection
|
|
39
39
|
const alignItems = this.notifications[notification.align];
|
|
40
40
|
// Support dismiss action
|
|
41
|
-
const {
|
|
41
|
+
const { timespan, onDismiss } = notification;
|
|
42
42
|
notification.onDismiss = () => {
|
|
43
43
|
// Remove from the collection
|
|
44
44
|
const index = alignItems.findIndex((item) => item.id === notification.id);
|
|
@@ -140,18 +140,19 @@ export class NotificationContainer {
|
|
|
140
140
|
* Report error
|
|
141
141
|
* @param error Error message
|
|
142
142
|
* @param callback Callback
|
|
143
|
+
* @param type Type, default is Error
|
|
143
144
|
* @param props Props
|
|
144
145
|
*/
|
|
145
|
-
alert(error, callback, props) {
|
|
146
|
+
alert(error, callback, type, props) {
|
|
146
147
|
// Setup
|
|
147
148
|
const n = {
|
|
148
149
|
inputProps: props,
|
|
149
|
-
type: NotificationType.Error,
|
|
150
|
+
type: type !== null && type !== void 0 ? type : NotificationType.Error,
|
|
150
151
|
content: error,
|
|
151
152
|
onReturn: callback
|
|
152
153
|
};
|
|
153
154
|
// Add to the collection
|
|
154
|
-
return this.addRaw(n);
|
|
155
|
+
return this.addRaw(n, true);
|
|
155
156
|
}
|
|
156
157
|
/**
|
|
157
158
|
* Confirm action
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/notificationbase",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.94",
|
|
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,22 +45,22 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/ETSOO/NotificationBase#readme",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@etsoo/shared": "^1.0.
|
|
48
|
+
"@etsoo/shared": "^1.0.75"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@babel/core": "^7.16.0",
|
|
52
|
-
"@babel/plugin-transform-runtime": "^7.16.
|
|
53
|
-
"@babel/preset-env": "^7.16.
|
|
54
|
-
"@babel/runtime-corejs3": "^7.16.
|
|
55
|
-
"@types/jest": "^27.0.
|
|
56
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
57
|
-
"@typescript-eslint/parser": "^5.
|
|
58
|
-
"babel-jest": "^27.
|
|
59
|
-
"eslint": "^8.
|
|
60
|
-
"eslint-config-airbnb-base": "^
|
|
61
|
-
"eslint-plugin-import": "^2.25.
|
|
62
|
-
"jest": "^27.
|
|
52
|
+
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
53
|
+
"@babel/preset-env": "^7.16.4",
|
|
54
|
+
"@babel/runtime-corejs3": "^7.16.3",
|
|
55
|
+
"@types/jest": "^27.0.3",
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^5.5.0",
|
|
57
|
+
"@typescript-eslint/parser": "^5.5.0",
|
|
58
|
+
"babel-jest": "^27.4.2",
|
|
59
|
+
"eslint": "^8.3.0",
|
|
60
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
61
|
+
"eslint-plugin-import": "^2.25.3",
|
|
62
|
+
"jest": "^27.4.2",
|
|
63
63
|
"ts-jest": "^27.0.7",
|
|
64
|
-
"typescript": "^4.
|
|
64
|
+
"typescript": "^4.5.2"
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -50,11 +50,13 @@ export interface INotifier<UI, C extends NotificationCallProps> {
|
|
|
50
50
|
* Report error
|
|
51
51
|
* @param error Error message
|
|
52
52
|
* @param callback Callback
|
|
53
|
+
* @param type Type, default is Error
|
|
53
54
|
* @param props Props
|
|
54
55
|
*/
|
|
55
56
|
alert(
|
|
56
57
|
error: NotificationContent<UI>,
|
|
57
58
|
callback?: NotificationReturn<void>,
|
|
59
|
+
type?: NotificationMessageType,
|
|
58
60
|
props?: C
|
|
59
61
|
): INotification<UI, C>;
|
|
60
62
|
|
|
@@ -233,7 +235,7 @@ export abstract class NotificationContainer<UI, C extends NotificationCallProps>
|
|
|
233
235
|
const alignItems = this.notifications[notification.align];
|
|
234
236
|
|
|
235
237
|
// Support dismiss action
|
|
236
|
-
const {
|
|
238
|
+
const { timespan, onDismiss } = notification;
|
|
237
239
|
notification.onDismiss = () => {
|
|
238
240
|
// Remove from the collection
|
|
239
241
|
const index = alignItems.findIndex(
|
|
@@ -349,19 +351,25 @@ export abstract class NotificationContainer<UI, C extends NotificationCallProps>
|
|
|
349
351
|
* Report error
|
|
350
352
|
* @param error Error message
|
|
351
353
|
* @param callback Callback
|
|
354
|
+
* @param type Type, default is Error
|
|
352
355
|
* @param props Props
|
|
353
356
|
*/
|
|
354
|
-
alert(
|
|
357
|
+
alert(
|
|
358
|
+
error: string,
|
|
359
|
+
callback?: NotificationReturn<void>,
|
|
360
|
+
type?: NotificationMessageType,
|
|
361
|
+
props?: C
|
|
362
|
+
) {
|
|
355
363
|
// Setup
|
|
356
364
|
const n: INotificaseBase<UI, C> = {
|
|
357
365
|
inputProps: props,
|
|
358
|
-
type: NotificationType.Error,
|
|
366
|
+
type: type ?? NotificationType.Error,
|
|
359
367
|
content: error,
|
|
360
368
|
onReturn: callback
|
|
361
369
|
};
|
|
362
370
|
|
|
363
371
|
// Add to the collection
|
|
364
|
-
return this.addRaw(n);
|
|
372
|
+
return this.addRaw(n, true);
|
|
365
373
|
}
|
|
366
374
|
|
|
367
375
|
/**
|