@jm-7c3/common-lib 1.7.3 → 1.7.4

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
@@ -35,10 +35,177 @@ import {ButtonComponent} from '@jm-7c3/common-lib';
35
35
 
36
36
  ### Confirmation
37
37
 
38
+ Shows a confirmation dialog.
39
+
40
+ #### Import the component
41
+
42
+ import {ConfirmationDialogComponent} from '@jm-7c3/common-lib';
43
+
44
+ #### Add the component
45
+
46
+ Add the component to the root component's template.
47
+
48
+ ```
49
+ <cl-confirmation />
50
+ ```
51
+
52
+ #### Import the service
53
+
54
+ ```
55
+ import {ConfirmationService} from '@jm-7c3/common-lib';
56
+ ```
57
+
58
+ #### Inject the service
59
+
60
+ ```
61
+ private readonly confirmationService = inject(ConfirmationService);
62
+ ```
63
+
64
+ #### Methods
65
+
66
+ | Method | Description |
67
+ | - | - |
68
+ | confirm | Opens the confirmation dialog. An unique string key is required as a idenfier. |
69
+ | onAccept | Returns an observable that emits values when the Accept button (for the specified string key) is clicked. |
70
+ | onCancel | Returns an observable that emits values when the Cancel button (for the specified string key) is clicked. |
71
+
72
+ #### Example
73
+
74
+ Open the confirmation dialog.
75
+
76
+ ```
77
+ const config: ConfirmationData = {
78
+ ...
79
+ key: 'confirmation-dialog'
80
+ ...
81
+ };
82
+
83
+ this.confirmationService.confirm(config);
84
+ ```
85
+
86
+ Subscribe to react when Accept button is cliked.
87
+
88
+ ```
89
+ this.confirmationService.onAccept('confirmation-dialog').subscribe(() => {
90
+ // Custom code here.
91
+ });
92
+ ```
93
+
38
94
  ### Content Dialog
39
95
 
96
+ Shows the provided content in a dialog.
97
+
98
+ #### Import the component
99
+
100
+ import {ContentDialogComponent} from '@jm-7c3/common-lib';
101
+
102
+ #### Add the component
103
+
104
+ Add the component to the root component's template.
105
+
106
+ ```
107
+ <cl-content-dialog />
108
+ ```
109
+
110
+ #### Import the service
111
+
112
+ ```
113
+ import {ContentDialogService} from '@jm-7c3/common-lib';
114
+ ```
115
+
116
+ #### Inject the service
117
+
118
+ ```
119
+ private readonly contentDialogService = inject(ContentDialogService);
120
+ ```
121
+
122
+ #### Methods
123
+
124
+ | Method | Description |
125
+ | - | - |
126
+ | onCancel | Returns an observable that emits values when the Cancel button (for the specified string key) is clicked. |
127
+ | open | Opens the dialog. An unique string key is required as a idenfier. |
128
+
129
+ #### Example
130
+
131
+ Open the content dialog.
132
+
133
+ ```
134
+ const config: ContentDialogData = {
135
+ ...
136
+ key: 'content-dialog'
137
+ ...
138
+ };
139
+
140
+ this.contentDialogService.open(config);
141
+ ```
142
+
143
+ Subscribe to react when Cancel button is cliked.
144
+
145
+ ```
146
+ this.contentDialogService.onCancel('content-dialog').subscribe(() => {
147
+ // Custom code here.
148
+ });
149
+ ```
150
+
40
151
  ### Form Dialog
41
152
 
153
+ Shows the provided form in a dialog.
154
+
155
+ #### Import the component
156
+
157
+ import {FormDialogComponent} from '@jm-7c3/common-lib';
158
+
159
+ #### Add the component
160
+
161
+ Add the component to the root component's template.
162
+
163
+ ```
164
+ <cl-form-dialog />
165
+ ```
166
+
167
+ #### Import the service
168
+
169
+ ```
170
+ import {FormDialogService} from '@jm-7c3/common-lib';
171
+ ```
172
+
173
+ #### Inject the service
174
+
175
+ ```
176
+ private readonly formDialogService = inject(FormDialogService);
177
+ ```
178
+
179
+ #### Methods
180
+
181
+ | Method | Description |
182
+ | - | - |
183
+ | onCancel | Returns an observable that emits values when the Cancel button (for the specified string key) is clicked. |
184
+ | onSubmit | Returns an observable that emits the form's value when the Submit button (for the specified string key) is clicked. |
185
+ | open | Opens the dialog. An unique string key is required as a idenfier. |
186
+
187
+ #### Example
188
+
189
+ Open the form dialog.
190
+
191
+ ```
192
+ const config: FormDialogData = {
193
+ ...
194
+ key: 'form-dialog'
195
+ ...
196
+ };
197
+
198
+ this.formDialogService.open(config);
199
+ ```
200
+
201
+ Subscribe to react when Submit button is cliked.
202
+
203
+ ```
204
+ this.formDialogService.onSubmit('content-dialog').subscribe(formValue => {
205
+ // Custom code here.
206
+ });
207
+ ```
208
+
42
209
  ### Icon Button
43
210
 
44
211
  Button to display only the icon with configurable styles.
@@ -69,25 +236,31 @@ import {IconButtonComponent} from '@jm-7c3/common-lib';
69
236
 
70
237
  Displays a dialog with a progress bar animation.
71
238
 
72
- #### Implementation
239
+ #### Import the component
240
+
241
+ import {ProgressBarDialogComponent} from '@jm-7c3/common-lib';
242
+
243
+ #### Add the component
244
+
245
+ Add the component to the root component's template.
246
+
247
+ ```
248
+ <cl-progress-bar-dialog />
249
+ ```
250
+
251
+ #### Import the service
73
252
 
74
253
  ```
75
- import {OnInit} from '@angular/core';
76
254
  import {ProgressBarDialogService} from '@jm-7c3/common-lib';
255
+ ```
77
256
 
78
- @Component({
79
- template: '<cl-progress-bar-dialog />'
80
- })
81
- export class AppComponent implements OnInit {
82
- private readonly progressBarDialogService = inject(ProgressBarDialogService);
257
+ #### Inject the service
83
258
 
84
- ngOnInit(): void {
85
- this.progressBarDialogService.open();
86
- }
87
- }
259
+ ```
260
+ private readonly progressBarDialogService = inject(ProgressBarDialogService);
88
261
  ```
89
262
 
90
- #### Service Methods
263
+ #### Methods
91
264
 
92
265
  | Method | Description |
93
266
  | - | - |
@@ -119,6 +292,40 @@ import {ReadonlyValueComponent} from '@jm-7c3/common-lib';
119
292
 
120
293
  ### Toasts
121
294
 
295
+ Shows toast notification.
296
+
297
+ #### Import the component
298
+
299
+ import {ToastsComponent} from '@jm-7c3/common-lib';
300
+
301
+ #### Add the component
302
+
303
+ Add the component to the root component's template.
304
+
305
+ ```
306
+ <cl-toats />
307
+ ```
308
+
309
+ #### Import the service
310
+
311
+ ```
312
+ import {ToastsService} from '@jm-7c3/common-lib';
313
+ ```
314
+
315
+ #### Inject the service
316
+
317
+ ```
318
+ private readonly toastsService = inject(ToastsService);
319
+ ```
320
+
321
+ #### Methods
322
+
323
+ | Method | Description |
324
+ | - | - |
325
+ | toastError | Displays a toast notifications styled for errors. |
326
+ | toastSuccess | Displays a toast notifications styled for success. |
327
+ | toastWarning | Displays a toast notifications styled for warning. |
328
+
122
329
  ## Forms
123
330
 
124
331
  Standalone UI form input controls, based on [PrimeNG](https://primeng.org) components, to be used in Reactive Forms.
@@ -139,6 +346,85 @@ class Step1FormComponent extends BaseFormComponent {
139
346
 
140
347
  ### File Input
141
348
 
349
+ Input to select a single file.
350
+
351
+ #### Import
352
+
353
+ ```
354
+ import {FileInputComponent} from '@jm-7c3/sp-integration';
355
+ ```
356
+
357
+ #### Implementation
358
+
359
+ ```
360
+ <cl-file-input />
361
+ ```
362
+
363
+ #### Inputs
364
+
365
+ | Input | Type | Default | Required | Description |
366
+ | - | - | - | - | - |
367
+ | directory | string | '' | false | Path to the directory where the files is stored. |
368
+ | icon | string | 'pi pi-plus' | false | Prime icon being used. |
369
+ | label | boolean | 'Browse' | false | Label for the input control. |
370
+ | readonly | string | | false | Disables the input control. |
371
+
372
+ #### Outputs
373
+
374
+ | onDownload | Type | Description |
375
+ | - | - | - |
376
+ | onDownload | FileInput[] | Returns the file to be downloaded. |
377
+
142
378
  ### File Inputs
143
379
 
380
+ Inputs to select a single file.
381
+
382
+ #### Import
383
+
384
+ ```
385
+ import {FileInputsComponent} from '@jm-7c3/sp-integration';
386
+ ```
387
+
388
+ #### Implementation
389
+
390
+ ```
391
+ <cl-file-inputs />
392
+ ```
393
+
394
+ #### Inputs
395
+
396
+ | Input | Type | Default | Required | Description |
397
+ | - | - | - | - | - |
398
+ | directory | string | '' | false | Path to the directory where the files is stored. |
399
+ | icon | string | 'pi pi-plus' | false | Prime icon being used. |
400
+ | label | boolean | 'Browse' | false | Label for the input control. |
401
+ | max | number | 5 | false | Maximum number of file controls allowed. |
402
+ | readonly | string | | false | Disables the input control. |
403
+
404
+ #### Outputs
405
+
406
+ | onDownload | Type | Description |
407
+ | - | - | - |
408
+ | onDownload | FileInput[] | Returns the file to be downloaded. |
409
+
144
410
  ### Form Field
411
+
412
+ A wrapper component for form controls.
413
+
414
+ #### Import
415
+
416
+ ```
417
+ import {FormFieldComponent} from '@jm-7c3/sp-integration';
418
+ ```
419
+
420
+ #### Implementation
421
+
422
+ ```
423
+ <cl-form-field>
424
+ <ff-label>Name</ff-label>
425
+ <input formControlName="Name" pInput type="text" />
426
+ <ff-error>
427
+ This field is required
428
+ <ff-error>
429
+ </cl-form-field>
430
+ ```
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jm-7c3/common-lib",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.1.0",
6
6
  "@angular/core": "^19.1.0",
Binary file