@etsoo/notificationbase 1.0.94 → 1.0.98

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 CHANGED
@@ -164,8 +164,9 @@ Methods:
164
164
 
165
165
  /**
166
166
  * Hide loading
167
+ * @param force Force to hide, otherwise, only the last one
167
168
  */
168
- hideLoading(): void;
169
+ hideLoading(force?: boolean): void;
169
170
 
170
171
  /**
171
172
  * Show a message
@@ -68,9 +68,10 @@ export interface NotifictionRenderSetup {
68
68
  /**
69
69
  * On return callback
70
70
  * return false will prevent default action
71
+ * return string is the error message to show
71
72
  */
72
73
  export interface NotificationReturn<T> {
73
- (value: T): boolean | void | PromiseLike<boolean | void>;
74
+ (value: T): boolean | string | void | PromiseLike<boolean | string | void>;
74
75
  }
75
76
  /**
76
77
  * Notification message parameters
@@ -76,8 +76,9 @@ export interface INotifier<UI, C extends NotificationCallProps> {
76
76
  getById(id: string): INotification<UI, C> | undefined;
77
77
  /**
78
78
  * Hide loading
79
+ * @param force Force to hide, otherwise, only the last one
79
80
  */
80
- hideLoading(): void;
81
+ hideLoading(force?: boolean): void;
81
82
  /**
82
83
  * Show a message
83
84
  * @param type Message type
@@ -198,8 +199,9 @@ export declare abstract class NotificationContainer<UI, C extends NotificationCa
198
199
  confirm(message: NotificationContent<UI>, title?: NotificationContent<UI>, callback?: NotificationReturn<boolean>, props?: C): INotification<UI, C>;
199
200
  /**
200
201
  * Hide loading
202
+ * @param force Force to hide, otherwise, only the last one
201
203
  */
202
- hideLoading(): void;
204
+ hideLoading(force?: boolean): void;
203
205
  /**
204
206
  * Show a message
205
207
  * @param type Message type
@@ -175,11 +175,14 @@ export class NotificationContainer {
175
175
  }
176
176
  /**
177
177
  * Hide loading
178
+ * @param force Force to hide, otherwise, only the last one
178
179
  */
179
- hideLoading() {
180
+ hideLoading(force) {
180
181
  var _a;
181
182
  // Deduct to count
182
183
  this.loadingCount--;
184
+ if (force)
185
+ this.loadingCount = 0;
183
186
  if (this.loadingCount === 0) {
184
187
  (_a = this.lastLoading) === null || _a === void 0 ? void 0 : _a.dismiss();
185
188
  this.lastLoading = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/notificationbase",
3
- "version": "1.0.94",
3
+ "version": "1.0.98",
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.75"
48
+ "@etsoo/shared": "^1.0.97"
49
49
  },
50
50
  "devDependencies": {
51
- "@babel/core": "^7.16.0",
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",
51
+ "@babel/core": "^7.16.7",
52
+ "@babel/plugin-transform-runtime": "^7.16.7",
53
+ "@babel/preset-env": "^7.16.7",
54
+ "@babel/runtime-corejs3": "^7.16.7",
55
+ "@types/jest": "^27.4.0",
56
+ "@typescript-eslint/eslint-plugin": "^5.8.1",
57
+ "@typescript-eslint/parser": "^5.8.1",
58
+ "babel-jest": "^27.4.5",
59
+ "eslint": "^8.5.0",
60
60
  "eslint-config-airbnb-base": "^15.0.0",
61
61
  "eslint-plugin-import": "^2.25.3",
62
- "jest": "^27.4.2",
63
- "ts-jest": "^27.0.7",
64
- "typescript": "^4.5.2"
62
+ "jest": "^27.4.5",
63
+ "ts-jest": "^27.1.2",
64
+ "typescript": "^4.5.4"
65
65
  }
66
66
  }
@@ -72,9 +72,10 @@ export interface NotifictionRenderSetup {
72
72
  /**
73
73
  * On return callback
74
74
  * return false will prevent default action
75
+ * return string is the error message to show
75
76
  */
76
77
  export interface NotificationReturn<T> {
77
- (value: T): boolean | void | PromiseLike<boolean | void>;
78
+ (value: T): boolean | string | void | PromiseLike<boolean | string | void>;
78
79
  }
79
80
 
80
81
  /**
@@ -111,8 +111,9 @@ export interface INotifier<UI, C extends NotificationCallProps> {
111
111
 
112
112
  /**
113
113
  * Hide loading
114
+ * @param force Force to hide, otherwise, only the last one
114
115
  */
115
- hideLoading(): void;
116
+ hideLoading(force?: boolean): void;
116
117
 
117
118
  /**
118
119
  * Show a message
@@ -400,11 +401,14 @@ export abstract class NotificationContainer<UI, C extends NotificationCallProps>
400
401
 
401
402
  /**
402
403
  * Hide loading
404
+ * @param force Force to hide, otherwise, only the last one
403
405
  */
404
- hideLoading() {
406
+ hideLoading(force?: boolean) {
405
407
  // Deduct to count
406
408
  this.loadingCount--;
407
409
 
410
+ if (force) this.loadingCount = 0;
411
+
408
412
  if (this.loadingCount === 0) {
409
413
  this.lastLoading?.dismiss();
410
414
  this.lastLoading = undefined;