@ukhomeoffice/cop-react-form-renderer 2.8.4 → 2.10.0

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.
Files changed (68) hide show
  1. package/dist/components/CheckYourAnswers/CheckYourAnswers.js +8 -12
  2. package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +11 -9
  3. package/dist/components/FormComponent/Collection.js +244 -0
  4. package/dist/components/FormComponent/Collection.scss +23 -0
  5. package/dist/components/FormComponent/Container.js +110 -0
  6. package/dist/components/FormComponent/Container.test.js +26 -26
  7. package/dist/components/FormComponent/FormComponent.js +65 -128
  8. package/dist/components/FormComponent/FormComponent.test.js +19 -19
  9. package/dist/components/FormComponent/helpers/getComponentError.js +31 -0
  10. package/dist/components/FormComponent/helpers/getComponentError.test.js +52 -0
  11. package/dist/components/FormComponent/helpers/index.js +15 -0
  12. package/dist/components/FormPage/FormPage.js +7 -11
  13. package/dist/components/FormPage/FormPage.test.js +12 -76
  14. package/dist/components/FormRenderer/FormRenderer.js +103 -44
  15. package/dist/components/FormRenderer/helpers/canActionProceed.js +3 -12
  16. package/dist/components/FormRenderer/helpers/canActionProceed.test.js +41 -65
  17. package/dist/components/FormRenderer/helpers/canCYASubmit.js +3 -24
  18. package/dist/components/FormRenderer/helpers/canCYASubmit.test.js +72 -145
  19. package/dist/components/SummaryList/GroupAction.js +6 -2
  20. package/dist/components/SummaryList/SummaryList.js +33 -18
  21. package/dist/components/SummaryList/SummaryList.scss +12 -8
  22. package/dist/components/SummaryList/SummaryList.test.js +94 -27
  23. package/dist/components/SummaryList/SummaryListRow.js +51 -0
  24. package/dist/components/SummaryList/SummaryListTitleRow.js +30 -0
  25. package/dist/context/ValidationContext/ValidationContext.js +122 -0
  26. package/dist/context/ValidationContext/ValidationContext.test.js +98 -0
  27. package/dist/context/ValidationContext/index.js +23 -0
  28. package/dist/context/index.js +15 -0
  29. package/dist/hooks/index.js +8 -0
  30. package/dist/hooks/useValidation.js +19 -0
  31. package/dist/index.js +11 -5
  32. package/dist/json/group.json +1 -17
  33. package/dist/json/port.json +346 -0
  34. package/dist/json/sublocation.json +859 -0
  35. package/dist/json/terminal.json +81 -0
  36. package/dist/models/CollectionLabels.js +14 -0
  37. package/dist/models/ComponentTypes.js +2 -0
  38. package/dist/models/index.js +8 -0
  39. package/dist/setupTests.js +32 -0
  40. package/dist/utils/CheckYourAnswers/getCYARow.js +14 -0
  41. package/dist/utils/CheckYourAnswers/getCYARow.test.js +34 -11
  42. package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +1 -0
  43. package/dist/utils/CheckYourAnswers/getCYARowsForCollection.js +89 -0
  44. package/dist/utils/CheckYourAnswers/getCYARowsForCollection.test.js +194 -0
  45. package/dist/utils/CheckYourAnswers/getCYARowsForContainer.test.js +9 -13
  46. package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +11 -4
  47. package/dist/utils/CheckYourAnswers/getCYARowsForPage.test.js +58 -14
  48. package/dist/utils/Component/cleanAttributes.js +1 -1
  49. package/dist/utils/Component/getComponent.js +36 -3
  50. package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +92 -0
  51. package/dist/utils/Component/getDefaultValue.js +25 -0
  52. package/dist/utils/Component/getDefaultValue.test.js +53 -0
  53. package/dist/utils/Component/index.js +4 -1
  54. package/dist/utils/Meta/constants.js +10 -0
  55. package/dist/utils/Meta/documents/getDocuments.js +18 -0
  56. package/dist/utils/Meta/documents/getDocuments.test.js +43 -0
  57. package/dist/utils/Meta/documents/index.js +23 -0
  58. package/dist/utils/Meta/documents/setDocumentForField.js +36 -0
  59. package/dist/utils/Meta/documents/setDocumentForField.test.js +49 -0
  60. package/dist/utils/Meta/index.js +21 -0
  61. package/dist/utils/Validate/validateCollection.js +42 -0
  62. package/dist/utils/Validate/validateCollection.test.js +74 -0
  63. package/dist/utils/Validate/validateComponent.js +67 -48
  64. package/dist/utils/Validate/validateComponent.test.js +247 -188
  65. package/dist/utils/Validate/validateContainer.js +29 -0
  66. package/dist/utils/Validate/validateContainer.test.js +68 -0
  67. package/dist/utils/index.js +4 -1
  68. package/package.json +2 -2
@@ -0,0 +1,346 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "id": 5,
5
+ "countryid": 234,
6
+ "commandid": 27,
7
+ "locationid": null,
8
+ "name": "Abbotsbury",
9
+ "addressid": null,
10
+ "subdivision": "DOR",
11
+ "municipality": null,
12
+ "geolong": null,
13
+ "geolat": null,
14
+ "air": false,
15
+ "land": false,
16
+ "sea": true,
17
+ "rail": false,
18
+ "iata": null,
19
+ "icao": null,
20
+ "localcode": null,
21
+ "unlocode": "AOT",
22
+ "helipad": false,
23
+ "fixedpcp": null,
24
+ "portablepcp": null,
25
+ "egates": null,
26
+ "nonoperational": false,
27
+ "portsizeid": 3,
28
+ "juxtaposed": false,
29
+ "freightparcelposthub": false,
30
+ "validfrom": "2019-01-01T00:01:00.000Z",
31
+ "validto": null,
32
+ "updatedby": null
33
+ },
34
+ {
35
+ "id": 7947,
36
+ "countryid": 234,
37
+ "commandid": null,
38
+ "locationid": null,
39
+ "name": "Whitehall",
40
+ "addressid": null,
41
+ "subdivision": "NA",
42
+ "municipality": null,
43
+ "geolong": "-1.14934",
44
+ "geolat": "51.79353",
45
+ "air": true,
46
+ "land": false,
47
+ "sea": false,
48
+ "rail": false,
49
+ "iata": null,
50
+ "icao": null,
51
+ "localcode": null,
52
+ "unlocode": null,
53
+ "helipad": false,
54
+ "fixedpcp": null,
55
+ "portablepcp": null,
56
+ "egates": null,
57
+ "nonoperational": false,
58
+ "portsizeid": 3,
59
+ "juxtaposed": false,
60
+ "freightparcelposthub": false,
61
+ "validfrom": "2019-01-01T00:01:00.000Z",
62
+ "validto": null,
63
+ "updatedby": null
64
+ },
65
+ {
66
+ "id": 9887,
67
+ "countryid": 234,
68
+ "commandid": 20,
69
+ "locationid": null,
70
+ "name": "The Manor House Castle Combe",
71
+ "addressid": null,
72
+ "subdivision": "NA",
73
+ "municipality": null,
74
+ "geolong": "-2.23211",
75
+ "geolat": "51.49378",
76
+ "air": true,
77
+ "land": false,
78
+ "sea": false,
79
+ "rail": false,
80
+ "iata": null,
81
+ "icao": null,
82
+ "localcode": null,
83
+ "unlocode": null,
84
+ "helipad": true,
85
+ "fixedpcp": null,
86
+ "portablepcp": null,
87
+ "egates": null,
88
+ "nonoperational": false,
89
+ "portsizeid": 3,
90
+ "juxtaposed": false,
91
+ "freightparcelposthub": false,
92
+ "validfrom": "2019-01-01T00:01:00.000Z",
93
+ "validto": null,
94
+ "updatedby": null
95
+ },
96
+ {
97
+ "id": 13418,
98
+ "countryid": 14,
99
+ "commandid": null,
100
+ "locationid": null,
101
+ "name": "Ballast Head",
102
+ "addressid": null,
103
+ "subdivision": "SA",
104
+ "municipality": null,
105
+ "geolong": null,
106
+ "geolat": null,
107
+ "air": false,
108
+ "land": false,
109
+ "sea": true,
110
+ "rail": false,
111
+ "iata": null,
112
+ "icao": null,
113
+ "localcode": null,
114
+ "unlocode": "BAH",
115
+ "helipad": null,
116
+ "fixedpcp": null,
117
+ "portablepcp": null,
118
+ "egates": null,
119
+ "nonoperational": false,
120
+ "portsizeid": null,
121
+ "juxtaposed": false,
122
+ "freightparcelposthub": false,
123
+ "validfrom": "2019-01-01T00:01:00.000Z",
124
+ "validto": null,
125
+ "updatedby": null
126
+ },
127
+ {
128
+ "id": 17391,
129
+ "countryid": 22,
130
+ "commandid": null,
131
+ "locationid": null,
132
+ "name": "Thuin",
133
+ "addressid": null,
134
+ "subdivision": "WHT",
135
+ "municipality": null,
136
+ "geolong": "4.28333",
137
+ "geolat": "50.33333",
138
+ "air": false,
139
+ "land": false,
140
+ "sea": true,
141
+ "rail": false,
142
+ "iata": null,
143
+ "icao": null,
144
+ "localcode": null,
145
+ "unlocode": "THU",
146
+ "helipad": null,
147
+ "fixedpcp": null,
148
+ "portablepcp": null,
149
+ "egates": null,
150
+ "nonoperational": false,
151
+ "portsizeid": null,
152
+ "juxtaposed": false,
153
+ "freightparcelposthub": false,
154
+ "validfrom": "2019-01-01T00:01:00.000Z",
155
+ "validto": null,
156
+ "updatedby": null
157
+ },
158
+ {
159
+ "id": 27077,
160
+ "countryid": 47,
161
+ "commandid": null,
162
+ "locationid": null,
163
+ "name": "Pudongxinqu Pt",
164
+ "addressid": null,
165
+ "subdivision": "31",
166
+ "municipality": null,
167
+ "geolong": null,
168
+ "geolat": null,
169
+ "air": false,
170
+ "land": false,
171
+ "sea": true,
172
+ "rail": false,
173
+ "iata": null,
174
+ "icao": null,
175
+ "localcode": null,
176
+ "unlocode": "PDX",
177
+ "helipad": null,
178
+ "fixedpcp": null,
179
+ "portablepcp": null,
180
+ "egates": null,
181
+ "nonoperational": false,
182
+ "portsizeid": null,
183
+ "juxtaposed": false,
184
+ "freightparcelposthub": false,
185
+ "validfrom": "2019-01-01T00:01:00.000Z",
186
+ "validto": null,
187
+ "updatedby": null
188
+ },
189
+ {
190
+ "id": 52061,
191
+ "countryid": 80,
192
+ "commandid": null,
193
+ "locationid": null,
194
+ "name": "Jouques",
195
+ "addressid": null,
196
+ "subdivision": "13",
197
+ "municipality": null,
198
+ "geolong": "5.63333",
199
+ "geolat": "43.63333",
200
+ "air": false,
201
+ "land": false,
202
+ "sea": true,
203
+ "rail": false,
204
+ "iata": null,
205
+ "icao": null,
206
+ "localcode": null,
207
+ "unlocode": "QUU",
208
+ "helipad": null,
209
+ "fixedpcp": null,
210
+ "portablepcp": null,
211
+ "egates": null,
212
+ "nonoperational": false,
213
+ "portsizeid": null,
214
+ "juxtaposed": false,
215
+ "freightparcelposthub": false,
216
+ "validfrom": "2019-01-01T00:01:00.000Z",
217
+ "validto": null,
218
+ "updatedby": null
219
+ },
220
+ {
221
+ "id": 63838,
222
+ "countryid": 107,
223
+ "commandid": null,
224
+ "locationid": null,
225
+ "name": "Panjang",
226
+ "addressid": null,
227
+ "subdivision": null,
228
+ "municipality": null,
229
+ "geolong": null,
230
+ "geolat": null,
231
+ "air": false,
232
+ "land": false,
233
+ "sea": true,
234
+ "rail": false,
235
+ "iata": null,
236
+ "icao": null,
237
+ "localcode": null,
238
+ "unlocode": "PNJ",
239
+ "helipad": null,
240
+ "fixedpcp": null,
241
+ "portablepcp": null,
242
+ "egates": null,
243
+ "nonoperational": false,
244
+ "portsizeid": null,
245
+ "juxtaposed": false,
246
+ "freightparcelposthub": false,
247
+ "validfrom": "2019-01-01T00:01:00.000Z",
248
+ "validto": null,
249
+ "updatedby": null
250
+ },
251
+ {
252
+ "id": 78550,
253
+ "countryid": 155,
254
+ "commandid": null,
255
+ "locationid": null,
256
+ "name": "Hoek van Holland",
257
+ "addressid": null,
258
+ "subdivision": null,
259
+ "municipality": null,
260
+ "geolong": null,
261
+ "geolat": null,
262
+ "air": false,
263
+ "land": false,
264
+ "sea": true,
265
+ "rail": false,
266
+ "iata": null,
267
+ "icao": null,
268
+ "localcode": null,
269
+ "unlocode": "HVH",
270
+ "helipad": null,
271
+ "fixedpcp": null,
272
+ "portablepcp": null,
273
+ "egates": null,
274
+ "nonoperational": false,
275
+ "portsizeid": null,
276
+ "juxtaposed": false,
277
+ "freightparcelposthub": false,
278
+ "validfrom": "2019-01-01T00:01:00.000Z",
279
+ "validto": null,
280
+ "updatedby": null
281
+ },
282
+ {
283
+ "id": 102163,
284
+ "countryid": 238,
285
+ "commandid": null,
286
+ "locationid": null,
287
+ "name": "Lolita",
288
+ "addressid": null,
289
+ "subdivision": "TX",
290
+ "municipality": null,
291
+ "geolong": "-96.53333",
292
+ "geolat": "28.83333",
293
+ "air": false,
294
+ "land": false,
295
+ "sea": true,
296
+ "rail": false,
297
+ "iata": null,
298
+ "icao": null,
299
+ "localcode": null,
300
+ "unlocode": "OIT",
301
+ "helipad": null,
302
+ "fixedpcp": null,
303
+ "portablepcp": null,
304
+ "egates": null,
305
+ "nonoperational": false,
306
+ "portsizeid": null,
307
+ "juxtaposed": false,
308
+ "freightparcelposthub": false,
309
+ "validfrom": "2019-01-01T00:01:00.000Z",
310
+ "validto": null,
311
+ "updatedby": null
312
+ },
313
+ {
314
+ "id": 113626,
315
+ "countryid": 234,
316
+ "commandid": 6,
317
+ "locationid": null,
318
+ "name": "Rotterdam Central Station",
319
+ "addressid": null,
320
+ "subdivision": "ZH",
321
+ "municipality": null,
322
+ "geolong": "4.469093",
323
+ "geolat": "51.92468",
324
+ "air": false,
325
+ "land": false,
326
+ "sea": false,
327
+ "rail": true,
328
+ "iata": null,
329
+ "icao": null,
330
+ "localcode": null,
331
+ "unlocode": "RTM",
332
+ "helipad": null,
333
+ "fixedpcp": null,
334
+ "portablepcp": null,
335
+ "egates": null,
336
+ "nonoperational": false,
337
+ "portsizeid": 2,
338
+ "juxtaposed": true,
339
+ "freightparcelposthub": false,
340
+ "validfrom": "2022-01-11T00:00:01.000Z",
341
+ "validto": null,
342
+ "updatedby": "Mohammed Abdul Odud"
343
+ }
344
+ ]
345
+ }
346
+