@defra/forms-model 3.0.580 → 3.0.582

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 (89) hide show
  1. package/dist/module/__stubs__/components.js +46 -0
  2. package/dist/module/__stubs__/components.js.map +1 -1
  3. package/dist/module/components/component-types.js +8 -1
  4. package/dist/module/components/component-types.js.map +1 -1
  5. package/dist/module/components/enums.js +1 -0
  6. package/dist/module/components/enums.js.map +1 -1
  7. package/dist/module/components/types.js.map +1 -1
  8. package/dist/module/conditions/condition-operators.js +2 -1
  9. package/dist/module/conditions/condition-operators.js.map +1 -1
  10. package/dist/module/form/form-definition/helpers.js +19 -0
  11. package/dist/module/form/form-definition/helpers.js.map +1 -1
  12. package/dist/module/form/form-editor/__stubs__/preview.js +27 -1
  13. package/dist/module/form/form-editor/__stubs__/preview.js.map +1 -1
  14. package/dist/module/form/form-editor/index.js +1 -1
  15. package/dist/module/form/form-editor/index.js.map +1 -1
  16. package/dist/module/form/form-editor/macros/types.js.map +1 -1
  17. package/dist/module/form/form-editor/preview/easting-northing.js +42 -0
  18. package/dist/module/form/form-editor/preview/easting-northing.js.map +1 -0
  19. package/dist/module/form/form-editor/preview/helpers.js +28 -5
  20. package/dist/module/form/form-editor/preview/helpers.js.map +1 -1
  21. package/dist/module/form/form-editor/preview/hidden.js +9 -0
  22. package/dist/module/form/form-editor/preview/hidden.js.map +1 -0
  23. package/dist/module/form/form-editor/preview/index.js +5 -0
  24. package/dist/module/form/form-editor/preview/index.js.map +1 -1
  25. package/dist/module/form/form-editor/preview/lat-long.js +42 -0
  26. package/dist/module/form/form-editor/preview/lat-long.js.map +1 -0
  27. package/dist/module/form/form-editor/preview/location-helpers.js +44 -0
  28. package/dist/module/form/form-editor/preview/location-helpers.js.map +1 -0
  29. package/dist/module/form/form-editor/preview/location-question-base.js +62 -0
  30. package/dist/module/form/form-editor/preview/location-question-base.js.map +1 -0
  31. package/dist/module/form/form-editor/preview/national-grid.js +46 -0
  32. package/dist/module/form/form-editor/preview/national-grid.js.map +1 -0
  33. package/dist/module/form/form-editor/preview/os-grid-ref.js +46 -0
  34. package/dist/module/form/form-editor/preview/os-grid-ref.js.map +1 -0
  35. package/dist/module/form/form-editor/preview/types.js.map +1 -1
  36. package/dist/types/__stubs__/components.d.ts +5 -1
  37. package/dist/types/__stubs__/components.d.ts.map +1 -1
  38. package/dist/types/components/component-types.d.ts.map +1 -1
  39. package/dist/types/components/enums.d.ts +2 -1
  40. package/dist/types/components/enums.d.ts.map +1 -1
  41. package/dist/types/components/types.d.ts +7 -1
  42. package/dist/types/components/types.d.ts.map +1 -1
  43. package/dist/types/conditions/condition-operators.d.ts +1 -0
  44. package/dist/types/conditions/condition-operators.d.ts.map +1 -1
  45. package/dist/types/form/form-definition/helpers.d.ts +6 -0
  46. package/dist/types/form/form-definition/helpers.d.ts.map +1 -1
  47. package/dist/types/form/form-editor/__stubs__/preview.d.ts +18 -0
  48. package/dist/types/form/form-editor/__stubs__/preview.d.ts.map +1 -1
  49. package/dist/types/form/form-editor/index.d.ts.map +1 -1
  50. package/dist/types/form/form-editor/macros/types.d.ts +50 -0
  51. package/dist/types/form/form-editor/macros/types.d.ts.map +1 -1
  52. package/dist/types/form/form-editor/preview/easting-northing.d.ts +17 -0
  53. package/dist/types/form/form-editor/preview/easting-northing.d.ts.map +1 -0
  54. package/dist/types/form/form-editor/preview/helpers.d.ts.map +1 -1
  55. package/dist/types/form/form-editor/preview/hidden.d.ts +4 -0
  56. package/dist/types/form/form-editor/preview/hidden.d.ts.map +1 -0
  57. package/dist/types/form/form-editor/preview/index.d.ts +5 -0
  58. package/dist/types/form/form-editor/preview/lat-long.d.ts +17 -0
  59. package/dist/types/form/form-editor/preview/lat-long.d.ts.map +1 -0
  60. package/dist/types/form/form-editor/preview/location-helpers.d.ts +23 -0
  61. package/dist/types/form/form-editor/preview/location-helpers.d.ts.map +1 -0
  62. package/dist/types/form/form-editor/preview/location-question-base.d.ts +43 -0
  63. package/dist/types/form/form-editor/preview/location-question-base.d.ts.map +1 -0
  64. package/dist/types/form/form-editor/preview/national-grid.d.ts +17 -0
  65. package/dist/types/form/form-editor/preview/national-grid.d.ts.map +1 -0
  66. package/dist/types/form/form-editor/preview/os-grid-ref.d.ts +17 -0
  67. package/dist/types/form/form-editor/preview/os-grid-ref.d.ts.map +1 -0
  68. package/dist/types/form/form-editor/preview/types.d.ts +21 -2
  69. package/dist/types/form/form-editor/preview/types.d.ts.map +1 -1
  70. package/package.json +1 -1
  71. package/src/__stubs__/components.ts +62 -0
  72. package/src/components/component-types.ts +9 -1
  73. package/src/components/enums.ts +2 -1
  74. package/src/components/types.ts +8 -0
  75. package/src/conditions/condition-operators.ts +2 -1
  76. package/src/form/form-definition/helpers.ts +23 -0
  77. package/src/form/form-editor/__stubs__/preview.js +24 -1
  78. package/src/form/form-editor/index.ts +1 -0
  79. package/src/form/form-editor/macros/types.ts +54 -0
  80. package/src/form/form-editor/preview/easting-northing.js +55 -0
  81. package/src/form/form-editor/preview/helpers.js +42 -5
  82. package/src/form/form-editor/preview/hidden.js +9 -0
  83. package/src/form/form-editor/preview/index.js +5 -0
  84. package/src/form/form-editor/preview/lat-long.js +55 -0
  85. package/src/form/form-editor/preview/location-helpers.js +49 -0
  86. package/src/form/form-editor/preview/location-question-base.js +65 -0
  87. package/src/form/form-editor/preview/national-grid.js +56 -0
  88. package/src/form/form-editor/preview/os-grid-ref.js +56 -0
  89. package/src/form/form-editor/preview/types.ts +24 -2
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Creates the standard location field model with common properties
3
+ * @param {QuestionBaseModel} baseModel - The base model from super._renderInput()
4
+ * @param {LocationElements} htmlElements - The HTML elements containing values
5
+ * @param {string | null} highlight - The currently highlighted element
6
+ * @param {string} instructionText - The instruction text to display
7
+ * @param {string} titleText - The title text including optional suffix
8
+ * @returns {LocationFieldModel}
9
+ */
10
+ export function createLocationFieldModel(baseModel: QuestionBaseModel, htmlElements: LocationElements, highlight: string | null, instructionText: string, titleText: string): LocationFieldModel;
11
+ /**
12
+ * Creates field classes with highlight if needed
13
+ * @param {string} fieldName - The name of the field
14
+ * @param {string | null} highlight - The currently highlighted element
15
+ * @returns {{classes: string}}
16
+ */
17
+ export function createFieldClasses(fieldName: string, highlight: string | null): {
18
+ classes: string;
19
+ };
20
+ import type { QuestionBaseModel } from '../../../form/form-editor/preview/types.js';
21
+ import type { LocationElements } from '../../../form/form-editor/preview/types.js';
22
+ import type { LocationFieldModel } from '../../../form/form-editor/preview/types.js';
23
+ //# sourceMappingURL=location-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location-helpers.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/location-helpers.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,oDAPW,iBAAiB,gBACjB,gBAAgB,aAChB,MAAM,GAAG,IAAI,mBACb,MAAM,aACN,MAAM,GACJ,kBAAkB,CAuB9B;AAED;;;;;GAKG;AACH,8CAJW,MAAM,aACN,MAAM,GAAG,IAAI,GACX;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,CAM7B;uCAG2E,yCAAyC;sCAAzC,yCAAyC;wCAAzC,yCAAyC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Base class for location question component preview elements with instruction text support
3
+ * @implements {QuestionElements}
4
+ */
5
+ export class LocationQuestionComponentPreviewElements extends QuestionComponentElements implements QuestionElements {
6
+ /**
7
+ * @param {any} component - Component with options.instructionText
8
+ */
9
+ constructor(component: any);
10
+ _instructionText: any;
11
+ /**
12
+ * @protected
13
+ * @returns {LocationSettings}
14
+ */
15
+ protected _getValues(): LocationSettings;
16
+ }
17
+ /**
18
+ * Base class for location questions with instruction text support
19
+ */
20
+ export class LocationQuestion extends Question {
21
+ /**
22
+ * @param {LocationElements} htmlElements
23
+ * @param {QuestionRenderer} questionRenderer
24
+ */
25
+ constructor(htmlElements: LocationElements, questionRenderer: QuestionRenderer);
26
+ /**
27
+ * @type {string}
28
+ * @protected
29
+ */
30
+ protected _instructionText: string;
31
+ /**
32
+ * @param {string} val
33
+ */
34
+ set instructionText(val: string);
35
+ get instructionText(): string;
36
+ }
37
+ import type { QuestionElements } from '../../../form/form-editor/preview/types.js';
38
+ import { QuestionComponentElements } from '../../../form/form-editor/preview/question.js';
39
+ import type { LocationSettings } from '../../../form/form-editor/preview/types.js';
40
+ import { Question } from '../../../form/form-editor/preview/question.js';
41
+ import type { LocationElements } from '../../../form/form-editor/preview/types.js';
42
+ import type { QuestionRenderer } from '../../../form/form-editor/preview/types.js';
43
+ //# sourceMappingURL=location-question-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location-question-base.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/location-question-base.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH;IACE;;OAEG;IACH,uBAFW,GAAG,EAKb;IADC,sBAA+D;IAGjE;;;OAGG;IACH,wBAFa,gBAAgB,CAO5B;CACF;AAED;;GAEG;AACH;IAOE;;;OAGG;IACH,0BAHW,gBAAgB,oBAChB,gBAAgB,EAK1B;IAbD;;;OAGG;IACH,4BAHU,MAAM,CAGK;IAerB;;OAEG;IACH,yBAFW,MAAM,EAKhB;IAVD,uBAKW,MAAM,CAHhB;CASF;sCAG0F,yCAAyC;0CA5D7H,4CAA4C;sCA4DwC,yCAAyC;yBA5D7H,4CAA4C;sCA4DwC,yCAAyC;sCAAzC,yCAAyC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @implements {QuestionElements}
3
+ */
4
+ export class NationalGridComponentPreviewElements extends LocationQuestionComponentPreviewElements implements QuestionElements {
5
+ }
6
+ export class NationalGridQuestion extends LocationQuestion {
7
+ /**
8
+ * @protected
9
+ * @returns {NationalGridModel}
10
+ */
11
+ protected _renderInput(): NationalGridModel;
12
+ }
13
+ import type { QuestionElements } from '../../../form/form-editor/preview/types.js';
14
+ import { LocationQuestionComponentPreviewElements } from '../../../form/form-editor/preview/location-question-base.js';
15
+ import { LocationQuestion } from '../../../form/form-editor/preview/location-question-base.js';
16
+ import type { NationalGridModel } from '../../../form/form-editor/macros/types.js';
17
+ //# sourceMappingURL=national-grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"national-grid.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/national-grid.js"],"names":[],"mappings":"AASA;;GAEG;AACH;CAAqG;AAErG;IAYE;;;OAGG;IACH,0BAFa,iBAAiB,CAoB7B;CACF;sCAG0F,yCAAyC;yDA9C7H,0DAA0D;iCAA1D,0DAA0D;uCA+C3B,wCAAwC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @implements {QuestionElements}
3
+ */
4
+ export class OsGridRefComponentPreviewElements extends LocationQuestionComponentPreviewElements implements QuestionElements {
5
+ }
6
+ export class OsGridRefQuestion extends LocationQuestion {
7
+ /**
8
+ * @protected
9
+ * @returns {OsGridRefModel}
10
+ */
11
+ protected _renderInput(): OsGridRefModel;
12
+ }
13
+ import type { QuestionElements } from '../../../form/form-editor/preview/types.js';
14
+ import { LocationQuestionComponentPreviewElements } from '../../../form/form-editor/preview/location-question-base.js';
15
+ import { LocationQuestion } from '../../../form/form-editor/preview/location-question-base.js';
16
+ import type { OsGridRefModel } from '../../../form/form-editor/macros/types.js';
17
+ //# sourceMappingURL=os-grid-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"os-grid-ref.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/os-grid-ref.js"],"names":[],"mappings":"AASA;;GAEG;AACH;CAAkG;AAElG;IAYE;;;OAGG;IACH,0BAFa,cAAc,CAoB1B;CACF;sCAG0F,yCAAyC;yDA9C7H,0DAA0D;iCAA1D,0DAA0D;oCA+C9B,wCAAwC"}
@@ -32,8 +32,8 @@ export interface GovukFieldset {
32
32
  legend: DefaultComponent;
33
33
  }
34
34
  export type ListenerRow = [
35
- HTMLInputElement | null,
36
- (target: HTMLInputElement, e: Event) => void,
35
+ HTMLInputElement | HTMLTextAreaElement | null,
36
+ (target: HTMLInputElement | HTMLTextAreaElement, e: Event) => void,
37
37
  keyof HTMLElementEventMap
38
38
  ];
39
39
  export interface DomElementsBase {
@@ -67,6 +67,25 @@ export interface UkAddressElements extends DomElementsBase {
67
67
  export interface NumberElements extends DomElementsBase {
68
68
  readonly values: NumberSettings;
69
69
  }
70
+ export interface LocationSettings extends BaseSettings {
71
+ instructionText: string;
72
+ }
73
+ export interface LocationElements extends DomElementsBase {
74
+ readonly values: LocationSettings;
75
+ }
76
+ export interface LocationFieldModel extends QuestionBaseModel {
77
+ userClasses: string;
78
+ fieldset: {
79
+ legend: {
80
+ text: string;
81
+ classes: string;
82
+ };
83
+ };
84
+ instructionText: string;
85
+ details: {
86
+ classes: string;
87
+ };
88
+ }
70
89
  export interface RenderBase {
71
90
  render(questionTemplate: string, renderContext: RenderContext): void;
72
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACvB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,gDAAgD,CAAA;AAC1F,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AACrF,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,iDAAiD,CAAA;AAC3F,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,iDAAiD,CAAA;AAC3F,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,+CAA+C,CAAA;AACvF,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gDAAgD,CAAA;AACzF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,4CAA4C,CAAA;AAC1E,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,kDAAkD,CAAA;AAC7F,OAAO,EAAE,KAAK,s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mB,GACnB,QAAQ,GACR,qBAAqB,GACrB,sBAAsB,GACtB,mBAAmB,GACnB,iBAAiB,GACjB,oBAAoB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-model",
3
- "version": "3.0.580",
3
+ "version": "3.0.582",
4
4
  "description": "A hapi plugin providing the model for Defra forms",
5
5
  "homepage": "https://github.com/DEFRA/forms-designer/tree/main/model#readme",
6
6
  "types": "dist/types/index.d.ts",
@@ -5,15 +5,19 @@ import {
5
5
  type DatePartsFieldComponent,
6
6
  type DeclarationFieldComponent,
7
7
  type DetailsComponent,
8
+ type EastingNorthingFieldComponent,
8
9
  type EmailAddressFieldComponent,
9
10
  type FileUploadFieldComponent,
10
11
  type HtmlComponent,
11
12
  type InsetTextComponent,
13
+ type LatLongFieldComponent,
12
14
  type ListComponent,
13
15
  type MarkdownComponent,
14
16
  type MonthYearFieldComponent,
15
17
  type MultilineTextFieldComponent,
18
+ type NationalGridFieldNumberFieldComponent,
16
19
  type NumberFieldComponent,
20
+ type OsGridRefFieldComponent,
17
21
  type RadiosFieldComponent,
18
22
  type SelectFieldComponent,
19
23
  type TelephoneNumberFieldComponent,
@@ -369,3 +373,61 @@ export function buildRadiosComponent(
369
373
  type: ComponentType.RadiosField
370
374
  }
371
375
  }
376
+
377
+ export function buildEastingNorthingFieldComponent(
378
+ partialComponent: Partial<EastingNorthingFieldComponent> = {}
379
+ ): EastingNorthingFieldComponent {
380
+ return {
381
+ id: '1a2b3c4d-5e6f-7g8h-9i0j-1k2l3m4n5o6p',
382
+ name: 'EastingNorthingField',
383
+ title: 'Easting and northing',
384
+ hint: 'For example, Easting: 248741, Northing: 63688',
385
+ options: {},
386
+ schema: {},
387
+ ...partialComponent,
388
+ type: ComponentType.EastingNorthingField
389
+ }
390
+ }
391
+
392
+ export function buildLatLongFieldComponent(
393
+ partialComponent: Partial<LatLongFieldComponent> = {}
394
+ ): LatLongFieldComponent {
395
+ return {
396
+ id: '2b3c4d5e-6f7g-8h9i-0j1k-2l3m4n5o6p7q',
397
+ name: 'LatLongField',
398
+ title: 'Latitude and longitude',
399
+ hint: 'For example, Latitude: 51.5074, Longitude: -0.1278',
400
+ options: {},
401
+ schema: {},
402
+ ...partialComponent,
403
+ type: ComponentType.LatLongField
404
+ }
405
+ }
406
+
407
+ export function buildNationalGridFieldNumberFieldComponent(
408
+ partialComponent: Partial<NationalGridFieldNumberFieldComponent> = {}
409
+ ): NationalGridFieldNumberFieldComponent {
410
+ return {
411
+ id: '3c4d5e6f-7g8h-9i0j-1k2l-3m4n5o6p7q8r',
412
+ name: 'NationalGridFieldNumberField',
413
+ title: 'National Grid field number',
414
+ hint: 'A National Grid field number is made up of 2 letters and 8 numbers, for example, SO04188589',
415
+ options: {},
416
+ ...partialComponent,
417
+ type: ComponentType.NationalGridFieldNumberField
418
+ }
419
+ }
420
+
421
+ export function buildOsGridRefFieldComponent(
422
+ partialComponent: Partial<OsGridRefFieldComponent> = {}
423
+ ): OsGridRefFieldComponent {
424
+ return {
425
+ id: '4d5e6f7g-8h9i-0j1k-2l3m-4n5o6p7q8r9s',
426
+ name: 'OsGridRefField',
427
+ title: 'Ordnance Survey (OS) grid reference',
428
+ hint: 'An OS grid reference number is made up of 2 letters followed by 6 numbers, for example, TQ123456',
429
+ options: {},
430
+ ...partialComponent,
431
+ type: ComponentType.OsGridRefField
432
+ }
433
+ }
@@ -163,7 +163,7 @@ export const ComponentTypes: readonly ComponentDef[] = Object.freeze([
163
163
  name: 'OsGridRefField',
164
164
  title: 'Ordnance Survey (OS) grid reference',
165
165
  type: ComponentType.OsGridRefField,
166
- hint: 'An OS grid reference number is made up of 2 letters followed by 10 numbers, for example, SO7394301364',
166
+ hint: 'An OS grid reference number is made up of 2 letters followed by 6 numbers, for example, TQ123456',
167
167
  options: {}
168
168
  },
169
169
  {
@@ -179,5 +179,13 @@ export const ComponentTypes: readonly ComponentDef[] = Object.freeze([
179
179
  type: ComponentType.LatLongField,
180
180
  hint: 'For Great Britain, the latitude will be a number between 49.850 and 60.859. The longitude will be a number between -13.687 and 1.767',
181
181
  options: {}
182
+ },
183
+ {
184
+ name: 'HiddenField',
185
+ title: 'Hidden field',
186
+ type: ComponentType.HiddenField,
187
+ hint: '',
188
+ options: {},
189
+ schema: {}
182
190
  }
183
191
  ])
@@ -22,5 +22,6 @@ export enum ComponentType {
22
22
  EastingNorthingField = 'EastingNorthingField',
23
23
  OsGridRefField = 'OsGridRefField',
24
24
  NationalGridFieldNumberField = 'NationalGridFieldNumberField',
25
- LatLongField = 'LatLongField'
25
+ LatLongField = 'LatLongField',
26
+ HiddenField = 'HiddenField'
26
27
  }
@@ -230,6 +230,13 @@ export interface LatLongFieldComponent extends FormFieldBase {
230
230
  }
231
231
  }
232
232
 
233
+ export interface HiddenFieldComponent extends FormFieldBase {
234
+ type: ComponentType.HiddenField
235
+ options: FormFieldBase['options'] & {
236
+ condition?: string
237
+ }
238
+ }
239
+
233
240
  // Date Fields
234
241
  export interface DatePartsFieldComponent extends DateFieldBase {
235
242
  type: ComponentType.DatePartsField
@@ -341,6 +348,7 @@ export type InputFieldsComponentsDef =
341
348
  | OsGridRefFieldComponent
342
349
  | NationalGridFieldNumberFieldComponent
343
350
  | LatLongFieldComponent
351
+ | HiddenFieldComponent
344
352
 
345
353
  // Components that render content
346
354
  export type ContentComponentsDef =
@@ -85,7 +85,8 @@ export const customOperators = {
85
85
  [ComponentType.EastingNorthingField]: defaultOperators,
86
86
  [ComponentType.OsGridRefField]: defaultOperators,
87
87
  [ComponentType.NationalGridFieldNumberField]: defaultOperators,
88
- [ComponentType.LatLongField]: defaultOperators
88
+ [ComponentType.LatLongField]: defaultOperators,
89
+ [ComponentType.HiddenField]: undefined
89
90
  }
90
91
 
91
92
  export function getOperatorNames(fieldType?: ConditionalComponentType) {
@@ -1,5 +1,8 @@
1
+ import { ComponentType } from '~/src/components/enums.js'
2
+ import { type ComponentDef } from '~/src/components/types.js'
1
3
  import { type ConditionListItemRefValueDataV2 } from '~/src/conditions/types.js'
2
4
  import { type FormDefinition } from '~/src/form/form-definition/types.js'
5
+ import { hasComponents } from '~/src/pages/helpers.js'
3
6
 
4
7
  /**
5
8
  * TypeGuard to check if something is a FormDefinition
@@ -39,3 +42,23 @@ export function isConditionListItemRefValueData(
39
42
  'itemId' in conditionValueData
40
43
  )
41
44
  }
45
+
46
+ /**
47
+ * Returns an array of all hidden fields in a form
48
+ * @param definition - form definition
49
+ */
50
+ export function getHiddenFields(definition: FormDefinition) {
51
+ if (definition.pages.length === 0) {
52
+ return []
53
+ }
54
+ const totalHiddenFields = [] as ComponentDef[]
55
+ for (const page of definition.pages) {
56
+ const hiddenFields = hasComponents(page)
57
+ ? page.components.filter(
58
+ (comp) => comp.type === ComponentType.HiddenField
59
+ )
60
+ : []
61
+ totalHiddenFields.push(...hiddenFields)
62
+ }
63
+ return totalHiddenFields
64
+ }
@@ -213,6 +213,29 @@ export class DeclarationPreviewElements extends QuestionPreviewElements {
213
213
  }
214
214
  }
215
215
 
216
+ /**
217
+ * @implements {LocationElements}
218
+ */
219
+ export class LocationPreviewElements extends QuestionPreviewElements {
220
+ /**
221
+ * @param {BaseSettings & {instructionText?: string}} elements
222
+ */
223
+ constructor({ instructionText, ...elements }) {
224
+ super(elements)
225
+ this._instructionText = instructionText ?? ''
226
+ }
227
+
228
+ /**
229
+ * @returns {LocationSettings}
230
+ */
231
+ get values() {
232
+ return {
233
+ ...super.values,
234
+ instructionText: this._instructionText
235
+ }
236
+ }
237
+ }
238
+
216
239
  /**
217
240
  * @implements {PageOverviewElements}
218
241
  */
@@ -429,5 +452,5 @@ export class NumberPreviewElements {
429
452
  /**
430
453
  * @import { ListElement } from '~/src/form/form-editor/types.js'
431
454
  * @import { PagePreviewPanelMacro } from '~/src/form/form-editor/macros/types.js'
432
- * @import { BaseSettings, ListElements, NumberSettings, RenderContext, QuestionBaseModel, QuestionRenderer, AutocompleteElements, PageOverviewElements, PageRenderer, UkAddressElements, UkAddressSettings, DeclarationElements, DeclarationSettings } from '~/src/form/form-editor/preview/types.js'
455
+ * @import { BaseSettings, ListElements, NumberSettings, RenderContext, QuestionBaseModel, QuestionRenderer, AutocompleteElements, PageOverviewElements, PageRenderer, UkAddressElements, UkAddressSettings, DeclarationElements, DeclarationSettings, LocationElements, LocationSettings } from '~/src/form/form-editor/preview/types.js'
433
456
  */
@@ -100,6 +100,7 @@ export const listSubSchema = Joi.string()
100
100
  export const locationSubSchema = Joi.string()
101
101
  .required()
102
102
  .valid(
103
+ ComponentType.UkAddressField,
103
104
  ComponentType.EastingNorthingField,
104
105
  ComponentType.OsGridRefField,
105
106
  ComponentType.NationalGridFieldNumberField,
@@ -67,6 +67,60 @@ export interface DeclarationModel extends QuestionBaseModel {
67
67
  }
68
68
  }
69
69
 
70
+ export interface EastingNorthingModel extends QuestionBaseModel {
71
+ fieldset?: {
72
+ legend: {
73
+ text: string
74
+ classes: string
75
+ }
76
+ }
77
+ easting?: {
78
+ classes?: string
79
+ }
80
+ northing?: {
81
+ classes?: string
82
+ }
83
+ instructionText?: string
84
+ details?: {
85
+ classes?: string
86
+ }
87
+ }
88
+
89
+ export interface OsGridRefModel extends QuestionBaseModel {
90
+ inputClasses?: string
91
+ instructionText?: string
92
+ details?: {
93
+ classes?: string
94
+ }
95
+ }
96
+
97
+ export interface NationalGridModel extends QuestionBaseModel {
98
+ inputClasses?: string
99
+ instructionText?: string
100
+ details?: {
101
+ classes?: string
102
+ }
103
+ }
104
+
105
+ export interface LatLongModel extends QuestionBaseModel {
106
+ fieldset?: {
107
+ legend: {
108
+ text: string
109
+ classes: string
110
+ }
111
+ }
112
+ latitude?: {
113
+ classes?: string
114
+ }
115
+ longitude?: {
116
+ classes?: string
117
+ }
118
+ instructionText?: string
119
+ details?: {
120
+ classes?: string
121
+ }
122
+ }
123
+
70
124
  export interface AppPreviewPanelMacro extends AppPreviewPanelTabsMacro {
71
125
  model: QuestionBaseModel
72
126
  }
@@ -0,0 +1,55 @@
1
+ import { ComponentType } from '~/src/components/enums.js'
2
+ import {
3
+ createFieldClasses,
4
+ createLocationFieldModel
5
+ } from '~/src/form/form-editor/preview/location-helpers.js'
6
+ import {
7
+ LocationQuestion,
8
+ LocationQuestionComponentPreviewElements
9
+ } from '~/src/form/form-editor/preview/location-question-base.js'
10
+ import { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'
11
+
12
+ /**
13
+ * @implements {QuestionElements}
14
+ */
15
+ export class EastingNorthingComponentPreviewElements extends LocationQuestionComponentPreviewElements {}
16
+
17
+ export class EastingNorthingQuestion extends LocationQuestion {
18
+ /**
19
+ * @type {ComponentType}
20
+ */
21
+ componentType = ComponentType.EastingNorthingField
22
+ /**
23
+ * @type {string}
24
+ * @protected
25
+ */
26
+ _questionTemplate = PreviewComponent.PATH + 'eastingnorthingfield.njk'
27
+ _fieldName = 'EastingNorthingField'
28
+
29
+ /**
30
+ * @protected
31
+ * @returns {EastingNorthingModel}
32
+ */
33
+ _renderInput() {
34
+ const baseModel = super._renderInput()
35
+ const locationModel = createLocationFieldModel(
36
+ baseModel,
37
+ /** @type {LocationElements} */ (this._htmlElements),
38
+ this._highlight,
39
+ this._instructionText,
40
+ this.titleText
41
+ )
42
+
43
+ return {
44
+ ...locationModel,
45
+ easting: createFieldClasses('easting', this._highlight),
46
+ northing: createFieldClasses('northing', this._highlight)
47
+ }
48
+ }
49
+ }
50
+
51
+ /**
52
+ * @import { LocationSettings, LocationElements, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'
53
+ * @import { EastingNorthingModel } from '~/src/form/form-editor/macros/types.js'
54
+ * @import { EastingNorthingFieldComponent } from '~/src/components/types.js'
55
+ */
@@ -14,7 +14,16 @@ import {
14
14
  DeclarationComponentPreviewElements,
15
15
  DeclarationQuestion
16
16
  } from '~/src/form/form-editor/preview/declaration.js'
17
+ import {
18
+ EastingNorthingComponentPreviewElements,
19
+ EastingNorthingQuestion
20
+ } from '~/src/form/form-editor/preview/easting-northing.js'
17
21
  import { EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'
22
+ import { HiddenQuestion } from '~/src/form/form-editor/preview/hidden.js'
23
+ import {
24
+ LatLongComponentPreviewElements,
25
+ LatLongQuestion
26
+ } from '~/src/form/form-editor/preview/lat-long.js'
18
27
  import {
19
28
  ListComponentElements,
20
29
  ListQuestion,
@@ -23,10 +32,18 @@ import {
23
32
  import { LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'
24
33
  import { Markdown } from '~/src/form/form-editor/preview/markdown.js'
25
34
  import { MonthYearQuestion } from '~/src/form/form-editor/preview/month-year.js'
35
+ import {
36
+ NationalGridComponentPreviewElements,
37
+ NationalGridQuestion
38
+ } from '~/src/form/form-editor/preview/national-grid.js'
26
39
  import {
27
40
  NumberComponentPreviewElements,
28
41
  NumberOnlyQuestion
29
42
  } from '~/src/form/form-editor/preview/number-only.js'
43
+ import {
44
+ OsGridRefComponentPreviewElements,
45
+ OsGridRefQuestion
46
+ } from '~/src/form/form-editor/preview/os-grid-ref.js'
30
47
  import { PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'
31
48
  import { QuestionComponentElements } from '~/src/form/form-editor/preview/question.js'
32
49
  import { RadioQuestion } from '~/src/form/form-editor/preview/radio.js'
@@ -63,10 +80,11 @@ const InputFieldComponentDictionary = {
63
80
  [ComponentType.YesNoField]: YesNoQuestion,
64
81
  [ComponentType.DeclarationField]: DeclarationQuestion,
65
82
  [ComponentType.FileUploadField]: SupportingEvidenceQuestion,
66
- [ComponentType.EastingNorthingField]: ShortAnswerQuestion,
67
- [ComponentType.OsGridRefField]: ShortAnswerQuestion,
68
- [ComponentType.NationalGridFieldNumberField]: ShortAnswerQuestion,
69
- [ComponentType.LatLongField]: ShortAnswerQuestion
83
+ [ComponentType.EastingNorthingField]: EastingNorthingQuestion,
84
+ [ComponentType.OsGridRefField]: OsGridRefQuestion,
85
+ [ComponentType.NationalGridFieldNumberField]: NationalGridQuestion,
86
+ [ComponentType.LatLongField]: LatLongQuestion,
87
+ [ComponentType.HiddenField]: HiddenQuestion
70
88
  }
71
89
 
72
90
  /**
@@ -102,6 +120,25 @@ const ComponentToPreviewQuestion = {
102
120
  [ComponentType.YesNoField]: (component, _definition) => {
103
121
  const componentCoerced = /** @type {YesNoFieldComponent} */ (component)
104
122
  return new QuestionComponentElements(componentCoerced)
123
+ },
124
+ [ComponentType.EastingNorthingField]: (component, _definition) => {
125
+ const componentCoerced = /** @type {EastingNorthingFieldComponent} */ (
126
+ component
127
+ )
128
+ return new EastingNorthingComponentPreviewElements(componentCoerced)
129
+ },
130
+ [ComponentType.OsGridRefField]: (component, _definition) => {
131
+ const componentCoerced = /** @type {OsGridRefFieldComponent} */ (component)
132
+ return new OsGridRefComponentPreviewElements(componentCoerced)
133
+ },
134
+ [ComponentType.NationalGridFieldNumberField]: (component, _definition) => {
135
+ const componentCoerced =
136
+ /** @type {NationalGridFieldNumberFieldComponent} */ (component)
137
+ return new NationalGridComponentPreviewElements(componentCoerced)
138
+ },
139
+ [ComponentType.LatLongField]: (component, _definition) => {
140
+ const componentCoerced = /** @type {LatLongFieldComponent} */ (component)
141
+ return new LatLongComponentPreviewElements(componentCoerced)
105
142
  }
106
143
  }
107
144
 
@@ -150,5 +187,5 @@ export function mapComponentToPreviewQuestion(questionRenderer, definition) {
150
187
  * @import { Question } from '~/src/form/form-editor/preview/question.js'
151
188
  * @import { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'
152
189
  * @import { FormDefinition } from '~/src/form/form-definition/types.js'
153
- * @import { AutocompleteFieldComponent, ComponentDef, DeclarationFieldComponent, NumberFieldComponent, SelectFieldComponent, UkAddressFieldComponent, YesNoFieldComponent } from '~/src/components/types.js'
190
+ * @import { AutocompleteFieldComponent, ComponentDef, DeclarationFieldComponent, EastingNorthingFieldComponent, LatLongFieldComponent, NationalGridFieldNumberFieldComponent, NumberFieldComponent, OsGridRefFieldComponent, SelectFieldComponent, UkAddressFieldComponent, YesNoFieldComponent } from '~/src/components/types.js'
154
191
  */
@@ -0,0 +1,9 @@
1
+ import { ComponentType } from '~/src/components/enums.js'
2
+ import { Question } from '~/src/form/form-editor/preview/question.js'
3
+
4
+ export class HiddenQuestion extends Question {
5
+ /**
6
+ * @type {ComponentType}
7
+ */
8
+ componentType = ComponentType.HiddenField
9
+ }
@@ -3,12 +3,16 @@ export * from '~/src/form/form-editor/preview/checkbox.js'
3
3
  export * from '~/src/form/form-editor/preview/checkbox-sortable.js'
4
4
  export * from '~/src/form/form-editor/preview/date-input.js'
5
5
  export * from '~/src/form/form-editor/preview/declaration.js'
6
+ export * from '~/src/form/form-editor/preview/easting-northing.js'
6
7
  export * from '~/src/form/form-editor/preview/email-address.js'
8
+ export * from '~/src/form/form-editor/preview/lat-long.js'
7
9
  export * from '~/src/form/form-editor/preview/list.js'
8
10
  export * from '~/src/form/form-editor/preview/list-sortable.js'
9
11
  export * from '~/src/form/form-editor/preview/markdown.js'
10
12
  export * from '~/src/form/form-editor/preview/month-year.js'
13
+ export * from '~/src/form/form-editor/preview/national-grid.js'
11
14
  export * from '~/src/form/form-editor/preview/number-only.js'
15
+ export * from '~/src/form/form-editor/preview/os-grid-ref.js'
12
16
  export * from '~/src/form/form-editor/preview/phone-number.js'
13
17
  export * from '~/src/form/form-editor/preview/question.js'
14
18
  export * from '~/src/form/form-editor/preview/radio.js'
@@ -21,6 +25,7 @@ export * from '~/src/form/form-editor/preview/supporting-evidence.js'
21
25
  export * from '~/src/form/form-editor/preview/long-answer.js'
22
26
  export * from '~/src/form/form-editor/preview/uk-address.js'
23
27
  export * from '~/src/form/form-editor/preview/yes-no.js'
28
+ export * from '~/src/form/form-editor/preview/hidden.js'
24
29
  export * from '~/src/form/form-editor/preview/controller/page-controller-base.js'
25
30
  export * from '~/src/form/form-editor/preview/controller/page-controller.js'
26
31
  export * from '~/src/form/form-editor/preview/controller/guidance-page-controller.js'