@etsoo/notificationbase 1.1.26 → 1.1.28

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
@@ -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
@@ -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
@@ -66,7 +68,7 @@ export interface NotificationDismiss {
66
68
  * Notification reander setup
67
69
  */
68
70
  export interface NotifictionRenderSetup {
69
- (options: any): void;
71
+ (options: any): any;
70
72
  }
71
73
  /**
72
74
  * On return callback
@@ -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"; // Alert
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,13 @@ 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 properties Popup properties
95
+ * @returns Result
96
+ */
97
+ popup(component: NotificationContent<UI>, properties: any): INotification<UI, C>;
91
98
  /**
92
99
  * Prompt action
93
100
  * @param message Message
@@ -224,6 +231,13 @@ export declare abstract class NotificationContainer<UI, C extends NotificationCa
224
231
  * @param title Title
225
232
  */
226
233
  showLoading(title?: NotificationContent<UI>): void;
234
+ /**
235
+ * Popup component as modal
236
+ * @param component Component to popup
237
+ * @param properties Popup properties
238
+ * @returns Result
239
+ */
240
+ popup(component: NotificationContent<UI>, properties: any): INotification<UI, C>;
227
241
  /**
228
242
  * Show a success message
229
243
  * @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 properties Popup properties
266
+ * @returns Result
267
+ */
268
+ popup(component, properties) {
269
+ // Setup
270
+ const n = {
271
+ type: NotificationType.Popup,
272
+ content: component,
273
+ renderSetup: (_options) => {
274
+ return properties;
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.26",
3
+ "version": "1.1.28",
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.8"
48
+ "@etsoo/shared": "^1.2.10"
49
49
  },
50
50
  "devDependencies": {
51
- "@babel/core": "^7.22.10",
51
+ "@babel/core": "^7.22.11",
52
52
  "@babel/plugin-transform-runtime": "^7.22.10",
53
- "@babel/preset-env": "^7.22.10",
54
- "@babel/runtime-corejs3": "^7.22.10",
55
- "@types/jest": "^29.5.3",
56
- "babel-jest": "^29.6.2",
57
- "jest": "^29.6.2",
58
- "jest-environment-jsdom": "^29.6.2",
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.1.6"
60
+ "typescript": "^5.2.2"
61
61
  }
62
62
  }
@@ -27,7 +27,8 @@ export enum NotificationModalType {
27
27
  Loading = 0,
28
28
  Confirm = 1,
29
29
  Prompt = 2,
30
- Error = 3 // Alert
30
+ Error = 3, // Alert
31
+ Popup = 6
31
32
  }
32
33
 
33
34
  /**
@@ -70,7 +71,7 @@ export interface NotificationDismiss {
70
71
  * Notification reander setup
71
72
  */
72
73
  export interface NotifictionRenderSetup {
73
- (options: any): void;
74
+ (options: any): any;
74
75
  }
75
76
 
76
77
  /**
@@ -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 properties Popup properties
140
+ * @returns Result
141
+ */
142
+ popup(
143
+ component: NotificationContent<UI>,
144
+ properties: any
145
+ ): INotification<UI, C>;
146
+
136
147
  /**
137
148
  * Prompt action
138
149
  * @param message Message
@@ -510,6 +521,26 @@ 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 properties Popup properties
528
+ * @returns Result
529
+ */
530
+ popup(component: NotificationContent<UI>, properties: any) {
531
+ // Setup
532
+ const n: INotificaseBase<UI, C> = {
533
+ type: NotificationType.Popup,
534
+ content: component,
535
+ renderSetup: (_options) => {
536
+ return properties;
537
+ }
538
+ };
539
+
540
+ // Add to the collection
541
+ return this.addRaw(n);
542
+ }
543
+
513
544
  /**
514
545
  * Show a success message
515
546
  * @param message Message