@etsoo/notificationbase 1.0.82 → 1.0.86
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/__tests__/tsconfig.json +1 -1
- package/lib/Notification.js +1 -1
- package/lib/NotificationContainer.js +8 -17
- package/package.json +7 -9
- package/src/NotificationContainer.ts +2 -11
- package/tsconfig.json +1 -1
package/__tests__/tsconfig.json
CHANGED
package/lib/Notification.js
CHANGED
|
@@ -77,7 +77,7 @@ export class Notification {
|
|
|
77
77
|
else
|
|
78
78
|
this.align = NotificationAlign.Center;
|
|
79
79
|
// Display as modal will lasts otherwise 5 seconds to dismiss it
|
|
80
|
-
this.timespan = timespan
|
|
80
|
+
this.timespan = timespan !== null && timespan !== void 0 ? timespan : (this.modal ? 0 : 5);
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* Is open or not
|
|
@@ -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
|
|
@@ -185,7 +175,8 @@ export class NotificationContainer {
|
|
|
185
175
|
* Hide loading
|
|
186
176
|
*/
|
|
187
177
|
hideLoading() {
|
|
188
|
-
|
|
178
|
+
var _a;
|
|
179
|
+
(_a = this.lastLoading) === null || _a === void 0 ? void 0 : _a.dismiss();
|
|
189
180
|
}
|
|
190
181
|
/**
|
|
191
182
|
* Show a message
|
|
@@ -197,7 +188,7 @@ export class NotificationContainer {
|
|
|
197
188
|
*/
|
|
198
189
|
message(type, message, title, parameters, props) {
|
|
199
190
|
// Destruct
|
|
200
|
-
const { align, timespan, callback, modal } = parameters
|
|
191
|
+
const { align, timespan, callback, modal } = parameters !== null && parameters !== void 0 ? parameters : {};
|
|
201
192
|
// Setup
|
|
202
193
|
const n = {
|
|
203
194
|
type,
|
|
@@ -238,7 +229,7 @@ export class NotificationContainer {
|
|
|
238
229
|
// Setup
|
|
239
230
|
const n = {
|
|
240
231
|
type: NotificationType.Loading,
|
|
241
|
-
content: title
|
|
232
|
+
content: title !== null && title !== void 0 ? title : ''
|
|
242
233
|
};
|
|
243
234
|
// Add to the collection
|
|
244
235
|
// Keep the reference
|
|
@@ -254,7 +245,7 @@ export class NotificationContainer {
|
|
|
254
245
|
*/
|
|
255
246
|
succeed(message, title, callback, timespan, props) {
|
|
256
247
|
// Default to zero for constant
|
|
257
|
-
timespan
|
|
248
|
+
timespan !== null && timespan !== void 0 ? timespan : (timespan = 0);
|
|
258
249
|
// Create as message
|
|
259
250
|
this.message(NotificationMessageType.Success, message, title, {
|
|
260
251
|
align: NotificationAlign.Center,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/notificationbase",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.86",
|
|
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
|
}
|
|
@@ -243,17 +243,8 @@ export abstract class NotificationContainer<UI, C extends NotificationCallProps>
|
|
|
243
243
|
};
|
|
244
244
|
|
|
245
245
|
// 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
|
-
}
|
|
246
|
+
if (top) alignItems.unshift(notification);
|
|
247
|
+
else alignItems.push(notification);
|
|
257
248
|
|
|
258
249
|
// Call the registered callback
|
|
259
250
|
this.doRegister(notification, false);
|