@defra/forms-model 3.0.581 → 3.0.582
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/components/component-types.js +7 -0
- package/dist/module/components/component-types.js.map +1 -1
- package/dist/module/components/enums.js +1 -0
- package/dist/module/components/enums.js.map +1 -1
- package/dist/module/components/types.js.map +1 -1
- package/dist/module/conditions/condition-operators.js +2 -1
- package/dist/module/conditions/condition-operators.js.map +1 -1
- package/dist/module/form/form-definition/helpers.js +19 -0
- package/dist/module/form/form-definition/helpers.js.map +1 -1
- package/dist/module/form/form-editor/preview/helpers.js +3 -1
- package/dist/module/form/form-editor/preview/helpers.js.map +1 -1
- package/dist/module/form/form-editor/preview/hidden.js +9 -0
- package/dist/module/form/form-editor/preview/hidden.js.map +1 -0
- package/dist/module/form/form-editor/preview/index.js +1 -0
- package/dist/module/form/form-editor/preview/index.js.map +1 -1
- package/dist/types/components/component-types.d.ts.map +1 -1
- package/dist/types/components/enums.d.ts +2 -1
- package/dist/types/components/enums.d.ts.map +1 -1
- package/dist/types/components/types.d.ts +7 -1
- package/dist/types/components/types.d.ts.map +1 -1
- package/dist/types/conditions/condition-operators.d.ts +1 -0
- package/dist/types/conditions/condition-operators.d.ts.map +1 -1
- package/dist/types/form/form-definition/helpers.d.ts +6 -0
- package/dist/types/form/form-definition/helpers.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/helpers.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/hidden.d.ts +4 -0
- package/dist/types/form/form-editor/preview/hidden.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/component-types.ts +8 -0
- package/src/components/enums.ts +2 -1
- package/src/components/types.ts +8 -0
- package/src/conditions/condition-operators.ts +2 -1
- package/src/form/form-definition/helpers.ts +23 -0
- package/src/form/form-editor/preview/helpers.js +3 -1
- package/src/form/form-editor/preview/hidden.js +9 -0
- package/src/form/form-editor/preview/index.js +1 -0
|
@@ -153,5 +153,12 @@ export const ComponentTypes = Object.freeze([{
|
|
|
153
153
|
type: ComponentType.LatLongField,
|
|
154
154
|
hint: 'For Great Britain, the latitude will be a number between 49.850 and 60.859. The longitude will be a number between -13.687 and 1.767',
|
|
155
155
|
options: {}
|
|
156
|
+
}, {
|
|
157
|
+
name: 'HiddenField',
|
|
158
|
+
title: 'Hidden field',
|
|
159
|
+
type: ComponentType.HiddenField,
|
|
160
|
+
hint: '',
|
|
161
|
+
options: {},
|
|
162
|
+
schema: {}
|
|
156
163
|
}]);
|
|
157
164
|
//# sourceMappingURL=component-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-types.js","names":["ComponentType","ComponentTypes","Object","freeze","name","title","type","TextField","hint","options","schema","MultilineTextField","YesNoField","DatePartsField","MonthYearField","SelectField","list","AutocompleteField","RadiosField","CheckboxesField","NumberField","UkAddressField","TelephoneNumberField","EmailAddressField","FileUploadField","Html","content","InsetText","Markdown","Details","List","DeclarationField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField"],"sources":["../../../src/components/component-types.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\n\n/**\n * Defaults for creating new components\n */\nexport const ComponentTypes: readonly ComponentDef[] = Object.freeze([\n {\n name: 'TextField',\n title: 'Text field',\n type: ComponentType.TextField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'MultilineTextField',\n title: 'Multiline text field',\n type: ComponentType.MultilineTextField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'YesNoField',\n title: 'Yes/No field',\n type: ComponentType.YesNoField,\n hint: '',\n options: {}\n },\n {\n name: 'DatePartsField',\n title: 'Date field',\n type: ComponentType.DatePartsField,\n hint: '',\n options: {}\n },\n {\n name: 'MonthYearField',\n title: 'Month & year field',\n type: ComponentType.MonthYearField,\n hint: '',\n options: {}\n },\n {\n name: 'SelectField',\n title: 'Select field',\n type: ComponentType.SelectField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'AutocompleteField',\n title: 'Autocomplete field',\n type: ComponentType.AutocompleteField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'RadiosField',\n title: 'Radios field',\n type: ComponentType.RadiosField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'CheckboxesField',\n title: 'Checkboxes field',\n type: ComponentType.CheckboxesField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'NumberField',\n title: 'Number field',\n type: ComponentType.NumberField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'UkAddressField',\n title: 'UK address field',\n type: ComponentType.UkAddressField,\n hint: '',\n options: {}\n },\n {\n name: 'TelephoneNumberField',\n title: 'Telephone number field',\n type: ComponentType.TelephoneNumberField,\n hint: '',\n options: {}\n },\n {\n name: 'EmailAddressField',\n title: 'Email address field',\n type: ComponentType.EmailAddressField,\n hint: 'For example, ‘name@example.com’',\n options: {}\n },\n {\n name: 'FileUploadField',\n title: 'File upload field',\n type: ComponentType.FileUploadField,\n options: {},\n schema: {}\n },\n {\n name: 'Html',\n title: 'Html',\n type: ComponentType.Html,\n content: '',\n options: {}\n },\n {\n name: 'InsetText',\n title: 'Inset text',\n type: ComponentType.InsetText,\n content: ''\n },\n {\n name: 'Markdown',\n title: 'Markdown',\n type: ComponentType.Markdown,\n content: '',\n options: {}\n },\n {\n name: 'Details',\n title: 'Details',\n type: ComponentType.Details,\n content: '',\n options: {}\n },\n {\n name: 'List',\n title: 'List',\n type: ComponentType.List,\n list: '',\n options: {}\n },\n {\n name: 'DeclarationField',\n title: 'Declaration',\n type: ComponentType.DeclarationField,\n hint: '',\n content: '',\n options: {}\n },\n {\n name: 'EastingNorthingField',\n title: 'Easting and northing',\n type: ComponentType.EastingNorthingField,\n hint: 'For example, Easting: 248741, Northing: 63688',\n options: {}\n },\n {\n name: 'OsGridRefField',\n title: 'Ordnance Survey (OS) grid reference',\n type: ComponentType.OsGridRefField,\n hint: 'An OS grid reference number is made up of 2 letters followed by 6 numbers, for example, TQ123456',\n options: {}\n },\n {\n name: 'NationalGridFieldNumberField',\n title: 'National Grid field number',\n type: ComponentType.NationalGridFieldNumberField,\n hint: 'A National Grid field number is made up of 2 letters and 8 numbers, for example, SO04188589',\n options: {}\n },\n {\n name: 'LatLongField',\n title: 'Latitude and longitude',\n type: ComponentType.LatLongField,\n hint: 'For Great Britain, the latitude will be a number between 49.850 and 60.859. The longitude will be a number between -13.687 and 1.767',\n options: {}\n }\n])\n"],"mappings":"AAAA,SAASA,aAAa;AAGtB;AACA;AACA;AACA,OAAO,MAAMC,cAAuC,GAAGC,MAAM,CAACC,MAAM,CAAC,CACnE;EACEC,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEN,aAAa,CAACO,SAAS;EAC7BC,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,oBAAoB;EAC1BC,KAAK,EAAE,sBAAsB;EAC7BC,IAAI,EAAEN,aAAa,CAACW,kBAAkB;EACtCH,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,YAAY;EAClBC,KAAK,EAAE,cAAc;EACrBC,IAAI,EAAEN,aAAa,CAACY,UAAU;EAC9BJ,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,gBAAgB;EACtBC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEN,aAAa,CAACa,cAAc;EAClCL,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,gBAAgB;EACtBC,KAAK,EAAE,oBAAoB;EAC3BC,IAAI,EAAEN,aAAa,CAACc,cAAc;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,EAAEN,aAAa,CAAC+B,gBAAgB;EACpCvB,IAAI,EAAE,EAAE;EACRkB,OAAO,EAAE,EAAE;EACXjB,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,sBAAsB;EAC5BC,KAAK,EAAE,sBAAsB;EAC7BC,IAAI,EAAEN,aAAa,CAACgC,oBAAoB;EACxCxB,IAAI,EAAE,+CAA+C;EACrDC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,gBAAgB;EACtBC,KAAK,EAAE,qCAAqC;EAC5CC,IAAI,EAAEN,aAAa,CAACiC,cAAc;EAClCzB,IAAI,EAAE,kGAAkG;EACxGC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,8BAA8B;EACpCC,KAAK,EAAE,4BAA4B;EACnCC,IAAI,EAAEN,aAAa,CAACkC,4BAA4B;EAChD1B,IAAI,EAAE,6FAA6F;EACnGC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,cAAc;EACpBC,KAAK,EAAE,wBAAwB;EAC/BC,IAAI,EAAEN,aAAa,CAACmC,YAAY;EAChC3B,IAAI,EAAE,sIAAsI;EAC5IC,OAAO,EAAE,CAAC;AACZ,CAAC,CACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"component-types.js","names":["ComponentType","ComponentTypes","Object","freeze","name","title","type","TextField","hint","options","schema","MultilineTextField","YesNoField","DatePartsField","MonthYearField","SelectField","list","AutocompleteField","RadiosField","CheckboxesField","NumberField","UkAddressField","TelephoneNumberField","EmailAddressField","FileUploadField","Html","content","InsetText","Markdown","Details","List","DeclarationField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","HiddenField"],"sources":["../../../src/components/component-types.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\n\n/**\n * Defaults for creating new components\n */\nexport const ComponentTypes: readonly ComponentDef[] = Object.freeze([\n {\n name: 'TextField',\n title: 'Text field',\n type: ComponentType.TextField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'MultilineTextField',\n title: 'Multiline text field',\n type: ComponentType.MultilineTextField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'YesNoField',\n title: 'Yes/No field',\n type: ComponentType.YesNoField,\n hint: '',\n options: {}\n },\n {\n name: 'DatePartsField',\n title: 'Date field',\n type: ComponentType.DatePartsField,\n hint: '',\n options: {}\n },\n {\n name: 'MonthYearField',\n title: 'Month & year field',\n type: ComponentType.MonthYearField,\n hint: '',\n options: {}\n },\n {\n name: 'SelectField',\n title: 'Select field',\n type: ComponentType.SelectField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'AutocompleteField',\n title: 'Autocomplete field',\n type: ComponentType.AutocompleteField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'RadiosField',\n title: 'Radios field',\n type: ComponentType.RadiosField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'CheckboxesField',\n title: 'Checkboxes field',\n type: ComponentType.CheckboxesField,\n hint: '',\n list: '',\n options: {}\n },\n {\n name: 'NumberField',\n title: 'Number field',\n type: ComponentType.NumberField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'UkAddressField',\n title: 'UK address field',\n type: ComponentType.UkAddressField,\n hint: '',\n options: {}\n },\n {\n name: 'TelephoneNumberField',\n title: 'Telephone number field',\n type: ComponentType.TelephoneNumberField,\n hint: '',\n options: {}\n },\n {\n name: 'EmailAddressField',\n title: 'Email address field',\n type: ComponentType.EmailAddressField,\n hint: 'For example, ‘name@example.com’',\n options: {}\n },\n {\n name: 'FileUploadField',\n title: 'File upload field',\n type: ComponentType.FileUploadField,\n options: {},\n schema: {}\n },\n {\n name: 'Html',\n title: 'Html',\n type: ComponentType.Html,\n content: '',\n options: {}\n },\n {\n name: 'InsetText',\n title: 'Inset text',\n type: ComponentType.InsetText,\n content: ''\n },\n {\n name: 'Markdown',\n title: 'Markdown',\n type: ComponentType.Markdown,\n content: '',\n options: {}\n },\n {\n name: 'Details',\n title: 'Details',\n type: ComponentType.Details,\n content: '',\n options: {}\n },\n {\n name: 'List',\n title: 'List',\n type: ComponentType.List,\n list: '',\n options: {}\n },\n {\n name: 'DeclarationField',\n title: 'Declaration',\n type: ComponentType.DeclarationField,\n hint: '',\n content: '',\n options: {}\n },\n {\n name: 'EastingNorthingField',\n title: 'Easting and northing',\n type: ComponentType.EastingNorthingField,\n hint: 'For example, Easting: 248741, Northing: 63688',\n options: {}\n },\n {\n name: 'OsGridRefField',\n title: 'Ordnance Survey (OS) grid reference',\n type: ComponentType.OsGridRefField,\n hint: 'An OS grid reference number is made up of 2 letters followed by 6 numbers, for example, TQ123456',\n options: {}\n },\n {\n name: 'NationalGridFieldNumberField',\n title: 'National Grid field number',\n type: ComponentType.NationalGridFieldNumberField,\n hint: 'A National Grid field number is made up of 2 letters and 8 numbers, for example, SO04188589',\n options: {}\n },\n {\n name: 'LatLongField',\n title: 'Latitude and longitude',\n type: ComponentType.LatLongField,\n hint: 'For Great Britain, the latitude will be a number between 49.850 and 60.859. The longitude will be a number between -13.687 and 1.767',\n options: {}\n },\n {\n name: 'HiddenField',\n title: 'Hidden field',\n type: ComponentType.HiddenField,\n hint: '',\n options: {},\n schema: {}\n }\n])\n"],"mappings":"AAAA,SAASA,aAAa;AAGtB;AACA;AACA;AACA,OAAO,MAAMC,cAAuC,GAAGC,MAAM,CAACC,MAAM,CAAC,CACnE;EACEC,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEN,aAAa,CAACO,SAAS;EAC7BC,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,oBAAoB;EAC1BC,KAAK,EAAE,sBAAsB;EAC7BC,IAAI,EAAEN,aAAa,CAACW,kBAAkB;EACtCH,IAAI,EAAE,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EAC5IC,OAAO,EAAE,CAAC;AACZ,CAAC,EACD;EACEL,IAAI,EAAE,aAAa;EACnBC,KAAK,EAAE,cAAc;EACrBC,IAAI,EAAEN,aAAa,CAACoC,WAAW;EAC/B5B,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,CACF,CAAC","ignoreList":[]}
|
|
@@ -23,6 +23,7 @@ export let ComponentType = /*#__PURE__*/function (ComponentType) {
|
|
|
23
23
|
ComponentType["OsGridRefField"] = "OsGridRefField";
|
|
24
24
|
ComponentType["NationalGridFieldNumberField"] = "NationalGridFieldNumberField";
|
|
25
25
|
ComponentType["LatLongField"] = "LatLongField";
|
|
26
|
+
ComponentType["HiddenField"] = "HiddenField";
|
|
26
27
|
return ComponentType;
|
|
27
28
|
}({});
|
|
28
29
|
//# sourceMappingURL=enums.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","names":["ComponentType"],"sources":["../../../src/components/enums.ts"],"sourcesContent":["export enum ComponentType {\n TextField = 'TextField',\n MultilineTextField = 'MultilineTextField',\n YesNoField = 'YesNoField',\n DatePartsField = 'DatePartsField',\n MonthYearField = 'MonthYearField',\n SelectField = 'SelectField',\n AutocompleteField = 'AutocompleteField',\n RadiosField = 'RadiosField',\n CheckboxesField = 'CheckboxesField',\n NumberField = 'NumberField',\n UkAddressField = 'UkAddressField',\n TelephoneNumberField = 'TelephoneNumberField',\n EmailAddressField = 'EmailAddressField',\n Html = 'Html',\n InsetText = 'InsetText',\n Details = 'Details',\n List = 'List',\n Markdown = 'Markdown',\n FileUploadField = 'FileUploadField',\n DeclarationField = 'DeclarationField',\n EastingNorthingField = 'EastingNorthingField',\n OsGridRefField = 'OsGridRefField',\n NationalGridFieldNumberField = 'NationalGridFieldNumberField',\n LatLongField = 'LatLongField'\n}\n"],"mappings":"AAAA,WAAYA,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"enums.js","names":["ComponentType"],"sources":["../../../src/components/enums.ts"],"sourcesContent":["export enum ComponentType {\n TextField = 'TextField',\n MultilineTextField = 'MultilineTextField',\n YesNoField = 'YesNoField',\n DatePartsField = 'DatePartsField',\n MonthYearField = 'MonthYearField',\n SelectField = 'SelectField',\n AutocompleteField = 'AutocompleteField',\n RadiosField = 'RadiosField',\n CheckboxesField = 'CheckboxesField',\n NumberField = 'NumberField',\n UkAddressField = 'UkAddressField',\n TelephoneNumberField = 'TelephoneNumberField',\n EmailAddressField = 'EmailAddressField',\n Html = 'Html',\n InsetText = 'InsetText',\n Details = 'Details',\n List = 'List',\n Markdown = 'Markdown',\n FileUploadField = 'FileUploadField',\n DeclarationField = 'DeclarationField',\n EastingNorthingField = 'EastingNorthingField',\n OsGridRefField = 'OsGridRefField',\n NationalGridFieldNumberField = 'NationalGridFieldNumberField',\n LatLongField = 'LatLongField',\n HiddenField = 'HiddenField'\n}\n"],"mappings":"AAAA,WAAYA,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/components/types.ts"],"sourcesContent":["import { type LanguageMessages } from 'joi'\n\nimport { type ComponentType } from '~/src/components/enums.js'\nimport {\n type ListTypeContent,\n type ListTypeOption\n} from '~/src/form/form-definition/types.js'\n\nexport type ConditionalComponentType = Exclude<\n ConditionalComponentsDef['type'],\n ContentComponentsDef\n>\n\n/**\n * Types for Components JSON structure which are expected by engine and turned into actual form input/content/lists\n */\n\ninterface FormFieldBase {\n id?: string\n type: FormComponentsDef['type']\n shortDescription?: string\n name: string\n title: string\n hint?: string\n options: {\n required?: boolean\n optionalText?: boolean\n classes?: string\n customValidationMessages?: LanguageMessages\n instructionText?: string\n }\n}\n\ninterface ListFieldBase extends FormFieldBase {\n type:\n | ComponentType.AutocompleteField\n | ComponentType.CheckboxesField\n | ComponentType.RadiosField\n | ComponentType.SelectField\n list: string\n options: FormFieldBase['options'] & {\n type?: ListTypeContent\n }\n}\n\ninterface ContentFieldBase {\n id?: string\n type:\n | ComponentType.Details\n | ComponentType.Html\n | ComponentType.Markdown\n | ComponentType.InsetText\n | ComponentType.List\n name: string\n title: string\n options?: {\n required?: undefined\n optionalText?: undefined\n }\n}\n\ninterface DateFieldBase extends FormFieldBase {\n type: ComponentType.DatePartsField | ComponentType.MonthYearField\n name: string\n title: string\n hint?: string\n options: FormFieldBase['options'] & {\n maxDaysInPast?: number\n maxDaysInFuture?: number\n }\n}\n\n// Text Fields\nexport interface TextFieldComponent extends FormFieldBase {\n type: ComponentType.TextField\n options: FormFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n }\n schema: {\n max?: number\n min?: number\n length?: number\n regex?: string\n }\n}\n\nexport interface EmailAddressFieldComponent extends FormFieldBase {\n type: ComponentType.EmailAddressField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface NumberFieldComponent extends FormFieldBase {\n type: ComponentType.NumberField\n options: FormFieldBase['options'] & {\n prefix?: string\n suffix?: string\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n }\n schema: {\n max?: number\n min?: number\n precision?: number\n minPrecision?: number\n minLength?: number\n maxLength?: number\n }\n}\n\nexport interface TelephoneNumberFieldComponent extends FormFieldBase {\n type: ComponentType.TelephoneNumberField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface FileUploadFieldComponent extends FormFieldBase {\n type: ComponentType.FileUploadField\n name: string\n title: string\n hint?: string\n options: FormFieldBase['options'] & {\n accept?: string\n }\n schema: {\n max?: number\n min?: number\n length?: number\n }\n}\n\nexport interface YesNoFieldComponent extends FormFieldBase {\n type: ComponentType.YesNoField\n options: FormFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface DeclarationFieldComponent extends FormFieldBase {\n type: ComponentType.DeclarationField\n content: string\n options: FormFieldBase['options'] & {\n condition?: string\n declarationConfirmationLabel?: string\n }\n}\n\nexport interface MultilineTextFieldComponent extends FormFieldBase {\n type: ComponentType.MultilineTextField\n options: FormFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n rows?: number\n maxWords?: number\n }\n schema: {\n max?: number\n min?: number\n length?: number\n regex?: string\n }\n}\n\nexport interface UkAddressFieldComponent extends FormFieldBase {\n type: ComponentType.UkAddressField\n options: FormFieldBase['options'] & {\n hideTitle?: boolean\n usePostcodeLookup?: boolean\n }\n}\n\n// Precise Location Fields\nexport interface EastingNorthingFieldComponent extends FormFieldBase {\n type: ComponentType.EastingNorthingField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n schema?: {\n easting?: {\n min?: number\n max?: number\n }\n northing?: {\n min?: number\n max?: number\n }\n }\n}\n\nexport interface OsGridRefFieldComponent extends FormFieldBase {\n type: ComponentType.OsGridRefField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface NationalGridFieldNumberFieldComponent extends FormFieldBase {\n type: ComponentType.NationalGridFieldNumberField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface LatLongFieldComponent extends FormFieldBase {\n type: ComponentType.LatLongField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n schema?: {\n latitude?: {\n min?: number\n max?: number\n }\n longitude?: {\n min?: number\n max?: number\n }\n }\n}\n\n// Date Fields\nexport interface DatePartsFieldComponent extends DateFieldBase {\n type: ComponentType.DatePartsField\n options: DateFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MonthYearFieldComponent extends DateFieldBase {\n type: ComponentType.MonthYearField\n options: DateFieldBase['options'] & {\n customValidationMessage?: string\n }\n}\n\n// Content Fields\nexport interface DetailsComponent extends ContentFieldBase {\n type: ComponentType.Details\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface HtmlComponent extends ContentFieldBase {\n type: ComponentType.Html\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MarkdownComponent extends ContentFieldBase {\n type: ComponentType.Markdown\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface InsetTextComponent extends ContentFieldBase {\n type: ComponentType.InsetText\n content: string\n}\n\nexport interface ListComponent extends ContentFieldBase {\n type: ComponentType.List\n hint?: string\n list: string\n options: ContentFieldBase['options'] & {\n type?: ListTypeOption\n classes?: string\n hideTitle?: boolean\n bold?: boolean\n }\n}\n\nexport interface AutocompleteFieldComponent extends ListFieldBase {\n type: ComponentType.AutocompleteField\n options: ListFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface CheckboxesFieldComponent extends ListFieldBase {\n type: ComponentType.CheckboxesField\n options: ListFieldBase['options'] & {\n bold?: boolean\n condition?: string\n }\n}\n\nexport interface RadiosFieldComponent extends ListFieldBase {\n type: ComponentType.RadiosField\n options: ListFieldBase['options'] & {\n bold?: boolean\n condition?: string\n }\n}\n\nexport interface SelectFieldComponent extends ListFieldBase {\n type: ComponentType.SelectField\n options: ListFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n }\n}\n\nexport type ComponentDef = FormComponentsDef | ContentComponentsDef\n\n// Components that render form fields\nexport type FormComponentsDef =\n | InputFieldsComponentsDef\n | SelectionComponentsDef\n\n// Components that render inputs\nexport type InputFieldsComponentsDef =\n | TextFieldComponent\n | EmailAddressFieldComponent\n | NumberFieldComponent\n | MultilineTextFieldComponent\n | TelephoneNumberFieldComponent\n | MonthYearFieldComponent\n | DatePartsFieldComponent\n | UkAddressFieldComponent\n | FileUploadFieldComponent\n | DeclarationFieldComponent\n | EastingNorthingFieldComponent\n | OsGridRefFieldComponent\n | NationalGridFieldNumberFieldComponent\n | LatLongFieldComponent\n\n// Components that render content\nexport type ContentComponentsDef =\n | DetailsComponent\n | HtmlComponent\n | MarkdownComponent\n | InsetTextComponent\n | ListComponent\n\n// Components that render lists\nexport type ListComponentsDef =\n | Exclude<SelectionComponentsDef, YesNoFieldComponent>\n | ListComponent\n\n// Components that have selection fields\nexport type SelectionComponentsDef =\n | AutocompleteFieldComponent\n | CheckboxesFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n | YesNoFieldComponent\n\n// Components that have condition support\nexport type ConditionalComponentsDef = Exclude<\n ComponentDef,\n | InsetTextComponent\n | ListComponent\n | MonthYearFieldComponent\n | UkAddressFieldComponent\n | FileUploadFieldComponent\n>\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/components/types.ts"],"sourcesContent":["import { type LanguageMessages } from 'joi'\n\nimport { type ComponentType } from '~/src/components/enums.js'\nimport {\n type ListTypeContent,\n type ListTypeOption\n} from '~/src/form/form-definition/types.js'\n\nexport type ConditionalComponentType = Exclude<\n ConditionalComponentsDef['type'],\n ContentComponentsDef\n>\n\n/**\n * Types for Components JSON structure which are expected by engine and turned into actual form input/content/lists\n */\n\ninterface FormFieldBase {\n id?: string\n type: FormComponentsDef['type']\n shortDescription?: string\n name: string\n title: string\n hint?: string\n options: {\n required?: boolean\n optionalText?: boolean\n classes?: string\n customValidationMessages?: LanguageMessages\n instructionText?: string\n }\n}\n\ninterface ListFieldBase extends FormFieldBase {\n type:\n | ComponentType.AutocompleteField\n | ComponentType.CheckboxesField\n | ComponentType.RadiosField\n | ComponentType.SelectField\n list: string\n options: FormFieldBase['options'] & {\n type?: ListTypeContent\n }\n}\n\ninterface ContentFieldBase {\n id?: string\n type:\n | ComponentType.Details\n | ComponentType.Html\n | ComponentType.Markdown\n | ComponentType.InsetText\n | ComponentType.List\n name: string\n title: string\n options?: {\n required?: undefined\n optionalText?: undefined\n }\n}\n\ninterface DateFieldBase extends FormFieldBase {\n type: ComponentType.DatePartsField | ComponentType.MonthYearField\n name: string\n title: string\n hint?: string\n options: FormFieldBase['options'] & {\n maxDaysInPast?: number\n maxDaysInFuture?: number\n }\n}\n\n// Text Fields\nexport interface TextFieldComponent extends FormFieldBase {\n type: ComponentType.TextField\n options: FormFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n }\n schema: {\n max?: number\n min?: number\n length?: number\n regex?: string\n }\n}\n\nexport interface EmailAddressFieldComponent extends FormFieldBase {\n type: ComponentType.EmailAddressField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface NumberFieldComponent extends FormFieldBase {\n type: ComponentType.NumberField\n options: FormFieldBase['options'] & {\n prefix?: string\n suffix?: string\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n }\n schema: {\n max?: number\n min?: number\n precision?: number\n minPrecision?: number\n minLength?: number\n maxLength?: number\n }\n}\n\nexport interface TelephoneNumberFieldComponent extends FormFieldBase {\n type: ComponentType.TelephoneNumberField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface FileUploadFieldComponent extends FormFieldBase {\n type: ComponentType.FileUploadField\n name: string\n title: string\n hint?: string\n options: FormFieldBase['options'] & {\n accept?: string\n }\n schema: {\n max?: number\n min?: number\n length?: number\n }\n}\n\nexport interface YesNoFieldComponent extends FormFieldBase {\n type: ComponentType.YesNoField\n options: FormFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface DeclarationFieldComponent extends FormFieldBase {\n type: ComponentType.DeclarationField\n content: string\n options: FormFieldBase['options'] & {\n condition?: string\n declarationConfirmationLabel?: string\n }\n}\n\nexport interface MultilineTextFieldComponent extends FormFieldBase {\n type: ComponentType.MultilineTextField\n options: FormFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n rows?: number\n maxWords?: number\n }\n schema: {\n max?: number\n min?: number\n length?: number\n regex?: string\n }\n}\n\nexport interface UkAddressFieldComponent extends FormFieldBase {\n type: ComponentType.UkAddressField\n options: FormFieldBase['options'] & {\n hideTitle?: boolean\n usePostcodeLookup?: boolean\n }\n}\n\n// Precise Location Fields\nexport interface EastingNorthingFieldComponent extends FormFieldBase {\n type: ComponentType.EastingNorthingField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n schema?: {\n easting?: {\n min?: number\n max?: number\n }\n northing?: {\n min?: number\n max?: number\n }\n }\n}\n\nexport interface OsGridRefFieldComponent extends FormFieldBase {\n type: ComponentType.OsGridRefField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface NationalGridFieldNumberFieldComponent extends FormFieldBase {\n type: ComponentType.NationalGridFieldNumberField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface LatLongFieldComponent extends FormFieldBase {\n type: ComponentType.LatLongField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n schema?: {\n latitude?: {\n min?: number\n max?: number\n }\n longitude?: {\n min?: number\n max?: number\n }\n }\n}\n\nexport interface HiddenFieldComponent extends FormFieldBase {\n type: ComponentType.HiddenField\n options: FormFieldBase['options'] & {\n condition?: string\n }\n}\n\n// Date Fields\nexport interface DatePartsFieldComponent extends DateFieldBase {\n type: ComponentType.DatePartsField\n options: DateFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MonthYearFieldComponent extends DateFieldBase {\n type: ComponentType.MonthYearField\n options: DateFieldBase['options'] & {\n customValidationMessage?: string\n }\n}\n\n// Content Fields\nexport interface DetailsComponent extends ContentFieldBase {\n type: ComponentType.Details\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface HtmlComponent extends ContentFieldBase {\n type: ComponentType.Html\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MarkdownComponent extends ContentFieldBase {\n type: ComponentType.Markdown\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface InsetTextComponent extends ContentFieldBase {\n type: ComponentType.InsetText\n content: string\n}\n\nexport interface ListComponent extends ContentFieldBase {\n type: ComponentType.List\n hint?: string\n list: string\n options: ContentFieldBase['options'] & {\n type?: ListTypeOption\n classes?: string\n hideTitle?: boolean\n bold?: boolean\n }\n}\n\nexport interface AutocompleteFieldComponent extends ListFieldBase {\n type: ComponentType.AutocompleteField\n options: ListFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface CheckboxesFieldComponent extends ListFieldBase {\n type: ComponentType.CheckboxesField\n options: ListFieldBase['options'] & {\n bold?: boolean\n condition?: string\n }\n}\n\nexport interface RadiosFieldComponent extends ListFieldBase {\n type: ComponentType.RadiosField\n options: ListFieldBase['options'] & {\n bold?: boolean\n condition?: string\n }\n}\n\nexport interface SelectFieldComponent extends ListFieldBase {\n type: ComponentType.SelectField\n options: ListFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n }\n}\n\nexport type ComponentDef = FormComponentsDef | ContentComponentsDef\n\n// Components that render form fields\nexport type FormComponentsDef =\n | InputFieldsComponentsDef\n | SelectionComponentsDef\n\n// Components that render inputs\nexport type InputFieldsComponentsDef =\n | TextFieldComponent\n | EmailAddressFieldComponent\n | NumberFieldComponent\n | MultilineTextFieldComponent\n | TelephoneNumberFieldComponent\n | MonthYearFieldComponent\n | DatePartsFieldComponent\n | UkAddressFieldComponent\n | FileUploadFieldComponent\n | DeclarationFieldComponent\n | EastingNorthingFieldComponent\n | OsGridRefFieldComponent\n | NationalGridFieldNumberFieldComponent\n | LatLongFieldComponent\n | HiddenFieldComponent\n\n// Components that render content\nexport type ContentComponentsDef =\n | DetailsComponent\n | HtmlComponent\n | MarkdownComponent\n | InsetTextComponent\n | ListComponent\n\n// Components that render lists\nexport type ListComponentsDef =\n | Exclude<SelectionComponentsDef, YesNoFieldComponent>\n | ListComponent\n\n// Components that have selection fields\nexport type SelectionComponentsDef =\n | AutocompleteFieldComponent\n | CheckboxesFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n | YesNoFieldComponent\n\n// Components that have condition support\nexport type ConditionalComponentsDef = Exclude<\n ComponentDef,\n | InsetTextComponent\n | ListComponent\n | MonthYearFieldComponent\n | UkAddressFieldComponent\n | FileUploadFieldComponent\n>\n"],"mappings":"","ignoreList":[]}
|
|
@@ -59,7 +59,8 @@ export const customOperators = {
|
|
|
59
59
|
[ComponentType.EastingNorthingField]: defaultOperators,
|
|
60
60
|
[ComponentType.OsGridRefField]: defaultOperators,
|
|
61
61
|
[ComponentType.NationalGridFieldNumberField]: defaultOperators,
|
|
62
|
-
[ComponentType.LatLongField]: defaultOperators
|
|
62
|
+
[ComponentType.LatLongField]: defaultOperators,
|
|
63
|
+
[ComponentType.HiddenField]: undefined
|
|
63
64
|
};
|
|
64
65
|
export function getOperatorNames(fieldType) {
|
|
65
66
|
const conditionals = getConditionals(fieldType);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition-operators.js","names":["ComponentType","isConditionalType","isContentType","ConditionValue","RelativeDateValue","ConditionType","DateDirections","Operator","OperatorName","defaultOperators","Is","inline","IsNot","withDefaults","operators","textFieldOperators","IsLongerThan","lengthIs","IsMoreThan","IsShorterThan","IsLessThan","HasLength","absoluteDateOperators","absoluteDate","IsBefore","IsAfter","relativeDateOperators","IsAtLeast","relativeDate","IsAtMost","customOperators","AutocompleteField","RadiosField","CheckboxesField","Contains","reverseInline","DoesNotContain","not","NumberField","DatePartsField","TextField","MultilineTextField","EmailAddressField","TelephoneNumberField","SelectField","YesNoField","DeclarationField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","getOperatorNames","fieldType","conditionals","getConditionals","Object","keys","getExpression","fieldName","operator","value","expression","type","name","field","formatValue","operatorDefinition","RelativeDate","toValue","replace","absoluteDateOperatorNames","relativeDateOperatorNames","Error","pastOperator","futureOperator","isPast","direction","PAST"],"sources":["../../../src/conditions/condition-operators.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { isConditionalType, isContentType } from '~/src/components/helpers.js'\nimport {\n type ComponentDef,\n type ConditionalComponentType\n} from '~/src/components/types.js'\nimport {\n ConditionValue,\n RelativeDateValue\n} from '~/src/conditions/condition-values.js'\nimport { type Condition } from '~/src/conditions/condition.js'\nimport {\n ConditionType,\n DateDirections,\n Operator,\n OperatorName\n} from '~/src/conditions/enums.js'\nimport {\n type Conditionals,\n type OperatorDefinition\n} from '~/src/conditions/types.js'\n\nconst defaultOperators = {\n [OperatorName.Is]: inline(Operator.Is),\n [OperatorName.IsNot]: inline(Operator.IsNot)\n}\n\nfunction withDefaults<T>(operators: T) {\n return { ...defaultOperators, ...operators }\n}\n\nconst textFieldOperators = {\n [OperatorName.IsLongerThan]: lengthIs(Operator.IsMoreThan),\n [OperatorName.IsShorterThan]: lengthIs(Operator.IsLessThan),\n [OperatorName.HasLength]: lengthIs(Operator.Is)\n}\n\nconst absoluteDateOperators = {\n [OperatorName.Is]: absoluteDate(Operator.Is),\n [OperatorName.IsNot]: absoluteDate(Operator.IsNot),\n [OperatorName.IsBefore]: absoluteDate(Operator.IsLessThan),\n [OperatorName.IsAfter]: absoluteDate(Operator.IsMoreThan)\n}\n\nconst relativeDateOperators = {\n [OperatorName.IsAtLeast]: relativeDate(Operator.IsAtMost, Operator.IsAtLeast),\n [OperatorName.IsAtMost]: relativeDate(Operator.IsAtLeast, Operator.IsAtMost),\n [OperatorName.IsLessThan]: relativeDate(\n Operator.IsMoreThan,\n Operator.IsLessThan\n ),\n [OperatorName.IsMoreThan]: relativeDate(\n Operator.IsLessThan,\n Operator.IsMoreThan\n )\n}\n\nexport const customOperators = {\n [ComponentType.AutocompleteField]: defaultOperators,\n [ComponentType.RadiosField]: defaultOperators,\n [ComponentType.CheckboxesField]: {\n [OperatorName.Contains]: reverseInline(Operator.Contains),\n [OperatorName.DoesNotContain]: not(reverseInline(Operator.Contains))\n },\n [ComponentType.NumberField]: withDefaults({\n [OperatorName.IsAtLeast]: inline(Operator.IsAtLeast),\n [OperatorName.IsAtMost]: inline(Operator.IsAtMost),\n [OperatorName.IsLessThan]: inline(Operator.IsLessThan),\n [OperatorName.IsMoreThan]: inline(Operator.IsMoreThan)\n }),\n [ComponentType.DatePartsField]: {\n ...absoluteDateOperators,\n ...relativeDateOperators\n },\n [ComponentType.TextField]: withDefaults(textFieldOperators),\n [ComponentType.MultilineTextField]: {\n [OperatorName.IsLongerThan]: lengthIs(Operator.IsMoreThan),\n [OperatorName.IsShorterThan]: lengthIs(Operator.IsLessThan)\n },\n [ComponentType.EmailAddressField]: withDefaults(textFieldOperators),\n [ComponentType.TelephoneNumberField]: defaultOperators,\n [ComponentType.SelectField]: defaultOperators,\n [ComponentType.YesNoField]: defaultOperators,\n [ComponentType.DeclarationField]: defaultOperators,\n [ComponentType.EastingNorthingField]: defaultOperators,\n [ComponentType.OsGridRefField]: defaultOperators,\n [ComponentType.NationalGridFieldNumberField]: defaultOperators,\n [ComponentType.LatLongField]: defaultOperators\n}\n\nexport function getOperatorNames(fieldType?: ConditionalComponentType) {\n const conditionals = getConditionals(fieldType)\n if (!conditionals) {\n return []\n }\n\n return Object.keys(conditionals) as OperatorName[]\n}\n\nexport function getExpression(\n fieldType: ConditionalComponentType,\n fieldName: string,\n operator: OperatorName,\n value: Condition['value']\n) {\n const conditionals = getConditionals(fieldType)\n if (!conditionals) {\n return\n }\n\n return conditionals[operator]?.expression(\n { type: fieldType, name: fieldName },\n value\n )\n}\n\nfunction getConditionals(\n fieldType?: ConditionalComponentType\n): Partial<Conditionals> | undefined {\n if (!fieldType || !isConditionalType(fieldType) || isContentType(fieldType)) {\n return\n }\n\n return fieldType in customOperators\n ? customOperators[fieldType]\n : defaultOperators\n}\n\nfunction inline(operator: Operator): OperatorDefinition {\n return {\n expression(field, value) {\n return `${field.name} ${operator} ${formatValue(field, value)}`\n }\n }\n}\n\nfunction lengthIs(operator: Operator): OperatorDefinition {\n return {\n expression(field, value) {\n return `length(${field.name}) ${operator} ${formatValue(field, value)}`\n }\n }\n}\n\nfunction reverseInline(operator: Operator.Contains): OperatorDefinition {\n return {\n expression(field, value) {\n return `${formatValue(field, value)} ${operator} ${field.name}`\n }\n }\n}\n\nfunction not(operatorDefinition: OperatorDefinition): OperatorDefinition {\n return {\n expression(field, value) {\n return `not (${operatorDefinition.expression(field, value)})`\n }\n }\n}\n\nfunction formatValue(\n field: Pick<ComponentDef, 'type'>,\n value: Condition['value']\n) {\n if (\n (field.type === ComponentType.DatePartsField &&\n value.type === ConditionType.RelativeDate) ||\n field.type === ComponentType.NumberField ||\n field.type === ComponentType.YesNoField ||\n field.type === ComponentType.DeclarationField\n ) {\n return value.toValue()\n }\n\n return `'${value.toValue().replace(/'/g, \"\\\\'\")}'`\n}\n\nexport const absoluteDateOperatorNames = Object.keys(\n absoluteDateOperators\n) as OperatorName[]\n\nexport const relativeDateOperatorNames = Object.keys(\n relativeDateOperators\n) as OperatorName[]\n\nfunction absoluteDate(operator: Operator): OperatorDefinition {\n return {\n expression(field, value) {\n if (!(value instanceof ConditionValue)) {\n throw new Error(\n \"Expression param 'value' must be ConditionValue instance\"\n )\n }\n\n return `${field.name} ${operator} ${formatValue(field, value)}`\n }\n }\n}\n\nfunction relativeDate(\n pastOperator: Operator,\n futureOperator: Operator\n): OperatorDefinition {\n return {\n expression(field, value) {\n if (!(value instanceof RelativeDateValue)) {\n throw new Error(\n \"Expression param 'value' must be RelativeDateValue instance\"\n )\n }\n\n const isPast = value.direction === DateDirections.PAST\n return `${field.name} ${isPast ? pastOperator : futureOperator} ${formatValue(field, value)}`\n }\n }\n}\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,iBAAiB,EAAEC,aAAa;AAKzC,SACEC,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,YAAY,CAACgB,QAA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;MACvB,IAAI,EAAEA,KAAK,YAAYxD,iBAAiB,CAAC,EAAE;QACzC,MAAM,IAAIoE,KAAK,CACb,6DACF,CAAC;MACH;MAEA,MAAMG,MAAM,GAAGf,KAAK,CAACgB,SAAS,KAAKtE,cAAc,CAACuE,IAAI;MACtD,OAAO,GAAGb,KAAK,CAACD,IAAI,IAAIY,MAAM,GAAGF,YAAY,GAAGC,cAAc,IAAIT,WAAW,CAACD,KAAK,EAAEJ,KAAK,CAAC,EAAE;IAC/F;EACF,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"condition-operators.js","names":["ComponentType","isConditionalType","isContentType","ConditionValue","RelativeDateValue","ConditionType","DateDirections","Operator","OperatorName","defaultOperators","Is","inline","IsNot","withDefaults","operators","textFieldOperators","IsLongerThan","lengthIs","IsMoreThan","IsShorterThan","IsLessThan","HasLength","absoluteDateOperators","absoluteDate","IsBefore","IsAfter","relativeDateOperators","IsAtLeast","relativeDate","IsAtMost","customOperators","AutocompleteField","RadiosField","CheckboxesField","Contains","reverseInline","DoesNotContain","not","NumberField","DatePartsField","TextField","MultilineTextField","EmailAddressField","TelephoneNumberField","SelectField","YesNoField","DeclarationField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","HiddenField","undefined","getOperatorNames","fieldType","conditionals","getConditionals","Object","keys","getExpression","fieldName","operator","value","expression","type","name","field","formatValue","operatorDefinition","RelativeDate","toValue","replace","absoluteDateOperatorNames","relativeDateOperatorNames","Error","pastOperator","futureOperator","isPast","direction","PAST"],"sources":["../../../src/conditions/condition-operators.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { isConditionalType, isContentType } from '~/src/components/helpers.js'\nimport {\n type ComponentDef,\n type ConditionalComponentType\n} from '~/src/components/types.js'\nimport {\n ConditionValue,\n RelativeDateValue\n} from '~/src/conditions/condition-values.js'\nimport { type Condition } from '~/src/conditions/condition.js'\nimport {\n ConditionType,\n DateDirections,\n Operator,\n OperatorName\n} from '~/src/conditions/enums.js'\nimport {\n type Conditionals,\n type OperatorDefinition\n} from '~/src/conditions/types.js'\n\nconst defaultOperators = {\n [OperatorName.Is]: inline(Operator.Is),\n [OperatorName.IsNot]: inline(Operator.IsNot)\n}\n\nfunction withDefaults<T>(operators: T) {\n return { ...defaultOperators, ...operators }\n}\n\nconst textFieldOperators = {\n [OperatorName.IsLongerThan]: lengthIs(Operator.IsMoreThan),\n [OperatorName.IsShorterThan]: lengthIs(Operator.IsLessThan),\n [OperatorName.HasLength]: lengthIs(Operator.Is)\n}\n\nconst absoluteDateOperators = {\n [OperatorName.Is]: absoluteDate(Operator.Is),\n [OperatorName.IsNot]: absoluteDate(Operator.IsNot),\n [OperatorName.IsBefore]: absoluteDate(Operator.IsLessThan),\n [OperatorName.IsAfter]: absoluteDate(Operator.IsMoreThan)\n}\n\nconst relativeDateOperators = {\n [OperatorName.IsAtLeast]: relativeDate(Operator.IsAtMost, Operator.IsAtLeast),\n [OperatorName.IsAtMost]: relativeDate(Operator.IsAtLeast, Operator.IsAtMost),\n [OperatorName.IsLessThan]: relativeDate(\n Operator.IsMoreThan,\n Operator.IsLessThan\n ),\n [OperatorName.IsMoreThan]: relativeDate(\n Operator.IsLessThan,\n Operator.IsMoreThan\n )\n}\n\nexport const customOperators = {\n [ComponentType.AutocompleteField]: defaultOperators,\n [ComponentType.RadiosField]: defaultOperators,\n [ComponentType.CheckboxesField]: {\n [OperatorName.Contains]: reverseInline(Operator.Contains),\n [OperatorName.DoesNotContain]: not(reverseInline(Operator.Contains))\n },\n [ComponentType.NumberField]: withDefaults({\n [OperatorName.IsAtLeast]: inline(Operator.IsAtLeast),\n [OperatorName.IsAtMost]: inline(Operator.IsAtMost),\n [OperatorName.IsLessThan]: inline(Operator.IsLessThan),\n [OperatorName.IsMoreThan]: inline(Operator.IsMoreThan)\n }),\n [ComponentType.DatePartsField]: {\n ...absoluteDateOperators,\n ...relativeDateOperators\n },\n [ComponentType.TextField]: withDefaults(textFieldOperators),\n [ComponentType.MultilineTextField]: {\n [OperatorName.IsLongerThan]: lengthIs(Operator.IsMoreThan),\n [OperatorName.IsShorterThan]: lengthIs(Operator.IsLessThan)\n },\n [ComponentType.EmailAddressField]: withDefaults(textFieldOperators),\n [ComponentType.TelephoneNumberField]: defaultOperators,\n [ComponentType.SelectField]: defaultOperators,\n [ComponentType.YesNoField]: defaultOperators,\n [ComponentType.DeclarationField]: defaultOperators,\n [ComponentType.EastingNorthingField]: defaultOperators,\n [ComponentType.OsGridRefField]: defaultOperators,\n [ComponentType.NationalGridFieldNumberField]: defaultOperators,\n [ComponentType.LatLongField]: defaultOperators,\n [ComponentType.HiddenField]: undefined\n}\n\nexport function getOperatorNames(fieldType?: ConditionalComponentType) {\n const conditionals = getConditionals(fieldType)\n if (!conditionals) {\n return []\n }\n\n return Object.keys(conditionals) as OperatorName[]\n}\n\nexport function getExpression(\n fieldType: ConditionalComponentType,\n fieldName: string,\n operator: OperatorName,\n value: Condition['value']\n) {\n const conditionals = getConditionals(fieldType)\n if (!conditionals) {\n return\n }\n\n return conditionals[operator]?.expression(\n { type: fieldType, name: fieldName },\n value\n )\n}\n\nfunction getConditionals(\n fieldType?: ConditionalComponentType\n): Partial<Conditionals> | undefined {\n if (!fieldType || !isConditionalType(fieldType) || isContentType(fieldType)) {\n return\n }\n\n return fieldType in customOperators\n ? customOperators[fieldType]\n : defaultOperators\n}\n\nfunction inline(operator: Operator): OperatorDefinition {\n return {\n expression(field, value) {\n return `${field.name} ${operator} ${formatValue(field, value)}`\n }\n }\n}\n\nfunction lengthIs(operator: Operator): OperatorDefinition {\n return {\n expression(field, value) {\n return `length(${field.name}) ${operator} ${formatValue(field, value)}`\n }\n }\n}\n\nfunction reverseInline(operator: Operator.Contains): OperatorDefinition {\n return {\n expression(field, value) {\n return `${formatValue(field, value)} ${operator} ${field.name}`\n }\n }\n}\n\nfunction not(operatorDefinition: OperatorDefinition): OperatorDefinition {\n return {\n expression(field, value) {\n return `not (${operatorDefinition.expression(field, value)})`\n }\n }\n}\n\nfunction formatValue(\n field: Pick<ComponentDef, 'type'>,\n value: Condition['value']\n) {\n if (\n (field.type === ComponentType.DatePartsField &&\n value.type === ConditionType.RelativeDate) ||\n field.type === ComponentType.NumberField ||\n field.type === ComponentType.YesNoField ||\n field.type === ComponentType.DeclarationField\n ) {\n return value.toValue()\n }\n\n return `'${value.toValue().replace(/'/g, \"\\\\'\")}'`\n}\n\nexport const absoluteDateOperatorNames = Object.keys(\n absoluteDateOperators\n) as OperatorName[]\n\nexport const relativeDateOperatorNames = Object.keys(\n relativeDateOperators\n) as OperatorName[]\n\nfunction absoluteDate(operator: Operator): OperatorDefinition {\n return {\n expression(field, value) {\n if (!(value instanceof ConditionValue)) {\n throw new Error(\n \"Expression param 'value' must be ConditionValue instance\"\n )\n }\n\n return `${field.name} ${operator} ${formatValue(field, value)}`\n }\n }\n}\n\nfunction relativeDate(\n pastOperator: Operator,\n futureOperator: Operator\n): OperatorDefinition {\n return {\n expression(field, value) {\n if (!(value instanceof RelativeDateValue)) {\n throw new Error(\n \"Expression param 'value' must be RelativeDateValue instance\"\n )\n }\n\n const isPast = value.direction === DateDirections.PAST\n return `${field.name} ${isPast ? pastOperator : futureOperator} ${formatValue(field, value)}`\n }\n }\n}\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,iBAAiB,EAAEC,aAAa;AAKzC,SACEC,cAAc,EACdC,iBAAiB;AAGnB,SACEC,aAAa,EACbC,cAAc,EACdC,QAAQ,EACRC,YAAY;AAOd,MAAMC,gBAAgB,GAAG;EACvB,CAACD,YAAY,CAACE,EAAE,GAAGC,MAAM,CAACJ,QAAQ,CAACG,EAAE,CAAC;EACtC,CAACF,YAAY,CAACI,KAAK,GAAGD,MAAM,CAACJ,QAAQ,CAACK,KAAK;AAC7C,CAAC;AAED,SAASC,YAAYA,CAAIC,SAAY,EAAE;EACrC,OAAO;IAAE,GAAGL,gBAAgB;IAAE,GAAGK;EAAU,CAAC;AAC9C;AAEA,MAA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AAEnB,OAAO,MAAMmD,yBAAyB,GAAGhB,MAAM,CAACC,IAAI,CAClDhC,qBACF,CAAmB;AAEnB,SAASH,YAAYA,CAACsC,QAAkB,EAAsB;EAC5D,OAAO;IACLE,UAAUA,CAACG,KAAK,EAAEJ,KAAK,EAAE;MACvB,IAAI,EAAEA,KAAK,YAAY3D,cAAc,CAAC,EAAE;QACtC,MAAM,IAAIuE,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,SAASlC,YAAYA,CACnB+C,YAAsB,EACtBC,cAAwB,EACJ;EACpB,OAAO;IACLb,UAAUA,CAACG,KAAK,EAAEJ,KAAK,EAAE;MACvB,IAAI,EAAEA,KAAK,YAAY1D,iBAAiB,CAAC,EAAE;QACzC,MAAM,IAAIsE,KAAK,CACb,6DACF,CAAC;MACH;MAEA,MAAMG,MAAM,GAAGf,KAAK,CAACgB,SAAS,KAAKxE,cAAc,CAACyE,IAAI;MACtD,OAAO,GAAGb,KAAK,CAACD,IAAI,IAAIY,MAAM,GAAGF,YAAY,GAAGC,cAAc,IAAIT,WAAW,CAACD,KAAK,EAAEJ,KAAK,CAAC,EAAE;IAC/F;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { ComponentType } from "../../components/enums.js";
|
|
2
|
+
import { hasComponents } from "../../pages/helpers.js";
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* TypeGuard to check if something is a FormDefinition
|
|
3
6
|
* @param { unknown } definition
|
|
@@ -21,4 +24,20 @@ export function isConditionListItemRefValueData(conditionValueData) {
|
|
|
21
24
|
}
|
|
22
25
|
return typeof conditionValueData === 'object' && 'listId' in conditionValueData && 'itemId' in conditionValueData;
|
|
23
26
|
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns an array of all hidden fields in a form
|
|
30
|
+
* @param definition - form definition
|
|
31
|
+
*/
|
|
32
|
+
export function getHiddenFields(definition) {
|
|
33
|
+
if (definition.pages.length === 0) {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
const totalHiddenFields = [];
|
|
37
|
+
for (const page of definition.pages) {
|
|
38
|
+
const hiddenFields = hasComponents(page) ? page.components.filter(comp => comp.type === ComponentType.HiddenField) : [];
|
|
39
|
+
totalHiddenFields.push(...hiddenFields);
|
|
40
|
+
}
|
|
41
|
+
return totalHiddenFields;
|
|
42
|
+
}
|
|
24
43
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["isFormDefinition","definition","isConditionListItemRefValueData","conditionValueData"],"sources":["../../../../src/form/form-definition/helpers.ts"],"sourcesContent":["import { type ConditionListItemRefValueDataV2 } from '~/src/conditions/types.js'\nimport { type FormDefinition } from '~/src/form/form-definition/types.js'\n\n/**\n * TypeGuard to check if something is a FormDefinition\n * @param { unknown } definition\n * @returns { definition is FormDefinition }\n */\nexport function isFormDefinition(\n definition: unknown\n): definition is FormDefinition {\n if (!definition) {\n return false\n }\n\n return (\n typeof definition === 'object' &&\n 'name' in definition &&\n 'pages' in definition &&\n 'conditions' in definition\n )\n}\n\n/**\n * TypeGuard to check if something is a ConditionListItemRefValueDataV2\n * @param { unknown } conditionValueData\n * @returns { definition is ConditionListItemRefValueDataV2 }\n */\nexport function isConditionListItemRefValueData(\n conditionValueData: unknown\n): conditionValueData is ConditionListItemRefValueDataV2 {\n if (!conditionValueData) {\n return false\n }\n\n return (\n typeof conditionValueData === 'object' &&\n 'listId' in conditionValueData &&\n 'itemId' in conditionValueData\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","names":["ComponentType","hasComponents","isFormDefinition","definition","isConditionListItemRefValueData","conditionValueData","getHiddenFields","pages","length","totalHiddenFields","page","hiddenFields","components","filter","comp","type","HiddenField","push"],"sources":["../../../../src/form/form-definition/helpers.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport { type ConditionListItemRefValueDataV2 } from '~/src/conditions/types.js'\nimport { type FormDefinition } from '~/src/form/form-definition/types.js'\nimport { hasComponents } from '~/src/pages/helpers.js'\n\n/**\n * TypeGuard to check if something is a FormDefinition\n * @param { unknown } definition\n * @returns { definition is FormDefinition }\n */\nexport function isFormDefinition(\n definition: unknown\n): definition is FormDefinition {\n if (!definition) {\n return false\n }\n\n return (\n typeof definition === 'object' &&\n 'name' in definition &&\n 'pages' in definition &&\n 'conditions' in definition\n )\n}\n\n/**\n * TypeGuard to check if something is a ConditionListItemRefValueDataV2\n * @param { unknown } conditionValueData\n * @returns { definition is ConditionListItemRefValueDataV2 }\n */\nexport function isConditionListItemRefValueData(\n conditionValueData: unknown\n): conditionValueData is ConditionListItemRefValueDataV2 {\n if (!conditionValueData) {\n return false\n }\n\n return (\n typeof conditionValueData === 'object' &&\n 'listId' in conditionValueData &&\n 'itemId' in conditionValueData\n )\n}\n\n/**\n * Returns an array of all hidden fields in a form\n * @param definition - form definition\n */\nexport function getHiddenFields(definition: FormDefinition) {\n if (definition.pages.length === 0) {\n return []\n }\n const totalHiddenFields = [] as ComponentDef[]\n for (const page of definition.pages) {\n const hiddenFields = hasComponents(page)\n ? page.components.filter(\n (comp) => comp.type === ComponentType.HiddenField\n )\n : []\n totalHiddenFields.push(...hiddenFields)\n }\n return totalHiddenFields\n}\n"],"mappings":"AAAA,SAASA,aAAa;AAItB,SAASC,aAAa;;AAEtB;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,UAAmB,EACW;EAC9B,IAAI,CAACA,UAAU,EAAE;IACf,OAAO,KAAK;EACd;EAEA,OACE,OAAOA,UAAU,KAAK,QAAQ,IAC9B,MAAM,IAAIA,UAAU,IACpB,OAAO,IAAIA,UAAU,IACrB,YAAY,IAAIA,UAAU;AAE9B;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,+BAA+BA,CAC7CC,kBAA2B,EAC4B;EACvD,IAAI,CAACA,kBAAkB,EAAE;IACvB,OAAO,KAAK;EACd;EAEA,OACE,OAAOA,kBAAkB,KAAK,QAAQ,IACtC,QAAQ,IAAIA,kBAAkB,IAC9B,QAAQ,IAAIA,kBAAkB;AAElC;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAACH,UAA0B,EAAE;EAC1D,IAAIA,UAAU,CAACI,KAAK,CAACC,MAAM,KAAK,CAAC,EAAE;IACjC,OAAO,EAAE;EACX;EACA,MAAMC,iBAAiB,GAAG,EAAoB;EAC9C,KAAK,MAAMC,IAAI,IAAIP,UAAU,CAACI,KAAK,EAAE;IACnC,MAAMI,YAAY,GAAGV,aAAa,CAACS,IAAI,CAAC,GACpCA,IAAI,CAACE,UAAU,CAACC,MAAM,CACnBC,IAAI,IAAKA,IAAI,CAACC,IAAI,KAAKf,aAAa,CAACgB,WACxC,CAAC,GACD,EAAE;IACNP,iBAAiB,CAACQ,IAAI,CAAC,GAAGN,YAAY,CAAC;EACzC;EACA,OAAOF,iBAAiB;AAC1B","ignoreList":[]}
|
|
@@ -8,6 +8,7 @@ import { DateInputQuestion } from "./date-input.js";
|
|
|
8
8
|
import { DeclarationComponentPreviewElements, DeclarationQuestion } from "./declaration.js";
|
|
9
9
|
import { EastingNorthingComponentPreviewElements, EastingNorthingQuestion } from "./easting-northing.js";
|
|
10
10
|
import { EmailAddressQuestion } from "./email-address.js";
|
|
11
|
+
import { HiddenQuestion } from "./hidden.js";
|
|
11
12
|
import { LatLongComponentPreviewElements, LatLongQuestion } from "./lat-long.js";
|
|
12
13
|
import { ListComponentElements, ListQuestion, SelectComponentElements } from "./list.js";
|
|
13
14
|
import { LongAnswerQuestion } from "./long-answer.js";
|
|
@@ -52,7 +53,8 @@ const InputFieldComponentDictionary = {
|
|
|
52
53
|
[ComponentType.EastingNorthingField]: EastingNorthingQuestion,
|
|
53
54
|
[ComponentType.OsGridRefField]: OsGridRefQuestion,
|
|
54
55
|
[ComponentType.NationalGridFieldNumberField]: NationalGridQuestion,
|
|
55
|
-
[ComponentType.LatLongField]: LatLongQuestion
|
|
56
|
+
[ComponentType.LatLongField]: LatLongQuestion,
|
|
57
|
+
[ComponentType.HiddenField]: HiddenQuestion
|
|
56
58
|
};
|
|
57
59
|
|
|
58
60
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["ComponentType","hasContentField","hasInputField","hasListField","hasSelectionFields","AutocompleteListQuestion","CheckboxQuestion","ComponentElements","ContentElements","DateInputQuestion","DeclarationComponentPreviewElements","DeclarationQuestion","EastingNorthingComponentPreviewElements","EastingNorthingQuestion","EmailAddressQuestion","LatLongComponentPreviewElements","LatLongQuestion","ListComponentElements","ListQuestion","SelectComponentElements","LongAnswerQuestion","Markdown","MonthYearQuestion","NationalGridComponentPreviewElements","NationalGridQuestion","NumberComponentPreviewElements","NumberOnlyQuestion","OsGridRefComponentPreviewElements","OsGridRefQuestion","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","ComponentToPreviewQuestion","component","definition","componentCoerced","list","_definition","mapComponentToPreviewQuestion","questionRenderer","questionElements","getQuestionElementsFunc","type","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 {\n DeclarationComponentPreviewElements,\n DeclarationQuestion\n} from '~/src/form/form-editor/preview/declaration.js'\nimport {\n EastingNorthingComponentPreviewElements,\n EastingNorthingQuestion\n} from '~/src/form/form-editor/preview/easting-northing.js'\nimport { EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport {\n LatLongComponentPreviewElements,\n LatLongQuestion\n} from '~/src/form/form-editor/preview/lat-long.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 NationalGridComponentPreviewElements,\n NationalGridQuestion\n} from '~/src/form/form-editor/preview/national-grid.js'\nimport {\n NumberComponentPreviewElements,\n NumberOnlyQuestion\n} from '~/src/form/form-editor/preview/number-only.js'\nimport {\n OsGridRefComponentPreviewElements,\n OsGridRefQuestion\n} from '~/src/form/form-editor/preview/os-grid-ref.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]: DeclarationQuestion,\n [ComponentType.FileUploadField]: SupportingEvidenceQuestion,\n [ComponentType.EastingNorthingField]: EastingNorthingQuestion,\n [ComponentType.OsGridRefField]: OsGridRefQuestion,\n [ComponentType.NationalGridFieldNumberField]: NationalGridQuestion,\n [ComponentType.LatLongField]: LatLongQuestion\n}\n\n/**\n * @type {Partial<Record<ComponentType, (component: ComponentDef, definition: FormDefinition ) => QuestionElements>>}\n */\nconst ComponentToPreviewQuestion = {\n [ComponentType.AutocompleteField]: (component, definition) => {\n const componentCoerced = /** @type {AutocompleteFieldComponent} */ (\n component\n )\n const list = findDefinitionListFromComponent(componentCoerced, definition)\n return new SelectComponentElements(componentCoerced, list)\n },\n [ComponentType.SelectField]: (component, definition) => {\n const componentCoerced = /** @type {SelectFieldComponent} */ (component)\n const list = findDefinitionListFromComponent(componentCoerced, definition)\n return new SelectComponentElements(componentCoerced, list)\n },\n [ComponentType.UkAddressField]: (component, _definition) => {\n const componentCoerced = /** @type {UkAddressFieldComponent} */ (component)\n return new UkAddressComponentPreviewElements(componentCoerced)\n },\n [ComponentType.NumberField]: (component, _definition) => {\n const componentCoerced = /** @type {NumberFieldComponent} */ (component)\n return new NumberComponentPreviewElements(componentCoerced)\n },\n [ComponentType.DeclarationField]: (component, _definition) => {\n const componentCoerced = /** @type {DeclarationFieldComponent} */ (\n component\n )\n return new DeclarationComponentPreviewElements(componentCoerced)\n },\n [ComponentType.YesNoField]: (component, _definition) => {\n const componentCoerced = /** @type {YesNoFieldComponent} */ (component)\n return new QuestionComponentElements(componentCoerced)\n },\n [ComponentType.EastingNorthingField]: (component, _definition) => {\n const componentCoerced = /** @type {EastingNorthingFieldComponent} */ (\n component\n )\n return new EastingNorthingComponentPreviewElements(componentCoerced)\n },\n [ComponentType.OsGridRefField]: (component, _definition) => {\n const componentCoerced = /** @type {OsGridRefFieldComponent} */ (component)\n return new OsGridRefComponentPreviewElements(componentCoerced)\n },\n [ComponentType.NationalGridFieldNumberField]: (component, _definition) => {\n const componentCoerced =\n /** @type {NationalGridFieldNumberFieldComponent} */ (component)\n return new NationalGridComponentPreviewElements(componentCoerced)\n },\n [ComponentType.LatLongField]: (component, _definition) => {\n const componentCoerced = /** @type {LatLongFieldComponent} */ (component)\n return new LatLongComponentPreviewElements(componentCoerced)\n }\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 // Look for one-to-one mapping first, then fallback if not found\n const getQuestionElementsFunc = ComponentToPreviewQuestion[component.type]\n if (getQuestionElementsFunc) {\n questionElements = getQuestionElementsFunc(component, definition)\n } else if (hasSelectionFields(component) && hasListField(component)) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new ListComponentElements(component, list)\n } else if (hasInputField(component)) {\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 { AutocompleteFieldComponent, ComponentDef, DeclarationFieldComponent, EastingNorthingFieldComponent, LatLongFieldComponent, NationalGridFieldNumberFieldComponent, NumberFieldComponent, OsGridRefFieldComponent, SelectFieldComponent, UkAddressFieldComponent, YesNoFieldComponent } 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,SACEC,mCAAmC,EACnCC,mBAAmB;AAErB,SACEC,uCAAuC,EACvCC,uBAAuB;AAEzB,SAASC,oBAAoB;AAC7B,SACEC,+BAA+B,EAC/BC,eAAe;AAEjB,SACEC,qBAAqB,EACrBC,YAAY,EACZC,uBAAuB;AAEzB,SAASC,kBAAkB;AAC3B,SAASC,QAAQ;AACjB,SAASC,iBAAiB;AAC1B,SACEC,oCAAoC,EACpCC,oBAAoB;AAEtB,SACEC,8BAA8B,EAC9BC,kBAAkB;AAEpB,SACEC,i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,uBAAuB,EAAE;MAC3BD,gBAAgB,GAAGC,uBAAuB,CAACR,SAAS,EAAEC,UAAU,CAAC;IACnE,CAAC,MAAM,IAAI7D,kBAAkB,CAAC4D,SAAS,CAAC,IAAI7D,YAAY,CAAC6D,SAAS,CAAC,EAAE;MACnE,MAAMG,IAAI,GAAG7B,+BAA+B,CAAC0B,SAAS,EAAEC,UAAU,CAAC;MACnEM,gBAAgB,GAAG,IAAItD,qBAAqB,CAAC+C,SAAS,EAAEG,IAAI,CAAC;IAC/D,CAAC,MAAM,IAAIjE,aAAa,CAAC8D,SAAS,CAAC,EAAE;MACnCO,gBAAgB,GAAG,IAAIzC,yBAAyB,CAACkC,SAAS,CAAC;IAC7D,CAAC,MAAM,IAAI/D,eAAe,CAAC+D,SAAS,CAAC,EAAE;MACrCO,gBAAgB,GAAG,IAAI/D,eAAe,CAACwD,SAAS,CAAC;IACnD,CAAC,MAAM;MACLO,gBAAgB,GAAG,IAAIhE,iBAAiB,CAACyD,SAAS,CAAC;IACrD;IAEA,MAAMU,mBAAmB,GAAGnC,6BAA6B,CAACyB,SAAS,CAACS,IAAI,CAAC;IAEzE,MAAME,gBAAgB,GAAG,IAAID,mBAAmB,CAC9CH,gBAAgB,EAChBD,gBACF,CAAC;IACDK,gBAAgB,CAACC,EAAE,GAAGZ,SAAS,CAACY,EAAE;IAClC,OAAOD,gBAAgB;EACzB,CAAC;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"helpers.js","names":["ComponentType","hasContentField","hasInputField","hasListField","hasSelectionFields","AutocompleteListQuestion","CheckboxQuestion","ComponentElements","ContentElements","DateInputQuestion","DeclarationComponentPreviewElements","DeclarationQuestion","EastingNorthingComponentPreviewElements","EastingNorthingQuestion","EmailAddressQuestion","HiddenQuestion","LatLongComponentPreviewElements","LatLongQuestion","ListComponentElements","ListQuestion","SelectComponentElements","LongAnswerQuestion","Markdown","MonthYearQuestion","NationalGridComponentPreviewElements","NationalGridQuestion","NumberComponentPreviewElements","NumberOnlyQuestion","OsGridRefComponentPreviewElements","OsGridRefQuestion","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","HiddenField","ComponentToPreviewQuestion","component","definition","componentCoerced","list","_definition","mapComponentToPreviewQuestion","questionRenderer","questionElements","getQuestionElementsFunc","type","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 {\n DeclarationComponentPreviewElements,\n DeclarationQuestion\n} from '~/src/form/form-editor/preview/declaration.js'\nimport {\n EastingNorthingComponentPreviewElements,\n EastingNorthingQuestion\n} from '~/src/form/form-editor/preview/easting-northing.js'\nimport { EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport { HiddenQuestion } from '~/src/form/form-editor/preview/hidden.js'\nimport {\n LatLongComponentPreviewElements,\n LatLongQuestion\n} from '~/src/form/form-editor/preview/lat-long.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 NationalGridComponentPreviewElements,\n NationalGridQuestion\n} from '~/src/form/form-editor/preview/national-grid.js'\nimport {\n NumberComponentPreviewElements,\n NumberOnlyQuestion\n} from '~/src/form/form-editor/preview/number-only.js'\nimport {\n OsGridRefComponentPreviewElements,\n OsGridRefQuestion\n} from '~/src/form/form-editor/preview/os-grid-ref.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]: DeclarationQuestion,\n [ComponentType.FileUploadField]: SupportingEvidenceQuestion,\n [ComponentType.EastingNorthingField]: EastingNorthingQuestion,\n [ComponentType.OsGridRefField]: OsGridRefQuestion,\n [ComponentType.NationalGridFieldNumberField]: NationalGridQuestion,\n [ComponentType.LatLongField]: LatLongQuestion,\n [ComponentType.HiddenField]: HiddenQuestion\n}\n\n/**\n * @type {Partial<Record<ComponentType, (component: ComponentDef, definition: FormDefinition ) => QuestionElements>>}\n */\nconst ComponentToPreviewQuestion = {\n [ComponentType.AutocompleteField]: (component, definition) => {\n const componentCoerced = /** @type {AutocompleteFieldComponent} */ (\n component\n )\n const list = findDefinitionListFromComponent(componentCoerced, definition)\n return new SelectComponentElements(componentCoerced, list)\n },\n [ComponentType.SelectField]: (component, definition) => {\n const componentCoerced = /** @type {SelectFieldComponent} */ (component)\n const list = findDefinitionListFromComponent(componentCoerced, definition)\n return new SelectComponentElements(componentCoerced, list)\n },\n [ComponentType.UkAddressField]: (component, _definition) => {\n const componentCoerced = /** @type {UkAddressFieldComponent} */ (component)\n return new UkAddressComponentPreviewElements(componentCoerced)\n },\n [ComponentType.NumberField]: (component, _definition) => {\n const componentCoerced = /** @type {NumberFieldComponent} */ (component)\n return new NumberComponentPreviewElements(componentCoerced)\n },\n [ComponentType.DeclarationField]: (component, _definition) => {\n const componentCoerced = /** @type {DeclarationFieldComponent} */ (\n component\n )\n return new DeclarationComponentPreviewElements(componentCoerced)\n },\n [ComponentType.YesNoField]: (component, _definition) => {\n const componentCoerced = /** @type {YesNoFieldComponent} */ (component)\n return new QuestionComponentElements(componentCoerced)\n },\n [ComponentType.EastingNorthingField]: (component, _definition) => {\n const componentCoerced = /** @type {EastingNorthingFieldComponent} */ (\n component\n )\n return new EastingNorthingComponentPreviewElements(componentCoerced)\n },\n [ComponentType.OsGridRefField]: (component, _definition) => {\n const componentCoerced = /** @type {OsGridRefFieldComponent} */ (component)\n return new OsGridRefComponentPreviewElements(componentCoerced)\n },\n [ComponentType.NationalGridFieldNumberField]: (component, _definition) => {\n const componentCoerced =\n /** @type {NationalGridFieldNumberFieldComponent} */ (component)\n return new NationalGridComponentPreviewElements(componentCoerced)\n },\n [ComponentType.LatLongField]: (component, _definition) => {\n const componentCoerced = /** @type {LatLongFieldComponent} */ (component)\n return new LatLongComponentPreviewElements(componentCoerced)\n }\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 // Look for one-to-one mapping first, then fallback if not found\n const getQuestionElementsFunc = ComponentToPreviewQuestion[component.type]\n if (getQuestionElementsFunc) {\n questionElements = getQuestionElementsFunc(component, definition)\n } else if (hasSelectionFields(component) && hasListField(component)) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new ListComponentElements(component, list)\n } else if (hasInputField(component)) {\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 { AutocompleteFieldComponent, ComponentDef, DeclarationFieldComponent, EastingNorthingFieldComponent, LatLongFieldComponent, NationalGridFieldNumberFieldComponent, NumberFieldComponent, OsGridRefFieldComponent, SelectFieldComponent, UkAddressFieldComponent, YesNoFieldComponent } 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,SACEC,mCAAmC,EACnCC,mBAAmB;AAErB,SACEC,uCAAuC,EACvCC,uBAAuB;AAEzB,SAASC,oBAAoB;AAC7B,SAASC,cAAc;AACvB,SACEC,+BAA+B,EAC/BC,eAAe;AAEjB,SACEC,qBAAqB,EACrBC,YAAY,EACZC,uBAAuB;AAEzB,SAASC,kBAAkB;AAC3B,SAASC,QAAQ;AACjB,SAASC,iBAAiB;AAC1B,SACEC,oCAAoC,EACpCC,oBAAoB;AAEtB,SACEC,8BAA8B,EAC9BC,kBAAkB;AAEpB,SACEC,iCAAiC,EACjCC,iBAAiB;AAEnB,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,CAACxC,aAAa,CAACyC,SAAS,GAAGP,mBAAmB;EAC9C,CAAClC,aAAa,CAAC0C,OAAO,GAAGR,mBAAmB;EAC5C,CAAClC,aAAa,CAAC2C,SAAS,GAAGT,mBAAmB;EAC9C,CAAClC,aAAa,CAAC4C,IAAI,GAAGV,mBAAmB;EACzC,CAAClC,aAAa,CAACsB,QAAQ,GAAGA,QAAQ;EAClC,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E,SAAS,CAAC,EAAE;MACrCO,gBAAgB,GAAG,IAAIjE,eAAe,CAAC0D,SAAS,CAAC;IACnD,CAAC,MAAM;MACLO,gBAAgB,GAAG,IAAIlE,iBAAiB,CAAC2D,SAAS,CAAC;IACrD;IAEA,MAAMU,mBAAmB,GAAGpC,6BAA6B,CAAC0B,SAAS,CAACS,IAAI,CAAC;IAEzE,MAAME,gBAAgB,GAAG,IAAID,mBAAmB,CAC9CH,gBAAgB,EAChBD,gBACF,CAAC;IACDK,gBAAgB,CAACC,EAAE,GAAGZ,SAAS,CAACY,EAAE;IAClC,OAAOD,gBAAgB;EACzB,CAAC;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentType } from "../../../components/enums.js";
|
|
2
|
+
import { Question } from "./question.js";
|
|
3
|
+
export class HiddenQuestion extends Question {
|
|
4
|
+
/**
|
|
5
|
+
* @type {ComponentType}
|
|
6
|
+
*/
|
|
7
|
+
componentType = ComponentType.HiddenField;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=hidden.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hidden.js","names":["ComponentType","Question","HiddenQuestion","componentType","HiddenField"],"sources":["../../../../../src/form/form-editor/preview/hidden.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class HiddenQuestion extends Question {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.HiddenField\n}\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,QAAQ;AAEjB,OAAO,MAAMC,cAAc,SAASD,QAAQ,CAAC;EAC3C;AACF;AACA;EACEE,aAAa,GAAGH,aAAa,CAACI,WAAW;AAC3C","ignoreList":[]}
|
|
@@ -25,6 +25,7 @@ export * from "./supporting-evidence.js";
|
|
|
25
25
|
export * from "./long-answer.js";
|
|
26
26
|
export * from "./uk-address.js";
|
|
27
27
|
export * from "./yes-no.js";
|
|
28
|
+
export * from "./hidden.js";
|
|
28
29
|
export * from "./controller/page-controller-base.js";
|
|
29
30
|
export * from "./controller/page-controller.js";
|
|
30
31
|
export * from "./controller/guidance-page-controller.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/form/form-editor/preview/index.js"],"sourcesContent":["export * from '~/src/form/form-editor/preview/autocomplete.js'\nexport * from '~/src/form/form-editor/preview/checkbox.js'\nexport * from '~/src/form/form-editor/preview/checkbox-sortable.js'\nexport * from '~/src/form/form-editor/preview/date-input.js'\nexport * from '~/src/form/form-editor/preview/declaration.js'\nexport * from '~/src/form/form-editor/preview/easting-northing.js'\nexport * from '~/src/form/form-editor/preview/email-address.js'\nexport * from '~/src/form/form-editor/preview/lat-long.js'\nexport * from '~/src/form/form-editor/preview/list.js'\nexport * from '~/src/form/form-editor/preview/list-sortable.js'\nexport * from '~/src/form/form-editor/preview/markdown.js'\nexport * from '~/src/form/form-editor/preview/month-year.js'\nexport * from '~/src/form/form-editor/preview/national-grid.js'\nexport * from '~/src/form/form-editor/preview/number-only.js'\nexport * from '~/src/form/form-editor/preview/os-grid-ref.js'\nexport * from '~/src/form/form-editor/preview/phone-number.js'\nexport * from '~/src/form/form-editor/preview/question.js'\nexport * from '~/src/form/form-editor/preview/radio.js'\nexport * from '~/src/form/form-editor/preview/radio-sortable.js'\nexport * from '~/src/form/form-editor/preview/select-sortable.js'\nexport * from '~/src/form/form-editor/preview/short-answer.js'\nexport * from '~/src/form/form-editor/preview/select.js'\nexport * from '~/src/form/form-editor/preview/select-sortable.js'\nexport * from '~/src/form/form-editor/preview/supporting-evidence.js'\nexport * from '~/src/form/form-editor/preview/long-answer.js'\nexport * from '~/src/form/form-editor/preview/uk-address.js'\nexport * from '~/src/form/form-editor/preview/yes-no.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller-base.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/guidance-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/summary-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/reorder-questions-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller-base.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/form/form-editor/preview/index.js"],"sourcesContent":["export * from '~/src/form/form-editor/preview/autocomplete.js'\nexport * from '~/src/form/form-editor/preview/checkbox.js'\nexport * from '~/src/form/form-editor/preview/checkbox-sortable.js'\nexport * from '~/src/form/form-editor/preview/date-input.js'\nexport * from '~/src/form/form-editor/preview/declaration.js'\nexport * from '~/src/form/form-editor/preview/easting-northing.js'\nexport * from '~/src/form/form-editor/preview/email-address.js'\nexport * from '~/src/form/form-editor/preview/lat-long.js'\nexport * from '~/src/form/form-editor/preview/list.js'\nexport * from '~/src/form/form-editor/preview/list-sortable.js'\nexport * from '~/src/form/form-editor/preview/markdown.js'\nexport * from '~/src/form/form-editor/preview/month-year.js'\nexport * from '~/src/form/form-editor/preview/national-grid.js'\nexport * from '~/src/form/form-editor/preview/number-only.js'\nexport * from '~/src/form/form-editor/preview/os-grid-ref.js'\nexport * from '~/src/form/form-editor/preview/phone-number.js'\nexport * from '~/src/form/form-editor/preview/question.js'\nexport * from '~/src/form/form-editor/preview/radio.js'\nexport * from '~/src/form/form-editor/preview/radio-sortable.js'\nexport * from '~/src/form/form-editor/preview/select-sortable.js'\nexport * from '~/src/form/form-editor/preview/short-answer.js'\nexport * from '~/src/form/form-editor/preview/select.js'\nexport * from '~/src/form/form-editor/preview/select-sortable.js'\nexport * from '~/src/form/form-editor/preview/supporting-evidence.js'\nexport * from '~/src/form/form-editor/preview/long-answer.js'\nexport * from '~/src/form/form-editor/preview/uk-address.js'\nexport * from '~/src/form/form-editor/preview/yes-no.js'\nexport * from '~/src/form/form-editor/preview/hidden.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller-base.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/guidance-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/summary-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/reorder-questions-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller-base.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -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,
|
|
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,EAwLhD,CAAA"}
|
|
@@ -22,6 +22,7 @@ export declare enum ComponentType {
|
|
|
22
22
|
EastingNorthingField = "EastingNorthingField",
|
|
23
23
|
OsGridRefField = "OsGridRefField",
|
|
24
24
|
NationalGridFieldNumberField = "NationalGridFieldNumberField",
|
|
25
|
-
LatLongField = "LatLongField"
|
|
25
|
+
LatLongField = "LatLongField",
|
|
26
|
+
HiddenField = "HiddenField"
|
|
26
27
|
}
|
|
27
28
|
//# sourceMappingURL=enums.d.ts.map
|
|
@@ -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,gBAAgB,qBAAqB;IACrC,oBAAoB,yBAAyB;IAC7C,cAAc,mBAAmB;IACjC,4BAA4B,iCAAiC;IAC7D,YAAY,iBAAiB;
|
|
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;IAC7B,WAAW,gBAAgB;CAC5B"}
|
|
@@ -192,6 +192,12 @@ export interface LatLongFieldComponent extends FormFieldBase {
|
|
|
192
192
|
};
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
|
+
export interface HiddenFieldComponent extends FormFieldBase {
|
|
196
|
+
type: ComponentType.HiddenField;
|
|
197
|
+
options: FormFieldBase['options'] & {
|
|
198
|
+
condition?: string;
|
|
199
|
+
};
|
|
200
|
+
}
|
|
195
201
|
export interface DatePartsFieldComponent extends DateFieldBase {
|
|
196
202
|
type: ComponentType.DatePartsField;
|
|
197
203
|
options: DateFieldBase['options'] & {
|
|
@@ -269,7 +275,7 @@ export interface SelectFieldComponent extends ListFieldBase {
|
|
|
269
275
|
}
|
|
270
276
|
export type ComponentDef = FormComponentsDef | ContentComponentsDef;
|
|
271
277
|
export type FormComponentsDef = InputFieldsComponentsDef | SelectionComponentsDef;
|
|
272
|
-
export type InputFieldsComponentsDef = TextFieldComponent | EmailAddressFieldComponent | NumberFieldComponent | MultilineTextFieldComponent | TelephoneNumberFieldComponent | MonthYearFieldComponent | DatePartsFieldComponent | UkAddressFieldComponent | FileUploadFieldComponent | DeclarationFieldComponent | EastingNorthingFieldComponent | OsGridRefFieldComponent | NationalGridFieldNumberFieldComponent | LatLongFieldComponent;
|
|
278
|
+
export type InputFieldsComponentsDef = TextFieldComponent | EmailAddressFieldComponent | NumberFieldComponent | MultilineTextFieldComponent | TelephoneNumberFieldComponent | MonthYearFieldComponent | DatePartsFieldComponent | UkAddressFieldComponent | FileUploadFieldComponent | DeclarationFieldComponent | EastingNorthingFieldComponent | OsGridRefFieldComponent | NationalGridFieldNumberFieldComponent | LatLongFieldComponent | HiddenFieldComponent;
|
|
273
279
|
export type ContentComponentsDef = DetailsComponent | HtmlComponent | MarkdownComponent | InsetTextComponent | ListComponent;
|
|
274
280
|
export type ListComponentsDef = Exclude<SelectionComponentsDef, YesNoFieldComponent> | ListComponent;
|
|
275
281
|
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,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wB,GAAG,OAAO,CAC5C,YAAY,EACV,kBAAkB,GAClB,aAAa,GACb,uBAAuB,GACvB,uBAAuB,GACvB,wBAAwB,CAC3B,CAAA"}
|
|
@@ -86,6 +86,7 @@ export declare const customOperators: {
|
|
|
86
86
|
is: OperatorDefinition;
|
|
87
87
|
"is not": OperatorDefinition;
|
|
88
88
|
};
|
|
89
|
+
HiddenField: undefined;
|
|
89
90
|
};
|
|
90
91
|
export declare function getOperatorNames(fieldType?: ConditionalComponentType): OperatorName[];
|
|
91
92
|
export declare function getExpression(fieldType: ConditionalComponentType, fieldName: string, operator: OperatorName, value: Condition['value']): string | undefined;
|
|
@@ -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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC3B,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;AA+DD,eAAO,MAAM,yBAAyB,EAEjC,YAAY,EAAE,CAAA;AAEnB,eAAO,MAAM,yBAAyB,EAEjC,YAAY,EAAE,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ComponentDef } from '../../components/types.js';
|
|
1
2
|
import { type ConditionListItemRefValueDataV2 } from '../../conditions/types.js';
|
|
2
3
|
import { type FormDefinition } from '../../form/form-definition/types.js';
|
|
3
4
|
/**
|
|
@@ -12,4 +13,9 @@ export declare function isFormDefinition(definition: unknown): definition is For
|
|
|
12
13
|
* @returns { definition is ConditionListItemRefValueDataV2 }
|
|
13
14
|
*/
|
|
14
15
|
export declare function isConditionListItemRefValueData(conditionValueData: unknown): conditionValueData is ConditionListItemRefValueDataV2;
|
|
16
|
+
/**
|
|
17
|
+
* Returns an array of all hidden fields in a form
|
|
18
|
+
* @param definition - form definition
|
|
19
|
+
*/
|
|
20
|
+
export declare function getHiddenFields(definition: FormDefinition): ComponentDef[];
|
|
15
21
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/form/form-definition/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/form/form-definition/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,KAAK,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAGzE;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,OAAO,GAClB,UAAU,IAAI,cAAc,CAW9B;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,kBAAkB,EAAE,OAAO,GAC1B,kBAAkB,IAAI,+BAA+B,CAUvD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,cAAc,kBAczD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/helpers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/helpers.js"],"names":[],"mappings":"AAgJA;;;;GAIG;AACH,gEAJW,gBAAgB,cAChB,cAAc,GACZ,CAAC,SAAS,EAAE,YAAY,KAAK,QAAQ,CAmCjD;sCAGsD,yCAAyC;oCAG7D,qCAAqC;kCACgO,2BAA2B;8BAHtS,4CAA4C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hidden.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/hidden.js"],"names":[],"mappings":"AAGA;CAKC;yBAPwB,4CAA4C"}
|
|
@@ -25,6 +25,7 @@ export * from "../../../form/form-editor/preview/supporting-evidence.js";
|
|
|
25
25
|
export * from "../../../form/form-editor/preview/long-answer.js";
|
|
26
26
|
export * from "../../../form/form-editor/preview/uk-address.js";
|
|
27
27
|
export * from "../../../form/form-editor/preview/yes-no.js";
|
|
28
|
+
export * from "../../../form/form-editor/preview/hidden.js";
|
|
28
29
|
export * from "../../../form/form-editor/preview/controller/page-controller-base.js";
|
|
29
30
|
export * from "../../../form/form-editor/preview/controller/page-controller.js";
|
|
30
31
|
export * from "../../../form/form-editor/preview/controller/guidance-page-controller.js";
|
package/package.json
CHANGED
|
@@ -179,5 +179,13 @@ export const ComponentTypes: readonly ComponentDef[] = Object.freeze([
|
|
|
179
179
|
type: ComponentType.LatLongField,
|
|
180
180
|
hint: 'For Great Britain, the latitude will be a number between 49.850 and 60.859. The longitude will be a number between -13.687 and 1.767',
|
|
181
181
|
options: {}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'HiddenField',
|
|
185
|
+
title: 'Hidden field',
|
|
186
|
+
type: ComponentType.HiddenField,
|
|
187
|
+
hint: '',
|
|
188
|
+
options: {},
|
|
189
|
+
schema: {}
|
|
182
190
|
}
|
|
183
191
|
])
|
package/src/components/enums.ts
CHANGED
|
@@ -22,5 +22,6 @@ export enum ComponentType {
|
|
|
22
22
|
EastingNorthingField = 'EastingNorthingField',
|
|
23
23
|
OsGridRefField = 'OsGridRefField',
|
|
24
24
|
NationalGridFieldNumberField = 'NationalGridFieldNumberField',
|
|
25
|
-
LatLongField = 'LatLongField'
|
|
25
|
+
LatLongField = 'LatLongField',
|
|
26
|
+
HiddenField = 'HiddenField'
|
|
26
27
|
}
|
package/src/components/types.ts
CHANGED
|
@@ -230,6 +230,13 @@ export interface LatLongFieldComponent extends FormFieldBase {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
export interface HiddenFieldComponent extends FormFieldBase {
|
|
234
|
+
type: ComponentType.HiddenField
|
|
235
|
+
options: FormFieldBase['options'] & {
|
|
236
|
+
condition?: string
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
233
240
|
// Date Fields
|
|
234
241
|
export interface DatePartsFieldComponent extends DateFieldBase {
|
|
235
242
|
type: ComponentType.DatePartsField
|
|
@@ -341,6 +348,7 @@ export type InputFieldsComponentsDef =
|
|
|
341
348
|
| OsGridRefFieldComponent
|
|
342
349
|
| NationalGridFieldNumberFieldComponent
|
|
343
350
|
| LatLongFieldComponent
|
|
351
|
+
| HiddenFieldComponent
|
|
344
352
|
|
|
345
353
|
// Components that render content
|
|
346
354
|
export type ContentComponentsDef =
|
|
@@ -85,7 +85,8 @@ export const customOperators = {
|
|
|
85
85
|
[ComponentType.EastingNorthingField]: defaultOperators,
|
|
86
86
|
[ComponentType.OsGridRefField]: defaultOperators,
|
|
87
87
|
[ComponentType.NationalGridFieldNumberField]: defaultOperators,
|
|
88
|
-
[ComponentType.LatLongField]: defaultOperators
|
|
88
|
+
[ComponentType.LatLongField]: defaultOperators,
|
|
89
|
+
[ComponentType.HiddenField]: undefined
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
export function getOperatorNames(fieldType?: ConditionalComponentType) {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { ComponentType } from '~/src/components/enums.js'
|
|
2
|
+
import { type ComponentDef } from '~/src/components/types.js'
|
|
1
3
|
import { type ConditionListItemRefValueDataV2 } from '~/src/conditions/types.js'
|
|
2
4
|
import { type FormDefinition } from '~/src/form/form-definition/types.js'
|
|
5
|
+
import { hasComponents } from '~/src/pages/helpers.js'
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* TypeGuard to check if something is a FormDefinition
|
|
@@ -39,3 +42,23 @@ export function isConditionListItemRefValueData(
|
|
|
39
42
|
'itemId' in conditionValueData
|
|
40
43
|
)
|
|
41
44
|
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Returns an array of all hidden fields in a form
|
|
48
|
+
* @param definition - form definition
|
|
49
|
+
*/
|
|
50
|
+
export function getHiddenFields(definition: FormDefinition) {
|
|
51
|
+
if (definition.pages.length === 0) {
|
|
52
|
+
return []
|
|
53
|
+
}
|
|
54
|
+
const totalHiddenFields = [] as ComponentDef[]
|
|
55
|
+
for (const page of definition.pages) {
|
|
56
|
+
const hiddenFields = hasComponents(page)
|
|
57
|
+
? page.components.filter(
|
|
58
|
+
(comp) => comp.type === ComponentType.HiddenField
|
|
59
|
+
)
|
|
60
|
+
: []
|
|
61
|
+
totalHiddenFields.push(...hiddenFields)
|
|
62
|
+
}
|
|
63
|
+
return totalHiddenFields
|
|
64
|
+
}
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
EastingNorthingQuestion
|
|
20
20
|
} from '~/src/form/form-editor/preview/easting-northing.js'
|
|
21
21
|
import { EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'
|
|
22
|
+
import { HiddenQuestion } from '~/src/form/form-editor/preview/hidden.js'
|
|
22
23
|
import {
|
|
23
24
|
LatLongComponentPreviewElements,
|
|
24
25
|
LatLongQuestion
|
|
@@ -82,7 +83,8 @@ const InputFieldComponentDictionary = {
|
|
|
82
83
|
[ComponentType.EastingNorthingField]: EastingNorthingQuestion,
|
|
83
84
|
[ComponentType.OsGridRefField]: OsGridRefQuestion,
|
|
84
85
|
[ComponentType.NationalGridFieldNumberField]: NationalGridQuestion,
|
|
85
|
-
[ComponentType.LatLongField]: LatLongQuestion
|
|
86
|
+
[ComponentType.LatLongField]: LatLongQuestion,
|
|
87
|
+
[ComponentType.HiddenField]: HiddenQuestion
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentType } from '~/src/components/enums.js'
|
|
2
|
+
import { Question } from '~/src/form/form-editor/preview/question.js'
|
|
3
|
+
|
|
4
|
+
export class HiddenQuestion extends Question {
|
|
5
|
+
/**
|
|
6
|
+
* @type {ComponentType}
|
|
7
|
+
*/
|
|
8
|
+
componentType = ComponentType.HiddenField
|
|
9
|
+
}
|
|
@@ -25,6 +25,7 @@ export * from '~/src/form/form-editor/preview/supporting-evidence.js'
|
|
|
25
25
|
export * from '~/src/form/form-editor/preview/long-answer.js'
|
|
26
26
|
export * from '~/src/form/form-editor/preview/uk-address.js'
|
|
27
27
|
export * from '~/src/form/form-editor/preview/yes-no.js'
|
|
28
|
+
export * from '~/src/form/form-editor/preview/hidden.js'
|
|
28
29
|
export * from '~/src/form/form-editor/preview/controller/page-controller-base.js'
|
|
29
30
|
export * from '~/src/form/form-editor/preview/controller/page-controller.js'
|
|
30
31
|
export * from '~/src/form/form-editor/preview/controller/guidance-page-controller.js'
|