@etsoo/notificationbase 1.1.26 → 1.1.27
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 +11 -0
- package/lib/Notification.d.ts +3 -1
- package/lib/Notification.js +2 -1
- package/lib/NotificationContainer.d.ts +20 -0
- package/lib/NotificationContainer.js +18 -0
- package/package.json +10 -10
- package/src/Notification.ts +2 -1
- package/src/NotificationContainer.ts +34 -0
package/README.md
CHANGED
|
@@ -194,6 +194,17 @@ Methods:
|
|
|
194
194
|
props?: C
|
|
195
195
|
): INotification<UI, C>;
|
|
196
196
|
|
|
197
|
+
/**
|
|
198
|
+
* Popup component as modal
|
|
199
|
+
* @param component Component to popup
|
|
200
|
+
* @param anchor Position anchor
|
|
201
|
+
* @returns Result
|
|
202
|
+
*/
|
|
203
|
+
popup(
|
|
204
|
+
component: NotificationContent<UI>,
|
|
205
|
+
anchor?: HTMLElement | string | { left: number; top: number }
|
|
206
|
+
): INotification<UI, C>;
|
|
207
|
+
|
|
197
208
|
/**
|
|
198
209
|
* Prompt action
|
|
199
210
|
* @param message Message
|
package/lib/Notification.d.ts
CHANGED
|
@@ -21,7 +21,8 @@ export declare enum NotificationModalType {
|
|
|
21
21
|
Loading = 0,
|
|
22
22
|
Confirm = 1,
|
|
23
23
|
Prompt = 2,
|
|
24
|
-
Error = 3
|
|
24
|
+
Error = 3,
|
|
25
|
+
Popup = 6
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
28
|
* Message types
|
|
@@ -47,6 +48,7 @@ export declare const NotificationType: {
|
|
|
47
48
|
Confirm: NotificationModalType.Confirm;
|
|
48
49
|
Prompt: NotificationModalType.Prompt;
|
|
49
50
|
Error: NotificationModalType.Error;
|
|
51
|
+
Popup: NotificationModalType.Popup;
|
|
50
52
|
};
|
|
51
53
|
/**
|
|
52
54
|
* Notification types
|
package/lib/Notification.js
CHANGED
|
@@ -21,7 +21,8 @@ export var NotificationModalType;
|
|
|
21
21
|
NotificationModalType[NotificationModalType["Loading"] = 0] = "Loading";
|
|
22
22
|
NotificationModalType[NotificationModalType["Confirm"] = 1] = "Confirm";
|
|
23
23
|
NotificationModalType[NotificationModalType["Prompt"] = 2] = "Prompt";
|
|
24
|
-
NotificationModalType[NotificationModalType["Error"] = 3] = "Error";
|
|
24
|
+
NotificationModalType[NotificationModalType["Error"] = 3] = "Error";
|
|
25
|
+
NotificationModalType[NotificationModalType["Popup"] = 6] = "Popup";
|
|
25
26
|
})(NotificationModalType || (NotificationModalType = {}));
|
|
26
27
|
/**
|
|
27
28
|
* Message types
|
|
@@ -88,6 +88,16 @@ export interface INotifier<UI, C extends NotificationCallProps> {
|
|
|
88
88
|
* @param props Props
|
|
89
89
|
*/
|
|
90
90
|
message(type: NotificationMessageType, message: NotificationContent<UI>, title?: NotificationContent<UI>, parameters?: NotificationParameters, props?: C): INotification<UI, C>;
|
|
91
|
+
/**
|
|
92
|
+
* Popup component as modal
|
|
93
|
+
* @param component Component to popup
|
|
94
|
+
* @param anchor Position anchor
|
|
95
|
+
* @returns Result
|
|
96
|
+
*/
|
|
97
|
+
popup(component: NotificationContent<UI>, anchor?: HTMLElement | string | {
|
|
98
|
+
left: number;
|
|
99
|
+
top: number;
|
|
100
|
+
}): INotification<UI, C>;
|
|
91
101
|
/**
|
|
92
102
|
* Prompt action
|
|
93
103
|
* @param message Message
|
|
@@ -224,6 +234,16 @@ export declare abstract class NotificationContainer<UI, C extends NotificationCa
|
|
|
224
234
|
* @param title Title
|
|
225
235
|
*/
|
|
226
236
|
showLoading(title?: NotificationContent<UI>): void;
|
|
237
|
+
/**
|
|
238
|
+
* Popup component as modal
|
|
239
|
+
* @param component Component to popup
|
|
240
|
+
* @param anchor Position anchor
|
|
241
|
+
* @returns Result
|
|
242
|
+
*/
|
|
243
|
+
popup(component: NotificationContent<UI>, anchor?: HTMLElement | string | {
|
|
244
|
+
left: number;
|
|
245
|
+
top: number;
|
|
246
|
+
}): INotification<UI, C>;
|
|
227
247
|
/**
|
|
228
248
|
* Show a success message
|
|
229
249
|
* @param message Message
|
|
@@ -259,6 +259,24 @@ export class NotificationContainer {
|
|
|
259
259
|
this.lastLoading = this.addRaw(n);
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Popup component as modal
|
|
264
|
+
* @param component Component to popup
|
|
265
|
+
* @param anchor Position anchor
|
|
266
|
+
* @returns Result
|
|
267
|
+
*/
|
|
268
|
+
popup(component, anchor) {
|
|
269
|
+
// Setup
|
|
270
|
+
const n = {
|
|
271
|
+
type: NotificationType.Popup,
|
|
272
|
+
content: component,
|
|
273
|
+
renderSetup: (options) => {
|
|
274
|
+
options.anchor = anchor;
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
// Add to the collection
|
|
278
|
+
return this.addRaw(n);
|
|
279
|
+
}
|
|
262
280
|
/**
|
|
263
281
|
* Show a success message
|
|
264
282
|
* @param message Message
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/notificationbase",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.27",
|
|
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,18 +45,18 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/ETSOO/NotificationBase#readme",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@etsoo/shared": "^1.2.
|
|
48
|
+
"@etsoo/shared": "^1.2.10"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@babel/core": "^7.22.
|
|
51
|
+
"@babel/core": "^7.22.11",
|
|
52
52
|
"@babel/plugin-transform-runtime": "^7.22.10",
|
|
53
|
-
"@babel/preset-env": "^7.22.
|
|
54
|
-
"@babel/runtime-corejs3": "^7.22.
|
|
55
|
-
"@types/jest": "^29.5.
|
|
56
|
-
"babel-jest": "^29.6.
|
|
57
|
-
"jest": "^29.6.
|
|
58
|
-
"jest-environment-jsdom": "^29.6.
|
|
53
|
+
"@babel/preset-env": "^7.22.14",
|
|
54
|
+
"@babel/runtime-corejs3": "^7.22.11",
|
|
55
|
+
"@types/jest": "^29.5.4",
|
|
56
|
+
"babel-jest": "^29.6.4",
|
|
57
|
+
"jest": "^29.6.4",
|
|
58
|
+
"jest-environment-jsdom": "^29.6.4",
|
|
59
59
|
"ts-jest": "^29.1.1",
|
|
60
|
-
"typescript": "^5.
|
|
60
|
+
"typescript": "^5.2.2"
|
|
61
61
|
}
|
|
62
62
|
}
|
package/src/Notification.ts
CHANGED
|
@@ -133,6 +133,17 @@ export interface INotifier<UI, C extends NotificationCallProps> {
|
|
|
133
133
|
props?: C
|
|
134
134
|
): INotification<UI, C>;
|
|
135
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Popup component as modal
|
|
138
|
+
* @param component Component to popup
|
|
139
|
+
* @param anchor Position anchor
|
|
140
|
+
* @returns Result
|
|
141
|
+
*/
|
|
142
|
+
popup(
|
|
143
|
+
component: NotificationContent<UI>,
|
|
144
|
+
anchor?: HTMLElement | string | { left: number; top: number }
|
|
145
|
+
): INotification<UI, C>;
|
|
146
|
+
|
|
136
147
|
/**
|
|
137
148
|
* Prompt action
|
|
138
149
|
* @param message Message
|
|
@@ -510,6 +521,29 @@ export abstract class NotificationContainer<UI, C extends NotificationCallProps>
|
|
|
510
521
|
}
|
|
511
522
|
}
|
|
512
523
|
|
|
524
|
+
/**
|
|
525
|
+
* Popup component as modal
|
|
526
|
+
* @param component Component to popup
|
|
527
|
+
* @param anchor Position anchor
|
|
528
|
+
* @returns Result
|
|
529
|
+
*/
|
|
530
|
+
popup(
|
|
531
|
+
component: NotificationContent<UI>,
|
|
532
|
+
anchor?: HTMLElement | string | { left: number; top: number }
|
|
533
|
+
) {
|
|
534
|
+
// Setup
|
|
535
|
+
const n: INotificaseBase<UI, C> = {
|
|
536
|
+
type: NotificationType.Popup,
|
|
537
|
+
content: component,
|
|
538
|
+
renderSetup: (options) => {
|
|
539
|
+
options.anchor = anchor;
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
// Add to the collection
|
|
544
|
+
return this.addRaw(n);
|
|
545
|
+
}
|
|
546
|
+
|
|
513
547
|
/**
|
|
514
548
|
* Show a success message
|
|
515
549
|
* @param message Message
|