@pongrass/utils 0.0.1-v20

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,122 @@
1
+ # Utils
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.2.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project utils` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project utils`.
8
+
9
+ > Note: Don't forget to add `--project utils` or else it will be added to the default project in your `angular.json` file.
10
+
11
+ ## Build
12
+
13
+ Run `ng build utils` to build the project. The build artifacts will be stored in the `dist/` directory.
14
+
15
+ ## Publishing
16
+
17
+ After building your library with `ng build utils`, go to the dist folder `cd dist/utils` and run `npm publish`.
18
+
19
+ ## Multi-Form Module
20
+
21
+ The Multi-Form module is a flexible form builder that allows you to create dynamic forms with various field types and validation rules.
22
+
23
+ ### Features
24
+
25
+ - Support for multiple field types (text, email, number, select, textarea, date, checkbox, etc.)
26
+ - Configurable validation rules
27
+ - Dynamic form generation based on configuration objects
28
+ - Unsaved changes detection and handling
29
+ - Custom styling options
30
+
31
+ ### Usage
32
+
33
+ 1. Import the `MultiFormModule` in your application module:
34
+
35
+ ```typescript
36
+ import { MultiFormModule } from 'utils';
37
+
38
+ @NgModule({
39
+ imports: [MultiFormModule]
40
+ })
41
+ export class YourModule { }
42
+ ```
43
+
44
+ 2. Use the component in your template:
45
+
46
+ ```html
47
+ <app-multi-form
48
+ [config]="formConfig"
49
+ [showUnsavedFlags]="true"
50
+ (fieldAction)="handleFieldAction($event)"
51
+ (formSavedUnsavedListen)="handleFormSave($event)">
52
+ </app-multi-form>
53
+ ```
54
+
55
+ 3. Define your form configuration:
56
+
57
+ ```typescript
58
+ import { IFormConfig, FormFieldType } from 'utils';
59
+
60
+ const formConfig: IFormConfig = {
61
+ formName: 'Sample Form',
62
+ rows: [
63
+ [
64
+ {
65
+ label: 'Name',
66
+ type: FormFieldType.Text,
67
+ controlName: 'name',
68
+ validations: { required: true },
69
+ placeholder: 'Enter your name'
70
+ },
71
+ {
72
+ label: 'Email',
73
+ type: FormFieldType.Email,
74
+ controlName: 'email',
75
+ validations: { required: true, pattern: '^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$' },
76
+ placeholder: 'Enter your email'
77
+ }
78
+ ]
79
+ ]
80
+ };
81
+ ```
82
+
83
+ ## Local Development and Linking
84
+
85
+ To use this library in another project during development:
86
+
87
+ 1. In the utils library directory, start the watch mode:
88
+ ```bash
89
+ npm run watch
90
+ ```
91
+
92
+ 2. Create a symlink to the library:
93
+ ```bash
94
+ npm link
95
+ ```
96
+
97
+ 3. In your target project directory, link to the library:
98
+ ```bash
99
+ npm link @pongrass/utils
100
+ ```
101
+
102
+ 4. Your target project will now use the local version of the library, and changes will be reflected immediately.
103
+
104
+ To unlink:
105
+
106
+ 1. In your target project directory:
107
+ ```bash
108
+ npm unlink @pongrass/utils
109
+ ```
110
+
111
+ 2. In the utils library directory:
112
+ ```bash
113
+ npm unlink
114
+ ```
115
+
116
+ ## Running unit tests
117
+
118
+ Run `ng test utils` to execute the unit tests via [Karma](https://karma-runner.github.io).
119
+
120
+ ## Further help
121
+
122
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.