@etsoo/notificationbase 1.0.83 → 1.0.87
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):
|
|
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):
|
|
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):
|
|
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):
|
|
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):
|
|
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):
|
|
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):
|
|
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):
|
|
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 (
|
|
54
|
-
|
|
55
|
-
|
|
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.
|
|
3
|
+
"version": "1.0.87",
|
|
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",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://github.com/ETSOO/NotificationBase#readme",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@etsoo/shared": "^1.0.
|
|
43
|
+
"@etsoo/shared": "^1.0.53"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@babel/core": "^7.15.8",
|
|
@@ -48,16 +48,14 @@
|
|
|
48
48
|
"@babel/preset-env": "^7.15.8",
|
|
49
49
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
50
50
|
"@types/jest": "^27.0.2",
|
|
51
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
52
|
-
"@typescript-eslint/parser": "^5.
|
|
53
|
-
"babel-
|
|
54
|
-
"babel-jest": "^27.2.5",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^5.1.0",
|
|
52
|
+
"@typescript-eslint/parser": "^5.1.0",
|
|
53
|
+
"babel-jest": "^27.3.0",
|
|
55
54
|
"eslint": "^8.0.1",
|
|
56
55
|
"eslint-config-airbnb-base": "^14.2.1",
|
|
57
56
|
"eslint-plugin-import": "^2.25.2",
|
|
58
|
-
"jest": "^27.
|
|
59
|
-
"
|
|
60
|
-
"ts-jest": "^27.0.5",
|
|
57
|
+
"jest": "^27.3.0",
|
|
58
|
+
"ts-jest": "^27.0.7",
|
|
61
59
|
"typescript": "^4.4.4"
|
|
62
60
|
}
|
|
63
61
|
}
|
|
@@ -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(
|
|
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
|
-
):
|
|
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
|
-
):
|
|
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
|
-
):
|
|
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 (
|
|
247
|
-
|
|
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,
|