@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
@@ -289,4 +289,50 @@ export function buildRadiosComponent(partialComponent = {}) {
289
289
  type: ComponentType.RadiosField
290
290
  };
291
291
  }
292
+ export function buildEastingNorthingFieldComponent(partialComponent = {}) {
293
+ return {
294
+ id: '1a2b3c4d-5e6f-7g8h-9i0j-1k2l3m4n5o6p',
295
+ name: 'EastingNorthingField',
296
+ title: 'Easting and northing',
297
+ hint: 'For example, Easting: 248741, Northing: 63688',
298
+ options: {},
299
+ schema: {},
300
+ ...partialComponent,
301
+ type: ComponentType.EastingNorthingField
302
+ };
303
+ }
304
+ export function buildLatLongFieldComponent(partialComponent = {}) {
305
+ return {
306
+ id: '2b3c4d5e-6f7g-8h9i-0j1k-2l3m4n5o6p7q',
307
+ name: 'LatLongField',
308
+ title: 'Latitude and longitude',
309
+ hint: 'For example, Latitude: 51.5074, Longitude: -0.1278',
310
+ options: {},
311
+ schema: {},
312
+ ...partialComponent,
313
+ type: ComponentType.LatLongField
314
+ };
315
+ }
316
+ export function buildNationalGridFieldNumberFieldComponent(partialComponent = {}) {
317
+ return {
318
+ id: '3c4d5e6f-7g8h-9i0j-1k2l-3m4n5o6p7q8r',
319
+ name: 'NationalGridFieldNumberField',
320
+ title: 'National Grid field number',
321
+ hint: 'A National Grid field number is made up of 2 letters and 8 numbers, for example, SO04188589',
322
+ options: {},
323
+ ...partialComponent,
324
+ type: ComponentType.NationalGridFieldNumberField
325
+ };
326
+ }
327
+ export function buildOsGridRefFieldComponent(partialComponent = {}) {
328
+ return {
329
+ id: '4d5e6f7g-8h9i-0j1k-2l3m-4n5o6p7q8r9s',
330
+ name: 'OsGridRefField',
331
+ title: 'Ordnance Survey (OS) grid reference',
332
+ hint: 'An OS grid reference number is made up of 2 letters followed by 6 numbers, for example, TQ123456',
333
+ options: {},
334
+ ...partialComponent,
335
+ type: ComponentType.OsGridRefField
336
+ };
337
+ }
292
338
  //# sourceMappingURL=components.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","names":["ComponentType","buildTextFieldComponent","partialTextField","id","name","title","hint","options","schema","type","TextField","buildMultilineTextFieldComponent","partialMultilineTextField","MultilineTextField","buildYesNoFieldComponent","partialYesNoField","YesNoField","buildDeclarationFieldComponent","partialDeclarationField","content","DeclarationField","buildMonthYearFieldComponent","partialMonthYearField","MonthYearField","buildSelectFieldComponent","partialSelectField","list","SelectField","buildUkAddressFieldComponent","partialUkAddressField","UkAddressField","buildTelephoneNumberFieldComponent","partialTelephoneNumberField","TelephoneNumberField","buildEmailAddressFieldComponent","partialEmailAddressField","EmailAddressField","buildHtmlComponent","partialHtml","Html","buildInsetTextComponent","partialInsetText","InsetText","buildDetailsComponent","partialDetails","Details","buildListComponent","partialList","List","buildMarkdownComponent","partialMarkdown","Markdown","buildFileUploadComponent","partialFileUploadField","FileUploadField","buildAutoCompleteComponent","partialAutoCompleteField","AutocompleteField","buildRadioComponent","partialListComponent","RadiosField","buildCheckboxComponent","CheckboxesField","buildListItem","partialListItem","text","value","buildList","items","buildNumberFieldComponent","partialComponent","NumberField","buildDateComponent","DatePartsField","buildRadiosComponent"],"sources":["../../../src/__stubs__/components.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n type AutocompleteFieldComponent,\n type CheckboxesFieldComponent,\n type DatePartsFieldComponent,\n type DeclarationFieldComponent,\n type DetailsComponent,\n type EmailAddressFieldComponent,\n type FileUploadFieldComponent,\n type HtmlComponent,\n type InsetTextComponent,\n type ListComponent,\n type MarkdownComponent,\n type MonthYearFieldComponent,\n type MultilineTextFieldComponent,\n type NumberFieldComponent,\n type RadiosFieldComponent,\n type SelectFieldComponent,\n type TelephoneNumberFieldComponent,\n type TextFieldComponent,\n type UkAddressFieldComponent,\n type YesNoFieldComponent\n} from '~/src/components/types.js'\nimport { type Item, type List } from '~/src/form/form-definition/types.js'\n\n/**\n * @param {Partial<TextFieldComponent>} partialTextField\n * @returns {TextFieldComponent}\n */\nexport function buildTextFieldComponent(\n partialTextField: Partial<TextFieldComponent> = {}\n): TextFieldComponent {\n return {\n id: '407dd0d7-cce9-4f43-8e1f-7d89cb698875',\n name: 'TextField',\n title: 'Text field',\n hint: '',\n options: {},\n schema: {},\n ...partialTextField,\n type: ComponentType.TextField\n }\n}\n\nexport function buildMultilineTextFieldComponent(\n partialMultilineTextField: Partial<MultilineTextFieldComponent> = {}\n): MultilineTextFieldComponent {\n return {\n id: '72671f23-552e-4504-a06a-693e240880d5',\n name: 'MuTeCo',\n options: {},\n schema: {},\n title: 'Multiline TextField Component',\n ...partialMultilineTextField,\n type: ComponentType.MultilineTextField\n }\n}\n\nexport function buildYesNoFieldComponent(\n partialYesNoField: Partial<YesNoFieldComponent> = {}\n): YesNoFieldComponent {\n return {\n title: 'YesNo Field Component',\n id: 'be7f849c-47d8-4f1f-ba15-ab939dc70914',\n name: 'YesNoFieldComponent',\n options: {},\n ...partialYesNoField,\n type: ComponentType.YesNoField\n }\n}\n\nexport function buildDeclarationFieldComponent(\n partialDeclarationField: Partial<DeclarationFieldComponent> = {}\n): DeclarationFieldComponent {\n return {\n title: 'Declaration',\n id: 'f2a8c9e1-3d4f-4b5a-8c6d-1e2f3a4b5c6d',\n name: 'DeclarationFieldComponent',\n content: '',\n options: {},\n ...partialDeclarationField,\n type: ComponentType.DeclarationField\n }\n}\nexport function buildMonthYearFieldComponent(\n partialMonthYearField: Partial<MonthYearFieldComponent> = {}\n): MonthYearFieldComponent {\n return {\n id: 'd4e99aca-6d13-4c1a-a623-9e9e5b27d46d',\n title: 'MonthYearFieldComponent',\n name: 'MonthYearFieldComponent',\n options: {},\n ...partialMonthYearField,\n type: ComponentType.MonthYearField\n }\n}\nexport function buildSelectFieldComponent(\n partialSelectField: Partial<SelectFieldComponent> = {}\n): SelectFieldComponent {\n return {\n id: '7f219cf6-3e16-4549-b8df-789506682147',\n list: '',\n name: '',\n options: {},\n title: '',\n ...partialSelectField,\n type: ComponentType.SelectField\n }\n}\nexport function buildUkAddressFieldComponent(\n partialUkAddressField: Partial<UkAddressFieldComponent> = {}\n): UkAddressFieldComponent {\n return {\n id: 'a7cb7440-9095-44cd-9136-2914232722c8',\n title: 'UkAddressFieldComponent',\n name: 'UkAddressFieldComponent',\n options: {},\n ...partialUkAddressField,\n type: ComponentType.UkAddressField\n }\n}\nexport function buildTelephoneNumberFieldComponent(\n partialTelephoneNumberField: Partial<TelephoneNumberFieldComponent> = {}\n): TelephoneNumberFieldComponent {\n return {\n id: '69907916-beac-4faa-b469-656dad5edced',\n title: 'TelephoneNumberFieldComponent',\n name: 'TelephoneNumberFieldComponent',\n options: {},\n ...partialTelephoneNumberField,\n type: ComponentType.TelephoneNumberField\n }\n}\nexport function buildEmailAddressFieldComponent(\n partialEmailAddressField: Partial<EmailAddressFieldComponent> = {}\n): EmailAddressFieldComponent {\n return {\n id: '9dcf0781-bf34-48c8-b13b-d13050dc34d9',\n title: 'EmailAddressFieldComponent',\n name: 'EmailAddressFieldComponent',\n options: {},\n ...partialEmailAddressField,\n type: ComponentType.EmailAddressField\n }\n}\n\nexport function buildHtmlComponent(\n partialHtml: Partial<HtmlComponent> = {}\n): HtmlComponent {\n return {\n id: 'bac683ce-149e-4740-95aa-8289b35bc327',\n title: 'HtmlComponent',\n name: 'HtmlComponent',\n options: {},\n content: '',\n ...partialHtml,\n type: ComponentType.Html\n }\n}\nexport function buildInsetTextComponent(\n partialInsetText: Partial<InsetTextComponent> = {}\n): InsetTextComponent {\n return {\n id: '6b717151-1e86-42b2-97a9-2201b0676e47',\n title: 'InsetText Component',\n name: 'InsetTextComponent',\n content: '',\n options: {},\n ...partialInsetText,\n type: ComponentType.InsetText\n }\n}\nexport function buildDetailsComponent(\n partialDetails: Partial<DetailsComponent> = {}\n): DetailsComponent {\n return {\n id: '245d54df-bb1e-488e-82f6-8f1e42c197e6',\n title: 'Details Component',\n name: 'DetailsComponent',\n content: '',\n options: {},\n ...partialDetails,\n type: ComponentType.Details\n }\n}\nexport function buildListComponent(\n partialList: Partial<ListComponent> = {}\n): ListComponent {\n return {\n id: '62f17168-c2ef-4978-bd42-bdaa5704e25f',\n title: 'List Component',\n name: 'ListComponent',\n list: '',\n options: {},\n ...partialList,\n type: ComponentType.List\n }\n}\nexport function buildMarkdownComponent(\n partialMarkdown: Partial<MarkdownComponent> = {}\n): MarkdownComponent {\n return {\n id: '4a2dc88c-be1a-4277-aff8-04220de2e778',\n title: 'Markdown Component',\n name: 'MarkdownComponent',\n options: {},\n content: '',\n ...partialMarkdown,\n type: ComponentType.Markdown\n }\n}\n\n/**\n * @param {Partial<FileUploadFieldComponent>} partialFileUploadField\n * @returns {FileUploadFieldComponent}\n */\nexport function buildFileUploadComponent(\n partialFileUploadField: Partial<FileUploadFieldComponent> = {}\n): FileUploadFieldComponent {\n return {\n name: 'FileUploadField',\n title: 'File Upload Field',\n options: {},\n schema: {},\n ...partialFileUploadField,\n type: ComponentType.FileUploadField\n }\n}\n\n/**\n *\n * @param {Partial<AutocompleteFieldComponent>} partialAutoCompleteField\n * @returns {AutocompleteFieldComponent}\n */\nexport function buildAutoCompleteComponent(\n partialAutoCompleteField: Partial<AutocompleteFieldComponent> = {}\n): AutocompleteFieldComponent {\n return {\n name: 'AutoCompleteField',\n title: 'What languages do you speak?',\n list: 'AutoCompleteList',\n options: {},\n ...partialAutoCompleteField,\n type: ComponentType.AutocompleteField\n }\n}\n\n/**\n * @param {Partial<RadiosFieldComponent>} partialListComponent\n * @returns {RadiosFieldComponent}\n */\nexport function buildRadioComponent(\n partialListComponent: Partial<RadiosFieldComponent> = {}\n): RadiosFieldComponent {\n return {\n id: '34455d57-df37-4b69-a64f-6c3af0317ebe',\n name: 'RadioField',\n title: 'Which country do you live in?',\n list: 'RadioList',\n options: {},\n ...partialListComponent,\n type: ComponentType.RadiosField\n }\n}\n\n/**\n * @param {Partial<CheckboxesFieldComponent>} partialListComponent\n * @returns {CheckboxesFieldComponent}\n */\nexport function buildCheckboxComponent(\n partialListComponent: Partial<CheckboxesFieldComponent> = {}\n): CheckboxesFieldComponent {\n return {\n name: 'FellowshipOfTheRing',\n title: 'Which are your favourite characters from the fellowship?',\n list: 'CheckboxList',\n options: {},\n ...partialListComponent,\n type: ComponentType.CheckboxesField\n }\n}\n\n/**\n * Builder to create a stub List item\n * @param {Partial<Item>} partialListItem\n * @returns {Item}\n */\nexport function buildListItem(partialListItem: Partial<Item> = {}): Item {\n return {\n text: 'Javascript',\n value: 'javascript',\n ...partialListItem\n }\n}\n\n/**\n * @param {Partial<List>} partialList\n * @returns {List}\n */\nexport function buildList(partialList: Partial<List> = {}): List {\n return {\n title: 'Development language2',\n name: 'YhmNDD',\n type: 'string',\n items: [\n buildListItem({\n text: 'Javascript',\n value: 'javascript'\n }),\n buildListItem({\n text: 'TypeScript',\n value: 'typescript'\n }),\n buildListItem({\n text: 'Python',\n value: 'python'\n }),\n buildListItem({\n text: 'Haskell',\n value: 'haskell'\n }),\n buildListItem({\n text: 'Erlang',\n value: 'erlang'\n }),\n buildListItem({\n text: 'Java',\n value: 'java'\n })\n ],\n ...partialList\n }\n}\n\nexport function buildNumberFieldComponent(\n partialComponent: Partial<NumberFieldComponent> = {}\n): NumberFieldComponent {\n return {\n name: 'year',\n title: 'Year',\n options: {},\n schema: {},\n ...partialComponent,\n type: ComponentType.NumberField\n }\n}\n\nexport function buildDateComponent(\n partialComponent: Partial<DatePartsFieldComponent> = {}\n): DatePartsFieldComponent {\n return {\n name: 'bcdefg',\n title: 'Default title',\n options: {},\n ...partialComponent,\n type: ComponentType.DatePartsField\n }\n}\n\nexport function buildRadiosComponent(\n partialComponent: Partial<RadiosFieldComponent> = {}\n): RadiosFieldComponent {\n return {\n name: 'cdefgh',\n title: 'Default title',\n options: {},\n list: 'Default list Id ref',\n ...partialComponent,\n type: ComponentType.RadiosField\n }\n}\n"],"mappings":"AAAA,SAASA,aAAa;AAyBtB;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CACrCC,gBAA6C,GAAG,CAAC,CAAC,EAC9B;EACpB,OAAO;IACLC,EAAE,EAAE,sCAAsC;IAC1CC,IAAI,EAAE,WAAW;IACjBC,KAAK,EAAE,YAAY;IACnBC,IAAI,EAAE,EAAE;IACRC,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC,CAAC;IACV,GAAGN,gBAAgB;IACnBO,IAAI,EAAET,aAAa,CAACU;EACtB,CAAC;AACH;AAEA,OAAO,SAASC,gCAAgCA,CAC9CC,yBAA+D,GAAG,CAAC,CAAC,EACvC;EAC7B,OAAO;IACLT,EAAE,EAAE,sCAAsC;IAC1CC,I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C,EAC9B;EACtB,OAAO;IACLlE,IAAI,EAAE,QAAQ;IACdC,KAAK,EAAE,eAAe;IACtBE,OAAO,EAAE,CAAC,CAAC;IACXmB,IAAI,EAAE,qBAAqB;IAC3B,GAAG4C,gBAAgB;IACnB7D,IAAI,EAAET,aAAa,CAAC4D;EACtB,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"components.js","names":["ComponentType","buildTextFieldComponent","partialTextField","id","name","title","hint","options","schema","type","TextField","buildMultilineTextFieldComponent","partialMultilineTextField","MultilineTextField","buildYesNoFieldComponent","partialYesNoField","YesNoField","buildDeclarationFieldComponent","partialDeclarationField","content","DeclarationField","buildMonthYearFieldComponent","partialMonthYearField","MonthYearField","buildSelectFieldComponent","partialSelectField","list","SelectField","buildUkAddressFieldComponent","partialUkAddressField","UkAddressField","buildTelephoneNumberFieldComponent","partialTelephoneNumberField","TelephoneNumberField","buildEmailAddressFieldComponent","partialEmailAddressField","EmailAddressField","buildHtmlComponent","partialHtml","Html","buildInsetTextComponent","partialInsetText","InsetText","buildDetailsComponent","partialDetails","Details","buildListComponent","partialList","List","buildMarkdownComponent","partialMarkdown","Markdown","buildFileUploadComponent","partialFileUploadField","FileUploadField","buildAutoCompleteComponent","partialAutoCompleteField","AutocompleteField","buildRadioComponent","partialListComponent","RadiosField","buildCheckboxComponent","CheckboxesField","buildListItem","partialListItem","text","value","buildList","items","buildNumberFieldComponent","partialComponent","NumberField","buildDateComponent","DatePartsField","buildRadiosComponent","buildEastingNorthingFieldComponent","EastingNorthingField","buildLatLongFieldComponent","LatLongField","buildNationalGridFieldNumberFieldComponent","NationalGridFieldNumberField","buildOsGridRefFieldComponent","OsGridRefField"],"sources":["../../../src/__stubs__/components.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n type AutocompleteFieldComponent,\n type CheckboxesFieldComponent,\n type DatePartsFieldComponent,\n type DeclarationFieldComponent,\n type DetailsComponent,\n type EastingNorthingFieldComponent,\n type EmailAddressFieldComponent,\n type FileUploadFieldComponent,\n type HtmlComponent,\n type InsetTextComponent,\n type LatLongFieldComponent,\n type ListComponent,\n type MarkdownComponent,\n type MonthYearFieldComponent,\n type MultilineTextFieldComponent,\n type NationalGridFieldNumberFieldComponent,\n type NumberFieldComponent,\n type OsGridRefFieldComponent,\n type RadiosFieldComponent,\n type SelectFieldComponent,\n type TelephoneNumberFieldComponent,\n type TextFieldComponent,\n type UkAddressFieldComponent,\n type YesNoFieldComponent\n} from '~/src/components/types.js'\nimport { type Item, type List } from '~/src/form/form-definition/types.js'\n\n/**\n * @param {Partial<TextFieldComponent>} partialTextField\n * @returns {TextFieldComponent}\n */\nexport function buildTextFieldComponent(\n partialTextField: Partial<TextFieldComponent> = {}\n): TextFieldComponent {\n return {\n id: '407dd0d7-cce9-4f43-8e1f-7d89cb698875',\n name: 'TextField',\n title: 'Text field',\n hint: '',\n options: {},\n schema: {},\n ...partialTextField,\n type: ComponentType.TextField\n }\n}\n\nexport function buildMultilineTextFieldComponent(\n partialMultilineTextField: Partial<MultilineTextFieldComponent> = {}\n): MultilineTextFieldComponent {\n return {\n id: '72671f23-552e-4504-a06a-693e240880d5',\n name: 'MuTeCo',\n options: {},\n schema: {},\n title: 'Multiline TextField Component',\n ...partialMultilineTextField,\n type: ComponentType.MultilineTextField\n }\n}\n\nexport function buildYesNoFieldComponent(\n partialYesNoField: Partial<YesNoFieldComponent> = {}\n): YesNoFieldComponent {\n return {\n title: 'YesNo Field Component',\n id: 'be7f849c-47d8-4f1f-ba15-ab939dc70914',\n name: 'YesNoFieldComponent',\n options: {},\n ...partialYesNoField,\n type: ComponentType.YesNoField\n }\n}\n\nexport function buildDeclarationFieldComponent(\n partialDeclarationField: Partial<DeclarationFieldComponent> = {}\n): DeclarationFieldComponent {\n return {\n title: 'Declaration',\n id: 'f2a8c9e1-3d4f-4b5a-8c6d-1e2f3a4b5c6d',\n name: 'DeclarationFieldComponent',\n content: '',\n options: {},\n ...partialDeclarationField,\n type: ComponentType.DeclarationField\n }\n}\nexport function buildMonthYearFieldComponent(\n partialMonthYearField: Partial<MonthYearFieldComponent> = {}\n): MonthYearFieldComponent {\n return {\n id: 'd4e99aca-6d13-4c1a-a623-9e9e5b27d46d',\n title: 'MonthYearFieldComponent',\n name: 'MonthYearFieldComponent',\n options: {},\n ...partialMonthYearField,\n type: ComponentType.MonthYearField\n }\n}\nexport function buildSelectFieldComponent(\n partialSelectField: Partial<SelectFieldComponent> = {}\n): SelectFieldComponent {\n return {\n id: '7f219cf6-3e16-4549-b8df-789506682147',\n list: '',\n name: '',\n options: {},\n title: '',\n ...partialSelectField,\n type: ComponentType.SelectField\n }\n}\nexport function buildUkAddressFieldComponent(\n partialUkAddressField: Partial<UkAddressFieldComponent> = {}\n): UkAddressFieldComponent {\n return {\n id: 'a7cb7440-9095-44cd-9136-2914232722c8',\n title: 'UkAddressFieldComponent',\n name: 'UkAddressFieldComponent',\n options: {},\n ...partialUkAddressField,\n type: ComponentType.UkAddressField\n }\n}\nexport function buildTelephoneNumberFieldComponent(\n partialTelephoneNumberField: Partial<TelephoneNumberFieldComponent> = {}\n): TelephoneNumberFieldComponent {\n return {\n id: '69907916-beac-4faa-b469-656dad5edced',\n title: 'TelephoneNumberFieldComponent',\n name: 'TelephoneNumberFieldComponent',\n options: {},\n ...partialTelephoneNumberField,\n type: ComponentType.TelephoneNumberField\n }\n}\nexport function buildEmailAddressFieldComponent(\n partialEmailAddressField: Partial<EmailAddressFieldComponent> = {}\n): EmailAddressFieldComponent {\n return {\n id: '9dcf0781-bf34-48c8-b13b-d13050dc34d9',\n title: 'EmailAddressFieldComponent',\n name: 'EmailAddressFieldComponent',\n options: {},\n ...partialEmailAddressField,\n type: ComponentType.EmailAddressField\n }\n}\n\nexport function buildHtmlComponent(\n partialHtml: Partial<HtmlComponent> = {}\n): HtmlComponent {\n return {\n id: 'bac683ce-149e-4740-95aa-8289b35bc327',\n title: 'HtmlComponent',\n name: 'HtmlComponent',\n options: {},\n content: '',\n ...partialHtml,\n type: ComponentType.Html\n }\n}\nexport function buildInsetTextComponent(\n partialInsetText: Partial<InsetTextComponent> = {}\n): InsetTextComponent {\n return {\n id: '6b717151-1e86-42b2-97a9-2201b0676e47',\n title: 'InsetText Component',\n name: 'InsetTextComponent',\n content: '',\n options: {},\n ...partialInsetText,\n type: ComponentType.InsetText\n }\n}\nexport function buildDetailsComponent(\n partialDetails: Partial<DetailsComponent> = {}\n): DetailsComponent {\n return {\n id: '245d54df-bb1e-488e-82f6-8f1e42c197e6',\n title: 'Details Component',\n name: 'DetailsComponent',\n content: '',\n options: {},\n ...partialDetails,\n type: ComponentType.Details\n }\n}\nexport function buildListComponent(\n partialList: Partial<ListComponent> = {}\n): ListComponent {\n return {\n id: '62f17168-c2ef-4978-bd42-bdaa5704e25f',\n title: 'List Component',\n name: 'ListComponent',\n list: '',\n options: {},\n ...partialList,\n type: ComponentType.List\n }\n}\nexport function buildMarkdownComponent(\n partialMarkdown: Partial<MarkdownComponent> = {}\n): MarkdownComponent {\n return {\n id: '4a2dc88c-be1a-4277-aff8-04220de2e778',\n title: 'Markdown Component',\n name: 'MarkdownComponent',\n options: {},\n content: '',\n ...partialMarkdown,\n type: ComponentType.Markdown\n }\n}\n\n/**\n * @param {Partial<FileUploadFieldComponent>} partialFileUploadField\n * @returns {FileUploadFieldComponent}\n */\nexport function buildFileUploadComponent(\n partialFileUploadField: Partial<FileUploadFieldComponent> = {}\n): FileUploadFieldComponent {\n return {\n name: 'FileUploadField',\n title: 'File Upload Field',\n options: {},\n schema: {},\n ...partialFileUploadField,\n type: ComponentType.FileUploadField\n }\n}\n\n/**\n *\n * @param {Partial<AutocompleteFieldComponent>} partialAutoCompleteField\n * @returns {AutocompleteFieldComponent}\n */\nexport function buildAutoCompleteComponent(\n partialAutoCompleteField: Partial<AutocompleteFieldComponent> = {}\n): AutocompleteFieldComponent {\n return {\n name: 'AutoCompleteField',\n title: 'What languages do you speak?',\n list: 'AutoCompleteList',\n options: {},\n ...partialAutoCompleteField,\n type: ComponentType.AutocompleteField\n }\n}\n\n/**\n * @param {Partial<RadiosFieldComponent>} partialListComponent\n * @returns {RadiosFieldComponent}\n */\nexport function buildRadioComponent(\n partialListComponent: Partial<RadiosFieldComponent> = {}\n): RadiosFieldComponent {\n return {\n id: '34455d57-df37-4b69-a64f-6c3af0317ebe',\n name: 'RadioField',\n title: 'Which country do you live in?',\n list: 'RadioList',\n options: {},\n ...partialListComponent,\n type: ComponentType.RadiosField\n }\n}\n\n/**\n * @param {Partial<CheckboxesFieldComponent>} partialListComponent\n * @returns {CheckboxesFieldComponent}\n */\nexport function buildCheckboxComponent(\n partialListComponent: Partial<CheckboxesFieldComponent> = {}\n): CheckboxesFieldComponent {\n return {\n name: 'FellowshipOfTheRing',\n title: 'Which are your favourite characters from the fellowship?',\n list: 'CheckboxList',\n options: {},\n ...partialListComponent,\n type: ComponentType.CheckboxesField\n }\n}\n\n/**\n * Builder to create a stub List item\n * @param {Partial<Item>} partialListItem\n * @returns {Item}\n */\nexport function buildListItem(partialListItem: Partial<Item> = {}): Item {\n return {\n text: 'Javascript',\n value: 'javascript',\n ...partialListItem\n }\n}\n\n/**\n * @param {Partial<List>} partialList\n * @returns {List}\n */\nexport function buildList(partialList: Partial<List> = {}): List {\n return {\n title: 'Development language2',\n name: 'YhmNDD',\n type: 'string',\n items: [\n buildListItem({\n text: 'Javascript',\n value: 'javascript'\n }),\n buildListItem({\n text: 'TypeScript',\n value: 'typescript'\n }),\n buildListItem({\n text: 'Python',\n value: 'python'\n }),\n buildListItem({\n text: 'Haskell',\n value: 'haskell'\n }),\n buildListItem({\n text: 'Erlang',\n value: 'erlang'\n }),\n buildListItem({\n text: 'Java',\n value: 'java'\n })\n ],\n ...partialList\n }\n}\n\nexport function buildNumberFieldComponent(\n partialComponent: Partial<NumberFieldComponent> = {}\n): NumberFieldComponent {\n return {\n name: 'year',\n title: 'Year',\n options: {},\n schema: {},\n ...partialComponent,\n type: ComponentType.NumberField\n }\n}\n\nexport function buildDateComponent(\n partialComponent: Partial<DatePartsFieldComponent> = {}\n): DatePartsFieldComponent {\n return {\n name: 'bcdefg',\n title: 'Default title',\n options: {},\n ...partialComponent,\n type: ComponentType.DatePartsField\n }\n}\n\nexport function buildRadiosComponent(\n partialComponent: Partial<RadiosFieldComponent> = {}\n): RadiosFieldComponent {\n return {\n name: 'cdefgh',\n title: 'Default title',\n options: {},\n list: 'Default list Id ref',\n ...partialComponent,\n type: ComponentType.RadiosField\n }\n}\n\nexport function buildEastingNorthingFieldComponent(\n partialComponent: Partial<EastingNorthingFieldComponent> = {}\n): EastingNorthingFieldComponent {\n return {\n id: '1a2b3c4d-5e6f-7g8h-9i0j-1k2l3m4n5o6p',\n name: 'EastingNorthingField',\n title: 'Easting and northing',\n hint: 'For example, Easting: 248741, Northing: 63688',\n options: {},\n schema: {},\n ...partialComponent,\n type: ComponentType.EastingNorthingField\n }\n}\n\nexport function buildLatLongFieldComponent(\n partialComponent: Partial<LatLongFieldComponent> = {}\n): LatLongFieldComponent {\n return {\n id: '2b3c4d5e-6f7g-8h9i-0j1k-2l3m4n5o6p7q',\n name: 'LatLongField',\n title: 'Latitude and longitude',\n hint: 'For example, Latitude: 51.5074, Longitude: -0.1278',\n options: {},\n schema: {},\n ...partialComponent,\n type: ComponentType.LatLongField\n }\n}\n\nexport function buildNationalGridFieldNumberFieldComponent(\n partialComponent: Partial<NationalGridFieldNumberFieldComponent> = {}\n): NationalGridFieldNumberFieldComponent {\n return {\n id: '3c4d5e6f-7g8h-9i0j-1k2l-3m4n5o6p7q8r',\n name: 'NationalGridFieldNumberField',\n title: 'National Grid field number',\n hint: 'A National Grid field number is made up of 2 letters and 8 numbers, for example, SO04188589',\n options: {},\n ...partialComponent,\n type: ComponentType.NationalGridFieldNumberField\n }\n}\n\nexport function buildOsGridRefFieldComponent(\n partialComponent: Partial<OsGridRefFieldComponent> = {}\n): OsGridRefFieldComponent {\n return {\n id: '4d5e6f7g-8h9i-0j1k-2l3m-4n5o6p7q8r9s',\n name: 'OsGridRefField',\n title: 'Ordnance Survey (OS) grid reference',\n hint: 'An OS grid reference number is made up of 2 letters followed by 6 numbers, for example, TQ123456',\n options: {},\n ...partialComponent,\n type: ComponentType.OsGridRefField\n }\n}\n"],"mappings":"AAAA,SAASA,aAAa;AA6BtB;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CACrCC,gBAA6C,GAAG,CAAC,CAAC,EAC9B;EACpB,OAAO;IACLC,EAAE,EAAE,sCAAsC;IAC1CC,IAAI,EAAE,WAAW;IACjBC,KAAK,EAAE,YAAY;IACnBC,IAAI,EAAE,EAAE;IACRC,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC,CAAC;IACV,GAAGN,gBAAgB;IACnBO,IAAI,EAAET,aAAa,CAACU;EACtB,CAAC;AACH;AAEA,OAAO,SAASC,gCAAgCA,CAC9CC,yBAA+D,GAAG,CAAC,CAAC,EACvC;EAC7B,OAAO;IACLT,EAAE,EAAE,sCAAsC;IAC1CC,IAAI,EAAE,QAAQ;IACdG,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC,CAAC;IACVH,KAAK,EAAE,+BAA+B;IACtC,GAAGO,yBAAyB;IAC5BH,IAAI,EAAET,aAAa,CAACa;EACtB,CAAC;AACH;AAEA,OAAO,SAASC,wBAAwBA,CACtCC,iBAA+C,GAAG,CAAC,CAAC,EAC/B;EACrB,OAAO;IACLV,KAAK,EAAE,uBAAuB;IAC9BF,EAAE,EAAE,sCAAsC;IAC1CC,IAAI,EAAE,qBAAqB;IAC3BG,OAAO,EAAE,CAAC,CAAC;IACX,GAAGQ,iBAAiB;IACpBN,IAAI,EAAET,aAAa,CAACgB;EACtB,CAAC;AACH;AAEA,OAAO,SAASC,8BAA8BA,CAC5CC,uBAA2D,GAAG,CAAC,CAAC,EACrC;EAC3B,OAAO;IACLb,KAAK,EAAE,aAAa;IACpBF,EAAE,EAAE,sCAAsC;IAC1CC,IAAI,EAAE,2BAA2B;IAC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vB,OAAO;IACLnE,EAAE,EAAE,sCAAsC;IAC1CC,IAAI,EAAE,cAAc;IACpBC,KAAK,EAAE,wBAAwB;IAC/BC,IAAI,EAAE,oDAAoD;IAC1DC,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC,CAAC;IACV,GAAG8D,gBAAgB;IACnB7D,IAAI,EAAET,aAAa,CAAC8E;EACtB,CAAC;AACH;AAEA,OAAO,SAASC,0CAA0CA,CACxDT,gBAAgE,GAAG,CAAC,CAAC,EAC9B;EACvC,OAAO;IACLnE,EAAE,EAAE,sCAAsC;IAC1CC,IAAI,EAAE,8BAA8B;IACpCC,KAAK,EAAE,4BAA4B;IACnCC,IAAI,EAAE,6FAA6F;IACnGC,OAAO,EAAE,CAAC,CAAC;IACX,GAAG+D,gBAAgB;IACnB7D,IAAI,EAAET,aAAa,CAACgF;EACtB,CAAC;AACH;AAEA,OAAO,SAASC,4BAA4BA,CAC1CX,gBAAkD,GAAG,CAAC,CAAC,EAC9B;EACzB,OAAO;IACLnE,EAAE,EAAE,sCAAsC;IAC1CC,IAAI,EAAE,gBAAgB;IACtBC,KAAK,EAAE,qCAAqC;IAC5CC,IAAI,EAAE,kGAAkG;IACxGC,OAAO,EAAE,CAAC,CAAC;IACX,GAAG+D,gBAAgB;IACnB7D,IAAI,EAAET,aAAa,CAACkF;EACtB,CAAC;AACH","ignoreList":[]}
@@ -139,7 +139,7 @@ export const ComponentTypes = Object.freeze([{
139
139
  name: 'OsGridRefField',
140
140
  title: 'Ordnance Survey (OS) grid reference',
141
141
  type: ComponentType.OsGridRefField,
142
- hint: 'An OS grid reference number is made up of 2 letters followed by 10 numbers, for example, SO7394301364',
142
+ hint: 'An OS grid reference number is made up of 2 letters followed by 6 numbers, for example, TQ123456',
143
143
  options: {}
144
144
  }, {
145
145
  name: 'NationalGridFieldNumberField',
@@ -153,5 +153,12 @@ export const ComponentTypes = Object.freeze([{
153
153
  type: ComponentType.LatLongField,
154
154
  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',
155
155
  options: {}
156
+ }, {
157
+ name: 'HiddenField',
158
+ title: 'Hidden field',
159
+ type: ComponentType.HiddenField,
160
+ hint: '',
161
+ options: {},
162
+ schema: {}
156
163
  }]);
157
164
  //# sourceMappingURL=component-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component-types.js","names":["ComponentType","ComponentTypes","Object","freeze","name","title","type","TextField","hint","options","schema","MultilineTextField","YesNoField","DatePartsField","MonthYearField","SelectField","list","AutocompleteField","RadiosField","CheckboxesField","NumberField","UkAddressField","TelephoneNumberField","EmailAddressField","FileUploadField","Html","content","InsetText","Markdown","Details","List","DeclarationField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField"],"sources":["../../../src/components/component-types.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\n\n/**\n * Defaults for creating new components\n */\nexport const ComponentTypes: readonly ComponentDef[] = Object.freeze([\n {\n name: 'TextField',\n title: 'Text field',\n type: ComponentType.TextField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'MultilineTextField',\n title: 'Multiline text field',\n type: ComponentType.MultilineTextField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'YesNoField',\n title: 'Yes/No field',\n type: ComponentType.YesNoField,\n hint: '',\n options: {}\n },\n {\n name: 'DatePartsField',\n title: 'Date field',\n type: ComponentType.DatePartsField,\n hint: '',\n options: {}\n },\n {\n name: 'MonthYearField',\n title: 'Month & year field',\n type: ComponentType.MonthYearField,\n hint: '',\n options: {}\n },\n {\n name: 'SelectField',\n title: 'Select field',\n type: ComponentType.SelectField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'AutocompleteField',\n title: 'Autocomplete field',\n type: ComponentType.AutocompleteField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'RadiosField',\n title: 'Radios field',\n type: ComponentType.RadiosField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'CheckboxesField',\n title: 'Checkboxes field',\n type: ComponentType.CheckboxesField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'NumberField',\n title: 'Number field',\n type: ComponentType.NumberField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'UkAddressField',\n title: 'UK address field',\n type: ComponentType.UkAddressField,\n hint: '',\n options: {}\n },\n {\n name: 'TelephoneNumberField',\n title: 'Telephone number field',\n type: ComponentType.TelephoneNumberField,\n hint: '',\n options: {}\n },\n {\n name: 'EmailAddressField',\n title: 'Email address field',\n type: ComponentType.EmailAddressField,\n hint: 'For example, ‘name@example.com’',\n options: {}\n },\n {\n name: 'FileUploadField',\n title: 'File upload field',\n type: ComponentType.FileUploadField,\n options: {},\n schema: {}\n },\n {\n name: 'Html',\n title: 'Html',\n type: ComponentType.Html,\n content: '',\n options: {}\n },\n {\n name: 'InsetText',\n title: 'Inset text',\n type: ComponentType.InsetText,\n content: ''\n },\n {\n name: 'Markdown',\n title: 'Markdown',\n type: ComponentType.Markdown,\n content: '',\n options: {}\n },\n {\n name: 'Details',\n title: 'Details',\n type: ComponentType.Details,\n content: '',\n options: {}\n },\n {\n name: 'List',\n title: 'List',\n type: ComponentType.List,\n list: '',\n options: {}\n },\n {\n name: 'DeclarationField',\n title: 'Declaration',\n type: ComponentType.DeclarationField,\n hint: '',\n content: '',\n options: {}\n },\n {\n name: 'EastingNorthingField',\n title: 'Easting and northing',\n type: ComponentType.EastingNorthingField,\n hint: 'For example, Easting: 248741, Northing: 63688',\n options: {}\n },\n {\n name: 'OsGridRefField',\n title: 'Ordnance Survey (OS) grid reference',\n type: ComponentType.OsGridRefField,\n hint: 'An OS grid reference number is made up of 2 letters followed by 10 numbers, for example, SO7394301364',\n options: {}\n },\n {\n name: 'NationalGridFieldNumberField',\n title: 'National Grid field number',\n type: ComponentType.NationalGridFieldNumberField,\n hint: 'A National Grid field number is made up of 2 letters and 8 numbers, for example, SO04188589',\n options: {}\n },\n {\n name: 'LatLongField',\n title: 'Latitude and longitude',\n type: ComponentType.LatLongField,\n 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',\n options: {}\n }\n])\n"],"mappings":"AAAA,SAASA,aAAa;AAGtB;AACA;AACA;AACA,OAAO,MAAMC,cAAuC,GAAGC,MAAM,CAACC,MAAM,CAAC,CACnE;EACEC,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEN,aAAa,CAACO,SAAS;EAC7BC,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,oBAAoB;EAC1BC,KAAK,EAAE,sBAAsB;EAC7BC,IAAI,EAAEN,aAAa,CAACW,kBAAkB;EACtCH,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,YAAY;EAClBC,KAAK,EAAE,cAAc;EACrBC,IAAI,EAAEN,aAAa,CAACY,UAAU;EAC9BJ,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,gBAAgB;EACtBC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEN,aAAa,CAACa,cAAc;EAClCL,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,gBAAgB;EACtBC,KAAK,EAAE,oBAAoB;EAC3BC,IAAI,EAAEN,aAAa,CAACc,cAAc;EAClCN,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,aAAa;EACnBC,KAAK,EAAE,cAAc;EACrBC,IAAI,EAAEN,aAAa,CAACe,WAAW;EAC/BP,IAAI,EAAE,EAAE;EACRQ,IAAI,EAAE,EA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aAAa,CAACgC,oBAAoB;EACxCxB,IAAI,EAAE,+CAA+C;EACrDC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,gBAAgB;EACtBC,KAAK,EAAE,qCAAqC;EAC5CC,IAAI,EAAEN,aAAa,CAACiC,cAAc;EAClCzB,IAAI,EAAE,uGAAuG;EAC7GC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,8BAA8B;EACpCC,KAAK,EAAE,4BAA4B;EACnCC,IAAI,EAAEN,aAAa,CAACkC,4BAA4B;EAChD1B,IAAI,EAAE,6FAA6F;EACnGC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,cAAc;EACpBC,KAAK,EAAE,wBAAwB;EAC/BC,IAAI,EAAEN,aAAa,CAACmC,YAAY;EAChC3B,IAAI,EAAE,sIAAsI;EAC5IC,OAAO,EAAE,CAAC;AACZ,CAAC,CACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"component-types.js","names":["ComponentType","ComponentTypes","Object","freeze","name","title","type","TextField","hint","options","schema","MultilineTextField","YesNoField","DatePartsField","MonthYearField","SelectField","list","AutocompleteField","RadiosField","CheckboxesField","NumberField","UkAddressField","TelephoneNumberField","EmailAddressField","FileUploadField","Html","content","InsetText","Markdown","Details","List","DeclarationField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","HiddenField"],"sources":["../../../src/components/component-types.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\n\n/**\n * Defaults for creating new components\n */\nexport const ComponentTypes: readonly ComponentDef[] = Object.freeze([\n {\n name: 'TextField',\n title: 'Text field',\n type: ComponentType.TextField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'MultilineTextField',\n title: 'Multiline text field',\n type: ComponentType.MultilineTextField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'YesNoField',\n title: 'Yes/No field',\n type: ComponentType.YesNoField,\n hint: '',\n options: {}\n },\n {\n name: 'DatePartsField',\n title: 'Date field',\n type: ComponentType.DatePartsField,\n hint: '',\n options: {}\n },\n {\n name: 'MonthYearField',\n title: 'Month & year field',\n type: ComponentType.MonthYearField,\n hint: '',\n options: {}\n },\n {\n name: 'SelectField',\n title: 'Select field',\n type: ComponentType.SelectField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'AutocompleteField',\n title: 'Autocomplete field',\n type: ComponentType.AutocompleteField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'RadiosField',\n title: 'Radios field',\n type: ComponentType.RadiosField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'CheckboxesField',\n title: 'Checkboxes field',\n type: ComponentType.CheckboxesField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'NumberField',\n title: 'Number field',\n type: ComponentType.NumberField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'UkAddressField',\n title: 'UK address field',\n type: ComponentType.UkAddressField,\n hint: '',\n options: {}\n },\n {\n name: 'TelephoneNumberField',\n title: 'Telephone number field',\n type: ComponentType.TelephoneNumberField,\n hint: '',\n options: {}\n },\n {\n name: 'EmailAddressField',\n title: 'Email address field',\n type: ComponentType.EmailAddressField,\n hint: 'For example, ‘name@example.com’',\n options: {}\n },\n {\n name: 'FileUploadField',\n title: 'File upload field',\n type: ComponentType.FileUploadField,\n options: {},\n schema: {}\n },\n {\n name: 'Html',\n title: 'Html',\n type: ComponentType.Html,\n content: '',\n options: {}\n },\n {\n name: 'InsetText',\n title: 'Inset text',\n type: ComponentType.InsetText,\n content: ''\n },\n {\n name: 'Markdown',\n title: 'Markdown',\n type: ComponentType.Markdown,\n content: '',\n options: {}\n },\n {\n name: 'Details',\n title: 'Details',\n type: ComponentType.Details,\n content: '',\n options: {}\n },\n {\n name: 'List',\n title: 'List',\n type: ComponentType.List,\n list: '',\n options: {}\n },\n {\n name: 'DeclarationField',\n title: 'Declaration',\n type: ComponentType.DeclarationField,\n hint: '',\n content: '',\n options: {}\n },\n {\n name: 'EastingNorthingField',\n title: 'Easting and northing',\n type: ComponentType.EastingNorthingField,\n hint: 'For example, Easting: 248741, Northing: 63688',\n options: {}\n },\n {\n name: 'OsGridRefField',\n title: 'Ordnance Survey (OS) grid reference',\n type: ComponentType.OsGridRefField,\n hint: 'An OS grid reference number is made up of 2 letters followed by 6 numbers, for example, TQ123456',\n options: {}\n },\n {\n name: 'NationalGridFieldNumberField',\n title: 'National Grid field number',\n type: ComponentType.NationalGridFieldNumberField,\n hint: 'A National Grid field number is made up of 2 letters and 8 numbers, for example, SO04188589',\n options: {}\n },\n {\n name: 'LatLongField',\n title: 'Latitude and longitude',\n type: ComponentType.LatLongField,\n 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',\n options: {}\n },\n {\n name: 'HiddenField',\n title: 'Hidden field',\n type: ComponentType.HiddenField,\n hint: '',\n options: {},\n schema: {}\n }\n])\n"],"mappings":"AAAA,SAASA,aAAa;AAGtB;AACA;AACA;AACA,OAAO,MAAMC,cAAuC,GAAGC,MAAM,CAACC,MAAM,CAAC,CACnE;EACEC,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEN,aAAa,CAACO,SAAS;EAC7BC,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,oBAAoB;EAC1BC,KAAK,EAAE,sBAAsB;EAC7BC,IAAI,EAAEN,aAAa,CAACW,kBAAkB;EACtCH,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,YAAY;EAClBC,KAAK,EAAE,cAAc;EACrBC,IAAI,EAAEN,aAAa,CAACY,UAAU;EAC9BJ,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE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CAAC;AACX,CAAC,CACF,CAAC","ignoreList":[]}
@@ -23,6 +23,7 @@ export let ComponentType = /*#__PURE__*/function (ComponentType) {
23
23
  ComponentType["OsGridRefField"] = "OsGridRefField";
24
24
  ComponentType["NationalGridFieldNumberField"] = "NationalGridFieldNumberField";
25
25
  ComponentType["LatLongField"] = "LatLongField";
26
+ ComponentType["HiddenField"] = "HiddenField";
26
27
  return ComponentType;
27
28
  }({});
28
29
  //# sourceMappingURL=enums.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"enums.js","names":["ComponentType"],"sources":["../../../src/components/enums.ts"],"sourcesContent":["export enum ComponentType {\n TextField = 'TextField',\n MultilineTextField = 'MultilineTextField',\n YesNoField = 'YesNoField',\n DatePartsField = 'DatePartsField',\n MonthYearField = 'MonthYearField',\n SelectField = 'SelectField',\n AutocompleteField = 'AutocompleteField',\n RadiosField = 'RadiosField',\n CheckboxesField = 'CheckboxesField',\n NumberField = 'NumberField',\n UkAddressField = 'UkAddressField',\n TelephoneNumberField = 'TelephoneNumberField',\n EmailAddressField = 'EmailAddressField',\n Html = 'Html',\n InsetText = 'InsetText',\n Details = 'Details',\n List = 'List',\n Markdown = 'Markdown',\n FileUploadField = 'FileUploadField',\n DeclarationField = 'DeclarationField',\n EastingNorthingField = 'EastingNorthingField',\n OsGridRefField = 'OsGridRefField',\n NationalGridFieldNumberField = 'NationalGridFieldNumberField',\n LatLongField = 'LatLongField'\n}\n"],"mappings":"AAAA,WAAYA,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"enums.js","names":["ComponentType"],"sources":["../../../src/components/enums.ts"],"sourcesContent":["export enum ComponentType {\n TextField = 'TextField',\n MultilineTextField = 'MultilineTextField',\n YesNoField = 'YesNoField',\n DatePartsField = 'DatePartsField',\n MonthYearField = 'MonthYearField',\n SelectField = 'SelectField',\n AutocompleteField = 'AutocompleteField',\n RadiosField = 'RadiosField',\n CheckboxesField = 'CheckboxesField',\n NumberField = 'NumberField',\n UkAddressField = 'UkAddressField',\n TelephoneNumberField = 'TelephoneNumberField',\n EmailAddressField = 'EmailAddressField',\n Html = 'Html',\n InsetText = 'InsetText',\n Details = 'Details',\n List = 'List',\n Markdown = 'Markdown',\n FileUploadField = 'FileUploadField',\n DeclarationField = 'DeclarationField',\n EastingNorthingField = 'EastingNorthingField',\n OsGridRefField = 'OsGridRefField',\n NationalGridFieldNumberField = 'NationalGridFieldNumberField',\n LatLongField = 'LatLongField',\n HiddenField = 'HiddenField'\n}\n"],"mappings":"AAAA,WAAYA,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/components/types.ts"],"sourcesContent":["import { type LanguageMessages } from 'joi'\n\nimport { type ComponentType } from '~/src/components/enums.js'\nimport {\n type ListTypeContent,\n type ListTypeOption\n} from '~/src/form/form-definition/types.js'\n\nexport type ConditionalComponentType = Exclude<\n ConditionalComponentsDef['type'],\n ContentComponentsDef\n>\n\n/**\n * Types for Components JSON structure which are expected by engine and turned into actual form input/content/lists\n */\n\ninterface FormFieldBase {\n id?: string\n type: FormComponentsDef['type']\n shortDescription?: string\n name: string\n title: string\n hint?: string\n options: {\n required?: boolean\n optionalText?: boolean\n classes?: string\n customValidationMessages?: LanguageMessages\n instructionText?: string\n }\n}\n\ninterface ListFieldBase extends FormFieldBase {\n type:\n | ComponentType.AutocompleteField\n | ComponentType.CheckboxesField\n | ComponentType.RadiosField\n | ComponentType.SelectField\n list: string\n options: FormFieldBase['options'] & {\n type?: ListTypeContent\n }\n}\n\ninterface ContentFieldBase {\n id?: string\n type:\n | ComponentType.Details\n | ComponentType.Html\n | ComponentType.Markdown\n | ComponentType.InsetText\n | ComponentType.List\n name: string\n title: string\n options?: {\n required?: undefined\n optionalText?: undefined\n }\n}\n\ninterface DateFieldBase extends FormFieldBase {\n type: ComponentType.DatePartsField | ComponentType.MonthYearField\n name: string\n title: string\n hint?: string\n options: FormFieldBase['options'] & {\n maxDaysInPast?: number\n maxDaysInFuture?: number\n }\n}\n\n// Text Fields\nexport interface TextFieldComponent extends FormFieldBase {\n type: ComponentType.TextField\n options: FormFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n }\n schema: {\n max?: number\n min?: number\n length?: number\n regex?: string\n }\n}\n\nexport interface EmailAddressFieldComponent extends FormFieldBase {\n type: ComponentType.EmailAddressField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface NumberFieldComponent extends FormFieldBase {\n type: ComponentType.NumberField\n options: FormFieldBase['options'] & {\n prefix?: string\n suffix?: string\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n }\n schema: {\n max?: number\n min?: number\n precision?: number\n minPrecision?: number\n minLength?: number\n maxLength?: number\n }\n}\n\nexport interface TelephoneNumberFieldComponent extends FormFieldBase {\n type: ComponentType.TelephoneNumberField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface FileUploadFieldComponent extends FormFieldBase {\n type: ComponentType.FileUploadField\n name: string\n title: string\n hint?: string\n options: FormFieldBase['options'] & {\n accept?: string\n }\n schema: {\n max?: number\n min?: number\n length?: number\n }\n}\n\nexport interface YesNoFieldComponent extends FormFieldBase {\n type: ComponentType.YesNoField\n options: FormFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface DeclarationFieldComponent extends FormFieldBase {\n type: ComponentType.DeclarationField\n content: string\n options: FormFieldBase['options'] & {\n condition?: string\n declarationConfirmationLabel?: string\n }\n}\n\nexport interface MultilineTextFieldComponent extends FormFieldBase {\n type: ComponentType.MultilineTextField\n options: FormFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n rows?: number\n maxWords?: number\n }\n schema: {\n max?: number\n min?: number\n length?: number\n regex?: string\n }\n}\n\nexport interface UkAddressFieldComponent extends FormFieldBase {\n type: ComponentType.UkAddressField\n options: FormFieldBase['options'] & {\n hideTitle?: boolean\n usePostcodeLookup?: boolean\n }\n}\n\n// Precise Location Fields\nexport interface EastingNorthingFieldComponent extends FormFieldBase {\n type: ComponentType.EastingNorthingField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n schema?: {\n easting?: {\n min?: number\n max?: number\n }\n northing?: {\n min?: number\n max?: number\n }\n }\n}\n\nexport interface OsGridRefFieldComponent extends FormFieldBase {\n type: ComponentType.OsGridRefField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface NationalGridFieldNumberFieldComponent extends FormFieldBase {\n type: ComponentType.NationalGridFieldNumberField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface LatLongFieldComponent extends FormFieldBase {\n type: ComponentType.LatLongField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n schema?: {\n latitude?: {\n min?: number\n max?: number\n }\n longitude?: {\n min?: number\n max?: number\n }\n }\n}\n\n// Date Fields\nexport interface DatePartsFieldComponent extends DateFieldBase {\n type: ComponentType.DatePartsField\n options: DateFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MonthYearFieldComponent extends DateFieldBase {\n type: ComponentType.MonthYearField\n options: DateFieldBase['options'] & {\n customValidationMessage?: string\n }\n}\n\n// Content Fields\nexport interface DetailsComponent extends ContentFieldBase {\n type: ComponentType.Details\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface HtmlComponent extends ContentFieldBase {\n type: ComponentType.Html\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MarkdownComponent extends ContentFieldBase {\n type: ComponentType.Markdown\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface InsetTextComponent extends ContentFieldBase {\n type: ComponentType.InsetText\n content: string\n}\n\nexport interface ListComponent extends ContentFieldBase {\n type: ComponentType.List\n hint?: string\n list: string\n options: ContentFieldBase['options'] & {\n type?: ListTypeOption\n classes?: string\n hideTitle?: boolean\n bold?: boolean\n }\n}\n\nexport interface AutocompleteFieldComponent extends ListFieldBase {\n type: ComponentType.AutocompleteField\n options: ListFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface CheckboxesFieldComponent extends ListFieldBase {\n type: ComponentType.CheckboxesField\n options: ListFieldBase['options'] & {\n bold?: boolean\n condition?: string\n }\n}\n\nexport interface RadiosFieldComponent extends ListFieldBase {\n type: ComponentType.RadiosField\n options: ListFieldBase['options'] & {\n bold?: boolean\n condition?: string\n }\n}\n\nexport interface SelectFieldComponent extends ListFieldBase {\n type: ComponentType.SelectField\n options: ListFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n }\n}\n\nexport type ComponentDef = FormComponentsDef | ContentComponentsDef\n\n// Components that render form fields\nexport type FormComponentsDef =\n | InputFieldsComponentsDef\n | SelectionComponentsDef\n\n// Components that render inputs\nexport type InputFieldsComponentsDef =\n | TextFieldComponent\n | EmailAddressFieldComponent\n | NumberFieldComponent\n | MultilineTextFieldComponent\n | TelephoneNumberFieldComponent\n | MonthYearFieldComponent\n | DatePartsFieldComponent\n | UkAddressFieldComponent\n | FileUploadFieldComponent\n | DeclarationFieldComponent\n | EastingNorthingFieldComponent\n | OsGridRefFieldComponent\n | NationalGridFieldNumberFieldComponent\n | LatLongFieldComponent\n\n// Components that render content\nexport type ContentComponentsDef =\n | DetailsComponent\n | HtmlComponent\n | MarkdownComponent\n | InsetTextComponent\n | ListComponent\n\n// Components that render lists\nexport type ListComponentsDef =\n | Exclude<SelectionComponentsDef, YesNoFieldComponent>\n | ListComponent\n\n// Components that have selection fields\nexport type SelectionComponentsDef =\n | AutocompleteFieldComponent\n | CheckboxesFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n | YesNoFieldComponent\n\n// Components that have condition support\nexport type ConditionalComponentsDef = Exclude<\n ComponentDef,\n | InsetTextComponent\n | ListComponent\n | MonthYearFieldComponent\n | UkAddressFieldComponent\n | FileUploadFieldComponent\n>\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/components/types.ts"],"sourcesContent":["import { type LanguageMessages } from 'joi'\n\nimport { type ComponentType } from '~/src/components/enums.js'\nimport {\n type ListTypeContent,\n type ListTypeOption\n} from '~/src/form/form-definition/types.js'\n\nexport type ConditionalComponentType = Exclude<\n ConditionalComponentsDef['type'],\n ContentComponentsDef\n>\n\n/**\n * Types for Components JSON structure which are expected by engine and turned into actual form input/content/lists\n */\n\ninterface FormFieldBase {\n id?: string\n type: FormComponentsDef['type']\n shortDescription?: string\n name: string\n title: string\n hint?: string\n options: {\n required?: boolean\n optionalText?: boolean\n classes?: string\n customValidationMessages?: LanguageMessages\n instructionText?: string\n }\n}\n\ninterface ListFieldBase extends FormFieldBase {\n type:\n | ComponentType.AutocompleteField\n | ComponentType.CheckboxesField\n | ComponentType.RadiosField\n | ComponentType.SelectField\n list: string\n options: FormFieldBase['options'] & {\n type?: ListTypeContent\n }\n}\n\ninterface ContentFieldBase {\n id?: string\n type:\n | ComponentType.Details\n | ComponentType.Html\n | ComponentType.Markdown\n | ComponentType.InsetText\n | ComponentType.List\n name: string\n title: string\n options?: {\n required?: undefined\n optionalText?: undefined\n }\n}\n\ninterface DateFieldBase extends FormFieldBase {\n type: ComponentType.DatePartsField | ComponentType.MonthYearField\n name: string\n title: string\n hint?: string\n options: FormFieldBase['options'] & {\n maxDaysInPast?: number\n maxDaysInFuture?: number\n }\n}\n\n// Text Fields\nexport interface TextFieldComponent extends FormFieldBase {\n type: ComponentType.TextField\n options: FormFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n }\n schema: {\n max?: number\n min?: number\n length?: number\n regex?: string\n }\n}\n\nexport interface EmailAddressFieldComponent extends FormFieldBase {\n type: ComponentType.EmailAddressField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface NumberFieldComponent extends FormFieldBase {\n type: ComponentType.NumberField\n options: FormFieldBase['options'] & {\n prefix?: string\n suffix?: string\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n }\n schema: {\n max?: number\n min?: number\n precision?: number\n minPrecision?: number\n minLength?: number\n maxLength?: number\n }\n}\n\nexport interface TelephoneNumberFieldComponent extends FormFieldBase {\n type: ComponentType.TelephoneNumberField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface FileUploadFieldComponent extends FormFieldBase {\n type: ComponentType.FileUploadField\n name: string\n title: string\n hint?: string\n options: FormFieldBase['options'] & {\n accept?: string\n }\n schema: {\n max?: number\n min?: number\n length?: number\n }\n}\n\nexport interface YesNoFieldComponent extends FormFieldBase {\n type: ComponentType.YesNoField\n options: FormFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface DeclarationFieldComponent extends FormFieldBase {\n type: ComponentType.DeclarationField\n content: string\n options: FormFieldBase['options'] & {\n condition?: string\n declarationConfirmationLabel?: string\n }\n}\n\nexport interface MultilineTextFieldComponent extends FormFieldBase {\n type: ComponentType.MultilineTextField\n options: FormFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n rows?: number\n maxWords?: number\n }\n schema: {\n max?: number\n min?: number\n length?: number\n regex?: string\n }\n}\n\nexport interface UkAddressFieldComponent extends FormFieldBase {\n type: ComponentType.UkAddressField\n options: FormFieldBase['options'] & {\n hideTitle?: boolean\n usePostcodeLookup?: boolean\n }\n}\n\n// Precise Location Fields\nexport interface EastingNorthingFieldComponent extends FormFieldBase {\n type: ComponentType.EastingNorthingField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n schema?: {\n easting?: {\n min?: number\n max?: number\n }\n northing?: {\n min?: number\n max?: number\n }\n }\n}\n\nexport interface OsGridRefFieldComponent extends FormFieldBase {\n type: ComponentType.OsGridRefField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface NationalGridFieldNumberFieldComponent extends FormFieldBase {\n type: ComponentType.NationalGridFieldNumberField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface LatLongFieldComponent extends FormFieldBase {\n type: ComponentType.LatLongField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n schema?: {\n latitude?: {\n min?: number\n max?: number\n }\n longitude?: {\n min?: number\n max?: number\n }\n }\n}\n\nexport interface HiddenFieldComponent extends FormFieldBase {\n type: ComponentType.HiddenField\n options: FormFieldBase['options'] & {\n condition?: string\n }\n}\n\n// Date Fields\nexport interface DatePartsFieldComponent extends DateFieldBase {\n type: ComponentType.DatePartsField\n options: DateFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MonthYearFieldComponent extends DateFieldBase {\n type: ComponentType.MonthYearField\n options: DateFieldBase['options'] & {\n customValidationMessage?: string\n }\n}\n\n// Content Fields\nexport interface DetailsComponent extends ContentFieldBase {\n type: ComponentType.Details\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface HtmlComponent extends ContentFieldBase {\n type: ComponentType.Html\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MarkdownComponent extends ContentFieldBase {\n type: ComponentType.Markdown\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface InsetTextComponent extends ContentFieldBase {\n type: ComponentType.InsetText\n content: string\n}\n\nexport interface ListComponent extends ContentFieldBase {\n type: ComponentType.List\n hint?: string\n list: string\n options: ContentFieldBase['options'] & {\n type?: ListTypeOption\n classes?: string\n hideTitle?: boolean\n bold?: boolean\n }\n}\n\nexport interface AutocompleteFieldComponent extends ListFieldBase {\n type: ComponentType.AutocompleteField\n options: ListFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface CheckboxesFieldComponent extends ListFieldBase {\n type: ComponentType.CheckboxesField\n options: ListFieldBase['options'] & {\n bold?: boolean\n condition?: string\n }\n}\n\nexport interface RadiosFieldComponent extends ListFieldBase {\n type: ComponentType.RadiosField\n options: ListFieldBase['options'] & {\n bold?: boolean\n condition?: string\n }\n}\n\nexport interface SelectFieldComponent extends ListFieldBase {\n type: ComponentType.SelectField\n options: ListFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n }\n}\n\nexport type ComponentDef = FormComponentsDef | ContentComponentsDef\n\n// Components that render form fields\nexport type FormComponentsDef =\n | InputFieldsComponentsDef\n | SelectionComponentsDef\n\n// Components that render inputs\nexport type InputFieldsComponentsDef =\n | TextFieldComponent\n | EmailAddressFieldComponent\n | NumberFieldComponent\n | MultilineTextFieldComponent\n | TelephoneNumberFieldComponent\n | MonthYearFieldComponent\n | DatePartsFieldComponent\n | UkAddressFieldComponent\n | FileUploadFieldComponent\n | DeclarationFieldComponent\n | EastingNorthingFieldComponent\n | OsGridRefFieldComponent\n | NationalGridFieldNumberFieldComponent\n | LatLongFieldComponent\n | HiddenFieldComponent\n\n// Components that render content\nexport type ContentComponentsDef =\n | DetailsComponent\n | HtmlComponent\n | MarkdownComponent\n | InsetTextComponent\n | ListComponent\n\n// Components that render lists\nexport type ListComponentsDef =\n | Exclude<SelectionComponentsDef, YesNoFieldComponent>\n | ListComponent\n\n// Components that have selection fields\nexport type SelectionComponentsDef =\n | AutocompleteFieldComponent\n | CheckboxesFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n | YesNoFieldComponent\n\n// Components that have condition support\nexport type ConditionalComponentsDef = Exclude<\n ComponentDef,\n | InsetTextComponent\n | ListComponent\n | MonthYearFieldComponent\n | UkAddressFieldComponent\n | FileUploadFieldComponent\n>\n"],"mappings":"","ignoreList":[]}
@@ -59,7 +59,8 @@ export const customOperators = {
59
59
  [ComponentType.EastingNorthingField]: defaultOperators,
60
60
  [ComponentType.OsGridRefField]: defaultOperators,
61
61
  [ComponentType.NationalGridFieldNumberField]: defaultOperators,
62
- [ComponentType.LatLongField]: defaultOperators
62
+ [ComponentType.LatLongField]: defaultOperators,
63
+ [ComponentType.HiddenField]: undefined
63
64
  };
64
65
  export function getOperatorNames(fieldType) {
65
66
  const conditionals = getConditionals(fieldType);
@@ -1 +1 @@
1
- {"version":3,"file":"condition-operators.js","names":["ComponentType","isConditionalType","isContentType","ConditionValue","RelativeDateValue","ConditionType","DateDirections","Operator","OperatorName","defaultOperators","Is","inline","IsNot","withDefaults","operators","textFieldOperators","IsLongerThan","lengthIs","IsMoreThan","IsShorterThan","IsLessThan","HasLength","absoluteDateOperators","absoluteDate","IsBefore","IsAfter","relativeDateOperators","IsAtLeast","relativeDate","IsAtMost","customOperators","AutocompleteField","RadiosField","CheckboxesField","Contains","reverseInline","DoesNotContain","not","NumberField","DatePartsField","TextField","MultilineTextField","EmailAddressField","TelephoneNumberField","SelectField","YesNoField","DeclarationField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","getOperatorNames","fieldType","conditionals","getConditionals","Object","keys","getExpression","fieldName","operator","value","expression","type","name","field","formatValue","operatorDefinition","RelativeDate","toValue","replace","absoluteDateOperatorNames","relativeDateOperatorNames","Error","pastOperator","futureOperator","isPast","direction","PAST"],"sources":["../../../src/conditions/condition-operators.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { isConditionalType, isContentType } from '~/src/components/helpers.js'\nimport {\n type ComponentDef,\n type ConditionalComponentType\n} from '~/src/components/types.js'\nimport {\n ConditionValue,\n RelativeDateValue\n} from '~/src/conditions/condition-values.js'\nimport { type Condition } from '~/src/conditions/condition.js'\nimport {\n ConditionType,\n DateDirections,\n Operator,\n OperatorName\n} from '~/src/conditions/enums.js'\nimport {\n type Conditionals,\n type OperatorDefinition\n} from '~/src/conditions/types.js'\n\nconst defaultOperators = {\n [OperatorName.Is]: inline(Operator.Is),\n [OperatorName.IsNot]: inline(Operator.IsNot)\n}\n\nfunction withDefaults<T>(operators: T) {\n return { ...defaultOperators, ...operators }\n}\n\nconst textFieldOperators = {\n [OperatorName.IsLongerThan]: lengthIs(Operator.IsMoreThan),\n [OperatorName.IsShorterThan]: lengthIs(Operator.IsLessThan),\n [OperatorName.HasLength]: lengthIs(Operator.Is)\n}\n\nconst absoluteDateOperators = {\n [OperatorName.Is]: absoluteDate(Operator.Is),\n [OperatorName.IsNot]: absoluteDate(Operator.IsNot),\n [OperatorName.IsBefore]: absoluteDate(Operator.IsLessThan),\n [OperatorName.IsAfter]: absoluteDate(Operator.IsMoreThan)\n}\n\nconst relativeDateOperators = {\n [OperatorName.IsAtLeast]: relativeDate(Operator.IsAtMost, Operator.IsAtLeast),\n [OperatorName.IsAtMost]: relativeDate(Operator.IsAtLeast, Operator.IsAtMost),\n [OperatorName.IsLessThan]: relativeDate(\n Operator.IsMoreThan,\n Operator.IsLessThan\n ),\n [OperatorName.IsMoreThan]: relativeDate(\n Operator.IsLessThan,\n Operator.IsMoreThan\n )\n}\n\nexport const customOperators = {\n [ComponentType.AutocompleteField]: defaultOperators,\n [ComponentType.RadiosField]: defaultOperators,\n [ComponentType.CheckboxesField]: {\n [OperatorName.Contains]: reverseInline(Operator.Contains),\n [OperatorName.DoesNotContain]: not(reverseInline(Operator.Contains))\n },\n [ComponentType.NumberField]: withDefaults({\n [OperatorName.IsAtLeast]: inline(Operator.IsAtLeast),\n [OperatorName.IsAtMost]: inline(Operator.IsAtMost),\n [OperatorName.IsLessThan]: inline(Operator.IsLessThan),\n [OperatorName.IsMoreThan]: inline(Operator.IsMoreThan)\n }),\n [ComponentType.DatePartsField]: {\n ...absoluteDateOperators,\n ...relativeDateOperators\n },\n [ComponentType.TextField]: withDefaults(textFieldOperators),\n [ComponentType.MultilineTextField]: {\n [OperatorName.IsLongerThan]: lengthIs(Operator.IsMoreThan),\n [OperatorName.IsShorterThan]: lengthIs(Operator.IsLessThan)\n },\n [ComponentType.EmailAddressField]: withDefaults(textFieldOperators),\n [ComponentType.TelephoneNumberField]: defaultOperators,\n [ComponentType.SelectField]: defaultOperators,\n [ComponentType.YesNoField]: defaultOperators,\n [ComponentType.DeclarationField]: defaultOperators,\n [ComponentType.EastingNorthingField]: defaultOperators,\n [ComponentType.OsGridRefField]: defaultOperators,\n [ComponentType.NationalGridFieldNumberField]: defaultOperators,\n [ComponentType.LatLongField]: defaultOperators\n}\n\nexport function getOperatorNames(fieldType?: ConditionalComponentType) {\n const conditionals = getConditionals(fieldType)\n if (!conditionals) {\n return []\n }\n\n return Object.keys(conditionals) as OperatorName[]\n}\n\nexport function getExpression(\n fieldType: ConditionalComponentType,\n fieldName: string,\n operator: OperatorName,\n value: Condition['value']\n) {\n const conditionals = getConditionals(fieldType)\n if (!conditionals) {\n return\n }\n\n return conditionals[operator]?.expression(\n { type: fieldType, name: fieldName },\n value\n )\n}\n\nfunction getConditionals(\n fieldType?: ConditionalComponentType\n): Partial<Conditionals> | undefined {\n if (!fieldType || !isConditionalType(fieldType) || isContentType(fieldType)) {\n return\n }\n\n return fieldType in customOperators\n ? customOperators[fieldType]\n : defaultOperators\n}\n\nfunction inline(operator: Operator): OperatorDefinition {\n return {\n expression(field, value) {\n return `${field.name} ${operator} ${formatValue(field, value)}`\n }\n }\n}\n\nfunction lengthIs(operator: Operator): OperatorDefinition {\n return {\n expression(field, value) {\n return `length(${field.name}) ${operator} ${formatValue(field, value)}`\n }\n }\n}\n\nfunction reverseInline(operator: Operator.Contains): OperatorDefinition {\n return {\n expression(field, value) {\n return `${formatValue(field, value)} ${operator} ${field.name}`\n }\n }\n}\n\nfunction not(operatorDefinition: OperatorDefinition): OperatorDefinition {\n return {\n expression(field, value) {\n return `not (${operatorDefinition.expression(field, value)})`\n }\n }\n}\n\nfunction formatValue(\n field: Pick<ComponentDef, 'type'>,\n value: Condition['value']\n) {\n if (\n (field.type === ComponentType.DatePartsField &&\n value.type === ConditionType.RelativeDate) ||\n field.type === ComponentType.NumberField ||\n field.type === ComponentType.YesNoField ||\n field.type === ComponentType.DeclarationField\n ) {\n return value.toValue()\n }\n\n return `'${value.toValue().replace(/'/g, \"\\\\'\")}'`\n}\n\nexport const absoluteDateOperatorNames = Object.keys(\n absoluteDateOperators\n) as OperatorName[]\n\nexport const relativeDateOperatorNames = Object.keys(\n relativeDateOperators\n) as OperatorName[]\n\nfunction absoluteDate(operator: Operator): OperatorDefinition {\n return {\n expression(field, value) {\n if (!(value instanceof ConditionValue)) {\n throw new Error(\n \"Expression param 'value' must be ConditionValue instance\"\n )\n }\n\n return `${field.name} ${operator} ${formatValue(field, value)}`\n }\n }\n}\n\nfunction relativeDate(\n pastOperator: Operator,\n futureOperator: Operator\n): OperatorDefinition {\n return {\n expression(field, value) {\n if (!(value instanceof RelativeDateValue)) {\n throw new Error(\n \"Expression param 'value' must be RelativeDateValue instance\"\n )\n }\n\n const isPast = value.direction === DateDirections.PAST\n return `${field.name} ${isPast ? pastOperator : futureOperator} ${formatValue(field, value)}`\n }\n }\n}\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,iBAAiB,EAAEC,aAAa;AAKzC,SACEC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AAI,KAAK9D,aAAa,CAAC6C,UAAU,IACvCmB,KAAK,CAACF,IAAI,KAAK9D,aAAa,CAAC8C,gBAAgB,EAC7C;IACA,OAAOc,KAAK,CAACQ,OAAO,CAAC,CAAC;EACxB;EAEA,OAAO,IAAIR,KAAK,CAACQ,OAAO,CAAC,CAAC,CAACC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG;AACpD;AAEA,OAAO,MAAMC,yBAAyB,GAAGf,MAAM,CAACC,IAAI,CAClDlC,qBACF,CAAmB;AAEnB,OAAO,MAAMiD,yBAAyB,GAAGhB,MAAM,CAACC,IAAI,CAClD9B,qBACF,CAAmB;AAEnB,SAASH,YAAYA,CAACoC,QAAkB,EAAsB;EAC5D,OAAO;IACLE,UAAUA,CAACG,KAAK,EAAEJ,KAAK,EAAE;MACvB,IAAI,EAAEA,KAAK,YAAYzD,cAAc,CAAC,EAAE;QACtC,MAAM,IAAIqE,KAAK,CACb,0DACF,CAAC;MACH;MAEA,OAAO,GAAGR,KAAK,CAACD,IAAI,IAAIJ,QAAQ,IAAIM,WAAW,CAACD,KAAK,EAAEJ,KAAK,CAAC,EAAE;IACjE;EACF,CAAC;AACH;AAEA,SAAShC,YAAYA,CACnB6C,YAAsB,EACtBC,cAAwB,EACJ;EACpB,OAAO;IACLb,UAAUA,CAACG,KAAK,EAAEJ,KAAK,EAAE;MACvB,IAAI,EAAEA,KAAK,YAAYxD,iBAAiB,CAAC,EAAE;QACzC,MAAM,IAAIoE,KAAK,CACb,6DACF,CAAC;MACH;MAEA,MAAMG,MAAM,GAAGf,KAAK,CAACgB,SAAS,KAAKtE,cAAc,CAACuE,IAAI;MACtD,OAAO,GAAGb,KAAK,CAACD,IAAI,IAAIY,MAAM,GAAGF,YAAY,GAAGC,cAAc,IAAIT,WAAW,CAACD,KAAK,EAAEJ,KAAK,CAAC,EAAE;IAC/F;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"condition-operators.js","names":["ComponentType","isConditionalType","isContentType","ConditionValue","RelativeDateValue","ConditionType","DateDirections","Operator","OperatorName","defaultOperators","Is","inline","IsNot","withDefaults","operators","textFieldOperators","IsLongerThan","lengthIs","IsMoreThan","IsShorterThan","IsLessThan","HasLength","absoluteDateOperators","absoluteDate","IsBefore","IsAfter","relativeDateOperators","IsAtLeast","relativeDate","IsAtMost","customOperators","AutocompleteField","RadiosField","CheckboxesField","Contains","reverseInline","DoesNotContain","not","NumberField","DatePartsField","TextField","MultilineTextField","EmailAddressField","TelephoneNumberField","SelectField","YesNoField","DeclarationField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","HiddenField","undefined","getOperatorNames","fieldType","conditionals","getConditionals","Object","keys","getExpression","fieldName","operator","value","expression","type","name","field","formatValue","operatorDefinition","RelativeDate","toValue","replace","absoluteDateOperatorNames","relativeDateOperatorNames","Error","pastOperator","futureOperator","isPast","direction","PAST"],"sources":["../../../src/conditions/condition-operators.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { isConditionalType, isContentType } from '~/src/components/helpers.js'\nimport {\n type ComponentDef,\n type ConditionalComponentType\n} from '~/src/components/types.js'\nimport {\n ConditionValue,\n RelativeDateValue\n} from '~/src/conditions/condition-values.js'\nimport { type Condition } from '~/src/conditions/condition.js'\nimport {\n ConditionType,\n DateDirections,\n Operator,\n OperatorName\n} from '~/src/conditions/enums.js'\nimport {\n type Conditionals,\n type OperatorDefinition\n} from '~/src/conditions/types.js'\n\nconst defaultOperators = {\n [OperatorName.Is]: inline(Operator.Is),\n [OperatorName.IsNot]: inline(Operator.IsNot)\n}\n\nfunction withDefaults<T>(operators: T) {\n return { ...defaultOperators, ...operators }\n}\n\nconst textFieldOperators = {\n [OperatorName.IsLongerThan]: lengthIs(Operator.IsMoreThan),\n [OperatorName.IsShorterThan]: lengthIs(Operator.IsLessThan),\n [OperatorName.HasLength]: lengthIs(Operator.Is)\n}\n\nconst absoluteDateOperators = {\n [OperatorName.Is]: absoluteDate(Operator.Is),\n [OperatorName.IsNot]: absoluteDate(Operator.IsNot),\n [OperatorName.IsBefore]: absoluteDate(Operator.IsLessThan),\n [OperatorName.IsAfter]: absoluteDate(Operator.IsMoreThan)\n}\n\nconst relativeDateOperators = {\n [OperatorName.IsAtLeast]: relativeDate(Operator.IsAtMost, Operator.IsAtLeast),\n [OperatorName.IsAtMost]: relativeDate(Operator.IsAtLeast, Operator.IsAtMost),\n [OperatorName.IsLessThan]: relativeDate(\n Operator.IsMoreThan,\n Operator.IsLessThan\n ),\n [OperatorName.IsMoreThan]: relativeDate(\n Operator.IsLessThan,\n Operator.IsMoreThan\n )\n}\n\nexport const customOperators = {\n [ComponentType.AutocompleteField]: defaultOperators,\n [ComponentType.RadiosField]: defaultOperators,\n [ComponentType.CheckboxesField]: {\n [OperatorName.Contains]: reverseInline(Operator.Contains),\n [OperatorName.DoesNotContain]: not(reverseInline(Operator.Contains))\n },\n [ComponentType.NumberField]: withDefaults({\n [OperatorName.IsAtLeast]: inline(Operator.IsAtLeast),\n [OperatorName.IsAtMost]: inline(Operator.IsAtMost),\n [OperatorName.IsLessThan]: inline(Operator.IsLessThan),\n [OperatorName.IsMoreThan]: inline(Operator.IsMoreThan)\n }),\n [ComponentType.DatePartsField]: {\n ...absoluteDateOperators,\n ...relativeDateOperators\n },\n [ComponentType.TextField]: withDefaults(textFieldOperators),\n [ComponentType.MultilineTextField]: {\n [OperatorName.IsLongerThan]: lengthIs(Operator.IsMoreThan),\n [OperatorName.IsShorterThan]: lengthIs(Operator.IsLessThan)\n },\n [ComponentType.EmailAddressField]: withDefaults(textFieldOperators),\n [ComponentType.TelephoneNumberField]: defaultOperators,\n [ComponentType.SelectField]: defaultOperators,\n [ComponentType.YesNoField]: defaultOperators,\n [ComponentType.DeclarationField]: defaultOperators,\n [ComponentType.EastingNorthingField]: defaultOperators,\n [ComponentType.OsGridRefField]: defaultOperators,\n [ComponentType.NationalGridFieldNumberField]: defaultOperators,\n [ComponentType.LatLongField]: defaultOperators,\n [ComponentType.HiddenField]: undefined\n}\n\nexport function getOperatorNames(fieldType?: ConditionalComponentType) {\n const conditionals = getConditionals(fieldType)\n if (!conditionals) {\n return []\n }\n\n return Object.keys(conditionals) as OperatorName[]\n}\n\nexport function getExpression(\n fieldType: ConditionalComponentType,\n fieldName: string,\n operator: OperatorName,\n value: Condition['value']\n) {\n const conditionals = getConditionals(fieldType)\n if (!conditionals) {\n return\n }\n\n return conditionals[operator]?.expression(\n { type: fieldType, name: fieldName },\n value\n )\n}\n\nfunction getConditionals(\n fieldType?: ConditionalComponentType\n): Partial<Conditionals> | undefined {\n if (!fieldType || !isConditionalType(fieldType) || isContentType(fieldType)) {\n return\n }\n\n return fieldType in customOperators\n ? customOperators[fieldType]\n : defaultOperators\n}\n\nfunction inline(operator: Operator): OperatorDefinition {\n return {\n expression(field, value) {\n return `${field.name} ${operator} ${formatValue(field, value)}`\n }\n }\n}\n\nfunction lengthIs(operator: Operator): OperatorDefinition {\n return {\n expression(field, value) {\n return `length(${field.name}) ${operator} ${formatValue(field, value)}`\n }\n }\n}\n\nfunction reverseInline(operator: Operator.Contains): OperatorDefinition {\n return {\n expression(field, value) {\n return `${formatValue(field, value)} ${operator} ${field.name}`\n }\n }\n}\n\nfunction not(operatorDefinition: OperatorDefinition): OperatorDefinition {\n return {\n expression(field, value) {\n return `not (${operatorDefinition.expression(field, value)})`\n }\n }\n}\n\nfunction formatValue(\n field: Pick<ComponentDef, 'type'>,\n value: Condition['value']\n) {\n if (\n (field.type === ComponentType.DatePartsField &&\n value.type === ConditionType.RelativeDate) ||\n field.type === ComponentType.NumberField ||\n field.type === ComponentType.YesNoField ||\n field.type === ComponentType.DeclarationField\n ) {\n return value.toValue()\n }\n\n return `'${value.toValue().replace(/'/g, \"\\\\'\")}'`\n}\n\nexport const absoluteDateOperatorNames = Object.keys(\n absoluteDateOperators\n) as OperatorName[]\n\nexport const relativeDateOperatorNames = Object.keys(\n relativeDateOperators\n) as OperatorName[]\n\nfunction absoluteDate(operator: Operator): OperatorDefinition {\n return {\n expression(field, value) {\n if (!(value instanceof ConditionValue)) {\n throw new Error(\n \"Expression param 'value' must be ConditionValue instance\"\n )\n }\n\n return `${field.name} ${operator} ${formatValue(field, value)}`\n }\n }\n}\n\nfunction relativeDate(\n pastOperator: Operator,\n futureOperator: Operator\n): OperatorDefinition {\n return {\n expression(field, value) {\n if (!(value instanceof RelativeDateValue)) {\n throw new Error(\n \"Expression param 'value' must be RelativeDateValue instance\"\n )\n }\n\n const isPast = value.direction === DateDirections.PAST\n return `${field.name} ${isPast ? pastOperator : futureOperator} ${formatValue(field, value)}`\n }\n }\n}\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,iBAAiB,EAAEC,aAAa;AAKzC,SACEC,cAAc,EACdC,iBAAiB;AAGnB,SACEC,aAAa,EACbC,cAAc,EACdC,QAAQ,EACRC,YAAY;AAOd,MAAMC,gBAAgB,GAAG;EACvB,CAACD,YAAY,CAACE,EAAE,GAAGC,MAAM,CAACJ,QAAQ,CAACG,EAAE,CAAC;EACtC,CAACF,YAAY,CAACI,KAAK,GAAGD,MAAM,CAACJ,QAAQ,CAACK,KAAK;AAC7C,CAAC;AAED,SAASC,YAAYA,CAAIC,SAAY,EAAE;EACrC,OAAO;IAAE,GAAGL,gBAAgB;IAAE,GAAGK;EAAU,CAAC;AAC9C;AAEA,MAAMC,kBAAkB,GAAG;EACzB,CAACP,YAAY,CAACQ,YAAY,GAAGC,QAAQ,CAACV,QAAQ,CAACW,UAAU,CAAC;EAC1D,CAACV,YAAY,CAACW,aAAa,GAAGF,QAAQ,CAACV,QAAQ,CAACa,UAAU,CAAC;EAC3D,CAACZ,YAAY,CAACa,SAAS,GAAGJ,QAAQ,CAACV,QAAQ,CAACG,EAAE;AAChD,CAAC;AAED,MAAMY,qBAAqB,GAAG;EAC5B,CAACd,YAAY,CAACE,EAAE,GAAGa,YAAY,CAAChB,QAAQ,CAACG,EAAE,CAAC;EAC5C,CAACF,YAAY,CAACI,KAAK,G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,CAAC;AACH;AAEA,SAASlC,YAAYA,CACnB+C,YAAsB,EACtBC,cAAwB,EACJ;EACpB,OAAO;IACLb,UAAUA,CAACG,KAAK,EAAEJ,KAAK,EAAE;MACvB,IAAI,EAAEA,KAAK,YAAY1D,iBAAiB,CAAC,EAAE;QACzC,MAAM,IAAIsE,KAAK,CACb,6DACF,CAAC;MACH;MAEA,MAAMG,MAAM,GAAGf,KAAK,CAACgB,SAAS,KAAKxE,cAAc,CAACyE,IAAI;MACtD,OAAO,GAAGb,KAAK,CAACD,IAAI,IAAIY,MAAM,GAAGF,YAAY,GAAGC,cAAc,IAAIT,WAAW,CAACD,KAAK,EAAEJ,KAAK,CAAC,EAAE;IAC/F;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,3 +1,6 @@
1
+ import { ComponentType } from "../../components/enums.js";
2
+ import { hasComponents } from "../../pages/helpers.js";
3
+
1
4
  /**
2
5
  * TypeGuard to check if something is a FormDefinition
3
6
  * @param { unknown } definition
@@ -21,4 +24,20 @@ export function isConditionListItemRefValueData(conditionValueData) {
21
24
  }
22
25
  return typeof conditionValueData === 'object' && 'listId' in conditionValueData && 'itemId' in conditionValueData;
23
26
  }
27
+
28
+ /**
29
+ * Returns an array of all hidden fields in a form
30
+ * @param definition - form definition
31
+ */
32
+ export function getHiddenFields(definition) {
33
+ if (definition.pages.length === 0) {
34
+ return [];
35
+ }
36
+ const totalHiddenFields = [];
37
+ for (const page of definition.pages) {
38
+ const hiddenFields = hasComponents(page) ? page.components.filter(comp => comp.type === ComponentType.HiddenField) : [];
39
+ totalHiddenFields.push(...hiddenFields);
40
+ }
41
+ return totalHiddenFields;
42
+ }
24
43
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","names":["isFormDefinition","definition","isConditionListItemRefValueData","conditionValueData"],"sources":["../../../../src/form/form-definition/helpers.ts"],"sourcesContent":["import { type ConditionListItemRefValueDataV2 } from '~/src/conditions/types.js'\nimport { type FormDefinition } from '~/src/form/form-definition/types.js'\n\n/**\n * TypeGuard to check if something is a FormDefinition\n * @param { unknown } definition\n * @returns { definition is FormDefinition }\n */\nexport function isFormDefinition(\n definition: unknown\n): definition is FormDefinition {\n if (!definition) {\n return false\n }\n\n return (\n typeof definition === 'object' &&\n 'name' in definition &&\n 'pages' in definition &&\n 'conditions' in definition\n )\n}\n\n/**\n * TypeGuard to check if something is a ConditionListItemRefValueDataV2\n * @param { unknown } conditionValueData\n * @returns { definition is ConditionListItemRefValueDataV2 }\n */\nexport function isConditionListItemRefValueData(\n conditionValueData: unknown\n): conditionValueData is ConditionListItemRefValueDataV2 {\n if (!conditionValueData) {\n return false\n }\n\n return (\n typeof conditionValueData === 'object' &&\n 'listId' in conditionValueData &&\n 'itemId' in conditionValueData\n )\n}\n"],"mappings":"AAGA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,gBAAgBA,CAC9BC,UAAmB,EACW;EAC9B,IAAI,CAACA,UAAU,EAAE;IACf,OAAO,KAAK;EACd;EAEA,OACE,OAAOA,UAAU,KAAK,QAAQ,IAC9B,MAAM,IAAIA,UAAU,IACpB,OAAO,IAAIA,UAAU,IACrB,YAAY,IAAIA,UAAU;AAE9B;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,+BAA+BA,CAC7CC,kBAA2B,EAC4B;EACvD,IAAI,CAACA,kBAAkB,EAAE;IACvB,OAAO,KAAK;EACd;EAEA,OACE,OAAOA,kBAAkB,KAAK,QAAQ,IACtC,QAAQ,IAAIA,kBAAkB,IAC9B,QAAQ,IAAIA,kBAAkB;AAElC","ignoreList":[]}
1
+ {"version":3,"file":"helpers.js","names":["ComponentType","hasComponents","isFormDefinition","definition","isConditionListItemRefValueData","conditionValueData","getHiddenFields","pages","length","totalHiddenFields","page","hiddenFields","components","filter","comp","type","HiddenField","push"],"sources":["../../../../src/form/form-definition/helpers.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport { type ConditionListItemRefValueDataV2 } from '~/src/conditions/types.js'\nimport { type FormDefinition } from '~/src/form/form-definition/types.js'\nimport { hasComponents } from '~/src/pages/helpers.js'\n\n/**\n * TypeGuard to check if something is a FormDefinition\n * @param { unknown } definition\n * @returns { definition is FormDefinition }\n */\nexport function isFormDefinition(\n definition: unknown\n): definition is FormDefinition {\n if (!definition) {\n return false\n }\n\n return (\n typeof definition === 'object' &&\n 'name' in definition &&\n 'pages' in definition &&\n 'conditions' in definition\n )\n}\n\n/**\n * TypeGuard to check if something is a ConditionListItemRefValueDataV2\n * @param { unknown } conditionValueData\n * @returns { definition is ConditionListItemRefValueDataV2 }\n */\nexport function isConditionListItemRefValueData(\n conditionValueData: unknown\n): conditionValueData is ConditionListItemRefValueDataV2 {\n if (!conditionValueData) {\n return false\n }\n\n return (\n typeof conditionValueData === 'object' &&\n 'listId' in conditionValueData &&\n 'itemId' in conditionValueData\n )\n}\n\n/**\n * Returns an array of all hidden fields in a form\n * @param definition - form definition\n */\nexport function getHiddenFields(definition: FormDefinition) {\n if (definition.pages.length === 0) {\n return []\n }\n const totalHiddenFields = [] as ComponentDef[]\n for (const page of definition.pages) {\n const hiddenFields = hasComponents(page)\n ? page.components.filter(\n (comp) => comp.type === ComponentType.HiddenField\n )\n : []\n totalHiddenFields.push(...hiddenFields)\n }\n return totalHiddenFields\n}\n"],"mappings":"AAAA,SAASA,aAAa;AAItB,SAASC,aAAa;;AAEtB;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,UAAmB,EACW;EAC9B,IAAI,CAACA,UAAU,EAAE;IACf,OAAO,KAAK;EACd;EAEA,OACE,OAAOA,UAAU,KAAK,QAAQ,IAC9B,MAAM,IAAIA,UAAU,IACpB,OAAO,IAAIA,UAAU,IACrB,YAAY,IAAIA,UAAU;AAE9B;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,+BAA+BA,CAC7CC,kBAA2B,EAC4B;EACvD,IAAI,CAACA,kBAAkB,EAAE;IACvB,OAAO,KAAK;EACd;EAEA,OACE,OAAOA,kBAAkB,KAAK,QAAQ,IACtC,QAAQ,IAAIA,kBAAkB,IAC9B,QAAQ,IAAIA,kBAAkB;AAElC;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAACH,UAA0B,EAAE;EAC1D,IAAIA,UAAU,CAACI,KAAK,CAACC,MAAM,KAAK,CAAC,EAAE;IACjC,OAAO,EAAE;EACX;EACA,MAAMC,iBAAiB,GAAG,EAAoB;EAC9C,KAAK,MAAMC,IAAI,IAAIP,UAAU,CAACI,KAAK,EAAE;IACnC,MAAMI,YAAY,GAAGV,aAAa,CAACS,IAAI,CAAC,GACpCA,IAAI,CAACE,UAAU,CAACC,MAAM,CACnBC,IAAI,IAAKA,IAAI,CAACC,IAAI,KAAKf,aAAa,CAACgB,WACxC,CAAC,GACD,EAAE;IACNP,iBAAiB,CAACQ,IAAI,CAAC,GAAGN,YAAY,CAAC;EACzC;EACA,OAAOF,iBAAiB;AAC1B","ignoreList":[]}
@@ -222,6 +222,32 @@ export class DeclarationPreviewElements extends QuestionPreviewElements {
222
222
  }
223
223
  }
224
224
 
225
+ /**
226
+ * @implements {LocationElements}
227
+ */
228
+ export class LocationPreviewElements extends QuestionPreviewElements {
229
+ /**
230
+ * @param {BaseSettings & {instructionText?: string}} elements
231
+ */
232
+ constructor({
233
+ instructionText,
234
+ ...elements
235
+ }) {
236
+ super(elements);
237
+ this._instructionText = instructionText ?? '';
238
+ }
239
+
240
+ /**
241
+ * @returns {LocationSettings}
242
+ */
243
+ get values() {
244
+ return {
245
+ ...super.values,
246
+ instructionText: this._instructionText
247
+ };
248
+ }
249
+ }
250
+
225
251
  /**
226
252
  * @implements {PageOverviewElements}
227
253
  */
@@ -426,6 +452,6 @@ export class NumberPreviewElements {
426
452
  /**
427
453
  * @import { ListElement } from '~/src/form/form-editor/types.js'
428
454
  * @import { PagePreviewPanelMacro } from '~/src/form/form-editor/macros/types.js'
429
- * @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'
430
456
  */
431
457
  //# sourceMappingURL=preview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"preview.js","names":["Question","QuestionRendererStub","renderMock","constructor","render","questionTemplate","questionBaseModel","buildHTML","_questionTemplate","_renderContext","PageRendererStub","pageTemplate","pagePreviewPanelMacro","QuestionPreviewElements","_question","_hintText","_optional","_shortDesc","_userClasses","_content","_items","afterInputsHTML","question","hintText","optional","shortDesc","userClasses","items","content","values","setPreviewHTML","_value","setPreviewDOM","AutocompletePreviewElements","autocompleteOptions","elements","UkAddressPreviewElements","usePostcodeLookup","_usePostcodeLookup","DeclarationPreviewElements","declarationText","_declarationText","PagePreviewElements","guidance","heading","addHeading","repeatQuestion","hasRepeater","undefined","length","baseElements","largeTitle","numberElements","prefix","suffix","list1Id","list2Id","list3Id","list4Id","listElementsBase","label","text","value","id","listElementsStub","buildPreviewShortAnswer","partialBaseElements","NumberPreviewElements","_prefix","_suffix"],"sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\n/**\n * @implements {QuestionRenderer}\n */\nexport class QuestionRendererStub {\n /**\n * @type {jest.Mock<void, [string, QuestionBaseModel]>}\n */\n renderMock\n\n /**\n * @param {jest.Mock<void, [string, QuestionBaseModel]>} renderMock\n */\n constructor(renderMock) {\n this.renderMock = renderMock\n }\n\n /**\n * @param {string} questionTemplate\n * @param {QuestionBaseModel} questionBaseModel\n */\n render(questionTemplate, questionBaseModel) {\n this.renderMock(questionTemplate, questionBaseModel)\n }\n\n /**\n * @returns {string}\n * @param {string} _questionTemplate\n * @param {RenderContext} _renderContext\n */\n static buildHTML(_questionTemplate, _renderContext) {\n return '**** BUILT HTML ****'\n }\n}\n\n/**\n * @implements {PageRenderer}\n */\nexport class PageRendererStub {\n /**\n * @type {jest.Mock<void, [string, PagePreviewPanelMacro]>}\n */\n renderMock\n\n /**\n * @param {jest.Mock<void, [string, PagePreviewPanelMacro]>} renderMock\n */\n constructor(renderMock) {\n this.renderMock = renderMock\n }\n\n /**\n * @param {string} pageTemplate\n * @param {PagePreviewPanelMacro} pagePreviewPanelMacro\n */\n render(pageTemplate, pagePreviewPanelMacro) {\n this.renderMock(pageTemplate, pagePreviewPanelMacro)\n }\n\n /**\n * @returns {string}\n * @param {string} _questionTemplate\n * @param {RenderContext} _renderContext\n */\n static buildHTML(_questionTemplate, _renderContext) {\n return '**** BUILT HTML ****'\n }\n}\n\n/**\n * @implements {ListElements}\n */\nexport class QuestionPreviewElements {\n /**\n * @protected\n */\n _question = ''\n /** @protected */\n _hintText = ''\n /** @protected */\n _optional = false\n /**\n * @type {string}\n * @protected\n */\n _shortDesc = ''\n /**\n * @type {string}\n * @protected\n */\n _userClasses = ''\n /**\n * @type {string}\n * @protected\n */\n _content = ''\n /**\n *\n * @type {ListElement[]}\n * @private\n */\n _items = []\n afterInputsHTML = '<div class=\"govuk-inset-text\">No items added yet.</div>'\n\n /**\n * @param {BaseSettings} baseSettings\n */\n constructor({\n question,\n hintText,\n optional,\n shortDesc,\n userClasses,\n items,\n content\n }) {\n this._question = question\n this._hintText = hintText\n this._optional = optional\n this._shortDesc = shortDesc\n this._userClasses = userClasses\n this._items = items\n this._content = content\n }\n\n /**\n * @returns {BaseSettings}\n */\n get values() {\n return {\n question: this._question,\n hintText: this._hintText,\n optional: this._optional,\n shortDesc: this._shortDesc,\n userClasses: this._userClasses,\n items: this._items,\n content: this._content\n }\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n // Not implemented for server side render\n }\n\n /**\n * @param {HTMLElement} _value\n */\n setPreviewDOM(_value) {\n // Not implemented for server side render\n }\n}\n\n/**\n * @implements {AutocompleteElements}\n */\nexport class AutocompletePreviewElements extends QuestionPreviewElements {\n /**\n * @param {BaseSettings & {autocompleteOptions: string}} elements\n */\n constructor({ autocompleteOptions, ...elements }) {\n super(elements)\n this.autocompleteOptions = autocompleteOptions\n }\n}\n\n/**\n * @implements {UkAddressElements}\n */\nexport class UkAddressPreviewElements extends QuestionPreviewElements {\n /**\n * @param {BaseSettings & {usePostcodeLookup?: boolean}} elements\n */\n constructor({ usePostcodeLookup, ...elements }) {\n super(elements)\n this._usePostcodeLookup = usePostcodeLookup ?? false\n }\n\n /**\n * @returns {UkAddressSettings}\n */\n get values() {\n return {\n ...super.values,\n usePostcodeLookup: this._usePostcodeLookup\n }\n }\n}\n\n/**\n * @implements {DeclarationElements}\n */\nexport class DeclarationPreviewElements extends QuestionPreviewElements {\n /**\n * @param {BaseSettings & {declarationText: string}} elements\n */\n constructor({ declarationText, ...elements }) {\n super(elements)\n this._declarationText = declarationText\n }\n\n /**\n * @returns {DeclarationSettings}\n */\n get values() {\n return {\n ...super.values,\n declarationText: this._declarationText\n }\n }\n}\n\n/**\n * @implements {PageOverviewElements}\n */\nexport class PagePreviewElements {\n guidance\n heading\n addHeading\n repeatQuestion\n hasRepeater\n\n /**\n * @param {string} heading\n * @param {string} guidance\n * @param {boolean} [addHeading]\n * @param {string} repeatQuestion\n * @param {boolean} hasRepeater\n */\n constructor(\n heading,\n guidance = '',\n addHeading = undefined,\n repeatQuestion = '',\n hasRepeater = false\n ) {\n this.heading = heading\n this.guidance = guidance\n this.addHeading = addHeading ?? heading.length > 0\n this.repeatQuestion = repeatQuestion\n this.hasRepeater = hasRepeater\n }\n}\n\nexport const baseElements = /** @type {BaseSettings} */ ({\n items: [],\n optional: false,\n question: 'Which quest would you like to pick?',\n hintText: 'Choose one adventure that best suits you.',\n userClasses: '',\n shortDesc: '',\n content: '',\n largeTitle: true\n})\n\nexport const numberElements = /** @type {NumberSettings} */ ({\n items: [],\n optional: false,\n question: 'Which quest would you like to pick?',\n hintText: 'Choose one adventure that best suits you.',\n userClasses: '',\n shortDesc: '',\n content: '',\n largeTitle: true,\n prefix: '',\n suffix: ''\n})\n\nconst list1Id = '414d82a3-4cab-416a-bd54-6b86fbd51120'\nconst list2Id = '801385a4-81e6-4171-96c3-6c6727d97f22'\nconst list3Id = 'e6e3f621-b875-4ca3-a054-cca9149149dd'\nconst list4Id = 'd71b3909-582f-4e90-b6f5-490b89a6eb8f'\n\nconst listElementsBase = /** @type {BaseSettings} */ ({\n ...baseElements,\n items: [\n {\n label: { text: 'Treasure Hunting' },\n text: 'Treasure Hunting',\n value: 'Treasure Hunting',\n id: list1Id\n },\n {\n label: { text: 'Rescuing the princess' },\n text: 'Rescuing the princess',\n value: 'Rescuing the princess',\n id: list2Id\n },\n {\n label: { text: 'Saving a city' },\n text: 'Saving a city',\n value: 'Saving a city',\n id: list3Id\n },\n {\n label: { text: 'Defeating the baron' },\n text: 'Defeating the baron',\n value: 'Defeating the baron',\n id: list4Id\n }\n ]\n})\n\nexport const listElementsStub = {\n list1Id,\n list2Id,\n list3Id,\n list4Id,\n baseElements: listElementsBase\n}\n\n/**\n * @param {Partial<BaseSettings>} partialBaseElements\n * @param {jest.Mock<void, [string, QuestionBaseModel]>} renderMock\n * @returns {Question}\n */\nexport function buildPreviewShortAnswer(partialBaseElements, renderMock) {\n return new Question(\n new QuestionPreviewElements({\n ...baseElements,\n ...partialBaseElements\n }),\n new QuestionRendererStub(renderMock)\n )\n}\n\nexport class NumberPreviewElements {\n /**\n * @protected\n */\n _question = ''\n /** @protected */\n _hintText = ''\n /** @protected */\n _optional = false\n /**\n * @type {string}\n * @protected\n */\n _shortDesc = ''\n /**\n * @type {string}\n * @protected\n */\n _userClasses = ''\n /**\n * @type {string}\n * @protected\n */\n _prefix = ''\n /**\n * @type {string}\n * @protected\n */\n _suffix = ''\n /**\n * @type {string}\n * @protected\n */\n _content = ''\n /**\n *\n * @type {ListElement[]}\n * @private\n */\n _items = []\n afterInputsHTML = '<div class=\"govuk-inset-text\">No items added yet.</div>'\n\n /**\n * @param {NumberSettings} baseSettings\n */\n constructor({\n question,\n hintText,\n optional,\n shortDesc,\n userClasses,\n prefix,\n suffix,\n items,\n content\n }) {\n this._question = question\n this._hintText = hintText\n this._optional = optional\n this._shortDesc = shortDesc\n this._userClasses = userClasses\n this._prefix = prefix\n this._suffix = suffix\n this._items = items\n this._content = content\n }\n\n /**\n * @returns {NumberSettings}\n */\n get values() {\n return {\n question: this._question,\n hintText: this._hintText,\n optional: this._optional,\n shortDesc: this._shortDesc,\n userClasses: this._userClasses,\n prefix: this._prefix,\n suffix: this._suffix,\n items: this._items,\n content: this._content\n }\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n // Not implemented for server side render\n }\n\n /**\n * @param {HTMLElement} _value\n */\n setPreviewDOM(_value) {\n // Not implemented for server side render\n }\n}\n\n/**\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n * @import { PagePreviewPanelMacro } from '~/src/form/form-editor/macros/types.js'\n * @import { BaseSettings, ListElements, NumberSettings, RenderContext, QuestionBaseModel, QuestionRenderer, AutocompleteElements, PageOverviewElements, PageRenderer, UkAddressElements, UkAddressSettings, DeclarationElements, DeclarationSettings } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,QAAQ;;AAEjB;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,CAAC;EAChC;AACF;AACA;EACEC,UAAU;;EAEV;AACF;AACA;EACEC,WAAWA,CAACD,UAAU,EAAE;IACtB,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B;;EAEA;AACF;AACA;AACA;EACEE,MAAMA,CAACC,gBAAgB,EAAEC,iBAAiB,EAAE;IAC1C,IAAI,CAACJ,UAAU,CAACG,gBAAgB,EAAEC,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E,IAAI,CAACR,YAAY;MAC9BmC,MAAM,EAAE,IAAI,CAACe,OAAO;MACpBd,MAAM,EAAE,IAAI,CAACe,OAAO;MACpB1C,KAAK,EAAE,IAAI,CAACP,MAAM;MAClBQ,OAAO,EAAE,IAAI,CAACT;IAChB,CAAC;EACH;;EAEA;AACF;AACA;EACEW,cAAcA,CAACC,MAAM,EAAE;IACrB;EAAA;;EAGF;AACF;AACA;EACEC,aAAaA,CAACD,MAAM,EAAE;IACpB;EAAA;AAEJ;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"preview.js","names":["Question","QuestionRendererStub","renderMock","constructor","render","questionTemplate","questionBaseModel","buildHTML","_questionTemplate","_renderContext","PageRendererStub","pageTemplate","pagePreviewPanelMacro","QuestionPreviewElements","_question","_hintText","_optional","_shortDesc","_userClasses","_content","_items","afterInputsHTML","question","hintText","optional","shortDesc","userClasses","items","content","values","setPreviewHTML","_value","setPreviewDOM","AutocompletePreviewElements","autocompleteOptions","elements","UkAddressPreviewElements","usePostcodeLookup","_usePostcodeLookup","DeclarationPreviewElements","declarationText","_declarationText","LocationPreviewElements","instructionText","_instructionText","PagePreviewElements","guidance","heading","addHeading","repeatQuestion","hasRepeater","undefined","length","baseElements","largeTitle","numberElements","prefix","suffix","list1Id","list2Id","list3Id","list4Id","listElementsBase","label","text","value","id","listElementsStub","buildPreviewShortAnswer","partialBaseElements","NumberPreviewElements","_prefix","_suffix"],"sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\n/**\n * @implements {QuestionRenderer}\n */\nexport class QuestionRendererStub {\n /**\n * @type {jest.Mock<void, [string, QuestionBaseModel]>}\n */\n renderMock\n\n /**\n * @param {jest.Mock<void, [string, QuestionBaseModel]>} renderMock\n */\n constructor(renderMock) {\n this.renderMock = renderMock\n }\n\n /**\n * @param {string} questionTemplate\n * @param {QuestionBaseModel} questionBaseModel\n */\n render(questionTemplate, questionBaseModel) {\n this.renderMock(questionTemplate, questionBaseModel)\n }\n\n /**\n * @returns {string}\n * @param {string} _questionTemplate\n * @param {RenderContext} _renderContext\n */\n static buildHTML(_questionTemplate, _renderContext) {\n return '**** BUILT HTML ****'\n }\n}\n\n/**\n * @implements {PageRenderer}\n */\nexport class PageRendererStub {\n /**\n * @type {jest.Mock<void, [string, PagePreviewPanelMacro]>}\n */\n renderMock\n\n /**\n * @param {jest.Mock<void, [string, PagePreviewPanelMacro]>} renderMock\n */\n constructor(renderMock) {\n this.renderMock = renderMock\n }\n\n /**\n * @param {string} pageTemplate\n * @param {PagePreviewPanelMacro} pagePreviewPanelMacro\n */\n render(pageTemplate, pagePreviewPanelMacro) {\n this.renderMock(pageTemplate, pagePreviewPanelMacro)\n }\n\n /**\n * @returns {string}\n * @param {string} _questionTemplate\n * @param {RenderContext} _renderContext\n */\n static buildHTML(_questionTemplate, _renderContext) {\n return '**** BUILT HTML ****'\n }\n}\n\n/**\n * @implements {ListElements}\n */\nexport class QuestionPreviewElements {\n /**\n * @protected\n */\n _question = ''\n /** @protected */\n _hintText = ''\n /** @protected */\n _optional = false\n /**\n * @type {string}\n * @protected\n */\n _shortDesc = ''\n /**\n * @type {string}\n * @protected\n */\n _userClasses = ''\n /**\n * @type {string}\n * @protected\n */\n _content = ''\n /**\n *\n * @type {ListElement[]}\n * @private\n */\n _items = []\n afterInputsHTML = '<div class=\"govuk-inset-text\">No items added yet.</div>'\n\n /**\n * @param {BaseSettings} baseSettings\n */\n constructor({\n question,\n hintText,\n optional,\n shortDesc,\n userClasses,\n items,\n content\n }) {\n this._question = question\n this._hintText = hintText\n this._optional = optional\n this._shortDesc = shortDesc\n this._userClasses = userClasses\n this._items = items\n this._content = content\n }\n\n /**\n * @returns {BaseSettings}\n */\n get values() {\n return {\n question: this._question,\n hintText: this._hintText,\n optional: this._optional,\n shortDesc: this._shortDesc,\n userClasses: this._userClasses,\n items: this._items,\n content: this._content\n }\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n // Not implemented for server side render\n }\n\n /**\n * @param {HTMLElement} _value\n */\n setPreviewDOM(_value) {\n // Not implemented for server side render\n }\n}\n\n/**\n * @implements {AutocompleteElements}\n */\nexport class AutocompletePreviewElements extends QuestionPreviewElements {\n /**\n * @param {BaseSettings & {autocompleteOptions: string}} elements\n */\n constructor({ autocompleteOptions, ...elements }) {\n super(elements)\n this.autocompleteOptions = autocompleteOptions\n }\n}\n\n/**\n * @implements {UkAddressElements}\n */\nexport class UkAddressPreviewElements extends QuestionPreviewElements {\n /**\n * @param {BaseSettings & {usePostcodeLookup?: boolean}} elements\n */\n constructor({ usePostcodeLookup, ...elements }) {\n super(elements)\n this._usePostcodeLookup = usePostcodeLookup ?? false\n }\n\n /**\n * @returns {UkAddressSettings}\n */\n get values() {\n return {\n ...super.values,\n usePostcodeLookup: this._usePostcodeLookup\n }\n }\n}\n\n/**\n * @implements {DeclarationElements}\n */\nexport class DeclarationPreviewElements extends QuestionPreviewElements {\n /**\n * @param {BaseSettings & {declarationText: string}} elements\n */\n constructor({ declarationText, ...elements }) {\n super(elements)\n this._declarationText = declarationText\n }\n\n /**\n * @returns {DeclarationSettings}\n */\n get values() {\n return {\n ...super.values,\n declarationText: this._declarationText\n }\n }\n}\n\n/**\n * @implements {LocationElements}\n */\nexport class LocationPreviewElements extends QuestionPreviewElements {\n /**\n * @param {BaseSettings & {instructionText?: string}} elements\n */\n constructor({ instructionText, ...elements }) {\n super(elements)\n this._instructionText = instructionText ?? ''\n }\n\n /**\n * @returns {LocationSettings}\n */\n get values() {\n return {\n ...super.values,\n instructionText: this._instructionText\n }\n }\n}\n\n/**\n * @implements {PageOverviewElements}\n */\nexport class PagePreviewElements {\n guidance\n heading\n addHeading\n repeatQuestion\n hasRepeater\n\n /**\n * @param {string} heading\n * @param {string} guidance\n * @param {boolean} [addHeading]\n * @param {string} repeatQuestion\n * @param {boolean} hasRepeater\n */\n constructor(\n heading,\n guidance = '',\n addHeading = undefined,\n repeatQuestion = '',\n hasRepeater = false\n ) {\n this.heading = heading\n this.guidance = guidance\n this.addHeading = addHeading ?? heading.length > 0\n this.repeatQuestion = repeatQuestion\n this.hasRepeater = hasRepeater\n }\n}\n\nexport const baseElements = /** @type {BaseSettings} */ ({\n items: [],\n optional: false,\n question: 'Which quest would you like to pick?',\n hintText: 'Choose one adventure that best suits you.',\n userClasses: '',\n shortDesc: '',\n content: '',\n largeTitle: true\n})\n\nexport const numberElements = /** @type {NumberSettings} */ ({\n items: [],\n optional: false,\n question: 'Which quest would you like to pick?',\n hintText: 'Choose one adventure that best suits you.',\n userClasses: '',\n shortDesc: '',\n content: '',\n largeTitle: true,\n prefix: '',\n suffix: ''\n})\n\nconst list1Id = '414d82a3-4cab-416a-bd54-6b86fbd51120'\nconst list2Id = '801385a4-81e6-4171-96c3-6c6727d97f22'\nconst list3Id = 'e6e3f621-b875-4ca3-a054-cca9149149dd'\nconst list4Id = 'd71b3909-582f-4e90-b6f5-490b89a6eb8f'\n\nconst listElementsBase = /** @type {BaseSettings} */ ({\n ...baseElements,\n items: [\n {\n label: { text: 'Treasure Hunting' },\n text: 'Treasure Hunting',\n value: 'Treasure Hunting',\n id: list1Id\n },\n {\n label: { text: 'Rescuing the princess' },\n text: 'Rescuing the princess',\n value: 'Rescuing the princess',\n id: list2Id\n },\n {\n label: { text: 'Saving a city' },\n text: 'Saving a city',\n value: 'Saving a city',\n id: list3Id\n },\n {\n label: { text: 'Defeating the baron' },\n text: 'Defeating the baron',\n value: 'Defeating the baron',\n id: list4Id\n }\n ]\n})\n\nexport const listElementsStub = {\n list1Id,\n list2Id,\n list3Id,\n list4Id,\n baseElements: listElementsBase\n}\n\n/**\n * @param {Partial<BaseSettings>} partialBaseElements\n * @param {jest.Mock<void, [string, QuestionBaseModel]>} renderMock\n * @returns {Question}\n */\nexport function buildPreviewShortAnswer(partialBaseElements, renderMock) {\n return new Question(\n new QuestionPreviewElements({\n ...baseElements,\n ...partialBaseElements\n }),\n new QuestionRendererStub(renderMock)\n )\n}\n\nexport class NumberPreviewElements {\n /**\n * @protected\n */\n _question = ''\n /** @protected */\n _hintText = ''\n /** @protected */\n _optional = false\n /**\n * @type {string}\n * @protected\n */\n _shortDesc = ''\n /**\n * @type {string}\n * @protected\n */\n _userClasses = ''\n /**\n * @type {string}\n * @protected\n */\n _prefix = ''\n /**\n * @type {string}\n * @protected\n */\n _suffix = ''\n /**\n * @type {string}\n * @protected\n */\n _content = ''\n /**\n *\n * @type {ListElement[]}\n * @private\n */\n _items = []\n afterInputsHTML = '<div class=\"govuk-inset-text\">No items added yet.</div>'\n\n /**\n * @param {NumberSettings} baseSettings\n */\n constructor({\n question,\n hintText,\n optional,\n shortDesc,\n userClasses,\n prefix,\n suffix,\n items,\n content\n }) {\n this._question = question\n this._hintText = hintText\n this._optional = optional\n this._shortDesc = shortDesc\n this._userClasses = userClasses\n this._prefix = prefix\n this._suffix = suffix\n this._items = items\n this._content = content\n }\n\n /**\n * @returns {NumberSettings}\n */\n get values() {\n return {\n question: this._question,\n hintText: this._hintText,\n optional: this._optional,\n shortDesc: this._shortDesc,\n userClasses: this._userClasses,\n prefix: this._prefix,\n suffix: this._suffix,\n items: this._items,\n content: this._content\n }\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n // Not implemented for server side render\n }\n\n /**\n * @param {HTMLElement} _value\n */\n setPreviewDOM(_value) {\n // Not implemented for server side render\n }\n}\n\n/**\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n * @import { PagePreviewPanelMacro } from '~/src/form/form-editor/macros/types.js'\n * @import { BaseSettings, ListElements, NumberSettings, RenderContext, QuestionBaseModel, QuestionRenderer, AutocompleteElements, PageOverviewElements, PageRenderer, UkAddressElements, UkAddressSettings, DeclarationElements, DeclarationSettings, LocationElements, LocationSettings } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,QAAQ;;AAEjB;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,CAAC;E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AK;IACLC;EACF,CAAC,EAAE;IACD,IAAI,CAACd,SAAS,GAAGQ,QAAQ;IACzB,IAAI,CAACP,SAAS,GAAGQ,QAAQ;IACzB,IAAI,CAACP,SAAS,GAAGQ,QAAQ;IACzB,IAAI,CAACP,UAAU,GAAGQ,SAAS;IAC3B,IAAI,CAACP,YAAY,GAAGQ,WAAW;IAC/B,IAAI,CAAC6C,OAAO,GAAGf,MAAM;IACrB,IAAI,CAACgB,OAAO,GAAGf,MAAM;IACrB,IAAI,CAACrC,MAAM,GAAGO,KAAK;IACnB,IAAI,CAACR,QAAQ,GAAGS,OAAO;EACzB;;EAEA;AACF;AACA;EACE,IAAIC,MAAMA,CAAA,EAAG;IACX,OAAO;MACLP,QAAQ,EAAE,IAAI,CAACR,SAAS;MACxBS,QAAQ,EAAE,IAAI,CAACR,SAAS;MACxBS,QAAQ,EAAE,IAAI,CAACR,SAAS;MACxBS,SAAS,EAAE,IAAI,CAACR,UAAU;MAC1BS,WAAW,EAAE,IAAI,CAACR,YAAY;MAC9BsC,MAAM,EAAE,IAAI,CAACe,OAAO;MACpBd,MAAM,EAAE,IAAI,CAACe,OAAO;MACpB7C,KAAK,EAAE,IAAI,CAACP,MAAM;MAClBQ,OAAO,EAAE,IAAI,CAACT;IAChB,CAAC;EACH;;EAEA;AACF;AACA;EACEW,cAAcA,CAACC,MAAM,EAAE;IACrB;EAAA;;EAGF;AACF;AACA;EACEC,aAAaA,CAACD,MAAM,EAAE;IACpB;EAAA;AAEJ;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -14,7 +14,7 @@ export const questionTypeFullSchema = Joi.string().required().valid(ComponentTyp
14
14
  export const writtenAnswerSubSchema = Joi.string().required().valid(ComponentType.TextField, ComponentType.MultilineTextField, ComponentType.NumberField).description('Subtype for written answer questions');
15
15
  export const dateSubSchema = Joi.string().required().valid(ComponentType.DatePartsField, ComponentType.MonthYearField).description('Subtype for date-related questions');
16
16
  export const listSubSchema = Joi.string().required().valid(ComponentType.YesNoField, ComponentType.CheckboxesField, ComponentType.RadiosField, ComponentType.AutocompleteField, ComponentType.SelectField).description('Subtype for list-related questions');
17
- export const locationSubSchema = Joi.string().required().valid(ComponentType.EastingNorthingField, ComponentType.OsGridRefField, ComponentType.NationalGridFieldNumberField, ComponentType.LatLongField).description('Subtype for location-related questions');
17
+ export const locationSubSchema = Joi.string().required().valid(ComponentType.UkAddressField, ComponentType.EastingNorthingField, ComponentType.OsGridRefField, ComponentType.NationalGridFieldNumberField, ComponentType.LatLongField).description('Subtype for location-related questions');
18
18
  export const nameSchema = Joi.string().trim().required().description('Unique identifier for the field');
19
19
  export const questionSchema = Joi.string().trim().required().description('The question text displayed to the user');
20
20
  export const hintTextSchema = Joi.string().trim().optional().allow('').description('Optional guidance text displayed below the question');