@etsoo/notificationbase 1.1.15 → 1.1.17
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/lib/Notification.d.ts
CHANGED
|
@@ -49,11 +49,11 @@ export declare const NotificationType: {
|
|
|
49
49
|
/**
|
|
50
50
|
* Notification types
|
|
51
51
|
*/
|
|
52
|
-
export
|
|
52
|
+
export type NotificationType = NotificationModalType | NotificationMessageType;
|
|
53
53
|
/**
|
|
54
54
|
* Notification content
|
|
55
55
|
*/
|
|
56
|
-
export
|
|
56
|
+
export type NotificationContent<UI> = string | UI;
|
|
57
57
|
/**
|
|
58
58
|
* On dismiss callback
|
|
59
59
|
*/
|
|
@@ -103,7 +103,7 @@ export interface NotificationParameters {
|
|
|
103
103
|
/**
|
|
104
104
|
* Notification props supported for calls
|
|
105
105
|
*/
|
|
106
|
-
export
|
|
106
|
+
export type NotificationCallProps = {
|
|
107
107
|
/**
|
|
108
108
|
* Input component properties
|
|
109
109
|
*/
|
|
@@ -112,7 +112,7 @@ export declare type NotificationCallProps = {
|
|
|
112
112
|
/**
|
|
113
113
|
* Notification render props
|
|
114
114
|
*/
|
|
115
|
-
export
|
|
115
|
+
export type NotificationRenderProps = object;
|
|
116
116
|
/**
|
|
117
117
|
* Notification base interface
|
|
118
118
|
*/
|
package/lib/Notification.js
CHANGED
|
@@ -46,6 +46,12 @@ export const NotificationType = {
|
|
|
46
46
|
* Generic parameter UI presents UI element type
|
|
47
47
|
*/
|
|
48
48
|
export class Notification {
|
|
49
|
+
/**
|
|
50
|
+
* Is open or not
|
|
51
|
+
*/
|
|
52
|
+
get open() {
|
|
53
|
+
return this._open;
|
|
54
|
+
}
|
|
49
55
|
/**
|
|
50
56
|
* Constructor
|
|
51
57
|
* @param type Type
|
|
@@ -79,12 +85,6 @@ export class Notification {
|
|
|
79
85
|
// Display as modal will lasts otherwise 5 seconds to dismiss it
|
|
80
86
|
this.timespan = timespan !== null && timespan !== void 0 ? timespan : (this.modal ? 0 : 5);
|
|
81
87
|
}
|
|
82
|
-
/**
|
|
83
|
-
* Is open or not
|
|
84
|
-
*/
|
|
85
|
-
get open() {
|
|
86
|
-
return this._open;
|
|
87
|
-
}
|
|
88
88
|
/**
|
|
89
89
|
* Dismiss it
|
|
90
90
|
* @param delaySeconds Delay seconds
|
|
@@ -8,7 +8,7 @@ export interface NotificationAction<UI, C extends NotificationCallProps> {
|
|
|
8
8
|
/**
|
|
9
9
|
* Notifications sorted with display align type
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type NotificationDictionary<UI, C extends NotificationCallProps> = {
|
|
12
12
|
[key: number]: INotification<UI, C>[];
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
@@ -3,6 +3,18 @@ import { NotificationAlign, NotificationMessageType, NotificationModalType, Noti
|
|
|
3
3
|
* Notification container class
|
|
4
4
|
*/
|
|
5
5
|
export class NotificationContainer {
|
|
6
|
+
/**
|
|
7
|
+
* Is loading bar showing
|
|
8
|
+
*/
|
|
9
|
+
get isLoading() {
|
|
10
|
+
return this.notifications[NotificationAlign.Unknown].some((n) => n.open && n.type === NotificationModalType.Loading);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Is model window showing
|
|
14
|
+
*/
|
|
15
|
+
get isModeling() {
|
|
16
|
+
return this.alignOpenCount(NotificationAlign.Unknown) > 0;
|
|
17
|
+
}
|
|
6
18
|
/**
|
|
7
19
|
* Constructor
|
|
8
20
|
*/
|
|
@@ -17,18 +29,6 @@ export class NotificationContainer {
|
|
|
17
29
|
this.notifications[align] = [];
|
|
18
30
|
}
|
|
19
31
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Is loading bar showing
|
|
22
|
-
*/
|
|
23
|
-
get isLoading() {
|
|
24
|
-
return this.notifications[NotificationAlign.Unknown].some((n) => n.open && n.type === NotificationModalType.Loading);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Is model window showing
|
|
28
|
-
*/
|
|
29
|
-
get isModeling() {
|
|
30
|
-
return this.alignOpenCount(NotificationAlign.Unknown) > 0;
|
|
31
|
-
}
|
|
32
32
|
/**
|
|
33
33
|
* Add notification
|
|
34
34
|
* @param notification Notification
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/notificationbase",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.17",
|
|
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,16 +45,16 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/ETSOO/NotificationBase#readme",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@etsoo/shared": "^1.1.
|
|
48
|
+
"@etsoo/shared": "^1.1.77"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@babel/core": "^7.20.2",
|
|
52
52
|
"@babel/plugin-transform-runtime": "^7.19.6",
|
|
53
53
|
"@babel/preset-env": "^7.20.2",
|
|
54
54
|
"@babel/runtime-corejs3": "^7.20.1",
|
|
55
|
-
"@types/jest": "^29.2.
|
|
56
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
57
|
-
"@typescript-eslint/parser": "^5.
|
|
55
|
+
"@types/jest": "^29.2.3",
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^5.43.0",
|
|
57
|
+
"@typescript-eslint/parser": "^5.43.0",
|
|
58
58
|
"babel-jest": "^29.3.1",
|
|
59
59
|
"eslint": "^8.27.0",
|
|
60
60
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
"jest": "^29.3.1",
|
|
63
63
|
"jest-environment-jsdom": "^29.3.1",
|
|
64
64
|
"ts-jest": "^29.0.3",
|
|
65
|
-
"typescript": "^4.
|
|
65
|
+
"typescript": "^4.9.3"
|
|
66
66
|
}
|
|
67
67
|
}
|