@defra/forms-model 3.0.567 → 3.0.569

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/module/components/component-types.js +24 -0
  2. package/dist/module/components/component-types.js.map +1 -1
  3. package/dist/module/components/enums.js +4 -0
  4. package/dist/module/components/enums.js.map +1 -1
  5. package/dist/module/components/types.js.map +1 -1
  6. package/dist/module/conditions/condition-operators.js +5 -1
  7. package/dist/module/conditions/condition-operators.js.map +1 -1
  8. package/dist/module/form/form-editor/__stubs__/preview.js +128 -1
  9. package/dist/module/form/form-editor/__stubs__/preview.js.map +1 -1
  10. package/dist/module/form/form-editor/index.js +9 -5
  11. package/dist/module/form/form-editor/index.js.map +1 -1
  12. package/dist/module/form/form-editor/macros/types.js.map +1 -1
  13. package/dist/module/form/form-editor/preview/component-elements.js +1 -0
  14. package/dist/module/form/form-editor/preview/component-elements.js.map +1 -1
  15. package/dist/module/form/form-editor/preview/helpers.js +8 -2
  16. package/dist/module/form/form-editor/preview/helpers.js.map +1 -1
  17. package/dist/module/form/form-editor/preview/number-only.js +75 -3
  18. package/dist/module/form/form-editor/preview/number-only.js.map +1 -1
  19. package/dist/module/form/form-editor/preview/question.js +30 -3
  20. package/dist/module/form/form-editor/preview/question.js.map +1 -1
  21. package/dist/module/form/form-editor/preview/types.js.map +1 -1
  22. package/dist/module/form/form-editor/types.js.map +1 -1
  23. package/dist/types/components/component-types.d.ts.map +1 -1
  24. package/dist/types/components/enums.d.ts +5 -1
  25. package/dist/types/components/enums.d.ts.map +1 -1
  26. package/dist/types/components/types.d.ts +50 -1
  27. package/dist/types/components/types.d.ts.map +1 -1
  28. package/dist/types/conditions/condition-operators.d.ts +16 -0
  29. package/dist/types/conditions/condition-operators.d.ts.map +1 -1
  30. package/dist/types/form/form-editor/__stubs__/preview.d.ts +71 -1
  31. package/dist/types/form/form-editor/__stubs__/preview.d.ts.map +1 -1
  32. package/dist/types/form/form-editor/index.d.ts +5 -1
  33. package/dist/types/form/form-editor/index.d.ts.map +1 -1
  34. package/dist/types/form/form-editor/macros/types.d.ts +7 -0
  35. package/dist/types/form/form-editor/macros/types.d.ts.map +1 -1
  36. package/dist/types/form/form-editor/preview/component-elements.d.ts.map +1 -1
  37. package/dist/types/form/form-editor/preview/helpers.d.ts.map +1 -1
  38. package/dist/types/form/form-editor/preview/number-only.d.ts +123 -0
  39. package/dist/types/form/form-editor/preview/number-only.d.ts.map +1 -1
  40. package/dist/types/form/form-editor/preview/question.d.ts +13 -0
  41. package/dist/types/form/form-editor/preview/question.d.ts.map +1 -1
  42. package/dist/types/form/form-editor/preview/types.d.ts +8 -0
  43. package/dist/types/form/form-editor/preview/types.d.ts.map +1 -1
  44. package/dist/types/form/form-editor/preview/uk-address.d.ts +7 -0
  45. package/dist/types/form/form-editor/preview/uk-address.d.ts.map +1 -1
  46. package/dist/types/form/form-editor/types.d.ts +15 -2
  47. package/dist/types/form/form-editor/types.d.ts.map +1 -1
  48. package/package.json +1 -1
  49. package/schemas/date-sub-schema.json +1 -1
  50. package/schemas/form-editor-input-page-schema.json +1 -0
  51. package/schemas/question-type-full-schema.json +5 -1
  52. package/schemas/question-type-schema.json +1 -0
  53. package/src/components/component-types.ts +28 -0
  54. package/src/components/enums.ts +5 -1
  55. package/src/components/types.ts +58 -0
  56. package/src/conditions/condition-operators.ts +5 -1
  57. package/src/form/form-editor/__stubs__/preview.js +130 -1
  58. package/src/form/form-editor/index.ts +34 -4
  59. package/src/form/form-editor/macros/types.ts +3 -0
  60. package/src/form/form-editor/preview/component-elements.js +4 -0
  61. package/src/form/form-editor/preview/helpers.js +11 -2
  62. package/src/form/form-editor/preview/number-only.js +72 -3
  63. package/src/form/form-editor/preview/question.js +33 -3
  64. package/src/form/form-editor/preview/types.ts +10 -0
  65. package/src/form/form-editor/types.ts +24 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Joi","ComponentType","MAX_NUMBER_OF_REPEAT_ITEMS","MIN_NUMBER_OF_REPEAT_ITEMS","QuestionTypeSubGroup","pageTypeSchema","string","required","valid","description","questionTypeSchema","WrittenAnswerSubGroup","DateSubGroup","UkAddressField","TelephoneNumberField","FileUploadField","EmailAddressField","ListSubGroup","YesNoField","CheckboxesField","RadiosField","AutocompleteField","questionTypeFullSchema","TextField","MultilineTextField","NumberField","DatePartsField","MonthYearField","SelectField","writtenAnswerSubSchema","dateSubSchema","listSubSchema","nameSchema","trim","questionSchema","hintTextSchema","optional","allow","questionOptionalSchema","listForQuestionSchema","listItemCountSchema","number","listItemsDataSchema","exactFilesSchema","empty","integer","min","max","minFilesSchema","maxFilesSchema","fileTypesSchema","array","items","single","default","documentTypesSchema","imageTypesSchema","tabularDataTypesSchema","enhancedActionSchema","radioIdSchema","radioTextSchema","radioHintSchema","radioValueSchema","shortDescriptionSchema","pageHeadingAndGuidanceSchema","pageHeadingSchema","guidanceTextSchema","exitPageSchema","boolean","repeaterSchema","minItemsSchema","maxItemsSchema","questionSetNameSchema","needDeclarationSchema","declarationTextSchema","minSchema","maxSchema","minLengthSchema","maxLengthSchema","maxFutureSchema","maxPastSchema","precisionSchema","prefixSchema","regexSchema","rowsSchema","suffixSchema","classesSchema","jsEnabledSchema","usePostcodeLookupSchema","customValidator","extend","joi","type","base","messages","coerce","from","method","value","helpers","rowSeparatorRule","schema","$_getRule","colSeparatorRule","keysRule","rowSeparator","args","rows","split","map","v","filter","Boolean","colSeparator","keys","coercedValue","row","reduce","acc","col","idx","_err","console","error","errors","rules","convert","alias","$_addRule","name","ref","assert","RegExp","message","Array","isArray","every","k","autoCompleteOptionsSchema","dsv","object","text","disallow","parent","unique","ignoreUndefined","questionDetailsFullSchema","formEditorInputPageKeys","pageType","questionType","formEditorInputPageSchema","formEditorInputheckAnswersSettingsKeys","declarationText","formEditorInputCheckAnswersSettingSchema","formEditorInputQuestionKeys","question","shortDescription","hintText","questionOptional","formEditorInputQuestionSchema","formEditorInputPageSettingsKeys","pageHeadingAndGuidance","pageHeading","guidanceText","formEditorInputPageSettingsSchema","govukFieldValueIsString","govukField","includes","govukFieldIsChecked","checkedValue","checked","allowedErrorTemplateFunctions"],"sources":["../../../../src/form/form-editor/index.ts"],"sourcesContent":["import Joi, { type ArraySchema, type GetRuleOptions } from 'joi'\n\nimport { ComponentType } from '~/src/components/enums.js'\nimport {\n MAX_NUMBER_OF_REPEAT_ITEMS,\n MIN_NUMBER_OF_REPEAT_ITEMS\n} from '~/src/form/form-definition/index.js'\nimport {\n type FormEditorInputCheckAnswersSettings,\n type FormEditorInputPage,\n type FormEditorInputPageSettings,\n type FormEditorInputQuestion,\n type GovukField,\n type GovukFieldQuestionOptional,\n type GovukFieldUsePostcodeLookup,\n type GovukStringField\n} from '~/src/form/form-editor/types.js'\n\nexport enum QuestionTypeSubGroup {\n WrittenAnswerSubGroup = 'writtenAnswerSub',\n DateSubGroup = 'dateSub',\n ListSubGroup = 'listSub'\n}\n\nexport const pageTypeSchema = Joi.string()\n .required()\n .valid('question', 'guidance')\n .description('Type of page - either a question page or guidance page')\n\nexport const questionTypeSchema = Joi.string()\n .required()\n .valid(\n QuestionTypeSubGroup.WrittenAnswerSubGroup,\n QuestionTypeSubGroup.DateSubGroup,\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n QuestionTypeSubGroup.ListSubGroup,\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField\n )\n .description('The high-level type of question, including grouped types')\n\nexport const questionTypeFullSchema = Joi.string()\n .required()\n .valid(\n ComponentType.TextField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField,\n ComponentType.DatePartsField,\n ComponentType.MonthYearField,\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField\n )\n .description('The specific component type to use for this question')\n\nexport const writtenAnswerSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.TextField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField\n )\n .description('Subtype for written answer questions')\n\nexport const dateSubSchema = Joi.string()\n .required()\n .valid(ComponentType.DatePartsField, ComponentType.MonthYearField)\nexport const listSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField\n )\n .description('Subtype for date-related questions')\n\nexport const nameSchema = Joi.string()\n .trim()\n .required()\n .description('Unique identifier for the field')\n\nexport const questionSchema = Joi.string()\n .trim()\n .required()\n .description('The question text displayed to the user')\n\nexport const hintTextSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Optional guidance text displayed below the question')\n\nexport const questionOptionalSchema = Joi.string()\n .trim()\n .optional()\n .valid('', 'true')\n .description(\n 'Indicates whether a question is optional. Empty string or \"true\" values are accepted.'\n )\n\nexport const listForQuestionSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Unique identifier for the list used by the field')\n\nexport const listItemCountSchema = Joi.number()\n .optional()\n .description('Number of list items in the list used by the field')\n\nexport const listItemsDataSchema = Joi.string()\n .allow('')\n .description('List items in JSON format, such as for radios or checkboxes.')\n\nexport const exactFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Specifies the exact number of files required for upload. Must be between 1 and 25.'\n )\n\nexport const minFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Minimum number of files required for upload. Must be between 1 and 25.'\n )\n\nexport const maxFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Maximum number of files allowed for upload. Must be between 1 and 25.'\n )\n\nexport const fileTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed file types. Can be provided as a single value or an array.'\n )\n\nexport const documentTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed document types. Can be provided as a single value or an array.'\n )\n\nexport const imageTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed image types. Can be provided as a single value or an array.'\n )\n\nexport const tabularDataTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n\nexport const enhancedActionSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Action field that can include enhanced functionality')\n\nexport const radioIdSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Unique identifier for radio options')\n\nexport const radioTextSchema = Joi.string()\n .trim()\n .required()\n .description('The visible text shown next to radio options')\n\nexport const radioHintSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Optional hint text displayed with radio buttons to provide additional guidance'\n )\n\nexport const radioValueSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Array of allowed tabular data types. Can be provided as a single value or an array.'\n )\n\nexport const shortDescriptionSchema = Joi.string()\n .trim()\n .required()\n .description('Brief description of the question for internal use')\n\nexport const pageHeadingAndGuidanceSchema = Joi.string()\n .trim()\n .optional()\n .description('Combined heading and guidance for the page')\n\nexport const pageHeadingSchema = Joi.string()\n .trim()\n .required()\n .description('Main heading displayed at the top of the page')\n\nexport const guidanceTextSchema = Joi.string()\n .trim()\n .description('Guidance text to assist users in completing the page')\n\nexport const exitPageSchema = Joi.boolean()\n .default(false)\n .optional()\n .description('Determines if page is set as an Exit Page')\n\nexport const repeaterSchema = Joi.string()\n .trim()\n .optional()\n .description(\n 'Combined min/max items and question set name for the repeater page'\n )\n\nexport const minItemsSchema = Joi.number()\n .empty('')\n .min(MIN_NUMBER_OF_REPEAT_ITEMS)\n .description('The minimum number of repeater items')\n\nexport const maxItemsSchema = Joi.number()\n .empty('')\n .max(MAX_NUMBER_OF_REPEAT_ITEMS)\n .description('The maximum number of repeater items')\n\nexport const questionSetNameSchema = Joi.string()\n .trim()\n .description('The repeater question set name')\n\nexport const needDeclarationSchema = Joi.string()\n .trim()\n .required()\n .description('Whether a declaration is needed')\n\nexport const declarationTextSchema = Joi.string()\n .trim()\n .required()\n .description('Text of the declaration that users must agree to')\n\nexport const minSchema = Joi.number()\n .empty('')\n .integer()\n .description('Minimum value for numeric inputs')\n\nexport const maxSchema = Joi.number()\n .empty('')\n .integer()\n .description('Maximum value for numeric inputs')\n\nexport const minLengthSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Minimum character length for text inputs')\n\nexport const maxLengthSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Maximum character length for text inputs')\n\nexport const maxFutureSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Maximum days in the future allowed for date inputs')\n\nexport const maxPastSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Maximum days in the past allowed for date inputs')\n\nexport const precisionSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Decimal precision for numeric inputs')\n\nexport const prefixSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Text to display before the input (e.g., £)')\n\nexport const regexSchema = Joi.string()\n .optional()\n .allow('')\n .description('Regular expression pattern for validation')\n\nexport const rowsSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Number of rows for multiline text fields')\n\nexport const suffixSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Text to display after the input (e.g., kg)')\n\nexport const classesSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Custom CSS classes to apply to the component')\n\nexport const jsEnabledSchema = Joi.string()\n .trim()\n .optional()\n .allow('false', 'true')\n .description('Flag to show if Javascript is enabled or not')\n\nexport const usePostcodeLookupSchema = Joi.string()\n .trim()\n .optional()\n .valid('', 'true')\n .description(\n 'Indicates whether a UK address component supports postcode lookup. Empty string or \"true\" values are accepted.'\n )\n\ntype GenericRuleOptions<K extends string, T> = Omit<GetRuleOptions, 'args'> & {\n args: Record<K, T>\n}\n\ninterface DSLSchema<TSchema = Record<string, unknown>[]>\n extends ArraySchema<TSchema> {\n rowSeparator: (rowSep: string | RegExp) => DSLSchema<TSchema>\n row: (rowSep: string | RegExp) => DSLSchema<TSchema>\n colSeparator: (colSep: string | RegExp) => DSLSchema<TSchema>\n col: (colSep: string | RegExp) => DSLSchema<TSchema>\n keys: (keys: string[]) => DSLSchema<TSchema>\n}\n\ninterface CustomValidator extends Joi.Root {\n dsv<TSchema>(): DSLSchema<TSchema>\n}\n\nexport const customValidator = Joi.extend((joi: Joi.Root) => {\n return {\n type: 'dsv',\n base: joi.array(),\n messages: {\n 'dsv.invalid': 'Invalid parse string'\n },\n coerce: {\n from: 'string',\n method(value: string, helpers) {\n try {\n // Only called when prefs.convert is true\n // Rules\n const rowSeparatorRule = helpers.schema.$_getRule('rowSeparator') as\n | undefined\n | GenericRuleOptions<'rowSeparator', string | RegExp>\n const colSeparatorRule = helpers.schema.$_getRule('colSeparator') as\n | undefined\n | GenericRuleOptions<'colSeparator', string | RegExp>\n const keysRule = helpers.schema.$_getRule('keys') as\n | undefined\n | GenericRuleOptions<'keys', string[]>\n\n // Rows\n const rowSeparator = rowSeparatorRule?.args.rowSeparator ?? /\\r?\\n/\n const rows = value\n .split(rowSeparator)\n .map((v) => v.trim())\n .filter(Boolean)\n\n // Columns\n const colSeparator = colSeparatorRule?.args.colSeparator ?? ','\n const keys = keysRule?.args.keys ?? ['key', 'value']\n\n const coercedValue = rows.map((row) => {\n return row\n .split(colSeparator)\n .reduce<Record<string, string>>((acc, col, idx) => {\n return {\n ...acc,\n [keys[idx]]: col.trim()\n }\n }, {})\n })\n return { value: coercedValue }\n } catch (_err) {\n // eslint-disable-next-line no-console\n console.error(_err)\n return { value, errors: [helpers.error('dsv.invalid')] }\n }\n }\n },\n rules: {\n rowSeparator: {\n convert: true,\n alias: 'row',\n method(rowSeparator: string) {\n return this.$_addRule({\n name: 'rowSeparator',\n args: { rowSeparator }\n })\n },\n args: [\n {\n name: 'rowSeparator',\n ref: true,\n assert: (value) =>\n typeof value === 'string' || value instanceof RegExp,\n message: 'must be a string or regex'\n }\n ]\n },\n colSeparator: {\n convert: true,\n alias: 'col',\n method(colSeparator: string) {\n return this.$_addRule({\n name: 'colSeparator',\n args: { colSeparator }\n })\n },\n args: [\n {\n name: 'colSeparator',\n ref: true,\n assert: (value) =>\n typeof value === 'string' || value instanceof RegExp,\n message: 'must be a string or regex'\n }\n ]\n },\n keys: {\n convert: true,\n method(keys: string[]) {\n return this.$_addRule({ name: 'keys', args: { keys } })\n },\n args: [\n {\n name: 'keys',\n ref: true,\n assert: (value) =>\n Array.isArray(value) && value.every((k) => typeof k === 'string'),\n message: 'must be an array of strings'\n }\n ]\n }\n }\n }\n}) as CustomValidator\n\nexport const autoCompleteOptionsSchema = customValidator\n .dsv<{ text: string; value: string }[]>()\n .row(/\\r?\\n/)\n .col(':')\n .keys(['text', 'value'])\n .items(\n customValidator.object({\n text: customValidator.string().min(1).disallow('').required(),\n value: customValidator\n .string()\n .default((parent: { text: string; value?: string }) => parent.text)\n .min(1)\n .disallow('')\n })\n )\n .min(1)\n .unique('text')\n .unique('value', { ignoreUndefined: true })\n .required()\n\nexport const questionDetailsFullSchema = {\n autoCompleteOptionsSchema,\n classesSchema,\n documentTypesSchema,\n enhancedActionSchema,\n exactFilesSchema,\n fileTypesSchema,\n hintTextSchema,\n imageTypesSchema,\n jsEnabledSchema,\n listForQuestionSchema,\n listItemCountSchema,\n listItemsDataSchema,\n maxFilesSchema,\n maxFutureSchema,\n maxLengthSchema,\n maxPastSchema,\n maxSchema,\n minFilesSchema,\n minLengthSchema,\n minSchema,\n nameSchema,\n precisionSchema,\n prefixSchema,\n questionOptionalSchema,\n questionSchema,\n questionTypeFullSchema,\n radioHintSchema,\n radioIdSchema,\n radioTextSchema,\n radioValueSchema,\n regexSchema,\n rowsSchema,\n shortDescriptionSchema,\n suffixSchema,\n tabularDataTypesSchema,\n usePostcodeLookupSchema\n}\n\nexport const formEditorInputPageKeys = {\n pageType: pageTypeSchema,\n questionType: questionTypeSchema\n}\n\n/**\n * Joi schema for `FormEditorInputPage` interface\n * @see {@link FormEditorInputPage}\n */\nexport const formEditorInputPageSchema = Joi.object<FormEditorInputPage>()\n .keys(formEditorInputPageKeys)\n .required()\n .description('Input schema for creating a new page in the form editor')\n\nexport const formEditorInputheckAnswersSettingsKeys = {\n declarationText: shortDescriptionSchema\n}\n\n/**\n * Joi schema for `FormEditorInputCheckAnswersSettings` interface\n * @see {@link FormEditorInputCheckAnswersSettings}\n */\nexport const formEditorInputCheckAnswersSettingSchema =\n Joi.object<FormEditorInputCheckAnswersSettings>()\n .keys(formEditorInputheckAnswersSettingsKeys)\n .required()\n .description('Configuration for the check-answers page')\n\nexport const formEditorInputQuestionKeys = {\n question: questionSchema,\n shortDescription: shortDescriptionSchema,\n hintText: hintTextSchema,\n questionOptional: questionOptionalSchema\n}\n\n/**\n * Joi schema for `FormEditorInputQuestion` interface\n * @see {@link FormEditorInputQuestion}\n */\nexport const formEditorInputQuestionSchema =\n Joi.object<FormEditorInputQuestion>()\n .keys(formEditorInputQuestionKeys)\n .required()\n .description(\n 'Input schema for creating or updating a question in the form editor'\n )\n\nexport const formEditorInputPageSettingsKeys = {\n pageHeadingAndGuidance: pageHeadingAndGuidanceSchema,\n pageHeading: pageHeadingSchema,\n guidanceText: guidanceTextSchema\n}\n\n/**\n * Joi schema for `FormEditorInputPageSettings` interface\n * @see {@link FormEditorInputPageSettings}\n */\nexport const formEditorInputPageSettingsSchema =\n Joi.object<FormEditorInputPageSettings>()\n .keys(formEditorInputPageSettingsKeys)\n .required()\n .description('Settings for page content and display in the form editor')\n\nexport function govukFieldValueIsString(\n govukField: GovukField\n): govukField is GovukStringField {\n return [\n 'question',\n 'hintText',\n 'shortDescription',\n 'autoCompleteOptions'\n ].includes(`${govukField.name}`)\n}\n\nexport function govukFieldIsChecked(\n govukField: GovukField\n): govukField is GovukFieldQuestionOptional | GovukFieldUsePostcodeLookup {\n if (\n govukField.name !== 'questionOptional' &&\n govukField.name !== 'usePostcodeLookup'\n ) {\n return false\n }\n const checkedValue = govukField.items?.[0].checked\n return typeof checkedValue === 'boolean'\n}\n\n// A list of allowed template funtions for use within error message templates\nexport const allowedErrorTemplateFunctions = ['lowerFirst', 'capitalise']\n"],"mappings":"AAAA,OAAOA,GAAG,MAAiD,KAAK;AAEhE,SAASC,aAAa;AACtB,SACEC,0BAA0B,EAC1BC,0BAA0B;AAa5B,WAAYC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAMhC,OAAO,MAAMC,cAAc,GAAGL,GAAG,CAACM,MAAM,CAAC,CAAC,CACvCC,QAAQ,CAAC,CAAC,CACVC,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAC7BC,WAAW,CAAC,wDAAwD,CAAC;AAExE,OAAO,MAAMC,kBAAkB,GAAGV,GAAG,CAACM,MAAM,CAAC,CAAC,CAC3CC,QAAQ,CAAC,CAAC,CACVC,KAAK,CACJJ,oBAAoB,CAACO,qBAAqB,EAC1CP,oBAAoB,CAACQ,YAAY,EACjCX,aAAa,CAACY,cAAc,EAC5BZ,aAAa,CAACa,oBAAoB,EAClCb,aAAa,CAACc,eAAe,EAC7Bd,aAAa,CAACe,iBAAiB,EAC/BZ,oBAAoB,CAACa,YAAY,EACjChB,aAAa,CAACiB,UAAU,EACxBjB,aAAa,CAACkB,eAAe,EAC7BlB,aAAa,CAACmB,WAAW,EACzBnB,aAAa,CAACoB,iBAChB,CAAC,CACAZ,WAAW,CAAC,0DAA0D,CAAC;AAE1E,OAAO,MAAMa,sBAAsB,GAAGtB,GAAG,CAACM,MAAM,CAAC,CAAC,CAC/CC,QAAQ,CAAC,CAAC,CACVC,KAAK,CACJP,aAAa,CAACsB,SAAS,EACvBt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AEA;AACA,OAAO,MAAME,6BAA6B,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["Joi","ComponentType","MAX_NUMBER_OF_REPEAT_ITEMS","MIN_NUMBER_OF_REPEAT_ITEMS","QuestionTypeSubGroup","pageTypeSchema","string","required","valid","description","questionTypeSchema","WrittenAnswerSubGroup","DateSubGroup","LocationSubGroup","UkAddressField","TelephoneNumberField","FileUploadField","EmailAddressField","ListSubGroup","YesNoField","CheckboxesField","RadiosField","AutocompleteField","questionTypeFullSchema","TextField","MultilineTextField","NumberField","DatePartsField","MonthYearField","SelectField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","writtenAnswerSubSchema","dateSubSchema","listSubSchema","locationSubSchema","nameSchema","trim","questionSchema","hintTextSchema","optional","allow","instructionTextSchema","questionOptionalSchema","listForQuestionSchema","listItemCountSchema","number","listItemsDataSchema","exactFilesSchema","empty","integer","min","max","minFilesSchema","maxFilesSchema","fileTypesSchema","array","items","single","default","documentTypesSchema","imageTypesSchema","tabularDataTypesSchema","enhancedActionSchema","radioIdSchema","radioTextSchema","radioHintSchema","radioValueSchema","shortDescriptionSchema","pageHeadingAndGuidanceSchema","pageHeadingSchema","guidanceTextSchema","exitPageSchema","boolean","repeaterSchema","minItemsSchema","maxItemsSchema","questionSetNameSchema","needDeclarationSchema","declarationTextSchema","minSchema","maxSchema","minLengthSchema","maxLengthSchema","maxFutureSchema","maxPastSchema","precisionSchema","prefixSchema","regexSchema","rowsSchema","suffixSchema","classesSchema","jsEnabledSchema","usePostcodeLookupSchema","customValidator","extend","joi","type","base","messages","coerce","from","method","value","helpers","rowSeparatorRule","schema","$_getRule","colSeparatorRule","keysRule","rowSeparator","args","rows","split","map","v","filter","Boolean","colSeparator","keys","coercedValue","row","reduce","acc","col","idx","_err","console","error","errors","rules","convert","alias","$_addRule","name","ref","assert","RegExp","message","Array","isArray","every","k","autoCompleteOptionsSchema","dsv","object","text","disallow","parent","unique","ignoreUndefined","questionDetailsFullSchema","formEditorInputPageKeys","pageType","questionType","formEditorInputPageSchema","formEditorInputheckAnswersSettingsKeys","declarationText","formEditorInputCheckAnswersSettingSchema","formEditorInputQuestionKeys","question","shortDescription","hintText","questionOptional","formEditorInputQuestionSchema","formEditorInputPageSettingsKeys","pageHeadingAndGuidance","pageHeading","guidanceText","formEditorInputPageSettingsSchema","govukFieldValueIsString","govukField","includes","govukFieldIsChecked","checkedValue","checked","allowedErrorTemplateFunctions"],"sources":["../../../../src/form/form-editor/index.ts"],"sourcesContent":["import Joi, { type ArraySchema, type GetRuleOptions } from 'joi'\n\nimport { ComponentType } from '~/src/components/enums.js'\nimport {\n MAX_NUMBER_OF_REPEAT_ITEMS,\n MIN_NUMBER_OF_REPEAT_ITEMS\n} from '~/src/form/form-definition/index.js'\nimport {\n type FormEditorInputCheckAnswersSettings,\n type FormEditorInputPage,\n type FormEditorInputPageSettings,\n type FormEditorInputQuestion,\n type GovukField,\n type GovukFieldQuestionOptional,\n type GovukFieldUsePostcodeLookup,\n type GovukStringField\n} from '~/src/form/form-editor/types.js'\n\nexport enum QuestionTypeSubGroup {\n WrittenAnswerSubGroup = 'writtenAnswerSub',\n DateSubGroup = 'dateSub',\n ListSubGroup = 'listSub',\n LocationSubGroup = 'locationSub'\n}\n\nexport const pageTypeSchema = Joi.string()\n .required()\n .valid('question', 'guidance')\n .description('Type of page - either a question page or guidance page')\n\nexport const questionTypeSchema = Joi.string()\n .required()\n .valid(\n QuestionTypeSubGroup.WrittenAnswerSubGroup,\n QuestionTypeSubGroup.DateSubGroup,\n QuestionTypeSubGroup.LocationSubGroup,\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n QuestionTypeSubGroup.ListSubGroup,\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField\n )\n .description('The high-level type of question, including grouped types')\n\nexport const questionTypeFullSchema = Joi.string()\n .required()\n .valid(\n ComponentType.TextField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField,\n ComponentType.DatePartsField,\n ComponentType.MonthYearField,\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField,\n ComponentType.EastingNorthingField,\n ComponentType.OsGridRefField,\n ComponentType.NationalGridFieldNumberField,\n ComponentType.LatLongField\n )\n .description('The specific component type to use for this question')\n\nexport const writtenAnswerSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.TextField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField\n )\n .description('Subtype for written answer questions')\n\nexport const dateSubSchema = Joi.string()\n .required()\n .valid(ComponentType.DatePartsField, ComponentType.MonthYearField)\n .description('Subtype for date-related questions')\n\nexport const listSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField\n )\n .description('Subtype for list-related questions')\n\nexport const locationSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.EastingNorthingField,\n ComponentType.OsGridRefField,\n ComponentType.NationalGridFieldNumberField,\n ComponentType.LatLongField\n )\n .description('Subtype for location-related questions')\n\nexport const nameSchema = Joi.string()\n .trim()\n .required()\n .description('Unique identifier for the field')\n\nexport const questionSchema = Joi.string()\n .trim()\n .required()\n .description('The question text displayed to the user')\n\nexport const hintTextSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Optional guidance text displayed below the question')\n\nexport const instructionTextSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Optional instruction text with markdown support to help users answer the question'\n )\n\nexport const questionOptionalSchema = Joi.string()\n .trim()\n .optional()\n .valid('', 'true')\n .description(\n 'Indicates whether a question is optional. Empty string or \"true\" values are accepted.'\n )\n\nexport const listForQuestionSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Unique identifier for the list used by the field')\n\nexport const listItemCountSchema = Joi.number()\n .optional()\n .description('Number of list items in the list used by the field')\n\nexport const listItemsDataSchema = Joi.string()\n .allow('')\n .description('List items in JSON format, such as for radios or checkboxes.')\n\nexport const exactFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Specifies the exact number of files required for upload. Must be between 1 and 25.'\n )\n\nexport const minFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Minimum number of files required for upload. Must be between 1 and 25.'\n )\n\nexport const maxFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Maximum number of files allowed for upload. Must be between 1 and 25.'\n )\n\nexport const fileTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed file types. Can be provided as a single value or an array.'\n )\n\nexport const documentTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed document types. Can be provided as a single value or an array.'\n )\n\nexport const imageTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed image types. Can be provided as a single value or an array.'\n )\n\nexport const tabularDataTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n\nexport const enhancedActionSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Action field that can include enhanced functionality')\n\nexport const radioIdSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Unique identifier for radio options')\n\nexport const radioTextSchema = Joi.string()\n .trim()\n .required()\n .description('The visible text shown next to radio options')\n\nexport const radioHintSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Optional hint text displayed with radio buttons to provide additional guidance'\n )\n\nexport const radioValueSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Array of allowed tabular data types. Can be provided as a single value or an array.'\n )\n\nexport const shortDescriptionSchema = Joi.string()\n .trim()\n .required()\n .description('Brief description of the question for internal use')\n\nexport const pageHeadingAndGuidanceSchema = Joi.string()\n .trim()\n .optional()\n .description('Combined heading and guidance for the page')\n\nexport const pageHeadingSchema = Joi.string()\n .trim()\n .required()\n .description('Main heading displayed at the top of the page')\n\nexport const guidanceTextSchema = Joi.string()\n .trim()\n .description('Guidance text to assist users in completing the page')\n\nexport const exitPageSchema = Joi.boolean()\n .default(false)\n .optional()\n .description('Determines if page is set as an Exit Page')\n\nexport const repeaterSchema = Joi.string()\n .trim()\n .optional()\n .description(\n 'Combined min/max items and question set name for the repeater page'\n )\n\nexport const minItemsSchema = Joi.number()\n .empty('')\n .min(MIN_NUMBER_OF_REPEAT_ITEMS)\n .description('The minimum number of repeater items')\n\nexport const maxItemsSchema = Joi.number()\n .empty('')\n .max(MAX_NUMBER_OF_REPEAT_ITEMS)\n .description('The maximum number of repeater items')\n\nexport const questionSetNameSchema = Joi.string()\n .trim()\n .description('The repeater question set name')\n\nexport const needDeclarationSchema = Joi.string()\n .trim()\n .required()\n .description('Whether a declaration is needed')\n\nexport const declarationTextSchema = Joi.string()\n .trim()\n .required()\n .description('Text of the declaration that users must agree to')\n\nexport const minSchema = Joi.number()\n .empty('')\n .integer()\n .description('Minimum value for numeric inputs')\n\nexport const maxSchema = Joi.number()\n .empty('')\n .integer()\n .description('Maximum value for numeric inputs')\n\nexport const minLengthSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Minimum character length for text inputs')\n\nexport const maxLengthSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Maximum character length for text inputs')\n\nexport const maxFutureSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Maximum days in the future allowed for date inputs')\n\nexport const maxPastSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Maximum days in the past allowed for date inputs')\n\nexport const precisionSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Decimal precision for numeric inputs')\n\nexport const prefixSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Text to display before the input (e.g., £)')\n\nexport const regexSchema = Joi.string()\n .optional()\n .allow('')\n .description('Regular expression pattern for validation')\n\nexport const rowsSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Number of rows for multiline text fields')\n\nexport const suffixSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Text to display after the input (e.g., kg)')\n\nexport const classesSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Custom CSS classes to apply to the component')\n\nexport const jsEnabledSchema = Joi.string()\n .trim()\n .optional()\n .allow('false', 'true')\n .description('Flag to show if Javascript is enabled or not')\n\nexport const usePostcodeLookupSchema = Joi.string()\n .trim()\n .optional()\n .valid('', 'true')\n .description(\n 'Indicates whether a UK address component supports postcode lookup. Empty string or \"true\" values are accepted.'\n )\n\ntype GenericRuleOptions<K extends string, T> = Omit<GetRuleOptions, 'args'> & {\n args: Record<K, T>\n}\n\ninterface DSLSchema<TSchema = Record<string, unknown>[]>\n extends ArraySchema<TSchema> {\n rowSeparator: (rowSep: string | RegExp) => DSLSchema<TSchema>\n row: (rowSep: string | RegExp) => DSLSchema<TSchema>\n colSeparator: (colSep: string | RegExp) => DSLSchema<TSchema>\n col: (colSep: string | RegExp) => DSLSchema<TSchema>\n keys: (keys: string[]) => DSLSchema<TSchema>\n}\n\ninterface CustomValidator extends Joi.Root {\n dsv<TSchema>(): DSLSchema<TSchema>\n}\n\nexport const customValidator = Joi.extend((joi: Joi.Root) => {\n return {\n type: 'dsv',\n base: joi.array(),\n messages: {\n 'dsv.invalid': 'Invalid parse string'\n },\n coerce: {\n from: 'string',\n method(value: string, helpers) {\n try {\n // Only called when prefs.convert is true\n // Rules\n const rowSeparatorRule = helpers.schema.$_getRule('rowSeparator') as\n | undefined\n | GenericRuleOptions<'rowSeparator', string | RegExp>\n const colSeparatorRule = helpers.schema.$_getRule('colSeparator') as\n | undefined\n | GenericRuleOptions<'colSeparator', string | RegExp>\n const keysRule = helpers.schema.$_getRule('keys') as\n | undefined\n | GenericRuleOptions<'keys', string[]>\n\n // Rows\n const rowSeparator = rowSeparatorRule?.args.rowSeparator ?? /\\r?\\n/\n const rows = value\n .split(rowSeparator)\n .map((v) => v.trim())\n .filter(Boolean)\n\n // Columns\n const colSeparator = colSeparatorRule?.args.colSeparator ?? ','\n const keys = keysRule?.args.keys ?? ['key', 'value']\n\n const coercedValue = rows.map((row) => {\n return row\n .split(colSeparator)\n .reduce<Record<string, string>>((acc, col, idx) => {\n return {\n ...acc,\n [keys[idx]]: col.trim()\n }\n }, {})\n })\n return { value: coercedValue }\n } catch (_err) {\n // eslint-disable-next-line no-console\n console.error(_err)\n return { value, errors: [helpers.error('dsv.invalid')] }\n }\n }\n },\n rules: {\n rowSeparator: {\n convert: true,\n alias: 'row',\n method(rowSeparator: string) {\n return this.$_addRule({\n name: 'rowSeparator',\n args: { rowSeparator }\n })\n },\n args: [\n {\n name: 'rowSeparator',\n ref: true,\n assert: (value) =>\n typeof value === 'string' || value instanceof RegExp,\n message: 'must be a string or regex'\n }\n ]\n },\n colSeparator: {\n convert: true,\n alias: 'col',\n method(colSeparator: string) {\n return this.$_addRule({\n name: 'colSeparator',\n args: { colSeparator }\n })\n },\n args: [\n {\n name: 'colSeparator',\n ref: true,\n assert: (value) =>\n typeof value === 'string' || value instanceof RegExp,\n message: 'must be a string or regex'\n }\n ]\n },\n keys: {\n convert: true,\n method(keys: string[]) {\n return this.$_addRule({ name: 'keys', args: { keys } })\n },\n args: [\n {\n name: 'keys',\n ref: true,\n assert: (value) =>\n Array.isArray(value) && value.every((k) => typeof k === 'string'),\n message: 'must be an array of strings'\n }\n ]\n }\n }\n }\n}) as CustomValidator\n\nexport const autoCompleteOptionsSchema = customValidator\n .dsv<{ text: string; value: string }[]>()\n .row(/\\r?\\n/)\n .col(':')\n .keys(['text', 'value'])\n .items(\n customValidator.object({\n text: customValidator.string().min(1).disallow('').required(),\n value: customValidator\n .string()\n .default((parent: { text: string; value?: string }) => parent.text)\n .min(1)\n .disallow('')\n })\n )\n .min(1)\n .unique('text')\n .unique('value', { ignoreUndefined: true })\n .required()\n\nexport const questionDetailsFullSchema = {\n autoCompleteOptionsSchema,\n classesSchema,\n documentTypesSchema,\n enhancedActionSchema,\n exactFilesSchema,\n fileTypesSchema,\n hintTextSchema,\n imageTypesSchema,\n instructionTextSchema,\n jsEnabledSchema,\n listForQuestionSchema,\n listItemCountSchema,\n listItemsDataSchema,\n maxFilesSchema,\n maxFutureSchema,\n maxLengthSchema,\n maxPastSchema,\n maxSchema,\n minFilesSchema,\n minLengthSchema,\n minSchema,\n nameSchema,\n precisionSchema,\n prefixSchema,\n questionOptionalSchema,\n questionSchema,\n questionTypeFullSchema,\n radioHintSchema,\n radioIdSchema,\n radioTextSchema,\n radioValueSchema,\n regexSchema,\n rowsSchema,\n shortDescriptionSchema,\n suffixSchema,\n tabularDataTypesSchema,\n usePostcodeLookupSchema\n}\n\nexport const formEditorInputPageKeys = {\n pageType: pageTypeSchema,\n questionType: questionTypeSchema\n}\n\n/**\n * Joi schema for `FormEditorInputPage` interface\n * @see {@link FormEditorInputPage}\n */\nexport const formEditorInputPageSchema = Joi.object<FormEditorInputPage>()\n .keys(formEditorInputPageKeys)\n .required()\n .description('Input schema for creating a new page in the form editor')\n\nexport const formEditorInputheckAnswersSettingsKeys = {\n declarationText: shortDescriptionSchema\n}\n\n/**\n * Joi schema for `FormEditorInputCheckAnswersSettings` interface\n * @see {@link FormEditorInputCheckAnswersSettings}\n */\nexport const formEditorInputCheckAnswersSettingSchema =\n Joi.object<FormEditorInputCheckAnswersSettings>()\n .keys(formEditorInputheckAnswersSettingsKeys)\n .required()\n .description('Configuration for the check-answers page')\n\nexport const formEditorInputQuestionKeys = {\n question: questionSchema,\n shortDescription: shortDescriptionSchema,\n hintText: hintTextSchema,\n questionOptional: questionOptionalSchema\n}\n\n/**\n * Joi schema for `FormEditorInputQuestion` interface\n * @see {@link FormEditorInputQuestion}\n */\nexport const formEditorInputQuestionSchema =\n Joi.object<FormEditorInputQuestion>()\n .keys(formEditorInputQuestionKeys)\n .required()\n .description(\n 'Input schema for creating or updating a question in the form editor'\n )\n\nexport const formEditorInputPageSettingsKeys = {\n pageHeadingAndGuidance: pageHeadingAndGuidanceSchema,\n pageHeading: pageHeadingSchema,\n guidanceText: guidanceTextSchema\n}\n\n/**\n * Joi schema for `FormEditorInputPageSettings` interface\n * @see {@link FormEditorInputPageSettings}\n */\nexport const formEditorInputPageSettingsSchema =\n Joi.object<FormEditorInputPageSettings>()\n .keys(formEditorInputPageSettingsKeys)\n .required()\n .description('Settings for page content and display in the form editor')\n\nexport function govukFieldValueIsString(\n govukField: GovukField\n): govukField is GovukStringField {\n return [\n 'question',\n 'hintText',\n 'shortDescription',\n 'autoCompleteOptions',\n 'classes',\n 'prefix',\n 'suffix'\n ].includes(`${govukField.name}`)\n}\n\nexport function govukFieldIsChecked(\n govukField: GovukField\n): govukField is GovukFieldQuestionOptional | GovukFieldUsePostcodeLookup {\n if (\n govukField.name !== 'questionOptional' &&\n govukField.name !== 'usePostcodeLookup'\n ) {\n return false\n }\n const checkedValue = govukField.items?.[0].checked\n return typeof checkedValue === 'boolean'\n}\n\n// A list of allowed template funtions for use within error message templates\nexport const allowedErrorTemplateFunctions = ['lowerFirst', 'capitalise']\n"],"mappings":"AAAA,OAAOA,GAAG,MAAiD,KAAK;AAEhE,SAASC,aAAa;AACtB,SACEC,0BAA0B,EAC1BC,0BAA0B;AAa5B,WAAYC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAOhC,OAAO,MAAMC,cAAc,GAAGL,GAAG,CAACM,MAAM,CAAC,CAAC,CACvCC,QAAQ,CAAC,CAAC,CACVC,KAAK,CA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;EACd;EACA,MAAMwC,YAAY,GAAGH,UAAU,CAAClH,KAAK,GAAG,CAAC,CAAC,CAACsH,OAAO;EAClD,OAAO,OAAOD,YAAY,KAAK,SAAS;AAC1C;;AAEA;AACA,OAAO,MAAME,6BAA6B,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/macros/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport {\n type DefaultComponent,\n type GovukFieldset\n} from '~/src/form/form-editor/preview/types.js'\nimport {\n type DateItem,\n type GovukField,\n type ListItemReadonly\n} from '~/src/form/form-editor/types.js'\n\nexport interface AppPreviewErrorPanelMacroErrorTemplate {\n advancedSettingsErrors: []\n baseErrors: { template: unknown; type: string }[]\n}\n\nexport interface AppPreviewErrorPanelMacro {\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n fieldDetails: {\n extraFields: GovukField[]\n basePageFields: GovukField[]\n }\n questionType: ComponentType\n}\n\nexport interface AppPreviewPanelTabsMacro {\n questionType: ComponentType\n previewPageUrl: string\n previewErrorsUrl: string\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n extraFields: GovukField[]\n basePageFields: GovukField[]\n}\n\nexport interface SelectAfterInput {\n afterInput: { html: string }\n}\nexport interface RadioAndCheckboxAfterInputs {\n afterInputs: { html: string }\n}\n\n// GDS components - Select uses afterInput, while Radio uses afterInputs\nexport type FormGroupAfterInput = SelectAfterInput | RadioAndCheckboxAfterInputs\n\nexport interface QuestionBaseModel {\n id?: string\n name?: string\n content?: string\n attributes?: Record<string, string>\n label?: DefaultComponent\n hint?: DefaultComponent\n fieldset?: GovukFieldset\n readonly items?: ListItemReadonly[] | DateItem[]\n text?: string\n formGroup?: FormGroupAfterInput\n type?: 'text' | 'number' | 'boolean'\n classes?: string\n}\n\nexport interface AppPreviewPanelMacro extends AppPreviewPanelTabsMacro {\n model: QuestionBaseModel\n}\n\nexport interface PagePreviewComponent {\n model: QuestionBaseModel\n questionType: ComponentType\n}\n\nexport interface PagePreviewPanelMacro {\n readonly pageTitle: {\n text: string\n classes: string\n }\n readonly guidance: {\n text: string\n classes: string\n }\n readonly components: PagePreviewComponent[]\n readonly sectionTitle?: {\n text: string\n classes: string\n }\n readonly repeaterButton?: {\n text: string\n classes: string\n }\n}\n\nexport interface SummaryRowActionItem {\n href: string\n text: string\n visuallyHiddenText: string\n}\n\nexport interface SummaryRow {\n key: { text: string }\n value: { text: string }\n actions: {\n items: SummaryRowActionItem[]\n }\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/macros/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport {\n type DefaultComponent,\n type GovukFieldset\n} from '~/src/form/form-editor/preview/types.js'\nimport {\n type DateItem,\n type GovukField,\n type ListItemReadonly\n} from '~/src/form/form-editor/types.js'\n\nexport interface AppPreviewErrorPanelMacroErrorTemplate {\n advancedSettingsErrors: []\n baseErrors: { template: unknown; type: string }[]\n}\n\nexport interface AppPreviewErrorPanelMacro {\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n fieldDetails: {\n extraFields: GovukField[]\n basePageFields: GovukField[]\n }\n questionType: ComponentType\n}\n\nexport interface AppPreviewPanelTabsMacro {\n questionType: ComponentType\n previewPageUrl: string\n previewErrorsUrl: string\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n extraFields: GovukField[]\n basePageFields: GovukField[]\n}\n\nexport interface SelectAfterInput {\n afterInput: { html: string }\n}\nexport interface RadioAndCheckboxAfterInputs {\n afterInputs: { html: string }\n}\n\n// GDS components - Select uses afterInput, while Radio uses afterInputs\nexport type FormGroupAfterInput = SelectAfterInput | RadioAndCheckboxAfterInputs\n\nexport interface QuestionBaseModel {\n id?: string\n name?: string\n content?: string\n attributes?: Record<string, string>\n label?: DefaultComponent\n hint?: DefaultComponent\n fieldset?: GovukFieldset\n readonly items?: ListItemReadonly[] | DateItem[]\n text?: string\n formGroup?: FormGroupAfterInput\n type?: 'text' | 'number' | 'boolean'\n classes?: string\n previewClasses?: string\n prefix?: { text: string }\n suffix?: { text: string }\n}\n\nexport interface AppPreviewPanelMacro extends AppPreviewPanelTabsMacro {\n model: QuestionBaseModel\n}\n\nexport interface PagePreviewComponent {\n model: QuestionBaseModel\n questionType: ComponentType\n}\n\nexport interface PagePreviewPanelMacro {\n readonly pageTitle: {\n text: string\n classes: string\n }\n readonly guidance: {\n text: string\n classes: string\n }\n readonly components: PagePreviewComponent[]\n readonly sectionTitle?: {\n text: string\n classes: string\n }\n readonly repeaterButton?: {\n text: string\n classes: string\n }\n}\n\nexport interface SummaryRowActionItem {\n href: string\n text: string\n visuallyHiddenText: string\n}\n\nexport interface SummaryRow {\n key: { text: string }\n value: { text: string }\n actions: {\n items: SummaryRowActionItem[]\n }\n}\n"],"mappings":"","ignoreList":[]}
@@ -25,6 +25,7 @@ export class ComponentElements {
25
25
  hintText: '',
26
26
  optional: !required,
27
27
  shortDesc: '',
28
+ userClasses: this._component.options && 'classes' in this._component.options ? this._component.options.classes ?? '' : '',
28
29
  items: [],
29
30
  content: ''
30
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"component-elements.js","names":["ComponentElements","_component","constructor","component","_getValues","required","options","question","title","hintText","optional","shortDesc","items","content","values","setPreviewDOM","_element","Error","setPreviewHTML","_value"],"sources":["../../../../../src/form/form-editor/preview/component-elements.js"],"sourcesContent":["/**\n * @implements {QuestionElements}\n */\nexport class ComponentElements {\n /**\n * @type {ComponentDef}\n * @protected\n */\n _component\n /**\n * @param {ComponentDef} component\n */\n constructor(component) {\n this._component = component\n }\n\n /**\n * @protected\n * @returns {BaseSettings}\n */\n _getValues() {\n const required = this._component.options?.required ?? true\n\n return {\n question: this._component.title,\n hintText: '',\n optional: !required,\n shortDesc: '',\n items: [],\n content: ''\n }\n }\n\n /**\n * @returns {BaseSettings}\n */\n get values() {\n const values = this._getValues()\n return values\n }\n\n /**\n * @param {HTMLElement} _element\n */\n setPreviewDOM(_element) {\n throw new Error('Not implemented')\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n throw new Error('Not implemented')\n }\n}\n\n/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { FormComponentsDef, ContentComponentsDef, ComponentDef } from '~/src/components/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,MAAMA,iBAAiB,CAAC;EAC7B;AACF;AACA;AACA;EACEC,UAAU;EACV;AACF;AACA;EACEC,WAAWA,CAACC,SAAS,EAAE;IACrB,IAAI,CAACF,UAAU,GAAGE,SAAS;EAC7B;;EAEA;AACF;AACA;AACA;EACEC,UAAUA,CAAA,EAAG;IACX,MAAMC,QAAQ,GAAG,IAAI,CAACJ,UAAU,CAACK,OAAO,EAAED,QAAQ,IAAI,IAAI;IAE1D,OAAO;MACLE,QAAQ,EAAE,IAAI,CAACN,UAAU,CAACO,KAAK;MAC/BC,QAAQ,EAAE,EAAE;MACZC,QAAQ,EAAE,CAACL,QAAQ;MACnBM,SAAS,EAAE,EAAE;MACbC,KAAK,EAAE,EAAE;MACTC,OAAO,EAAE;IACX,CAAC;EACH;;EAEA;AACF;AACA;EACE,IAAIC,MAAMA,CAAA,EAAG;IACX,MAAMA,MAAM,GAAG,IAAI,CAACV,UAAU,CAAC,CAAC;IAChC,OAAOU,MAAM;EACf;;EAEA;AACF;AACA;EACEC,aAAaA,CAACC,QAAQ,EAAE;IACtB,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;EACpC;;EAEA;AACF;AACA;EACEC,cAAcA,CAACC,MAAM,EAAE;IACrB,MAAM,IAAIF,KAAK,CAAC,iBAAiB,CAAC;EACpC;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"component-elements.js","names":["ComponentElements","_component","constructor","component","_getValues","required","options","question","title","hintText","optional","shortDesc","userClasses","classes","items","content","values","setPreviewDOM","_element","Error","setPreviewHTML","_value"],"sources":["../../../../../src/form/form-editor/preview/component-elements.js"],"sourcesContent":["/**\n * @implements {QuestionElements}\n */\nexport class ComponentElements {\n /**\n * @type {ComponentDef}\n * @protected\n */\n _component\n /**\n * @param {ComponentDef} component\n */\n constructor(component) {\n this._component = component\n }\n\n /**\n * @protected\n * @returns {BaseSettings}\n */\n _getValues() {\n const required = this._component.options?.required ?? true\n\n return {\n question: this._component.title,\n hintText: '',\n optional: !required,\n shortDesc: '',\n userClasses:\n this._component.options && 'classes' in this._component.options\n ? (this._component.options.classes ?? '')\n : '',\n items: [],\n content: ''\n }\n }\n\n /**\n * @returns {BaseSettings}\n */\n get values() {\n const values = this._getValues()\n return values\n }\n\n /**\n * @param {HTMLElement} _element\n */\n setPreviewDOM(_element) {\n throw new Error('Not implemented')\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n throw new Error('Not implemented')\n }\n}\n\n/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { FormComponentsDef, ContentComponentsDef, ComponentDef } from '~/src/components/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,MAAMA,iBAAiB,CAAC;EAC7B;AACF;AACA;AACA;EACEC,UAAU;EACV;AACF;AACA;EACEC,WAAWA,CAACC,SAAS,EAAE;IACrB,IAAI,CAACF,UAAU,GAAGE,SAAS;EAC7B;;EAEA;AACF;AACA;AACA;EACEC,UAAUA,CAAA,EAAG;IACX,MAAMC,QAAQ,GAAG,IAAI,CAACJ,UAAU,CAACK,OAAO,EAAED,QAAQ,IAAI,IAAI;IAE1D,OAAO;MACLE,QAAQ,EAAE,IAAI,CAACN,UAAU,CAACO,KAAK;MAC/BC,QAAQ,EAAE,EAAE;MACZC,QAAQ,EAAE,CAACL,QAAQ;MACnBM,SAAS,EAAE,EAAE;MACbC,WAAW,EACT,IAAI,CAACX,UAAU,CAACK,OAAO,IAAI,SAAS,IAAI,IAAI,CAACL,UAAU,CAACK,OAAO,GAC1D,IAAI,CAACL,UAAU,CAACK,OAAO,CAACO,OAAO,IAAI,EAAE,GACtC,EAAE;MACRC,KAAK,EAAE,EAAE;MACTC,OAAO,EAAE;IACX,CAAC;EACH;;EAEA;AACF;AACA;EACE,IAAIC,MAAMA,CAAA,EAAG;IACX,MAAMA,MAAM,GAAG,IAAI,CAACZ,UAAU,CAAC,CAAC;IAChC,OAAOY,MAAM;EACf;;EAEA;AACF;AACA;EACEC,aAAaA,CAACC,QAAQ,EAAE;IACtB,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;EACpC;;EAEA;AACF;AACA;EACEC,cAAcA,CAACC,MAAM,EAAE;IACrB,MAAM,IAAIF,KAAK,CAAC,iBAAiB,CAAC;EACpC;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -10,7 +10,7 @@ import { ListComponentElements, ListQuestion, SelectComponentElements } from "./
10
10
  import { LongAnswerQuestion } from "./long-answer.js";
11
11
  import { Markdown } from "./markdown.js";
12
12
  import { MonthYearQuestion } from "./month-year.js";
13
- import { NumberOnlyQuestion } from "./number-only.js";
13
+ import { NumberComponentPreviewElements, NumberOnlyQuestion } from "./number-only.js";
14
14
  import { PhoneNumberQuestion } from "./phone-number.js";
15
15
  import { QuestionComponentElements } from "./question.js";
16
16
  import { RadioQuestion } from "./radio.js";
@@ -42,7 +42,11 @@ const InputFieldComponentDictionary = {
42
42
  [ComponentType.CheckboxesField]: CheckboxQuestion,
43
43
  [ComponentType.SelectField]: SelectQuestion,
44
44
  [ComponentType.YesNoField]: YesNoQuestion,
45
- [ComponentType.FileUploadField]: SupportingEvidenceQuestion
45
+ [ComponentType.FileUploadField]: SupportingEvidenceQuestion,
46
+ [ComponentType.EastingNorthingField]: ShortAnswerQuestion,
47
+ [ComponentType.OsGridRefField]: ShortAnswerQuestion,
48
+ [ComponentType.NationalGridFieldNumberField]: ShortAnswerQuestion,
49
+ [ComponentType.LatLongField]: ShortAnswerQuestion
46
50
  };
47
51
 
48
52
  /**
@@ -61,6 +65,8 @@ export function mapComponentToPreviewQuestion(questionRenderer, definition) {
61
65
  questionElements = new SelectComponentElements(component, list);
62
66
  } else if (component.type === ComponentType.UkAddressField) {
63
67
  questionElements = new UkAddressComponentPreviewElements(component);
68
+ } else if (component.type === ComponentType.NumberField) {
69
+ questionElements = new NumberComponentPreviewElements(component);
64
70
  } else if (hasSelectionFields(component) && hasListField(component)) {
65
71
  const list = findDefinitionListFromComponent(component, definition);
66
72
  questionElements = new ListComponentElements(component, list);
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","names":["ComponentType","hasContentField","hasInputField","hasListField","hasSelectionFields","AutocompleteListQuestion","CheckboxQuestion","ComponentElements","ContentElements","DateInputQuestion","EmailAddressQuestion","ListComponentElements","ListQuestion","SelectComponentElements","LongAnswerQuestion","Markdown","MonthYearQuestion","NumberOnlyQuestion","PhoneNumberQuestion","QuestionComponentElements","RadioQuestion","SelectQuestion","ShortAnswerQuestion","SupportingEvidenceQuestion","UkAddressComponentPreviewElements","UkAddressQuestion","YesNoQuestion","findDefinitionListFromComponent","InputFieldComponentDictionary","TextField","Details","InsetText","Html","List","EmailAddressField","NumberField","MultilineTextField","TelephoneNumberField","MonthYearField","DatePartsField","UkAddressField","AutocompleteField","RadiosField","CheckboxesField","SelectField","YesNoField","FileUploadField","mapComponentToPreviewQuestion","questionRenderer","definition","component","questionElements","type","list","QuestionConstructor","previewComponent","id"],"sources":["../../../../../src/form/form-editor/preview/helpers.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n hasContentField,\n hasInputField,\n hasListField,\n hasSelectionFields\n} from '~/src/components/helpers.js'\nimport { AutocompleteListQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { CheckboxQuestion } from '~/src/form/form-editor/preview/checkbox.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { ContentElements } from '~/src/form/form-editor/preview/content.js'\nimport { DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport {\n ListComponentElements,\n ListQuestion,\n SelectComponentElements\n} from '~/src/form/form-editor/preview/list.js'\nimport { LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { Markdown } from '~/src/form/form-editor/preview/markdown.js'\nimport { MonthYearQuestion } from '~/src/form/form-editor/preview/month-year.js'\nimport { NumberOnlyQuestion } from '~/src/form/form-editor/preview/number-only.js'\nimport { PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { QuestionComponentElements } from '~/src/form/form-editor/preview/question.js'\nimport { RadioQuestion } from '~/src/form/form-editor/preview/radio.js'\nimport { SelectQuestion } from '~/src/form/form-editor/preview/select.js'\nimport { ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { SupportingEvidenceQuestion } from '~/src/form/form-editor/preview/supporting-evidence.js'\nimport {\n UkAddressComponentPreviewElements,\n UkAddressQuestion\n} from '~/src/form/form-editor/preview/uk-address.js'\nimport { YesNoQuestion } from '~/src/form/form-editor/preview/yes-no.js'\nimport { findDefinitionListFromComponent } from '~/src/form/utils/list.js'\n/**\n * @type {Record<ComponentType, typeof PreviewComponent>}\n */\nconst InputFieldComponentDictionary = {\n [ComponentType.TextField]: ShortAnswerQuestion,\n [ComponentType.Details]: ShortAnswerQuestion,\n [ComponentType.InsetText]: ShortAnswerQuestion,\n [ComponentType.Html]: ShortAnswerQuestion,\n [ComponentType.Markdown]: Markdown,\n [ComponentType.List]: ListQuestion,\n [ComponentType.EmailAddressField]: EmailAddressQuestion,\n [ComponentType.NumberField]: NumberOnlyQuestion,\n [ComponentType.MultilineTextField]: LongAnswerQuestion,\n [ComponentType.TelephoneNumberField]: PhoneNumberQuestion,\n [ComponentType.MonthYearField]: MonthYearQuestion,\n [ComponentType.DatePartsField]: DateInputQuestion,\n [ComponentType.UkAddressField]: UkAddressQuestion,\n [ComponentType.AutocompleteField]: AutocompleteListQuestion,\n [ComponentType.RadiosField]: RadioQuestion,\n [ComponentType.CheckboxesField]: CheckboxQuestion,\n [ComponentType.SelectField]: SelectQuestion,\n [ComponentType.YesNoField]: YesNoQuestion,\n [ComponentType.FileUploadField]: SupportingEvidenceQuestion\n}\n\n/**\n * @param {QuestionRenderer} questionRenderer\n * @param {FormDefinition} definition\n * @returns {(component: ComponentDef) => Question}\n */\nexport function mapComponentToPreviewQuestion(questionRenderer, definition) {\n return /** @type {(component: ComponentDef) => Question} */ (\n (component) => {\n /**\n * @type {QuestionElements}\n */\n let questionElements\n\n if (\n component.type === ComponentType.AutocompleteField ||\n component.type === ComponentType.SelectField\n ) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new SelectComponentElements(component, list)\n } else if (component.type === ComponentType.UkAddressField) {\n questionElements = new UkAddressComponentPreviewElements(component)\n } else if (hasSelectionFields(component) && hasListField(component)) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new ListComponentElements(component, list)\n } else if (\n hasInputField(component) ||\n component.type === ComponentType.YesNoField\n ) {\n questionElements = new QuestionComponentElements(component)\n } else if (hasContentField(component)) {\n questionElements = new ContentElements(component)\n } else {\n questionElements = new ComponentElements(component)\n }\n\n const QuestionConstructor = InputFieldComponentDictionary[component.type]\n\n const previewComponent = new QuestionConstructor(\n questionElements,\n questionRenderer\n )\n previewComponent.id = component.id\n return previewComponent\n }\n )\n}\n\n/**\n * @import { QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { Question } from '~/src/form/form-editor/preview/question.js'\n * @import { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n * @import { FormDefinition } from '~/src/form/form-definition/types.js'\n * @import { ComponentDef } from '~/src/components/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SACEC,eAAe,EACfC,aAAa,EACbC,YAAY,EACZC,kBAAkB;AAEpB,SAASC,wBAAwB;AACjC,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAC1B,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,oBAAoB;AAC7B,SACEC,qBAAqB,EACrBC,YAAY,EACZC,uBAAuB;AAEzB,SAASC,kBAAkB;AAC3B,SAASC,QAAQ;AACjB,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB;AAC3B,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,CAAC5B,aAAa,CAAC6B,SAAS,GAAGP,mBAAmB;EAC9C,CAACtB,aAAa,CAAC8B,OAAO,GAAGR,mBAAmB;EAC5C,CAACtB,aAAa,CAAC+B,SAAS,GAAGT,mBAAmB;EAC9C,CAACtB,aAAa,CAACgC,IAAI,GAAGV,mBAAmB;EACzC,CAACtB,aAAa,CAACe,QAAQ,GAAGA,QAAQ;EAClC,CAACf,aAAa,CAACiC,IAAI,GAAGrB,YAAY;EAClC,CAACZ,aAAa,CAACkC,iBAAiB,GAAGxB,oBAAoB;EACvD,CAACV,aAAa,CAACmC,WAAW,GAAGlB,kBAAkB;EAC/C,CAACjB,aAAa,CAACoC,kBAAkB,GAAGtB,kBAAkB;EACtD,CAACd,aAAa,CAACqC,oBAAoB,GAAGnB,mBAAmB;EACzD,CAAClB,aAAa,CAACsC,cAAc,GAAGtB,iBAAiB;EACjD,CAAChB,aAAa,CA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IAAI,KAAKpD,aAAa,CAAC6C,UAAU,EAC3C;MACAM,gBAAgB,GAAG,IAAIhC,yBAAyB,CAAC+B,SAAS,CAAC;IAC7D,CAAC,MAAM,IAAIjD,eAAe,CAACiD,SAAS,CAAC,EAAE;MACrCC,gBAAgB,GAAG,IAAI3C,eAAe,CAAC0C,SAAS,CAAC;IACnD,CAAC,MAAM;MACLC,gBAAgB,GAAG,IAAI5C,iBAAiB,CAAC2C,SAAS,CAAC;IACrD;IAEA,MAAMI,mBAAmB,GAAG1B,6BAA6B,CAACsB,SAAS,CAACE,IAAI,CAAC;IAEzE,MAAMG,gBAAgB,GAAG,IAAID,mBAAmB,CAC9CH,gBAAgB,EAChBH,gBACF,CAAC;IACDO,gBAAgB,CAACC,EAAE,GAAGN,SAAS,CAACM,EAAE;IAClC,OAAOD,gBAAgB;EACzB,CAAC;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"helpers.js","names":["ComponentType","hasContentField","hasInputField","hasListField","hasSelectionFields","AutocompleteListQuestion","CheckboxQuestion","ComponentElements","ContentElements","DateInputQuestion","EmailAddressQuestion","ListComponentElements","ListQuestion","SelectComponentElements","LongAnswerQuestion","Markdown","MonthYearQuestion","NumberComponentPreviewElements","NumberOnlyQuestion","PhoneNumberQuestion","QuestionComponentElements","RadioQuestion","SelectQuestion","ShortAnswerQuestion","SupportingEvidenceQuestion","UkAddressComponentPreviewElements","UkAddressQuestion","YesNoQuestion","findDefinitionListFromComponent","InputFieldComponentDictionary","TextField","Details","InsetText","Html","List","EmailAddressField","NumberField","MultilineTextField","TelephoneNumberField","MonthYearField","DatePartsField","UkAddressField","AutocompleteField","RadiosField","CheckboxesField","SelectField","YesNoField","FileUploadField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","mapComponentToPreviewQuestion","questionRenderer","definition","component","questionElements","type","list","QuestionConstructor","previewComponent","id"],"sources":["../../../../../src/form/form-editor/preview/helpers.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n hasContentField,\n hasInputField,\n hasListField,\n hasSelectionFields\n} from '~/src/components/helpers.js'\nimport { AutocompleteListQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { CheckboxQuestion } from '~/src/form/form-editor/preview/checkbox.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { ContentElements } from '~/src/form/form-editor/preview/content.js'\nimport { DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport {\n ListComponentElements,\n ListQuestion,\n SelectComponentElements\n} from '~/src/form/form-editor/preview/list.js'\nimport { LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { Markdown } from '~/src/form/form-editor/preview/markdown.js'\nimport { MonthYearQuestion } from '~/src/form/form-editor/preview/month-year.js'\nimport {\n NumberComponentPreviewElements,\n NumberOnlyQuestion\n} from '~/src/form/form-editor/preview/number-only.js'\nimport { PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { QuestionComponentElements } from '~/src/form/form-editor/preview/question.js'\nimport { RadioQuestion } from '~/src/form/form-editor/preview/radio.js'\nimport { SelectQuestion } from '~/src/form/form-editor/preview/select.js'\nimport { ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { SupportingEvidenceQuestion } from '~/src/form/form-editor/preview/supporting-evidence.js'\nimport {\n UkAddressComponentPreviewElements,\n UkAddressQuestion\n} from '~/src/form/form-editor/preview/uk-address.js'\nimport { YesNoQuestion } from '~/src/form/form-editor/preview/yes-no.js'\nimport { findDefinitionListFromComponent } from '~/src/form/utils/list.js'\n/**\n * @type {Record<ComponentType, typeof PreviewComponent>}\n */\nconst InputFieldComponentDictionary = {\n [ComponentType.TextField]: ShortAnswerQuestion,\n [ComponentType.Details]: ShortAnswerQuestion,\n [ComponentType.InsetText]: ShortAnswerQuestion,\n [ComponentType.Html]: ShortAnswerQuestion,\n [ComponentType.Markdown]: Markdown,\n [ComponentType.List]: ListQuestion,\n [ComponentType.EmailAddressField]: EmailAddressQuestion,\n [ComponentType.NumberField]: NumberOnlyQuestion,\n [ComponentType.MultilineTextField]: LongAnswerQuestion,\n [ComponentType.TelephoneNumberField]: PhoneNumberQuestion,\n [ComponentType.MonthYearField]: MonthYearQuestion,\n [ComponentType.DatePartsField]: DateInputQuestion,\n [ComponentType.UkAddressField]: UkAddressQuestion,\n [ComponentType.AutocompleteField]: AutocompleteListQuestion,\n [ComponentType.RadiosField]: RadioQuestion,\n [ComponentType.CheckboxesField]: CheckboxQuestion,\n [ComponentType.SelectField]: SelectQuestion,\n [ComponentType.YesNoField]: YesNoQuestion,\n [ComponentType.FileUploadField]: SupportingEvidenceQuestion,\n [ComponentType.EastingNorthingField]: ShortAnswerQuestion,\n [ComponentType.OsGridRefField]: ShortAnswerQuestion,\n [ComponentType.NationalGridFieldNumberField]: ShortAnswerQuestion,\n [ComponentType.LatLongField]: ShortAnswerQuestion\n}\n\n/**\n * @param {QuestionRenderer} questionRenderer\n * @param {FormDefinition} definition\n * @returns {(component: ComponentDef) => Question}\n */\nexport function mapComponentToPreviewQuestion(questionRenderer, definition) {\n return /** @type {(component: ComponentDef) => Question} */ (\n (component) => {\n /**\n * @type {QuestionElements}\n */\n let questionElements\n\n if (\n component.type === ComponentType.AutocompleteField ||\n component.type === ComponentType.SelectField\n ) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new SelectComponentElements(component, list)\n } else if (component.type === ComponentType.UkAddressField) {\n questionElements = new UkAddressComponentPreviewElements(component)\n } else if (component.type === ComponentType.NumberField) {\n questionElements = new NumberComponentPreviewElements(component)\n } else if (hasSelectionFields(component) && hasListField(component)) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new ListComponentElements(component, list)\n } else if (\n hasInputField(component) ||\n component.type === ComponentType.YesNoField\n ) {\n questionElements = new QuestionComponentElements(component)\n } else if (hasContentField(component)) {\n questionElements = new ContentElements(component)\n } else {\n questionElements = new ComponentElements(component)\n }\n\n const QuestionConstructor = InputFieldComponentDictionary[component.type]\n\n const previewComponent = new QuestionConstructor(\n questionElements,\n questionRenderer\n )\n previewComponent.id = component.id\n return previewComponent\n }\n )\n}\n\n/**\n * @import { QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { Question } from '~/src/form/form-editor/preview/question.js'\n * @import { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n * @import { FormDefinition } from '~/src/form/form-definition/types.js'\n * @import { ComponentDef } from '~/src/components/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SACEC,eAAe,EACfC,aAAa,EACbC,YAAY,EACZC,kBAAkB;AAEpB,SAASC,wBAAwB;AACjC,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAC1B,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,oBAAoB;AAC7B,SACEC,qBAAqB,EACrBC,YAAY,EACZC,uBAAuB;AAEzB,SAASC,kBAAkB;AAC3B,SAASC,QAAQ;AACjB,SAASC,iBAAiB;AAC1B,SACEC,8BAA8B,EAC9BC,kBAAkB;AAEpB,SAASC,mBAAmB;AAC5B,SAASC,yBAAyB;AAClC,SAASC,aAAa;AACtB,SAASC,cAAc;AACvB,SAASC,mBAAmB;AAC5B,SAASC,0BAA0B;AACnC,SACEC,iCAAiC,EACjCC,iBAAiB;AAEnB,SAASC,aAAa;AACtB,SAASC,+BAA+B;AACxC;AACA;AACA;AACA,MAAMC,6BAA6B,GAAG;EACpC,CAAC7B,aAAa,CAAC8B,SAAS,GAAGP,mBAAmB;EAC9C,CAACvB,aAAa,CAAC+B,OAAO,GAAGR,mBAAmB;EAC5C,CAACvB,aAAa,CAACgC,SAAS,GAAGT,mBAAmB;EAC9C,CAACvB,aAAa,CAACiC,IAAI,GAAGV,mBAAmB;EACzC,CAACvB,aAAa,CAACe,QAAQ,GAAGA,QAAQ;EAClC,CAAC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List":[]}
@@ -1,5 +1,31 @@
1
1
  import { ComponentType } from "../../../components/enums.js";
2
- import { Question } from "./question.js";
2
+ import { Question, QuestionComponentElements } from "./question.js";
3
+
4
+ /**
5
+ * @implements {QuestionElements}
6
+ */
7
+ export class NumberComponentPreviewElements extends QuestionComponentElements {
8
+ /**
9
+ * @param {NumberFieldComponent} component
10
+ */
11
+ constructor(component) {
12
+ super(component);
13
+ this._prefix = component.options.prefix;
14
+ this._suffix = component.options.suffix;
15
+ }
16
+
17
+ /**
18
+ * @protected
19
+ * @returns {NumberSettings}
20
+ */
21
+ _getValues() {
22
+ return {
23
+ ...super._getValues(),
24
+ prefix: this._prefix ?? '',
25
+ suffix: this._suffix ?? ''
26
+ };
27
+ }
28
+ }
3
29
  export class NumberOnlyQuestion extends Question {
4
30
  /**
5
31
  * @type {ComponentType}
@@ -7,12 +33,14 @@ export class NumberOnlyQuestion extends Question {
7
33
  componentType = ComponentType.NumberField;
8
34
 
9
35
  /**
10
- * @param {QuestionElements} htmlElements
36
+ * @param {NumberElements} htmlElements
11
37
  * @param {QuestionRenderer} questionRenderer
12
38
  */
13
39
  constructor(htmlElements, questionRenderer) {
14
40
  super(htmlElements, questionRenderer);
15
41
  this._fieldName = 'numberField';
42
+ this._prefix = htmlElements.values.prefix;
43
+ this._suffix = htmlElements.values.suffix;
16
44
  }
17
45
 
18
46
  /**
@@ -23,9 +51,53 @@ export class NumberOnlyQuestion extends Question {
23
51
  type: 'number'
24
52
  };
25
53
  }
54
+ get prefix() {
55
+ return this._prefix;
56
+ }
57
+
58
+ /**
59
+ * @param {string} val
60
+ */
61
+ set prefix(val) {
62
+ this._prefix = val;
63
+ this.render();
64
+ }
65
+ get suffix() {
66
+ return this._suffix;
67
+ }
68
+
69
+ /**
70
+ * @param {string} val
71
+ */
72
+ set suffix(val) {
73
+ this._suffix = val;
74
+ this.render();
75
+ }
76
+
77
+ /**
78
+ * @protected
79
+ */
80
+ _renderInput() {
81
+ const prefixObj = this.prefix ? {
82
+ prefix: {
83
+ text: this.prefix
84
+ }
85
+ } : {};
86
+ const suffixObj = this.suffix ? {
87
+ suffix: {
88
+ text: this.suffix
89
+ }
90
+ } : {};
91
+ return {
92
+ ...super._renderInput(),
93
+ ...prefixObj,
94
+ ...suffixObj
95
+ };
96
+ }
26
97
  }
27
98
 
28
99
  /**
29
- * @import { QuestionElements, QuestionBaseModel, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'
100
+ * @import { NumberSettings, NumberElements, QuestionBaseModel, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'
101
+ * @import { NumberFieldComponent } from '~/src/components/types.js'
30
102
  */
31
103
  //# sourceMappingURL=number-only.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"number-only.js","names":["ComponentType","Question","NumberOnlyQuestion","componentType","NumberField","constructor","htmlElements","questionRenderer","_fieldName","customRenderFields","type"],"sources":["../../../../../src/form/form-editor/preview/number-only.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class NumberOnlyQuestion extends Question {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.NumberField\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n super(htmlElements, questionRenderer)\n this._fieldName = 'numberField'\n }\n\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n return {\n type: 'number'\n }\n }\n}\n\n/**\n * @import { QuestionElements, QuestionBaseModel, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,QAAQ;AAEjB,OAAO,MAAMC,kBAAkB,SAASD,QAAQ,CAAC;EAC/C;AACF;AACA;EACEE,aAAa,GAAGH,aAAa,CAACI,WAAW;;EAEzC;AACF;AACA;AACA;EACEC,WAAWA,CAACC,YAAY,EAAEC,gBAAgB,EAAE;IAC1C,KAAK,CAACD,YAAY,EAAEC,gBAAgB,CAAC;IACrC,IAAI,CAACC,UAAU,GAAG,aAAa;EACjC;;EAEA;AACF;AACA;EACE,IAAIC,kBAAkBA,CAAA,EAAG;IACvB,OAAO;MACLC,IAAI,EAAE;IACR,CAAC;EACH;AACF;;AAEA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"number-only.js","names":["ComponentType","Question","QuestionComponentElements","NumberComponentPreviewElements","constructor","component","_prefix","options","prefix","_suffix","suffix","_getValues","NumberOnlyQuestion","componentType","NumberField","htmlElements","questionRenderer","_fieldName","values","customRenderFields","type","val","render","_renderInput","prefixObj","text","suffixObj"],"sources":["../../../../../src/form/form-editor/preview/number-only.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n Question,\n QuestionComponentElements\n} from '~/src/form/form-editor/preview/question.js'\n\n/**\n * @implements {QuestionElements}\n */\nexport class NumberComponentPreviewElements extends QuestionComponentElements {\n /**\n * @param {NumberFieldComponent} component\n */\n constructor(component) {\n super(component)\n this._prefix = component.options.prefix\n this._suffix = component.options.suffix\n }\n\n /**\n * @protected\n * @returns {NumberSettings}\n */\n _getValues() {\n return {\n ...super._getValues(),\n prefix: this._prefix ?? '',\n suffix: this._suffix ?? ''\n }\n }\n}\n\nexport class NumberOnlyQuestion extends Question {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.NumberField\n\n /**\n * @param {NumberElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n super(htmlElements, questionRenderer)\n this._fieldName = 'numberField'\n this._prefix = htmlElements.values.prefix\n this._suffix = htmlElements.values.suffix\n }\n\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n return {\n type: 'number'\n }\n }\n\n get prefix() {\n return this._prefix\n }\n\n /**\n * @param {string} val\n */\n set prefix(val) {\n this._prefix = val\n this.render()\n }\n\n get suffix() {\n return this._suffix\n }\n\n /**\n * @param {string} val\n */\n set suffix(val) {\n this._suffix = val\n this.render()\n }\n\n /**\n * @protected\n */\n _renderInput() {\n const prefixObj = this.prefix ? { prefix: { text: this.prefix } } : {}\n const suffixObj = this.suffix ? { suffix: { text: this.suffix } } : {}\n return {\n ...super._renderInput(),\n ...prefixObj,\n ...suffixObj\n }\n }\n}\n\n/**\n * @import { NumberSettings, NumberElements, QuestionBaseModel, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { NumberFieldComponent } from '~/src/components/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SACEC,QAAQ,EACRC,yBAAyB;;AAG3B;AACA;AACA;AACA,OAAO,MAAMC,8BAA8B,SAASD,yBAAyB,CAAC;EAC5E;AACF;AACA;EACEE,WAAWA,CAACC,SAAS,EAAE;IACrB,KAAK,CAACA,SAAS,CAAC;IAChB,IAAI,CAACC,OAAO,GAAGD,SAAS,CAACE,OAAO,CAACC,MAAM;IACvC,IAAI,CAACC,OAAO,GAAGJ,SAAS,CAACE,OAAO,CAACG,MAAM;EACzC;;EAEA;AACF;AACA;AACA;EACEC,UAAUA,CAAA,EAAG;IACX,OAAO;MACL,GAAG,KAAK,CAACA,UAAU,CAAC,CAAC;MACrBH,MAAM,EAAE,IAAI,CAACF,OAAO,IAAI,EAAE;MAC1BI,MAAM,EAAE,IAAI,CAACD,OAAO,IAAI;IAC1B,CAAC;EACH;AACF;AAEA,OAAO,MAAMG,kBAAkB,SAASX,QAAQ,CAAC;EAC/C;AACF;AACA;EACEY,aAAa,GAAGb,aAAa,CAACc,WAAW;;EAEzC;AACF;AACA;AACA;EACEV,WAAWA,CAACW,YAAY,EAAEC,gBAAgB,EAAE;IAC1C,KAAK,CAACD,YAAY,EAAEC,gBAAgB,CAAC;IACrC,IAAI,CAACC,UAAU,GAAG,aAAa;IAC/B,IAAI,CAACX,OAAO,GAAGS,YAAY,CAACG,MAAM,CAACV,MAAM;IACzC,IAAI,CAACC,OAAO,GAAGM,YAAY,CAACG,MAAM,CAACR,MAAM;EAC3C;;EAEA;AACF;AACA;EACE,IAAIS,kBAAkBA,CAAA,EAAG;IACvB,OAAO;MACLC,IAAI,EAAE;IACR,CAAC;EACH;EAEA,IAAIZ,MAAMA,CAAA,EAAG;IACX,OAAO,IAAI,CAACF,OAAO;EACrB;;EAEA;AACF;AACA;EACE,IAAIE,MAAMA,CAACa,GAAG,EAAE;IACd,IAAI,CAACf,OAAO,GAAGe,GAAG;IAClB,IAAI,CAACC,MAAM,CAAC,CAAC;EACf;EAEA,IAAIZ,MAAMA,CAAA,EAAG;IACX,OAAO,IAAI,CAACD,OAAO;EACrB;;EAEA;AACF;AACA;EACE,IAAIC,MAAMA,CAACW,GAAG,EAAE;IACd,IAAI,CAACZ,OAAO,GAAGY,GAAG;IAClB,IAAI,CAACC,MAAM,CAAC,CAAC;EACf;;EAEA;AACF;AACA;EACEC,YAAYA,CAAA,EAAG;IACb,MAAMC,SAAS,GAAG,IAAI,CAAChB,MAAM,GAAG;MAAEA,MAAM,EAAE;QAAEiB,IAAI,EAAE,IAAI,CAACjB;MAAO;IAAE,CAAC,GAAG,CAAC,CAAC;IACtE,MAAMkB,SAAS,GAAG,IAAI,CAAChB,MAAM,GAAG;MAAEA,MAAM,EAAE;QAAEe,IAAI,EAAE,IAAI,CAACf;MAAO;IAAE,CAAC,GAAG,CAAC,CAAC;IACtE,OAAO;MACL,GAAG,KAAK,CAACa,YAAY,CAAC,CAAC;MACvB,GAAGC,SAAS;MACZ,GAAGE;IACL,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA","ignoreList":[]}
@@ -27,7 +27,8 @@ export class QuestionComponentElements extends ComponentElements {
27
27
  return {
28
28
  ...super._getValues(),
29
29
  hintText: this._component.hint ?? '',
30
- shortDesc: this._component.shortDescription ?? ''
30
+ shortDesc: this._component.shortDescription ?? '',
31
+ userClasses: this._component.options.classes ?? ''
31
32
  };
32
33
  }
33
34
  }
@@ -66,13 +67,19 @@ export class Question extends PreviewComponent {
66
67
  constructor(htmlElements, questionRenderer) {
67
68
  super(htmlElements, questionRenderer);
68
69
  const {
69
- hintText
70
+ hintText,
71
+ userClasses
70
72
  } = htmlElements.values;
71
73
  /**
72
74
  * @type {string}
73
75
  * @private
74
76
  */
75
77
  this._hintText = hintText;
78
+ /**
79
+ * @type {string}
80
+ * @private
81
+ */
82
+ this._userClasses = userClasses;
76
83
  }
77
84
 
78
85
  /**
@@ -92,11 +99,16 @@ export class Question extends PreviewComponent {
92
99
  * @protected
93
100
  */
94
101
  _renderInput() {
95
- return {
102
+ const renderValues = {
96
103
  ...super._renderInput(),
97
104
  label: this.label,
98
105
  hint: this.hint
99
106
  };
107
+ return {
108
+ ...renderValues,
109
+ classes: this._userClasses,
110
+ previewClasses: renderValues.classes ?? ''
111
+ };
100
112
  }
101
113
 
102
114
  /**
@@ -113,6 +125,21 @@ export class Question extends PreviewComponent {
113
125
  this._hintText = value;
114
126
  this.render();
115
127
  }
128
+
129
+ /**
130
+ * @type {string}
131
+ */
132
+ get userClasses() {
133
+ return this._userClasses;
134
+ }
135
+
136
+ /**
137
+ * @param {string} value
138
+ */
139
+ set userClasses(value) {
140
+ this._userClasses = value;
141
+ this.render();
142
+ }
116
143
  }
117
144
 
118
145
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"question.js","names":["ComponentType","ComponentElements","PreviewComponent","QuestionComponentElements","_component","constructor","component","_getValues","hintText","hint","shortDesc","shortDescription","Question","componentType","TextField","_questionTemplate","PATH","_fieldName","htmlElements","questionRenderer","values","_hintText","text","_highlight","length","classes","getHighlight","_renderInput","label","value","render"],"sources":["../../../../../src/form/form-editor/preview/question.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\n/**\n * @implements {QuestionElements}\n */\nexport class QuestionComponentElements extends ComponentElements {\n /**\n * @type {FormComponentsDef}\n * @protected\n */\n _component\n /**\n * @param {FormComponentsDef} component\n */\n constructor(component) {\n super(component)\n this._component = component\n }\n\n /**\n * @protected\n * @returns {BaseSettings}\n */\n _getValues() {\n return {\n ...super._getValues(),\n hintText: this._component.hint ?? '',\n shortDesc: this._component.shortDescription ?? ''\n }\n }\n}\n\n/**\n * @class Question\n * @classdesc\n * A data object that has access to the underlying data via the QuestionElements object interface\n * and the templating mechanism to render the HTML for the data.\n *\n * It does not have access to the DOM, but has access to QuestionElements.setPreviewHTML to update\n * the HTML. Question classes should only be responsible for data and rendering as are reused in the\n * server side.\n */\nexport class Question extends PreviewComponent {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.TextField\n\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'textfield.njk'\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'inputField'\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n super(htmlElements, questionRenderer)\n const { hintText } = htmlElements.values\n /**\n * @type {string}\n * @private\n */\n this._hintText = hintText\n }\n\n /**\n * @type {DefaultComponent}\n * @protected\n */\n get hint() {\n const text =\n this._highlight === 'hintText' && !this._hintText.length\n ? 'Hint text'\n : this._hintText\n\n return {\n text,\n classes: this.getHighlight('hintText')\n }\n }\n\n /**\n * @returns {QuestionBaseModel}\n * @protected\n */\n _renderInput() {\n return { ...super._renderInput(), label: this.label, hint: this.hint }\n }\n\n /**\n * @type {string}\n */\n get hintText() {\n return this._hintText\n }\n\n /**\n * @param {string} value\n */\n set hintText(value) {\n this._hintText = value\n this.render()\n }\n}\n\n/**\n * @import { BaseSettings, QuestionElements, QuestionBaseModel, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { FormComponentsDef } from '~/src/components/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;;AAEzB;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,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AAYA,CAAA,EAAG;IACb,OAAO;MAAE,GAAG,KAAK,CAACA,YAAY,CAAC,CAAC;MAAEC,KAAK,EAAE,IAAI,CAACA,KAAK;MAAEnB,IAAI,EAAE,IAAI,CAACA;IAAK,CAAC;EACxE;;EAEA;AACF;AACA;EACE,IAAID,QAAQA,CAAA,EAAG;IACb,OAAO,IAAI,CAACa,SAAS;EACvB;;EAEA;AACF;AACA;EACE,IAAIb,QAAQA,CAACqB,KAAK,EAAE;IAClB,IAAI,CAACR,SAAS,GAAGQ,KAAK;IACtB,IAAI,CAACC,MAAM,CAAC,CAAC;EACf;AACF;;AAEA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"question.js","names":["ComponentType","ComponentElements","PreviewComponent","QuestionComponentElements","_component","constructor","component","_getValues","hintText","hint","shortDesc","shortDescription","userClasses","options","classes","Question","componentType","TextField","_questionTemplate","PATH","_fieldName","htmlElements","questionRenderer","values","_hintText","_userClasses","text","_highlight","length","getHighlight","_renderInput","renderValues","label","previewClasses","value","render"],"sources":["../../../../../src/form/form-editor/preview/question.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\n/**\n * @implements {QuestionElements}\n */\nexport class QuestionComponentElements extends ComponentElements {\n /**\n * @type {FormComponentsDef}\n * @protected\n */\n _component\n /**\n * @param {FormComponentsDef} component\n */\n constructor(component) {\n super(component)\n this._component = component\n }\n\n /**\n * @protected\n * @returns {BaseSettings}\n */\n _getValues() {\n return {\n ...super._getValues(),\n hintText: this._component.hint ?? '',\n shortDesc: this._component.shortDescription ?? '',\n userClasses: this._component.options.classes ?? ''\n }\n }\n}\n\n/**\n * @class Question\n * @classdesc\n * A data object that has access to the underlying data via the QuestionElements object interface\n * and the templating mechanism to render the HTML for the data.\n *\n * It does not have access to the DOM, but has access to QuestionElements.setPreviewHTML to update\n * the HTML. Question classes should only be responsible for data and rendering as are reused in the\n * server side.\n */\nexport class Question extends PreviewComponent {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.TextField\n\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'textfield.njk'\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'inputField'\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n super(htmlElements, questionRenderer)\n const { hintText, userClasses } = htmlElements.values\n /**\n * @type {string}\n * @private\n */\n this._hintText = hintText\n /**\n * @type {string}\n * @private\n */\n this._userClasses = userClasses\n }\n\n /**\n * @type {DefaultComponent}\n * @protected\n */\n get hint() {\n const text =\n this._highlight === 'hintText' && !this._hintText.length\n ? 'Hint text'\n : this._hintText\n\n return {\n text,\n classes: this.getHighlight('hintText')\n }\n }\n\n /**\n * @returns {QuestionBaseModel}\n * @protected\n */\n _renderInput() {\n const renderValues = {\n ...super._renderInput(),\n label: this.label,\n hint: this.hint\n }\n return {\n ...renderValues,\n classes: this._userClasses,\n previewClasses: renderValues.classes ?? ''\n }\n }\n\n /**\n * @type {string}\n */\n get hintText() {\n return this._hintText\n }\n\n /**\n * @param {string} value\n */\n set hintText(value) {\n this._hintText = value\n this.render()\n }\n\n /**\n * @type {string}\n */\n get userClasses() {\n return this._userClasses\n }\n\n /**\n * @param {string} value\n */\n set userClasses(value) {\n this._userClasses = value\n this.render()\n }\n}\n\n/**\n * @import { BaseSettings, QuestionElements, QuestionBaseModel, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { FormComponentsDef } from '~/src/components/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;;AAEzB;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,SAASF,iBAAiB,CAAC;EAC/D;AACF;AACA;AACA;EACEG,UAAU;EACV;AACF;AACA;EACEC,WAA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,IAAI,CAACe,YAAY,CAAC,UAAU;IACvC,CAAC;EACH;;EAEA;AACF;AACA;AACA;EACEC,YAAYA,CAAA,EAAG;IACb,MAAMC,YAAY,GAAG;MACnB,GAAG,KAAK,CAACD,YAAY,CAAC,CAAC;MACvBE,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBvB,IAAI,EAAE,IAAI,CAACA;IACb,CAAC;IACD,OAAO;MACL,GAAGsB,YAAY;MACfjB,OAAO,EAAE,IAAI,CAACW,YAAY;MAC1BQ,cAAc,EAAEF,YAAY,CAACjB,OAAO,IAAI;IAC1C,CAAC;EACH;;EAEA;AACF;AACA;EACE,IAAIN,QAAQA,CAAA,EAAG;IACb,OAAO,IAAI,CAACgB,SAAS;EACvB;;EAEA;AACF;AACA;EACE,IAAIhB,QAAQA,CAAC0B,KAAK,EAAE;IAClB,IAAI,CAACV,SAAS,GAAGU,KAAK;IACtB,IAAI,CAACC,MAAM,CAAC,CAAC;EACf;;EAEA;AACF;AACA;EACE,IAAIvB,WAAWA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACa,YAAY;EAC1B;;EAEA;AACF;AACA;EACE,IAAIb,WAAWA,CAACsB,KAAK,EAAE;IACrB,IAAI,CAACT,YAAY,GAAGS,KAAK;IACzB,IAAI,CAACC,MAAM,CAAC,CAAC;EACf;AACF;;AAEA;AACA;AACA;AACA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/preview/types.ts"],"sourcesContent":["import {\n type PagePreviewPanelMacro,\n type QuestionBaseModel\n} from '~/src/form/form-editor/macros/types.js'\nimport { type AutocompleteQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { type DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { type EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport { type ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { type LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { type PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { type Question } from '~/src/form/form-editor/preview/question.js'\nimport { type RadioSortableQuestion } from '~/src/form/form-editor/preview/radio-sortable.js'\nimport { type SelectSortableQuestion } from '~/src/form/form-editor/preview/select-sortable.js'\nimport { type ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport { type ListElement } from '~/src/form/form-editor/types.js'\nexport { type QuestionBaseModel } from '~/src/form/form-editor/macros/types.js'\nexport interface BaseSettings {\n question: string\n hintText: string\n optional: boolean\n shortDesc: string\n items: ListElement[]\n content: string\n attributes?: Record<string, string>\n usePostcodeLookup?: boolean\n}\n\nexport interface DefaultComponent {\n id?: string\n text: string\n classes: string\n isPageHeading?: boolean\n}\n\nexport interface GovukFieldset {\n legend: DefaultComponent\n}\n\nexport type ListenerRow = [\n HTMLInputElement | null,\n (target: HTMLInputElement, e: Event) => void,\n keyof HTMLElementEventMap\n]\n\nexport interface DomElementsBase {\n readonly values?: BaseSettings\n autocompleteOptions?: string\n setPreviewHTML(value: string): void\n setPreviewDOM(element: HTMLElement): void\n}\n\nexport interface QuestionElements extends DomElementsBase {\n readonly values: BaseSettings\n}\n\nexport interface AutocompleteElements extends QuestionElements {\n autocompleteOptions: string\n}\n\nexport interface RenderBase {\n render(questionTemplate: string, renderContext: RenderContext): void\n}\n\nexport interface QuestionRenderContext {\n model: QuestionBaseModel\n}\n\nexport interface PageRenderContext {\n params: PagePreviewPanelMacro\n}\n\nexport type RenderContext = QuestionRenderContext | PageRenderContext\n\nexport interface HTMLBuilder {\n buildHTML(questionTemplate: string, renderContext: RenderContext): string\n}\n\nexport interface QuestionRenderer {\n render(questionTemplate: string, questionBaseModel: QuestionBaseModel): void\n}\n\nexport interface PageRenderer {\n render(pageTemplate: string, pagePreview: PagePreviewPanelMacro): void\n}\n\nexport type Renderer = QuestionRenderer | PageRenderer\n\nexport interface ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport interface PagePreviewBaseElements {\n heading: string\n guidance: string\n}\n\nexport interface PageOverviewElements extends PagePreviewBaseElements {\n addHeading: boolean\n repeatQuestion: string | undefined\n hasRepeater: boolean\n}\n\nexport interface SummaryPageElements extends PagePreviewBaseElements {\n declaration: boolean\n}\n\nexport type PreviewQuestion =\n | DateInputQuestion\n | EmailAddressQuestion\n | ListSortableQuestion\n | LongAnswerQuestion\n | PhoneNumberQuestion\n | Question\n | RadioSortableQuestion\n | SelectSortableQuestion\n | ShortAnswerQuestion\n | UkAddressQuestion\n | AutocompleteQuestion\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/preview/types.ts"],"sourcesContent":["import {\n type PagePreviewPanelMacro,\n type QuestionBaseModel\n} from '~/src/form/form-editor/macros/types.js'\nimport { type AutocompleteQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { type DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { type EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport { type ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { type LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { type PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { type Question } from '~/src/form/form-editor/preview/question.js'\nimport { type RadioSortableQuestion } from '~/src/form/form-editor/preview/radio-sortable.js'\nimport { type SelectSortableQuestion } from '~/src/form/form-editor/preview/select-sortable.js'\nimport { type ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport { type ListElement } from '~/src/form/form-editor/types.js'\nexport { type QuestionBaseModel } from '~/src/form/form-editor/macros/types.js'\nexport interface BaseSettings {\n question: string\n hintText: string\n optional: boolean\n shortDesc: string\n userClasses: string\n items: ListElement[]\n content: string\n attributes?: Record<string, string>\n usePostcodeLookup?: boolean\n}\n\nexport interface DefaultComponent {\n id?: string\n text: string\n classes: string\n isPageHeading?: boolean\n}\n\nexport interface GovukFieldset {\n legend: DefaultComponent\n}\n\nexport type ListenerRow = [\n HTMLInputElement | null,\n (target: HTMLInputElement, e: Event) => void,\n keyof HTMLElementEventMap\n]\n\nexport interface DomElementsBase {\n readonly values?: BaseSettings\n autocompleteOptions?: string\n setPreviewHTML(value: string): void\n setPreviewDOM(element: HTMLElement): void\n}\n\nexport interface QuestionElements extends DomElementsBase {\n readonly values: BaseSettings\n}\n\nexport interface AutocompleteElements extends QuestionElements {\n autocompleteOptions: string\n}\n\nexport interface NumberSettings extends BaseSettings {\n prefix: string\n suffix: string\n}\n\nexport interface NumberElements extends DomElementsBase {\n readonly values: NumberSettings\n}\n\nexport interface RenderBase {\n render(questionTemplate: string, renderContext: RenderContext): void\n}\n\nexport interface QuestionRenderContext {\n model: QuestionBaseModel\n}\n\nexport interface PageRenderContext {\n params: PagePreviewPanelMacro\n}\n\nexport type RenderContext = QuestionRenderContext | PageRenderContext\n\nexport interface HTMLBuilder {\n buildHTML(questionTemplate: string, renderContext: RenderContext): string\n}\n\nexport interface QuestionRenderer {\n render(questionTemplate: string, questionBaseModel: QuestionBaseModel): void\n}\n\nexport interface PageRenderer {\n render(pageTemplate: string, pagePreview: PagePreviewPanelMacro): void\n}\n\nexport type Renderer = QuestionRenderer | PageRenderer\n\nexport interface ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport interface PagePreviewBaseElements {\n heading: string\n guidance: string\n}\n\nexport interface PageOverviewElements extends PagePreviewBaseElements {\n addHeading: boolean\n repeatQuestion: string | undefined\n hasRepeater: boolean\n}\n\nexport interface SummaryPageElements extends PagePreviewBaseElements {\n declaration: boolean\n}\n\nexport type PreviewQuestion =\n | DateInputQuestion\n | EmailAddressQuestion\n | ListSortableQuestion\n | LongAnswerQuestion\n | PhoneNumberQuestion\n | Question\n | RadioSortableQuestion\n | SelectSortableQuestion\n | ShortAnswerQuestion\n | UkAddressQuestion\n | AutocompleteQuestion\n"],"mappings":"","ignoreList":[]}