devlab-one-dynamic-alert 1.0.0

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 ADDED
@@ -0,0 +1,388 @@
1
+ # Dynamic Alert
2
+
3
+ A lightweight Angular Material-based Alert Library that provides beautiful and consistent alert dialogs for common application scenarios such as:
4
+
5
+ * Success Messages
6
+ * Error Messages
7
+ * Information Messages
8
+ * Warning Messages
9
+ * Confirmation Dialogs
10
+
11
+ The library eliminates the need to manually create dialog components for simple notifications and confirmation popups.
12
+
13
+ ---
14
+
15
+ ## Features
16
+
17
+ * 🚀 Simple API
18
+ * 🎨 Angular Material Design
19
+ * ✅ Success Alerts
20
+ * ❌ Error Alerts
21
+ * ℹ️ Information Alerts
22
+ * ⚠️ Warning Alerts
23
+ * 🤔 Confirmation Dialogs
24
+ * 🔄 Callback Support
25
+ * 📝 Supports String Messages
26
+ * 📋 Supports Structured Error Messages
27
+ * ⚡ Zero Configuration
28
+
29
+ ---
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ npm install @your-scope/dynamic-alert
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Inject Alert Service
40
+
41
+ ```typescript
42
+ import { AlertService } from '@your-scope/dynamic-alert';
43
+
44
+ constructor(
45
+ private alertService: AlertService
46
+ ) {}
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Available Methods
52
+
53
+ ```typescript
54
+ success(
55
+ message: string | IErrorMessage,
56
+ okCallback?: () => void
57
+ ): void;
58
+
59
+ error(
60
+ message: string | IErrorMessage,
61
+ okCallback?: () => void
62
+ ): void;
63
+
64
+ info(
65
+ message: string | IErrorMessage,
66
+ okCallback?: () => void
67
+ ): void;
68
+
69
+ warning(
70
+ message: string | IErrorMessage,
71
+ okCallback?: () => void
72
+ ): void;
73
+
74
+ confirmationModel(
75
+ message: string | IErrorMessage,
76
+ okCallback?: () => void,
77
+ cancelCallback?: () => void
78
+ ): void;
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Success Alert
84
+
85
+ Display a success message after a successful operation.
86
+
87
+ ```typescript
88
+ this.alertService.success(
89
+ 'Employee created successfully'
90
+ );
91
+ ```
92
+
93
+ ### With Callback
94
+
95
+ ```typescript
96
+ this.alertService.success(
97
+ 'Employee created successfully',
98
+ () => {
99
+ this.loadEmployees();
100
+ }
101
+ );
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Error Alert
107
+
108
+ Display application or API error messages.
109
+
110
+ ```typescript
111
+ this.alertService.error(
112
+ 'Unable to save employee details'
113
+ );
114
+ ```
115
+
116
+ ### With Callback
117
+
118
+ ```typescript
119
+ this.alertService.error(
120
+ 'Unable to save employee details',
121
+ () => {
122
+ console.log('Error acknowledged');
123
+ }
124
+ );
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Information Alert
130
+
131
+ Display informational messages to the user.
132
+
133
+ ```typescript
134
+ this.alertService.info(
135
+ 'New application update is available'
136
+ );
137
+ ```
138
+
139
+ ### With Callback
140
+
141
+ ```typescript
142
+ this.alertService.info(
143
+ 'New application update is available',
144
+ () => {
145
+ console.log('Information viewed');
146
+ }
147
+ );
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Warning Alert
153
+
154
+ Display warning messages before a critical action.
155
+
156
+ ```typescript
157
+ this.alertService.warning(
158
+ 'You have unsaved changes'
159
+ );
160
+ ```
161
+
162
+ ### With Callback
163
+
164
+ ```typescript
165
+ this.alertService.warning(
166
+ 'You have unsaved changes',
167
+ () => {
168
+ console.log('Warning acknowledged');
169
+ }
170
+ );
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Confirmation Dialog
176
+
177
+ Display a confirmation popup before performing an action.
178
+
179
+ ```typescript
180
+ this.alertService.confirmationModel(
181
+ 'Are you sure you want to delete this employee?'
182
+ );
183
+ ```
184
+
185
+ ### With Confirm Callback
186
+
187
+ ```typescript
188
+ this.alertService.confirmationModel(
189
+ 'Are you sure you want to delete this employee?',
190
+ () => {
191
+ this.deleteEmployee();
192
+ }
193
+ );
194
+ ```
195
+
196
+ ### With Confirm and Cancel Callback
197
+
198
+ ```typescript
199
+ this.alertService.confirmationModel(
200
+ 'Are you sure you want to delete this employee?',
201
+ () => {
202
+ console.log('Confirmed');
203
+ },
204
+ () => {
205
+ console.log('Cancelled');
206
+ }
207
+ );
208
+ ```
209
+
210
+ ---
211
+
212
+ ## Using Structured Error Messages
213
+
214
+ The library supports both string messages and structured error objects.
215
+
216
+ ```typescript
217
+ export interface IErrorMessage {
218
+ title?: string;
219
+ message: string;
220
+ errors?: string[];
221
+ }
222
+ ```
223
+
224
+ ### Example
225
+
226
+ ```typescript
227
+ const error: IErrorMessage = {
228
+ title: 'Validation Error',
229
+ message: 'Unable to submit the form',
230
+ errors: [
231
+ 'Name is required',
232
+ 'Email is invalid'
233
+ ]
234
+ };
235
+
236
+ this.alertService.error(error);
237
+ ```
238
+
239
+ ---
240
+
241
+ ## Alert Types
242
+
243
+ | Method | Description |
244
+ | ------------------- | ------------------------ |
245
+ | success() | Success notification |
246
+ | error() | Error notification |
247
+ | info() | Information notification |
248
+ | warning() | Warning notification |
249
+ | confirmationModel() | Confirmation dialog |
250
+
251
+ ---
252
+
253
+ ## Callback Flow
254
+
255
+ ### Success
256
+
257
+ ```typescript
258
+ this.alertService.success(
259
+ 'Saved Successfully',
260
+ () => {
261
+ console.log('OK Clicked');
262
+ }
263
+ );
264
+ ```
265
+
266
+ ### Confirmation
267
+
268
+ ```typescript
269
+ this.alertService.confirmationModel(
270
+ 'Delete Employee?',
271
+ () => {
272
+ console.log('Confirmed');
273
+ },
274
+ () => {
275
+ console.log('Cancelled');
276
+ }
277
+ );
278
+ ```
279
+
280
+ ---
281
+
282
+ ## UI Examples
283
+
284
+ ### Success Alert
285
+
286
+ ```text
287
+ ✓ Success
288
+
289
+ Employee saved successfully
290
+
291
+ [ OK ]
292
+ ```
293
+
294
+ ### Error Alert
295
+
296
+ ```text
297
+ ✕ Error
298
+
299
+ Unable to save employee
300
+
301
+ [ OK ]
302
+ ```
303
+
304
+ ### Information Alert
305
+
306
+ ```text
307
+ ℹ Information
308
+
309
+ New update available
310
+
311
+ [ OK ]
312
+ ```
313
+
314
+ ### Warning Alert
315
+
316
+ ```text
317
+ ⚠ Warning
318
+
319
+ Unsaved changes detected
320
+
321
+ [ OK ]
322
+ ```
323
+
324
+ ### Confirmation Dialog
325
+
326
+ ```text
327
+ ? Confirmation
328
+
329
+ Are you sure you want to delete this record?
330
+
331
+ [ Cancel ] [ Confirm ]
332
+ ```
333
+
334
+ ---
335
+
336
+ ## Typical Usage Scenarios
337
+
338
+ ### API Success
339
+
340
+ ```typescript
341
+ this.employeeService.create(employee)
342
+ .subscribe({
343
+ next: () => {
344
+ this.alertService.success(
345
+ 'Employee created successfully'
346
+ );
347
+ }
348
+ });
349
+ ```
350
+
351
+ ### API Error
352
+
353
+ ```typescript
354
+ this.employeeService.create(employee)
355
+ .subscribe({
356
+ error: () => {
357
+ this.alertService.error(
358
+ 'Unable to create employee'
359
+ );
360
+ }
361
+ });
362
+ ```
363
+
364
+ ### Delete Confirmation
365
+
366
+ ```typescript
367
+ this.alertService.confirmationModel(
368
+ 'Delete selected employee?',
369
+ () => {
370
+ this.deleteEmployee();
371
+ }
372
+ );
373
+ ```
374
+
375
+ ---
376
+
377
+ ## Built With
378
+
379
+ * Angular 21+
380
+ * Angular Material Dialog
381
+ * TypeScript
382
+ * RxJS
383
+
384
+ ---
385
+
386
+ ## License
387
+
388
+ MIT License
@@ -0,0 +1,207 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { Inject, Component, Injectable } from '@angular/core';
4
+ import * as i3 from '@angular/material/button';
5
+ import { MatButtonModule } from '@angular/material/button';
6
+ import * as i1 from '@angular/material/dialog';
7
+ import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
8
+ import * as i2 from '@angular/material/icon';
9
+ import { MatIconModule } from '@angular/material/icon';
10
+
11
+ class DynamicAlert {
12
+ dialogRef;
13
+ data;
14
+ /**
15
+ * Desc : constructor initialization
16
+ * @param dialogRef : alert component
17
+ * @param data : input to the alert component
18
+ */
19
+ constructor(dialogRef, data) {
20
+ this.dialogRef = dialogRef;
21
+ this.data = data;
22
+ }
23
+ /**
24
+ * Desc : executes while click on yes button
25
+ */
26
+ onYesClick() {
27
+ this.dialogRef.close(true);
28
+ }
29
+ /**
30
+ * Desc : executes while click on no button
31
+ */
32
+ onNoClick() {
33
+ this.dialogRef.close(false);
34
+ }
35
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: DynamicAlert, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
36
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: DynamicAlert, isStandalone: true, selector: "lib-dynamic-alert", ngImport: i0, template: "<!-- Alert model section begins -->\n<section class=\"alert-modal-container\">\n <div class=\"mat-title\" mat-dialog-title>\n <mat-icon\n class=\"{{ data.type }}\"\n aria-hidden=\"false\"\n aria-label=\"filter icon\"\n fontIcon=\"{{ data.type }}\"\n ></mat-icon>\n </div>\n <div mat-dialog-content>\n <span class=\"alert-content-text\" [innerHTML]=\"data.message\"></span>\n </div>\n @if(data.alertType === 'confirmation'){\n <div mat-dialog-actions>\n <div class=\"alert-btn-section\">\n <button mat-stroked-button class=\"btn-ok\" (click)=\"onNoClick()\">No</button>\n <button mat-flat-button color=\"primary\" class=\"btn-yes\" (click)=\"onYesClick()\">Yes</button>\n </div>\n </div>\n }@else{\n <div mat-dialog-actions>\n <div class=\"alert-btn-section\">\n <button class=\"btn-ok\" mat-stroked-button color=\"primary\" (click)=\"onYesClick()\">Ok</button>\n </div>\n </div>\n }\n </section>\n <!-- Alert model section ends -->", styles: [".alert-modal-container{padding:5%;text-align:center}.alert-modal-container .mat-title{padding:unset}.alert-modal-container .mat-title .info{font-size:60px;height:60px;width:60px;color:#ffdd2d}.alert-modal-container .mat-title .cancel{font-size:60px;height:60px;width:60px;color:red}.alert-modal-container .mat-title .check_circle{font-size:60px;height:60px;width:60px;color:green}.alert-modal-container .alert-content-text{font-size:var(--FONT-SIZE-FOR-NORMAL-TEXT);font-weight:var(--FONT-WEIGHT-BOLD);color:var(--TEXT-DARK-COLOR);word-wrap:break-word}.alert-modal-container .alert-heading-text{font-size:var(--FONT-SIZE-FOR-NORMAL-TEXT);font-weight:var(--FONT-WEIGHT-BOLD)}.alert-modal-container .alert-btn-section{text-align:center;width:100%}.alert-modal-container .alert-btn-section .btn-ok{width:100px;height:40px;font-size:var(--FONT-SIZE-FOR-SMALL-TEXT);color:var(--PRIMARY-COLOR);font-weight:var(--FONT-WEIGHT-SEMI-BOLD)}.alert-modal-container .alert-btn-section .btn-yes{width:100px;height:40px;font-size:var(--FONT-SIZE-FOR-SMALL-TEXT);color:var(--TEXT-LIGHT-COLOR);font-weight:var(--FONT-WEIGHT-SEMI-BOLD)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }] });
37
+ }
38
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: DynamicAlert, decorators: [{
39
+ type: Component,
40
+ args: [{ selector: 'lib-dynamic-alert', standalone: true, imports: [
41
+ CommonModule,
42
+ MatDialogModule,
43
+ MatIconModule,
44
+ MatButtonModule
45
+ ], template: "<!-- Alert model section begins -->\n<section class=\"alert-modal-container\">\n <div class=\"mat-title\" mat-dialog-title>\n <mat-icon\n class=\"{{ data.type }}\"\n aria-hidden=\"false\"\n aria-label=\"filter icon\"\n fontIcon=\"{{ data.type }}\"\n ></mat-icon>\n </div>\n <div mat-dialog-content>\n <span class=\"alert-content-text\" [innerHTML]=\"data.message\"></span>\n </div>\n @if(data.alertType === 'confirmation'){\n <div mat-dialog-actions>\n <div class=\"alert-btn-section\">\n <button mat-stroked-button class=\"btn-ok\" (click)=\"onNoClick()\">No</button>\n <button mat-flat-button color=\"primary\" class=\"btn-yes\" (click)=\"onYesClick()\">Yes</button>\n </div>\n </div>\n }@else{\n <div mat-dialog-actions>\n <div class=\"alert-btn-section\">\n <button class=\"btn-ok\" mat-stroked-button color=\"primary\" (click)=\"onYesClick()\">Ok</button>\n </div>\n </div>\n }\n </section>\n <!-- Alert model section ends -->", styles: [".alert-modal-container{padding:5%;text-align:center}.alert-modal-container .mat-title{padding:unset}.alert-modal-container .mat-title .info{font-size:60px;height:60px;width:60px;color:#ffdd2d}.alert-modal-container .mat-title .cancel{font-size:60px;height:60px;width:60px;color:red}.alert-modal-container .mat-title .check_circle{font-size:60px;height:60px;width:60px;color:green}.alert-modal-container .alert-content-text{font-size:var(--FONT-SIZE-FOR-NORMAL-TEXT);font-weight:var(--FONT-WEIGHT-BOLD);color:var(--TEXT-DARK-COLOR);word-wrap:break-word}.alert-modal-container .alert-heading-text{font-size:var(--FONT-SIZE-FOR-NORMAL-TEXT);font-weight:var(--FONT-WEIGHT-BOLD)}.alert-modal-container .alert-btn-section{text-align:center;width:100%}.alert-modal-container .alert-btn-section .btn-ok{width:100px;height:40px;font-size:var(--FONT-SIZE-FOR-SMALL-TEXT);color:var(--PRIMARY-COLOR);font-weight:var(--FONT-WEIGHT-SEMI-BOLD)}.alert-modal-container .alert-btn-section .btn-yes{width:100px;height:40px;font-size:var(--FONT-SIZE-FOR-SMALL-TEXT);color:var(--TEXT-LIGHT-COLOR);font-weight:var(--FONT-WEIGHT-SEMI-BOLD)}\n"] }]
46
+ }], ctorParameters: () => [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
47
+ type: Inject,
48
+ args: [MAT_DIALOG_DATA]
49
+ }] }] });
50
+
51
+ class ErrorHelper {
52
+ /**
53
+ * Desc : Prepare display error message
54
+ * @param errorMessage : error message response
55
+ * @returns : error message
56
+ */
57
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
+ static prepareErrorMessage(errorMessage) {
59
+ let messageContent = '';
60
+ const message = errorMessage?.message ? errorMessage.message : errorMessage;
61
+ if (errorMessage.info && errorMessage.info?.length > 0) {
62
+ errorMessage.info.map((infoDetails, index) => {
63
+ messageContent += `<p>${index + 1}.${this.prepareErrorMessage(infoDetails)}</p>`;
64
+ });
65
+ }
66
+ return errorMessage.info && errorMessage.info?.length > 0
67
+ ? `<p>${errorMessage?.message}</p> ${messageContent}`
68
+ : message;
69
+ }
70
+ }
71
+
72
+ var MessageType;
73
+ (function (MessageType) {
74
+ MessageType["success"] = "check_circle";
75
+ MessageType["error"] = "cancel";
76
+ MessageType["info"] = "info";
77
+ MessageType["warning"] = "warning";
78
+ })(MessageType || (MessageType = {}));
79
+ var AlertType;
80
+ (function (AlertType) {
81
+ AlertType["confirmation"] = "confirmation";
82
+ AlertType["notification"] = "notification";
83
+ })(AlertType || (AlertType = {}));
84
+
85
+ /**********************************************************************
86
+ Page : Notification alert service page
87
+ Desc : contain functioanlities of notifcation alert
88
+ **********************************************************************/
89
+ class AlertService {
90
+ dialog;
91
+ /**
92
+ * Desc : declaring variable for storing width size of alert modal
93
+ */
94
+ widthModel = '400px';
95
+ /**
96
+ * Desc : declaring variable for storing height of alert modal
97
+ */
98
+ heightModel = '650px';
99
+ /**
100
+ * Desc : constructor initialization
101
+ * @param dialog : consumed angular material mat dialog
102
+ * @param utility : consumed utility service
103
+ */
104
+ constructor(dialog) {
105
+ this.dialog = dialog;
106
+ }
107
+ /**
108
+ * Desc : success alert
109
+ * @param message : display message
110
+ */
111
+ success(message, okCallback) {
112
+ const disabledClose = false;
113
+ const widthModel = this.widthModel;
114
+ const messageConent = typeof message == 'string' ? message : ErrorHelper.prepareErrorMessage(message);
115
+ this.openDialog(disabledClose, widthModel, messageConent, MessageType.success, AlertType.notification, okCallback);
116
+ }
117
+ /**
118
+ * Desc : error alert
119
+ * @param message : display message
120
+ */
121
+ error(message, okCallback) {
122
+ const disabledClose = false;
123
+ const widthModel = this.widthModel;
124
+ const messageConent = typeof message == 'string' ? message : ErrorHelper.prepareErrorMessage(message);
125
+ this.openDialog(disabledClose, widthModel, messageConent, MessageType.error, AlertType.notification, okCallback);
126
+ }
127
+ /**
128
+ * Desc : info alert
129
+ * @param message : display message
130
+ */
131
+ info(message, okCallback) {
132
+ const disabledClose = false;
133
+ const widthModel = this.widthModel;
134
+ const messageConent = typeof message == 'string' ? message : ErrorHelper.prepareErrorMessage(message);
135
+ this.openDialog(disabledClose, widthModel, messageConent, MessageType.info, AlertType.notification, okCallback);
136
+ }
137
+ /**
138
+ * Desc : warning alert
139
+ * @param message : display message
140
+ */
141
+ warning(message, okCallback) {
142
+ const disabledClose = false;
143
+ const widthModel = this.widthModel;
144
+ const messageConent = typeof message == 'string' ? message : ErrorHelper.prepareErrorMessage(message);
145
+ this.openDialog(disabledClose, widthModel, messageConent, MessageType.warning, AlertType.notification, okCallback);
146
+ }
147
+ /**
148
+ * Desc : confirmation alert model
149
+ * @param message : display message
150
+ * @param okCallback : callback function
151
+ */
152
+ confirmationModel(message, okCallback, CancelCallback) {
153
+ const disabledClose = false;
154
+ const widthModel = this.widthModel;
155
+ const messageConent = typeof message == 'string' ? message : ErrorHelper.prepareErrorMessage(message);
156
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
157
+ this.openDialog(disabledClose, widthModel, messageConent, MessageType.info, AlertType.confirmation, okCallback, CancelCallback);
158
+ }
159
+ /**
160
+ *
161
+ * @param disabledClose : strict closing
162
+ * @param widthModel : width size of model
163
+ * @param messageContent : full message content to be displayed in dialog
164
+ * @param typeOfMessage : message type
165
+ * @param alertType : alert type
166
+ * @param okCallback : callback function
167
+ * @param cancelCallback : callback function
168
+ */
169
+ openDialog(disabledClose, widthModel, messageContent, typeOfMessage, alertType, okCallback,
170
+ // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-explicit-any
171
+ cancelCallback = () => { }) {
172
+ this.dialog
173
+ .open(DynamicAlert, {
174
+ width: widthModel,
175
+ data: { message: messageContent, type: typeOfMessage, alertType: alertType },
176
+ disableClose: disabledClose,
177
+ })
178
+ .afterClosed()
179
+ .subscribe((result) => {
180
+ if (result && okCallback) {
181
+ okCallback();
182
+ }
183
+ if (!result && cancelCallback) {
184
+ cancelCallback();
185
+ }
186
+ });
187
+ }
188
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: AlertService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
189
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: AlertService, providedIn: 'root' });
190
+ }
191
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: AlertService, decorators: [{
192
+ type: Injectable,
193
+ args: [{
194
+ providedIn: 'root',
195
+ }]
196
+ }], ctorParameters: () => [{ type: i1.MatDialog }] });
197
+
198
+ /*
199
+ * Public API Surface of dynamic-alert
200
+ */
201
+
202
+ /**
203
+ * Generated bundle index. Do not edit.
204
+ */
205
+
206
+ export { AlertService, AlertType, DynamicAlert, MessageType };
207
+ //# sourceMappingURL=devlab-one-dynamic-alert.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devlab-one-dynamic-alert.mjs","sources":["../../../projects/dynamic-alert/src/lib/dynamic-alert.ts","../../../projects/dynamic-alert/src/lib/dynamic-alert.html","../../../projects/dynamic-alert/src/lib/class/error-helper.ts","../../../projects/dynamic-alert/src/lib/interfaces/idialog.ts","../../../projects/dynamic-alert/src/lib/services/alert.service.ts","../../../projects/dynamic-alert/src/public-api.ts","../../../projects/dynamic-alert/src/devlab-one-dynamic-alert.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, Inject } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';\nimport { MatIconModule } from '@angular/material/icon';\nimport { IDialogData } from './interfaces/idialog';\n\n@Component({\n selector: 'lib-dynamic-alert',\n standalone: true,\n imports: [\n CommonModule,\n MatDialogModule,\n MatIconModule,\n MatButtonModule\n ],\n templateUrl: './dynamic-alert.html',\n styleUrl: './dynamic-alert.scss'\n})\n\nexport class DynamicAlert {\n /**\n * Desc : constructor initialization\n * @param dialogRef : alert component\n * @param data : input to the alert component\n */\n constructor(\n public dialogRef: MatDialogRef<DynamicAlert>,\n @Inject(MAT_DIALOG_DATA) public data: IDialogData,\n ) {}\n /**\n * Desc : executes while click on yes button\n */\n onYesClick(): void {\n this.dialogRef.close(true);\n }\n /**\n * Desc : executes while click on no button\n */\n onNoClick(): void {\n this.dialogRef.close(false);\n }\n}\n","<!-- Alert model section begins -->\n<section class=\"alert-modal-container\">\n <div class=\"mat-title\" mat-dialog-title>\n <mat-icon\n class=\"{{ data.type }}\"\n aria-hidden=\"false\"\n aria-label=\"filter icon\"\n fontIcon=\"{{ data.type }}\"\n ></mat-icon>\n </div>\n <div mat-dialog-content>\n <span class=\"alert-content-text\" [innerHTML]=\"data.message\"></span>\n </div>\n @if(data.alertType === 'confirmation'){\n <div mat-dialog-actions>\n <div class=\"alert-btn-section\">\n <button mat-stroked-button class=\"btn-ok\" (click)=\"onNoClick()\">No</button>\n <button mat-flat-button color=\"primary\" class=\"btn-yes\" (click)=\"onYesClick()\">Yes</button>\n </div>\n </div>\n }@else{\n <div mat-dialog-actions>\n <div class=\"alert-btn-section\">\n <button class=\"btn-ok\" mat-stroked-button color=\"primary\" (click)=\"onYesClick()\">Ok</button>\n </div>\n </div>\n }\n </section>\n <!-- Alert model section ends -->","import { IErrorInfo, IErrorMessage} from '../interfaces/idialog';\n\nexport class ErrorHelper {\n /**\n * Desc : Prepare display error message\n * @param errorMessage : error message response\n * @returns : error message\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public static prepareErrorMessage(errorMessage: IErrorMessage): string | any {\n let messageContent = '';\n const message = errorMessage?.message ? errorMessage.message : errorMessage;\n if (errorMessage.info && errorMessage.info?.length > 0) {\n errorMessage.info.map((infoDetails: IErrorInfo, index: number) => {\n messageContent += `<p>${index + 1}.${this.prepareErrorMessage(infoDetails)}</p>`;\n });\n }\n return errorMessage.info && errorMessage.info?.length > 0\n ? `<p>${errorMessage?.message}</p> ${messageContent}`\n : message;\n }\n}","import { ComponentType } from '@angular/cdk/overlay';\nimport { DynamicAlert } from '../dynamic-alert';\n\nexport interface IDialogData {\n message: string;\n title: string;\n type: string;\n alertType: AlertType;\n}\n\nexport enum MessageType {\n success = 'check_circle',\n error = 'cancel',\n info = 'info',\n warning = 'warning',\n}\n\n\nexport enum AlertType {\n confirmation = 'confirmation',\n notification = 'notification',\n}\n\nexport interface IErrorMessage {\n code: string;\n info?: Array<IErrorInfo>;\n message: string;\n}\n\n\nexport interface IErrorInfo {\n code: string;\n message: string;\n}","import { Injectable } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { ErrorHelper } from '../class/error-helper';\nimport { IErrorMessage } from '../interfaces/idialog';\nimport { AlertType, MessageType } from '../interfaces/idialog';\nimport { DynamicAlert } from '../dynamic-alert';\n/********************************************************************** \n Page : Notification alert service page\n Desc : contain functioanlities of notifcation alert\n**********************************************************************/\n@Injectable({\n providedIn: 'root',\n})\nexport class AlertService {\n /**\n * Desc : declaring variable for storing width size of alert modal\n */\n public widthModel = '400px';\n /**\n * Desc : declaring variable for storing height of alert modal\n */\n public heightModel = '650px';\n /**\n * Desc : constructor initialization\n * @param dialog : consumed angular material mat dialog\n * @param utility : consumed utility service\n */\n constructor(\n public dialog: MatDialog\n ) {}\n /**\n * Desc : success alert\n * @param message : display message\n */\n public success(message: string | IErrorMessage, okCallback?: () => void): void {\n const disabledClose = false;\n const widthModel = this.widthModel;\n const messageConent = typeof message == 'string' ? message : ErrorHelper.prepareErrorMessage(message);\n this.openDialog(disabledClose, widthModel, messageConent, MessageType.success, AlertType.notification, okCallback);\n }\n /**\n * Desc : error alert\n * @param message : display message\n */\n public error(message: string | IErrorMessage, okCallback?: () => void): void {\n const disabledClose = false;\n const widthModel = this.widthModel;\n const messageConent = typeof message == 'string' ? message : ErrorHelper.prepareErrorMessage(message);\n this.openDialog(disabledClose, widthModel, messageConent, MessageType.error, AlertType.notification, okCallback);\n }\n /**\n * Desc : info alert\n * @param message : display message\n */\n public info(message: string | IErrorMessage, okCallback?: () => void): void {\n const disabledClose = false;\n const widthModel = this.widthModel;\n const messageConent = typeof message == 'string' ? message : ErrorHelper.prepareErrorMessage(message);\n this.openDialog(disabledClose, widthModel, messageConent, MessageType.info, AlertType.notification, okCallback);\n }\n /**\n * Desc : warning alert\n * @param message : display message\n */\n public warning(message: string | IErrorMessage, okCallback?: () => void): void {\n const disabledClose = false;\n const widthModel = this.widthModel;\n const messageConent = typeof message == 'string' ? message : ErrorHelper.prepareErrorMessage(message);\n this.openDialog(disabledClose, widthModel, messageConent, MessageType.warning, AlertType.notification, okCallback);\n }\n /**\n * Desc : confirmation alert model\n * @param message : display message\n * @param okCallback : callback function\n */\n public confirmationModel(\n message: string | IErrorMessage,\n okCallback?: () => void,\n CancelCallback?: () => void,\n ): void {\n const disabledClose = false;\n const widthModel = this.widthModel;\n const messageConent = typeof message == 'string' ? message : ErrorHelper.prepareErrorMessage(message);\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n this.openDialog(\n disabledClose,\n widthModel,\n messageConent,\n MessageType.info,\n AlertType.confirmation,\n okCallback,\n CancelCallback,\n );\n }\n /**\n *\n * @param disabledClose : strict closing\n * @param widthModel : width size of model\n * @param messageContent : full message content to be displayed in dialog\n * @param typeOfMessage : message type\n * @param alertType : alert type\n * @param okCallback : callback function\n * @param cancelCallback : callback function\n */\n public openDialog(\n disabledClose: boolean,\n widthModel: string,\n messageContent: string,\n typeOfMessage: MessageType,\n alertType: AlertType,\n okCallback?: () => void,\n // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-explicit-any\n cancelCallback: () => any = () => {},\n ): void {\n this.dialog\n .open(DynamicAlert, {\n width: widthModel,\n data: { message: messageContent, type: typeOfMessage, alertType: alertType },\n disableClose: disabledClose,\n })\n .afterClosed()\n .subscribe((result) => {\n if (result && okCallback) {\n okCallback();\n }\n if (!result && cancelCallback) {\n cancelCallback();\n }\n });\n }\n}\n","/*\n * Public API Surface of dynamic-alert\n */\n\nexport * from './lib/dynamic-alert';\nexport * from './lib/services/alert.service'\nexport * from './lib/interfaces/idialog';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;MAoBa,YAAY,CAAA;AAOd,IAAA,SAAA;AACyB,IAAA,IAAA;AAPjC;;;;AAIE;IACH,WAAA,CACS,SAAqC,EACZ,IAAiB,EAAA;QAD1C,IAAA,CAAA,SAAS,GAAT,SAAS;QACgB,IAAA,CAAA,IAAI,GAAJ,IAAI;IACnC;AACH;;AAEG;IACH,UAAU,GAAA;AACR,QAAA,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC;IAC5B;AACA;;AAEG;IACH,SAAS,GAAA;AACP,QAAA,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,C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json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "devlab-one-dynamic-alert",
3
+ "version": "1.0.0",
4
+ "peerDependencies": {
5
+ "@angular/common": "^21.2.0",
6
+ "@angular/core": "^21.2.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0"
10
+ },
11
+ "sideEffects": false,
12
+ "module": "fesm2022/devlab-one-dynamic-alert.mjs",
13
+ "typings": "types/devlab-one-dynamic-alert.d.ts",
14
+ "exports": {
15
+ "./package.json": {
16
+ "default": "./package.json"
17
+ },
18
+ ".": {
19
+ "types": "./types/devlab-one-dynamic-alert.d.ts",
20
+ "default": "./fesm2022/devlab-one-dynamic-alert.mjs"
21
+ }
22
+ },
23
+ "type": "module"
24
+ }
@@ -0,0 +1,113 @@
1
+ import { MatDialogRef, MatDialog } from '@angular/material/dialog';
2
+ import * as i0 from '@angular/core';
3
+
4
+ interface IDialogData {
5
+ message: string;
6
+ title: string;
7
+ type: string;
8
+ alertType: AlertType;
9
+ }
10
+ declare enum MessageType {
11
+ success = "check_circle",
12
+ error = "cancel",
13
+ info = "info",
14
+ warning = "warning"
15
+ }
16
+ declare enum AlertType {
17
+ confirmation = "confirmation",
18
+ notification = "notification"
19
+ }
20
+ interface IErrorMessage {
21
+ code: string;
22
+ info?: Array<IErrorInfo>;
23
+ message: string;
24
+ }
25
+ interface IErrorInfo {
26
+ code: string;
27
+ message: string;
28
+ }
29
+
30
+ declare class DynamicAlert {
31
+ dialogRef: MatDialogRef<DynamicAlert>;
32
+ data: IDialogData;
33
+ /**
34
+ * Desc : constructor initialization
35
+ * @param dialogRef : alert component
36
+ * @param data : input to the alert component
37
+ */
38
+ constructor(dialogRef: MatDialogRef<DynamicAlert>, data: IDialogData);
39
+ /**
40
+ * Desc : executes while click on yes button
41
+ */
42
+ onYesClick(): void;
43
+ /**
44
+ * Desc : executes while click on no button
45
+ */
46
+ onNoClick(): void;
47
+ static ɵfac: i0.ɵɵFactoryDeclaration<DynamicAlert, never>;
48
+ static ɵcmp: i0.ɵɵComponentDeclaration<DynamicAlert, "lib-dynamic-alert", never, {}, {}, never, never, true, never>;
49
+ }
50
+
51
+ /**********************************************************************
52
+ Page : Notification alert service page
53
+ Desc : contain functioanlities of notifcation alert
54
+ **********************************************************************/
55
+ declare class AlertService {
56
+ dialog: MatDialog;
57
+ /**
58
+ * Desc : declaring variable for storing width size of alert modal
59
+ */
60
+ widthModel: string;
61
+ /**
62
+ * Desc : declaring variable for storing height of alert modal
63
+ */
64
+ heightModel: string;
65
+ /**
66
+ * Desc : constructor initialization
67
+ * @param dialog : consumed angular material mat dialog
68
+ * @param utility : consumed utility service
69
+ */
70
+ constructor(dialog: MatDialog);
71
+ /**
72
+ * Desc : success alert
73
+ * @param message : display message
74
+ */
75
+ success(message: string | IErrorMessage, okCallback?: () => void): void;
76
+ /**
77
+ * Desc : error alert
78
+ * @param message : display message
79
+ */
80
+ error(message: string | IErrorMessage, okCallback?: () => void): void;
81
+ /**
82
+ * Desc : info alert
83
+ * @param message : display message
84
+ */
85
+ info(message: string | IErrorMessage, okCallback?: () => void): void;
86
+ /**
87
+ * Desc : warning alert
88
+ * @param message : display message
89
+ */
90
+ warning(message: string | IErrorMessage, okCallback?: () => void): void;
91
+ /**
92
+ * Desc : confirmation alert model
93
+ * @param message : display message
94
+ * @param okCallback : callback function
95
+ */
96
+ confirmationModel(message: string | IErrorMessage, okCallback?: () => void, CancelCallback?: () => void): void;
97
+ /**
98
+ *
99
+ * @param disabledClose : strict closing
100
+ * @param widthModel : width size of model
101
+ * @param messageContent : full message content to be displayed in dialog
102
+ * @param typeOfMessage : message type
103
+ * @param alertType : alert type
104
+ * @param okCallback : callback function
105
+ * @param cancelCallback : callback function
106
+ */
107
+ openDialog(disabledClose: boolean, widthModel: string, messageContent: string, typeOfMessage: MessageType, alertType: AlertType, okCallback?: () => void, cancelCallback?: () => any): void;
108
+ static ɵfac: i0.ɵɵFactoryDeclaration<AlertService, never>;
109
+ static ɵprov: i0.ɵɵInjectableDeclaration<AlertService>;
110
+ }
111
+
112
+ export { AlertService, AlertType, DynamicAlert, MessageType };
113
+ export type { IDialogData, IErrorInfo, IErrorMessage };