@genesislcap/foundation-forms 14.121.0 → 14.121.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.
- package/README.md +28 -63
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://lerna.js.org/)
|
|
4
4
|
[](https://www.typescriptlang.org/)
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## [API Docs](./docs/api/index.md)
|
|
7
7
|
|
|
8
8
|
`foundation-forms` is a library for efficiently building complex forms and filters at scale.
|
|
9
9
|
|
|
@@ -30,9 +30,7 @@ To enable this module in your application, follow the steps below.
|
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
###
|
|
34
|
-
|
|
35
|
-
#### 1. Register components
|
|
33
|
+
### 1. Register components
|
|
36
34
|
|
|
37
35
|
```ts
|
|
38
36
|
import { Form } from '@genesislcap/foundation-forms';
|
|
@@ -41,16 +39,15 @@ Form
|
|
|
41
39
|
...
|
|
42
40
|
```
|
|
43
41
|
|
|
44
|
-
|
|
42
|
+
### 2. Add component to the template
|
|
45
43
|
|
|
46
44
|
```html
|
|
47
45
|
<foundation-form resourceName="EVENT_TRADE_INSERT"></foundation-form>
|
|
48
46
|
```
|
|
49
47
|
|
|
50
|
-
This should generate working form based on the `JSON schema` for that endpoint.
|
|
51
|
-
DevTools console will output autogenerated `UI schema` that you can use to configure the form
|
|
48
|
+
This should generate working form based on the `JSON schema` for that endpoint. The DevTools console will output autogenerated `UI schema` that you can use to configure the form.
|
|
52
49
|
|
|
53
|
-
|
|
50
|
+
### 3. Configure form using UI schema
|
|
54
51
|
|
|
55
52
|
```ts
|
|
56
53
|
const sampleUISchema = {
|
|
@@ -74,7 +71,7 @@ const sampleUISchema = {
|
|
|
74
71
|
<foundation-form resourceName="EVENT_TRADE_INSERT" :uischema=${() => sampleUISchema}></foundation-form>
|
|
75
72
|
```
|
|
76
73
|
|
|
77
|
-
|
|
74
|
+
### 4. Configure form using JSON schema (optional)
|
|
78
75
|
|
|
79
76
|
Instead of providing `resourceName`, you can hard-code the `JSON schema` on the client.
|
|
80
77
|
|
|
@@ -106,7 +103,7 @@ const sampleJsonSchema = {
|
|
|
106
103
|
};
|
|
107
104
|
```
|
|
108
105
|
|
|
109
|
-
```ts
|
|
106
|
+
```ts
|
|
110
107
|
const sampleUiSchema = {
|
|
111
108
|
type: 'VerticalLayout',
|
|
112
109
|
elements: [
|
|
@@ -159,7 +156,7 @@ const sampleUiSchema = {
|
|
|
159
156
|
Use this when you want to avoid fetching metadata from the server, but be aware that it could get out of sync if metadata changes on the server.
|
|
160
157
|
:::
|
|
161
158
|
|
|
162
|
-
|
|
159
|
+
### 5. Pre-fill forms with data (optional)
|
|
163
160
|
|
|
164
161
|
Use the `data` attribute, which allows you to pre-fill the form with ready-made information.
|
|
165
162
|
|
|
@@ -193,9 +190,7 @@ To enable this module in your application, follow the steps below.
|
|
|
193
190
|
}
|
|
194
191
|
```
|
|
195
192
|
|
|
196
|
-
###
|
|
197
|
-
|
|
198
|
-
#### 1. Register components
|
|
193
|
+
### 1. Register components
|
|
199
194
|
|
|
200
195
|
```ts
|
|
201
196
|
import { Filters } from '@genesislcap/foundation-forms';
|
|
@@ -204,7 +199,7 @@ Filters
|
|
|
204
199
|
...
|
|
205
200
|
```
|
|
206
201
|
|
|
207
|
-
|
|
202
|
+
### 2. Add component to the template
|
|
208
203
|
|
|
209
204
|
```html
|
|
210
205
|
<foundation-filters resourceName="ALL_TRADES"></foundation-filters>
|
|
@@ -213,7 +208,7 @@ Filters
|
|
|
213
208
|
This should generate a working form based on the `JSON schema` for that endpoint.
|
|
214
209
|
The DevTools console will output an autogenerated `UI schema` that you can use to configure the filters
|
|
215
210
|
|
|
216
|
-
|
|
211
|
+
### 3. Configure form using UI schema
|
|
217
212
|
|
|
218
213
|
```ts
|
|
219
214
|
const sampleUISchema = {
|
|
@@ -237,7 +232,7 @@ const sampleUISchema = {
|
|
|
237
232
|
<foundation-filters resourceName="ALL_TRADES" :uischema=${() => sampleUISchema}></foundation-filters>
|
|
238
233
|
```
|
|
239
234
|
|
|
240
|
-
|
|
235
|
+
### 4. Configure form using JSON schema (optional)
|
|
241
236
|
|
|
242
237
|
Instead of providing `resourceName`, you can hard-code the `JSON schema` on the client.
|
|
243
238
|
|
|
@@ -258,7 +253,7 @@ const sampleJsonSchema = {
|
|
|
258
253
|
};
|
|
259
254
|
```
|
|
260
255
|
|
|
261
|
-
```ts
|
|
256
|
+
```ts
|
|
262
257
|
const sampleUiSchema = {
|
|
263
258
|
type: 'VerticalLayout',
|
|
264
259
|
elements: [
|
|
@@ -284,11 +279,11 @@ const sampleUiSchema = {
|
|
|
284
279
|
Use this when you want to avoid fetching metadata from the server, but be aware that it could get out of sync if metadata changes on the server.
|
|
285
280
|
:::
|
|
286
281
|
|
|
287
|
-
|
|
282
|
+
### 5. An example of synchronizing values with datasource criteria
|
|
288
283
|
|
|
289
284
|
```html
|
|
290
285
|
<zero-card>
|
|
291
|
-
<foundation-filters
|
|
286
|
+
<foundation-filters
|
|
292
287
|
resourceName="ALL_USERS"
|
|
293
288
|
:value=${sync((x) => x.allUsersfilters)}>
|
|
294
289
|
</foundation-filters>
|
|
@@ -306,9 +301,7 @@ Use this when you want to avoid fetching metadata from the server, but be aware
|
|
|
306
301
|
|
|
307
302
|
### Default layout renderers and examples
|
|
308
303
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
This is the default layout that is defined if no `uiSchema` is specified. This arranges our control elements vertically.
|
|
304
|
+
This is the default layout for `VerticalLayout`, which is defined if no `uiSchema` is specified. This arranges the control elements vertically.
|
|
312
305
|
|
|
313
306
|
```ts
|
|
314
307
|
const VerticalUISchema = {
|
|
@@ -319,9 +312,7 @@ const VerticalUISchema = {
|
|
|
319
312
|
};
|
|
320
313
|
```
|
|
321
314
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
This arranges our control elements in 2 columns vertically.
|
|
315
|
+
This example arranges the control elements in two columns vertically.
|
|
325
316
|
|
|
326
317
|
```ts
|
|
327
318
|
const VerticalColumnsUISchema = {
|
|
@@ -332,8 +323,6 @@ const VerticalColumnsUISchema = {
|
|
|
332
323
|
};
|
|
333
324
|
```
|
|
334
325
|
|
|
335
|
-
#### 3. HorizontalLayout
|
|
336
|
-
|
|
337
326
|
This arranges our control elements horizontally.
|
|
338
327
|
|
|
339
328
|
```ts
|
|
@@ -345,11 +334,9 @@ const horizontalUISchema = {
|
|
|
345
334
|
};
|
|
346
335
|
```
|
|
347
336
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
Array Layout allows you to create a dynamic form with the ability to add, for example, multiple users.
|
|
337
|
+
An array Layout enables you to create a dynamic form with the ability to add, for example, multiple users.
|
|
351
338
|
|
|
352
|
-
It is more complicated when it comes to customisation because it needs proper `jsonSchema` and `uiSchema`.
|
|
339
|
+
It is more complicated when it comes to customisation, because it needs proper `jsonSchema` and `uiSchema`.
|
|
353
340
|
|
|
354
341
|
```ts
|
|
355
342
|
const arrayUISchema = {
|
|
@@ -412,9 +399,7 @@ const arrayJsonSchema = {
|
|
|
412
399
|
};
|
|
413
400
|
```
|
|
414
401
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
Categorization layout allows you to create more complex forms that can be divided into appropriate categories (for example, personal information and address), which will be in separate tabs.
|
|
402
|
+
Categorization layout enables you to create more complex forms that can be divided into appropriate categories (for example, personal information and address), which will be in separate tabs.
|
|
418
403
|
|
|
419
404
|
```ts
|
|
420
405
|
const categoryUISchema = {
|
|
@@ -468,9 +453,7 @@ const categoryUISchema = {
|
|
|
468
453
|
};
|
|
469
454
|
```
|
|
470
455
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
Group layout similarly to Categorization layout divides forms, but this time into groups. They are visible on the same tab, but they are separated from each other by their own labels.
|
|
456
|
+
Group layout is similar to Categorization layout; it divides forms into groups. These are visible on the same tab, but they are separated from each other by their own labels.
|
|
474
457
|
|
|
475
458
|
```ts
|
|
476
459
|
const groupUISchema = {
|
|
@@ -525,14 +508,12 @@ const groupUISchema = {
|
|
|
525
508
|
};
|
|
526
509
|
```
|
|
527
510
|
|
|
528
|
-
|
|
511
|
+
Stepper layout enables you to create more complex forms that can be divided into appropriate groups (for example, personal information and address), which will be in separate steps.
|
|
529
512
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
It is more complicated when it comes to customisation because it needs proper `jsonSchema` and `uiSchema` so that validation and data saving work properly.
|
|
513
|
+
It is more complicated when it comes to customisation, because it needs proper `jsonSchema` and `uiSchema` so that validation and data saving work properly.
|
|
533
514
|
|
|
534
515
|
:::info
|
|
535
|
-
Remember to add `hide-submit-button` attribute to `foundation-forms
|
|
516
|
+
Remember to add a `hide-submit-button` attribute to `foundation-forms`, because in this case, submit is built directly into stepper-layout.
|
|
536
517
|
:::
|
|
537
518
|
|
|
538
519
|
```ts
|
|
@@ -704,9 +685,7 @@ const jsonSchemaStepper = {
|
|
|
704
685
|
|
|
705
686
|
Most renderers are defined directly in the `jsonSchema` that comes from the server, but there are also those that you can add via `uiSchema`.
|
|
706
687
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
This is the default renderer, which creates a `text-field`.
|
|
688
|
+
String renderer is the default renderer, which creates a `text-field`.
|
|
710
689
|
|
|
711
690
|
```ts
|
|
712
691
|
const stringJsonSchema = {
|
|
@@ -730,8 +709,6 @@ const stringJsonSchema = {
|
|
|
730
709
|
};
|
|
731
710
|
```
|
|
732
711
|
|
|
733
|
-
#### 2. Number renderer
|
|
734
|
-
|
|
735
712
|
The number renderer creates a `number-field`.
|
|
736
713
|
|
|
737
714
|
```ts
|
|
@@ -746,8 +723,6 @@ const numberJsonSchema = {
|
|
|
746
723
|
};
|
|
747
724
|
```
|
|
748
725
|
|
|
749
|
-
#### 3. Boolean renderer
|
|
750
|
-
|
|
751
726
|
The boolean renderer creates a `checkbox-field`.
|
|
752
727
|
|
|
753
728
|
```ts
|
|
@@ -761,9 +736,7 @@ const booleanJsonSchema = {
|
|
|
761
736
|
};
|
|
762
737
|
```
|
|
763
738
|
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
The multiselect renderer creates a `multiselect` component with options from datasource.
|
|
739
|
+
The connected multiselect renderer creates a `multiselect` component with options from datasource.
|
|
767
740
|
|
|
768
741
|
```ts
|
|
769
742
|
const connectedMultiselectUISchema = {
|
|
@@ -793,9 +766,7 @@ const connectedMultiselectUISchema = {
|
|
|
793
766
|
};
|
|
794
767
|
```
|
|
795
768
|
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
This is a select renderer that creates a `select` component with options.
|
|
769
|
+
Connected Select renderer is a select renderer that creates a `select` component with options.
|
|
799
770
|
|
|
800
771
|
```ts
|
|
801
772
|
const connectedSelectUISchema = {
|
|
@@ -825,8 +796,6 @@ const connectedSelectUISchema = {
|
|
|
825
796
|
};
|
|
826
797
|
```
|
|
827
798
|
|
|
828
|
-
#### 6. Date renderer
|
|
829
|
-
|
|
830
799
|
The date renderer creates a `date-field`.
|
|
831
800
|
|
|
832
801
|
```ts
|
|
@@ -843,8 +812,6 @@ const dateJsonSchema = {
|
|
|
843
812
|
|
|
844
813
|
### Specific renderers for filters and examples
|
|
845
814
|
|
|
846
|
-
#### 1. Filter date renderer
|
|
847
|
-
|
|
848
815
|
The filter date renderer creates two `date-fields` with minimum and maximum value.
|
|
849
816
|
|
|
850
817
|
```ts
|
|
@@ -859,8 +826,6 @@ const dateJsonSchema = {
|
|
|
859
826
|
};
|
|
860
827
|
```
|
|
861
828
|
|
|
862
|
-
#### 2. Filter number renderer
|
|
863
|
-
|
|
864
829
|
The filter number renderer creates two `number-fields` with minimum and maximum value.
|
|
865
830
|
|
|
866
831
|
```ts
|
|
@@ -880,4 +845,4 @@ const numberJsonSchema = {
|
|
|
880
845
|
Note: this project provides front-end dependencies and uses licensed components listed in the next section; thus, licenses for those components are required during development. Contact [Genesis Global](https://genesis.global/contact-us/) for more details.
|
|
881
846
|
|
|
882
847
|
### Licensed components
|
|
883
|
-
Genesis low-code platform
|
|
848
|
+
Genesis low-code platform
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-forms",
|
|
3
3
|
"description": "Genesis Foundation Forms",
|
|
4
|
-
"version": "14.121.
|
|
4
|
+
"version": "14.121.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"test:debug": "genx test --debug"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@genesislcap/foundation-testing": "14.121.
|
|
44
|
-
"@genesislcap/genx": "14.121.
|
|
43
|
+
"@genesislcap/foundation-testing": "14.121.1",
|
|
44
|
+
"@genesislcap/genx": "14.121.1",
|
|
45
45
|
"@types/json-schema": "^7.0.11",
|
|
46
46
|
"rimraf": "^3.0.2"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@genesislcap/foundation-comms": "14.121.
|
|
50
|
-
"@genesislcap/foundation-criteria": "14.121.
|
|
51
|
-
"@genesislcap/foundation-logger": "14.121.
|
|
52
|
-
"@genesislcap/foundation-ui": "14.121.
|
|
53
|
-
"@genesislcap/foundation-utils": "14.121.
|
|
49
|
+
"@genesislcap/foundation-comms": "14.121.1",
|
|
50
|
+
"@genesislcap/foundation-criteria": "14.121.1",
|
|
51
|
+
"@genesislcap/foundation-logger": "14.121.1",
|
|
52
|
+
"@genesislcap/foundation-ui": "14.121.1",
|
|
53
|
+
"@genesislcap/foundation-utils": "14.121.1",
|
|
54
54
|
"@jsonforms/core": "^3.0.0",
|
|
55
55
|
"@microsoft/fast-components": "^2.21.3",
|
|
56
56
|
"@microsoft/fast-element": "^1.7.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
72
|
"customElements": "dist/custom-elements.json",
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "8e78bf8e11be74bf258060aedab854dea1c7e11b"
|
|
74
74
|
}
|