@defra/forms-model 3.0.430 → 3.0.432
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 +163 -1
- package/dist/module/common/pagination/index.js +2 -2
- package/dist/module/common/pagination/index.js.map +1 -1
- package/dist/module/common/search/index.js +4 -4
- package/dist/module/common/search/index.js.map +1 -1
- package/dist/module/common/sorting/index.js +2 -2
- package/dist/module/common/sorting/index.js.map +1 -1
- package/dist/module/form/form-definition/index.js +156 -156
- package/dist/module/form/form-definition/index.js.map +1 -1
- package/dist/module/form/form-editor/index.js +42 -42
- package/dist/module/form/form-editor/index.js.map +1 -1
- package/dist/module/form/form-manager/index.js +3 -3
- package/dist/module/form/form-manager/index.js.map +1 -1
- package/dist/module/form/form-metadata/index.js +34 -34
- package/dist/module/form/form-metadata/index.js.map +1 -1
- package/dist/module/form/form-submission/index.js +13 -13
- package/dist/module/form/form-submission/index.js.map +1 -1
- package/dist/module/types/joi-to-json.d.js +2 -0
- package/dist/module/types/joi-to-json.d.js.map +1 -0
- package/dist/types/common/pagination/index.d.ts.map +1 -1
- package/dist/types/common/search/index.d.ts.map +1 -1
- package/dist/types/common/sorting/index.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 +12 -12
- package/dist/types/form/form-editor/index.d.ts.map +1 -1
- package/dist/types/form/form-manager/index.d.ts.map +1 -1
- package/dist/types/form/form-metadata/index.d.ts.map +1 -1
- package/dist/types/form/form-submission/index.d.ts.map +1 -1
- package/package.json +6 -4
- package/schemas/component-schema-v2.json +162 -0
- package/schemas/component-schema.json +162 -0
- package/schemas/date-sub-schema.json +11 -0
- package/schemas/form-definition-schema.json +1876 -0
- package/schemas/form-definition-v2-payload-schema.json +1459 -0
- package/schemas/form-editor-input-check-answers-setting-schema.json +18 -0
- package/schemas/form-editor-input-page-schema.json +41 -0
- package/schemas/form-editor-input-page-settings-schema.json +28 -0
- package/schemas/form-editor-input-question-schema.json +38 -0
- package/schemas/form-metadata-author-schema.json +24 -0
- package/schemas/form-metadata-contact-schema.json +61 -0
- package/schemas/form-metadata-email-schema.json +25 -0
- package/schemas/form-metadata-input-schema.json +127 -0
- package/schemas/form-metadata-online-schema.json +25 -0
- package/schemas/form-metadata-schema.json +340 -0
- package/schemas/form-metadata-state-schema.json +72 -0
- package/schemas/form-submit-payload-schema.json +124 -0
- package/schemas/form-submit-record-schema.json +30 -0
- package/schemas/form-submit-recordset-schema.json +62 -0
- package/schemas/list-schema-v2.json +486 -0
- package/schemas/list-schema.json +486 -0
- package/schemas/max-future-schema.json +8 -0
- package/schemas/max-length-schema.json +8 -0
- package/schemas/max-past-schema.json +8 -0
- package/schemas/max-schema.json +7 -0
- package/schemas/min-length-schema.json +8 -0
- package/schemas/min-schema.json +7 -0
- package/schemas/page-schema-payload-v2.json +400 -0
- package/schemas/page-schema-v2.json +400 -0
- package/schemas/page-schema.json +400 -0
- package/schemas/page-type-schema.json +11 -0
- package/schemas/pagination-options-schema.json +27 -0
- package/schemas/patch-page-schema.json +26 -0
- package/schemas/query-options-schema.json +94 -0
- package/schemas/question-schema.json +7 -0
- package/schemas/question-type-full-schema.json +22 -0
- package/schemas/question-type-schema.json +20 -0
- package/schemas/search-options-schema.json +59 -0
- package/schemas/sorting-options-schema.json +28 -0
- package/schemas/written-answer-sub-schema.json +12 -0
- package/src/common/pagination/index.ts +8 -1
- package/src/common/search/index.ts +17 -3
- package/src/common/sorting/index.ts +8 -2
- package/src/form/form-definition/index.ts +567 -238
- package/src/form/form-editor/index.ts +202 -29
- package/src/form/form-manager/index.ts +11 -2
- package/src/form/form-metadata/index.ts +118 -40
- package/src/form/form-submission/index.ts +33 -10
- package/src/types/joi-to-json.d.ts +15 -0
@@ -0,0 +1,486 @@
|
|
1
|
+
{
|
2
|
+
"type": "object",
|
3
|
+
"description": "Enhanced list schema for V2 forms with auto-generated IDs",
|
4
|
+
"properties": {
|
5
|
+
"name": {
|
6
|
+
"type": "string",
|
7
|
+
"description": "Name used to reference this list from components",
|
8
|
+
"title": "Name"
|
9
|
+
},
|
10
|
+
"title": {
|
11
|
+
"type": "string",
|
12
|
+
"description": "Human-readable title for the list",
|
13
|
+
"title": "Title"
|
14
|
+
},
|
15
|
+
"type": {
|
16
|
+
"type": "string",
|
17
|
+
"description": "Data type for list values (string or number)",
|
18
|
+
"enum": [
|
19
|
+
"string",
|
20
|
+
"number"
|
21
|
+
],
|
22
|
+
"title": "Type"
|
23
|
+
},
|
24
|
+
"items": {
|
25
|
+
"type": [
|
26
|
+
"array",
|
27
|
+
"boolean",
|
28
|
+
"number",
|
29
|
+
"object",
|
30
|
+
"string",
|
31
|
+
"null"
|
32
|
+
],
|
33
|
+
"oneOf": [
|
34
|
+
{
|
35
|
+
"type": "array",
|
36
|
+
"description": "Array of items with string values",
|
37
|
+
"uniqueItems": true,
|
38
|
+
"items": {
|
39
|
+
"type": "object",
|
40
|
+
"description": "List item with string value",
|
41
|
+
"properties": {
|
42
|
+
"text": {
|
43
|
+
"type": "string",
|
44
|
+
"description": "Display text shown to the user",
|
45
|
+
"title": "Text"
|
46
|
+
},
|
47
|
+
"description": {
|
48
|
+
"type": "string",
|
49
|
+
"description": "Optional additional descriptive text for the item",
|
50
|
+
"title": "Description"
|
51
|
+
},
|
52
|
+
"conditional": {
|
53
|
+
"type": "object",
|
54
|
+
"description": "Optional components to show when this item is selected",
|
55
|
+
"properties": {
|
56
|
+
"components": {
|
57
|
+
"type": "array",
|
58
|
+
"description": "Components to display conditionally",
|
59
|
+
"uniqueItems": true,
|
60
|
+
"items": {
|
61
|
+
"type": "object",
|
62
|
+
"description": "Form component definition specifying UI element behavior",
|
63
|
+
"properties": {
|
64
|
+
"id": {
|
65
|
+
"type": "string",
|
66
|
+
"description": "Unique identifier for the component",
|
67
|
+
"format": "uuid",
|
68
|
+
"title": "Id"
|
69
|
+
},
|
70
|
+
"type": {
|
71
|
+
"type": "string",
|
72
|
+
"description": "Component type (TextField, RadioButtons, DateField, etc.)",
|
73
|
+
"title": "Type"
|
74
|
+
},
|
75
|
+
"shortDescription": {
|
76
|
+
"type": "string",
|
77
|
+
"description": "Brief description of the component purpose",
|
78
|
+
"title": "Short Description"
|
79
|
+
},
|
80
|
+
"name": {
|
81
|
+
"type": [
|
82
|
+
"array",
|
83
|
+
"boolean",
|
84
|
+
"number",
|
85
|
+
"object",
|
86
|
+
"string",
|
87
|
+
"null"
|
88
|
+
],
|
89
|
+
"oneOf": [
|
90
|
+
{
|
91
|
+
"type": "string",
|
92
|
+
"description": "Name format for display-only components like HTML, Markdown, etc.",
|
93
|
+
"pattern": "^[a-zA-Z]+$",
|
94
|
+
"title": "Display Component Name"
|
95
|
+
},
|
96
|
+
{
|
97
|
+
"type": "string",
|
98
|
+
"description": "Name format for input components that collect user data.",
|
99
|
+
"pattern": "^[a-zA-Z]+$",
|
100
|
+
"title": "Input Component Name"
|
101
|
+
}
|
102
|
+
],
|
103
|
+
"title": "Name",
|
104
|
+
"description": "The name value.",
|
105
|
+
"oneOfTitles": [
|
106
|
+
"Display Component Name",
|
107
|
+
"Input Component Name"
|
108
|
+
]
|
109
|
+
},
|
110
|
+
"title": {
|
111
|
+
"type": [
|
112
|
+
"array",
|
113
|
+
"boolean",
|
114
|
+
"number",
|
115
|
+
"object",
|
116
|
+
"string",
|
117
|
+
"null"
|
118
|
+
],
|
119
|
+
"oneOf": [
|
120
|
+
{
|
121
|
+
"type": "string",
|
122
|
+
"description": "Title format for display-only components.",
|
123
|
+
"title": "Display Component Title"
|
124
|
+
},
|
125
|
+
{
|
126
|
+
"type": "string",
|
127
|
+
"description": "Title displayed above input components.",
|
128
|
+
"title": "Input Component Title"
|
129
|
+
}
|
130
|
+
],
|
131
|
+
"title": "Title",
|
132
|
+
"description": "The title value.",
|
133
|
+
"oneOfTitles": [
|
134
|
+
"Display Component Title",
|
135
|
+
"Input Component Title"
|
136
|
+
]
|
137
|
+
},
|
138
|
+
"hint": {
|
139
|
+
"type": "string",
|
140
|
+
"description": "Additional guidance text displayed below the component title",
|
141
|
+
"title": "Hint"
|
142
|
+
},
|
143
|
+
"options": {
|
144
|
+
"type": "object",
|
145
|
+
"description": "Component-specific configuration options",
|
146
|
+
"default": {},
|
147
|
+
"properties": {
|
148
|
+
"rows": {
|
149
|
+
"type": "number",
|
150
|
+
"description": "Number of rows for textarea components",
|
151
|
+
"title": "Rows"
|
152
|
+
},
|
153
|
+
"maxWords": {
|
154
|
+
"type": "number",
|
155
|
+
"description": "Maximum number of words allowed in text inputs",
|
156
|
+
"title": "Max Words"
|
157
|
+
},
|
158
|
+
"maxDaysInPast": {
|
159
|
+
"type": "number",
|
160
|
+
"description": "Maximum days in the past allowed for date inputs",
|
161
|
+
"title": "Max Days In Past"
|
162
|
+
},
|
163
|
+
"maxDaysInFuture": {
|
164
|
+
"type": "number",
|
165
|
+
"description": "Maximum days in the future allowed for date inputs",
|
166
|
+
"title": "Max Days In Future"
|
167
|
+
},
|
168
|
+
"customValidationMessage": {
|
169
|
+
"type": "string",
|
170
|
+
"description": "Custom error message for validation failures",
|
171
|
+
"title": "Custom Validation Message"
|
172
|
+
},
|
173
|
+
"customValidationMessages": {
|
174
|
+
"type": "object",
|
175
|
+
"description": "Custom error messages keyed by validation rule name",
|
176
|
+
"properties": {},
|
177
|
+
"additionalProperties": true,
|
178
|
+
"title": "Custom Validation Messages"
|
179
|
+
}
|
180
|
+
},
|
181
|
+
"additionalProperties": true,
|
182
|
+
"title": "Options"
|
183
|
+
},
|
184
|
+
"schema": {
|
185
|
+
"type": "object",
|
186
|
+
"description": "Validation rules for the component",
|
187
|
+
"default": {},
|
188
|
+
"properties": {
|
189
|
+
"min": {
|
190
|
+
"type": "number",
|
191
|
+
"description": "Minimum value or length for validation",
|
192
|
+
"title": "Min"
|
193
|
+
},
|
194
|
+
"max": {
|
195
|
+
"type": "number",
|
196
|
+
"description": "Maximum value or length for validation",
|
197
|
+
"title": "Max"
|
198
|
+
},
|
199
|
+
"length": {
|
200
|
+
"type": "number",
|
201
|
+
"description": "Exact length required for validation",
|
202
|
+
"title": "Length"
|
203
|
+
}
|
204
|
+
},
|
205
|
+
"additionalProperties": true,
|
206
|
+
"title": "Schema"
|
207
|
+
},
|
208
|
+
"list": {
|
209
|
+
"type": "string",
|
210
|
+
"description": "Reference to a predefined list of options for select components",
|
211
|
+
"title": "List"
|
212
|
+
}
|
213
|
+
},
|
214
|
+
"required": [
|
215
|
+
"type"
|
216
|
+
],
|
217
|
+
"additionalProperties": true,
|
218
|
+
"title": "Components Item"
|
219
|
+
},
|
220
|
+
"title": "Components"
|
221
|
+
}
|
222
|
+
},
|
223
|
+
"required": [
|
224
|
+
"components"
|
225
|
+
],
|
226
|
+
"additionalProperties": false,
|
227
|
+
"title": "Conditional"
|
228
|
+
},
|
229
|
+
"condition": {
|
230
|
+
"type": "string",
|
231
|
+
"description": "Condition that determines if this item is shown",
|
232
|
+
"title": "Condition"
|
233
|
+
},
|
234
|
+
"value": {
|
235
|
+
"type": "string",
|
236
|
+
"description": "String value stored when this item is selected",
|
237
|
+
"title": "Value"
|
238
|
+
}
|
239
|
+
},
|
240
|
+
"required": [
|
241
|
+
"value"
|
242
|
+
],
|
243
|
+
"additionalProperties": false,
|
244
|
+
"title": "Items (array) Item"
|
245
|
+
},
|
246
|
+
"title": "String List Items"
|
247
|
+
},
|
248
|
+
{
|
249
|
+
"type": "array",
|
250
|
+
"description": "Array of items with numeric values",
|
251
|
+
"uniqueItems": true,
|
252
|
+
"items": {
|
253
|
+
"type": "object",
|
254
|
+
"description": "List item with numeric value",
|
255
|
+
"properties": {
|
256
|
+
"text": {
|
257
|
+
"type": "string",
|
258
|
+
"description": "Display text shown to the user",
|
259
|
+
"title": "Text"
|
260
|
+
},
|
261
|
+
"description": {
|
262
|
+
"type": "string",
|
263
|
+
"description": "Optional additional descriptive text for the item",
|
264
|
+
"title": "Description"
|
265
|
+
},
|
266
|
+
"conditional": {
|
267
|
+
"type": "object",
|
268
|
+
"description": "Optional components to show when this item is selected",
|
269
|
+
"properties": {
|
270
|
+
"components": {
|
271
|
+
"type": "array",
|
272
|
+
"description": "Components to display conditionally",
|
273
|
+
"uniqueItems": true,
|
274
|
+
"items": {
|
275
|
+
"type": "object",
|
276
|
+
"description": "Form component definition specifying UI element behavior",
|
277
|
+
"properties": {
|
278
|
+
"id": {
|
279
|
+
"type": "string",
|
280
|
+
"description": "Unique identifier for the component",
|
281
|
+
"format": "uuid",
|
282
|
+
"title": "Id"
|
283
|
+
},
|
284
|
+
"type": {
|
285
|
+
"type": "string",
|
286
|
+
"description": "Component type (TextField, RadioButtons, DateField, etc.)",
|
287
|
+
"title": "Type"
|
288
|
+
},
|
289
|
+
"shortDescription": {
|
290
|
+
"type": "string",
|
291
|
+
"description": "Brief description of the component purpose",
|
292
|
+
"title": "Short Description"
|
293
|
+
},
|
294
|
+
"name": {
|
295
|
+
"type": [
|
296
|
+
"array",
|
297
|
+
"boolean",
|
298
|
+
"number",
|
299
|
+
"object",
|
300
|
+
"string",
|
301
|
+
"null"
|
302
|
+
],
|
303
|
+
"oneOf": [
|
304
|
+
{
|
305
|
+
"type": "string",
|
306
|
+
"description": "Name format for display-only components like HTML, Markdown, etc.",
|
307
|
+
"pattern": "^[a-zA-Z]+$",
|
308
|
+
"title": "Display Component Name"
|
309
|
+
},
|
310
|
+
{
|
311
|
+
"type": "string",
|
312
|
+
"description": "Name format for input components that collect user data.",
|
313
|
+
"pattern": "^[a-zA-Z]+$",
|
314
|
+
"title": "Input Component Name"
|
315
|
+
}
|
316
|
+
],
|
317
|
+
"title": "Name",
|
318
|
+
"description": "The name value.",
|
319
|
+
"oneOfTitles": [
|
320
|
+
"Display Component Name",
|
321
|
+
"Input Component Name"
|
322
|
+
]
|
323
|
+
},
|
324
|
+
"title": {
|
325
|
+
"type": [
|
326
|
+
"array",
|
327
|
+
"boolean",
|
328
|
+
"number",
|
329
|
+
"object",
|
330
|
+
"string",
|
331
|
+
"null"
|
332
|
+
],
|
333
|
+
"oneOf": [
|
334
|
+
{
|
335
|
+
"type": "string",
|
336
|
+
"description": "Title format for display-only components.",
|
337
|
+
"title": "Display Component Title"
|
338
|
+
},
|
339
|
+
{
|
340
|
+
"type": "string",
|
341
|
+
"description": "Title displayed above input components.",
|
342
|
+
"title": "Input Component Title"
|
343
|
+
}
|
344
|
+
],
|
345
|
+
"title": "Title",
|
346
|
+
"description": "The title value.",
|
347
|
+
"oneOfTitles": [
|
348
|
+
"Display Component Title",
|
349
|
+
"Input Component Title"
|
350
|
+
]
|
351
|
+
},
|
352
|
+
"hint": {
|
353
|
+
"type": "string",
|
354
|
+
"description": "Additional guidance text displayed below the component title",
|
355
|
+
"title": "Hint"
|
356
|
+
},
|
357
|
+
"options": {
|
358
|
+
"type": "object",
|
359
|
+
"description": "Component-specific configuration options",
|
360
|
+
"default": {},
|
361
|
+
"properties": {
|
362
|
+
"rows": {
|
363
|
+
"type": "number",
|
364
|
+
"description": "Number of rows for textarea components",
|
365
|
+
"title": "Rows"
|
366
|
+
},
|
367
|
+
"maxWords": {
|
368
|
+
"type": "number",
|
369
|
+
"description": "Maximum number of words allowed in text inputs",
|
370
|
+
"title": "Max Words"
|
371
|
+
},
|
372
|
+
"maxDaysInPast": {
|
373
|
+
"type": "number",
|
374
|
+
"description": "Maximum days in the past allowed for date inputs",
|
375
|
+
"title": "Max Days In Past"
|
376
|
+
},
|
377
|
+
"maxDaysInFuture": {
|
378
|
+
"type": "number",
|
379
|
+
"description": "Maximum days in the future allowed for date inputs",
|
380
|
+
"title": "Max Days In Future"
|
381
|
+
},
|
382
|
+
"customValidationMessage": {
|
383
|
+
"type": "string",
|
384
|
+
"description": "Custom error message for validation failures",
|
385
|
+
"title": "Custom Validation Message"
|
386
|
+
},
|
387
|
+
"customValidationMessages": {
|
388
|
+
"type": "object",
|
389
|
+
"description": "Custom error messages keyed by validation rule name",
|
390
|
+
"properties": {},
|
391
|
+
"additionalProperties": true,
|
392
|
+
"title": "Custom Validation Messages"
|
393
|
+
}
|
394
|
+
},
|
395
|
+
"additionalProperties": true,
|
396
|
+
"title": "Options"
|
397
|
+
},
|
398
|
+
"schema": {
|
399
|
+
"type": "object",
|
400
|
+
"description": "Validation rules for the component",
|
401
|
+
"default": {},
|
402
|
+
"properties": {
|
403
|
+
"min": {
|
404
|
+
"type": "number",
|
405
|
+
"description": "Minimum value or length for validation",
|
406
|
+
"title": "Min"
|
407
|
+
},
|
408
|
+
"max": {
|
409
|
+
"type": "number",
|
410
|
+
"description": "Maximum value or length for validation",
|
411
|
+
"title": "Max"
|
412
|
+
},
|
413
|
+
"length": {
|
414
|
+
"type": "number",
|
415
|
+
"description": "Exact length required for validation",
|
416
|
+
"title": "Length"
|
417
|
+
}
|
418
|
+
},
|
419
|
+
"additionalProperties": true,
|
420
|
+
"title": "Schema"
|
421
|
+
},
|
422
|
+
"list": {
|
423
|
+
"type": "string",
|
424
|
+
"description": "Reference to a predefined list of options for select components",
|
425
|
+
"title": "List"
|
426
|
+
}
|
427
|
+
},
|
428
|
+
"required": [
|
429
|
+
"type"
|
430
|
+
],
|
431
|
+
"additionalProperties": true,
|
432
|
+
"title": "Components Item"
|
433
|
+
},
|
434
|
+
"title": "Components"
|
435
|
+
}
|
436
|
+
},
|
437
|
+
"required": [
|
438
|
+
"components"
|
439
|
+
],
|
440
|
+
"additionalProperties": false,
|
441
|
+
"title": "Conditional"
|
442
|
+
},
|
443
|
+
"condition": {
|
444
|
+
"type": "string",
|
445
|
+
"description": "Condition that determines if this item is shown",
|
446
|
+
"title": "Condition"
|
447
|
+
},
|
448
|
+
"value": {
|
449
|
+
"type": "number",
|
450
|
+
"description": "Numeric value stored when this item is selected",
|
451
|
+
"title": "Value"
|
452
|
+
}
|
453
|
+
},
|
454
|
+
"required": [
|
455
|
+
"value"
|
456
|
+
],
|
457
|
+
"additionalProperties": false,
|
458
|
+
"title": "Items (array) Item"
|
459
|
+
},
|
460
|
+
"title": "Number List Items"
|
461
|
+
}
|
462
|
+
],
|
463
|
+
"title": "Items",
|
464
|
+
"description": "The items value.",
|
465
|
+
"oneOfTitles": [
|
466
|
+
"Items (array)",
|
467
|
+
"Items (array)"
|
468
|
+
]
|
469
|
+
},
|
470
|
+
"id": {
|
471
|
+
"type": "string",
|
472
|
+
"description": "Auto-generated unique identifier for the list",
|
473
|
+
"format": "uuid",
|
474
|
+
"title": "Id"
|
475
|
+
}
|
476
|
+
},
|
477
|
+
"required": [
|
478
|
+
"name",
|
479
|
+
"title",
|
480
|
+
"type"
|
481
|
+
],
|
482
|
+
"additionalProperties": false,
|
483
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
484
|
+
"title": "List Schema V2",
|
485
|
+
"$id": "@defra/forms-model/schemas/list-schema-v2.json"
|
486
|
+
}
|