@genesislcap/foundation-forms 14.408.0 → 14.409.0-FUI-2495.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 +6 -818
- package/dist/custom-elements.json +226 -226
- package/package.json +15 -15
- package/docs/api/foundation-forms.arrayrendereroptions.md +0 -23
- package/docs/api/foundation-forms.bulkrowstatus.md +0 -22
- package/docs/api/foundation-forms.bulkrowsubmitstatus.md +0 -13
- package/docs/api/foundation-forms.bulksubmitfaileditem.md +0 -20
- package/docs/api/foundation-forms.bulksubmitresult.md +0 -18
- package/docs/api/foundation-forms.bulksubmitsuccessitem.md +0 -17
- package/docs/api/foundation-forms.categorizationrendereroptions.md +0 -17
- package/docs/api/foundation-forms.childuischemaresolver.md +0 -15
- package/docs/api/foundation-forms.connectedrenderersoptions.md +0 -23
- package/docs/api/foundation-forms.csvmappingresult.mappedrows.md +0 -13
- package/docs/api/foundation-forms.csvmappingresult.md +0 -77
- package/docs/api/foundation-forms.csvmappingresult.unmappedcolumns.md +0 -13
- package/docs/api/foundation-forms.csvparseresult.errors.md +0 -13
- package/docs/api/foundation-forms.csvparseresult.headers.md +0 -13
- package/docs/api/foundation-forms.csvparseresult.md +0 -96
- package/docs/api/foundation-forms.csvparseresult.rows.md +0 -13
- package/docs/api/foundation-forms.downloadcsvtemplate.md +0 -74
- package/docs/api/foundation-forms.filters.allsavedfilters.md +0 -11
- package/docs/api/foundation-forms.filters.connectedcallback.md +0 -15
- package/docs/api/foundation-forms.filters.data.md +0 -13
- package/docs/api/foundation-forms.filters.deletefilter.md +0 -15
- package/docs/api/foundation-forms.filters.filtername.md +0 -11
- package/docs/api/foundation-forms.filters.filternamechanged.md +0 -64
- package/docs/api/foundation-forms.filters.jsonschema.md +0 -18
- package/docs/api/foundation-forms.filters.kvstorage.md +0 -11
- package/docs/api/foundation-forms.filters.loadallsavedfilters.md +0 -15
- package/docs/api/foundation-forms.filters.loadfilterdata.md +0 -50
- package/docs/api/foundation-forms.filters.md +0 -335
- package/docs/api/foundation-forms.filters.prefix.md +0 -13
- package/docs/api/foundation-forms.filters.renderers.md +0 -13
- package/docs/api/foundation-forms.filters.resourcename.md +0 -13
- package/docs/api/foundation-forms.filters.savefilter.md +0 -15
- package/docs/api/foundation-forms.filters.showfilterpersistencecontrols.md +0 -13
- package/docs/api/foundation-forms.filters.uischema.md +0 -50
- package/docs/api/foundation-forms.filters.value.md +0 -13
- package/docs/api/foundation-forms.filtersrenderers.md +0 -13
- package/docs/api/foundation-forms.form.additionalrenderers.md +0 -13
- package/docs/api/foundation-forms.form.approvalmessagelabel.md +0 -13
- package/docs/api/foundation-forms.form.bulkinsert.md +0 -13
- package/docs/api/foundation-forms.form.bulkinsertmaxitems.md +0 -13
- package/docs/api/foundation-forms.form.bulkinsertminitems.md +0 -13
- package/docs/api/foundation-forms.form.clearrowsubmitstatuses.md +0 -17
- package/docs/api/foundation-forms.form.confirmationmessage.md +0 -13
- package/docs/api/foundation-forms.form.data.md +0 -13
- package/docs/api/foundation-forms.form.downloadcsvtemplate.md +0 -17
- package/docs/api/foundation-forms.form.handlecsvfileselected.md +0 -54
- package/docs/api/foundation-forms.form.hidesubmit.md +0 -13
- package/docs/api/foundation-forms.form.jsonschema.md +0 -18
- package/docs/api/foundation-forms.form.md +0 -434
- package/docs/api/foundation-forms.form.prefix.md +0 -13
- package/docs/api/foundation-forms.form.readonly.md +0 -13
- package/docs/api/foundation-forms.form.renderers.md +0 -13
- package/docs/api/foundation-forms.form.reset.md +0 -54
- package/docs/api/foundation-forms.form.resourcename.md +0 -13
- package/docs/api/foundation-forms.form.rowsubmitstatuses.md +0 -13
- package/docs/api/foundation-forms.form.setapprovalmessage.md +0 -13
- package/docs/api/foundation-forms.form.submitsinglerow.md +0 -56
- package/docs/api/foundation-forms.form.uischema.md +0 -50
- package/docs/api/foundation-forms.generatecsvtemplate.md +0 -104
- package/docs/api/foundation-forms.getanyoferrormessage.md +0 -96
- package/docs/api/foundation-forms.grouprendereroptions.md +0 -15
- package/docs/api/foundation-forms.labelplacementoptions.md +0 -17
- package/docs/api/foundation-forms.labelplacementtype.md +0 -13
- package/docs/api/foundation-forms.mapcsvtoschema.md +0 -88
- package/docs/api/foundation-forms.md +0 -516
- package/docs/api/foundation-forms.multicolumndropdowncontrolrendererentry.md +0 -15
- package/docs/api/foundation-forms.multicolumndropdowncontrolrenderertemplate.md +0 -82
- package/docs/api/foundation-forms.multicolumndropdownrendereroptions.md +0 -25
- package/docs/api/foundation-forms.mustmatch.md +0 -62
- package/docs/api/foundation-forms.numberrendereroptions.md +0 -17
- package/docs/api/foundation-forms.parsecsv.md +0 -56
- package/docs/api/foundation-forms.rendererentry.md +0 -30
- package/docs/api/foundation-forms.renderers.md +0 -13
- package/docs/api/foundation-forms.standardrendereroptions.md +0 -22
- package/docs/api/foundation-forms.stepperorientationoptions.md +0 -17
- package/docs/api/foundation-forms.stepperorientationtype.md +0 -13
- package/docs/api/foundation-forms.stepperrendereroptions.md +0 -15
- package/docs/api/foundation-forms.stringrendereroptions.md +0 -17
- package/docs/api/foundation-forms.uischema.md +0 -19
- package/docs/api/foundation-forms.uischemaelement.md +0 -22
- package/docs/api/foundation-forms.uischemaelementoptions.md +0 -15
- package/docs/api/foundation-forms.uischemaelementtype.md +0 -13
- package/docs/api/foundation-forms.uischemaoptions.md +0 -15
- package/docs/api/index.md +0 -30
- package/docs/api-report.md.api.md +0 -440
package/README.md
CHANGED
|
@@ -1,837 +1,25 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @genesislcap/foundation-forms
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://www.typescriptlang.org/)
|
|
3
|
+
Documentation for this package is published on the Genesis docs site:
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
`foundation-forms` is a library for efficiently building complex forms and filters at scale.
|
|
9
|
-
|
|
10
|
-
Foundation forms is defined by using two schemata:
|
|
11
|
-
|
|
12
|
-
- `resourceName`/`jsonSchema` defines the underlying data to be shown in the UI (objects, properties, and their types).
|
|
13
|
-
- `uiSchema` defines how this data is rendered as a form, e.g. the order of controls, their visibility, and the layout.
|
|
14
|
-
|
|
15
|
-
## Forms
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
### 1. Register components
|
|
19
|
-
|
|
20
|
-
```ts
|
|
21
|
-
import { Form } from '@genesislcap/foundation-forms';
|
|
22
|
-
...
|
|
23
|
-
Form
|
|
24
|
-
...
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### 2. Add component to the template
|
|
28
|
-
|
|
29
|
-
```html
|
|
30
|
-
<foundation-form resourceName="EVENT_TRADE_INSERT"></foundation-form>
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
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.
|
|
34
|
-
|
|
35
|
-
### 3. Configure form using UI schema
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
const sampleUISchema = {
|
|
39
|
-
type: "VerticalLayout",
|
|
40
|
-
elements: [
|
|
41
|
-
{
|
|
42
|
-
type: "Control",
|
|
43
|
-
scope: "#/properties/QUANTITY",
|
|
44
|
-
label: "Quantity",
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
type: "Control",
|
|
48
|
-
scope: "#/properties/SIDE",
|
|
49
|
-
label: "Side",
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
};
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
```html
|
|
56
|
-
<foundation-form resourceName="EVENT_TRADE_INSERT" :uischema=${() => sampleUISchema}></foundation-form>
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### 4. Configure form using JSON schema (optional)
|
|
60
|
-
|
|
61
|
-
Instead of providing `resourceName`, you can hard-code the `JSON schema` on the client.
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
const sampleJsonSchema = {
|
|
65
|
-
type: 'object',
|
|
66
|
-
properties: {
|
|
67
|
-
ISSUER_NAME: {
|
|
68
|
-
type: 'string',
|
|
69
|
-
minLength: 3,
|
|
70
|
-
description: 'kotlin.String',
|
|
71
|
-
},
|
|
72
|
-
PRICE: {
|
|
73
|
-
type: 'number',
|
|
74
|
-
description: 'kotlin.Double',
|
|
75
|
-
},
|
|
76
|
-
MAIN_CONTACT: {
|
|
77
|
-
type: 'string',
|
|
78
|
-
pattern: '^[\\+]?[(]?[0-9]{3}[)]?[-\\s\\.]?[0-9]{3}[-\\s\\.]?[0-9]{4,6}$',
|
|
79
|
-
description: 'kotlin.String',
|
|
80
|
-
},
|
|
81
|
-
PASSWORD: {
|
|
82
|
-
type: 'string',
|
|
83
|
-
description: 'kotlin.String',
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
additionalProperties: false,
|
|
87
|
-
required: ['ISSUER_NAME', 'MAIN_CONTACT'],
|
|
88
|
-
};
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
```ts
|
|
92
|
-
const sampleUiSchema = {
|
|
93
|
-
type: 'VerticalLayout',
|
|
94
|
-
elements: [
|
|
95
|
-
{
|
|
96
|
-
type: 'Control',
|
|
97
|
-
label: 'Issuer Name',
|
|
98
|
-
scope: '#/properties/ISSUER_NAME',
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
type: 'Control',
|
|
102
|
-
label: 'Phone',
|
|
103
|
-
scope: '#/properties/MAIN_CONTACT',
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
type: 'Control',
|
|
107
|
-
label: 'Price',
|
|
108
|
-
scope: '#/properties/PRICE',
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
type: 'Control',
|
|
112
|
-
scope: '#/properties/COUNTERPARTY',
|
|
113
|
-
options: {
|
|
114
|
-
allOptionsResourceName: 'COUNTERPARTY',
|
|
115
|
-
valueField: 'COUNTERPARTY_ID',
|
|
116
|
-
labelField: 'COUNTERPARTY_ID',
|
|
117
|
-
datasourceConfig: {
|
|
118
|
-
request: {
|
|
119
|
-
COUNTERPARTY_ID: 'ACME',
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
type: 'Control',
|
|
126
|
-
label: 'Password',
|
|
127
|
-
scope: '#/properties/PASSWORD',
|
|
128
|
-
options: {
|
|
129
|
-
isPassword: true,
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
};
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
```html
|
|
137
|
-
<foundation-form :jsonSchema=${() => sampleJsonSchema} :uischema=${() => sampleUISchema}></foundation-form>
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
:::info
|
|
141
|
-
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.
|
|
142
|
-
:::
|
|
143
|
-
|
|
144
|
-
### 5. Pre-fill forms with data (optional)
|
|
145
|
-
|
|
146
|
-
Use the `data` attribute, which allows you to pre-fill the form with ready-made information.
|
|
147
|
-
|
|
148
|
-
```ts
|
|
149
|
-
const sampleData = {
|
|
150
|
-
ISSUER_NAME: 'Some Issuer',
|
|
151
|
-
INVIS: 'Invisible value!',
|
|
152
|
-
USER: 'JohnDoe',
|
|
153
|
-
};
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
```html
|
|
157
|
-
<foundation-form resourceName="EVENT_TRADE_INSERT" :uischema=${() => sampleUISchema} :data=${() => sampleData}></foundation-form>
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
## Filters
|
|
161
|
-
|
|
162
|
-
### 1. Register components
|
|
163
|
-
|
|
164
|
-
```ts
|
|
165
|
-
import { Filters } from '@genesislcap/foundation-forms';
|
|
166
|
-
...
|
|
167
|
-
Filters
|
|
168
|
-
...
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### 2. Add component to the template
|
|
172
|
-
|
|
173
|
-
```html
|
|
174
|
-
<foundation-filters resourceName="ALL_TRADES"></foundation-filters>
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
This should generate a working form based on the `JSON schema` for that endpoint.
|
|
178
|
-
The DevTools console will output an autogenerated `UI schema` that you can use to configure the filters
|
|
179
|
-
|
|
180
|
-
### 3. Configure form using UI schema
|
|
181
|
-
|
|
182
|
-
```ts
|
|
183
|
-
const sampleUISchema = {
|
|
184
|
-
type: "VerticalLayout",
|
|
185
|
-
elements: [
|
|
186
|
-
{
|
|
187
|
-
type: "Control",
|
|
188
|
-
scope: "#/properties/QUANTITY",
|
|
189
|
-
label: "Quantity",
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
type: "Control",
|
|
193
|
-
scope: "#/properties/SIDE",
|
|
194
|
-
label: "Side",
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
};
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
```html
|
|
201
|
-
<foundation-filters resourceName="ALL_TRADES" :uischema=${() => sampleUISchema}></foundation-filters>
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### 4. Configure form using JSON schema (optional)
|
|
205
|
-
|
|
206
|
-
Instead of providing `resourceName`, you can hard-code the `JSON schema` on the client.
|
|
207
|
-
|
|
208
|
-
```ts
|
|
209
|
-
const sampleJsonSchema = {
|
|
210
|
-
type: 'object',
|
|
211
|
-
properties: {
|
|
212
|
-
INSTRUMENT_ID: {
|
|
213
|
-
type: 'string',
|
|
214
|
-
minLength: 3,
|
|
215
|
-
description: 'kotlin.String',
|
|
216
|
-
},
|
|
217
|
-
QUANTITY: {
|
|
218
|
-
type: 'number',
|
|
219
|
-
description: 'kotlin.Double',
|
|
220
|
-
},
|
|
221
|
-
},
|
|
222
|
-
};
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
```ts
|
|
226
|
-
const sampleUiSchema = {
|
|
227
|
-
type: 'VerticalLayout',
|
|
228
|
-
elements: [
|
|
229
|
-
{
|
|
230
|
-
type: 'Control',
|
|
231
|
-
label: 'Instrument ID',
|
|
232
|
-
scope: '#/properties/INSTRUMENT_ID',
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
type: 'Control',
|
|
236
|
-
label: 'Quantity',
|
|
237
|
-
scope: '#/properties/QUANTITY',
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
};
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
```html
|
|
244
|
-
<foundation-filters :jsonSchema=${() => sampleJsonSchema} :uischema=${() => sampleUISchema}></foundation-filters>
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
:::info
|
|
248
|
-
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.
|
|
249
|
-
:::
|
|
250
|
-
|
|
251
|
-
### 5. An example of synchronizing values with datasource criteria
|
|
252
|
-
|
|
253
|
-
```html
|
|
254
|
-
<zero-card>
|
|
255
|
-
<foundation-filters
|
|
256
|
-
resourceName="ALL_USERS"
|
|
257
|
-
:value=${sync((x) => x.allUsersfilters)}>
|
|
258
|
-
</foundation-filters>
|
|
259
|
-
</zero-card>
|
|
260
|
-
<zero-grid-pro>
|
|
261
|
-
<grid-pro-client-side-datasource
|
|
262
|
-
resource-name="ALL_USERS"
|
|
263
|
-
criteria=${(x) => x.allUsersfilters}
|
|
264
|
-
></grid-pro-client-side-datasource>
|
|
265
|
-
</zero-grid-pro>
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
## Advanced customisation
|
|
270
|
-
|
|
271
|
-
### Default layout renderers and examples
|
|
272
|
-
|
|
273
|
-
This is the default layout for `VerticalLayout`, which is defined if no `uiSchema` is specified. This arranges the control elements vertically.
|
|
274
|
-
|
|
275
|
-
```ts
|
|
276
|
-
const VerticalUISchema = {
|
|
277
|
-
type: 'VerticalLayout',
|
|
278
|
-
elements: [
|
|
279
|
-
...
|
|
280
|
-
],
|
|
281
|
-
};
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
This example arranges the control elements in two columns vertically.
|
|
285
|
-
|
|
286
|
-
```ts
|
|
287
|
-
const VerticalColumnsUISchema = {
|
|
288
|
-
type: 'LayoutVertical2Columns',
|
|
289
|
-
elements: [
|
|
290
|
-
...
|
|
291
|
-
],
|
|
292
|
-
};
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
This arranges our control elements horizontally.
|
|
296
|
-
|
|
297
|
-
```ts
|
|
298
|
-
const horizontalUISchema = {
|
|
299
|
-
type: 'HorizontalLayout',
|
|
300
|
-
elements: [
|
|
301
|
-
...
|
|
302
|
-
],
|
|
303
|
-
};
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
An array Layout enables you to create a dynamic form with the ability to add, for example, multiple users.
|
|
307
|
-
|
|
308
|
-
It is more complicated when it comes to customisation, because it needs proper `jsonSchema` and `uiSchema`.
|
|
309
|
-
|
|
310
|
-
```ts
|
|
311
|
-
const arrayUISchema = {
|
|
312
|
-
type: "VerticalLayout",
|
|
313
|
-
elements: [
|
|
314
|
-
{
|
|
315
|
-
type: "Control",
|
|
316
|
-
scope: "#/properties/users",
|
|
317
|
-
options: {
|
|
318
|
-
childUiSchema: {
|
|
319
|
-
type: "HorizontalLayout",
|
|
320
|
-
elements: [
|
|
321
|
-
{
|
|
322
|
-
type: "Control",
|
|
323
|
-
scope: "#/properties/firstname",
|
|
324
|
-
label: "First Name",
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
type: "Control",
|
|
328
|
-
scope: "#/properties/lastname",
|
|
329
|
-
label: "Last Name",
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
type: "Control",
|
|
333
|
-
scope: "#/properties/email",
|
|
334
|
-
label: "Email",
|
|
335
|
-
},
|
|
336
|
-
],
|
|
337
|
-
},
|
|
338
|
-
},
|
|
339
|
-
},
|
|
340
|
-
],
|
|
341
|
-
};
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
```ts
|
|
345
|
-
const arrayJsonSchema = {
|
|
346
|
-
type: "object",
|
|
347
|
-
properties: {
|
|
348
|
-
users: {
|
|
349
|
-
type: "array",
|
|
350
|
-
items: {
|
|
351
|
-
type: "object",
|
|
352
|
-
title: "Users",
|
|
353
|
-
properties: {
|
|
354
|
-
firstname: {
|
|
355
|
-
type: "string",
|
|
356
|
-
},
|
|
357
|
-
lastname: {
|
|
358
|
-
type: "string",
|
|
359
|
-
},
|
|
360
|
-
email: {
|
|
361
|
-
type: "string",
|
|
362
|
-
format: "email",
|
|
363
|
-
},
|
|
364
|
-
},
|
|
365
|
-
},
|
|
366
|
-
},
|
|
367
|
-
},
|
|
368
|
-
};
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
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.
|
|
372
|
-
|
|
373
|
-
```ts
|
|
374
|
-
const categoryUISchema = {
|
|
375
|
-
type: "Categorization",
|
|
376
|
-
elements: [
|
|
377
|
-
{
|
|
378
|
-
type: "Control",
|
|
379
|
-
scope: "#/properties/basic",
|
|
380
|
-
label: "Personal information",
|
|
381
|
-
options: {
|
|
382
|
-
childElements: [
|
|
383
|
-
{
|
|
384
|
-
type: "HorizontalLayout",
|
|
385
|
-
elements: [
|
|
386
|
-
{
|
|
387
|
-
type: "Control",
|
|
388
|
-
scope: "#/properties/firstName",
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
type: "Control",
|
|
392
|
-
scope: "#/properties/secondName",
|
|
393
|
-
},
|
|
394
|
-
],
|
|
395
|
-
},
|
|
396
|
-
],
|
|
397
|
-
},
|
|
398
|
-
},
|
|
399
|
-
{
|
|
400
|
-
type: "Control",
|
|
401
|
-
label: "Address",
|
|
402
|
-
scope: "#/properties/address",
|
|
403
|
-
options: {
|
|
404
|
-
childElements: [
|
|
405
|
-
{
|
|
406
|
-
type: "HorizontalLayout",
|
|
407
|
-
elements: [
|
|
408
|
-
{
|
|
409
|
-
type: "Control",
|
|
410
|
-
scope: "#/properties/address/properties/street",
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
type: "Control",
|
|
414
|
-
scope: "#/properties/address/properties/streetNumber",
|
|
415
|
-
},
|
|
416
|
-
],
|
|
417
|
-
},
|
|
418
|
-
],
|
|
419
|
-
},
|
|
420
|
-
},
|
|
421
|
-
],
|
|
422
|
-
};
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
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.
|
|
426
|
-
|
|
427
|
-
```ts
|
|
428
|
-
const groupUISchema = {
|
|
429
|
-
type: "VerticalLayout",
|
|
430
|
-
elements: [
|
|
431
|
-
{
|
|
432
|
-
type: "Group",
|
|
433
|
-
label: "Person",
|
|
434
|
-
scope: "#/properties/person",
|
|
435
|
-
options: {
|
|
436
|
-
childElements: [
|
|
437
|
-
{
|
|
438
|
-
type: "LayoutVertical2Columns",
|
|
439
|
-
elements: [
|
|
440
|
-
{
|
|
441
|
-
type: "Control",
|
|
442
|
-
label: "First Name",
|
|
443
|
-
scope: "#/properties/person/properties/firstName",
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
type: "Control",
|
|
447
|
-
scope: "#/properties/person/properties/lastName",
|
|
448
|
-
},
|
|
449
|
-
],
|
|
450
|
-
},
|
|
451
|
-
],
|
|
452
|
-
},
|
|
453
|
-
},
|
|
454
|
-
{
|
|
455
|
-
type: "Group",
|
|
456
|
-
label: "Address",
|
|
457
|
-
scope: "#/properties/address/",
|
|
458
|
-
options: {
|
|
459
|
-
childElements: [
|
|
460
|
-
{
|
|
461
|
-
type: "VerticalLayout",
|
|
462
|
-
elements: [
|
|
463
|
-
{
|
|
464
|
-
type: "Control",
|
|
465
|
-
scope: "#/properties/person/properties/shippingAddress",
|
|
466
|
-
},
|
|
467
|
-
{
|
|
468
|
-
type: "Control",
|
|
469
|
-
scope: "#/properties/address/properties/street",
|
|
470
|
-
},
|
|
471
|
-
],
|
|
472
|
-
},
|
|
473
|
-
],
|
|
474
|
-
},
|
|
475
|
-
},
|
|
476
|
-
],
|
|
477
|
-
};
|
|
478
|
-
```
|
|
479
|
-
|
|
480
|
-
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.
|
|
481
|
-
|
|
482
|
-
It is more complicated when it comes to customisation, because it needs proper `jsonSchema` and `uiSchema` so that validation and data saving work properly.
|
|
483
|
-
|
|
484
|
-
:::info
|
|
485
|
-
Remember to add a `hide-submit-button` attribute to `foundation-forms`, because in this case, submit is built directly into stepper-layout.
|
|
486
|
-
:::
|
|
487
|
-
|
|
488
|
-
```ts
|
|
489
|
-
const uiSchemaStepper = {
|
|
490
|
-
type: 'Stepper',
|
|
491
|
-
elements: [
|
|
492
|
-
{
|
|
493
|
-
type: 'Control',
|
|
494
|
-
scope: '#/properties/person',
|
|
495
|
-
label: 'Entity',
|
|
496
|
-
options: {
|
|
497
|
-
childElements: [
|
|
498
|
-
{
|
|
499
|
-
type: 'HorizontalLayout',
|
|
500
|
-
elements: [
|
|
501
|
-
{
|
|
502
|
-
type: 'Control',
|
|
503
|
-
scope: '#/properties/person/properties/firstName',
|
|
504
|
-
},
|
|
505
|
-
{
|
|
506
|
-
type: 'Control',
|
|
507
|
-
scope: '#/properties/person/properties/secondName',
|
|
508
|
-
},
|
|
509
|
-
],
|
|
510
|
-
},
|
|
511
|
-
{
|
|
512
|
-
type: 'HorizontalLayout',
|
|
513
|
-
elements: [
|
|
514
|
-
{
|
|
515
|
-
type: 'Control',
|
|
516
|
-
scope: '#/properties/person/properties/birthDate',
|
|
517
|
-
},
|
|
518
|
-
{
|
|
519
|
-
type: 'Control',
|
|
520
|
-
scope: '#/properties/person/properties/nationality',
|
|
521
|
-
},
|
|
522
|
-
],
|
|
523
|
-
},
|
|
524
|
-
],
|
|
525
|
-
},
|
|
526
|
-
},
|
|
527
|
-
{
|
|
528
|
-
type: 'Control',
|
|
529
|
-
label: 'Doc',
|
|
530
|
-
scope: '#/properties/address',
|
|
531
|
-
options: {
|
|
532
|
-
childElements: [
|
|
533
|
-
{
|
|
534
|
-
type: 'HorizontalLayout',
|
|
535
|
-
elements: [
|
|
536
|
-
{
|
|
537
|
-
type: 'Control',
|
|
538
|
-
scope: '#/properties/address/properties/street',
|
|
539
|
-
},
|
|
540
|
-
{
|
|
541
|
-
type: 'Control',
|
|
542
|
-
scope: '#/properties/address/properties/streetNumber',
|
|
543
|
-
},
|
|
544
|
-
],
|
|
545
|
-
},
|
|
546
|
-
{
|
|
547
|
-
type: 'HorizontalLayout',
|
|
548
|
-
elements: [
|
|
549
|
-
{
|
|
550
|
-
type: 'Control',
|
|
551
|
-
scope: '#/properties/address/properties/city',
|
|
552
|
-
},
|
|
553
|
-
{
|
|
554
|
-
type: 'Control',
|
|
555
|
-
scope: '#/properties/address/properties/postalCode',
|
|
556
|
-
},
|
|
557
|
-
],
|
|
558
|
-
},
|
|
559
|
-
],
|
|
560
|
-
},
|
|
561
|
-
},
|
|
562
|
-
{
|
|
563
|
-
type: 'Control',
|
|
564
|
-
label: 'Primary doc',
|
|
565
|
-
scope: '#/properties/vegetarianOptions',
|
|
566
|
-
options: {
|
|
567
|
-
childElements: [
|
|
568
|
-
{
|
|
569
|
-
type: 'VerticalLayout',
|
|
570
|
-
elements: [
|
|
571
|
-
{
|
|
572
|
-
type: 'Control',
|
|
573
|
-
scope: '#/properties/vegetarianOptions/properties/favoriteVegetable',
|
|
574
|
-
},
|
|
575
|
-
{
|
|
576
|
-
type: 'Control',
|
|
577
|
-
scope: '#/properties/vegetarianOptions/properties/otherFavoriteVegetable',
|
|
578
|
-
},
|
|
579
|
-
],
|
|
580
|
-
},
|
|
581
|
-
],
|
|
582
|
-
},
|
|
583
|
-
},
|
|
584
|
-
],
|
|
585
|
-
};
|
|
586
|
-
```
|
|
587
|
-
|
|
588
|
-
```ts
|
|
589
|
-
const jsonSchemaStepper = {
|
|
590
|
-
type: 'object',
|
|
591
|
-
properties: {
|
|
592
|
-
person: {
|
|
593
|
-
type: 'object',
|
|
594
|
-
properties: {
|
|
595
|
-
firstName: {
|
|
596
|
-
type: 'string',
|
|
597
|
-
minLength: 3,
|
|
598
|
-
description: 'Please enter your first name',
|
|
599
|
-
},
|
|
600
|
-
secondName: {
|
|
601
|
-
type: 'string',
|
|
602
|
-
minLength: 3,
|
|
603
|
-
description: 'Please enter your second name',
|
|
604
|
-
},
|
|
605
|
-
birthDate: {
|
|
606
|
-
type: 'string',
|
|
607
|
-
format: 'date',
|
|
608
|
-
description: 'Please enter your birth date.',
|
|
609
|
-
},
|
|
610
|
-
nationality: {
|
|
611
|
-
type: 'string',
|
|
612
|
-
description: 'Please enter your nationality.',
|
|
613
|
-
},
|
|
614
|
-
},
|
|
615
|
-
required: ['firstName', 'secondName'],
|
|
616
|
-
},
|
|
617
|
-
address: {
|
|
618
|
-
type: 'object',
|
|
619
|
-
properties: {
|
|
620
|
-
street: {
|
|
621
|
-
type: 'string',
|
|
622
|
-
},
|
|
623
|
-
streetNumber: {
|
|
624
|
-
type: 'string',
|
|
625
|
-
},
|
|
626
|
-
city: {
|
|
627
|
-
type: 'string',
|
|
628
|
-
},
|
|
629
|
-
postalCode: {
|
|
630
|
-
type: 'string',
|
|
631
|
-
maxLength: 5,
|
|
632
|
-
},
|
|
633
|
-
},
|
|
634
|
-
required: ['postalCode'],
|
|
635
|
-
},
|
|
636
|
-
vegetarianOptions: {
|
|
637
|
-
type: 'object',
|
|
638
|
-
properties: {
|
|
639
|
-
favoriteVegetable: {
|
|
640
|
-
type: 'string',
|
|
641
|
-
enum: ['Tomato', 'Potato', 'Salad', 'Aubergine', 'Cucumber', 'Other'],
|
|
642
|
-
},
|
|
643
|
-
otherFavoriteVegetable: {
|
|
644
|
-
type: 'string',
|
|
645
|
-
},
|
|
646
|
-
},
|
|
647
|
-
required: ['otherFavoriteVegetable'],
|
|
648
|
-
},
|
|
649
|
-
},
|
|
650
|
-
};
|
|
651
|
-
```
|
|
652
|
-
|
|
653
|
-
### Default control renderers and examples
|
|
654
|
-
|
|
655
|
-
Most renderers are defined directly in the `jsonSchema` that comes from the server, but there are also those that you can add via `uiSchema`.
|
|
656
|
-
|
|
657
|
-
String renderer is the default renderer, which creates a `text-field`.
|
|
658
|
-
|
|
659
|
-
```ts
|
|
660
|
-
const stringJsonSchema = {
|
|
661
|
-
type: "object",
|
|
662
|
-
properties: {
|
|
663
|
-
ISSUER_NAME: {
|
|
664
|
-
type: "string",
|
|
665
|
-
minLength: 3,
|
|
666
|
-
description: "kotlin.String",
|
|
667
|
-
},
|
|
668
|
-
USER: {
|
|
669
|
-
type: "string",
|
|
670
|
-
description: "kotlin.String",
|
|
671
|
-
},
|
|
672
|
-
MAIN_CONTACT: {
|
|
673
|
-
type: "string",
|
|
674
|
-
pattern: "^[\\+]?[(]?[0-9]{3}[)]?[-\\s\\.]?[0-9]{3}[-\\s\\.]?[0-9]{4,6}$",
|
|
675
|
-
description: "kotlin.String",
|
|
676
|
-
},
|
|
677
|
-
},
|
|
678
|
-
};
|
|
679
|
-
```
|
|
680
|
-
|
|
681
|
-
The number renderer creates a `number-field`.
|
|
682
|
-
|
|
683
|
-
```ts
|
|
684
|
-
const numberJsonSchema = {
|
|
685
|
-
type: "object",
|
|
686
|
-
properties: {
|
|
687
|
-
PRICE: {
|
|
688
|
-
type: "number",
|
|
689
|
-
description: "kotlin.Double",
|
|
690
|
-
},
|
|
691
|
-
},
|
|
692
|
-
};
|
|
693
|
-
```
|
|
694
|
-
|
|
695
|
-
The boolean renderer creates a `checkbox-field`.
|
|
696
|
-
|
|
697
|
-
```ts
|
|
698
|
-
const booleanJsonSchema = {
|
|
699
|
-
type: "object",
|
|
700
|
-
properties: {
|
|
701
|
-
vegetarian: {
|
|
702
|
-
type: "boolean",
|
|
703
|
-
},
|
|
704
|
-
},
|
|
705
|
-
};
|
|
706
|
-
```
|
|
707
|
-
|
|
708
|
-
The connected multiselect renderer creates a `multiselect` component with options from datasource.
|
|
709
|
-
|
|
710
|
-
```ts
|
|
711
|
-
const connectedMultiselectUISchema = {
|
|
712
|
-
type: "HorizontalLayout",
|
|
713
|
-
elements: [
|
|
714
|
-
{
|
|
715
|
-
type: 'Control',
|
|
716
|
-
label: 'Rights',
|
|
717
|
-
scope: '#/properties/RIGHT_CODES',
|
|
718
|
-
options: {
|
|
719
|
-
allOptionsResourceName: 'RIGHT',
|
|
720
|
-
valueField: 'CODE',
|
|
721
|
-
labelField: 'CODE',
|
|
722
|
-
},
|
|
723
|
-
},
|
|
724
|
-
{
|
|
725
|
-
type: 'Control',
|
|
726
|
-
label: 'Users',
|
|
727
|
-
scope: '#/properties/USER_NAMES',
|
|
728
|
-
options: {
|
|
729
|
-
allOptionsResourceName: 'USER',
|
|
730
|
-
valueField: 'USER_NAME',
|
|
731
|
-
labelField: 'USER_NAME',
|
|
732
|
-
},
|
|
733
|
-
},
|
|
734
|
-
],
|
|
735
|
-
};
|
|
736
|
-
```
|
|
737
|
-
|
|
738
|
-
Connected Select renderer is a select renderer that creates a `select` component with options.
|
|
739
|
-
|
|
740
|
-
```ts
|
|
741
|
-
const connectedSelectUISchema = {
|
|
742
|
-
type: "HorizontalLayout",
|
|
743
|
-
elements: [
|
|
744
|
-
{
|
|
745
|
-
type: "Control",
|
|
746
|
-
scope: "#/properties/COUNTERPARTY_ID",
|
|
747
|
-
options: {
|
|
748
|
-
data: CounterpartyOptions,
|
|
749
|
-
valueField: "value",
|
|
750
|
-
labelField: "name",
|
|
751
|
-
},
|
|
752
|
-
label: "Counterparty",
|
|
753
|
-
},
|
|
754
|
-
{
|
|
755
|
-
type: "Control",
|
|
756
|
-
scope: "#/properties/INSTRUMENT_ID",
|
|
757
|
-
options: {
|
|
758
|
-
data: InstrumentOptions,
|
|
759
|
-
valueField: "value",
|
|
760
|
-
labelField: "name",
|
|
761
|
-
},
|
|
762
|
-
label: "Instrument",
|
|
763
|
-
},
|
|
764
|
-
],
|
|
765
|
-
};
|
|
766
|
-
```
|
|
767
|
-
|
|
768
|
-
The date renderer creates a `date-field`.
|
|
769
|
-
|
|
770
|
-
```ts
|
|
771
|
-
const dateJsonSchema = {
|
|
772
|
-
type: "object",
|
|
773
|
-
properties: {
|
|
774
|
-
tradeDate: {
|
|
775
|
-
type: "string",
|
|
776
|
-
description: "org.joda.time.DateTime",
|
|
777
|
-
},
|
|
778
|
-
},
|
|
779
|
-
};
|
|
780
|
-
```
|
|
781
|
-
|
|
782
|
-
### Specific renderers for filters and examples
|
|
783
|
-
|
|
784
|
-
The filter date renderer creates two `date-fields` with minimum and maximum value.
|
|
785
|
-
|
|
786
|
-
```ts
|
|
787
|
-
const dateJsonSchema = {
|
|
788
|
-
type: "object",
|
|
789
|
-
properties: {
|
|
790
|
-
tradeDate: {
|
|
791
|
-
type: "string",
|
|
792
|
-
description: "org.joda.time.DateTime",
|
|
793
|
-
},
|
|
794
|
-
},
|
|
795
|
-
};
|
|
796
|
-
```
|
|
797
|
-
|
|
798
|
-
The filter number renderer creates two `number-fields` with minimum and maximum value.
|
|
799
|
-
|
|
800
|
-
```ts
|
|
801
|
-
const numberJsonSchema = {
|
|
802
|
-
type: "object",
|
|
803
|
-
properties: {
|
|
804
|
-
PRICE: {
|
|
805
|
-
type: "number",
|
|
806
|
-
description: "kotlin.Double",
|
|
807
|
-
},
|
|
808
|
-
},
|
|
809
|
-
};
|
|
810
|
-
```
|
|
5
|
+
**Docs: [Smart forms](https://docs.genesis.global/docs/develop/client-capabilities/forms/smart-forms/)**
|
|
811
6
|
|
|
812
7
|
## Installation
|
|
813
8
|
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
1. Add `@genesislcap/foundation-forms` as a dependency in your `package.json` file. Whenever you change the dependencies of your project, ensure you run the `$ npm run bootstrap` command again. You can find more information in the [package.json basics](https://learn.genesis.global/secure/web/basics/package-json-basics/) page.
|
|
9
|
+
Add the package to your `package.json` dependencies. After changing dependencies, run `npm run bootstrap` (or your project's equivalent). See [package.json basics](https://learn.genesis.global/secure/web/basics/package-json-basics/) for more information.
|
|
817
10
|
|
|
818
11
|
```json
|
|
819
12
|
{
|
|
820
|
-
...
|
|
821
13
|
"dependencies": {
|
|
822
|
-
...
|
|
823
14
|
"@genesislcap/foundation-forms": "latest"
|
|
824
|
-
|
|
825
|
-
},
|
|
826
|
-
...
|
|
15
|
+
}
|
|
827
16
|
}
|
|
828
17
|
```
|
|
829
18
|
|
|
830
|
-
## [API Docs](./docs/api/index.md)
|
|
831
|
-
|
|
832
19
|
## License
|
|
833
20
|
|
|
834
21
|
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.
|
|
835
22
|
|
|
836
23
|
### Licensed components
|
|
24
|
+
|
|
837
25
|
Genesis low-code platform
|