ngx-iso-form 2.3.3 → 3.0.1

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.
Files changed (33) hide show
  1. package/README.md +260 -260
  2. package/fesm2022/ngx-iso-form.mjs +81 -75
  3. package/fesm2022/ngx-iso-form.mjs.map +1 -1
  4. package/lib/styles/index.scss +1 -1
  5. package/package.json +5 -6
  6. package/esm2022/lib/Models/Control.mjs +0 -2
  7. package/esm2022/lib/Models/IsoForm.mjs +0 -13
  8. package/esm2022/lib/Models/Schema.mjs +0 -2
  9. package/esm2022/lib/components/controls/iso-base-control.component.mjs +0 -25
  10. package/esm2022/lib/components/controls/iso-mat-checkbox.component.mjs +0 -17
  11. package/esm2022/lib/components/controls/iso-mat-currency.component.mjs +0 -18
  12. package/esm2022/lib/components/controls/iso-mat-date.component.mjs +0 -19
  13. package/esm2022/lib/components/controls/iso-mat-datetime.component.mjs +0 -19
  14. package/esm2022/lib/components/controls/iso-mat-input.component.mjs +0 -18
  15. package/esm2022/lib/components/controls/iso-mat-select.component.mjs +0 -19
  16. package/esm2022/lib/components/controls/iso-mat-textarea.component.mjs +0 -18
  17. package/esm2022/lib/components/index.mjs +0 -10
  18. package/esm2022/lib/components/iso-control/iso-control.component.mjs +0 -72
  19. package/esm2022/lib/ngx-iso-form.component.mjs +0 -199
  20. package/esm2022/lib/ngx-iso-form.module.mjs +0 -113
  21. package/esm2022/lib/ngx-iso-form.service.mjs +0 -267
  22. package/esm2022/lib/shared/components/dynamic/ngx-dynamic.component.mjs +0 -33
  23. package/esm2022/lib/shared/directives/component-content.directive.mjs +0 -16
  24. package/esm2022/lib/shared/models/component.model.mjs +0 -7
  25. package/esm2022/lib/shared/pipe/error.pipe.mjs +0 -33
  26. package/esm2022/lib/shared/pipe/general.pipe.mjs +0 -33
  27. package/esm2022/lib/shared/pipe/translate.pipe.mjs +0 -33
  28. package/esm2022/lib/shared/services/component.service.mjs +0 -20
  29. package/esm2022/lib/shared/services/control.service.mjs +0 -45
  30. package/esm2022/lib/shared/services/custom-date-adapter.mjs +0 -34
  31. package/esm2022/lib/shared/services/index.mjs +0 -3
  32. package/esm2022/ngx-iso-form.mjs +0 -5
  33. package/esm2022/public-api.mjs +0 -9
package/README.md CHANGED
@@ -1,260 +1,260 @@
1
- <div align="center">
2
- <a href="https://https://github.com/pixelbyaj/ngx-iso-form">
3
- <img src="https://raw.githubusercontent.com/pixelbyaj/ngx-form/main/anguar_logo.svg?sanitize=true" />
4
- </a>
5
- <br />
6
- <h1>
7
- XSD - JSON powered / Dynamic ISO 20022 forms in Angular v18
8
- </h1>
9
-
10
- ![npm](https://img.shields.io/npm/v/ngx-iso-form)
11
- ![NPM](https://img.shields.io/npm/l/ngx-iso-form)
12
- [![Downloads](https://img.shields.io/npm/dt/ngx-iso-form.svg)](https://npmjs.org/package/ngx-iso-form)
13
- </div>
14
-
15
- ---
16
-
17
- # NgxIsoForm
18
-
19
- This form is used to design Angular Reactive Form using any given JSON - XSD. The primary use of this UI library is to design ISO 20022 forms dynamically.
20
-
21
- ## Features
22
-
23
- - 🔥 Automatic forms generation
24
- - 📝 Easy to extend with custom field types
25
- - ⚡️ Supports ISO 20022 schemas:
26
- - XSD - JSON Schema using XSDService nuget
27
- - Support all validation like required, pattern, minlength, maxlength
28
- - Support translation labels, errors and date formats.
29
- - 💪 Built on top of [Angular Reactive Forms](https://angular.dev/guide/forms/reactive-forms)
30
-
31
- ## [Live Demo](https://iso20022.in/#/ngx-iso-form-demo?json=pacs.009.001.10)
32
-
33
- ## [StackBlitz Demo](https://stackblitz.com/edit/ngx-iso-form)
34
-
35
- ## **NOTE**
36
-
37
- **The library don't support direct execution of XSD and user need to convert XSD to JSON using [xsd-json-converter](https://www.npmjs.com/package/xsd-json-converter) npm package**
38
-
39
- ## How to consume
40
-
41
- ### Add angular material v18
42
-
43
- ```console
44
- ng add @angular/material
45
- ```
46
-
47
- ### Install npm package ngx-iso-form.
48
-
49
- ```console
50
- npm i ngx-iso-form
51
- ```
52
-
53
- ### Import Module & SCSS
54
-
55
- ```typescript
56
- import { NgxIsoFormModule } from 'ngx-iso-form';
57
- import { HttpClient, provideHttpClient } from '@angular/common/http';
58
-
59
- @NgModule({
60
- ...
61
- imports: [
62
- ...
63
- NgxIsoFormModule
64
- ],
65
- provider:[provideHttpClient()]
66
- TranslateModule.forRoot({
67
- defaultLanguage: 'en',
68
- loader: {
69
- provide: TranslateLoader,
70
- useFactory: HttpLoaderFactory,
71
- deps: [HttpClient]
72
- }
73
- })
74
- ...
75
- })
76
-
77
- export function HttpLoaderFactory(http: HttpClient) {
78
- return new TranslateHttpLoader(http, '/i18n/', '.json');
79
- }
80
-
81
- ```
82
-
83
- Add style file to angular.json file
84
-
85
- ```json
86
- styles:[
87
- "node_modules/ngx-iso-form/lib/styles/index.scss"
88
- ]
89
- ```
90
-
91
- ### View
92
-
93
- **New Option `excludes`**
94
-
95
- ```html
96
- <ngx-iso-form #isoForm [schema]="schema" [form]="form" [excludes]="excludes"></ngx-iso-form>
97
- ```
98
-
99
- **NOTE: `excludes` (optional) takes string[] and excludes all the mentioned Ids from the form. It will help you to minimize the form and include only the required fields for your business requirements.
100
-
101
- ### Public APIs
102
-
103
- - model: Get the form data in the json format
104
- - invalid: Get the validation status of the form. true | false
105
-
106
- ```ts
107
- @ViewChild('isoForm') isoForm: NgxIsoFormComponent;
108
-
109
- get model():string {
110
- const data = this.isoForm.model;
111
- this.formData = JSON.stringify(data)
112
- }
113
- get invalid():boolean {
114
- return this.isoForm.invalid;
115
- }
116
- ```
117
-
118
- ### Component
119
-
120
- ```typescript
121
- export class AppComponent implements OnInit {
122
- @ViewChild('isoForm') isoForm: NgxIsoFormComponent;
123
-
124
- form: IsoForm;
125
- schema: SchemaElement;
126
- // exclude the MsgId field from loading
127
- excludes:['Document_BkToCstmrStmt_GrpHdr_MsgId']
128
-
129
- this.httpClient.get(sample).subscribe((data) => {
130
- this.schema = data as SchemaElement
131
- });
132
-
133
- this.httpClient.get(sampleLoad).subscribe((model) => {
134
- this.form = new IsoForm(model)
135
- });
136
-
137
- //To get the form object
138
- get model():string {
139
- const data = this.isoForm.model;
140
- this.formData = JSON.stringify(data)
141
- }
142
-
143
- //To get the form validation status
144
- get invalid():boolean {
145
- return this.isoForm.invalid;
146
- }
147
-
148
- }
149
- ```
150
-
151
- ### Supported JSON Schema
152
-
153
- ```typescript
154
- export interface SchemaElement {
155
- id: string;
156
- name: string;
157
- dataType: string;
158
- minOccurs: string;
159
- maxOccurs: string;
160
- minLength: string;
161
- maxLength: string;
162
- pattern: string;
163
- fractionDigits: string;
164
- totalDigits: string;
165
- minInclusive: string;
166
- maxInclusive: string;
167
- values: string[];
168
- isCurrency: boolean;
169
- xpath: string;
170
- expanded: boolean;
171
- elements: SchemaElement[];
172
- }
173
- ```
174
-
175
- ### Translation Support
176
-
177
- It support name and id properties of the SchemaElement
178
- Please declare all your translation rules under 'iso' object.
179
-
180
- ```json
181
- {
182
- "iso": {
183
- "BkToCstmrStmt": {
184
- "label": "Bank To Customer Statement"
185
- },
186
- "GrpHdr": {
187
- "label": "Group Header"
188
- },
189
- "Document_BkToCstmrStmt_GrpHdr_CreDtTm": {
190
- "label": "Create Datetime",
191
- "general": {
192
- "format": "YYYY-MM-DDThh:mm:ss.sss+/-"
193
- },
194
- "error": {
195
- "required": "This field is required"
196
- }
197
- }
198
- }
199
- }
200
- ```
201
-
202
- # Convert XSD to JSON
203
-
204
- Global (For CLI)
205
-
206
- ```console
207
- npm install -g xsd-json-converter
208
- ```
209
-
210
- Local (For SCRIPT)
211
-
212
- ```console
213
- npm install xsd-json-converter
214
- ```
215
-
216
- ### CLI
217
-
218
- ```console
219
- xjc <source-path> <output-path>
220
- ```
221
-
222
- #### Example
223
-
224
- ##### Linux
225
-
226
- ```console
227
- xjc /mnt/c/source/xsd/camt.053.001.10.xsd /mnt/c/source/xsd/camt.053.json
228
- ```
229
-
230
- ##### Windows
231
-
232
- ```console
233
- xjc C:/source/xsd/camt.053.001.10.xsd C:/source/xsd/camt.053.json
234
- ```
235
-
236
- ### Script
237
-
238
- JavaScript
239
-
240
- ```js
241
- const xsd = require("xsd-json-converter").default;
242
-
243
- xsd
244
- .convert("./camt.053.001.10.xsd")
245
- .then((output) => console.log(output))
246
- .catch((error) => console.error(error));
247
- ```
248
-
249
- TypeScript
250
-
251
- ```ts
252
- import xsd from "xsd-json-converter";
253
-
254
- xsd
255
- .convert("./camt.053.001.10.xsd")
256
- .then((output) => console.log(output))
257
- .catch((error) => console.error(error));
258
- ```
259
-
260
- **NOTE**: For script please install the package locally
1
+ <div align="center">
2
+ <a href="https://https://github.com/pixelbyaj/ngx-iso-form">
3
+ <img src="https://raw.githubusercontent.com/pixelbyaj/ngx-form/main/anguar_logo.svg?sanitize=true" />
4
+ </a>
5
+ <br />
6
+ <h1>
7
+ XSD - JSON powered / Dynamic ISO 20022 forms in Angular v19
8
+ </h1>
9
+
10
+ ![npm](https://img.shields.io/npm/v/ngx-iso-form)
11
+ ![NPM](https://img.shields.io/npm/l/ngx-iso-form)
12
+ [![Downloads](https://img.shields.io/npm/dt/ngx-iso-form.svg)](https://npmjs.org/package/ngx-iso-form)
13
+ </div>
14
+
15
+ ---
16
+
17
+ # NgxIsoForm
18
+
19
+ This form is used to design Angular Reactive Form using any given JSON - XSD. The primary use of this UI library is to design ISO 20022 forms dynamically.
20
+
21
+ ## Features
22
+
23
+ - 🔥 Automatic forms generation
24
+ - 📝 Easy to extend with custom field types
25
+ - ⚡️ Supports ISO 20022 schemas:
26
+ - XSD - JSON Schema using XSDService nuget
27
+ - Support all validation like required, pattern, minlength, maxlength
28
+ - Support translation labels, errors and date formats.
29
+ - 💪 Built on top of [Angular Reactive Forms](https://angular.dev/guide/forms/reactive-forms)
30
+
31
+ ## [Live Demo](https://iso20022.in/#/ngx-iso-form-demo?json=pacs.009.001.10)
32
+
33
+ ## [StackBlitz Demo](https://stackblitz.com/edit/ngx-iso-form)
34
+
35
+ ## **NOTE**
36
+
37
+ **The library don't support direct execution of XSD and user need to convert XSD to JSON using [xsd-json-converter](https://www.npmjs.com/package/xsd-json-converter) npm package**
38
+
39
+ ## How to consume
40
+
41
+ ### Add angular material v19
42
+
43
+ ```console
44
+ ng add @angular/material
45
+ ```
46
+
47
+ ### Install npm package ngx-iso-form.
48
+
49
+ ```console
50
+ npm i ngx-iso-form
51
+ ```
52
+
53
+ ### Import Module & SCSS
54
+
55
+ ```typescript
56
+ import { NgxIsoFormModule } from 'ngx-iso-form';
57
+ import { HttpClient, provideHttpClient } from '@angular/common/http';
58
+
59
+ @NgModule({
60
+ ...
61
+ imports: [
62
+ ...
63
+ NgxIsoFormModule
64
+ ],
65
+ provider:[provideHttpClient()]
66
+ TranslateModule.forRoot({
67
+ defaultLanguage: 'en',
68
+ loader: {
69
+ provide: TranslateLoader,
70
+ useFactory: HttpLoaderFactory,
71
+ deps: [HttpClient]
72
+ }
73
+ })
74
+ ...
75
+ })
76
+
77
+ export function HttpLoaderFactory(http: HttpClient) {
78
+ return new TranslateHttpLoader(http, '/i18n/', '.json');
79
+ }
80
+
81
+ ```
82
+
83
+ Add style file to angular.json file
84
+
85
+ ```json
86
+ styles:[
87
+ "node_modules/ngx-iso-form/lib/styles/index.scss"
88
+ ]
89
+ ```
90
+
91
+ ### View
92
+
93
+ **New Option `excludes`**
94
+
95
+ ```html
96
+ <ngx-iso-form #isoForm [schema]="schema" [form]="form" [excludes]="excludes"></ngx-iso-form>
97
+ ```
98
+
99
+ **NOTE: `excludes` (optional) takes string[] and excludes all the mentioned Ids from the form. It will help you to minimize the form and include only the required fields for your business requirements.
100
+
101
+ ### Public APIs
102
+
103
+ - model: Get the form data in the json format
104
+ - invalid: Get the validation status of the form. true | false
105
+
106
+ ```ts
107
+ @ViewChild('isoForm') isoForm: NgxIsoFormComponent;
108
+
109
+ get model():string {
110
+ const data = this.isoForm.model;
111
+ this.formData = JSON.stringify(data)
112
+ }
113
+ get invalid():boolean {
114
+ return this.isoForm.invalid;
115
+ }
116
+ ```
117
+
118
+ ### Component
119
+
120
+ ```typescript
121
+ export class AppComponent implements OnInit {
122
+ @ViewChild('isoForm') isoForm: NgxIsoFormComponent;
123
+
124
+ form: IsoForm;
125
+ schema: SchemaElement;
126
+ // exclude the MsgId field from loading
127
+ excludes:['Document_BkToCstmrStmt_GrpHdr_MsgId']
128
+
129
+ this.httpClient.get(sample).subscribe((data) => {
130
+ this.schema = data as SchemaElement
131
+ });
132
+
133
+ this.httpClient.get(sampleLoad).subscribe((model) => {
134
+ this.form = new IsoForm(model)
135
+ });
136
+
137
+ //To get the form object
138
+ get model():string {
139
+ const data = this.isoForm.model;
140
+ this.formData = JSON.stringify(data)
141
+ }
142
+
143
+ //To get the form validation status
144
+ get invalid():boolean {
145
+ return this.isoForm.invalid;
146
+ }
147
+
148
+ }
149
+ ```
150
+
151
+ ### Supported JSON Schema
152
+
153
+ ```typescript
154
+ export interface SchemaElement {
155
+ id: string;
156
+ name: string;
157
+ dataType: string;
158
+ minOccurs: string;
159
+ maxOccurs: string;
160
+ minLength: string;
161
+ maxLength: string;
162
+ pattern: string;
163
+ fractionDigits: string;
164
+ totalDigits: string;
165
+ minInclusive: string;
166
+ maxInclusive: string;
167
+ values: string[];
168
+ isCurrency: boolean;
169
+ xpath: string;
170
+ expanded: boolean;
171
+ elements: SchemaElement[];
172
+ }
173
+ ```
174
+
175
+ ### Translation Support
176
+
177
+ It support name and id properties of the SchemaElement
178
+ Please declare all your translation rules under 'iso' object.
179
+
180
+ ```json
181
+ {
182
+ "iso": {
183
+ "BkToCstmrStmt": {
184
+ "label": "Bank To Customer Statement"
185
+ },
186
+ "GrpHdr": {
187
+ "label": "Group Header"
188
+ },
189
+ "Document_BkToCstmrStmt_GrpHdr_CreDtTm": {
190
+ "label": "Create Datetime",
191
+ "general": {
192
+ "format": "YYYY-MM-DDThh:mm:ss.sss+/-"
193
+ },
194
+ "error": {
195
+ "required": "This field is required"
196
+ }
197
+ }
198
+ }
199
+ }
200
+ ```
201
+
202
+ # Convert XSD to JSON
203
+
204
+ Global (For CLI)
205
+
206
+ ```console
207
+ npm install -g xsd-json-converter
208
+ ```
209
+
210
+ Local (For SCRIPT)
211
+
212
+ ```console
213
+ npm install xsd-json-converter
214
+ ```
215
+
216
+ ### CLI
217
+
218
+ ```console
219
+ xjc <source-path> <output-path>
220
+ ```
221
+
222
+ #### Example
223
+
224
+ ##### Linux
225
+
226
+ ```console
227
+ xjc /mnt/c/source/xsd/camt.053.001.10.xsd /mnt/c/source/xsd/camt.053.json
228
+ ```
229
+
230
+ ##### Windows
231
+
232
+ ```console
233
+ xjc C:/source/xsd/camt.053.001.10.xsd C:/source/xsd/camt.053.json
234
+ ```
235
+
236
+ ### Script
237
+
238
+ JavaScript
239
+
240
+ ```js
241
+ const xsd = require("xsd-json-converter").default;
242
+
243
+ xsd
244
+ .convert("./camt.053.001.10.xsd")
245
+ .then((output) => console.log(output))
246
+ .catch((error) => console.error(error));
247
+ ```
248
+
249
+ TypeScript
250
+
251
+ ```ts
252
+ import xsd from "xsd-json-converter";
253
+
254
+ xsd
255
+ .convert("./camt.053.001.10.xsd")
256
+ .then((output) => console.log(output))
257
+ .catch((error) => console.error(error));
258
+ ```
259
+
260
+ **NOTE**: For script please install the package locally