@defra/forms-model 3.0.573 → 3.0.575

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 (32) hide show
  1. package/dist/module/__stubs__/components.js +11 -0
  2. package/dist/module/__stubs__/components.js.map +1 -1
  3. package/dist/module/components/component-types.js +7 -0
  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/helpers.js +2 -2
  8. package/dist/module/components/helpers.js.map +1 -1
  9. package/dist/module/components/types.js.map +1 -1
  10. package/dist/module/conditions/condition-operators.js +1 -0
  11. package/dist/module/conditions/condition-operators.js.map +1 -1
  12. package/dist/module/form/form-editor/preview/helpers.js +1 -0
  13. package/dist/module/form/form-editor/preview/helpers.js.map +1 -1
  14. package/dist/types/__stubs__/components.d.ts +2 -1
  15. package/dist/types/__stubs__/components.d.ts.map +1 -1
  16. package/dist/types/components/component-types.d.ts.map +1 -1
  17. package/dist/types/components/enums.d.ts +1 -0
  18. package/dist/types/components/enums.d.ts.map +1 -1
  19. package/dist/types/components/helpers.d.ts.map +1 -1
  20. package/dist/types/components/types.d.ts +12 -1
  21. package/dist/types/components/types.d.ts.map +1 -1
  22. package/dist/types/conditions/condition-operators.d.ts +4 -0
  23. package/dist/types/conditions/condition-operators.d.ts.map +1 -1
  24. package/dist/types/form/form-editor/preview/helpers.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/src/__stubs__/components.ts +15 -0
  27. package/src/components/component-types.ts +8 -0
  28. package/src/components/enums.ts +1 -0
  29. package/src/components/helpers.ts +4 -2
  30. package/src/components/types.ts +13 -0
  31. package/src/conditions/condition-operators.ts +1 -0
  32. package/src/form/form-editor/preview/helpers.js +1 -0
@@ -36,6 +36,17 @@ export function buildYesNoFieldComponent(partialYesNoField = {}) {
36
36
  type: ComponentType.YesNoField
37
37
  };
38
38
  }
39
+ export function buildDeclarationFieldComponent(partialDeclarationField = {}) {
40
+ return {
41
+ title: 'Declaration',
42
+ id: 'f2a8c9e1-3d4f-4b5a-8c6d-1e2f3a4b5c6d',
43
+ name: 'DeclarationFieldComponent',
44
+ content: '',
45
+ options: {},
46
+ ...partialDeclarationField,
47
+ type: ComponentType.DeclarationField
48
+ };
49
+ }
39
50
  export function buildMonthYearFieldComponent(partialMonthYearField = {}) {
40
51
  return {
41
52
  id: 'd4e99aca-6d13-4c1a-a623-9e9e5b27d46d',
@@ -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","buildMonthYearFieldComponent","partialMonthYearField","MonthYearField","buildSelectFieldComponent","partialSelectField","list","SelectField","buildUkAddressFieldComponent","partialUkAddressField","UkAddressField","buildTelephoneNumberFieldComponent","partialTelephoneNumberField","TelephoneNumberField","buildEmailAddressFieldComponent","partialEmailAddressField","EmailAddressField","buildHtmlComponent","partialHtml","content","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 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}\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;AAwBtB;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CACrCC,gBAA6C,GAAG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Aa,CAACsE;EACtB,CAAC;AACH;AAEA,OAAO,SAASC,oBAAoBA,CAClCJ,gBAA+C,GAAG,CAAC,CAAC,EAC9B;EACtB,OAAO;IACL/D,IAAI,EAAE,QAAQ;IACdC,KAAK,EAAE,eAAe;IACtBE,OAAO,EAAE,CAAC,CAAC;IACXe,IAAI,EAAE,qBAAqB;IAC3B,GAAG6C,gBAAgB;IACnB1D,IAAI,EAAET,aAAa,CAACyD;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"],"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,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,sCAAs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CAAC;MACZE,IAAI,EAAE,MAAM;MACZC,KAAK,EAAE;IACT,CAAC,CAAC,CACH;IACD,GAAGnB;EACL,CAAC;AACH;AAEA,OAAO,SAASsB,yBAAyBA,CACvCC,gBAA+C,GAAG,CAAC,CAAC,EAC9B;EACtB,OAAO;IACLlE,IAAI,EAAE,MAAM;IACZC,KAAK,EAAE,MAAM;IACbE,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC,CAAC;IACV,GAAG8D,gBAAgB;IACnB7D,IAAI,EAAET,aAAa,CAACuE;EACtB,CAAC;AACH;AAEA,OAAO,SAASC,kBAAkBA,CAChCF,gBAAkD,GAAG,CAAC,CAAC,EAC9B;EACzB,OAAO;IACLlE,IAAI,EAAE,QAAQ;IACdC,KAAK,EAAE,eAAe;IACtBE,OAAO,EAAE,CAAC,CAAC;IACX,GAAG+D,gBAAgB;IACnB7D,IAAI,EAAET,aAAa,CAACyE;EACtB,CAAC;AACH;AAEA,OAAO,SAASC,oBAAoBA,CAClCJ,gBAA+C,GAAG,CAAC,CAAC,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":[]}
@@ -122,6 +122,13 @@ export const ComponentTypes = Object.freeze([{
122
122
  type: ComponentType.List,
123
123
  list: '',
124
124
  options: {}
125
+ }, {
126
+ name: 'DeclarationField',
127
+ title: 'Declaration',
128
+ type: ComponentType.DeclarationField,
129
+ hint: '',
130
+ content: '',
131
+ options: {}
125
132
  }, {
126
133
  name: 'EastingNorthingField',
127
134
  title: 'Easting and northing',
@@ -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","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: '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,EAA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AC","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"],"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,c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AAE,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":[]}
@@ -18,6 +18,7 @@ export let ComponentType = /*#__PURE__*/function (ComponentType) {
18
18
  ComponentType["List"] = "List";
19
19
  ComponentType["Markdown"] = "Markdown";
20
20
  ComponentType["FileUploadField"] = "FileUploadField";
21
+ ComponentType["DeclarationField"] = "DeclarationField";
21
22
  ComponentType["EastingNorthingField"] = "EastingNorthingField";
22
23
  ComponentType["OsGridRefField"] = "OsGridRefField";
23
24
  ComponentType["NationalGridFieldNumberField"] = "NationalGridFieldNumberField";
@@ -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 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;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}\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":[]}
@@ -20,7 +20,7 @@ export function hasConditionSupport(component) {
20
20
  return isConditionalType(component?.type);
21
21
  }
22
22
  export function isConditionalType(type) {
23
- const allowedTypes = [ComponentType.AutocompleteField, ComponentType.RadiosField, ComponentType.CheckboxesField, ComponentType.DatePartsField, ComponentType.EmailAddressField, ComponentType.MultilineTextField, ComponentType.TelephoneNumberField, ComponentType.NumberField, ComponentType.SelectField, ComponentType.TextField, ComponentType.YesNoField];
23
+ const allowedTypes = [ComponentType.AutocompleteField, ComponentType.RadiosField, ComponentType.CheckboxesField, ComponentType.DatePartsField, ComponentType.EmailAddressField, ComponentType.MultilineTextField, ComponentType.TelephoneNumberField, ComponentType.NumberField, ComponentType.SelectField, ComponentType.TextField, ComponentType.YesNoField, ComponentType.DeclarationField];
24
24
  return !!type && allowedTypes.includes(type);
25
25
  }
26
26
 
@@ -88,7 +88,7 @@ export function hasInputField(component) {
88
88
  * (excludes content and input fields)
89
89
  */
90
90
  export function hasSelectionFields(component) {
91
- const allowedTypes = [ComponentType.AutocompleteField, ComponentType.CheckboxesField, ComponentType.RadiosField, ComponentType.SelectField, ComponentType.YesNoField];
91
+ const allowedTypes = [ComponentType.AutocompleteField, ComponentType.CheckboxesField, ComponentType.RadiosField, ComponentType.SelectField, ComponentType.YesNoField, ComponentType.DeclarationField];
92
92
  return !!component?.type && allowedTypes.includes(component.type);
93
93
  }
94
94
 
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","names":["ComponentTypes","ComponentType","getComponentDefaults","component","defaults","find","type","Error","structuredClone","hasConditionSupport","isConditionalType","allowedTypes","AutocompleteField","RadiosField","CheckboxesField","DatePartsField","EmailAddressField","MultilineTextField","TelephoneNumberField","NumberField","SelectField","TextField","YesNoField","includes","isConditionalRevealType","isContentType","hasContent","hasContentField","deniedTypes","List","Details","Html","Markdown","InsetText","hasFormField","isFormType","hasListField","isListType","hasInputField","hasSelectionFields","hasTitle","hasHint"],"sources":["../../../src/components/helpers.ts"],"sourcesContent":["import { ComponentTypes } from '~/src/components/component-types.js'\nimport { ComponentType } from '~/src/components/enums.js'\nimport {\n type ComponentDef,\n type ConditionalComponentType,\n type ConditionalComponentsDef,\n type ContentComponentsDef,\n type FormComponentsDef,\n type HtmlComponent,\n type InputFieldsComponentsDef,\n type InsetTextComponent,\n type ListComponent,\n type ListComponentsDef,\n type MarkdownComponent,\n type SelectionComponentsDef\n} from '~/src/components/types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getComponentDefaults<FieldType extends ComponentDef>(\n component?: Pick<FieldType, 'type'>\n) {\n const defaults = ComponentTypes.find(({ type }) => type === component?.type)\n\n if (!defaults) {\n throw new Error(\n `Defaults not found for component type '${component?.type}'`\n )\n }\n\n return structuredClone(defaults) as FieldType\n}\n\n/**\n * Filter known components with support for conditions\n */\nexport function hasConditionSupport(\n component?: Partial<ComponentDef>\n): component is ConditionalComponentsDef {\n return isConditionalType(component?.type)\n}\n\nexport function isConditionalType(\n type?: ComponentType\n): type is ConditionalComponentType {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.RadiosField,\n ComponentType.CheckboxesField,\n ComponentType.DatePartsField,\n ComponentType.EmailAddressField,\n ComponentType.MultilineTextField,\n ComponentType.TelephoneNumberField,\n ComponentType.NumberField,\n ComponentType.SelectField,\n ComponentType.TextField,\n ComponentType.YesNoField\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Check if the component type is supported for conditional reveal.\n * As of today this is just content types, but we're providing this as a wrapper\n * function for clarity.\n * @param type - Component type to check\n */\nexport function isConditionalRevealType(type: ComponentType) {\n return isContentType(type)\n}\n\n/**\n * Filter known components with content (textarea or list)\n */\nexport function hasContent(\n component?: Partial<ComponentDef>\n): component is ContentComponentsDef {\n return isContentType(component?.type)\n}\n\n/**\n * Filter known components with content textarea\n */\nexport function hasContentField(\n component?: Partial<ComponentDef>\n): component is Exclude<ContentComponentsDef, ListComponent> {\n const deniedTypes = [ComponentType.List]\n return hasContent(component) && !deniedTypes.includes(component.type)\n}\n\nexport function isContentType(\n type?: ComponentType\n): type is ContentComponentsDef['type'] {\n const allowedTypes = [\n ComponentType.Details,\n ComponentType.Html,\n ComponentType.Markdown,\n ComponentType.InsetText,\n ComponentType.List\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known components with form fields\n * (includes input fields and selection fields)\n */\nexport function hasFormField(\n component?: Partial<ComponentDef>\n): component is FormComponentsDef {\n return isFormType(component?.type)\n}\n\nexport function isFormType(\n type?: ComponentType\n): type is FormComponentsDef['type'] {\n return !!type && !isContentType(type)\n}\n\n/**\n * Filter known components with lists\n */\nexport function hasListField(\n component?: Partial<ComponentDef>\n): component is ListComponentsDef {\n return isListType(component?.type)\n}\n\nexport function isListType(\n type?: ComponentType\n): type is ListComponentsDef['type'] {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.List,\n ComponentType.RadiosField,\n ComponentType.SelectField,\n ComponentType.CheckboxesField\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known form components with input fields\n * (excludes content and selection fields)\n */\nexport function hasInputField(\n component?: Partial<ComponentDef>\n): component is InputFieldsComponentsDef {\n return hasFormField(component) && !hasSelectionFields(component)\n}\n\n/**\n * Filter known form components with selection fields\n * (excludes content and input fields)\n */\nexport function hasSelectionFields(\n component?: Partial<ComponentDef>\n): component is SelectionComponentsDef {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.SelectField,\n ComponentType.YesNoField\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with titles\n */\nexport function hasTitle(\n component?: Partial<ComponentDef>\n): component is Exclude<\n ComponentDef,\n InsetTextComponent | HtmlComponent | MarkdownComponent\n> {\n const deniedTypes = [\n ComponentType.InsetText,\n ComponentType.Html,\n ComponentType.Markdown\n ]\n return !!component?.type && !deniedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with hint text\n */\nexport function hasHint(\n component?: Partial<ComponentDef>\n): component is FormComponentsDef | ListComponent {\n return isFormType(component?.type) || component?.type === ComponentType.List\n}\n"],"mappings":"AAAA,SAASA,cAAc;AACvB,SAASC,aAAa;AAgBtB;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAClCC,SAAmC,EACnC;EACA,MAAMC,QAAQ,GAAGJ,cAAc,CAACK,IAAI,CAAC,CAAC;IAAEC;EAAK,CAAC,KAAKA,IAAI,KAAKH,SAAS,EAAEG,IAAI,CAAC;EAE5E,IAAI,CAACF,QAAQ,EAAE;IACb,MAAM,IAAIG,KAAK,CACb,0CAA0CJ,SAAS,EAAEG,IAAI,GAC3D,CAAC;EACH;EAEA,OAAOE,eAAe,CAACJ,QAAQ,CAAC;AAClC;;AAEA;AACA;AACA;AACA,OAAO,SAASK,mBAAmBA,CACjCN,SAAiC,EACM;EACvC,OAAOO,iBAAiB,CAACP,SAAS,EAAEG,IAAI,CAAC;AAC3C;AAEA,OAAO,SAASI,iBAAiBA,CAC/BJ,IAAoB,EACc;EAClC,MAAMK,YAAY,GAAG,CACnBV,aAAa,CAACW,iBAAiB,EAC/BX,aAAa,CAACY,WAAW,EACzBZ,aAAa,CAACa,eAAe,EAC7Bb,aAAa,CAACc,cAAc,EAC5Bd,aAAa,CAACe,iBAAiB,EAC/Bf,aAAa,CAACgB,kBAAkB,EAChChB,aAAa,CAACiB,oBAAoB,EAClCjB,aAAa,CAACkB,WAAW,EACzBlB,aAAa,CAACmB,WAAW,EACzBnB,aAAa,CAACoB,SAAS,EACvBpB,aAAa,CAACqB,UAAU,CACzB;EAED,OAAO,CAAC,CAAChB,IAAI,IAAIK,YAAY,CAACY,QAAQ,CAACjB,IAAI,CAAC;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1
+ {"version":3,"file":"helpers.js","names":["ComponentTypes","ComponentType","getComponentDefaults","component","defaults","find","type","Error","structuredClone","hasConditionSupport","isConditionalType","allowedTypes","AutocompleteField","RadiosField","CheckboxesField","DatePartsField","EmailAddressField","MultilineTextField","TelephoneNumberField","NumberField","SelectField","TextField","YesNoField","DeclarationField","includes","isConditionalRevealType","isContentType","hasContent","hasContentField","deniedTypes","List","Details","Html","Markdown","InsetText","hasFormField","isFormType","hasListField","isListType","hasInputField","hasSelectionFields","hasTitle","hasHint"],"sources":["../../../src/components/helpers.ts"],"sourcesContent":["import { ComponentTypes } from '~/src/components/component-types.js'\nimport { ComponentType } from '~/src/components/enums.js'\nimport {\n type ComponentDef,\n type ConditionalComponentType,\n type ConditionalComponentsDef,\n type ContentComponentsDef,\n type FormComponentsDef,\n type HtmlComponent,\n type InputFieldsComponentsDef,\n type InsetTextComponent,\n type ListComponent,\n type ListComponentsDef,\n type MarkdownComponent,\n type SelectionComponentsDef\n} from '~/src/components/types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getComponentDefaults<FieldType extends ComponentDef>(\n component?: Pick<FieldType, 'type'>\n) {\n const defaults = ComponentTypes.find(({ type }) => type === component?.type)\n\n if (!defaults) {\n throw new Error(\n `Defaults not found for component type '${component?.type}'`\n )\n }\n\n return structuredClone(defaults) as FieldType\n}\n\n/**\n * Filter known components with support for conditions\n */\nexport function hasConditionSupport(\n component?: Partial<ComponentDef>\n): component is ConditionalComponentsDef {\n return isConditionalType(component?.type)\n}\n\nexport function isConditionalType(\n type?: ComponentType\n): type is ConditionalComponentType {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.RadiosField,\n ComponentType.CheckboxesField,\n ComponentType.DatePartsField,\n ComponentType.EmailAddressField,\n ComponentType.MultilineTextField,\n ComponentType.TelephoneNumberField,\n ComponentType.NumberField,\n ComponentType.SelectField,\n ComponentType.TextField,\n ComponentType.YesNoField,\n ComponentType.DeclarationField\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Check if the component type is supported for conditional reveal.\n * As of today this is just content types, but we're providing this as a wrapper\n * function for clarity.\n * @param type - Component type to check\n */\nexport function isConditionalRevealType(type: ComponentType) {\n return isContentType(type)\n}\n\n/**\n * Filter known components with content (textarea or list)\n */\nexport function hasContent(\n component?: Partial<ComponentDef>\n): component is ContentComponentsDef {\n return isContentType(component?.type)\n}\n\n/**\n * Filter known components with content textarea\n */\nexport function hasContentField(\n component?: Partial<ComponentDef>\n): component is Exclude<ContentComponentsDef, ListComponent> {\n const deniedTypes = [ComponentType.List]\n return hasContent(component) && !deniedTypes.includes(component.type)\n}\n\nexport function isContentType(\n type?: ComponentType\n): type is ContentComponentsDef['type'] {\n const allowedTypes = [\n ComponentType.Details,\n ComponentType.Html,\n ComponentType.Markdown,\n ComponentType.InsetText,\n ComponentType.List\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known components with form fields\n * (includes input fields and selection fields)\n */\nexport function hasFormField(\n component?: Partial<ComponentDef>\n): component is FormComponentsDef {\n return isFormType(component?.type)\n}\n\nexport function isFormType(\n type?: ComponentType\n): type is FormComponentsDef['type'] {\n return !!type && !isContentType(type)\n}\n\n/**\n * Filter known components with lists\n */\nexport function hasListField(\n component?: Partial<ComponentDef>\n): component is ListComponentsDef {\n return isListType(component?.type)\n}\n\nexport function isListType(\n type?: ComponentType\n): type is ListComponentsDef['type'] {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.List,\n ComponentType.RadiosField,\n ComponentType.SelectField,\n ComponentType.CheckboxesField\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known form components with input fields\n * (excludes content and selection fields)\n */\nexport function hasInputField(\n component?: Partial<ComponentDef>\n): component is InputFieldsComponentsDef {\n return hasFormField(component) && !hasSelectionFields(component)\n}\n\n/**\n * Filter known form components with selection fields\n * (excludes content and input fields)\n */\nexport function hasSelectionFields(\n component?: Partial<ComponentDef>\n): component is SelectionComponentsDef {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.SelectField,\n ComponentType.YesNoField,\n ComponentType.DeclarationField\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with titles\n */\nexport function hasTitle(\n component?: Partial<ComponentDef>\n): component is Exclude<\n ComponentDef,\n InsetTextComponent | HtmlComponent | MarkdownComponent\n> {\n const deniedTypes = [\n ComponentType.InsetText,\n ComponentType.Html,\n ComponentType.Markdown\n ]\n return !!component?.type && !deniedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with hint text\n */\nexport function hasHint(\n component?: Partial<ComponentDef>\n): component is FormComponentsDef | ListComponent {\n return isFormType(component?.type) || component?.type === ComponentType.List\n}\n"],"mappings":"AAAA,SAASA,cAAc;AACvB,SAASC,aAAa;AAgBtB;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAClCC,SAAmC,EACnC;EACA,MAAMC,QAAQ,GAAGJ,cAAc,CAACK,IAAI,CAAC,CAAC;IAAEC;EAAK,CAAC,KAAKA,IAAI,KAAKH,SAAS,EAAEG,IAAI,CAAC;EAE5E,IAAI,CAACF,QAAQ,EAAE;IACb,MAAM,IAAIG,KAAK,CACb,0CAA0CJ,SAAS,EAAEG,IAAI,GAC3D,CAAC;EACH;EAEA,OAAOE,eAAe,CAACJ,QAAQ,CAAC;AAClC;;AAEA;AACA;AACA;AACA,OAAO,SAASK,mBAAmBA,CACjCN,SAAiC,EACM;EACvC,OAAOO,iBAAiB,CAACP,SAAS,EAAEG,IAAI,CAAC;AAC3C;AAEA,OAAO,SAASI,iBAAiBA,CAC/BJ,IAAoB,EACc;EAClC,MAAMK,YAAY,GAAG,CACnBV,aAAa,CAACW,iBAAiB,EAC/BX,aAAa,CAACY,WAAW,EACzBZ,aAAa,CAACa,eAAe,EAC7Bb,aAAa,CAACc,cAAc,EAC5Bd,aAAa,CAACe,iBAAiB,EAC/Bf,aAAa,CAACgB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AC,CAAC9B,SAAS,EAAEG,IAAI,IAAI,CAACuB,WAAW,CAACL,QAAQ,CAACrB,SAAS,CAACG,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAASoC,OAAOA,CACrBvC,SAAiC,EACe;EAChD,OAAOiC,UAAU,CAACjC,SAAS,EAAEG,IAAI,CAAC,IAAIH,SAAS,EAAEG,IAAI,KAAKL,aAAa,CAAC6B,IAAI;AAC9E","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 }\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 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 | 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\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":[]}
@@ -55,6 +55,7 @@ export const customOperators = {
55
55
  [ComponentType.TelephoneNumberField]: defaultOperators,
56
56
  [ComponentType.SelectField]: defaultOperators,
57
57
  [ComponentType.YesNoField]: defaultOperators,
58
+ [ComponentType.DeclarationField]: defaultOperators,
58
59
  [ComponentType.EastingNorthingField]: defaultOperators,
59
60
  [ComponentType.OsGridRefField]: defaultOperators,
60
61
  [ComponentType.NationalGridFieldNumberField]: defaultOperators,
@@ -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","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.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 ) {\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 ? pastOper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AACF,IAAI,KAAK7D,aAAa,CAACsC,WAAW,IACxCyB,KAAK,CAACF,IAAI,KAAK7D,aAAa,CAAC6C,UAAU,EACvC;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,CAClDjC,qBACF,CAAmB;AAEnB,OAAO,MAAMgD,yBAAyB,GAAGhB,MAAM,CAACC,IAAI,CAClD7B,qBACF,CAAmB;AAEnB,SAASH,YAAYA,CAACmC,QAAkB,EAAsB;EAC5D,OAAO;IACLE,UAAUA,CAACG,KAAK,EAAEJ,KAAK,EAAE;MACvB,IAAI,EAAEA,KAAK,YAAYxD,cAAc,CAAC,EAAE;QACtC,MAAM,IAAIoE,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,SAAS/B,YAAYA,CACnB4C,YAAsB,EACtBC,cAAwB,EACJ;EACpB,OAAO;IACLb,UAAUA,CAACG,KAAK,EAAEJ,KAAK,EAAE;MACvB,IAAI,EAAEA,KAAK,YAAYvD,iBAAiB,CAAC,EAAE;QACzC,MAAM,IAAImE,KAAK,CACb,6DACF,CAAC;MACH;MAEA,MAAMG,MAAM,GAAGf,KAAK,CAACgB,SAAS,KAAKrE,cAAc,CAACsE,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","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 ) {\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,GAAGW,YAAY,CAAChB,QAAQ,CAACK,KAAK,CAAC;EAClD,CAACJ,Y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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":[]}
@@ -42,6 +42,7 @@ const InputFieldComponentDictionary = {
42
42
  [ComponentType.CheckboxesField]: CheckboxQuestion,
43
43
  [ComponentType.SelectField]: SelectQuestion,
44
44
  [ComponentType.YesNoField]: YesNoQuestion,
45
+ [ComponentType.DeclarationField]: YesNoQuestion,
45
46
  [ComponentType.FileUploadField]: SupportingEvidenceQuestion,
46
47
  [ComponentType.EastingNorthingField]: ShortAnswerQuestion,
47
48
  [ComponentType.OsGridRefField]: ShortAnswerQuestion,
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","names":["ComponentType","hasContentField","hasInputField","hasListField","hasSelectionFields","AutocompleteListQuestion","CheckboxQuestion","ComponentElements","ContentElements","DateInputQuestion","EmailAddressQuestion","ListComponentElements","ListQuestion","SelectComponentElements","LongAnswerQuestion","Markdown","MonthYearQuestion","NumberComponentPreviewElements","NumberOnlyQuestion","PhoneNumberQuestion","QuestionComponentElements","RadioQuestion","SelectQuestion","ShortAnswerQuestion","SupportingEvidenceQuestion","UkAddressComponentPreviewElements","UkAddressQuestion","YesNoQuestion","findDefinitionListFromComponent","InputFieldComponentDictionary","TextField","Details","InsetText","Html","List","EmailAddressField","NumberField","MultilineTextField","TelephoneNumberField","MonthYearField","DatePartsField","UkAddressField","AutocompleteField","RadiosField","CheckboxesField","SelectField","YesNoField","FileUploadField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","mapComponentToPreviewQuestion","questionRenderer","definition","component","questionElements","type","list","QuestionConstructor","previewComponent","id"],"sources":["../../../../../src/form/form-editor/preview/helpers.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n hasContentField,\n hasInputField,\n hasListField,\n hasSelectionFields\n} from '~/src/components/helpers.js'\nimport { AutocompleteListQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { CheckboxQuestion } from '~/src/form/form-editor/preview/checkbox.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { ContentElements } from '~/src/form/form-editor/preview/content.js'\nimport { DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport {\n ListComponentElements,\n ListQuestion,\n SelectComponentElements\n} from '~/src/form/form-editor/preview/list.js'\nimport { LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { Markdown } from '~/src/form/form-editor/preview/markdown.js'\nimport { MonthYearQuestion } from '~/src/form/form-editor/preview/month-year.js'\nimport {\n NumberComponentPreviewElements,\n NumberOnlyQuestion\n} from '~/src/form/form-editor/preview/number-only.js'\nimport { PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { QuestionComponentElements } from '~/src/form/form-editor/preview/question.js'\nimport { RadioQuestion } from '~/src/form/form-editor/preview/radio.js'\nimport { SelectQuestion } from '~/src/form/form-editor/preview/select.js'\nimport { ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { SupportingEvidenceQuestion } from '~/src/form/form-editor/preview/supporting-evidence.js'\nimport {\n UkAddressComponentPreviewElements,\n UkAddressQuestion\n} from '~/src/form/form-editor/preview/uk-address.js'\nimport { YesNoQuestion } from '~/src/form/form-editor/preview/yes-no.js'\nimport { findDefinitionListFromComponent } from '~/src/form/utils/list.js'\n/**\n * @type {Record<ComponentType, typeof PreviewComponent>}\n */\nconst InputFieldComponentDictionary = {\n [ComponentType.TextField]: ShortAnswerQuestion,\n [ComponentType.Details]: ShortAnswerQuestion,\n [ComponentType.InsetText]: ShortAnswerQuestion,\n [ComponentType.Html]: ShortAnswerQuestion,\n [ComponentType.Markdown]: Markdown,\n [ComponentType.List]: ListQuestion,\n [ComponentType.EmailAddressField]: EmailAddressQuestion,\n [ComponentType.NumberField]: NumberOnlyQuestion,\n [ComponentType.MultilineTextField]: LongAnswerQuestion,\n [ComponentType.TelephoneNumberField]: PhoneNumberQuestion,\n [ComponentType.MonthYearField]: MonthYearQuestion,\n [ComponentType.DatePartsField]: DateInputQuestion,\n [ComponentType.UkAddressField]: UkAddressQuestion,\n [ComponentType.AutocompleteField]: AutocompleteListQuestion,\n [ComponentType.RadiosField]: RadioQuestion,\n [ComponentType.CheckboxesField]: CheckboxQuestion,\n [ComponentType.SelectField]: SelectQuestion,\n [ComponentType.YesNoField]: YesNoQuestion,\n [ComponentType.FileUploadField]: SupportingEvidenceQuestion,\n [ComponentType.EastingNorthingField]: ShortAnswerQuestion,\n [ComponentType.OsGridRefField]: ShortAnswerQuestion,\n [ComponentType.NationalGridFieldNumberField]: ShortAnswerQuestion,\n [ComponentType.LatLongField]: ShortAnswerQuestion\n}\n\n/**\n * @param {QuestionRenderer} questionRenderer\n * @param {FormDefinition} definition\n * @returns {(component: ComponentDef) => Question}\n */\nexport function mapComponentToPreviewQuestion(questionRenderer, definition) {\n return /** @type {(component: ComponentDef) => Question} */ (\n (component) => {\n /**\n * @type {QuestionElements}\n */\n let questionElements\n\n if (\n component.type === ComponentType.AutocompleteField ||\n component.type === ComponentType.SelectField\n ) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new SelectComponentElements(component, list)\n } else if (component.type === ComponentType.UkAddressField) {\n questionElements = new UkAddressComponentPreviewElements(component)\n } else if (component.type === ComponentType.NumberField) {\n questionElements = new NumberComponentPreviewElements(component)\n } else if (hasSelectionFields(component) && hasListField(component)) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new ListComponentElements(component, list)\n } else if (\n hasInputField(component) ||\n component.type === ComponentType.YesNoField\n ) {\n questionElements = new QuestionComponentElements(component)\n } else if (hasContentField(component)) {\n questionElements = new ContentElements(component)\n } else {\n questionElements = new ComponentElements(component)\n }\n\n const QuestionConstructor = InputFieldComponentDictionary[component.type]\n\n const previewComponent = new QuestionConstructor(\n questionElements,\n questionRenderer\n )\n previewComponent.id = component.id\n return previewComponent\n }\n )\n}\n\n/**\n * @import { QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { Question } from '~/src/form/form-editor/preview/question.js'\n * @import { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n * @import { FormDefinition } from '~/src/form/form-definition/types.js'\n * @import { ComponentDef } from '~/src/components/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SACEC,eAAe,EACfC,aAAa,EACbC,YAAY,EACZC,kBAAkB;AAEpB,SAASC,wBAAwB;AACjC,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAC1B,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,oBAAoB;AAC7B,SACEC,qBAAqB,EACrBC,YAAY,EACZC,uBAAuB;AAEzB,SAASC,kBAAkB;AAC3B,SAASC,QAAQ;AACjB,SAASC,iBAAiB;AAC1B,SACEC,8BAA8B,EAC9BC,kBAAkB;AAEpB,SAASC,mBAAmB;AAC5B,SAASC,yBAAyB;AAClC,SAASC,aAAa;AACtB,SAASC,cAAc;AACvB,SAASC,mBAAmB;AAC5B,SAASC,0BAA0B;AACnC,SACEC,iCAAiC,EACjCC,iBAAiB;AAEnB,SAASC,aAAa;AACtB,SAASC,+BAA+B;AACxC;AACA;AACA;AACA,MAAMC,6BAA6B,GAAG;EACpC,CAAC7B,aAAa,CAAC8B,SAAS,GAAGP,mBAAmB;EAC9C,CAACvB,aAAa,CAAC+B,OAAO,GAAGR,mBAAmB;EAC5C,CAACvB,aAAa,CAACgC,SAAS,GAAGT,mBAAmB;EAC9C,CAACvB,aAAa,CAACiC,IAAI,GAAGV,mBAAmB;EACzC,CAACvB,aAAa,CAACe,QA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AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"helpers.js","names":["ComponentType","hasContentField","hasInputField","hasListField","hasSelectionFields","AutocompleteListQuestion","CheckboxQuestion","ComponentElements","ContentElements","DateInputQuestion","EmailAddressQuestion","ListComponentElements","ListQuestion","SelectComponentElements","LongAnswerQuestion","Markdown","MonthYearQuestion","NumberComponentPreviewElements","NumberOnlyQuestion","PhoneNumberQuestion","QuestionComponentElements","RadioQuestion","SelectQuestion","ShortAnswerQuestion","SupportingEvidenceQuestion","UkAddressComponentPreviewElements","UkAddressQuestion","YesNoQuestion","findDefinitionListFromComponent","InputFieldComponentDictionary","TextField","Details","InsetText","Html","List","EmailAddressField","NumberField","MultilineTextField","TelephoneNumberField","MonthYearField","DatePartsField","UkAddressField","AutocompleteField","RadiosField","CheckboxesField","SelectField","YesNoField","DeclarationField","FileUploadField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","mapComponentToPreviewQuestion","questionRenderer","definition","component","questionElements","type","list","QuestionConstructor","previewComponent","id"],"sources":["../../../../../src/form/form-editor/preview/helpers.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n hasContentField,\n hasInputField,\n hasListField,\n hasSelectionFields\n} from '~/src/components/helpers.js'\nimport { AutocompleteListQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { CheckboxQuestion } from '~/src/form/form-editor/preview/checkbox.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { ContentElements } from '~/src/form/form-editor/preview/content.js'\nimport { DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport {\n ListComponentElements,\n ListQuestion,\n SelectComponentElements\n} from '~/src/form/form-editor/preview/list.js'\nimport { LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { Markdown } from '~/src/form/form-editor/preview/markdown.js'\nimport { MonthYearQuestion } from '~/src/form/form-editor/preview/month-year.js'\nimport {\n NumberComponentPreviewElements,\n NumberOnlyQuestion\n} from '~/src/form/form-editor/preview/number-only.js'\nimport { PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { QuestionComponentElements } from '~/src/form/form-editor/preview/question.js'\nimport { RadioQuestion } from '~/src/form/form-editor/preview/radio.js'\nimport { SelectQuestion } from '~/src/form/form-editor/preview/select.js'\nimport { ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { SupportingEvidenceQuestion } from '~/src/form/form-editor/preview/supporting-evidence.js'\nimport {\n UkAddressComponentPreviewElements,\n UkAddressQuestion\n} from '~/src/form/form-editor/preview/uk-address.js'\nimport { YesNoQuestion } from '~/src/form/form-editor/preview/yes-no.js'\nimport { findDefinitionListFromComponent } from '~/src/form/utils/list.js'\n/**\n * @type {Record<ComponentType, typeof PreviewComponent>}\n */\nconst InputFieldComponentDictionary = {\n [ComponentType.TextField]: ShortAnswerQuestion,\n [ComponentType.Details]: ShortAnswerQuestion,\n [ComponentType.InsetText]: ShortAnswerQuestion,\n [ComponentType.Html]: ShortAnswerQuestion,\n [ComponentType.Markdown]: Markdown,\n [ComponentType.List]: ListQuestion,\n [ComponentType.EmailAddressField]: EmailAddressQuestion,\n [ComponentType.NumberField]: NumberOnlyQuestion,\n [ComponentType.MultilineTextField]: LongAnswerQuestion,\n [ComponentType.TelephoneNumberField]: PhoneNumberQuestion,\n [ComponentType.MonthYearField]: MonthYearQuestion,\n [ComponentType.DatePartsField]: DateInputQuestion,\n [ComponentType.UkAddressField]: UkAddressQuestion,\n [ComponentType.AutocompleteField]: AutocompleteListQuestion,\n [ComponentType.RadiosField]: RadioQuestion,\n [ComponentType.CheckboxesField]: CheckboxQuestion,\n [ComponentType.SelectField]: SelectQuestion,\n [ComponentType.YesNoField]: YesNoQuestion,\n [ComponentType.DeclarationField]: YesNoQuestion,\n [ComponentType.FileUploadField]: SupportingEvidenceQuestion,\n [ComponentType.EastingNorthingField]: ShortAnswerQuestion,\n [ComponentType.OsGridRefField]: ShortAnswerQuestion,\n [ComponentType.NationalGridFieldNumberField]: ShortAnswerQuestion,\n [ComponentType.LatLongField]: ShortAnswerQuestion\n}\n\n/**\n * @param {QuestionRenderer} questionRenderer\n * @param {FormDefinition} definition\n * @returns {(component: ComponentDef) => Question}\n */\nexport function mapComponentToPreviewQuestion(questionRenderer, definition) {\n return /** @type {(component: ComponentDef) => Question} */ (\n (component) => {\n /**\n * @type {QuestionElements}\n */\n let questionElements\n\n if (\n component.type === ComponentType.AutocompleteField ||\n component.type === ComponentType.SelectField\n ) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new SelectComponentElements(component, list)\n } else if (component.type === ComponentType.UkAddressField) {\n questionElements = new UkAddressComponentPreviewElements(component)\n } else if (component.type === ComponentType.NumberField) {\n questionElements = new NumberComponentPreviewElements(component)\n } else if (hasSelectionFields(component) && hasListField(component)) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new ListComponentElements(component, list)\n } else if (\n hasInputField(component) ||\n component.type === ComponentType.YesNoField\n ) {\n questionElements = new QuestionComponentElements(component)\n } else if (hasContentField(component)) {\n questionElements = new ContentElements(component)\n } else {\n questionElements = new ComponentElements(component)\n }\n\n const QuestionConstructor = InputFieldComponentDictionary[component.type]\n\n const previewComponent = new QuestionConstructor(\n questionElements,\n questionRenderer\n )\n previewComponent.id = component.id\n return previewComponent\n }\n )\n}\n\n/**\n * @import { QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { Question } from '~/src/form/form-editor/preview/question.js'\n * @import { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n * @import { FormDefinition } from '~/src/form/form-definition/types.js'\n * @import { ComponentDef } from '~/src/components/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SACEC,eAAe,EACfC,aAAa,EACbC,YAAY,EACZC,kBAAkB;AAEpB,SAASC,wBAAwB;AACjC,SAASC,gBAAgB;AACzB,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G,IAAI,GAAG/B,+BAA+B,CAAC4B,SAAS,EAAED,UAAU,CAAC;MACnEE,gBAAgB,GAAG,IAAI9C,qBAAqB,CAAC6C,SAAS,EAAEG,IAAI,CAAC;IAC/D,CAAC,MAAM,IACLzD,aAAa,CAACsD,SAAS,CAAC,IACxBA,SAAS,CAACE,IAAI,KAAK1D,aAAa,CAAC8C,UAAU,EAC3C;MACAW,gBAAgB,GAAG,IAAIrC,yBAAyB,CAACoC,SAAS,CAAC;IAC7D,CAAC,MAAM,IAAIvD,eAAe,CAACuD,SAAS,CAAC,EAAE;MACrCC,gBAAgB,GAAG,IAAIjD,eAAe,CAACgD,SAAS,CAAC;IACnD,CAAC,MAAM;MACLC,gBAAgB,GAAG,IAAIlD,iBAAiB,CAACiD,SAAS,CAAC;IACrD;IAEA,MAAMI,mBAAmB,GAAG/B,6BAA6B,CAAC2B,SAAS,CAACE,IAAI,CAAC;IAEzE,MAAMG,gBAAgB,GAAG,IAAID,mBAAmB,CAC9CH,gBAAgB,EAChBH,gBACF,CAAC;IACDO,gBAAgB,CAACC,EAAE,GAAGN,SAAS,CAACM,EAAE;IAClC,OAAOD,gBAAgB;EACzB,CAAC;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { type AutocompleteFieldComponent, type CheckboxesFieldComponent, type DatePartsFieldComponent, type DetailsComponent, type EmailAddressFieldComponent, type FileUploadFieldComponent, type HtmlComponent, type InsetTextComponent, type ListComponent, type MarkdownComponent, type MonthYearFieldComponent, type MultilineTextFieldComponent, type NumberFieldComponent, type RadiosFieldComponent, type SelectFieldComponent, type TelephoneNumberFieldComponent, type TextFieldComponent, type UkAddressFieldComponent, type YesNoFieldComponent } from '../components/types.js';
1
+ import { type AutocompleteFieldComponent, type CheckboxesFieldComponent, type DatePartsFieldComponent, type DeclarationFieldComponent, type DetailsComponent, type EmailAddressFieldComponent, type FileUploadFieldComponent, type HtmlComponent, type InsetTextComponent, type ListComponent, type MarkdownComponent, type MonthYearFieldComponent, type MultilineTextFieldComponent, type NumberFieldComponent, type RadiosFieldComponent, type SelectFieldComponent, type TelephoneNumberFieldComponent, type TextFieldComponent, type UkAddressFieldComponent, type YesNoFieldComponent } from '../components/types.js';
2
2
  import { type Item, type List } from '../form/form-definition/types.js';
3
3
  /**
4
4
  * @param {Partial<TextFieldComponent>} partialTextField
@@ -7,6 +7,7 @@ import { type Item, type List } from '../form/form-definition/types.js';
7
7
  export declare function buildTextFieldComponent(partialTextField?: Partial<TextFieldComponent>): TextFieldComponent;
8
8
  export declare function buildMultilineTextFieldComponent(partialMultilineTextField?: Partial<MultilineTextFieldComponent>): MultilineTextFieldComponent;
9
9
  export declare function buildYesNoFieldComponent(partialYesNoField?: Partial<YesNoFieldComponent>): YesNoFieldComponent;
10
+ export declare function buildDeclarationFieldComponent(partialDeclarationField?: Partial<DeclarationFieldComponent>): DeclarationFieldComponent;
10
11
  export declare function buildMonthYearFieldComponent(partialMonthYearField?: Partial<MonthYearFieldComponent>): MonthYearFieldComponent;
11
12
  export declare function buildSelectFieldComponent(partialSelectField?: Partial<SelectFieldComponent>): SelectFieldComponent;
12
13
  export declare function buildUkAddressFieldComponent(partialUkAddressField?: Partial<UkAddressFieldComponent>): UkAddressFieldComponent;
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/__stubs__/components.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,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Aa,CAUf;AACD,wBAAgB,sBAAsB,CACpC,eAAe,GAAE,OAAO,CAAC,iBAAiB,CAAM,GAC/C,iBAAiB,CAUnB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,sBAAsB,GAAE,OAAO,CAAC,wBAAwB,CAAM,GAC7D,wBAAwB,CAS1B;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,wBAAwB,GAAE,OAAO,CAAC,0BAA0B,CAAM,GACjE,0BAA0B,CAS5B;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,oBAAoB,GAAE,OAAO,CAAC,oBAAoB,CAAM,GACvD,oBAAoB,CAUtB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,oBAAoB,GAAE,OAAO,CAAC,wBAAwB,CAAM,GAC3D,wBAAwB,CAS1B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,eAAe,GAAE,OAAO,CAAC,IAAI,CAAM,GAAG,IAAI,CAMvE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,WAAW,GAAE,OAAO,CAAC,IAAI,CAAM,GAAG,IAAI,CAiC/D;AAED,wBAAgB,yBAAyB,CACvC,gBAAgB,GAAE,OAAO,CAAC,oBAAoB,CAAM,GACnD,oBAAoB,CAStB;AAED,wBAAgB,kBAAkB,CAChC,gBAAgB,GAAE,OAAO,CAAC,uBAAuB,CAAM,GACtD,uBAAuB,CAQzB;AAED,wBAAgB,oBAAoB,CAClC,gBAAgB,GAAE,OAAO,CAAC,oBAAoB,CAAM,GACnD,oBAAoB,CAStB"}
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/__stubs__/components.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EA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,GACnD,oBAAoB,CAStB"}
@@ -1 +1 @@
1
- {"version":3,"file":"component-types.d.ts","sourceRoot":"","sources":["../../../src/components/component-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAwKhD,CAAA"}
1
+ {"version":3,"file":"component-types.d.ts","sourceRoot":"","sources":["../../../src/components/component-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAgLhD,CAAA"}
@@ -18,6 +18,7 @@ export declare enum ComponentType {
18
18
  List = "List",
19
19
  Markdown = "Markdown",
20
20
  FileUploadField = "FileUploadField",
21
+ DeclarationField = "DeclarationField",
21
22
  EastingNorthingField = "EastingNorthingField",
22
23
  OsGridRefField = "OsGridRefField",
23
24
  NationalGridFieldNumberField = "NationalGridFieldNumberField",
@@ -1 +1 @@
1
- {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/components/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,SAAS,cAAc;IACvB,kBAAkB,uBAAuB;IACzC,UAAU,eAAe;IACzB,cAAc,mBAAmB;IACjC,cAAc,mBAAmB;IACjC,WAAW,gBAAgB;IAC3B,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,WAAW,gBAAgB;IAC3B,cAAc,mBAAmB;IACjC,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,eAAe,oBAAoB;IACnC,oBAAoB,yBAAyB;IAC7C,cAAc,mBAAmB;IACjC,4BAA4B,iCAAiC;IAC7D,YAAY,iBAAiB;CAC9B"}
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/components/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,SAAS,cAAc;IACvB,kBAAkB,uBAAuB;IACzC,UAAU,eAAe;IACzB,cAAc,mBAAmB;IACjC,cAAc,mBAAmB;IACjC,WAAW,gBAAgB;IAC3B,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,WAAW,gBAAgB;IAC3B,cAAc,mBAAmB;IACjC,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;IACrC,oBAAoB,yBAAyB;IAC7C,cAAc,mBAAmB;IACjC,4BAA4B,iCAAiC;IAC7D,YAAY,iBAAiB;CAC9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/components/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,2BAA2B,CAAA;AAElC;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,SAAS,YAAY,EACjE,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,GAUC,SAAS,CAC9C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,CAAC,EAAE,OAAO,CA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ponent extends FormFieldBase {
81
81
  max?: number;
82
82
  min?: number;
83
83
  precision?: number;
84
+ minPrecision?: number;
85
+ minLength?: number;
86
+ maxLength?: number;
84
87
  };
85
88
  }
86
89
  export interface TelephoneNumberFieldComponent extends FormFieldBase {
@@ -110,6 +113,14 @@ export interface YesNoFieldComponent extends FormFieldBase {
110
113
  condition?: string;
111
114
  };
112
115
  }
116
+ export interface DeclarationFieldComponent extends FormFieldBase {
117
+ type: ComponentType.DeclarationField;
118
+ content: string;
119
+ options: FormFieldBase['options'] & {
120
+ condition?: string;
121
+ declarationConfirmationLabel?: string;
122
+ };
123
+ }
113
124
  export interface MultilineTextFieldComponent extends FormFieldBase {
114
125
  type: ComponentType.MultilineTextField;
115
126
  options: FormFieldBase['options'] & {
@@ -258,7 +269,7 @@ export interface SelectFieldComponent extends ListFieldBase {
258
269
  }
259
270
  export type ComponentDef = FormComponentsDef | ContentComponentsDef;
260
271
  export type FormComponentsDef = InputFieldsComponentsDef | SelectionComponentsDef;
261
- export type InputFieldsComponentsDef = TextFieldComponent | EmailAddressFieldComponent | NumberFieldComponent | MultilineTextFieldComponent | TelephoneNumberFieldComponent | MonthYearFieldComponent | DatePartsFieldComponent | UkAddressFieldComponent | FileUploadFieldComponent | EastingNorthingFieldComponent | OsGridRefFieldComponent | NationalGridFieldNumberFieldComponent | LatLongFieldComponent;
272
+ export type InputFieldsComponentsDef = TextFieldComponent | EmailAddressFieldComponent | NumberFieldComponent | MultilineTextFieldComponent | TelephoneNumberFieldComponent | MonthYearFieldComponent | DatePartsFieldComponent | UkAddressFieldComponent | FileUploadFieldComponent | DeclarationFieldComponent | EastingNorthingFieldComponent | OsGridRefFieldComponent | NationalGridFieldNumberFieldComponent | LatLongFieldComponent;
262
273
  export type ContentComponentsDef = DetailsComponent | HtmlComponent | MarkdownComponent | InsetTextComponent | ListComponent;
263
274
  export type ListComponentsDef = Exclude<SelectionComponentsDef, YesNoFieldComponent> | ListComponent;
264
275
  export type SelectionComponentsDef = AutocompleteFieldComponent | CheckboxesFieldComponent | RadiosFieldComponent | SelectFieldComponent | YesNoFieldComponent;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAE3C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,qCAAqC,CAAA;AAE5C,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAC5C,wBAAwB,CAAC,MAAM,CAAC,EAChC,oBAAoB,CACrB,CAAA;AAED;;GAEG;AAEH,UAAU,aAAa;IACrB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAA;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,YAAY,CAAC,EAAE,OAAO,CAAA;QACtB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,wBAAwB,CAAC,EAAE,gBAAgB,CAAA;QAC3C,eAAe,CAAC,EAAE,MAAM,CAAA;KACzB,CAAA;CACF;AAED,UAAU,aAAc,SAAQ,aAAa;IAC3C,IAAI,EACA,aAAa,CAAC,iBAAiB,GAC/B,aAAa,CAAC,eAAe,GAC7B,aAAa,CAAC,WAAW,GACzB,aAAa,CAAC,WAAW,CAAA;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG;QAClC,IAAI,CAAC,EAAE,eAAe,CAAA;KACvB,CAAA;CACF;AAED,UAAU,gBAAgB;IACxB,EAAE,CAAC,EAA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,SAAS,CAAC,GAAG;QAClC,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;CACF;AAED,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,IAAI,EAAE,aAAa,CAAC,WAAW,CAAA;IAC/B,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG;QAClC,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;CACF;AAED,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,oBAAoB,CAAA;AAGnE,MAAM,MAAM,iBAAiB,GACzB,wBAAwB,GACxB,sBAAsB,CAAA;AAG1B,MAAM,MAAM,wBAAwB,GAChC,kBAAkB,GAClB,0BAA0B,GAC1B,oBAAoB,GACpB,2BAA2B,GAC3B,6BAA6B,GAC7B,uBAAuB,GACvB,uBAAuB,GACvB,uBAAuB,GACvB,wBAAwB,GACxB,yBAAyB,GACzB,6BAA6B,GAC7B,uBAAuB,GACvB,qCAAqC,GACrC,qBAAqB,CAAA;AAGzB,MAAM,MAAM,oBAAoB,GAC5B,gBAAgB,GAChB,aAAa,GACb,iBAAiB,GACjB,kBAAkB,GAClB,aAAa,CAAA;AAGjB,MAAM,MAAM,iBAAiB,GACzB,OAAO,CAAC,sBAAsB,EAAE,mBAAmB,CAAC,GACpD,aAAa,CAAA;AAGjB,MAAM,MAAM,sBAAsB,GAC9B,0BAA0B,GAC1B,wBAAwB,GACxB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,CAAA;AAGvB,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAC5C,YAAY,EACV,kBAAkB,GAClB,aAAa,GACb,uBAAuB,GACvB,uBAAuB,GACvB,wBAAwB,CAC3B,CAAA"}
@@ -66,6 +66,10 @@ export declare const customOperators: {
66
66
  is: OperatorDefinition;
67
67
  "is not": OperatorDefinition;
68
68
  };
69
+ DeclarationField: {
70
+ is: OperatorDefinition;
71
+ "is not": OperatorDefinition;
72
+ };
69
73
  EastingNorthingField: {
70
74
  is: OperatorDefinition;
71
75
  "is not": OperatorDefinition;
@@ -1 +1 @@
1
- {"version":3,"file":"condition-operators.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-operators.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,2BAA2B,CAAA;AAKlC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAIL,YAAY,EACb,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAA;AAqClC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B3B,CAAA;AAED,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,wBAAwB,kBAOpE;AAED,wBAAgB,aAAa,CAC3B,SAAS,EAAE,wBAAwB,EACnC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,sBAW1B;AA8DD,eAAO,MAAM,yBAAyB,EAEjC,YAAY,EAAE,CAAA;AAEnB,eAAO,MAAM,yBAAyB,EAEjC,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"condition-operators.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-operators.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,2BAA2B,CAAA;AAKlC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAIL,YAAY,EACb,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAA;AAqClC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+B3B,CAAA;AAED,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,wBAAwB,kBAOpE;AAED,wBAAgB,aAAa,CAC3B,SAAS,EAAE,wBAAwB,EACnC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,sBAW1B;AA8DD,eAAO,MAAM,yBAAyB,EAEjC,YAAY,EAAE,CAAA;AAEnB,eAAO,MAAM,yBAAyB,EAEjC,YAAY,EAAE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/helpers.js"],"names":[],"mappings":"AAkEA;;;;GAIG;AACH,gEAJW,gBAAgB,cAChB,cAAc,GACZ,CAAC,SAAS,EAAE,YAAY,KAAK,QAAQ,CA4CjD;sCAGsD,yCAAyC;oCAG7D,qCAAqC;kCACvC,2BAA2B;8BAH/B,4CAA4C"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/helpers.js"],"names":[],"mappings":"AAmEA;;;;GAIG;AACH,gEAJW,gBAAgB,cAChB,cAAc,GACZ,CAAC,SAAS,EAAE,YAAY,KAAK,QAAQ,CA4CjD;sCAGsD,yCAAyC;oCAG7D,qCAAqC;kCACvC,2BAA2B;8BAH/B,4CAA4C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-model",
3
- "version": "3.0.573",
3
+ "version": "3.0.575",
4
4
  "description": "A hapi plugin providing the model for Defra forms",
5
5
  "homepage": "https://github.com/DEFRA/forms-designer/tree/main/model#readme",
6
6
  "types": "dist/types/index.d.ts",
@@ -3,6 +3,7 @@ import {
3
3
  type AutocompleteFieldComponent,
4
4
  type CheckboxesFieldComponent,
5
5
  type DatePartsFieldComponent,
6
+ type DeclarationFieldComponent,
6
7
  type DetailsComponent,
7
8
  type EmailAddressFieldComponent,
8
9
  type FileUploadFieldComponent,
@@ -67,6 +68,20 @@ export function buildYesNoFieldComponent(
67
68
  type: ComponentType.YesNoField
68
69
  }
69
70
  }
71
+
72
+ export function buildDeclarationFieldComponent(
73
+ partialDeclarationField: Partial<DeclarationFieldComponent> = {}
74
+ ): DeclarationFieldComponent {
75
+ return {
76
+ title: 'Declaration',
77
+ id: 'f2a8c9e1-3d4f-4b5a-8c6d-1e2f3a4b5c6d',
78
+ name: 'DeclarationFieldComponent',
79
+ content: '',
80
+ options: {},
81
+ ...partialDeclarationField,
82
+ type: ComponentType.DeclarationField
83
+ }
84
+ }
70
85
  export function buildMonthYearFieldComponent(
71
86
  partialMonthYearField: Partial<MonthYearFieldComponent> = {}
72
87
  ): MonthYearFieldComponent {
@@ -144,6 +144,14 @@ export const ComponentTypes: readonly ComponentDef[] = Object.freeze([
144
144
  list: '',
145
145
  options: {}
146
146
  },
147
+ {
148
+ name: 'DeclarationField',
149
+ title: 'Declaration',
150
+ type: ComponentType.DeclarationField,
151
+ hint: '',
152
+ content: '',
153
+ options: {}
154
+ },
147
155
  {
148
156
  name: 'EastingNorthingField',
149
157
  title: 'Easting and northing',
@@ -18,6 +18,7 @@ export enum ComponentType {
18
18
  List = 'List',
19
19
  Markdown = 'Markdown',
20
20
  FileUploadField = 'FileUploadField',
21
+ DeclarationField = 'DeclarationField',
21
22
  EastingNorthingField = 'EastingNorthingField',
22
23
  OsGridRefField = 'OsGridRefField',
23
24
  NationalGridFieldNumberField = 'NationalGridFieldNumberField',
@@ -55,7 +55,8 @@ export function isConditionalType(
55
55
  ComponentType.NumberField,
56
56
  ComponentType.SelectField,
57
57
  ComponentType.TextField,
58
- ComponentType.YesNoField
58
+ ComponentType.YesNoField,
59
+ ComponentType.DeclarationField
59
60
  ]
60
61
 
61
62
  return !!type && allowedTypes.includes(type)
@@ -165,7 +166,8 @@ export function hasSelectionFields(
165
166
  ComponentType.CheckboxesField,
166
167
  ComponentType.RadiosField,
167
168
  ComponentType.SelectField,
168
- ComponentType.YesNoField
169
+ ComponentType.YesNoField,
170
+ ComponentType.DeclarationField
169
171
  ]
170
172
 
171
173
  return !!component?.type && allowedTypes.includes(component.type)
@@ -107,6 +107,9 @@ export interface NumberFieldComponent extends FormFieldBase {
107
107
  max?: number
108
108
  min?: number
109
109
  precision?: number
110
+ minPrecision?: number
111
+ minLength?: number
112
+ maxLength?: number
110
113
  }
111
114
  }
112
115
 
@@ -140,6 +143,15 @@ export interface YesNoFieldComponent extends FormFieldBase {
140
143
  }
141
144
  }
142
145
 
146
+ export interface DeclarationFieldComponent extends FormFieldBase {
147
+ type: ComponentType.DeclarationField
148
+ content: string
149
+ options: FormFieldBase['options'] & {
150
+ condition?: string
151
+ declarationConfirmationLabel?: string
152
+ }
153
+ }
154
+
143
155
  export interface MultilineTextFieldComponent extends FormFieldBase {
144
156
  type: ComponentType.MultilineTextField
145
157
  options: FormFieldBase['options'] & {
@@ -324,6 +336,7 @@ export type InputFieldsComponentsDef =
324
336
  | DatePartsFieldComponent
325
337
  | UkAddressFieldComponent
326
338
  | FileUploadFieldComponent
339
+ | DeclarationFieldComponent
327
340
  | EastingNorthingFieldComponent
328
341
  | OsGridRefFieldComponent
329
342
  | NationalGridFieldNumberFieldComponent
@@ -81,6 +81,7 @@ export const customOperators = {
81
81
  [ComponentType.TelephoneNumberField]: defaultOperators,
82
82
  [ComponentType.SelectField]: defaultOperators,
83
83
  [ComponentType.YesNoField]: defaultOperators,
84
+ [ComponentType.DeclarationField]: defaultOperators,
84
85
  [ComponentType.EastingNorthingField]: defaultOperators,
85
86
  [ComponentType.OsGridRefField]: defaultOperators,
86
87
  [ComponentType.NationalGridFieldNumberField]: defaultOperators,
@@ -57,6 +57,7 @@ const InputFieldComponentDictionary = {
57
57
  [ComponentType.CheckboxesField]: CheckboxQuestion,
58
58
  [ComponentType.SelectField]: SelectQuestion,
59
59
  [ComponentType.YesNoField]: YesNoQuestion,
60
+ [ComponentType.DeclarationField]: YesNoQuestion,
60
61
  [ComponentType.FileUploadField]: SupportingEvidenceQuestion,
61
62
  [ComponentType.EastingNorthingField]: ShortAnswerQuestion,
62
63
  [ComponentType.OsGridRefField]: ShortAnswerQuestion,