@pongrass/utils 0.0.3-v20 → 1.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 +230 -122
- package/fesm2022/pongrass-utils.mjs +125 -163
- package/fesm2022/pongrass-utils.mjs.map +1 -1
- package/index.d.ts +91 -90
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,122 +1,230 @@
|
|
|
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
|
-
##
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
###
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
import {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
+
## Available Modules
|
|
20
|
+
|
|
21
|
+
This library provides several Angular modules that can be imported separately based on your needs:
|
|
22
|
+
|
|
23
|
+
### TableGridModule
|
|
24
|
+
|
|
25
|
+
A comprehensive AG Grid wrapper module that provides advanced table functionality with built-in column management, filtering, and state persistence.
|
|
26
|
+
|
|
27
|
+
- Includes column visibility toggling
|
|
28
|
+
- Pagination support
|
|
29
|
+
- Column resizing and reordering
|
|
30
|
+
- State persistence
|
|
31
|
+
- Custom cell renderers
|
|
32
|
+
- Filter management
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import { TableGridModule } from '@pongrass/utils';
|
|
36
|
+
|
|
37
|
+
@NgModule({
|
|
38
|
+
imports: [TableGridModule]
|
|
39
|
+
})
|
|
40
|
+
export class YourModule { }
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### MultiFormModule
|
|
44
|
+
|
|
45
|
+
A flexible form builder that allows you to create dynamic forms with various field types and validation rules.
|
|
46
|
+
|
|
47
|
+
- Support for multiple field types (text, email, number, select, textarea, date, checkbox, etc.)
|
|
48
|
+
- Configurable validation rules
|
|
49
|
+
- Dynamic form generation based on configuration objects
|
|
50
|
+
- Unsaved changes detection and handling
|
|
51
|
+
- Custom styling options
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { MultiFormModule } from '@pongrass/utils';
|
|
55
|
+
|
|
56
|
+
@NgModule({
|
|
57
|
+
imports: [MultiFormModule]
|
|
58
|
+
})
|
|
59
|
+
export class YourModule { }
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Available Components
|
|
63
|
+
|
|
64
|
+
### Cell Renderers
|
|
65
|
+
|
|
66
|
+
- **ColorCellRendererComponent** - Renders color values with visual color indicators
|
|
67
|
+
- **CheckboxCellRendererComponent** - Renders boolean values as checkboxes
|
|
68
|
+
- **CommentsButtonCellRendererComponent** - Renders a button for managing comments
|
|
69
|
+
- **IndustryUpdateListboxCellRendererComponent** - Renders industry updates in a listbox format
|
|
70
|
+
- **PageStatusCellRendererComponent** - Renders page status with appropriate styling
|
|
71
|
+
- **StatusSelectCellRendererComponent** - Renders status values with a select dropdown
|
|
72
|
+
|
|
73
|
+
### Other Components
|
|
74
|
+
|
|
75
|
+
- **EditionListGroupedComponent** - Displays editions in a grouped list format
|
|
76
|
+
- **GenericFilterModelComponent** - Provides a generic filter interface
|
|
77
|
+
|
|
78
|
+
## Available Directives
|
|
79
|
+
|
|
80
|
+
- **CircularFocusDirective** - Enables circular focus navigation in form elements
|
|
81
|
+
- **DecimalInputDirective** - Restricts input to decimal values
|
|
82
|
+
- **MultiSelectStylerDirective** - Applies custom styling to multi-select components
|
|
83
|
+
- **ShowTooltipIfTruncatedDirective** - Shows a tooltip when text is truncated
|
|
84
|
+
|
|
85
|
+
## Available Services
|
|
86
|
+
|
|
87
|
+
- **ConfigurationService** - Manages application configuration and preferences
|
|
88
|
+
- **JsonrpcService** - Handles JSON-RPC communication with backend services
|
|
89
|
+
- **UtilsService** - Provides various utility functions
|
|
90
|
+
|
|
91
|
+
## Styles
|
|
92
|
+
|
|
93
|
+
This library relies on AG Grid and other third-party component styles that need to be included in your application's global styles.
|
|
94
|
+
|
|
95
|
+
### Global Styles via angular.json
|
|
96
|
+
|
|
97
|
+
To use the library styles globally, add the following to your `angular.json` file:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"projects": {
|
|
102
|
+
"your-app-name": {
|
|
103
|
+
"architect": {
|
|
104
|
+
"build": {
|
|
105
|
+
"options": {
|
|
106
|
+
"styles": [
|
|
107
|
+
"src/scss/styles.scss",
|
|
108
|
+
"node_modules/@ag-grid-community/styles/ag-grid.css",
|
|
109
|
+
"node_modules/@ag-grid-community/styles/ag-theme-quartz.min.css",
|
|
110
|
+
"node_modules/ngx-bootstrap/datepicker/bs-datepicker.css"
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Component-Level Styles
|
|
121
|
+
|
|
122
|
+
When using components from this library, ensure that the required styles are available in your application:
|
|
123
|
+
|
|
124
|
+
- AG-Grid community styles
|
|
125
|
+
- Bootstrap datepicker styles from ngx-bootstrap
|
|
126
|
+
|
|
127
|
+
## Multi-Form Module
|
|
128
|
+
|
|
129
|
+
The Multi-Form module is a flexible form builder that allows you to create dynamic forms with various field types and validation rules.
|
|
130
|
+
|
|
131
|
+
### Features
|
|
132
|
+
|
|
133
|
+
- Support for multiple field types (text, email, number, select, textarea, date, checkbox, etc.)
|
|
134
|
+
- Configurable validation rules
|
|
135
|
+
- Dynamic form generation based on configuration objects
|
|
136
|
+
- Unsaved changes detection and handling
|
|
137
|
+
- Custom styling options
|
|
138
|
+
|
|
139
|
+
### Usage
|
|
140
|
+
|
|
141
|
+
1. Import the `MultiFormModule` in your application module:
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
import { MultiFormModule } from '@pongrass/utils';
|
|
145
|
+
|
|
146
|
+
@NgModule({
|
|
147
|
+
imports: [MultiFormModule]
|
|
148
|
+
})
|
|
149
|
+
export class YourModule {}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
2. Use the component in your template:
|
|
153
|
+
|
|
154
|
+
```html
|
|
155
|
+
<app-multi-form [config]="formConfig" [showUnsavedFlags]="true" (fieldAction)="handleFieldAction($event)" (formSavedUnsavedListen)="handleFormSave($event)">
|
|
156
|
+
</app-multi-form>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
3. Define your form configuration:
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
import { IFormConfig, FormFieldType } from '@pongrass/utils';
|
|
163
|
+
|
|
164
|
+
const formConfig: IFormConfig = {
|
|
165
|
+
formName: 'Sample Form',
|
|
166
|
+
rows: [
|
|
167
|
+
[
|
|
168
|
+
{
|
|
169
|
+
label: 'Name',
|
|
170
|
+
type: FormFieldType.Text,
|
|
171
|
+
controlName: 'name',
|
|
172
|
+
validations: { required: true },
|
|
173
|
+
placeholder: 'Enter your name'
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
label: 'Email',
|
|
177
|
+
type: FormFieldType.Email,
|
|
178
|
+
controlName: 'email',
|
|
179
|
+
validations: { required: true, pattern: '^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$' },
|
|
180
|
+
placeholder: 'Enter your email'
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
]
|
|
184
|
+
};
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Local Development and Linking
|
|
188
|
+
|
|
189
|
+
To use this library in another project during development:
|
|
190
|
+
|
|
191
|
+
1. In the utils library directory, start the watch mode:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
npm run watch
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
2. Create a symlink to the library:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
npm link
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
3. In your target project directory, link to the library:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
npm link @pongrass/utils
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
4. Your target project will now use the local version of the library, and changes will be reflected immediately.
|
|
210
|
+
|
|
211
|
+
To unlink:
|
|
212
|
+
|
|
213
|
+
1. In your target project directory:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
npm unlink @pongrass/utils
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
2. In the utils library directory:
|
|
220
|
+
```bash
|
|
221
|
+
npm unlink
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Running unit tests
|
|
225
|
+
|
|
226
|
+
Run `ng test utils` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
227
|
+
|
|
228
|
+
## Further help
|
|
229
|
+
|
|
230
|
+
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.
|