@jm-7c3/common-lib 22.0.0 → 22.2.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,12 +1,14 @@
1
1
  # Common Lib
2
2
 
3
- Constains elements based on PrimeNG library.
3
+ Constains elements based on [Angular Material](https://material.angular.dev/), [PrimeNG](https://primeng.org) and [Tailwind CSS](https://tailwindcss.com/) libraries.
4
4
 
5
5
  Now the major version matches the Angular version used in the project.
6
6
 
7
+ PrimeNG based components and functionality will be removed in future versions.
8
+
7
9
  ## Controls
8
10
 
9
- Standalone UI controls, based on [PrimeNG](https://primeng.org) components.
11
+ Standalone UI controls.
10
12
 
11
13
  ### Button
12
14
 
@@ -156,7 +158,9 @@ Shows the provided form in a dialog.
156
158
 
157
159
  #### Import the component
158
160
 
161
+ ```
159
162
  import {FormDialogComponent} from '@jm-7c3/common-lib';
163
+ ```
160
164
 
161
165
  #### Add the component
162
166
 
@@ -234,6 +238,104 @@ import {IconButtonComponent} from '@jm-7c3/common-lib';
234
238
  | severity | '', 'danger', 'help', 'info', 'secondary', 'success', 'warning' | '' | false | Style of the button |
235
239
  | type | 'button', 'submit' | 'button' | false | Type of the button |
236
240
 
241
+ ### Mat Confirmation
242
+
243
+ Shows a confirmation dialog using Angular Material components.
244
+
245
+ #### Import the service
246
+
247
+ ```
248
+ import {MatConfirmationService} from '@jm-7c3/common-lib';
249
+ ```
250
+
251
+ #### Inject the service
252
+
253
+ ```
254
+ private readonly matConfirmationService = inject(MatConfirmationService);
255
+ ```
256
+
257
+ #### Methods
258
+
259
+ | Method | Description |
260
+ | - | - |
261
+ | confirm | Opens the confirmation dialog. Returns an observable with a boolean value. |
262
+
263
+ #### Example
264
+
265
+ Open the confirmation dialog and subscribe to the result.
266
+
267
+ ```
268
+ const config: MatConfirmationData = {
269
+ message: 'Message to be displayed in the dialog.',
270
+ title: 'Dialog Title'
271
+ };
272
+
273
+ this.matConfirmationService.confirm(config).subscribe(result => {
274
+ // Custom code here.
275
+ });
276
+ ```
277
+
278
+ ### Mat Form Dialog
279
+
280
+ Shows the provided form in a dialog using Angular Material components.
281
+
282
+ #### Import the service
283
+
284
+ ```
285
+ import {MatFormDialogService} from '@jm-7c3/common-lib';
286
+ ```
287
+
288
+ #### Inject the service
289
+
290
+ ```
291
+ private readonly matFormDialogService = inject(MatFormDialogService);
292
+ ```
293
+
294
+ #### Methods
295
+
296
+ | Method | Description |
297
+ | - | - |
298
+ | open | Opens the Angular Material dialog component displaying the form. It returns an observable with the form's value.|
299
+
300
+ #### Example
301
+
302
+ Open the form dialog and subscribe to the result.
303
+
304
+ ```
305
+ const config: MatFormDialogData = {
306
+ component: FormComponent
307
+ };
308
+
309
+ this.matFormDialogService.open(config).subscribe(formValue => {
310
+ // Custom code here.
311
+ });
312
+ ```
313
+
314
+ ### Panel
315
+
316
+ Display a panel with header, content and footer sections.
317
+
318
+ #### Import the component
319
+
320
+ ```
321
+ import {PanelComponent} from '@jm-7c3/common-lib';
322
+ ```
323
+
324
+ #### Examples
325
+
326
+ Display the panel with custom content. For the title you can use the `title` input or un `ng-template` with `#titleContent`.
327
+
328
+ ```
329
+ <cl-panel title="Panel Title">
330
+ <ng-template #contentTemplate>
331
+ // Custom content here.
332
+ </ng-template>
333
+ <ng-template #footerTemplate>
334
+ // Custom footer content here.
335
+ </ng-template
336
+ </cl-panel>
337
+ ```
338
+
237
339
  ### Progress Bar Dialog
238
340
 
239
341
  Displays a dialog with a progress bar animation.
@@ -330,7 +432,7 @@ private readonly toastsService = inject(ToastsService);
330
432
 
331
433
  ## Forms
332
434
 
333
- Standalone UI form input controls, based on [PrimeNG](https://primeng.org) components, to be used in Reactive Forms.
435
+ Standalone UI form input controls.
334
436
 
335
437
  ### Base Form
336
438
 
@@ -353,7 +455,7 @@ Input to select a single file.
353
455
  #### Import
354
456
 
355
457
  ```
356
- import {FileInputComponent} from '@jm-7c3/sp-integration';
458
+ import {FileInputComponent} from '@jm-7c3/common-lib';
357
459
  ```
358
460
 
359
461
  #### Implementation
@@ -384,7 +486,7 @@ Inputs to select a single file.
384
486
  #### Import
385
487
 
386
488
  ```
387
- import {FileInputsComponent} from '@jm-7c3/sp-integration';
489
+ import {FileInputsComponent} from '@jm-7c3/common-lib';
388
490
  ```
389
491
 
390
492
  #### Implementation
@@ -416,7 +518,7 @@ A wrapper component for form controls.
416
518
  #### Import
417
519
 
418
520
  ```
419
- import {FormFieldComponent} from '@jm-7c3/sp-integration';
521
+ import {FormFieldComponent} from '@jm-7c3/common-lib';
420
522
  ```
421
523
 
422
524
  #### Implementation
@@ -430,3 +532,66 @@ import {FormFieldComponent} from '@jm-7c3/sp-integration';
430
532
  <ff-error>
431
533
  </cl-form-field>
432
534
  ```
535
+
536
+ ### Mat File Input
537
+
538
+ Input to select a single file using Angular Material components.
539
+
540
+ #### Import
541
+
542
+ ```
543
+ import {MatFileInputComponent} from '@jm-7c3/common-lib';
544
+ ```
545
+
546
+ #### Implementation
547
+
548
+ ```
549
+ <cl-mat-file-input />
550
+ ```
551
+
552
+ #### Inputs
553
+
554
+ | Input | Type | Default | Required | Description |
555
+ | - | - | - | - | - |
556
+ | directory | string | '' | false | Path to the directory where the files is stored. |
557
+ | icon | string | 'pi pi-plus' | false | Prime icon being used. |
558
+ | label | boolean | 'Browse' | false | Label for the input control. |
559
+ | readonly | string | | false | Disables the input control. |
560
+
561
+ #### Outputs
562
+
563
+ | onDownload | Type | Description |
564
+ | - | - | - |
565
+ | onDownload | FileInput[] | Returns the file to be downloaded. |
566
+
567
+ ### Mat File Inputs
568
+
569
+ Inputs to select a single file using Angular Material components.
570
+
571
+ #### Import
572
+
573
+ ```
574
+ import {MatFileInputsComponent} from '@jm-7c3/common-lib';
575
+ ```
576
+
577
+ #### Implementation
578
+
579
+ ```
580
+ <cl-mat-file-inputs />
581
+ ```
582
+
583
+ #### Inputs
584
+
585
+ | Input | Type | Default | Required | Description |
586
+ | - | - | - | - | - |
587
+ | directory | string | '' | false | Path to the directory where the files is stored. |
588
+ | icon | string | 'pi pi-plus' | false | Prime icon being used. |
589
+ | label | boolean | 'Browse' | false | Label for the input control. |
590
+ | max | number | 5 | false | Maximum number of file controls allowed. |
591
+ | readonly | string | | false | Disables the input control. |
592
+
593
+ #### Outputs
594
+
595
+ | onDownload | Type | Description |
596
+ | - | - | - |
597
+ | onDownload | FileInput[] | Returns the file to be downloaded. |