@defra/forms-model 3.0.431 → 3.0.433
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/form/form-definition/index.js +2 -1
- package/dist/module/form/form-definition/index.js.map +1 -1
- package/dist/module/form/form-definition/types.js.map +1 -1
- package/dist/module/form/form-editor/index.js +107 -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/module/form/form-manager/index.js +1 -1
- package/dist/module/form/form-manager/index.js.map +1 -1
- package/dist/types/form/form-definition/index.d.ts.map +1 -1
- package/dist/types/form/form-definition/types.d.ts +1 -0
- package/dist/types/form/form-definition/types.d.ts.map +1 -1
- package/dist/types/form/form-editor/index.d.ts +21 -1
- package/dist/types/form/form-editor/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/types.d.ts +8 -2
- package/dist/types/form/form-editor/types.d.ts.map +1 -1
- package/dist/types/form/form-manager/index.d.ts +1 -1
- package/dist/types/form/form-manager/index.d.ts.map +1 -1
- package/package.json +1 -1
- 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 +1886 -0
- package/schemas/form-definition-v2-payload-schema.json +1469 -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 +496 -0
- package/schemas/list-schema.json +496 -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/form/form-definition/index.ts +5 -1
- package/src/form/form-definition/types.ts +1 -0
- package/src/form/form-editor/index.ts +147 -1
- package/src/form/form-editor/types.ts +19 -2
- package/src/form/form-manager/index.ts +1 -1
- package/scripts/generate-schemas.js +0 -238
- package/scripts/schema-modules/constants.js +0 -39
- package/scripts/schema-modules/schema-processors.js +0 -109
- package/scripts/schema-modules/schema-simplifiers.js +0 -351
- package/scripts/schema-modules/title-processors.js +0 -327
- package/scripts/schema-modules/types.js +0 -21
- package/scripts/schema-modules/utils.js +0 -41
@@ -0,0 +1,400 @@
|
|
1
|
+
{
|
2
|
+
"type": "object",
|
3
|
+
"description": "Page schema for payload data with auto-generated IDs for pages and components",
|
4
|
+
"properties": {
|
5
|
+
"path": {
|
6
|
+
"type": "string",
|
7
|
+
"description": "URL path for this page, must not be the reserved \"/status\" path",
|
8
|
+
"not": {
|
9
|
+
"type": "string",
|
10
|
+
"enum": [
|
11
|
+
"/status"
|
12
|
+
]
|
13
|
+
},
|
14
|
+
"title": "Path"
|
15
|
+
},
|
16
|
+
"section": {
|
17
|
+
"type": "string",
|
18
|
+
"description": "Section this page belongs to",
|
19
|
+
"title": "Section"
|
20
|
+
},
|
21
|
+
"controller": {
|
22
|
+
"type": "string",
|
23
|
+
"description": "Custom controller class name for special page behavior",
|
24
|
+
"title": "Controller"
|
25
|
+
},
|
26
|
+
"repeat": {
|
27
|
+
"type": "object",
|
28
|
+
"title": "Repeat Configuration",
|
29
|
+
"description": "Configuration for repeatable pages, used with RepeatPageController. Defines how repeatable sections behave including min/max repetitions and display options.\n\nNOTE: This configuration is only used when the 'controller' property is set to 'RepeatPageController'. Otherwise, this property should not be specified.",
|
30
|
+
"oneOfTitles": [
|
31
|
+
"Repeat Configuration",
|
32
|
+
"Alternative Validation"
|
33
|
+
],
|
34
|
+
"properties": {
|
35
|
+
"options": {
|
36
|
+
"type": "object",
|
37
|
+
"description": "Display and identification options for the repetition",
|
38
|
+
"properties": {
|
39
|
+
"name": {
|
40
|
+
"type": "string",
|
41
|
+
"description": "Identifier for the repeatable section, used in data structure",
|
42
|
+
"title": "Name"
|
43
|
+
},
|
44
|
+
"title": {
|
45
|
+
"type": "string",
|
46
|
+
"description": "Title displayed for each repeatable item",
|
47
|
+
"title": "Title"
|
48
|
+
}
|
49
|
+
},
|
50
|
+
"required": [
|
51
|
+
"name",
|
52
|
+
"title"
|
53
|
+
],
|
54
|
+
"additionalProperties": false,
|
55
|
+
"title": "Options"
|
56
|
+
},
|
57
|
+
"schema": {
|
58
|
+
"type": "object",
|
59
|
+
"description": "Validation constraints for the number of repetitions",
|
60
|
+
"properties": {
|
61
|
+
"min": {
|
62
|
+
"type": "number",
|
63
|
+
"description": "Minimum number of repetitions required",
|
64
|
+
"title": "Min"
|
65
|
+
},
|
66
|
+
"max": {
|
67
|
+
"type": "number",
|
68
|
+
"description": "Maximum number of repetitions allowed",
|
69
|
+
"title": "Max"
|
70
|
+
}
|
71
|
+
},
|
72
|
+
"required": [
|
73
|
+
"min",
|
74
|
+
"max"
|
75
|
+
],
|
76
|
+
"additionalProperties": false,
|
77
|
+
"title": "Schema"
|
78
|
+
}
|
79
|
+
},
|
80
|
+
"required": [
|
81
|
+
"options",
|
82
|
+
"schema"
|
83
|
+
],
|
84
|
+
"additionalProperties": false
|
85
|
+
},
|
86
|
+
"condition": {
|
87
|
+
"type": "string",
|
88
|
+
"description": "Optional condition that determines if this page is shown",
|
89
|
+
"title": "Condition"
|
90
|
+
},
|
91
|
+
"next": {
|
92
|
+
"type": "array",
|
93
|
+
"description": "Possible navigation paths after this page",
|
94
|
+
"default": [],
|
95
|
+
"items": {
|
96
|
+
"type": "object",
|
97
|
+
"description": "Navigation link defining where to go after completing a page",
|
98
|
+
"properties": {
|
99
|
+
"path": {
|
100
|
+
"type": "string",
|
101
|
+
"description": "The target page path to navigate to",
|
102
|
+
"title": "Path"
|
103
|
+
},
|
104
|
+
"condition": {
|
105
|
+
"type": "string",
|
106
|
+
"description": "Optional condition that determines if this path should be taken",
|
107
|
+
"title": "Condition"
|
108
|
+
},
|
109
|
+
"redirect": {
|
110
|
+
"type": "string",
|
111
|
+
"description": "Optional external URL to redirect to instead of an internal page",
|
112
|
+
"title": "Redirect"
|
113
|
+
}
|
114
|
+
},
|
115
|
+
"required": [
|
116
|
+
"path"
|
117
|
+
],
|
118
|
+
"additionalProperties": false,
|
119
|
+
"title": "Next Item"
|
120
|
+
},
|
121
|
+
"title": "Next"
|
122
|
+
},
|
123
|
+
"events": {
|
124
|
+
"type": "object",
|
125
|
+
"description": "Event handlers for page lifecycle events",
|
126
|
+
"properties": {
|
127
|
+
"onLoad": {
|
128
|
+
"type": "object",
|
129
|
+
"description": "Event handler triggered when the page is loaded",
|
130
|
+
"properties": {
|
131
|
+
"type": {
|
132
|
+
"type": "string",
|
133
|
+
"description": "Type of the event handler (currently only \"http\" supported)",
|
134
|
+
"title": "Type"
|
135
|
+
},
|
136
|
+
"options": {
|
137
|
+
"type": "object",
|
138
|
+
"description": "Options specific to the event handler type",
|
139
|
+
"properties": {
|
140
|
+
"method": {
|
141
|
+
"type": "string",
|
142
|
+
"description": "HTTP method to use for the request",
|
143
|
+
"title": "Method"
|
144
|
+
},
|
145
|
+
"url": {
|
146
|
+
"type": "string",
|
147
|
+
"description": "URL endpoint to call when the event fires",
|
148
|
+
"format": "uri",
|
149
|
+
"title": "Url"
|
150
|
+
}
|
151
|
+
},
|
152
|
+
"required": [
|
153
|
+
"method",
|
154
|
+
"url"
|
155
|
+
],
|
156
|
+
"additionalProperties": false,
|
157
|
+
"title": "Options"
|
158
|
+
}
|
159
|
+
},
|
160
|
+
"required": [
|
161
|
+
"type"
|
162
|
+
],
|
163
|
+
"additionalProperties": false,
|
164
|
+
"title": "On Load"
|
165
|
+
},
|
166
|
+
"onSave": {
|
167
|
+
"type": "object",
|
168
|
+
"description": "Event handler triggered when the page data is saved",
|
169
|
+
"properties": {
|
170
|
+
"type": {
|
171
|
+
"type": "string",
|
172
|
+
"description": "Type of the event handler (currently only \"http\" supported)",
|
173
|
+
"title": "Type"
|
174
|
+
},
|
175
|
+
"options": {
|
176
|
+
"type": "object",
|
177
|
+
"description": "Options specific to the event handler type",
|
178
|
+
"properties": {
|
179
|
+
"method": {
|
180
|
+
"type": "string",
|
181
|
+
"description": "HTTP method to use for the request",
|
182
|
+
"title": "Method"
|
183
|
+
},
|
184
|
+
"url": {
|
185
|
+
"type": "string",
|
186
|
+
"description": "URL endpoint to call when the event fires",
|
187
|
+
"format": "uri",
|
188
|
+
"title": "Url"
|
189
|
+
}
|
190
|
+
},
|
191
|
+
"required": [
|
192
|
+
"method",
|
193
|
+
"url"
|
194
|
+
],
|
195
|
+
"additionalProperties": false,
|
196
|
+
"title": "Options"
|
197
|
+
}
|
198
|
+
},
|
199
|
+
"required": [
|
200
|
+
"type"
|
201
|
+
],
|
202
|
+
"additionalProperties": false,
|
203
|
+
"title": "On Save"
|
204
|
+
}
|
205
|
+
},
|
206
|
+
"additionalProperties": false,
|
207
|
+
"title": "Events"
|
208
|
+
},
|
209
|
+
"view": {
|
210
|
+
"type": "string",
|
211
|
+
"description": "Optional custom view template to use for rendering this page",
|
212
|
+
"title": "View"
|
213
|
+
},
|
214
|
+
"title": {
|
215
|
+
"type": "string",
|
216
|
+
"description": "Page title with enhanced support for empty titles in V2",
|
217
|
+
"title": "Title"
|
218
|
+
},
|
219
|
+
"id": {
|
220
|
+
"type": "string",
|
221
|
+
"description": "Auto-generated unique identifier for the page",
|
222
|
+
"format": "uuid",
|
223
|
+
"title": "Id"
|
224
|
+
},
|
225
|
+
"components": {
|
226
|
+
"type": "array",
|
227
|
+
"description": "Components with auto-generated IDs",
|
228
|
+
"uniqueItems": true,
|
229
|
+
"items": {
|
230
|
+
"type": "object",
|
231
|
+
"description": "Enhanced component schema for V2 forms with auto-generated IDs",
|
232
|
+
"properties": {
|
233
|
+
"type": {
|
234
|
+
"type": "string",
|
235
|
+
"description": "Component type (TextField, RadioButtons, DateField, etc.)",
|
236
|
+
"title": "Type"
|
237
|
+
},
|
238
|
+
"shortDescription": {
|
239
|
+
"type": "string",
|
240
|
+
"description": "Brief description of the component purpose",
|
241
|
+
"title": "Short Description"
|
242
|
+
},
|
243
|
+
"name": {
|
244
|
+
"type": [
|
245
|
+
"array",
|
246
|
+
"boolean",
|
247
|
+
"number",
|
248
|
+
"object",
|
249
|
+
"string",
|
250
|
+
"null"
|
251
|
+
],
|
252
|
+
"oneOf": [
|
253
|
+
{
|
254
|
+
"type": "string",
|
255
|
+
"description": "Name format for display-only components like HTML, Markdown, etc.",
|
256
|
+
"pattern": "^[a-zA-Z]+$",
|
257
|
+
"title": "Display Component Name"
|
258
|
+
},
|
259
|
+
{
|
260
|
+
"type": "string",
|
261
|
+
"description": "Name format for input components that collect user data.",
|
262
|
+
"pattern": "^[a-zA-Z]+$",
|
263
|
+
"title": "Input Component Name"
|
264
|
+
}
|
265
|
+
],
|
266
|
+
"title": "Name",
|
267
|
+
"description": "The name value.",
|
268
|
+
"oneOfTitles": [
|
269
|
+
"Display Component Name",
|
270
|
+
"Input Component Name"
|
271
|
+
]
|
272
|
+
},
|
273
|
+
"title": {
|
274
|
+
"type": [
|
275
|
+
"array",
|
276
|
+
"boolean",
|
277
|
+
"number",
|
278
|
+
"object",
|
279
|
+
"string",
|
280
|
+
"null"
|
281
|
+
],
|
282
|
+
"oneOf": [
|
283
|
+
{
|
284
|
+
"type": "string",
|
285
|
+
"description": "Title format for display-only components.",
|
286
|
+
"title": "Display Component Title"
|
287
|
+
},
|
288
|
+
{
|
289
|
+
"type": "string",
|
290
|
+
"description": "Title displayed above input components.",
|
291
|
+
"title": "Input Component Title"
|
292
|
+
}
|
293
|
+
],
|
294
|
+
"title": "Title",
|
295
|
+
"description": "The title value.",
|
296
|
+
"oneOfTitles": [
|
297
|
+
"Display Component Title",
|
298
|
+
"Input Component Title"
|
299
|
+
]
|
300
|
+
},
|
301
|
+
"hint": {
|
302
|
+
"type": "string",
|
303
|
+
"description": "Additional guidance text displayed below the component title",
|
304
|
+
"title": "Hint"
|
305
|
+
},
|
306
|
+
"options": {
|
307
|
+
"type": "object",
|
308
|
+
"description": "Component-specific configuration options",
|
309
|
+
"default": {},
|
310
|
+
"properties": {
|
311
|
+
"rows": {
|
312
|
+
"type": "number",
|
313
|
+
"description": "Number of rows for textarea components",
|
314
|
+
"title": "Rows"
|
315
|
+
},
|
316
|
+
"maxWords": {
|
317
|
+
"type": "number",
|
318
|
+
"description": "Maximum number of words allowed in text inputs",
|
319
|
+
"title": "Max Words"
|
320
|
+
},
|
321
|
+
"maxDaysInPast": {
|
322
|
+
"type": "number",
|
323
|
+
"description": "Maximum days in the past allowed for date inputs",
|
324
|
+
"title": "Max Days In Past"
|
325
|
+
},
|
326
|
+
"maxDaysInFuture": {
|
327
|
+
"type": "number",
|
328
|
+
"description": "Maximum days in the future allowed for date inputs",
|
329
|
+
"title": "Max Days In Future"
|
330
|
+
},
|
331
|
+
"customValidationMessage": {
|
332
|
+
"type": "string",
|
333
|
+
"description": "Custom error message for validation failures",
|
334
|
+
"title": "Custom Validation Message"
|
335
|
+
},
|
336
|
+
"customValidationMessages": {
|
337
|
+
"type": "object",
|
338
|
+
"description": "Custom error messages keyed by validation rule name",
|
339
|
+
"properties": {},
|
340
|
+
"additionalProperties": true,
|
341
|
+
"title": "Custom Validation Messages"
|
342
|
+
}
|
343
|
+
},
|
344
|
+
"additionalProperties": true,
|
345
|
+
"title": "Options"
|
346
|
+
},
|
347
|
+
"schema": {
|
348
|
+
"type": "object",
|
349
|
+
"description": "Validation rules for the component",
|
350
|
+
"default": {},
|
351
|
+
"properties": {
|
352
|
+
"min": {
|
353
|
+
"type": "number",
|
354
|
+
"description": "Minimum value or length for validation",
|
355
|
+
"title": "Min"
|
356
|
+
},
|
357
|
+
"max": {
|
358
|
+
"type": "number",
|
359
|
+
"description": "Maximum value or length for validation",
|
360
|
+
"title": "Max"
|
361
|
+
},
|
362
|
+
"length": {
|
363
|
+
"type": "number",
|
364
|
+
"description": "Exact length required for validation",
|
365
|
+
"title": "Length"
|
366
|
+
}
|
367
|
+
},
|
368
|
+
"additionalProperties": true,
|
369
|
+
"title": "Schema"
|
370
|
+
},
|
371
|
+
"list": {
|
372
|
+
"type": "string",
|
373
|
+
"description": "Reference to a predefined list of options for select components",
|
374
|
+
"title": "List"
|
375
|
+
},
|
376
|
+
"id": {
|
377
|
+
"type": "string",
|
378
|
+
"description": "Auto-generated unique identifier for the component",
|
379
|
+
"format": "uuid",
|
380
|
+
"title": "Id"
|
381
|
+
}
|
382
|
+
},
|
383
|
+
"required": [
|
384
|
+
"type"
|
385
|
+
],
|
386
|
+
"additionalProperties": true,
|
387
|
+
"title": "Components Item"
|
388
|
+
},
|
389
|
+
"title": "Components"
|
390
|
+
}
|
391
|
+
},
|
392
|
+
"required": [
|
393
|
+
"path",
|
394
|
+
"title"
|
395
|
+
],
|
396
|
+
"additionalProperties": false,
|
397
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
398
|
+
"title": "Page Schema Payload V2",
|
399
|
+
"$id": "@defra/forms-model/schemas/page-schema-payload-v2.json"
|
400
|
+
}
|