ngx-alert-modal 1.0.0 → 2.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 CHANGED
@@ -1,279 +1,279 @@
1
- # NgxAlertModal
2
-
3
- Angular modal/Alert/Popup
4
-
5
- Simple popup modal
6
- like sweetalert2
7
-
8
- ## 📦Demo
9
- Preview [Demo](https://mr-samani.github.io/pkgs/alert)
10
-
11
-
12
- ## 🗃️ Install
13
- - NPM: npm i ngx-alert-modal
14
- - YARN: yarn add ngx-alert-modal
15
-
16
- ## Standalone
17
-
18
- ## 🖥️Usage
19
-
20
- ## 💬For open popup
21
- ```
22
- import { Component, OnInit } from '@angular/core';
23
- import { NgxAlertModalService } from 'ngx-alert-modal';
24
-
25
- @Component({
26
- selector: 'app-demo',
27
- templateUrl: './demo.component.html',
28
- styleUrls: ['./demo.component.scss']
29
- })
30
- export class DemoComponent implements OnInit {
31
-
32
- constructor(
33
- private alert: NgxAlertModalService
34
- ) { }
35
-
36
- ngOnInit(): void {
37
- }
38
-
39
-
40
- openPopup() {
41
- this.alert.show({
42
- title: 'Message Title',
43
- text: 'Description',
44
- icon: 'warning',
45
- showConfirmButton: true,
46
- showCancelButton: true,
47
- }).then(r => {
48
- console.log('result=', r);
49
- });
50
- }
51
-
52
- }
53
- ```
54
-
55
- ## Setting Global Options
56
- Pass values to NgxAlertModalModule.forRoot() or provider to set global options.
57
-
58
- - Module based
59
- ```
60
- // app NgModule
61
- imports: [
62
- NgxAlertModalModule.forRoot({
63
- confirmButtonText: 'تائید',
64
- cancelButtonText: 'انصراف',
65
- ...
66
- }),
67
- ],
68
-
69
- ```
70
- - Provider
71
- ```
72
- import { NGX_ALERT_CONFIG } from 'ngx-alert-modal';
73
-
74
- // app NgModule
75
- providers:[
76
- {
77
- provide: NGX_ALERT_CONFIG, useValue: {
78
- confirmButtonText: 'تائید',
79
- cancelButtonText: 'انصراف',
80
- ...
81
- }
82
- }
83
- ]
84
- ```
85
-
86
-
87
-
88
-
89
- ## ⚙️Options
90
-
91
- ```
92
- export type AlertIcon = 'success' | 'error' | 'warning' | 'info' | 'question'
93
-
94
- export class AlertOptions {
95
- /**
96
- * The title of the popup
97
- *
98
- * @default ''
99
- */
100
- title?: string = '';
101
-
102
- /**
103
- * A description for the popup.
104
- *
105
- * @default ''
106
- */
107
- text?: string = '';
108
-
109
- /**
110
- * A HTML description for the popup.
111
- *
112
- * [Security] we does NOT sanitize this parameter. It is the developer's responsibility
113
- * to escape any user input when using the `html` option, so XSS attacks would be prevented.
114
- *
115
- * @default ''
116
- */
117
- html?: string | HTMLElement = '';
118
-
119
-
120
- /**
121
- * Whether or not should show a full screen click-to-dismiss backdrop.
122
- * Either a boolean value or a css background value (hex, rgb, rgba, url, etc.)
123
- *
124
- * @default true
125
- */
126
- backdrop?: boolean = true;
127
-
128
-
129
- icon?: AlertIcon;
130
-
131
- /**
132
- * Popup width, including paddings (`box-sizing: border-box`).
133
- *
134
- * @default undefined
135
- * @description ❌⚠️NOT Implemented!⚠️❌
136
- */
137
- width?: number | string
138
-
139
-
140
- /**
141
- * If set to `false`, the user can't dismiss the popup by clicking outside it.
142
- *
143
- * @default true
144
- */
145
- allowOutsideClick?: boolean = true;
146
-
147
- /**
148
- * If set to `false`, the user can't dismiss the popup by pressing the Escape key.
149
- *
150
- * @default true
151
- */
152
- allowEscapeKey?: boolean = true;
153
-
154
- /**
155
- * If set to `false`, the user can't confirm the popup by pressing the Enter or Space keys,
156
- * unless they manually focus the confirm button.
157
- *
158
- * @default true
159
- */
160
- allowEnterKey?: boolean = true;
161
-
162
-
163
- /**
164
- * If set to `false`, the "Confirm" button will not be shown.
165
- *
166
- * @default true
167
- */
168
- showConfirmButton?: boolean = true;
169
-
170
- /**
171
- * If set to `true`, the "Deny" button will be shown, which the user can click on to deny the popup.
172
- *
173
- * @default false
174
- */
175
- showDenyButton?: boolean = false;
176
-
177
- /**
178
- * If set to `true`, the "Cancel" button will be shown, which the user can click on to dismiss the popup.
179
- *
180
- * @default false
181
- */
182
- showCancelButton?: boolean = true;
183
-
184
- /**
185
- * Use this to change the text on the "Confirm" button.
186
- *
187
- * @default 'OK'
188
- */
189
- confirmButtonText?: string = 'Ok';
190
-
191
- /**
192
- * Use this to change the text on the "Confirm" button.
193
- *
194
- * @default 'No'
195
- */
196
- denyButtonText?: string = 'No';
197
-
198
- /**
199
- * Use this to change the text on the "Cancel" button.
200
- *
201
- * @default 'Cancel'
202
- */
203
- cancelButtonText?: string = 'Cancel';
204
-
205
- /**
206
- * Use this to change the background color of the "Confirm" button.
207
- *
208
- * @default undefined
209
- * @description ❌⚠️NOT Implemented!⚠️❌
210
- */
211
- confirmButtonColor?: string;
212
-
213
- /**
214
- * Use this to change the background color of the "Deny" button.
215
- *
216
- * @default undefined
217
- * @description ❌⚠️NOT Implemented!⚠️❌
218
- */
219
- denyButtonColor?: string;
220
-
221
- /**
222
- * Use this to change the background color of the "Cancel" button.
223
- *
224
- * @default undefined
225
- * @description ❌⚠️NOT Implemented!⚠️❌
226
- */
227
- cancelButtonColor?: string;
228
-
229
- /**
230
- * Use this to change the `aria-label` for the "Confirm" button.
231
- *
232
- * @default ''
233
- */
234
- confirmButtonAriaLabel?: string = '';
235
-
236
- /**
237
- * Use this to change the `aria-label` for the "Deny" button.
238
- *
239
- * @default ''
240
- */
241
- denyButtonAriaLabel?: string = '';
242
-
243
- /**
244
- * Use this to change the `aria-label` for the "Cancel" button.
245
- *
246
- * @default ''
247
- */
248
- cancelButtonAriaLabel?: string = '';
249
-
250
-
251
- /**
252
- * Set to `true` if you want to invert default buttons positions.
253
- *
254
- * @default false
255
- * @description ❌⚠️NOT Implemented!⚠️❌
256
- */
257
- reverseButtons?: boolean = false;
258
-
259
-
260
-
261
- /**
262
- * Set to `true` to show close button.
263
- *
264
- * @default false
265
- */
266
- showCloseButton?: boolean = false;
267
-
268
-
269
- containerClass?: string = '';
270
- }
271
- ```
272
-
273
-
274
- ## Author
275
- 💻Mohammadreza samani | FrontEnd Developer
276
-
277
- [❤️Buy me a coffee 😉](https://www.buymeacoffee.com/mrsamani)
278
-
279
-
1
+ # NgxAlertModal
2
+
3
+ Angular modal/Alert/Popup
4
+
5
+ Simple popup modal
6
+ like sweetalert2
7
+
8
+ ## 📦Demo
9
+ Preview [Demo](https://mr-samani.github.io/pkgs/alert)
10
+
11
+
12
+ ## 🗃️ Install
13
+ - NPM: npm i ngx-alert-modal
14
+ - YARN: yarn add ngx-alert-modal
15
+
16
+ ## Standalone
17
+
18
+ ## 🖥️Usage
19
+
20
+ ## 💬For open popup
21
+ ```
22
+ import { Component, OnInit } from '@angular/core';
23
+ import { NgxAlertModalService } from 'ngx-alert-modal';
24
+
25
+ @Component({
26
+ selector: 'app-demo',
27
+ templateUrl: './demo.component.html',
28
+ styleUrls: ['./demo.component.scss']
29
+ })
30
+ export class DemoComponent implements OnInit {
31
+
32
+ constructor(
33
+ private alert: NgxAlertModalService
34
+ ) { }
35
+
36
+ ngOnInit(): void {
37
+ }
38
+
39
+
40
+ openPopup() {
41
+ this.alert.show({
42
+ title: 'Message Title',
43
+ text: 'Description',
44
+ icon: 'warning',
45
+ showConfirmButton: true,
46
+ showCancelButton: true,
47
+ }).then(r => {
48
+ console.log('result=', r);
49
+ });
50
+ }
51
+
52
+ }
53
+ ```
54
+
55
+ ## Setting Global Options
56
+ Pass values to NgxAlertModalModule.forRoot() or provider to set global options.
57
+
58
+ - Module based
59
+ ```
60
+ // app NgModule
61
+ imports: [
62
+ NgxAlertModalModule.forRoot({
63
+ confirmButtonText: 'تائید',
64
+ cancelButtonText: 'انصراف',
65
+ ...
66
+ }),
67
+ ],
68
+
69
+ ```
70
+ - Provider
71
+ ```
72
+ import { NGX_ALERT_CONFIG } from 'ngx-alert-modal';
73
+
74
+ // app NgModule
75
+ providers:[
76
+ {
77
+ provide: NGX_ALERT_CONFIG, useValue: {
78
+ confirmButtonText: 'تائید',
79
+ cancelButtonText: 'انصراف',
80
+ ...
81
+ }
82
+ }
83
+ ]
84
+ ```
85
+
86
+
87
+
88
+
89
+ ## ⚙️Options
90
+
91
+ ```
92
+ export type AlertIcon = 'success' | 'error' | 'warning' | 'info' | 'question'
93
+
94
+ export class AlertOptions {
95
+ /**
96
+ * The title of the popup
97
+ *
98
+ * @default ''
99
+ */
100
+ title?: string = '';
101
+
102
+ /**
103
+ * A description for the popup.
104
+ *
105
+ * @default ''
106
+ */
107
+ text?: string = '';
108
+
109
+ /**
110
+ * A HTML description for the popup.
111
+ *
112
+ * [Security] we does NOT sanitize this parameter. It is the developer's responsibility
113
+ * to escape any user input when using the `html` option, so XSS attacks would be prevented.
114
+ *
115
+ * @default ''
116
+ */
117
+ html?: string | HTMLElement = '';
118
+
119
+
120
+ /**
121
+ * Whether or not should show a full screen click-to-dismiss backdrop.
122
+ * Either a boolean value or a css background value (hex, rgb, rgba, url, etc.)
123
+ *
124
+ * @default true
125
+ */
126
+ backdrop?: boolean = true;
127
+
128
+
129
+ icon?: AlertIcon;
130
+
131
+ /**
132
+ * Popup width, including paddings (`box-sizing: border-box`).
133
+ *
134
+ * @default undefined
135
+ * @description ❌⚠️NOT Implemented!⚠️❌
136
+ */
137
+ width?: number | string
138
+
139
+
140
+ /**
141
+ * If set to `false`, the user can't dismiss the popup by clicking outside it.
142
+ *
143
+ * @default true
144
+ */
145
+ allowOutsideClick?: boolean = true;
146
+
147
+ /**
148
+ * If set to `false`, the user can't dismiss the popup by pressing the Escape key.
149
+ *
150
+ * @default true
151
+ */
152
+ allowEscapeKey?: boolean = true;
153
+
154
+ /**
155
+ * If set to `false`, the user can't confirm the popup by pressing the Enter or Space keys,
156
+ * unless they manually focus the confirm button.
157
+ *
158
+ * @default true
159
+ */
160
+ allowEnterKey?: boolean = true;
161
+
162
+
163
+ /**
164
+ * If set to `false`, the "Confirm" button will not be shown.
165
+ *
166
+ * @default true
167
+ */
168
+ showConfirmButton?: boolean = true;
169
+
170
+ /**
171
+ * If set to `true`, the "Deny" button will be shown, which the user can click on to deny the popup.
172
+ *
173
+ * @default false
174
+ */
175
+ showDenyButton?: boolean = false;
176
+
177
+ /**
178
+ * If set to `true`, the "Cancel" button will be shown, which the user can click on to dismiss the popup.
179
+ *
180
+ * @default false
181
+ */
182
+ showCancelButton?: boolean = true;
183
+
184
+ /**
185
+ * Use this to change the text on the "Confirm" button.
186
+ *
187
+ * @default 'OK'
188
+ */
189
+ confirmButtonText?: string = 'Ok';
190
+
191
+ /**
192
+ * Use this to change the text on the "Confirm" button.
193
+ *
194
+ * @default 'No'
195
+ */
196
+ denyButtonText?: string = 'No';
197
+
198
+ /**
199
+ * Use this to change the text on the "Cancel" button.
200
+ *
201
+ * @default 'Cancel'
202
+ */
203
+ cancelButtonText?: string = 'Cancel';
204
+
205
+ /**
206
+ * Use this to change the background color of the "Confirm" button.
207
+ *
208
+ * @default undefined
209
+ * @description ❌⚠️NOT Implemented!⚠️❌
210
+ */
211
+ confirmButtonColor?: string;
212
+
213
+ /**
214
+ * Use this to change the background color of the "Deny" button.
215
+ *
216
+ * @default undefined
217
+ * @description ❌⚠️NOT Implemented!⚠️❌
218
+ */
219
+ denyButtonColor?: string;
220
+
221
+ /**
222
+ * Use this to change the background color of the "Cancel" button.
223
+ *
224
+ * @default undefined
225
+ * @description ❌⚠️NOT Implemented!⚠️❌
226
+ */
227
+ cancelButtonColor?: string;
228
+
229
+ /**
230
+ * Use this to change the `aria-label` for the "Confirm" button.
231
+ *
232
+ * @default ''
233
+ */
234
+ confirmButtonAriaLabel?: string = '';
235
+
236
+ /**
237
+ * Use this to change the `aria-label` for the "Deny" button.
238
+ *
239
+ * @default ''
240
+ */
241
+ denyButtonAriaLabel?: string = '';
242
+
243
+ /**
244
+ * Use this to change the `aria-label` for the "Cancel" button.
245
+ *
246
+ * @default ''
247
+ */
248
+ cancelButtonAriaLabel?: string = '';
249
+
250
+
251
+ /**
252
+ * Set to `true` if you want to invert default buttons positions.
253
+ *
254
+ * @default false
255
+ * @description ❌⚠️NOT Implemented!⚠️❌
256
+ */
257
+ reverseButtons?: boolean = false;
258
+
259
+
260
+
261
+ /**
262
+ * Set to `true` to show close button.
263
+ *
264
+ * @default false
265
+ */
266
+ showCloseButton?: boolean = false;
267
+
268
+
269
+ containerClass?: string = '';
270
+ }
271
+ ```
272
+
273
+
274
+ ## Author
275
+ 💻Mohammadreza samani | FrontEnd Developer
276
+
277
+ [❤️Buy me a coffee 😉](https://www.buymeacoffee.com/mrsamani)
278
+
279
+