@defra/forms-model 3.0.605 → 3.0.607
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/dist/module/components/component-types.js +6 -0
- package/dist/module/components/component-types.js.map +1 -1
- package/dist/module/components/enums.js +1 -0
- package/dist/module/components/enums.js.map +1 -1
- package/dist/module/components/types.js.map +1 -1
- package/dist/module/form/form-definition/index.js +9 -1
- package/dist/module/form/form-definition/index.js.map +1 -1
- package/dist/module/form/form-editor/index.js +1 -0
- package/dist/module/form/form-editor/index.js.map +1 -1
- package/dist/module/form/form-editor/types.js.map +1 -1
- package/dist/types/components/component-types.d.ts.map +1 -1
- package/dist/types/components/enums.d.ts +2 -1
- package/dist/types/components/enums.d.ts.map +1 -1
- package/dist/types/components/types.d.ts +9 -2
- package/dist/types/components/types.d.ts.map +1 -1
- package/dist/types/form/form-definition/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/index.d.ts +1 -0
- package/dist/types/form/form-editor/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/types.d.ts +5 -0
- package/dist/types/form/form-editor/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/schemas/component-schema-v2.json +13 -0
- package/schemas/component-schema.json +13 -0
- package/schemas/form-definition-schema.json +39 -0
- package/schemas/form-definition-v2-schema.json +65 -0
- package/schemas/list-schema-v2.json +26 -0
- package/schemas/list-schema.json +26 -0
- package/schemas/page-schema-v2.json +39 -0
- package/schemas/page-schema.json +13 -0
- package/src/components/component-types.ts +7 -0
- package/src/components/enums.ts +2 -1
- package/src/components/types.ts +10 -0
- package/src/form/form-definition/index.ts +16 -1
- package/src/form/form-editor/index.ts +4 -0
- package/src/form/form-editor/types.ts +10 -0
|
@@ -481,6 +481,19 @@
|
|
|
481
481
|
"properties": {},
|
|
482
482
|
"additionalProperties": true,
|
|
483
483
|
"title": "Custom Validation Messages"
|
|
484
|
+
},
|
|
485
|
+
"amount": {
|
|
486
|
+
"type": "number",
|
|
487
|
+
"description": "Payment amount in GBP (£0.30 - £100,000)",
|
|
488
|
+
"minimum": 0.3,
|
|
489
|
+
"maximum": 100000,
|
|
490
|
+
"title": "Amount"
|
|
491
|
+
},
|
|
492
|
+
"description": {
|
|
493
|
+
"type": "string",
|
|
494
|
+
"description": "Payment description (max 230 chars)",
|
|
495
|
+
"maxLength": 230,
|
|
496
|
+
"title": "Description"
|
|
484
497
|
}
|
|
485
498
|
},
|
|
486
499
|
"additionalProperties": true,
|
|
@@ -677,6 +690,19 @@
|
|
|
677
690
|
"properties": {},
|
|
678
691
|
"additionalProperties": true,
|
|
679
692
|
"title": "Custom Validation Messages"
|
|
693
|
+
},
|
|
694
|
+
"amount": {
|
|
695
|
+
"type": "number",
|
|
696
|
+
"description": "Payment amount in GBP (£0.30 - £100,000)",
|
|
697
|
+
"minimum": 0.3,
|
|
698
|
+
"maximum": 100000,
|
|
699
|
+
"title": "Amount"
|
|
700
|
+
},
|
|
701
|
+
"description": {
|
|
702
|
+
"type": "string",
|
|
703
|
+
"description": "Payment description (max 230 chars)",
|
|
704
|
+
"maxLength": 230,
|
|
705
|
+
"title": "Description"
|
|
680
706
|
}
|
|
681
707
|
},
|
|
682
708
|
"additionalProperties": true,
|
|
@@ -956,6 +982,19 @@
|
|
|
956
982
|
"properties": {},
|
|
957
983
|
"additionalProperties": true,
|
|
958
984
|
"title": "Custom Validation Messages"
|
|
985
|
+
},
|
|
986
|
+
"amount": {
|
|
987
|
+
"type": "number",
|
|
988
|
+
"description": "Payment amount in GBP (£0.30 - £100,000)",
|
|
989
|
+
"minimum": 0.3,
|
|
990
|
+
"maximum": 100000,
|
|
991
|
+
"title": "Amount"
|
|
992
|
+
},
|
|
993
|
+
"description": {
|
|
994
|
+
"type": "string",
|
|
995
|
+
"description": "Payment description (max 230 chars)",
|
|
996
|
+
"maxLength": 230,
|
|
997
|
+
"title": "Description"
|
|
959
998
|
}
|
|
960
999
|
},
|
|
961
1000
|
"additionalProperties": true,
|
|
@@ -1261,6 +1300,19 @@
|
|
|
1261
1300
|
"properties": {},
|
|
1262
1301
|
"additionalProperties": true,
|
|
1263
1302
|
"title": "Custom Validation Messages"
|
|
1303
|
+
},
|
|
1304
|
+
"amount": {
|
|
1305
|
+
"type": "number",
|
|
1306
|
+
"description": "Payment amount in GBP (£0.30 - £100,000)",
|
|
1307
|
+
"minimum": 0.3,
|
|
1308
|
+
"maximum": 100000,
|
|
1309
|
+
"title": "Amount"
|
|
1310
|
+
},
|
|
1311
|
+
"description": {
|
|
1312
|
+
"type": "string",
|
|
1313
|
+
"description": "Payment description (max 230 chars)",
|
|
1314
|
+
"maxLength": 230,
|
|
1315
|
+
"title": "Description"
|
|
1264
1316
|
}
|
|
1265
1317
|
},
|
|
1266
1318
|
"additionalProperties": true,
|
|
@@ -1527,6 +1579,19 @@
|
|
|
1527
1579
|
"properties": {},
|
|
1528
1580
|
"additionalProperties": true,
|
|
1529
1581
|
"title": "Custom Validation Messages"
|
|
1582
|
+
},
|
|
1583
|
+
"amount": {
|
|
1584
|
+
"type": "number",
|
|
1585
|
+
"description": "Payment amount in GBP (£0.30 - £100,000)",
|
|
1586
|
+
"minimum": 0.3,
|
|
1587
|
+
"maximum": 100000,
|
|
1588
|
+
"title": "Amount"
|
|
1589
|
+
},
|
|
1590
|
+
"description": {
|
|
1591
|
+
"type": "string",
|
|
1592
|
+
"description": "Payment description (max 230 chars)",
|
|
1593
|
+
"maxLength": 230,
|
|
1594
|
+
"title": "Description"
|
|
1530
1595
|
}
|
|
1531
1596
|
},
|
|
1532
1597
|
"additionalProperties": true,
|
|
@@ -182,6 +182,19 @@
|
|
|
182
182
|
"properties": {},
|
|
183
183
|
"additionalProperties": true,
|
|
184
184
|
"title": "Custom Validation Messages"
|
|
185
|
+
},
|
|
186
|
+
"amount": {
|
|
187
|
+
"type": "number",
|
|
188
|
+
"description": "Payment amount in GBP (£0.30 - £100,000)",
|
|
189
|
+
"minimum": 0.3,
|
|
190
|
+
"maximum": 100000,
|
|
191
|
+
"title": "Amount"
|
|
192
|
+
},
|
|
193
|
+
"description": {
|
|
194
|
+
"type": "string",
|
|
195
|
+
"description": "Payment description (max 230 chars)",
|
|
196
|
+
"maxLength": 230,
|
|
197
|
+
"title": "Description"
|
|
185
198
|
}
|
|
186
199
|
},
|
|
187
200
|
"additionalProperties": true,
|
|
@@ -448,6 +461,19 @@
|
|
|
448
461
|
"properties": {},
|
|
449
462
|
"additionalProperties": true,
|
|
450
463
|
"title": "Custom Validation Messages"
|
|
464
|
+
},
|
|
465
|
+
"amount": {
|
|
466
|
+
"type": "number",
|
|
467
|
+
"description": "Payment amount in GBP (£0.30 - £100,000)",
|
|
468
|
+
"minimum": 0.3,
|
|
469
|
+
"maximum": 100000,
|
|
470
|
+
"title": "Amount"
|
|
471
|
+
},
|
|
472
|
+
"description": {
|
|
473
|
+
"type": "string",
|
|
474
|
+
"description": "Payment description (max 230 chars)",
|
|
475
|
+
"maxLength": 230,
|
|
476
|
+
"title": "Description"
|
|
451
477
|
}
|
|
452
478
|
},
|
|
453
479
|
"additionalProperties": true,
|
package/schemas/list-schema.json
CHANGED
|
@@ -188,6 +188,19 @@
|
|
|
188
188
|
"properties": {},
|
|
189
189
|
"additionalProperties": true,
|
|
190
190
|
"title": "Custom Validation Messages"
|
|
191
|
+
},
|
|
192
|
+
"amount": {
|
|
193
|
+
"type": "number",
|
|
194
|
+
"description": "Payment amount in GBP (£0.30 - £100,000)",
|
|
195
|
+
"minimum": 0.3,
|
|
196
|
+
"maximum": 100000,
|
|
197
|
+
"title": "Amount"
|
|
198
|
+
},
|
|
199
|
+
"description": {
|
|
200
|
+
"type": "string",
|
|
201
|
+
"description": "Payment description (max 230 chars)",
|
|
202
|
+
"maxLength": 230,
|
|
203
|
+
"title": "Description"
|
|
191
204
|
}
|
|
192
205
|
},
|
|
193
206
|
"additionalProperties": true,
|
|
@@ -454,6 +467,19 @@
|
|
|
454
467
|
"properties": {},
|
|
455
468
|
"additionalProperties": true,
|
|
456
469
|
"title": "Custom Validation Messages"
|
|
470
|
+
},
|
|
471
|
+
"amount": {
|
|
472
|
+
"type": "number",
|
|
473
|
+
"description": "Payment amount in GBP (£0.30 - £100,000)",
|
|
474
|
+
"minimum": 0.3,
|
|
475
|
+
"maximum": 100000,
|
|
476
|
+
"title": "Amount"
|
|
477
|
+
},
|
|
478
|
+
"description": {
|
|
479
|
+
"type": "string",
|
|
480
|
+
"description": "Payment description (max 230 chars)",
|
|
481
|
+
"maxLength": 230,
|
|
482
|
+
"title": "Description"
|
|
457
483
|
}
|
|
458
484
|
},
|
|
459
485
|
"additionalProperties": true,
|
|
@@ -294,6 +294,19 @@
|
|
|
294
294
|
"properties": {},
|
|
295
295
|
"additionalProperties": true,
|
|
296
296
|
"title": "Custom Validation Messages"
|
|
297
|
+
},
|
|
298
|
+
"amount": {
|
|
299
|
+
"type": "number",
|
|
300
|
+
"description": "Payment amount in GBP (£0.30 - £100,000)",
|
|
301
|
+
"minimum": 0.3,
|
|
302
|
+
"maximum": 100000,
|
|
303
|
+
"title": "Amount"
|
|
304
|
+
},
|
|
305
|
+
"description": {
|
|
306
|
+
"type": "string",
|
|
307
|
+
"description": "Payment description (max 230 chars)",
|
|
308
|
+
"maxLength": 230,
|
|
309
|
+
"title": "Description"
|
|
297
310
|
}
|
|
298
311
|
},
|
|
299
312
|
"additionalProperties": true,
|
|
@@ -490,6 +503,19 @@
|
|
|
490
503
|
"properties": {},
|
|
491
504
|
"additionalProperties": true,
|
|
492
505
|
"title": "Custom Validation Messages"
|
|
506
|
+
},
|
|
507
|
+
"amount": {
|
|
508
|
+
"type": "number",
|
|
509
|
+
"description": "Payment amount in GBP (£0.30 - £100,000)",
|
|
510
|
+
"minimum": 0.3,
|
|
511
|
+
"maximum": 100000,
|
|
512
|
+
"title": "Amount"
|
|
513
|
+
},
|
|
514
|
+
"description": {
|
|
515
|
+
"type": "string",
|
|
516
|
+
"description": "Payment description (max 230 chars)",
|
|
517
|
+
"maxLength": 230,
|
|
518
|
+
"title": "Description"
|
|
493
519
|
}
|
|
494
520
|
},
|
|
495
521
|
"additionalProperties": true,
|
|
@@ -769,6 +795,19 @@
|
|
|
769
795
|
"properties": {},
|
|
770
796
|
"additionalProperties": true,
|
|
771
797
|
"title": "Custom Validation Messages"
|
|
798
|
+
},
|
|
799
|
+
"amount": {
|
|
800
|
+
"type": "number",
|
|
801
|
+
"description": "Payment amount in GBP (£0.30 - £100,000)",
|
|
802
|
+
"minimum": 0.3,
|
|
803
|
+
"maximum": 100000,
|
|
804
|
+
"title": "Amount"
|
|
805
|
+
},
|
|
806
|
+
"description": {
|
|
807
|
+
"type": "string",
|
|
808
|
+
"description": "Payment description (max 230 chars)",
|
|
809
|
+
"maxLength": 230,
|
|
810
|
+
"title": "Description"
|
|
772
811
|
}
|
|
773
812
|
},
|
|
774
813
|
"additionalProperties": true,
|
package/schemas/page-schema.json
CHANGED
|
@@ -157,6 +157,19 @@
|
|
|
157
157
|
"properties": {},
|
|
158
158
|
"additionalProperties": true,
|
|
159
159
|
"title": "Custom Validation Messages"
|
|
160
|
+
},
|
|
161
|
+
"amount": {
|
|
162
|
+
"type": "number",
|
|
163
|
+
"description": "Payment amount in GBP (£0.30 - £100,000)",
|
|
164
|
+
"minimum": 0.3,
|
|
165
|
+
"maximum": 100000,
|
|
166
|
+
"title": "Amount"
|
|
167
|
+
},
|
|
168
|
+
"description": {
|
|
169
|
+
"type": "string",
|
|
170
|
+
"description": "Payment description (max 230 chars)",
|
|
171
|
+
"maxLength": 230,
|
|
172
|
+
"title": "Description"
|
|
160
173
|
}
|
|
161
174
|
},
|
|
162
175
|
"additionalProperties": true,
|
|
@@ -187,5 +187,12 @@ export const ComponentTypes: readonly ComponentDef[] = Object.freeze([
|
|
|
187
187
|
hint: '',
|
|
188
188
|
options: {},
|
|
189
189
|
schema: {}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: 'PaymentField',
|
|
193
|
+
title: 'Payment field',
|
|
194
|
+
type: ComponentType.PaymentField,
|
|
195
|
+
hint: '',
|
|
196
|
+
options: {}
|
|
190
197
|
}
|
|
191
198
|
])
|
package/src/components/enums.ts
CHANGED
|
@@ -23,7 +23,8 @@ export enum ComponentType {
|
|
|
23
23
|
OsGridRefField = 'OsGridRefField',
|
|
24
24
|
NationalGridFieldNumberField = 'NationalGridFieldNumberField',
|
|
25
25
|
LatLongField = 'LatLongField',
|
|
26
|
-
HiddenField = 'HiddenField'
|
|
26
|
+
HiddenField = 'HiddenField',
|
|
27
|
+
PaymentField = 'PaymentField'
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export const PreviewTypeEnum = {
|
package/src/components/types.ts
CHANGED
|
@@ -255,6 +255,14 @@ export interface MonthYearFieldComponent extends DateFieldBase {
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
+
export interface PaymentFieldComponent extends FormFieldBase {
|
|
259
|
+
type: ComponentType.PaymentField
|
|
260
|
+
options: FormFieldBase['options'] & {
|
|
261
|
+
amount?: number
|
|
262
|
+
description?: string
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
258
266
|
// Content Fields
|
|
259
267
|
export interface DetailsComponent extends ContentFieldBase {
|
|
260
268
|
type: ComponentType.Details
|
|
@@ -352,6 +360,7 @@ export type InputFieldsComponentsDef =
|
|
|
352
360
|
| NationalGridFieldNumberFieldComponent
|
|
353
361
|
| LatLongFieldComponent
|
|
354
362
|
| HiddenFieldComponent
|
|
363
|
+
| PaymentFieldComponent
|
|
355
364
|
|
|
356
365
|
// Components that render content
|
|
357
366
|
export type ContentComponentsDef =
|
|
@@ -382,6 +391,7 @@ export type ConditionalComponentsDef = Exclude<
|
|
|
382
391
|
| MonthYearFieldComponent
|
|
383
392
|
| UkAddressFieldComponent
|
|
384
393
|
| FileUploadFieldComponent
|
|
394
|
+
| PaymentFieldComponent
|
|
385
395
|
>
|
|
386
396
|
|
|
387
397
|
export type PreviewType = keyof typeof PreviewTypeEnum
|
|
@@ -574,7 +574,22 @@ export const componentSchema = Joi.object<ComponentDef>()
|
|
|
574
574
|
customValidationMessages: Joi.object<LanguageMessages>()
|
|
575
575
|
.unknown(true)
|
|
576
576
|
.optional()
|
|
577
|
-
.description('Custom error messages keyed by validation rule name')
|
|
577
|
+
.description('Custom error messages keyed by validation rule name'),
|
|
578
|
+
amount: Joi.when('type', {
|
|
579
|
+
is: Joi.string().trim().valid(ComponentType.PaymentField).required(),
|
|
580
|
+
then: Joi.number()
|
|
581
|
+
.min(0.3)
|
|
582
|
+
.max(100000)
|
|
583
|
+
.required()
|
|
584
|
+
.description('Payment amount in GBP (£0.30 - £100,000)')
|
|
585
|
+
}).description('Payment amount - for PaymentField only'),
|
|
586
|
+
description: Joi.when('type', {
|
|
587
|
+
is: Joi.string().trim().valid(ComponentType.PaymentField).required(),
|
|
588
|
+
then: Joi.string()
|
|
589
|
+
.max(230)
|
|
590
|
+
.required()
|
|
591
|
+
.description('Payment description (max 230 chars)')
|
|
592
|
+
}).description('Payment description - for PaymentField only')
|
|
578
593
|
})
|
|
579
594
|
.default({})
|
|
580
595
|
.unknown(true)
|
|
@@ -306,6 +306,10 @@ export const disableConfirmationEmailSchema = Joi.boolean()
|
|
|
306
306
|
.valid(true)
|
|
307
307
|
.description('Whether confirmation emails should be disabled')
|
|
308
308
|
|
|
309
|
+
export const enableReferenceNumberSchema = Joi.boolean()
|
|
310
|
+
.valid(true)
|
|
311
|
+
.description('Whether reference number should be enabled')
|
|
312
|
+
|
|
309
313
|
export const minSchema = Joi.number()
|
|
310
314
|
.empty('')
|
|
311
315
|
.integer()
|
|
@@ -125,6 +125,11 @@ export interface FormEditor {
|
|
|
125
125
|
*/
|
|
126
126
|
disableConfirmationEmail: boolean
|
|
127
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Whether reference numbers should be enabled
|
|
130
|
+
*/
|
|
131
|
+
enableReferenceNumber: boolean
|
|
132
|
+
|
|
128
133
|
/**
|
|
129
134
|
* The min length a field can have
|
|
130
135
|
*/
|
|
@@ -321,6 +326,11 @@ export type FormEditorInputConfirmationEmailSettings = Pick<
|
|
|
321
326
|
'disableConfirmationEmail'
|
|
322
327
|
>
|
|
323
328
|
|
|
329
|
+
export type FormEditorInputReferenceNumberSettings = Pick<
|
|
330
|
+
FormEditor,
|
|
331
|
+
'enableReferenceNumber'
|
|
332
|
+
>
|
|
333
|
+
|
|
324
334
|
export type FormEditorInputQuestion = Pick<
|
|
325
335
|
FormEditor,
|
|
326
336
|
| 'questionType'
|