@etsoo/notificationbase 1.1.65 → 1.1.67

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.
@@ -11,6 +11,10 @@ on:
11
11
  # release:
12
12
  # types: [created]
13
13
 
14
+ permissions:
15
+ id-token: write # Required for OIDC
16
+ contents: read
17
+
14
18
  jobs:
15
19
  # Publish to NPM
16
20
  publish-npm:
@@ -44,6 +48,4 @@ jobs:
44
48
 
45
49
  # Publish to npm
46
50
  # For scoped package, make it public for free service
47
- - run: npm publish --access public
48
- env:
49
- NODE_AUTH_TOKEN: ${{ secrets.ETSOONpmToken }}
51
+ - run: npm publish
@@ -22,7 +22,8 @@ export declare enum NotificationModalType {
22
22
  Confirm = 1,
23
23
  Prompt = 2,
24
24
  Error = 3,// Alert
25
- Popup = 6
25
+ Popup = 6,
26
+ Data = 7
26
27
  }
27
28
  /**
28
29
  * Message types
@@ -49,6 +50,7 @@ export declare const NotificationType: {
49
50
  Prompt: NotificationModalType.Prompt;
50
51
  Error: NotificationModalType.Error;
51
52
  Popup: NotificationModalType.Popup;
53
+ Data: NotificationModalType.Data;
52
54
  };
53
55
  /**
54
56
  * Notification types
@@ -26,6 +26,7 @@ var NotificationModalType;
26
26
  NotificationModalType[NotificationModalType["Prompt"] = 2] = "Prompt";
27
27
  NotificationModalType[NotificationModalType["Error"] = 3] = "Error";
28
28
  NotificationModalType[NotificationModalType["Popup"] = 6] = "Popup";
29
+ NotificationModalType[NotificationModalType["Data"] = 7] = "Data";
29
30
  })(NotificationModalType || (exports.NotificationModalType = NotificationModalType = {}));
30
31
  /**
31
32
  * Message types
@@ -67,6 +67,14 @@ export interface INotifier<UI, C extends NotificationCallProps> {
67
67
  * @param props Props
68
68
  */
69
69
  confirm(message: NotificationContent<UI>, title?: NotificationContent<UI>, callback?: NotificationReturn<boolean>, props?: C): INotification<UI, C>;
70
+ /**
71
+ * Collecting data action
72
+ * @param message Message
73
+ * @param callback Callback
74
+ * @param title Title
75
+ * @param props More properties
76
+ */
77
+ data<T>(inputs: Exclude<NotificationContent<UI>, string>, callback: NotificationReturn<T>, title?: string, props?: C): INotification<UI, C>;
70
78
  /**
71
79
  * Dispose all notifications
72
80
  */
@@ -226,6 +234,14 @@ export declare abstract class NotificationContainer<UI, C extends NotificationCa
226
234
  * @param force Force to hide, otherwise, only the last one
227
235
  */
228
236
  hideLoading(force?: boolean): void;
237
+ /**
238
+ * Collecting data action
239
+ * @param message Message
240
+ * @param callback Callback
241
+ * @param title Title
242
+ * @param props More properties
243
+ */
244
+ data<T>(inputs: Exclude<NotificationContent<UI>, string>, callback: NotificationReturn<T>, title?: string, props?: C): INotification<UI, C>;
229
245
  /**
230
246
  * Show a message
231
247
  * @param type Message type
@@ -220,6 +220,25 @@ class NotificationContainer {
220
220
  }
221
221
  }
222
222
  }
223
+ /**
224
+ * Collecting data action
225
+ * @param message Message
226
+ * @param callback Callback
227
+ * @param title Title
228
+ * @param props More properties
229
+ */
230
+ data(inputs, callback, title, props) {
231
+ // Setup
232
+ const n = {
233
+ type: Notification_1.NotificationType.Data,
234
+ content: inputs,
235
+ title,
236
+ inputProps: props,
237
+ onReturn: callback
238
+ };
239
+ // Add to the collection
240
+ return this.addRaw(n);
241
+ }
223
242
  /**
224
243
  * Show a message
225
244
  * @param type Message type
@@ -22,7 +22,8 @@ export declare enum NotificationModalType {
22
22
  Confirm = 1,
23
23
  Prompt = 2,
24
24
  Error = 3,// Alert
25
- Popup = 6
25
+ Popup = 6,
26
+ Data = 7
26
27
  }
27
28
  /**
28
29
  * Message types
@@ -49,6 +50,7 @@ export declare const NotificationType: {
49
50
  Prompt: NotificationModalType.Prompt;
50
51
  Error: NotificationModalType.Error;
51
52
  Popup: NotificationModalType.Popup;
53
+ Data: NotificationModalType.Data;
52
54
  };
53
55
  /**
54
56
  * Notification types
@@ -23,6 +23,7 @@ export var NotificationModalType;
23
23
  NotificationModalType[NotificationModalType["Prompt"] = 2] = "Prompt";
24
24
  NotificationModalType[NotificationModalType["Error"] = 3] = "Error";
25
25
  NotificationModalType[NotificationModalType["Popup"] = 6] = "Popup";
26
+ NotificationModalType[NotificationModalType["Data"] = 7] = "Data";
26
27
  })(NotificationModalType || (NotificationModalType = {}));
27
28
  /**
28
29
  * Message types
@@ -67,6 +67,14 @@ export interface INotifier<UI, C extends NotificationCallProps> {
67
67
  * @param props Props
68
68
  */
69
69
  confirm(message: NotificationContent<UI>, title?: NotificationContent<UI>, callback?: NotificationReturn<boolean>, props?: C): INotification<UI, C>;
70
+ /**
71
+ * Collecting data action
72
+ * @param message Message
73
+ * @param callback Callback
74
+ * @param title Title
75
+ * @param props More properties
76
+ */
77
+ data<T>(inputs: Exclude<NotificationContent<UI>, string>, callback: NotificationReturn<T>, title?: string, props?: C): INotification<UI, C>;
70
78
  /**
71
79
  * Dispose all notifications
72
80
  */
@@ -226,6 +234,14 @@ export declare abstract class NotificationContainer<UI, C extends NotificationCa
226
234
  * @param force Force to hide, otherwise, only the last one
227
235
  */
228
236
  hideLoading(force?: boolean): void;
237
+ /**
238
+ * Collecting data action
239
+ * @param message Message
240
+ * @param callback Callback
241
+ * @param title Title
242
+ * @param props More properties
243
+ */
244
+ data<T>(inputs: Exclude<NotificationContent<UI>, string>, callback: NotificationReturn<T>, title?: string, props?: C): INotification<UI, C>;
229
245
  /**
230
246
  * Show a message
231
247
  * @param type Message type
@@ -217,6 +217,25 @@ export class NotificationContainer {
217
217
  }
218
218
  }
219
219
  }
220
+ /**
221
+ * Collecting data action
222
+ * @param message Message
223
+ * @param callback Callback
224
+ * @param title Title
225
+ * @param props More properties
226
+ */
227
+ data(inputs, callback, title, props) {
228
+ // Setup
229
+ const n = {
230
+ type: NotificationType.Data,
231
+ content: inputs,
232
+ title,
233
+ inputProps: props,
234
+ onReturn: callback
235
+ };
236
+ // Add to the collection
237
+ return this.addRaw(n);
238
+ }
220
239
  /**
221
240
  * Show a message
222
241
  * @param type Message type
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/notificationbase",
3
- "version": "1.1.65",
3
+ "version": "1.1.67",
4
4
  "description": "TypeScript notification component for extending with all features described and partially implemented",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -35,16 +35,16 @@
35
35
  },
36
36
  "homepage": "https://github.com/ETSOO/NotificationBase#readme",
37
37
  "dependencies": {
38
- "@etsoo/shared": "^1.2.78"
38
+ "@etsoo/shared": "^1.2.80"
39
39
  },
40
40
  "devDependencies": {
41
- "@babel/core": "^7.28.5",
42
- "@babel/plugin-transform-runtime": "^7.28.5",
43
- "@babel/preset-env": "^7.28.5",
44
- "@babel/runtime-corejs3": "^7.28.4",
45
- "@vitejs/plugin-react": "^5.1.0",
46
- "jsdom": "^27.1.0",
41
+ "@babel/core": "^7.29.0",
42
+ "@babel/plugin-transform-runtime": "^7.29.0",
43
+ "@babel/preset-env": "^7.29.0",
44
+ "@babel/runtime-corejs3": "^7.29.0",
45
+ "@vitejs/plugin-react": "^6.0.1",
46
+ "jsdom": "^28.1.0",
47
47
  "typescript": "^5.9.3",
48
- "vitest": "^4.0.7"
48
+ "vitest": "^4.1.0"
49
49
  }
50
50
  }
@@ -28,7 +28,8 @@ export enum NotificationModalType {
28
28
  Confirm = 1,
29
29
  Prompt = 2,
30
30
  Error = 3, // Alert
31
- Popup = 6
31
+ Popup = 6,
32
+ Data = 7
32
33
  }
33
34
 
34
35
  /**
@@ -188,8 +189,10 @@ export interface INotificaseBase<UI, C extends NotificationCallProps = {}> {
188
189
  /**
189
190
  * Notification interface
190
191
  */
191
- export interface INotification<UI, C extends NotificationCallProps>
192
- extends INotificaseBase<UI, C> {
192
+ export interface INotification<
193
+ UI,
194
+ C extends NotificationCallProps
195
+ > extends INotificaseBase<UI, C> {
193
196
  /**
194
197
  * Display align
195
198
  */
@@ -264,9 +267,10 @@ export interface INotification<UI, C extends NotificationCallProps>
264
267
  * Notification class
265
268
  * Generic parameter UI presents UI element type
266
269
  */
267
- export abstract class Notification<UI, C extends NotificationCallProps>
268
- implements INotification<UI, C>
269
- {
270
+ export abstract class Notification<
271
+ UI,
272
+ C extends NotificationCallProps
273
+ > implements INotification<UI, C> {
270
274
  /**
271
275
  * Display align
272
276
  */
@@ -103,6 +103,20 @@ export interface INotifier<UI, C extends NotificationCallProps> {
103
103
  props?: C
104
104
  ): INotification<UI, C>;
105
105
 
106
+ /**
107
+ * Collecting data action
108
+ * @param message Message
109
+ * @param callback Callback
110
+ * @param title Title
111
+ * @param props More properties
112
+ */
113
+ data<T>(
114
+ inputs: Exclude<NotificationContent<UI>, string>,
115
+ callback: NotificationReturn<T>,
116
+ title?: string,
117
+ props?: C
118
+ ): INotification<UI, C>;
119
+
106
120
  /**
107
121
  * Dispose all notifications
108
122
  */
@@ -194,9 +208,10 @@ export interface INotifier<UI, C extends NotificationCallProps> {
194
208
  /**
195
209
  * Notification container class
196
210
  */
197
- export abstract class NotificationContainer<UI, C extends NotificationCallProps>
198
- implements INotifier<UI, C>
199
- {
211
+ export abstract class NotificationContainer<
212
+ UI,
213
+ C extends NotificationCallProps
214
+ > implements INotifier<UI, C> {
200
215
  // Registered update action
201
216
  private update: NotificationAction<UI, C>;
202
217
 
@@ -469,6 +484,32 @@ export abstract class NotificationContainer<UI, C extends NotificationCallProps>
469
484
  }
470
485
  }
471
486
 
487
+ /**
488
+ * Collecting data action
489
+ * @param message Message
490
+ * @param callback Callback
491
+ * @param title Title
492
+ * @param props More properties
493
+ */
494
+ data<T>(
495
+ inputs: Exclude<NotificationContent<UI>, string>,
496
+ callback: NotificationReturn<T>,
497
+ title?: string,
498
+ props?: C
499
+ ) {
500
+ // Setup
501
+ const n: INotificaseBase<UI, C> = {
502
+ type: NotificationType.Data,
503
+ content: inputs,
504
+ title,
505
+ inputProps: props,
506
+ onReturn: callback
507
+ };
508
+
509
+ // Add to the collection
510
+ return this.addRaw(n);
511
+ }
512
+
472
513
  /**
473
514
  * Show a message
474
515
  * @param type Message type