@pongrass/utils 1.0.4-v20 → 1.1.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/fesm2022/pongrass-utils.mjs +137 -20
- package/fesm2022/pongrass-utils.mjs.map +1 -1
- package/index.d.ts +67 -14
- package/package.json +1 -1
- package/README.md +0 -260
package/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { WritableSignal, ElementRef, OnInit, OnDestroy, EventEmitter, OnChanges, SimpleChanges, AfterViewInit } from '@angular/core';
|
|
3
|
-
import * as i3
|
|
3
|
+
import * as i3 from '@ag-grid-community/angular';
|
|
4
4
|
import { ICellRendererAngularComp, IFilterAngularComp } from '@ag-grid-community/angular';
|
|
5
5
|
import { ICellRendererParams, IFilterParams, IDoesFilterPassParams, ColDef, SelectionColumnDef, GridOptions, GridReadyEvent, GridApi, CellValueChangedEvent, PaginationChangedEvent, AgPublicEventType, ColumnResizedEvent, ColumnMovedEvent, SortChangedEvent, FirstDataRenderedEvent } from '@ag-grid-community/core';
|
|
6
6
|
import * as i4 from '@angular/forms';
|
|
7
7
|
import { AbstractControl, FormGroup } from '@angular/forms';
|
|
8
8
|
import { Observable, Subject } from 'rxjs';
|
|
9
|
-
import * as
|
|
9
|
+
import * as i2 from '@angular/common';
|
|
10
10
|
import * as i5 from '@coreui/angular-pro';
|
|
11
11
|
import * as i6 from '@coreui/icons-angular';
|
|
12
12
|
import * as i9 from 'ngx-bootstrap/datepicker';
|
|
@@ -142,7 +142,7 @@ declare class ColorCellRendererComponent implements ICellRendererAngularComp {
|
|
|
142
142
|
refresh(params: ICellRendererParams): boolean;
|
|
143
143
|
setColorCode(colorKey: string): void;
|
|
144
144
|
static ɵfac: i0.ɵɵFactoryDeclaration<ColorCellRendererComponent, never>;
|
|
145
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ColorCellRendererComponent, "
|
|
145
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ColorCellRendererComponent, "prg-ws-color-cell-renderer", never, {}, {}, never, never, true, never>;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
declare class CustomSelectFilterComponent implements IFilterAngularComp {
|
|
@@ -171,7 +171,7 @@ declare class CustomSelectFilterComponent implements IFilterAngularComp {
|
|
|
171
171
|
values?: string[];
|
|
172
172
|
}): void;
|
|
173
173
|
static ɵfac: i0.ɵɵFactoryDeclaration<CustomSelectFilterComponent, never>;
|
|
174
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<CustomSelectFilterComponent, "
|
|
174
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CustomSelectFilterComponent, "prg-ws-custom-set-filter", never, {}, {}, never, never, true, never>;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
declare class CheckboxCellRendererComponent implements ICellRendererAngularComp {
|
|
@@ -191,7 +191,7 @@ declare class CommentsButtonCellRendererComponent implements ICellRendererAngula
|
|
|
191
191
|
refresh(params: ICellRendererParams): boolean;
|
|
192
192
|
onCommentClick(): void;
|
|
193
193
|
static ɵfac: i0.ɵɵFactoryDeclaration<CommentsButtonCellRendererComponent, never>;
|
|
194
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<CommentsButtonCellRendererComponent, "
|
|
194
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CommentsButtonCellRendererComponent, "prg-ws-comments-button-cell-renderer", never, {}, {}, never, never, true, never>;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
declare class EditionListGroupedComponent implements OnInit, OnDestroy {
|
|
@@ -215,7 +215,7 @@ declare class EditionListGroupedComponent implements OnInit, OnDestroy {
|
|
|
215
215
|
onSelectEditionGroup(region: string, index: number): void;
|
|
216
216
|
onVisibleChange(isActive: boolean): void;
|
|
217
217
|
static ɵfac: i0.ɵɵFactoryDeclaration<EditionListGroupedComponent, never>;
|
|
218
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<EditionListGroupedComponent, "
|
|
218
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EditionListGroupedComponent, "prg-ws-edition-list-grouped", never, { "label": { "alias": "label"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "hasFormError": { "alias": "hasFormError"; "required": false; }; }, { "selectedEditionsChange": "selectedEditionsChange"; }, never, never, true, never>;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
declare class IndustryUpdateListboxCellRendererComponent implements ICellRendererAngularComp {
|
|
@@ -226,7 +226,7 @@ declare class IndustryUpdateListboxCellRendererComponent implements ICellRendere
|
|
|
226
226
|
refresh(params: ICellRendererParams): boolean;
|
|
227
227
|
onIndustryChange(event: Event): void;
|
|
228
228
|
static ɵfac: i0.ɵɵFactoryDeclaration<IndustryUpdateListboxCellRendererComponent, never>;
|
|
229
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<IndustryUpdateListboxCellRendererComponent, "
|
|
229
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<IndustryUpdateListboxCellRendererComponent, "prg-ws-industry-update-listbox-cell-renderer", never, {}, {}, never, never, true, never>;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
declare class PageStatusCellRendererComponent {
|
|
@@ -238,7 +238,7 @@ declare class PageStatusCellRendererComponent {
|
|
|
238
238
|
updatePageStatus(value: string): void;
|
|
239
239
|
getStatusColor(): string;
|
|
240
240
|
static ɵfac: i0.ɵɵFactoryDeclaration<PageStatusCellRendererComponent, never>;
|
|
241
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<PageStatusCellRendererComponent, "
|
|
241
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PageStatusCellRendererComponent, "prg-ws-page-status-cell-renderer", never, {}, {}, never, never, true, never>;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
declare class StatusSelectCellRendererComponent implements ICellRendererAngularComp {
|
|
@@ -250,7 +250,7 @@ declare class StatusSelectCellRendererComponent implements ICellRendererAngularC
|
|
|
250
250
|
updatePageStatus(value: string): void;
|
|
251
251
|
getStatusColor(): string;
|
|
252
252
|
static ɵfac: i0.ɵɵFactoryDeclaration<StatusSelectCellRendererComponent, never>;
|
|
253
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<StatusSelectCellRendererComponent, "
|
|
253
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<StatusSelectCellRendererComponent, "prg-ws-status-select-cell-renderer", never, {}, {}, never, never, true, never>;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
interface IEmmitedResponse {
|
|
@@ -549,7 +549,7 @@ declare class GenericFilterModelComponent implements OnInit {
|
|
|
549
549
|
private filterAttributesWithValues;
|
|
550
550
|
close(): void;
|
|
551
551
|
static ɵfac: i0.ɵɵFactoryDeclaration<GenericFilterModelComponent, never>;
|
|
552
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<GenericFilterModelComponent, "
|
|
552
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<GenericFilterModelComponent, "prg-ws-generic-filter-model", never, { "filterFormConfiguration": { "alias": "filterFormConfiguration"; "required": false; }; "tableName": { "alias": "tableName"; "required": false; }; }, { "sendFilteredData": "sendFilteredData"; }, never, never, true, never>;
|
|
553
553
|
}
|
|
554
554
|
|
|
555
555
|
declare class CircularFocusDirective implements AfterViewInit, OnDestroy {
|
|
@@ -614,7 +614,7 @@ declare class MultiSelectStylerDirective implements OnInit, OnDestroy {
|
|
|
614
614
|
|
|
615
615
|
declare class MultiFormModule {
|
|
616
616
|
static ɵfac: i0.ɵɵFactoryDeclaration<MultiFormModule, never>;
|
|
617
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<MultiFormModule, [typeof MultiFormComponent], [typeof CircularFocusDirective, typeof
|
|
617
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<MultiFormModule, [typeof MultiFormComponent], [typeof CircularFocusDirective, typeof i2.CommonModule, typeof i4.ReactiveFormsModule, typeof i5.MultiSelectModule, typeof i5.FormModule, typeof i6.IconModule, typeof i5.InputGroupComponent, typeof i5.DatePickerModule, typeof DecimalInputDirective, typeof ShowTooltipIfTruncatedDirective, typeof i5.ModalModule, typeof i5.TooltipModule, typeof i5.ButtonModule, typeof i9.BsDatepickerModule, typeof EditionListGroupedComponent, typeof MultiSelectStylerDirective], [typeof MultiFormComponent]>;
|
|
618
618
|
static ɵinj: i0.ɵɵInjectorDeclaration<MultiFormModule>;
|
|
619
619
|
}
|
|
620
620
|
|
|
@@ -702,7 +702,7 @@ declare class TableGridComponent implements OnInit, OnChanges, OnDestroy {
|
|
|
702
702
|
|
|
703
703
|
declare class TableGridModule {
|
|
704
704
|
static ɵfac: i0.ɵɵFactoryDeclaration<TableGridModule, never>;
|
|
705
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<TableGridModule, [typeof TableGridComponent], [typeof
|
|
705
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<TableGridModule, [typeof TableGridComponent], [typeof i2.CommonModule, typeof i3.AgGridModule, typeof i5.FormModule, typeof i4.ReactiveFormsModule, typeof i5.ButtonModule, typeof i5.OffcanvasModule, typeof i5.TooltipModule, typeof i6.IconModule], [typeof TableGridComponent]>;
|
|
706
706
|
static ɵinj: i0.ɵɵInjectorDeclaration<TableGridModule>;
|
|
707
707
|
}
|
|
708
708
|
|
|
@@ -787,5 +787,58 @@ declare function regionalDateFormat(date: Date): string;
|
|
|
787
787
|
declare function convertIsoToFormat(date: string | Date, dateFormat?: string): string;
|
|
788
788
|
declare function convertDateShort(dateString: string): string;
|
|
789
789
|
|
|
790
|
-
|
|
791
|
-
|
|
790
|
+
interface ILoginConfig {
|
|
791
|
+
/** Heading of Application (e.g., Maintainance Portal) */
|
|
792
|
+
title: string;
|
|
793
|
+
/** URL of the logo shown on login screen */
|
|
794
|
+
logoUrl: string;
|
|
795
|
+
/** Placeholder text for username/email input */
|
|
796
|
+
usernamePlaceholder: string;
|
|
797
|
+
/** Placeholder text for password input */
|
|
798
|
+
passwordPlaceholder: string;
|
|
799
|
+
/** Text displayed on the login submit button */
|
|
800
|
+
submitButtonText: string;
|
|
801
|
+
/** Background configuration */
|
|
802
|
+
backgroundDirective: {
|
|
803
|
+
/** Array of background image URLs */
|
|
804
|
+
backgroundImages: string[];
|
|
805
|
+
/** If true → pick a random image on each load */
|
|
806
|
+
random: boolean;
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
declare enum ILOGIN_ACTION {
|
|
810
|
+
SUBMIT = "submit",
|
|
811
|
+
BACK_TO_LOGIN = "backToLogin"
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
declare class LoginComponent implements OnInit {
|
|
815
|
+
readonly configService: ConfigurationServiceLib;
|
|
816
|
+
private readonly rendererService;
|
|
817
|
+
private readonly formBuilder;
|
|
818
|
+
config: i0.InputSignal<ILoginConfig>;
|
|
819
|
+
action: i0.OutputEmitterRef<{
|
|
820
|
+
type: string;
|
|
821
|
+
data?: any;
|
|
822
|
+
}>;
|
|
823
|
+
isFormSubmitted: i0.InputSignal<boolean>;
|
|
824
|
+
showInactivityLogoutMessage: i0.InputSignal<boolean>;
|
|
825
|
+
loginForm: FormGroup;
|
|
826
|
+
contactSupportValue: string;
|
|
827
|
+
forgetPasswordValue: string;
|
|
828
|
+
constructor();
|
|
829
|
+
ngOnInit(): void;
|
|
830
|
+
private initializeForm;
|
|
831
|
+
onSubmit(): void;
|
|
832
|
+
private initializeInitialValues;
|
|
833
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LoginComponent, never>;
|
|
834
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LoginComponent, "prg-ws-login", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; "isFormSubmitted": { "alias": "isFormSubmitted"; "required": false; "isSignal": true; }; "showInactivityLogoutMessage": { "alias": "showInactivityLogoutMessage"; "required": false; "isSignal": true; }; }, { "action": "action"; }, never, never, false, never>;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
declare class LoginModule {
|
|
838
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LoginModule, never>;
|
|
839
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<LoginModule, [typeof LoginComponent], [typeof i2.CommonModule, typeof BackgroundImageDirective, typeof i4.FormsModule, typeof i4.ReactiveFormsModule, typeof i5.FormModule, typeof i5.ButtonModule, typeof i5.SpinnerModule, typeof i5.FormPasswordDirective, typeof i6.IconModule, typeof i5.AlertModule], [typeof LoginComponent]>;
|
|
840
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<LoginModule>;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
export { BackgroundImageDirective, CheckboxCellRendererComponent, CircularFocusDirective, ColorCellRendererComponent, CommentsButtonCellRendererComponent, ConfigurationServiceLib, CustomSelectFilterComponent, DecimalInputDirective, EditionListGroupedComponent, ExcelType, ExportToExcelNames, FormFieldType, GenericFilterModelComponent, ILOGIN_ACTION, ITableGridConfiguration, ITableGridPagination, IndustryUpdateListboxCellRendererComponent, LoginComponent, LoginModule, MultiFormComponent, MultiFormModule, MultiSelectStylerDirective, PageStatusCellRendererComponent, ShowTooltipIfTruncatedDirective, StatusSelectCellRendererComponent, TableGridComponent, TableGridModule, UtilsService, convertDateShort, convertIsoToFormat, convertToISOnString, regionalDateFormat };
|
|
844
|
+
export type { IAgPublicEventType, ICellValueChangedEvent, IColDef, IColumnStateEvent, IEmmitedResponse, IExcelHeaders, IExportCellConfig, IFieldConfig, IFilterChangeEvent, IFormConfig, IFormStyles, IFormSubmissionEmit, IFormValidations, IGridApi, IGridReadyEvent, ILoginConfig, IPaginationChangedEvent, IPrintHeaders, IRowSelectionOptions, ITableGridState, MaintAction, PongrassICellRendererAngularComp, PongrassICellRendererParams };
|
package/package.json
CHANGED
package/README.md
DELETED
|
@@ -1,260 +0,0 @@
|
|
|
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
|
-
- **BackgroundImageDirective** - Adds background images to elements with optional random selection
|
|
85
|
-
|
|
86
|
-
### BackgroundImageDirective
|
|
87
|
-
|
|
88
|
-
Adds background images to elements with support for random image selection from a list.
|
|
89
|
-
|
|
90
|
-
#### Inputs
|
|
91
|
-
|
|
92
|
-
- `backgroundImage` (string | string[]) - Path to a single background image or array of image paths
|
|
93
|
-
- `random` (boolean) - Flag to enable random image selection from array (defaults to false)
|
|
94
|
-
|
|
95
|
-
#### Usage
|
|
96
|
-
|
|
97
|
-
```html
|
|
98
|
-
<!-- Single background image -->
|
|
99
|
-
<div appBackgroundImage [backgroundImage]="'assets/background1.jpg'"></div>
|
|
100
|
-
|
|
101
|
-
<!-- Random background image from a list -->
|
|
102
|
-
<div appBackgroundImage
|
|
103
|
-
[random]="true"
|
|
104
|
-
[backgroundImage]="['assets/background1.jpg', 'assets/background2.jpg', 'assets/background3.jpg']">
|
|
105
|
-
</div>
|
|
106
|
-
|
|
107
|
-
<!-- First image from a list (random=false) -->
|
|
108
|
-
<div appBackgroundImage
|
|
109
|
-
[backgroundImage]="['assets/background1.jpg', 'assets/background2.jpg', 'assets/background3.jpg']">
|
|
110
|
-
</div>
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
Place your background images in your application's assets folder and reference them using the directive.
|
|
114
|
-
|
|
115
|
-
## Available Services
|
|
116
|
-
|
|
117
|
-
- **ConfigurationService** - Manages application configuration and preferences
|
|
118
|
-
- **JsonrpcService** - Handles JSON-RPC communication with backend services
|
|
119
|
-
- **UtilsService** - Provides various utility functions
|
|
120
|
-
|
|
121
|
-
## Styles
|
|
122
|
-
|
|
123
|
-
This library relies on AG Grid and other third-party component styles that need to be included in your application's global styles.
|
|
124
|
-
|
|
125
|
-
### Global Styles via angular.json
|
|
126
|
-
|
|
127
|
-
To use the library styles globally, add the following to your `angular.json` file:
|
|
128
|
-
|
|
129
|
-
```json
|
|
130
|
-
{
|
|
131
|
-
"projects": {
|
|
132
|
-
"your-app-name": {
|
|
133
|
-
"architect": {
|
|
134
|
-
"build": {
|
|
135
|
-
"options": {
|
|
136
|
-
"styles": [
|
|
137
|
-
"src/scss/styles.scss",
|
|
138
|
-
"node_modules/@ag-grid-community/styles/ag-grid.css",
|
|
139
|
-
"node_modules/@ag-grid-community/styles/ag-theme-quartz.min.css",
|
|
140
|
-
"node_modules/ngx-bootstrap/datepicker/bs-datepicker.css"
|
|
141
|
-
]
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Component-Level Styles
|
|
151
|
-
|
|
152
|
-
When using components from this library, ensure that the required styles are available in your application:
|
|
153
|
-
|
|
154
|
-
- AG-Grid community styles
|
|
155
|
-
- Bootstrap datepicker styles from ngx-bootstrap
|
|
156
|
-
|
|
157
|
-
## Multi-Form Module
|
|
158
|
-
|
|
159
|
-
The Multi-Form module is a flexible form builder that allows you to create dynamic forms with various field types and validation rules.
|
|
160
|
-
|
|
161
|
-
### Features
|
|
162
|
-
|
|
163
|
-
- Support for multiple field types (text, email, number, select, textarea, date, checkbox, etc.)
|
|
164
|
-
- Configurable validation rules
|
|
165
|
-
- Dynamic form generation based on configuration objects
|
|
166
|
-
- Unsaved changes detection and handling
|
|
167
|
-
- Custom styling options
|
|
168
|
-
|
|
169
|
-
### Usage
|
|
170
|
-
|
|
171
|
-
1. Import the `MultiFormModule` in your application module:
|
|
172
|
-
|
|
173
|
-
```typescript
|
|
174
|
-
import { MultiFormModule } from '@pongrass/utils';
|
|
175
|
-
|
|
176
|
-
@NgModule({
|
|
177
|
-
imports: [MultiFormModule]
|
|
178
|
-
})
|
|
179
|
-
export class YourModule {}
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
2. Use the component in your template:
|
|
183
|
-
|
|
184
|
-
```html
|
|
185
|
-
<app-multi-form [config]="formConfig" [showUnsavedFlags]="true" (fieldAction)="handleFieldAction($event)" (formSavedUnsavedListen)="handleFormSave($event)">
|
|
186
|
-
</app-multi-form>
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
3. Define your form configuration:
|
|
190
|
-
|
|
191
|
-
```typescript
|
|
192
|
-
import { IFormConfig, FormFieldType } from '@pongrass/utils';
|
|
193
|
-
|
|
194
|
-
const formConfig: IFormConfig = {
|
|
195
|
-
formName: 'Sample Form',
|
|
196
|
-
rows: [
|
|
197
|
-
[
|
|
198
|
-
{
|
|
199
|
-
label: 'Name',
|
|
200
|
-
type: FormFieldType.Text,
|
|
201
|
-
controlName: 'name',
|
|
202
|
-
validations: { required: true },
|
|
203
|
-
placeholder: 'Enter your name'
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
label: 'Email',
|
|
207
|
-
type: FormFieldType.Email,
|
|
208
|
-
controlName: 'email',
|
|
209
|
-
validations: { required: true, pattern: '^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$' },
|
|
210
|
-
placeholder: 'Enter your email'
|
|
211
|
-
}
|
|
212
|
-
]
|
|
213
|
-
]
|
|
214
|
-
};
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
## Local Development and Linking
|
|
218
|
-
|
|
219
|
-
To use this library in another project during development:
|
|
220
|
-
|
|
221
|
-
1. In the utils library directory, start the watch mode:
|
|
222
|
-
|
|
223
|
-
```bash
|
|
224
|
-
npm run watch
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
2. Create a symlink to the library:
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
npm link
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
3. In your target project directory, link to the library:
|
|
234
|
-
|
|
235
|
-
```bash
|
|
236
|
-
npm link @pongrass/utils
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
4. Your target project will now use the local version of the library, and changes will be reflected immediately.
|
|
240
|
-
|
|
241
|
-
To unlink:
|
|
242
|
-
|
|
243
|
-
1. In your target project directory:
|
|
244
|
-
|
|
245
|
-
```bash
|
|
246
|
-
npm unlink @pongrass/utils
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
2. In the utils library directory:
|
|
250
|
-
```bash
|
|
251
|
-
npm unlink
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
## Running unit tests
|
|
255
|
-
|
|
256
|
-
Run `ng test utils` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
257
|
-
|
|
258
|
-
## Further help
|
|
259
|
-
|
|
260
|
-
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.
|