@defra/forms-model 3.0.300 → 3.0.301

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 (48) hide show
  1. package/dist/module/components/component-types.js +2 -2
  2. package/dist/module/components/component-types.js.map +1 -1
  3. package/dist/module/components/helpers.js +2 -2
  4. package/dist/module/components/helpers.js.map +1 -1
  5. package/dist/module/form/form-definition/types.js.map +1 -1
  6. package/dist/module/form/utils/find-start-page.js +3 -1
  7. package/dist/module/form/utils/find-start-page.js.map +1 -1
  8. package/dist/module/index.js +1 -0
  9. package/dist/module/index.js.map +1 -1
  10. package/dist/module/pages/controller-types.js +24 -0
  11. package/dist/module/pages/controller-types.js.map +1 -0
  12. package/dist/module/pages/enums.js +16 -0
  13. package/dist/module/pages/enums.js.map +1 -0
  14. package/dist/module/pages/helpers.js +77 -0
  15. package/dist/module/pages/helpers.js.map +1 -0
  16. package/dist/module/pages/index.js +5 -0
  17. package/dist/module/pages/index.js.map +1 -0
  18. package/dist/module/pages/page-types.js +45 -0
  19. package/dist/module/pages/page-types.js.map +1 -0
  20. package/dist/types/components/component-types.d.ts +1 -1
  21. package/dist/types/components/component-types.d.ts.map +1 -1
  22. package/dist/types/components/helpers.d.ts.map +1 -1
  23. package/dist/types/form/form-definition/types.d.ts +23 -8
  24. package/dist/types/form/form-definition/types.d.ts.map +1 -1
  25. package/dist/types/form/utils/find-start-page.d.ts.map +1 -1
  26. package/dist/types/index.d.ts +1 -0
  27. package/dist/types/index.d.ts.map +1 -1
  28. package/dist/types/pages/controller-types.d.ts +7 -0
  29. package/dist/types/pages/controller-types.d.ts.map +1 -0
  30. package/dist/types/pages/enums.d.ts +14 -0
  31. package/dist/types/pages/enums.d.ts.map +1 -0
  32. package/dist/types/pages/helpers.d.ts +41 -0
  33. package/dist/types/pages/helpers.d.ts.map +1 -0
  34. package/dist/types/pages/index.d.ts +5 -0
  35. package/dist/types/pages/index.d.ts.map +1 -0
  36. package/dist/types/pages/page-types.d.ts +6 -0
  37. package/dist/types/pages/page-types.d.ts.map +1 -0
  38. package/package.json +1 -1
  39. package/src/components/component-types.ts +2 -2
  40. package/src/components/helpers.ts +3 -1
  41. package/src/form/form-definition/types.ts +30 -11
  42. package/src/form/utils/find-start-page.ts +2 -1
  43. package/src/index.ts +1 -0
  44. package/src/pages/controller-types.ts +32 -0
  45. package/src/pages/enums.ts +14 -0
  46. package/src/pages/helpers.ts +109 -0
  47. package/src/pages/index.ts +19 -0
  48. package/src/pages/page-types.ts +52 -0
@@ -2,7 +2,7 @@ import { ComponentType } from "./enums.js";
2
2
  /**
3
3
  * Defaults for creating new components
4
4
  */
5
- export const ComponentTypes = [{
5
+ export const ComponentTypes = Object.freeze([{
6
6
  name: 'TextField',
7
7
  title: 'Text field',
8
8
  type: ComponentType.TextField,
@@ -110,5 +110,5 @@ export const ComponentTypes = [{
110
110
  type: ComponentType.List,
111
111
  list: '',
112
112
  options: {}
113
- }];
113
+ }]);
114
114
  //# sourceMappingURL=component-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component-types.js","names":["ComponentType","ComponentTypes","name","title","type","TextField","hint","options","schema","MultilineTextField","YesNoField","DatePartsField","MonthYearField","SelectField","list","AutocompleteField","RadiosField","CheckboxesField","NumberField","UkAddressField","TelephoneNumberField","EmailAddressField","Html","content","InsetText","Details","List"],"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: ComponentDef[] = [\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: '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: '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"],"mappings":"AAAA,SAASA,aAAa;AAGtB;AACA;AACA;AACA,OAAO,MAAMC,cAA8B,GAAG,CAC5C;EACEC,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEJ,aAAa,CAACK,SAAS;EAC7BC,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EAC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BC,IAAI,EAAEJ,aAAa,CAACyB,OAAO;EAC3BF,OAAO,EAAE,EAAE;EACXhB,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAEJ,aAAa,CAAC0B,IAAI;EACxBZ,IAAI,EAAE,EAAE;EACRP,OAAO,EAAE,CAAC;AACZ,CAAC,CACF","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","Html","content","InsetText","Details","List"],"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: '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: '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"],"mappings":"AAAA,SAASA,aAAa;AAGtB;AACA;AACA;AACA,OAAO,MAAMC,cAAuC,GAAGC,MAAM,CAACC,MAAM,CAAC,CACnE;EACEC,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEN,aAAa,CAACO,SAAS;EAC7BC,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,oBAAoB;EAC1BC,KAAK,EAAE,sBAAsB;EAC7BC,IAAI,EAAEN,aAAa,CAACW,kBAAkB;EACtCH,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,YAAY;EAClBC,KAAK,EAAE,cAAc;EACrBC,IAAI,EAAEN,aAAa,CAACY,UAAU;EAC9BJ,IAA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AAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,gBAAgB;EACtBC,KAAK,EAAE,kBAAkB;EACzBC,IAAI,EAAEN,aAAa,CAACqB,cAAc;EAClCb,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,sBAAsB;EAC5BC,KAAK,EAAE,wBAAwB;EAC/BC,IAAI,EAAEN,aAAa,CAACsB,oBAAoB;EACxCd,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,mBAAmB;EACzBC,KAAK,EAAE,qBAAqB;EAC5BC,IAAI,EAAEN,aAAa,CAACuB,iBAAiB;EACrCf,IAAI,EAAE,iCAAiC;EACvCC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAEN,aAAa,CAACwB,IAAI;EACxBC,OAAO,EAAE,EAAE;EACXhB,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEN,aAAa,CAAC0B,SAAS;EAC7BD,OAAO,EAAE;AACX,CAAC,EACD;EACErB,IAAI,EAAE,SAAS;EACfC,KAAK,EAAE,SAAS;EAChBC,IAAI,EAAEN,aAAa,CAAC2B,OAAO;EAC3BF,OAAO,EAAE,EAAE;EACXhB,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAEN,aAAa,CAAC4B,IAAI;EACxBZ,IAAI,EAAE,EAAE;EACRP,OAAO,EAAE,CAAC;AACZ,CAAC,CACF,CAAC","ignoreList":[]}
@@ -7,9 +7,9 @@ export function getComponentDefaults(component) {
7
7
  if (!component?.type) {
8
8
  return;
9
9
  }
10
- return ComponentTypes.find(({
10
+ return structuredClone(ComponentTypes.find(({
11
11
  type
12
- }) => type === component.type);
12
+ }) => type === component.type));
13
13
  }
14
14
 
15
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","names":["ComponentTypes","ComponentType","getComponentDefaults","component","type","find","hasConditionSupport","isConditionalType","allowedTypes","AutocompleteField","RadiosField","CheckboxesField","DatePartsField","EmailAddressField","MultilineTextField","TelephoneNumberField","NumberField","SelectField","TextField","YesNoField","Html","Details","includes","hasContent","isContentType","hasContentField","deniedTypes","List","InsetText","hasFormField","isFormType","hasListField","isListType","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 ConditionalComponentsDef,\n type ConditionalComponentType,\n type ContentComponentsDef,\n type FormComponentsDef,\n type HtmlComponent,\n type InsetTextComponent,\n type ListComponent,\n type ListComponentsDef,\n type SelectionComponentsDef\n} from '~/src/components/types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getComponentDefaults(component?: Partial<ComponentDef>) {\n if (!component?.type) {\n return\n }\n\n return ComponentTypes.find(({ type }) => type === component.type)\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.Html,\n ComponentType.Details\n ]\n\n return !!type && allowedTypes.includes(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.InsetText,\n ComponentType.List\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known components with form 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 components with selection 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<ComponentDef, InsetTextComponent | HtmlComponent> {\n const deniedTypes = [ComponentType.InsetText, ComponentType.Html]\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;AActB;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,SAAiC,EAAE;EACtE,IAAI,CAACA,SAAS,EAAEC,IAAI,EAAE;IACpB;EACF;EAEA,OAAOJ,cAAc,CAACK,IAAI,CAAC,CAAC;IAAED;EAAK,CAAC,KAAKA,IAAI,KAAKD,SAAS,CAACC,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAASE,mBAAmBA,CACjCH,SAAiC,EACM;EACvC,OAAOI,iBAAiB,CAACJ,SAAS,EAAEC,IAAI,CAAC;AAC3C;AAEA,OAAO,SAASG,iBAAiBA,CAC/BH,IAAoB,EACc;EAClC,MAAMI,YAAY,GAAG,CACnBP,aAAa,CAACQ,iBAAiB,EAC/BR,aAAa,CAACS,WAAW,EACzBT,aAAa,CAACU,eAAe,EAC7BV,aAAa,CAACW,cAAc,EAC5BX,aAAa,CAACY,iBAAiB,EAC/BZ,aAAa,CAACa,kBAAkB,EAChCb,aAAa,CAACc,oBAAoB,EAClCd,aAAa,CAACe,WAAW,EACzBf,aAAa,CAACgB,WAAW,EACzBhB,aAAa,CAACiB,SAAS,EACvBjB,aAAa,CAACkB,UAAU,EACxBlB,aAAa,CAACmB,IAAI,EAClBnB,aAAa,CAACoB,OAAO,CACtB;EAED,OAAO,CAAC,CAACjB,IAAI,IAAII,YAAY,CAACc,QAAQ,CAAClB,IAAI,CAAC;AAC9C;;AAEA;AACA;AACA;AACA,OAAO,SAASmB,UAAUA,CACxBpB,SAAiC,EACE;EACnC,OAAOqB,aAAa,CAACrB,SAAS,EAAEC,IAAI,CAAC;AACvC;;AAEA;AACA;AACA;AACA,OAAO,SAASqB,eAAeA,CAC7BtB,SAAiC,EAC0B;EAC3D,MAAMuB,WAAW,GAAG,CAACzB,aAAa,CAAC0B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ACS,WAAW,EACzBT,aAAa,CAACgB,WAAW,EACzBhB,aAAa,CAACkB,UAAU,CACzB;EAED,OAAO,CAAC,CAAChB,SAAS,EAAEC,IAAI,IAAII,YAAY,CAACc,QAAQ,CAACnB,SAAS,CAACC,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAAS8B,QAAQA,CACtB/B,SAAiC,EACuC;EACxE,MAAMuB,WAAW,GAAG,CAACzB,aAAa,CAAC2B,SAAS,EAAE3B,aAAa,CAACmB,IAAI,CAAC;EACjE,OAAO,CAAC,CAACjB,SAAS,EAAEC,IAAI,IAAI,CAACsB,WAAW,CAACJ,QAAQ,CAACnB,SAAS,CAACC,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAAS+B,OAAOA,CACrBhC,SAAiC,EACe;EAChD,OAAO2B,UAAU,CAAC3B,SAAS,EAAEC,IAAI,CAAC,IAAID,SAAS,EAAEC,IAAI,KAAKH,aAAa,CAAC0B,IAAI;AAC9E","ignoreList":[]}
1
+ {"version":3,"file":"helpers.js","names":["ComponentTypes","ComponentType","getComponentDefaults","component","type","structuredClone","find","hasConditionSupport","isConditionalType","allowedTypes","AutocompleteField","RadiosField","CheckboxesField","DatePartsField","EmailAddressField","MultilineTextField","TelephoneNumberField","NumberField","SelectField","TextField","YesNoField","Html","Details","includes","hasContent","isContentType","hasContentField","deniedTypes","List","InsetText","hasFormField","isFormType","hasListField","isListType","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 ConditionalComponentsDef,\n type ConditionalComponentType,\n type ContentComponentsDef,\n type FormComponentsDef,\n type HtmlComponent,\n type InsetTextComponent,\n type ListComponent,\n type ListComponentsDef,\n type SelectionComponentsDef\n} from '~/src/components/types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getComponentDefaults(component?: Partial<ComponentDef>) {\n if (!component?.type) {\n return\n }\n\n return structuredClone(\n ComponentTypes.find(({ type }) => type === component.type)\n )\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.Html,\n ComponentType.Details\n ]\n\n return !!type && allowedTypes.includes(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.InsetText,\n ComponentType.List\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known components with form 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 components with selection 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<ComponentDef, InsetTextComponent | HtmlComponent> {\n const deniedTypes = [ComponentType.InsetText, ComponentType.Html]\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;AActB;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,SAAiC,EAAE;EACtE,IAAI,CAACA,SAAS,EAAEC,IAAI,EAAE;IACpB;EACF;EAEA,OAAOC,eAAe,CACpBL,cAAc,CAACM,IAAI,CAAC,CAAC;IAAEF;EAAK,CAAC,KAAKA,IAAI,KAAKD,SAAS,CAACC,IAAI,CAC3D,CAAC;AACH;;AAEA;AACA;AACA;AACA,OAAO,SAASG,mBAAmBA,CACjCJ,SAAiC,EACM;EACvC,OAAOK,iBAAiB,CAACL,SAAS,EAAEC,IAAI,CAAC;AAC3C;AAEA,OAAO,SAASI,iBAAiBA,CAC/BJ,IAAoB,EACc;EAClC,MAAMK,YAAY,GAAG,CACnBR,aAAa,CAACS,iBAAiB,EAC/BT,aAAa,CAACU,WAAW,EACzBV,aAAa,CAACW,eAAe,EAC7BX,aAAa,CAACY,cAAc,EAC5BZ,aAAa,CAACa,iBAAiB,EA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AYA,CAC1B7B,SAAiC,EACD;EAChC,OAAO8B,UAAU,CAAC9B,SAAS,EAAEC,IAAI,CAAC;AACpC;AAEA,OAAO,SAAS6B,UAAUA,CACxB7B,IAAoB,EACe;EACnC,MAAMK,YAAY,GAAG,CACnBR,aAAa,CAACS,iBAAiB,EAC/BT,aAAa,CAAC2B,IAAI,EAClB3B,aAAa,CAACU,WAAW,EACzBV,aAAa,CAACiB,WAAW,EACzBjB,aAAa,CAACW,eAAe,CAC9B;EAED,OAAO,CAAC,CAACR,IAAI,IAAIK,YAAY,CAACc,QAAQ,CAACnB,IAAI,CAAC;AAC9C;;AAEA;AACA;AACA;AACA,OAAO,SAAS8B,kBAAkBA,CAChC/B,SAAiC,EACI;EACrC,MAAMM,YAAY,GAAG,CACnBR,aAAa,CAACS,iBAAiB,EAC/BT,aAAa,CAACW,eAAe,EAC7BX,aAAa,CAACU,WAAW,EACzBV,aAAa,CAACiB,WAAW,EACzBjB,aAAa,CAACmB,UAAU,CACzB;EAED,OAAO,CAAC,CAACjB,SAAS,EAAEC,IAAI,IAAIK,YAAY,CAACc,QAAQ,CAACpB,SAAS,CAACC,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAAS+B,QAAQA,CACtBhC,SAAiC,EACuC;EACxE,MAAMwB,WAAW,GAAG,CAAC1B,aAAa,CAAC4B,SAAS,EAAE5B,aAAa,CAACoB,IAAI,CAAC;EACjE,OAAO,CAAC,CAAClB,SAAS,EAAEC,IAAI,IAAI,CAACuB,WAAW,CAACJ,QAAQ,CAACpB,SAAS,CAACC,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAASgC,OAAOA,CACrBjC,SAAiC,EACe;EAChD,OAAO4B,UAAU,CAAC5B,SAAS,EAAEC,IAAI,CAAC,IAAID,SAAS,EAAEC,IAAI,KAAKH,aAAa,CAAC2B,IAAI;AAC9E","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-definition/types.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types.js'\nimport { type ConditionsModelData } from '~/src/conditions/types.js'\nimport { formDefinitionSchema } from '~/src/form/form-definition/index.js'\n\nexport interface Link {\n path: string\n condition?: string\n redirect?: string\n}\n\nexport interface PageBase {\n title: string\n path: string\n controller?:\n | 'StartPageController'\n | 'FileUploadPageController'\n | 'SummaryPageController'\n components?: ComponentDef[]\n section?: string\n next?: Link[]\n}\n\nexport interface PageWithNext extends PageBase {\n controller?: Exclude<PageBase['controller'], 'SummaryPageController'>\n next: Link[]\n}\n\nexport interface PageWithComponents extends PageBase {\n components: ComponentDef[]\n}\n\nexport type Page = PageWithComponents | PageWithNext | PageBase\n\nexport interface Section {\n name: string\n title: string\n hideTitle?: boolean\n}\n\nexport interface Item {\n text: string\n value: string | number | boolean\n description?: string\n conditional?: { components: ComponentDef[] }\n condition?: string\n}\n\nexport interface List {\n name: string\n title: string\n type: ListTypeContent\n items: Item[]\n}\n\nexport type ListTypeOption = 'bulleted' | 'numbered'\nexport type ListTypeContent = 'string' | 'number' | 'boolean'\n\nexport interface Feedback {\n feedbackForm?: boolean\n url?: string\n emailAddress?: string\n}\n\nexport interface PhaseBanner {\n phase?: 'alpha' | 'beta'\n feedbackUrl?: string\n}\n\nexport interface ConditionWrapper {\n name: string\n displayName: string\n value: ConditionsModelData\n}\n\n/**\n * Interface for `formDefinitionSchema` Joi schema\n * @see {@link formDefinitionSchema}\n */\nexport interface FormDefinition {\n pages: Page[]\n conditions: ConditionWrapper[]\n lists: List[]\n sections: Section[]\n startPage?: string\n name?: string\n feedback?: Feedback\n phaseBanner?: PhaseBanner\n skipSummary?: boolean\n declaration?: string\n metadata?: Record<string, unknown>\n outputEmail?: string\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-definition/types.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types.js'\nimport { type ConditionsModelData } from '~/src/conditions/types.js'\nimport { formDefinitionSchema } from '~/src/form/form-definition/index.js'\nimport { type ControllerPath, type ControllerType } from '~/src/pages/enums.js'\n\nexport interface Link {\n path: string\n condition?: string\n redirect?: string\n}\n\nexport interface PageBase {\n title: string\n path: string\n}\n\nexport interface PageStart extends PageBase {\n controller: ControllerType.Start | ControllerType.Home\n section?: string | undefined\n next: Link[]\n components: ComponentDef[]\n}\n\nexport interface PageQuestion extends PageBase {\n controller?: ControllerType.Page | ControllerType.FileUpload\n section?: string | undefined\n next: Link[]\n components: ComponentDef[]\n}\n\nexport interface PageSummary extends PageBase {\n path: ControllerPath.Summary\n controller: ControllerType.Summary\n section?: undefined\n}\n\nexport interface PageStatus extends PageBase {\n path: ControllerPath.Status\n controller: ControllerType.Status\n section?: undefined\n}\n\nexport type Page = PageStart | PageQuestion | PageSummary | PageStatus\n\nexport type RequiredField<\n Type extends Partial<object>,\n KeyType extends keyof Type\n> = Omit<Type, KeyType> &\n Required<{\n [Key in KeyType]: Type[Key]\n }>\n\nexport interface Section {\n name: string\n title: string\n hideTitle?: boolean\n}\n\nexport interface Item {\n text: string\n value: string | number | boolean\n description?: string\n conditional?: { components: ComponentDef[] }\n condition?: string\n}\n\nexport interface List {\n name: string\n title: string\n type: ListTypeContent\n items: Item[]\n}\n\nexport type ListTypeOption = 'bulleted' | 'numbered'\nexport type ListTypeContent = 'string' | 'number' | 'boolean'\n\nexport interface Feedback {\n feedbackForm?: boolean\n url?: string\n emailAddress?: string\n}\n\nexport interface PhaseBanner {\n phase?: 'alpha' | 'beta'\n feedbackUrl?: string\n}\n\nexport interface ConditionWrapper {\n name: string\n displayName: string\n value: ConditionsModelData\n}\n\n/**\n * Interface for `formDefinitionSchema` Joi schema\n * @see {@link formDefinitionSchema}\n */\nexport interface FormDefinition {\n pages: Page[]\n conditions: ConditionWrapper[]\n lists: List[]\n sections: Section[]\n startPage?: string\n name?: string\n feedback?: Feedback\n phaseBanner?: PhaseBanner\n skipSummary?: boolean\n declaration?: string\n metadata?: Record<string, unknown>\n outputEmail?: string\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ import { hasNext } from "../../pages/helpers.js";
2
+
1
3
  /**
2
4
  * Find correct start page for form definition
3
5
  *
@@ -16,7 +18,7 @@ export function findStartPage(data) {
16
18
  } = data;
17
19
 
18
20
  // Get a unique list of all pages that are linked to by other pages
19
- const pageReferences = new Set(pages.flatMap(page => page.next?.map(next => next.path)));
21
+ const pageReferences = new Set(pages.filter(hasNext).flatMap(page => page.next.map(next => next.path)));
20
22
 
21
23
  // For each page on the form, work out if it's referenced by another page
22
24
  // those that aren't referenced must be start pages
@@ -1 +1 @@
1
- {"version":3,"file":"find-start-page.js","names":["findStartPage","data","pages","pageReferences","Set","flatMap","page","next","map","path","startPages","filter","has","length"],"sources":["../../../../src/form/utils/find-start-page.ts"],"sourcesContent":["import { type FormDefinition } from '~/src/form/form-definition/types.js'\n\n/**\n * Find correct start page for form definition\n *\n * Computed by counting the next paths in a form definition and returning page\n * that doesn't have a reference, meaning it must be a start page / root node\n *\n * It's possibe for forms to be malformed and have multiple start pages while\n * they're being developed. This may be valid during development, but in this\n * scenario we can't detect the real start page and we require the user to fix\n * this themselves\n * @param data - Form definition\n */\nexport function findStartPage(data: FormDefinition) {\n const { pages } = data\n\n // Get a unique list of all pages that are linked to by other pages\n const pageReferences = new Set(\n pages.flatMap((page) => page.next?.map((next) => next.path))\n )\n\n // For each page on the form, work out if it's referenced by another page\n // those that aren't referenced must be start pages\n const startPages = pages\n .map((page) => page.path)\n .filter((page) => !pageReferences.has(page))\n\n // We can only set the start page if there is a single one, else the user has made an error\n if (startPages.length === 1) {\n return startPages[0]\n }\n}\n"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,aAAaA,CAACC,IAAoB,EAAE;EAClD,MAAM;IAAEC;EAAM,CAAC,GAAGD,IAAI;;EAEtB;EACA,MAAME,cAAc,GAAG,IAAIC,GAAG,CAC5BF,KAAK,CAACG,OAAO,CAAEC,IAAI,IAAKA,IAAI,CAACC,IAAI,EAAEC,GAAG,CAAED,IAAI,IAAKA,IAAI,CAACE,IAAI,CAAC,CAC7D,CAAC;;EAED;EACA;EACA,MAAMC,UAAU,GAAGR,KAAK,CACrBM,GAAG,CAAEF,IAAI,IAAKA,IAAI,CAACG,IAAI,CAAC,CACxBE,MAAM,CAAEL,IAAI,IAAK,CAACH,cAAc,CAACS,GAAG,CAACN,IAAI,CAAC,CAAC;;EAE9C;EACA,IAAII,UAAU,CAACG,MAAM,KAAK,CAAC,EAAE;IAC3B,OAAOH,UAAU,CAAC,CAAC,CAAC;EACtB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"find-start-page.js","names":["hasNext","findStartPage","data","pages","pageReferences","Set","filter","flatMap","page","next","map","path","startPages","has","length"],"sources":["../../../../src/form/utils/find-start-page.ts"],"sourcesContent":["import { type FormDefinition } from '~/src/form/form-definition/types.js'\nimport { hasNext } from '~/src/pages/helpers.js'\n\n/**\n * Find correct start page for form definition\n *\n * Computed by counting the next paths in a form definition and returning page\n * that doesn't have a reference, meaning it must be a start page / root node\n *\n * It's possibe for forms to be malformed and have multiple start pages while\n * they're being developed. This may be valid during development, but in this\n * scenario we can't detect the real start page and we require the user to fix\n * this themselves\n * @param data - Form definition\n */\nexport function findStartPage(data: FormDefinition) {\n const { pages } = data\n\n // Get a unique list of all pages that are linked to by other pages\n const pageReferences = new Set(\n pages.filter(hasNext).flatMap((page) => page.next.map((next) => next.path))\n )\n\n // For each page on the form, work out if it's referenced by another page\n // those that aren't referenced must be start pages\n const startPages = pages\n .map((page) => page.path)\n .filter((page) => !pageReferences.has(page))\n\n // We can only set the start page if there is a single one, else the user has made an error\n if (startPages.length === 1) {\n return startPages[0]\n }\n}\n"],"mappings":"AACA,SAASA,OAAO;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACC,IAAoB,EAAE;EAClD,MAAM;IAAEC;EAAM,CAAC,GAAGD,IAAI;;EAEtB;EACA,MAAME,cAAc,GAAG,IAAIC,GAAG,CAC5BF,KAAK,CAACG,MAAM,CAACN,OAAO,CAAC,CAACO,OAAO,CAAEC,IAAI,IAAKA,IAAI,CAACC,IAAI,CAACC,GAAG,CAAED,IAAI,IAAKA,IAAI,CAACE,IAAI,CAAC,CAC5E,CAAC;;EAED;EACA;EACA,MAAMC,UAAU,GAAGT,KAAK,CACrBO,GAAG,CAAEF,IAAI,IAAKA,IAAI,CAACG,IAAI,CAAC,CACxBL,MAAM,CAAEE,IAAI,IAAK,CAACJ,cAAc,CAACS,GAAG,CAACL,IAAI,CAAC,CAAC;;EAE9C;EACA,IAAII,UAAU,CAACE,MAAM,KAAK,CAAC,EAAE;IAC3B,OAAOF,UAAU,CAAC,CAAC,CAAC;EACtB;AACF","ignoreList":[]}
@@ -3,5 +3,6 @@ export * from "./form/form-metadata/index.js";
3
3
  export * from "./form/utils/index.js";
4
4
  export * from "./components/index.js";
5
5
  export * from "./conditions/index.js";
6
+ export * from "./pages/index.js";
6
7
  export * from "./utils/helpers.js";
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from '~/src/form/form-definition/index.js'\nexport * from '~/src/form/form-metadata/index.js'\nexport * from '~/src/form/utils/index.js'\nexport * from '~/src/components/index.js'\nexport * from '~/src/conditions/index.js'\nexport * from '~/src/utils/helpers.js'\nexport type * from '~/src/components/types.js'\nexport type * from '~/src/conditions/types.js'\nexport type * from '~/src/form/form-definition/types.js'\nexport type * from '~/src/form/form-metadata/types.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from '~/src/form/form-definition/index.js'\nexport * from '~/src/form/form-metadata/index.js'\nexport * from '~/src/form/utils/index.js'\nexport * from '~/src/components/index.js'\nexport * from '~/src/conditions/index.js'\nexport * from '~/src/pages/index.js'\nexport * from '~/src/utils/helpers.js'\nexport type * from '~/src/components/types.js'\nexport type * from '~/src/conditions/types.js'\nexport type * from '~/src/form/form-definition/types.js'\nexport type * from '~/src/form/form-metadata/types.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ import { ControllerType } from "./enums.js";
2
+ export const ControllerTypes = [{
3
+ name: ControllerType.Start,
4
+ path: './pages/start.js'
5
+ }, {
6
+ name: ControllerType.Home,
7
+ path: './pages/home.js'
8
+ }, {
9
+ name: ControllerType.Page,
10
+ path: './pages/page.js'
11
+ }, {
12
+ name: ControllerType.FileUpload,
13
+ path: './pages/file-upload.js'
14
+ }, {
15
+ name: ControllerType.Summary,
16
+ path: './pages/summary.js'
17
+ }, {
18
+ name: ControllerType.Status,
19
+ path: './pages/status.js'
20
+ }];
21
+ export const ControllerNames = ControllerTypes.map(({
22
+ name
23
+ }) => name.toString());
24
+ //# sourceMappingURL=controller-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller-types.js","names":["ControllerType","ControllerTypes","name","Start","path","Home","Page","FileUpload","Summary","Status","ControllerNames","map","toString"],"sources":["../../../src/pages/controller-types.ts"],"sourcesContent":["import { ControllerType } from '~/src/pages/enums.js'\n\nexport const ControllerTypes = [\n {\n name: ControllerType.Start,\n path: './pages/start.js'\n },\n {\n name: ControllerType.Home,\n path: './pages/home.js'\n },\n {\n name: ControllerType.Page,\n path: './pages/page.js'\n },\n {\n name: ControllerType.FileUpload,\n path: './pages/file-upload.js'\n },\n {\n name: ControllerType.Summary,\n path: './pages/summary.js'\n },\n {\n name: ControllerType.Status,\n path: './pages/status.js'\n }\n]\n\nexport const ControllerNames = ControllerTypes.map(({ name }) =>\n name.toString()\n)\n"],"mappings":"AAAA,SAASA,cAAc;AAEvB,OAAO,MAAMC,eAAe,GAAG,CAC7B;EACEC,IAAI,EAAEF,cAAc,CAACG,KAAK;EAC1BC,IAAI,EAAE;AACR,CAAC,EACD;EACEF,IAAI,EAAEF,cAAc,CAACK,IAAI;EACzBD,IAAI,EAAE;AACR,CAAC,EACD;EACEF,IAAI,EAAEF,cAAc,CAACM,IAAI;EACzBF,IAAI,EAAE;AACR,CAAC,EACD;EACEF,IAAI,EAAEF,cAAc,CAACO,UAAU;EAC/BH,IAAI,EAAE;AACR,CAAC,EACD;EACEF,IAAI,EAAEF,cAAc,CAACQ,OAAO;EAC5BJ,IAAI,EAAE;AACR,CAAC,EACD;EACEF,IAAI,EAAEF,cAAc,CAACS,MAAM;EAC3BL,IAAI,EAAE;AACR,CAAC,CACF;AAED,OAAO,MAAMM,eAAe,GAAGT,eAAe,CAACU,GAAG,CAAC,CAAC;EAAET;AAAK,CAAC,KAC1DA,IAAI,CAACU,QAAQ,CAAC,CAChB,CAAC","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ export let ControllerPath = /*#__PURE__*/function (ControllerPath) {
2
+ ControllerPath["Start"] = "/start";
3
+ ControllerPath["Summary"] = "/summary";
4
+ ControllerPath["Status"] = "/status";
5
+ return ControllerPath;
6
+ }({});
7
+ export let ControllerType = /*#__PURE__*/function (ControllerType) {
8
+ ControllerType["Start"] = "StartPageController";
9
+ ControllerType["Home"] = "HomePageController";
10
+ ControllerType["Page"] = "PageController";
11
+ ControllerType["FileUpload"] = "FileUploadPageController";
12
+ ControllerType["Summary"] = "SummaryPageController";
13
+ ControllerType["Status"] = "StatusPageController";
14
+ return ControllerType;
15
+ }({});
16
+ //# sourceMappingURL=enums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.js","names":["ControllerPath","ControllerType"],"sources":["../../../src/pages/enums.ts"],"sourcesContent":["export enum ControllerPath {\n Start = '/start',\n Summary = '/summary',\n Status = '/status'\n}\n\nexport enum ControllerType {\n Start = 'StartPageController',\n Home = 'HomePageController',\n Page = 'PageController',\n FileUpload = 'FileUploadPageController',\n Summary = 'SummaryPageController',\n Status = 'StatusPageController'\n}\n"],"mappings":"AAAA,WAAYA,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAM1B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA","ignoreList":[]}
@@ -0,0 +1,77 @@
1
+ import { ControllerNames, ControllerTypes } from "./controller-types.js";
2
+ import { ControllerType } from "./enums.js";
3
+ import { PageTypes } from "./page-types.js";
4
+
5
+ /**
6
+ * Return component defaults by type
7
+ */
8
+ export function getPageDefaults(page) {
9
+ const controller = controllerNameFromPath(page.controller);
10
+ const defaults = PageTypes.find(pageType => pageType.controller === controller);
11
+ if (!defaults) {
12
+ throw new Error(`Defaults not found for ${page.controller}`);
13
+ }
14
+ return structuredClone(defaults);
15
+ }
16
+
17
+ /**
18
+ * Check page has components
19
+ */
20
+ export function hasComponents(page) {
21
+ return isLinkablePage(page) && Array.isArray(page.components);
22
+ }
23
+
24
+ /**
25
+ * Check page has sections
26
+ */
27
+ export function hasSection(page) {
28
+ return isLinkablePage(page) && typeof page.section === 'string';
29
+ }
30
+
31
+ /**
32
+ * Check page has next link
33
+ */
34
+ export function hasNext(page) {
35
+ return isLinkablePage(page);
36
+ }
37
+
38
+ /**
39
+ * Check for known page controller names
40
+ */
41
+ export function isControllerName(nameOrPath) {
42
+ return !!nameOrPath && ControllerNames.includes(nameOrPath);
43
+ }
44
+
45
+ /**
46
+ * Check page is linkable
47
+ */
48
+ export function isLinkablePage(page) {
49
+ if (!page || !('next' in page)) {
50
+ return false;
51
+ }
52
+ const controller = controllerNameFromPath(page.controller);
53
+ return controller === ControllerType.Start || controller === ControllerType.Page || controller === ControllerType.FileUpload;
54
+ }
55
+
56
+ /**
57
+ * Check page supports questions
58
+ */
59
+ export function isQuestionPage(page) {
60
+ const controller = controllerNameFromPath(page?.controller);
61
+ return controller === ControllerType.Page || controller === ControllerType.FileUpload;
62
+ }
63
+
64
+ /**
65
+ * Check and optionally replace legacy path with controller name
66
+ * @param {string} [nameOrPath] - Controller name or legacy controller path
67
+ */
68
+ export function controllerNameFromPath(nameOrPath) {
69
+ if (isControllerName(nameOrPath)) {
70
+ return nameOrPath;
71
+ }
72
+ const options = ControllerTypes.find(({
73
+ path
74
+ }) => path === nameOrPath);
75
+ return options?.name ?? ControllerType.Page;
76
+ }
77
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","names":["ControllerNames","ControllerTypes","ControllerType","PageTypes","getPageDefaults","page","controller","controllerNameFromPath","defaults","find","pageType","Error","structuredClone","hasComponents","isLinkablePage","Array","isArray","components","hasSection","section","hasNext","isControllerName","nameOrPath","includes","Start","Page","FileUpload","isQuestionPage","options","path","name"],"sources":["../../../src/pages/helpers.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types.js'\nimport {\n type Link,\n type Page,\n type PageQuestion,\n type PageStart,\n type RequiredField\n} from '~/src/form/form-definition/types.js'\nimport {\n ControllerNames,\n ControllerTypes\n} from '~/src/pages/controller-types.js'\nimport { ControllerType } from '~/src/pages/enums.js'\nimport { PageTypes } from '~/src/pages/page-types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getPageDefaults(page: Pick<Page, 'controller'>) {\n const controller = controllerNameFromPath(page.controller)\n\n const defaults = PageTypes.find(\n (pageType) => pageType.controller === controller\n )\n\n if (!defaults) {\n throw new Error(`Defaults not found for ${page.controller}`)\n }\n\n return structuredClone(defaults)\n}\n\n/**\n * Check page has components\n */\nexport function hasComponents(\n page?: Partial<Page>\n): page is Extract<Page, { components: ComponentDef[] }> {\n return isLinkablePage(page) && Array.isArray(page.components)\n}\n\n/**\n * Check page has sections\n */\nexport function hasSection(\n page?: Partial<Page>\n): page is RequiredField<PageStart | PageQuestion, 'section'> {\n return isLinkablePage(page) && typeof page.section === 'string'\n}\n\n/**\n * Check page has next link\n */\nexport function hasNext(page?: Partial<Page>) {\n return isLinkablePage(page)\n}\n\n/**\n * Check for known page controller names\n */\nexport function isControllerName(\n nameOrPath?: ControllerType | string\n): nameOrPath is ControllerType {\n return !!nameOrPath && ControllerNames.includes(nameOrPath)\n}\n\n/**\n * Check page is linkable\n */\nexport function isLinkablePage(\n page?: Partial<Page>\n): page is Extract<Page, { next: Link[] }> {\n if (!page || !('next' in page)) {\n return false\n }\n\n const controller = controllerNameFromPath(page.controller)\n\n return (\n controller === ControllerType.Start ||\n controller === ControllerType.Page ||\n controller === ControllerType.FileUpload\n )\n}\n\n/**\n * Check page supports questions\n */\nexport function isQuestionPage(page?: Partial<Page>): page is PageQuestion {\n const controller = controllerNameFromPath(page?.controller)\n\n return (\n controller === ControllerType.Page ||\n controller === ControllerType.FileUpload\n )\n}\n\n/**\n * Check and optionally replace legacy path with controller name\n * @param {string} [nameOrPath] - Controller name or legacy controller path\n */\nexport function controllerNameFromPath(nameOrPath?: ControllerType | string) {\n if (isControllerName(nameOrPath)) {\n return nameOrPath\n }\n\n const options = ControllerTypes.find(({ path }) => path === nameOrPath)\n return options?.name ?? ControllerType.Page\n}\n"],"mappings":"AAQA,SACEA,eAAe,EACfC,eAAe;AAEjB,SAASC,cAAc;AACvB,SAASC,SAAS;;AAElB;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAACC,IAA8B,EAAE;EAC9D,MAAMC,UAAU,GAAGC,sBAAsB,CAACF,IAAI,CAACC,UAAU,CAAC;EAE1D,MAAME,QAAQ,GAAGL,SAAS,CAACM,IAAI,CAC5BC,QAAQ,IAAKA,QAAQ,CAACJ,UAAU,KAAKA,UACxC,CAAC;EAED,IAAI,CAACE,QAAQ,EAAE;IACb,MAAM,IAAIG,KAAK,CAAC,0BAA0BN,IAAI,CAACC,UAAU,EAAE,CAAC;EAC9D;EAEA,OAAOM,eAAe,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AAoC,EAAE;EAC3E,IAAID,gBAAgB,CAACC,UAAU,CAAC,EAAE;IAChC,OAAOA,UAAU;EACnB;EAEA,MAAMM,OAAO,GAAG3B,eAAe,CAACQ,IAAI,CAAC,CAAC;IAAEoB;EAAK,CAAC,KAAKA,IAAI,KAAKP,UAAU,CAAC;EACvE,OAAOM,OAAO,EAAEE,IAAI,IAAI5B,cAAc,CAACuB,IAAI;AAC7C","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ export { ControllerNames, ControllerTypes } from "./controller-types.js";
2
+ export { PageTypes } from "./page-types.js";
3
+ export { controllerNameFromPath, getPageDefaults, hasComponents, hasSection, hasNext, isControllerName, isLinkablePage, isQuestionPage } from "./helpers.js";
4
+ export { ControllerPath, ControllerType } from "./enums.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["ControllerNames","ControllerTypes","PageTypes","controllerNameFromPath","getPageDefaults","hasComponents","hasSection","hasNext","isControllerName","isLinkablePage","isQuestionPage","ControllerPath","ControllerType"],"sources":["../../../src/pages/index.ts"],"sourcesContent":["export {\n ControllerNames,\n ControllerTypes\n} from '~/src/pages/controller-types.js'\n\nexport { PageTypes } from '~/src/pages/page-types.js'\n\nexport {\n controllerNameFromPath,\n getPageDefaults,\n hasComponents,\n hasSection,\n hasNext,\n isControllerName,\n isLinkablePage,\n isQuestionPage\n} from '~/src/pages/helpers.js'\n\nexport { ControllerPath, ControllerType } from '~/src/pages/enums.js'\n"],"mappings":"AAAA,SACEA,eAAe,EACfC,eAAe;AAGjB,SAASC,SAAS;AAElB,SACEC,sBAAsB,EACtBC,eAAe,EACfC,aAAa,EACbC,UAAU,EACVC,OAAO,EACPC,gBAAgB,EAChBC,cAAc,EACdC,cAAc;AAGhB,SAASC,cAAc,EAAEC,cAAc","ignoreList":[]}
@@ -0,0 +1,45 @@
1
+ import { ControllerType, ControllerPath } from "./enums.js";
2
+
3
+ /**
4
+ * Defaults for creating new pages
5
+ */
6
+ export const PageTypes = Object.freeze([{
7
+ title: 'Start page',
8
+ path: ControllerPath.Start,
9
+ controller: ControllerType.Start,
10
+ section: undefined,
11
+ next: [],
12
+ components: []
13
+ }, {
14
+ title: 'Question page',
15
+ path: '/question-page',
16
+ controller: ControllerType.Page,
17
+ section: undefined,
18
+ next: [],
19
+ components: []
20
+ }, {
21
+ title: 'File upload page',
22
+ path: '/file-upload-page',
23
+ controller: ControllerType.FileUpload,
24
+ section: undefined,
25
+ next: [],
26
+ components: []
27
+ }, {
28
+ title: 'File upload page',
29
+ path: '/file-upload-page',
30
+ controller: ControllerType.FileUpload,
31
+ section: undefined,
32
+ next: [],
33
+ components: []
34
+ }, {
35
+ title: 'Check your answers',
36
+ path: ControllerPath.Summary,
37
+ controller: ControllerType.Summary,
38
+ section: undefined
39
+ }, {
40
+ title: 'Form submitted',
41
+ path: ControllerPath.Status,
42
+ controller: ControllerType.Status,
43
+ section: undefined
44
+ }]);
45
+ //# sourceMappingURL=page-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-types.js","names":["ControllerType","ControllerPath","PageTypes","Object","freeze","title","path","Start","controller","section","undefined","next","components","Page","FileUpload","Summary","Status"],"sources":["../../../src/pages/page-types.ts"],"sourcesContent":["import { type Page } from '~/src/form/form-definition/types.js'\nimport { ControllerType, ControllerPath } from '~/src/pages/enums.js'\n\n/**\n * Defaults for creating new pages\n */\nexport const PageTypes: readonly Page[] = Object.freeze([\n {\n title: 'Start page',\n path: ControllerPath.Start,\n controller: ControllerType.Start,\n section: undefined,\n next: [],\n components: []\n },\n {\n title: 'Question page',\n path: '/question-page',\n controller: ControllerType.Page,\n section: undefined,\n next: [],\n components: []\n },\n {\n title: 'File upload page',\n path: '/file-upload-page',\n controller: ControllerType.FileUpload,\n section: undefined,\n next: [],\n components: []\n },\n {\n title: 'File upload page',\n path: '/file-upload-page',\n controller: ControllerType.FileUpload,\n section: undefined,\n next: [],\n components: []\n },\n {\n title: 'Check your answers',\n path: ControllerPath.Summary,\n controller: ControllerType.Summary,\n section: undefined\n },\n {\n title: 'Form submitted',\n path: ControllerPath.Status,\n controller: ControllerType.Status,\n section: undefined\n }\n])\n"],"mappings":"AACA,SAASA,cAAc,EAAEC,cAAc;;AAEvC;AACA;AACA;AACA,OAAO,MAAMC,SAA0B,GAAGC,MAAM,CAACC,MAAM,CAAC,CACtD;EACEC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEL,cAAc,CAACM,KAAK;EAC1BC,UAAU,EAAER,cAAc,CAACO,KAAK;EAChCE,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,eAAe;EACtBC,IAAI,EAAE,gBAAgB;EACtBE,UAAU,EAAER,cAAc,CAACa,IAAI;EAC/BJ,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,kBAAkB;EACzBC,IAAI,EAAE,mBAAmB;EACzBE,UAAU,EAAER,cAAc,CAACc,UAAU;EACrCL,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,kBAAkB;EACzBC,IAAI,EAAE,mBAAmB;EACzBE,UAAU,EAAER,cAAc,CAACc,UAAU;EACrCL,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,oBAAoB;EAC3BC,IAAI,EAAEL,cAAc,CAACc,OAAO;EAC5BP,UAAU,EAAER,cAAc,CAACe,OAAO;EAClCN,OAAO,EAAEC;AACX,CAAC,EACD;EACEL,KAAK,EAAE,gBAAgB;EACvBC,IAAI,EAAEL,cAAc,CAACe,MAAM;EAC3BR,UAAU,EAAER,cAAc,CAACgB,MAAM;EACjCP,OAAO,EAAEC;AACX,CAAC,CACF,CAAC","ignoreList":[]}
@@ -2,5 +2,5 @@ import { type ComponentDef } from '../components/types.js';
2
2
  /**
3
3
  * Defaults for creating new components
4
4
  */
5
- export declare const ComponentTypes: ComponentDef[];
5
+ export declare const ComponentTypes: readonly ComponentDef[];
6
6
  //# sourceMappingURL=component-types.d.ts.map
@@ -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,YAAY,EA8HxC,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,EA8HhD,CAAA"}
@@ -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,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,2BAA2B,CAAA;AAElC;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,4BAMrE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,wBAAwB,CAEvC;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,CAAC,EAAE,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;;GAEG;AACH,wBAAgB,YAAY,CAC1B,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,iBAAiB,CAEhC;AAED,wBAAgB,UAAU,CACxB,IAAI,CAAC,EAAE,aAAa,GACnB,IAAI,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAUnC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,sBAAsB,CAUrC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CACtB,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,OAAO,CAAC,YAAY,EAAE,kBAAkB,GAAG,aAAa,CAAC,CAGxE;AAED;;GAEG;AACH,wBAAgB,OAAO,CACrB,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,iBAAiB,GAAG,aAAa,CAEhD"}
@@ -1,5 +1,6 @@
1
1
  import { type ComponentDef } from '../../components/types.js';
2
2
  import { type ConditionsModelData } from '../../conditions/types.js';
3
+ import { type ControllerPath, type ControllerType } from '../../pages/enums.js';
3
4
  export interface Link {
4
5
  path: string;
5
6
  condition?: string;
@@ -8,19 +9,33 @@ export interface Link {
8
9
  export interface PageBase {
9
10
  title: string;
10
11
  path: string;
11
- controller?: 'StartPageController' | 'FileUploadPageController' | 'SummaryPageController';
12
- components?: ComponentDef[];
13
- section?: string;
14
- next?: Link[];
15
12
  }
16
- export interface PageWithNext extends PageBase {
17
- controller?: Exclude<PageBase['controller'], 'SummaryPageController'>;
13
+ export interface PageStart extends PageBase {
14
+ controller: ControllerType.Start | ControllerType.Home;
15
+ section?: string | undefined;
18
16
  next: Link[];
17
+ components: ComponentDef[];
19
18
  }
20
- export interface PageWithComponents extends PageBase {
19
+ export interface PageQuestion extends PageBase {
20
+ controller?: ControllerType.Page | ControllerType.FileUpload;
21
+ section?: string | undefined;
22
+ next: Link[];
21
23
  components: ComponentDef[];
22
24
  }
23
- export type Page = PageWithComponents | PageWithNext | PageBase;
25
+ export interface PageSummary extends PageBase {
26
+ path: ControllerPath.Summary;
27
+ controller: ControllerType.Summary;
28
+ section?: undefined;
29
+ }
30
+ export interface PageStatus extends PageBase {
31
+ path: ControllerPath.Status;
32
+ controller: ControllerType.Status;
33
+ section?: undefined;
34
+ }
35
+ export type Page = PageStart | PageQuestion | PageSummary | PageStatus;
36
+ export type RequiredField<Type extends Partial<object>, KeyType extends keyof Type> = Omit<Type, KeyType> & Required<{
37
+ [Key in KeyType]: Type[Key];
38
+ }>;
24
39
  export interface Section {
25
40
  name: string;
26
41
  title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/form-definition/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAGpE,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EACP,qBAAqB,GACrB,0BAA0B,GAC1B,uBAAuB,CAAA;IAC3B,UAAU,CAAC,EAAE,YAAY,EAAE,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,IAAI,EAAE,CAAA;CACd;AAED,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,uBAAuB,CAAC,CAAA;IACrE,IAAI,EAAE,IAAI,EAAE,CAAA;CACb;AAED,MAAM,WAAW,kBA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"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAEzE;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,sBAkBjD"}
1
+ {"version":3,"file":"find-start-page.d.ts","sourceRoot":"","sources":["../../../../src/form/utils/find-start-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAGzE;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,sBAkBjD"}
@@ -3,6 +3,7 @@ export * from './form/form-metadata/index.js';
3
3
  export * from './form/utils/index.js';
4
4
  export * from './components/index.js';
5
5
  export * from './conditions/index.js';
6
+ export * from './pages/index.js';
6
7
  export * from './utils/helpers.js';
7
8
  export type * from './components/types.js';
8
9
  export type * from './conditions/types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA;AACnD,cAAc,mCAAmC,CAAA;AACjD,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,qCAAqC,CAAA;AACxD,mBAAmB,mCAAmC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA;AACnD,cAAc,mCAAmC,CAAA;AACjD,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,qCAAqC,CAAA;AACxD,mBAAmB,mCAAmC,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { ControllerType } from '../pages/enums.js';
2
+ export declare const ControllerTypes: {
3
+ name: ControllerType;
4
+ path: string;
5
+ }[];
6
+ export declare const ControllerNames: string[];
7
+ //# sourceMappingURL=controller-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller-types.d.ts","sourceRoot":"","sources":["../../../src/pages/controller-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,eAAO,MAAM,eAAe;;;GAyB3B,CAAA;AAED,eAAO,MAAM,eAAe,UAE3B,CAAA"}
@@ -0,0 +1,14 @@
1
+ export declare enum ControllerPath {
2
+ Start = "/start",
3
+ Summary = "/summary",
4
+ Status = "/status"
5
+ }
6
+ export declare enum ControllerType {
7
+ Start = "StartPageController",
8
+ Home = "HomePageController",
9
+ Page = "PageController",
10
+ FileUpload = "FileUploadPageController",
11
+ Summary = "SummaryPageController",
12
+ Status = "StatusPageController"
13
+ }
14
+ //# sourceMappingURL=enums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/pages/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,KAAK,WAAW;IAChB,OAAO,aAAa;IACpB,MAAM,YAAY;CACnB;AAED,oBAAY,cAAc;IACxB,KAAK,wBAAwB;IAC7B,IAAI,uBAAuB;IAC3B,IAAI,mBAAmB;IACvB,UAAU,6BAA6B;IACvC,OAAO,0BAA0B;IACjC,MAAM,yBAAyB;CAChC"}
@@ -0,0 +1,41 @@
1
+ import { type ComponentDef } from '../components/types.js';
2
+ import { type Link, type Page, type PageQuestion, type PageStart, type RequiredField } from '../form/form-definition/types.js';
3
+ import { ControllerType } from '../pages/enums.js';
4
+ /**
5
+ * Return component defaults by type
6
+ */
7
+ export declare function getPageDefaults(page: Pick<Page, 'controller'>): Page;
8
+ /**
9
+ * Check page has components
10
+ */
11
+ export declare function hasComponents(page?: Partial<Page>): page is Extract<Page, {
12
+ components: ComponentDef[];
13
+ }>;
14
+ /**
15
+ * Check page has sections
16
+ */
17
+ export declare function hasSection(page?: Partial<Page>): page is RequiredField<PageStart | PageQuestion, 'section'>;
18
+ /**
19
+ * Check page has next link
20
+ */
21
+ export declare function hasNext(page?: Partial<Page>): page is PageStart | PageQuestion;
22
+ /**
23
+ * Check for known page controller names
24
+ */
25
+ export declare function isControllerName(nameOrPath?: ControllerType | string): nameOrPath is ControllerType;
26
+ /**
27
+ * Check page is linkable
28
+ */
29
+ export declare function isLinkablePage(page?: Partial<Page>): page is Extract<Page, {
30
+ next: Link[];
31
+ }>;
32
+ /**
33
+ * Check page supports questions
34
+ */
35
+ export declare function isQuestionPage(page?: Partial<Page>): page is PageQuestion;
36
+ /**
37
+ * Check and optionally replace legacy path with controller name
38
+ * @param {string} [nameOrPath] - Controller name or legacy controller path
39
+ */
40
+ export declare function controllerNameFromPath(nameOrPath?: ControllerType | string): ControllerType;
41
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/pages/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EACL,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,qCAAqC,CAAA;AAK5C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAGrD;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,QAY7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GACnB,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,YAAY,EAAE,CAAA;CAAE,CAAC,CAEvD;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GACnB,IAAI,IAAI,aAAa,CAAC,SAAS,GAAG,YAAY,EAAE,SAAS,CAAC,CAE5D;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,oCAE3C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,CAAC,EAAE,cAAc,GAAG,MAAM,GACnC,UAAU,IAAI,cAAc,CAE9B;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GACnB,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,IAAI,EAAE,CAAA;CAAE,CAAC,CAYzC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,YAAY,CAOzE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,CAAC,EAAE,cAAc,GAAG,MAAM,kBAO1E"}
@@ -0,0 +1,5 @@
1
+ export { ControllerNames, ControllerTypes } from '../pages/controller-types.js';
2
+ export { PageTypes } from '../pages/page-types.js';
3
+ export { controllerNameFromPath, getPageDefaults, hasComponents, hasSection, hasNext, isControllerName, isLinkablePage, isQuestionPage } from '../pages/helpers.js';
4
+ export { ControllerPath, ControllerType } from '../pages/enums.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,eAAe,EAChB,MAAM,iCAAiC,CAAA;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,aAAa,EACb,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,cAAc,EACf,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { type Page } from '../form/form-definition/types.js';
2
+ /**
3
+ * Defaults for creating new pages
4
+ */
5
+ export declare const PageTypes: readonly Page[];
6
+ //# sourceMappingURL=page-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-types.d.ts","sourceRoot":"","sources":["../../../src/pages/page-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,qCAAqC,CAAA;AAG/D;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,IAAI,EA6CnC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-model",
3
- "version": "3.0.300",
3
+ "version": "3.0.301",
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
  "repository": {
@@ -4,7 +4,7 @@ import { type ComponentDef } from '~/src/components/types.js'
4
4
  /**
5
5
  * Defaults for creating new components
6
6
  */
7
- export const ComponentTypes: ComponentDef[] = [
7
+ export const ComponentTypes: readonly ComponentDef[] = Object.freeze([
8
8
  {
9
9
  name: 'TextField',
10
10
  title: 'Text field',
@@ -130,4 +130,4 @@ export const ComponentTypes: ComponentDef[] = [
130
130
  list: '',
131
131
  options: {}
132
132
  }
133
- ]
133
+ ])
@@ -21,7 +21,9 @@ export function getComponentDefaults(component?: Partial<ComponentDef>) {
21
21
  return
22
22
  }
23
23
 
24
- return ComponentTypes.find(({ type }) => type === component.type)
24
+ return structuredClone(
25
+ ComponentTypes.find(({ type }) => type === component.type)
26
+ )
25
27
  }
26
28
 
27
29
  /**
@@ -1,6 +1,7 @@
1
1
  import { type ComponentDef } from '~/src/components/types.js'
2
2
  import { type ConditionsModelData } from '~/src/conditions/types.js'
3
3
  import { formDefinitionSchema } from '~/src/form/form-definition/index.js'
4
+ import { type ControllerPath, type ControllerType } from '~/src/pages/enums.js'
4
5
 
5
6
  export interface Link {
6
7
  path: string
@@ -11,25 +12,43 @@ export interface Link {
11
12
  export interface PageBase {
12
13
  title: string
13
14
  path: string
14
- controller?:
15
- | 'StartPageController'
16
- | 'FileUploadPageController'
17
- | 'SummaryPageController'
18
- components?: ComponentDef[]
19
- section?: string
20
- next?: Link[]
21
15
  }
22
16
 
23
- export interface PageWithNext extends PageBase {
24
- controller?: Exclude<PageBase['controller'], 'SummaryPageController'>
17
+ export interface PageStart extends PageBase {
18
+ controller: ControllerType.Start | ControllerType.Home
19
+ section?: string | undefined
25
20
  next: Link[]
21
+ components: ComponentDef[]
26
22
  }
27
23
 
28
- export interface PageWithComponents extends PageBase {
24
+ export interface PageQuestion extends PageBase {
25
+ controller?: ControllerType.Page | ControllerType.FileUpload
26
+ section?: string | undefined
27
+ next: Link[]
29
28
  components: ComponentDef[]
30
29
  }
31
30
 
32
- export type Page = PageWithComponents | PageWithNext | PageBase
31
+ export interface PageSummary extends PageBase {
32
+ path: ControllerPath.Summary
33
+ controller: ControllerType.Summary
34
+ section?: undefined
35
+ }
36
+
37
+ export interface PageStatus extends PageBase {
38
+ path: ControllerPath.Status
39
+ controller: ControllerType.Status
40
+ section?: undefined
41
+ }
42
+
43
+ export type Page = PageStart | PageQuestion | PageSummary | PageStatus
44
+
45
+ export type RequiredField<
46
+ Type extends Partial<object>,
47
+ KeyType extends keyof Type
48
+ > = Omit<Type, KeyType> &
49
+ Required<{
50
+ [Key in KeyType]: Type[Key]
51
+ }>
33
52
 
34
53
  export interface Section {
35
54
  name: string
@@ -1,4 +1,5 @@
1
1
  import { type FormDefinition } from '~/src/form/form-definition/types.js'
2
+ import { hasNext } from '~/src/pages/helpers.js'
2
3
 
3
4
  /**
4
5
  * Find correct start page for form definition
@@ -17,7 +18,7 @@ export function findStartPage(data: FormDefinition) {
17
18
 
18
19
  // Get a unique list of all pages that are linked to by other pages
19
20
  const pageReferences = new Set(
20
- pages.flatMap((page) => page.next?.map((next) => next.path))
21
+ pages.filter(hasNext).flatMap((page) => page.next.map((next) => next.path))
21
22
  )
22
23
 
23
24
  // For each page on the form, work out if it's referenced by another page
package/src/index.ts CHANGED
@@ -3,6 +3,7 @@ export * from '~/src/form/form-metadata/index.js'
3
3
  export * from '~/src/form/utils/index.js'
4
4
  export * from '~/src/components/index.js'
5
5
  export * from '~/src/conditions/index.js'
6
+ export * from '~/src/pages/index.js'
6
7
  export * from '~/src/utils/helpers.js'
7
8
  export type * from '~/src/components/types.js'
8
9
  export type * from '~/src/conditions/types.js'
@@ -0,0 +1,32 @@
1
+ import { ControllerType } from '~/src/pages/enums.js'
2
+
3
+ export const ControllerTypes = [
4
+ {
5
+ name: ControllerType.Start,
6
+ path: './pages/start.js'
7
+ },
8
+ {
9
+ name: ControllerType.Home,
10
+ path: './pages/home.js'
11
+ },
12
+ {
13
+ name: ControllerType.Page,
14
+ path: './pages/page.js'
15
+ },
16
+ {
17
+ name: ControllerType.FileUpload,
18
+ path: './pages/file-upload.js'
19
+ },
20
+ {
21
+ name: ControllerType.Summary,
22
+ path: './pages/summary.js'
23
+ },
24
+ {
25
+ name: ControllerType.Status,
26
+ path: './pages/status.js'
27
+ }
28
+ ]
29
+
30
+ export const ControllerNames = ControllerTypes.map(({ name }) =>
31
+ name.toString()
32
+ )
@@ -0,0 +1,14 @@
1
+ export enum ControllerPath {
2
+ Start = '/start',
3
+ Summary = '/summary',
4
+ Status = '/status'
5
+ }
6
+
7
+ export enum ControllerType {
8
+ Start = 'StartPageController',
9
+ Home = 'HomePageController',
10
+ Page = 'PageController',
11
+ FileUpload = 'FileUploadPageController',
12
+ Summary = 'SummaryPageController',
13
+ Status = 'StatusPageController'
14
+ }
@@ -0,0 +1,109 @@
1
+ import { type ComponentDef } from '~/src/components/types.js'
2
+ import {
3
+ type Link,
4
+ type Page,
5
+ type PageQuestion,
6
+ type PageStart,
7
+ type RequiredField
8
+ } from '~/src/form/form-definition/types.js'
9
+ import {
10
+ ControllerNames,
11
+ ControllerTypes
12
+ } from '~/src/pages/controller-types.js'
13
+ import { ControllerType } from '~/src/pages/enums.js'
14
+ import { PageTypes } from '~/src/pages/page-types.js'
15
+
16
+ /**
17
+ * Return component defaults by type
18
+ */
19
+ export function getPageDefaults(page: Pick<Page, 'controller'>) {
20
+ const controller = controllerNameFromPath(page.controller)
21
+
22
+ const defaults = PageTypes.find(
23
+ (pageType) => pageType.controller === controller
24
+ )
25
+
26
+ if (!defaults) {
27
+ throw new Error(`Defaults not found for ${page.controller}`)
28
+ }
29
+
30
+ return structuredClone(defaults)
31
+ }
32
+
33
+ /**
34
+ * Check page has components
35
+ */
36
+ export function hasComponents(
37
+ page?: Partial<Page>
38
+ ): page is Extract<Page, { components: ComponentDef[] }> {
39
+ return isLinkablePage(page) && Array.isArray(page.components)
40
+ }
41
+
42
+ /**
43
+ * Check page has sections
44
+ */
45
+ export function hasSection(
46
+ page?: Partial<Page>
47
+ ): page is RequiredField<PageStart | PageQuestion, 'section'> {
48
+ return isLinkablePage(page) && typeof page.section === 'string'
49
+ }
50
+
51
+ /**
52
+ * Check page has next link
53
+ */
54
+ export function hasNext(page?: Partial<Page>) {
55
+ return isLinkablePage(page)
56
+ }
57
+
58
+ /**
59
+ * Check for known page controller names
60
+ */
61
+ export function isControllerName(
62
+ nameOrPath?: ControllerType | string
63
+ ): nameOrPath is ControllerType {
64
+ return !!nameOrPath && ControllerNames.includes(nameOrPath)
65
+ }
66
+
67
+ /**
68
+ * Check page is linkable
69
+ */
70
+ export function isLinkablePage(
71
+ page?: Partial<Page>
72
+ ): page is Extract<Page, { next: Link[] }> {
73
+ if (!page || !('next' in page)) {
74
+ return false
75
+ }
76
+
77
+ const controller = controllerNameFromPath(page.controller)
78
+
79
+ return (
80
+ controller === ControllerType.Start ||
81
+ controller === ControllerType.Page ||
82
+ controller === ControllerType.FileUpload
83
+ )
84
+ }
85
+
86
+ /**
87
+ * Check page supports questions
88
+ */
89
+ export function isQuestionPage(page?: Partial<Page>): page is PageQuestion {
90
+ const controller = controllerNameFromPath(page?.controller)
91
+
92
+ return (
93
+ controller === ControllerType.Page ||
94
+ controller === ControllerType.FileUpload
95
+ )
96
+ }
97
+
98
+ /**
99
+ * Check and optionally replace legacy path with controller name
100
+ * @param {string} [nameOrPath] - Controller name or legacy controller path
101
+ */
102
+ export function controllerNameFromPath(nameOrPath?: ControllerType | string) {
103
+ if (isControllerName(nameOrPath)) {
104
+ return nameOrPath
105
+ }
106
+
107
+ const options = ControllerTypes.find(({ path }) => path === nameOrPath)
108
+ return options?.name ?? ControllerType.Page
109
+ }
@@ -0,0 +1,19 @@
1
+ export {
2
+ ControllerNames,
3
+ ControllerTypes
4
+ } from '~/src/pages/controller-types.js'
5
+
6
+ export { PageTypes } from '~/src/pages/page-types.js'
7
+
8
+ export {
9
+ controllerNameFromPath,
10
+ getPageDefaults,
11
+ hasComponents,
12
+ hasSection,
13
+ hasNext,
14
+ isControllerName,
15
+ isLinkablePage,
16
+ isQuestionPage
17
+ } from '~/src/pages/helpers.js'
18
+
19
+ export { ControllerPath, ControllerType } from '~/src/pages/enums.js'
@@ -0,0 +1,52 @@
1
+ import { type Page } from '~/src/form/form-definition/types.js'
2
+ import { ControllerType, ControllerPath } from '~/src/pages/enums.js'
3
+
4
+ /**
5
+ * Defaults for creating new pages
6
+ */
7
+ export const PageTypes: readonly Page[] = Object.freeze([
8
+ {
9
+ title: 'Start page',
10
+ path: ControllerPath.Start,
11
+ controller: ControllerType.Start,
12
+ section: undefined,
13
+ next: [],
14
+ components: []
15
+ },
16
+ {
17
+ title: 'Question page',
18
+ path: '/question-page',
19
+ controller: ControllerType.Page,
20
+ section: undefined,
21
+ next: [],
22
+ components: []
23
+ },
24
+ {
25
+ title: 'File upload page',
26
+ path: '/file-upload-page',
27
+ controller: ControllerType.FileUpload,
28
+ section: undefined,
29
+ next: [],
30
+ components: []
31
+ },
32
+ {
33
+ title: 'File upload page',
34
+ path: '/file-upload-page',
35
+ controller: ControllerType.FileUpload,
36
+ section: undefined,
37
+ next: [],
38
+ components: []
39
+ },
40
+ {
41
+ title: 'Check your answers',
42
+ path: ControllerPath.Summary,
43
+ controller: ControllerType.Summary,
44
+ section: undefined
45
+ },
46
+ {
47
+ title: 'Form submitted',
48
+ path: ControllerPath.Status,
49
+ controller: ControllerType.Status,
50
+ section: undefined
51
+ }
52
+ ])