@defra/forms-model 3.0.407 → 3.0.408
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/common/types.js.map +1 -1
- package/dist/module/form/form-definition/types.js.map +1 -1
- package/dist/module/form/form-editor/index.js +11 -0
- package/dist/module/form/form-editor/index.js.map +1 -1
- package/dist/module/form/form-editor/types.js.map +1 -1
- package/dist/module/pages/helpers.js +7 -0
- package/dist/module/pages/helpers.js.map +1 -1
- package/dist/module/pages/index.js +1 -1
- package/dist/module/pages/index.js.map +1 -1
- package/dist/module/pages/page-types.js +2 -1
- package/dist/module/pages/page-types.js.map +1 -1
- package/dist/types/common/types.d.ts +3 -1
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/form/form-definition/types.d.ts +1 -0
- package/dist/types/form/form-definition/types.d.ts.map +1 -1
- package/dist/types/form/form-editor/index.d.ts +11 -1
- package/dist/types/form/form-editor/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/types.d.ts +9 -0
- package/dist/types/form/form-editor/types.d.ts.map +1 -1
- package/dist/types/pages/helpers.d.ts +6 -0
- package/dist/types/pages/helpers.d.ts.map +1 -1
- package/dist/types/pages/index.d.ts +1 -1
- package/dist/types/pages/index.d.ts.map +1 -1
- package/dist/types/pages/page-types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/types.ts +3 -1
- package/src/form/form-definition/types.ts +2 -1
- package/src/form/form-editor/index.ts +16 -0
- package/src/form/form-editor/types.ts +15 -0
- package/src/pages/helpers.ts +11 -0
- package/src/pages/index.ts +1 -0
- package/src/pages/page-types.ts +2 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/common/types.ts"],"sourcesContent":["import {\n type PaginationOptions,\n type PaginationResult\n} from '~/src/common/pagination/types.js'\nimport { type SearchOptions } from '~/src/common/search/types.js'\nimport { type SortingOptions } from '~/src/common/sorting/types.js'\n\n/**\n * Options for querying results, including pagination, sorting, and searching\n */\nexport type QueryOptions = PaginationOptions & SortingOptions & SearchOptions\n\n/**\n * Available form status values\n */\nexport type FormStatus = 'draft' | 'live'\n\n/**\n * Available filter options for the current result set\n */\nexport interface FilterOptions {\n /**\n * List of unique authors in the response\n */\n authors: string[]\n\n /**\n * List of organizations that have forms\n */\n organisations: string[]\n\n /**\n * Status values present in the results\n */\n status?: FormStatus[]\n}\n\n/**\n * Metadata containing the optional pagination, sorting, and searching information\n */\nexport interface Meta {\n /**\n * The pagination details\n */\n pagination?: PaginationResult\n\n /**\n * The sorting details\n */\n sorting?: SortingOptions\n\n /**\n * The search details\n */\n search?: SearchOptions\n\n /**\n * Available filter options\n */\n filters?: FilterOptions\n}\n\n/**\n * Standard response wrapper for query results with metadata\n */\nexport interface QueryResult<Model> {\n /**\n * The array of data items\n */\n data: Model[]\n\n /**\n * The metadata about the result\n */\n meta: Meta\n}\n\n/**\n * Type for the list items within a Radio or Checkbox nunjucks definition\n */\nexport interface CheckboxOrRadioItem {\n /**\n * The text to be displayed\n */\n text?: string\n\n /**\n * If text is set, this is not required. HTML to use within each radio item label\n */\n html?: string\n\n /**\n * Specific ID attribute for the checkbox/radio item\n */\n id?: string\n\n /**\n * Name for the checkbox/radio item\n */\n name?: string\n\n /**\n * Required. Value for the radio input\n */\n value: string\n\n /**\n * Subset of options for the label\n */\n label?: string\n\n /**\n * Can be used to add a hint to each item\n */\n hint?: string\n\n /**\n * Divider text to separate checkbox/radio items, for example the text \"or\"\n */\n divider?: string\n\n /**\n * Whether the checkbox/radio should be checked when the page loads\n */\n checked?: boolean\n\n /**\n * Provide additional content to reveal when the checkbox/radio is checked\n */\n conditional?:
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/common/types.ts"],"sourcesContent":["import {\n type PaginationOptions,\n type PaginationResult\n} from '~/src/common/pagination/types.js'\nimport { type SearchOptions } from '~/src/common/search/types.js'\nimport { type SortingOptions } from '~/src/common/sorting/types.js'\n\n/**\n * Options for querying results, including pagination, sorting, and searching\n */\nexport type QueryOptions = PaginationOptions & SortingOptions & SearchOptions\n\n/**\n * Available form status values\n */\nexport type FormStatus = 'draft' | 'live'\n\n/**\n * Available filter options for the current result set\n */\nexport interface FilterOptions {\n /**\n * List of unique authors in the response\n */\n authors: string[]\n\n /**\n * List of organizations that have forms\n */\n organisations: string[]\n\n /**\n * Status values present in the results\n */\n status?: FormStatus[]\n}\n\n/**\n * Metadata containing the optional pagination, sorting, and searching information\n */\nexport interface Meta {\n /**\n * The pagination details\n */\n pagination?: PaginationResult\n\n /**\n * The sorting details\n */\n sorting?: SortingOptions\n\n /**\n * The search details\n */\n search?: SearchOptions\n\n /**\n * Available filter options\n */\n filters?: FilterOptions\n}\n\n/**\n * Standard response wrapper for query results with metadata\n */\nexport interface QueryResult<Model> {\n /**\n * The array of data items\n */\n data: Model[]\n\n /**\n * The metadata about the result\n */\n meta: Meta\n}\n\n/**\n * Type for the list items within a Radio or Checkbox nunjucks definition\n */\nexport interface CheckboxOrRadioItem {\n /**\n * The text to be displayed\n */\n text?: string\n\n /**\n * If text is set, this is not required. HTML to use within each radio item label\n */\n html?: string\n\n /**\n * Specific ID attribute for the checkbox/radio item\n */\n id?: string\n\n /**\n * Name for the checkbox/radio item\n */\n name?: string\n\n /**\n * Required. Value for the radio input\n */\n value: string\n\n /**\n * Subset of options for the label\n */\n label?: string\n\n /**\n * Can be used to add a hint to each item\n */\n hint?: string\n\n /**\n * Divider text to separate checkbox/radio items, for example the text \"or\"\n */\n divider?: string\n\n /**\n * Whether the checkbox/radio should be checked when the page loads\n */\n checked?: boolean\n\n /**\n * Provide additional content to reveal when the checkbox/radio is checked\n */\n conditional?: {\n html?: string\n }\n\n /**\n * The behaviour - if set to \"exclusive\" implements a 'None of thse' type behaviour via Javascript when checkboxes are clicked\n */\n behaviour?: string\n\n /**\n * If true, checkbox/radio option will be disabled\n */\n disabled?: boolean\n\n /**\n * HTML attributes (for example data attributes) to add to the checkbox input tag\n */\n attributes?: object\n}\n"],"mappings":"","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":["Engine"],"sources":["../../../../src/form/form-definition/types.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types.js'\nimport { type ConditionsModelData } from '~/src/conditions/types.js'\nimport { formDefinitionSchema } from '~/src/form/form-definition/index.js'\nimport { type ControllerPath, type ControllerType } from '~/src/pages/enums.js'\n\nexport enum Engine {\n V1 = 'V1',\n V2 = 'V2'\n}\n\nexport interface Link {\n path: string\n condition?: string\n redirect?: string\n}\n\nexport interface EventOptions {\n method: string\n url: string\n}\n\nexport interface Event {\n type: string\n options: EventOptions\n}\n\nexport interface Events {\n onLoad?: Event\n onSave?: Event\n}\n\nexport interface PageBase {\n id?: string\n title: string\n path: string\n condition?: string\n events?: Events\n view?: string\n}\n\nexport interface RepeatOptions {\n name: string\n title: string\n}\n\nexport interface RepeatSchema {\n min: number\n max: number\n}\n\nexport interface Repeat {\n options: RepeatOptions\n schema: RepeatSchema\n}\n\nexport interface PageStart extends PageBase {\n path: ControllerPath.Start | string\n controller: ControllerType.Start\n section?: string | undefined\n next: Link[]\n components: ComponentDef[]\n}\n\nexport interface PageQuestion extends PageBase {\n controller?: ControllerType.Page\n section?: string | undefined\n next: Link[]\n components: ComponentDef[]\n}\n\nexport interface PageTerminal extends PageBase {\n controller?: ControllerType.Terminal\n section?: string | undefined\n next: Link[]\n components: ComponentDef[]\n}\n\nexport interface PageRepeat extends PageBase {\n controller: ControllerType.Repeat\n repeat: Repeat\n section?: string | undefined\n next: Link[]\n components: ComponentDef[]\n}\n\nexport interface PageFileUpload extends PageBase {\n controller: ControllerType.FileUpload\n section?: string | undefined\n next: Link[]\n components: ComponentDef[]\n}\n\nexport interface PageSummary extends PageBase {\n path: ControllerPath.Summary | string\n controller: ControllerType.Summary\n section?: undefined\n}\n\nexport interface PageStatus extends PageBase {\n path: ControllerPath.Status | string\n controller: ControllerType.Status\n section?: undefined\n}\n\nexport type Page =\n | PageStart\n | PageQuestion\n | PageTerminal\n | PageFileUpload\n | PageRepeat\n | PageSummary\n | PageStatus\n\nexport interface Section {\n name: string\n title: string\n hideTitle?: boolean\n}\n\nexport interface Item {\n text: string\n value: string | number | boolean\n description?: string\n conditional?: { components: ComponentDef[] }\n condition?: string\n}\n\nexport interface List {\n name: string\n title: string\n type: ListTypeContent\n items: Item[]\n}\n\nexport type ListTypeOption = 'bulleted' | 'numbered'\nexport type ListTypeContent = 'string' | 'number' | 'boolean'\n\nexport interface Feedback {\n feedbackForm?: boolean\n url?: string\n emailAddress?: string\n}\n\nexport interface PhaseBanner {\n phase?: 'alpha' | 'beta'\n feedbackUrl?: string\n}\n\nexport interface ConditionWrapper {\n name: string\n displayName: string\n value: ConditionsModelData\n}\n\n/**\n * Interface for `formDefinitionSchema` Joi schema\n * @see {@link formDefinitionSchema}\n */\nexport interface FormDefinition {\n engine?: Engine\n pages: Page[]\n conditions: ConditionWrapper[]\n lists: List[]\n sections: Section[]\n startPage?: string\n name?: string\n feedback?: Feedback\n phaseBanner?: PhaseBanner\n declaration?: string\n skipSummary?: never\n metadata?: Record<string, unknown>\n outputEmail?: string\n output?: {\n audience: 'human' | 'machine'\n version: string\n }\n}\n"],"mappings":"AAKA,WAAYA,MAAM,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA;;
|
1
|
+
{"version":3,"file":"types.js","names":["Engine"],"sources":["../../../../src/form/form-definition/types.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types.js'\nimport { type ConditionsModelData } from '~/src/conditions/types.js'\nimport { formDefinitionSchema } from '~/src/form/form-definition/index.js'\nimport { type ControllerPath, type ControllerType } from '~/src/pages/enums.js'\n\nexport enum Engine {\n V1 = 'V1',\n V2 = 'V2'\n}\n\nexport interface Link {\n path: string\n condition?: string\n redirect?: string\n}\n\nexport interface EventOptions {\n method: string\n url: string\n}\n\nexport interface Event {\n type: string\n options: EventOptions\n}\n\nexport interface Events {\n onLoad?: Event\n onSave?: Event\n}\n\nexport interface PageBase {\n id?: string\n title: string\n path: string\n condition?: string\n events?: Events\n view?: string\n}\n\nexport interface RepeatOptions {\n name: string\n title: string\n}\n\nexport interface RepeatSchema {\n min: number\n max: number\n}\n\nexport interface Repeat {\n options: RepeatOptions\n schema: RepeatSchema\n}\n\nexport interface PageStart extends PageBase {\n path: ControllerPath.Start | string\n controller: ControllerType.Start\n section?: string | undefined\n next: Link[]\n components: ComponentDef[]\n}\n\nexport interface PageQuestion extends PageBase {\n controller?: ControllerType.Page\n section?: string | undefined\n next: Link[]\n components: ComponentDef[]\n}\n\nexport interface PageTerminal extends PageBase {\n controller?: ControllerType.Terminal\n section?: string | undefined\n next: Link[]\n components: ComponentDef[]\n}\n\nexport interface PageRepeat extends PageBase {\n controller: ControllerType.Repeat\n repeat: Repeat\n section?: string | undefined\n next: Link[]\n components: ComponentDef[]\n}\n\nexport interface PageFileUpload extends PageBase {\n controller: ControllerType.FileUpload\n section?: string | undefined\n next: Link[]\n components: ComponentDef[]\n}\n\nexport interface PageSummary extends PageBase {\n path: ControllerPath.Summary | string\n controller: ControllerType.Summary\n section?: undefined\n components?: ComponentDef[]\n}\n\nexport interface PageStatus extends PageBase {\n path: ControllerPath.Status | string\n controller: ControllerType.Status\n section?: undefined\n}\n\nexport type Page =\n | PageStart\n | PageQuestion\n | PageTerminal\n | PageFileUpload\n | PageRepeat\n | PageSummary\n | PageStatus\n\nexport interface Section {\n name: string\n title: string\n hideTitle?: boolean\n}\n\nexport interface Item {\n text: string\n value: string | number | boolean\n description?: string\n conditional?: { components: ComponentDef[] }\n condition?: string\n}\n\nexport interface List {\n name: string\n title: string\n type: ListTypeContent\n items: Item[]\n}\n\nexport type ListTypeOption = 'bulleted' | 'numbered'\nexport type ListTypeContent = 'string' | 'number' | 'boolean'\n\nexport interface Feedback {\n feedbackForm?: boolean\n url?: string\n emailAddress?: string\n}\n\nexport interface PhaseBanner {\n phase?: 'alpha' | 'beta'\n feedbackUrl?: string\n}\n\nexport interface ConditionWrapper {\n name: string\n displayName: string\n value: ConditionsModelData\n}\n\n/**\n * Interface for `formDefinitionSchema` Joi schema\n * @see {@link formDefinitionSchema}\n */\nexport interface FormDefinition {\n engine?: Engine\n pages: Page[]\n conditions: ConditionWrapper[]\n lists: List[]\n sections: Section[]\n startPage?: string\n name?: string\n feedback?: Feedback\n phaseBanner?: PhaseBanner\n declaration?: string // Deprecated in v2\n skipSummary?: never\n metadata?: Record<string, unknown>\n outputEmail?: string\n output?: {\n audience: 'human' | 'machine'\n version: string\n }\n}\n"],"mappings":"AAKA,WAAYA,MAAM,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA;;AAsJlB;AACA;AACA;AACA","ignoreList":[]}
|
@@ -12,6 +12,8 @@ export const shortDescriptionSchema = Joi.string().required();
|
|
12
12
|
export const pageHeadingAndGuidanceSchema = Joi.string().optional();
|
13
13
|
export const pageHeadingSchema = Joi.string().required();
|
14
14
|
export const guidanceTextSchema = Joi.string().optional().allow('');
|
15
|
+
export const needDeclarationSchema = Joi.string().required();
|
16
|
+
export const declarationTextSchema = Joi.string().required();
|
15
17
|
export const formEditorInputPageKeys = {
|
16
18
|
pageType: pageTypeSchema,
|
17
19
|
questionType: questionTypeSchema
|
@@ -22,6 +24,15 @@ export const formEditorInputPageKeys = {
|
|
22
24
|
* @see {@link FormEditorInputPage}
|
23
25
|
*/
|
24
26
|
export const formEditorInputPageSchema = Joi.object().keys(formEditorInputPageKeys).required();
|
27
|
+
export const formEditorInputheckAnswersSettingsKeys = {
|
28
|
+
declarationText: shortDescriptionSchema
|
29
|
+
};
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Joi schema for `FormEditorInputCheckAnswersSettings` interface
|
33
|
+
* @see {@link FormEditorInputCheckAnswersSettings}
|
34
|
+
*/
|
35
|
+
export const formEditorInputCheckAnswersSettingSchema = Joi.object().keys(formEditorInputheckAnswersSettingsKeys).required();
|
25
36
|
export const formEditorInputQuestionKeys = {
|
26
37
|
question: questionSchema,
|
27
38
|
shortDescription: shortDescriptionSchema,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["Joi","ComponentType","pageTypeSchema","string","required","valid","questionTypeSchema","UkAddressField","TelephoneNumberField","FileUploadField","EmailAddressField","SelectField","questionTypeFullSchema","TextField","MultilineTextField","NumberField","DatePartsField","MonthYearField","writtenAnswerSubSchema","dateSubSchema","questionSchema","hintTextSchema","optional","allow","questionOptionalSchema","shortDescriptionSchema","pageHeadingAndGuidanceSchema","pageHeadingSchema","guidanceTextSchema","formEditorInputPageKeys","pageType","questionType","formEditorInputPageSchema","object","keys","formEditorInputQuestionKeys","question","shortDescription","hintText","questionOptional","formEditorInputQuestionSchema","formEditorInputPageSettingsKeys","pageHeadingAndGuidance","pageHeading","guidanceText","formEditorInputPageSettingsSchema"],"sources":["../../../../src/form/form-editor/index.ts"],"sourcesContent":["import Joi from 'joi'\n\nimport { ComponentType } from '~/src/components/enums.js'\nimport {\n type FormEditorInputPage,\n type FormEditorInputPageSettings,\n type FormEditorInputQuestion\n} from '~/src/form/form-editor/types.js'\n\nexport const pageTypeSchema = Joi.string()\n .required()\n .valid('question', 'guidance')\nexport const questionTypeSchema = Joi.string()\n .required()\n .valid(\n 'written-answer-group',\n 'date-group',\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n ComponentType.SelectField\n )\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.SelectField\n )\n\nexport const writtenAnswerSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.TextField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField\n )\nexport const dateSubSchema = Joi.string()\n .required()\n .valid(ComponentType.DatePartsField, ComponentType.MonthYearField)\n\nexport const questionSchema = Joi.string().required()\nexport const hintTextSchema = Joi.string().optional().allow('')\nexport const questionOptionalSchema = Joi.string().optional().valid('', 'true')\nexport const shortDescriptionSchema = Joi.string().required()\nexport const pageHeadingAndGuidanceSchema = Joi.string().optional()\nexport const pageHeadingSchema = Joi.string().required()\nexport const guidanceTextSchema = Joi.string().optional().allow('')\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\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\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"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAErB,SAASC,aAAa;
|
1
|
+
{"version":3,"file":"index.js","names":["Joi","ComponentType","pageTypeSchema","string","required","valid","questionTypeSchema","UkAddressField","TelephoneNumberField","FileUploadField","EmailAddressField","SelectField","questionTypeFullSchema","TextField","MultilineTextField","NumberField","DatePartsField","MonthYearField","writtenAnswerSubSchema","dateSubSchema","questionSchema","hintTextSchema","optional","allow","questionOptionalSchema","shortDescriptionSchema","pageHeadingAndGuidanceSchema","pageHeadingSchema","guidanceTextSchema","needDeclarationSchema","declarationTextSchema","formEditorInputPageKeys","pageType","questionType","formEditorInputPageSchema","object","keys","formEditorInputheckAnswersSettingsKeys","declarationText","formEditorInputCheckAnswersSettingSchema","formEditorInputQuestionKeys","question","shortDescription","hintText","questionOptional","formEditorInputQuestionSchema","formEditorInputPageSettingsKeys","pageHeadingAndGuidance","pageHeading","guidanceText","formEditorInputPageSettingsSchema"],"sources":["../../../../src/form/form-editor/index.ts"],"sourcesContent":["import Joi from 'joi'\n\nimport { ComponentType } from '~/src/components/enums.js'\nimport {\n type FormEditorInputCheckAnswersSettings,\n type FormEditorInputPage,\n type FormEditorInputPageSettings,\n type FormEditorInputQuestion\n} from '~/src/form/form-editor/types.js'\n\nexport const pageTypeSchema = Joi.string()\n .required()\n .valid('question', 'guidance')\nexport const questionTypeSchema = Joi.string()\n .required()\n .valid(\n 'written-answer-group',\n 'date-group',\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n ComponentType.SelectField\n )\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.SelectField\n )\n\nexport const writtenAnswerSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.TextField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField\n )\nexport const dateSubSchema = Joi.string()\n .required()\n .valid(ComponentType.DatePartsField, ComponentType.MonthYearField)\n\nexport const questionSchema = Joi.string().required()\nexport const hintTextSchema = Joi.string().optional().allow('')\nexport const questionOptionalSchema = Joi.string().optional().valid('', 'true')\nexport const shortDescriptionSchema = Joi.string().required()\nexport const pageHeadingAndGuidanceSchema = Joi.string().optional()\nexport const pageHeadingSchema = Joi.string().required()\nexport const guidanceTextSchema = Joi.string().optional().allow('')\nexport const needDeclarationSchema = Joi.string().required()\nexport const declarationTextSchema = Joi.string().required()\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\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\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\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"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAErB,SAASC,aAAa;AAQtB,OAAO,MAAMC,cAAc,GAAGF,GAAG,CAACG,MAAM,CAAC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AC5CjC,QAAQ,CAAC,CAAC;AAEf,OAAO,MAAMoC,2BAA2B,GAAG;EACzCC,QAAQ,EAAErB,cAAc;EACxBsB,gBAAgB,EAAEjB,sBAAsB;EACxCkB,QAAQ,EAAEtB,cAAc;EACxBuB,gBAAgB,EAAEpB;AACpB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMqB,6BAA6B,GACxC7C,GAAG,CAACmC,MAAM,CAA0B,CAAC,CAClCC,IAAI,CAACI,2BAA2B,CAAC,CACjCpC,QAAQ,CAAC,CAAC;AAEf,OAAO,MAAM0C,+BAA+B,GAAG;EAC7CC,sBAAsB,EAAErB,4BAA4B;EACpDsB,WAAW,EAAErB,iBAAiB;EAC9BsB,YAAY,EAAErB;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMsB,iCAAiC,GAC5ClD,GAAG,CAACmC,MAAM,CAA8B,CAAC,CACtCC,IAAI,CAACU,+BAA+B,CAAC,CACrC1C,QAAQ,CAAC,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-editor/types.ts"],"sourcesContent":["/**\n * Interface for `FormEditor` Joi schema\n */\nexport interface FormEditor {\n /**\n * The type of the page\n */\n pageType: string\n\n /**\n * The type of the question\n */\n questionType: string | undefined\n\n /**\n * The sub-type of written answer\n */\n writtenAnswerSub: string\n\n /**\n * The sub-type of date\n */\n dateSub: string\n\n /**\n * The text of the question\n */\n question: string\n\n /**\n * The hint text of the question\n */\n hintText: string\n\n /**\n * Denotes if the question is optional\n */\n questionOptional: string\n\n /**\n * The short description of the question\n */\n shortDescription: string\n\n /**\n * The value of checkbox to reveal heading and guidance section\n */\n pageHeadingAndGuidance: string\n\n /**\n * The page heading\n */\n pageHeading: string\n\n /**\n * The page guidance text\n */\n guidanceText: string\n}\n\nexport type FormEditorInputPage = Pick<\n FormEditor,\n 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub'\n>\n\nexport type FormEditorInputQuestion = Pick<\n FormEditor,\n | 'questionType'\n | 'question'\n | 'shortDescription'\n | 'hintText'\n | 'questionOptional'\n>\n\nexport type FormEditorInputPageSettings = Pick<\n FormEditor,\n 'pageHeadingAndGuidance' | 'pageHeading' | 'guidanceText'\n>\n"],"mappings":"","ignoreList":[]}
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-editor/types.ts"],"sourcesContent":["/**\n * Interface for `FormEditor` Joi schema\n */\nexport interface FormEditor {\n /**\n * The type of the page\n */\n pageType: string\n\n /**\n * The type of the question\n */\n questionType: string | undefined\n\n /**\n * The sub-type of written answer\n */\n writtenAnswerSub: string\n\n /**\n * The sub-type of date\n */\n dateSub: string\n\n /**\n * The text of the question\n */\n question: string\n\n /**\n * The hint text of the question\n */\n hintText: string\n\n /**\n * Denotes if the question is optional\n */\n questionOptional: string\n\n /**\n * The short description of the question\n */\n shortDescription: string\n\n /**\n * The value of checkbox to reveal heading and guidance section\n */\n pageHeadingAndGuidance: string\n\n /**\n * The page heading\n */\n pageHeading: string\n\n /**\n * The page guidance text\n */\n guidanceText: string\n\n /**\n * The value of radio to reveal declaration text field\n */\n needDeclaration: string\n\n /**\n * The check answers declaration text\n */\n declarationText: string\n}\n\nexport type FormEditorInputPage = Pick<\n FormEditor,\n 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub'\n>\n\nexport type FormEditorInputCheckAnswersSettings = Pick<\n FormEditor,\n 'needDeclaration' | 'declarationText'\n>\n\nexport type FormEditorInputQuestion = Pick<\n FormEditor,\n | 'questionType'\n | 'question'\n | 'shortDescription'\n | 'hintText'\n | 'questionOptional'\n>\n\nexport type FormEditorInputPageSettings = Pick<\n FormEditor,\n 'pageHeadingAndGuidance' | 'pageHeading' | 'guidanceText'\n>\n"],"mappings":"","ignoreList":[]}
|
@@ -22,6 +22,13 @@ export function hasComponents(page) {
|
|
22
22
|
return hasNext(page) && Array.isArray(page.components);
|
23
23
|
}
|
24
24
|
|
25
|
+
/**
|
26
|
+
* Check if the page has components (the page can be any page type e.g. SummaryPage)
|
27
|
+
*/
|
28
|
+
export function hasComponentsEvenIfNoNext(page) {
|
29
|
+
return page !== undefined && 'components' in page && Array.isArray(page.components);
|
30
|
+
}
|
31
|
+
|
25
32
|
/**
|
26
33
|
* Check page has form components
|
27
34
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["ControllerNames","ControllerTypes","ControllerType","PageTypes","getPageDefaults","page","nameOrPath","controller","Page","controllerNameFromPath","defaults","find","pageType","Error","structuredClone","hasComponents","hasNext","Array","isArray","components","hasFormComponents","Start","hasRepeater","Repeat","isControllerName","map","String","includes","Terminal","FileUpload","options","path","name"],"sources":["../../../src/pages/helpers.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types.js'\nimport {\n type Link,\n type Page,\n type PageFileUpload,\n type PageQuestion,\n type PageRepeat\n} from '~/src/form/form-definition/types.js'\nimport {\n ControllerNames,\n ControllerTypes\n} from '~/src/pages/controller-types.js'\nimport { ControllerType } from '~/src/pages/enums.js'\nimport { PageTypes } from '~/src/pages/page-types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getPageDefaults<PageType extends Page>(\n page?: Pick<PageType, 'controller'>\n) {\n const nameOrPath = page?.controller ?? ControllerType.Page\n const controller = controllerNameFromPath(nameOrPath)\n\n const defaults = PageTypes.find(\n (pageType) => pageType.controller === controller\n )\n\n if (!defaults) {\n throw new Error(`Defaults not found for page type '${nameOrPath}'`)\n }\n\n return structuredClone(defaults) as PageType\n}\n\n/**\n * Check page has components\n */\nexport function hasComponents(\n page?: Partial<Page>\n): page is Extract<Page, { components: ComponentDef[] }> {\n return hasNext(page) && Array.isArray(page.components)\n}\n\n/**\n * Check page has form components\n */\nexport function hasFormComponents(\n page?: Partial<Page>\n): page is PageQuestion | PageFileUpload {\n const controller = controllerNameFromPath(page?.controller)\n return hasComponents(page) && controller !== ControllerType.Start\n}\n\n/**\n * Check page has repeater\n */\nexport function hasRepeater(page?: Partial<Page>): page is PageRepeat {\n return controllerNameFromPath(page?.controller) === ControllerType.Repeat\n}\n\n/**\n * Check for known page controller names\n */\nexport function isControllerName(\n nameOrPath?: ControllerType | string\n): nameOrPath is ControllerType {\n return !!nameOrPath && ControllerNames.map(String).includes(nameOrPath)\n}\n\n/**\n * Check page has next link\n */\nexport function hasNext(\n page?: Partial<Page>\n): page is Extract<Page, { next: Link[] }> {\n if (!page || !('next' in page)) {\n return false\n }\n\n const controller = controllerNameFromPath(page.controller)\n\n return (\n !controller ||\n controller === ControllerType.Start ||\n controller === ControllerType.Page ||\n controller === ControllerType.Terminal ||\n controller === ControllerType.FileUpload ||\n controller === ControllerType.Repeat\n )\n}\n\n/**\n * Check and optionally replace legacy path with controller name\n * @param {string} [nameOrPath] - Controller name or legacy controller path\n */\nexport function controllerNameFromPath(nameOrPath?: ControllerType | string) {\n if (isControllerName(nameOrPath)) {\n return nameOrPath\n }\n\n const options = ControllerTypes.find(({ path }) => path === nameOrPath)\n return options?.name\n}\n"],"mappings":"AAQA,SACEA,eAAe,EACfC,eAAe;AAEjB,SAASC,cAAc;AACvB,SAASC,SAAS;;AAElB;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC7BC,IAAmC,EACnC;EACA,MAAMC,UAAU,GAAGD,IAAI,EAAEE,UAAU,IAAIL,cAAc,CAACM,IAAI;EAC1D,MAAMD,UAAU,GAAGE,sBAAsB,CAACH,UAAU,CAAC;EAErD,MAAMI,QAAQ,GAAGP,SAAS,CAACQ,IAAI,CAC5BC,QAAQ,IAAKA,QAAQ,CAACL,UAAU,KAAKA,UACxC,CAAC;EAED,IAAI,CAACG,QAAQ,EAAE;IACb,MAAM,IAAIG,KAAK,CAAC,qCAAqCP,UAAU,GAAG,CAAC;EACrE;EAEA,OAAOQ,eAAe,CAACJ,QAAQ,CAAC;AAClC;;AAEA;AACA;AACA;AACA,OAAO,SAASK,aAAaA,CAC3BV,IAAoB,EACmC;EACvD,OAAOW,OAAO,CAACX,IAAI,CAAC,IAAIY,KAAK,CAACC,OAAO,CAACb,IAAI,CAACc,UAAU,CAAC;AACxD;;AAEA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAC/
|
1
|
+
{"version":3,"file":"helpers.js","names":["ControllerNames","ControllerTypes","ControllerType","PageTypes","getPageDefaults","page","nameOrPath","controller","Page","controllerNameFromPath","defaults","find","pageType","Error","structuredClone","hasComponents","hasNext","Array","isArray","components","hasComponentsEvenIfNoNext","undefined","hasFormComponents","Start","hasRepeater","Repeat","isControllerName","map","String","includes","Terminal","FileUpload","options","path","name"],"sources":["../../../src/pages/helpers.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types.js'\nimport {\n type Link,\n type Page,\n type PageFileUpload,\n type PageQuestion,\n type PageRepeat\n} from '~/src/form/form-definition/types.js'\nimport {\n ControllerNames,\n ControllerTypes\n} from '~/src/pages/controller-types.js'\nimport { ControllerType } from '~/src/pages/enums.js'\nimport { PageTypes } from '~/src/pages/page-types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getPageDefaults<PageType extends Page>(\n page?: Pick<PageType, 'controller'>\n) {\n const nameOrPath = page?.controller ?? ControllerType.Page\n const controller = controllerNameFromPath(nameOrPath)\n\n const defaults = PageTypes.find(\n (pageType) => pageType.controller === controller\n )\n\n if (!defaults) {\n throw new Error(`Defaults not found for page type '${nameOrPath}'`)\n }\n\n return structuredClone(defaults) as PageType\n}\n\n/**\n * Check page has components\n */\nexport function hasComponents(\n page?: Partial<Page>\n): page is Extract<Page, { components: ComponentDef[] }> {\n return hasNext(page) && Array.isArray(page.components)\n}\n\n/**\n * Check if the page has components (the page can be any page type e.g. SummaryPage)\n */\nexport function hasComponentsEvenIfNoNext(\n page?: Partial<Page>\n): page is Extract<Page, { components: ComponentDef[] }> {\n return (\n page !== undefined && 'components' in page && Array.isArray(page.components)\n )\n}\n\n/**\n * Check page has form components\n */\nexport function hasFormComponents(\n page?: Partial<Page>\n): page is PageQuestion | PageFileUpload {\n const controller = controllerNameFromPath(page?.controller)\n return hasComponents(page) && controller !== ControllerType.Start\n}\n\n/**\n * Check page has repeater\n */\nexport function hasRepeater(page?: Partial<Page>): page is PageRepeat {\n return controllerNameFromPath(page?.controller) === ControllerType.Repeat\n}\n\n/**\n * Check for known page controller names\n */\nexport function isControllerName(\n nameOrPath?: ControllerType | string\n): nameOrPath is ControllerType {\n return !!nameOrPath && ControllerNames.map(String).includes(nameOrPath)\n}\n\n/**\n * Check page has next link\n */\nexport function hasNext(\n page?: Partial<Page>\n): page is Extract<Page, { next: Link[] }> {\n if (!page || !('next' in page)) {\n return false\n }\n\n const controller = controllerNameFromPath(page.controller)\n\n return (\n !controller ||\n controller === ControllerType.Start ||\n controller === ControllerType.Page ||\n controller === ControllerType.Terminal ||\n controller === ControllerType.FileUpload ||\n controller === ControllerType.Repeat\n )\n}\n\n/**\n * Check and optionally replace legacy path with controller name\n * @param {string} [nameOrPath] - Controller name or legacy controller path\n */\nexport function controllerNameFromPath(nameOrPath?: ControllerType | string) {\n if (isControllerName(nameOrPath)) {\n return nameOrPath\n }\n\n const options = ControllerTypes.find(({ path }) => path === nameOrPath)\n return options?.name\n}\n"],"mappings":"AAQA,SACEA,eAAe,EACfC,eAAe;AAEjB,SAASC,cAAc;AACvB,SAASC,SAAS;;AAElB;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC7BC,IAAmC,EACnC;EACA,MAAMC,UAAU,GAAGD,IAAI,EAAEE,UAAU,IAAIL,cAAc,CAACM,IAAI;EAC1D,MAAMD,UAAU,GAAGE,sBAAsB,CAACH,UAAU,CAAC;EAErD,MAAMI,QAAQ,GAAGP,SAAS,CAACQ,IAAI,CAC5BC,QAAQ,IAAKA,QAAQ,CAACL,UAAU,KAAKA,UACxC,CAAC;EAED,IAAI,CAACG,QAAQ,EAAE;IACb,MAAM,IAAIG,KAAK,CAAC,qCAAqCP,UAAU,GAAG,CAAC;EACrE;EAEA,OAAOQ,eAAe,CA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IAAI,IAClCD,UAAU,KAAKL,cAAc,CAAC4B,QAAQ,IACtCvB,UAAU,KAAKL,cAAc,CAAC6B,UAAU,IACxCxB,UAAU,KAAKL,cAAc,CAACuB,MAAM;AAExC;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAAShB,sBAAsBA,CAACH,UAAoC,EAAE;EAC3E,IAAIoB,gBAAgB,CAACpB,UAAU,CAAC,EAAE;IAChC,OAAOA,UAAU;EACnB;EAEA,MAAM0B,OAAO,GAAG/B,eAAe,CAACU,IAAI,CAAC,CAAC;IAAEsB;EAAK,CAAC,KAAKA,IAAI,KAAK3B,UAAU,CAAC;EACvE,OAAO0B,OAAO,EAAEE,IAAI;AACtB","ignoreList":[]}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
export { ControllerNames, ControllerTypes } from "./controller-types.js";
|
2
2
|
export { PageTypes } from "./page-types.js";
|
3
|
-
export { controllerNameFromPath, getPageDefaults, hasComponents, hasFormComponents, hasNext, hasRepeater, isControllerName } from "./helpers.js";
|
3
|
+
export { controllerNameFromPath, getPageDefaults, hasComponents, hasComponentsEvenIfNoNext, hasFormComponents, hasNext, hasRepeater, isControllerName } from "./helpers.js";
|
4
4
|
export { ControllerPath, ControllerType } from "./enums.js";
|
5
5
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["ControllerNames","ControllerTypes","PageTypes","controllerNameFromPath","getPageDefaults","hasComponents","hasFormComponents","hasNext","hasRepeater","isControllerName","ControllerPath","ControllerType"],"sources":["../../../src/pages/index.ts"],"sourcesContent":["export {\n ControllerNames,\n ControllerTypes\n} from '~/src/pages/controller-types.js'\n\nexport { PageTypes } from '~/src/pages/page-types.js'\n\nexport {\n controllerNameFromPath,\n getPageDefaults,\n hasComponents,\n hasFormComponents,\n hasNext,\n hasRepeater,\n isControllerName\n} from '~/src/pages/helpers.js'\n\nexport { ControllerPath, ControllerType } from '~/src/pages/enums.js'\n"],"mappings":"AAAA,SACEA,eAAe,EACfC,eAAe;AAGjB,SAASC,SAAS;AAElB,SACEC,sBAAsB,EACtBC,eAAe,EACfC,aAAa,EACbC,iBAAiB,EACjBC,OAAO,EACPC,WAAW,EACXC,gBAAgB;AAGlB,SAASC,cAAc,EAAEC,cAAc","ignoreList":[]}
|
1
|
+
{"version":3,"file":"index.js","names":["ControllerNames","ControllerTypes","PageTypes","controllerNameFromPath","getPageDefaults","hasComponents","hasComponentsEvenIfNoNext","hasFormComponents","hasNext","hasRepeater","isControllerName","ControllerPath","ControllerType"],"sources":["../../../src/pages/index.ts"],"sourcesContent":["export {\n ControllerNames,\n ControllerTypes\n} from '~/src/pages/controller-types.js'\n\nexport { PageTypes } from '~/src/pages/page-types.js'\n\nexport {\n controllerNameFromPath,\n getPageDefaults,\n hasComponents,\n hasComponentsEvenIfNoNext,\n hasFormComponents,\n hasNext,\n hasRepeater,\n isControllerName\n} from '~/src/pages/helpers.js'\n\nexport { ControllerPath, ControllerType } from '~/src/pages/enums.js'\n"],"mappings":"AAAA,SACEA,eAAe,EACfC,eAAe;AAGjB,SAASC,SAAS;AAElB,SACEC,sBAAsB,EACtBC,eAAe,EACfC,aAAa,EACbC,yBAAyB,EACzBC,iBAAiB,EACjBC,OAAO,EACPC,WAAW,EACXC,gBAAgB;AAGlB,SAASC,cAAc,EAAEC,cAAc","ignoreList":[]}
|
@@ -52,7 +52,8 @@ export const PageTypes = Object.freeze([{
|
|
52
52
|
title: 'Summary page',
|
53
53
|
path: ControllerPath.Summary,
|
54
54
|
controller: ControllerType.Summary,
|
55
|
-
section: undefined
|
55
|
+
section: undefined,
|
56
|
+
components: []
|
56
57
|
}, {
|
57
58
|
title: 'Status page',
|
58
59
|
path: ControllerPath.Status,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"page-types.js","names":["ControllerPath","ControllerType","PageTypes","Object","freeze","title","path","Start","controller","section","undefined","next","components","Page","Terminal","Repeat","repeat","options","name","schema","min","max","FileUpload","Summary","Status"],"sources":["../../../src/pages/page-types.ts"],"sourcesContent":["import { type Page } from '~/src/form/form-definition/types.js'\nimport { ControllerPath, ControllerType } from '~/src/pages/enums.js'\n\n/**\n * Defaults for creating new pages\n */\nexport const PageTypes: readonly Page[] = Object.freeze([\n {\n title: 'Start page',\n path: ControllerPath.Start,\n controller: ControllerType.Start,\n section: undefined,\n next: [],\n components: []\n },\n {\n title: 'Question page',\n path: '/question-page',\n controller: ControllerType.Page,\n section: undefined,\n next: [],\n components: []\n },\n {\n title: 'Terminal page',\n path: '/terminal-page',\n controller: ControllerType.Terminal,\n section: undefined,\n next: [],\n components: []\n },\n {\n title: 'Add another',\n path: '/add-another-page',\n controller: ControllerType.Repeat,\n repeat: {\n options: { name: '', title: '' },\n schema: { min: 1, max: 25 }\n },\n section: undefined,\n next: [],\n components: []\n },\n {\n title: 'File upload page',\n path: '/file-upload-page',\n controller: ControllerType.FileUpload,\n section: undefined,\n next: [],\n components: []\n },\n {\n title: 'Summary page',\n path: ControllerPath.Summary,\n controller: ControllerType.Summary,\n section: undefined\n },\n {\n title: 'Status page',\n path: ControllerPath.Status,\n controller: ControllerType.Status,\n section: undefined\n }\n])\n"],"mappings":"AACA,SAASA,cAAc,EAAEC,cAAc;;AAEvC;AACA;AACA;AACA,OAAO,MAAMC,SAA0B,GAAGC,MAAM,CAACC,MAAM,CAAC,CACtD;EACEC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEN,cAAc,CAACO,KAAK;EAC1BC,UAAU,EAAEP,cAAc,CAACM,KAAK;EAChCE,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,eAAe;EACtBC,IAAI,EAAE,gBAAgB;EACtBE,UAAU,EAAEP,cAAc,CAACY,IAAI;EAC/BJ,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,eAAe;EACtBC,IAAI,EAAE,gBAAgB;EACtBE,UAAU,EAAEP,cAAc,CAACa,QAAQ;EACnCL,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,aAAa;EACpBC,IAAI,EAAE,mBAAmB;EACzBE,UAAU,EAAEP,cAAc,CAACc,MAAM;EACjCC,MAAM,EAAE;IACNC,OAAO,EAAE;MAAEC,IAAI,EAAE,EAAE;MAAEb,KAAK,EAAE;IAAG,CAAC;IAChCc,MAAM,EAAE;MAAEC,GAAG,EAAE,CAAC;MAAEC,GAAG,EAAE;IAAG;EAC5B,CAAC;EACDZ,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,kBAAkB;EACzBC,IAAI,EAAE,mBAAmB;EACzBE,UAAU,EAAEP,cAAc,CAACqB,UAAU;EACrCb,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,cAAc;EACrBC,IAAI,EAAEN,cAAc,CAACuB,OAAO;EAC5Bf,UAAU,EAAEP,cAAc,CAACsB,OAAO;EAClCd,OAAO,EAAEC;
|
1
|
+
{"version":3,"file":"page-types.js","names":["ControllerPath","ControllerType","PageTypes","Object","freeze","title","path","Start","controller","section","undefined","next","components","Page","Terminal","Repeat","repeat","options","name","schema","min","max","FileUpload","Summary","Status"],"sources":["../../../src/pages/page-types.ts"],"sourcesContent":["import { type Page } from '~/src/form/form-definition/types.js'\nimport { ControllerPath, ControllerType } from '~/src/pages/enums.js'\n\n/**\n * Defaults for creating new pages\n */\nexport const PageTypes: readonly Page[] = Object.freeze([\n {\n title: 'Start page',\n path: ControllerPath.Start,\n controller: ControllerType.Start,\n section: undefined,\n next: [],\n components: []\n },\n {\n title: 'Question page',\n path: '/question-page',\n controller: ControllerType.Page,\n section: undefined,\n next: [],\n components: []\n },\n {\n title: 'Terminal page',\n path: '/terminal-page',\n controller: ControllerType.Terminal,\n section: undefined,\n next: [],\n components: []\n },\n {\n title: 'Add another',\n path: '/add-another-page',\n controller: ControllerType.Repeat,\n repeat: {\n options: { name: '', title: '' },\n schema: { min: 1, max: 25 }\n },\n section: undefined,\n next: [],\n components: []\n },\n {\n title: 'File upload page',\n path: '/file-upload-page',\n controller: ControllerType.FileUpload,\n section: undefined,\n next: [],\n components: []\n },\n {\n title: 'Summary page',\n path: ControllerPath.Summary,\n controller: ControllerType.Summary,\n section: undefined,\n components: []\n },\n {\n title: 'Status page',\n path: ControllerPath.Status,\n controller: ControllerType.Status,\n section: undefined\n }\n])\n"],"mappings":"AACA,SAASA,cAAc,EAAEC,cAAc;;AAEvC;AACA;AACA;AACA,OAAO,MAAMC,SAA0B,GAAGC,MAAM,CAACC,MAAM,CAAC,CACtD;EACEC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEN,cAAc,CAACO,KAAK;EAC1BC,UAAU,EAAEP,cAAc,CAACM,KAAK;EAChCE,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,eAAe;EACtBC,IAAI,EAAE,gBAAgB;EACtBE,UAAU,EAAEP,cAAc,CAACY,IAAI;EAC/BJ,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,eAAe;EACtBC,IAAI,EAAE,gBAAgB;EACtBE,UAAU,EAAEP,cAAc,CAACa,QAAQ;EACnCL,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,aAAa;EACpBC,IAAI,EAAE,mBAAmB;EACzBE,UAAU,EAAEP,cAAc,CAACc,MAAM;EACjCC,MAAM,EAAE;IACNC,OAAO,EAAE;MAAEC,IAAI,EAAE,EAAE;MAAEb,KAAK,EAAE;IAAG,CAAC;IAChCc,MAAM,EAAE;MAAEC,GAAG,EAAE,CAAC;MAAEC,GAAG,EAAE;IAAG;EAC5B,CAAC;EACDZ,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,kBAAkB;EACzBC,IAAI,EAAE,mBAAmB;EACzBE,UAAU,EAAEP,cAAc,CAACqB,UAAU;EACrCb,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,cAAc;EACrBC,IAAI,EAAEN,cAAc,CAACuB,OAAO;EAC5Bf,UAAU,EAAEP,cAAc,CAACsB,OAAO;EAClCd,OAAO,EAAEC,SAAS;EAClBE,UAAU,EAAE;AACd,CAAC,EACD;EACEP,KAAK,EAAE,aAAa;EACpBC,IAAI,EAAEN,cAAc,CAACwB,MAAM;EAC3BhB,UAAU,EAAEP,cAAc,CAACuB,MAAM;EACjCf,OAAO,EAAEC;AACX,CAAC,CACF,CAAC","ignoreList":[]}
|
@@ -103,7 +103,9 @@ export interface CheckboxOrRadioItem {
|
|
103
103
|
/**
|
104
104
|
* Provide additional content to reveal when the checkbox/radio is checked
|
105
105
|
*/
|
106
|
-
conditional?:
|
106
|
+
conditional?: {
|
107
|
+
html?: string;
|
108
|
+
};
|
107
109
|
/**
|
108
110
|
* The behaviour - if set to "exclusive" implements a 'None of thse' type behaviour via Javascript when checkboxes are clicked
|
109
111
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAA;AACj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CAAA;IAEX;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;OAEG;IACH,WAAW,CAAC,EAAE;QACZ,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;IAED;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB"}
|
@@ -78,6 +78,7 @@ export interface PageSummary extends PageBase {
|
|
78
78
|
path: ControllerPath.Summary | string;
|
79
79
|
controller: ControllerType.Summary;
|
80
80
|
section?: undefined;
|
81
|
+
components?: ComponentDef[];
|
81
82
|
}
|
82
83
|
export interface PageStatus extends PageBase {
|
83
84
|
path: ControllerPath.Status | string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/form-definition/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAEpE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE/E,oBAAY,MAAM;IAChB,EAAE,OAAO;IACT,EAAE,OAAO;CACV;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAA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AAK,EAAE,IAAI,EAAE,CAAA;IACb,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE;QACP,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;QAC7B,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACF"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import Joi from 'joi';
|
2
|
-
import { type FormEditorInputPage, type FormEditorInputPageSettings, type FormEditorInputQuestion } from '../../form/form-editor/types.js';
|
2
|
+
import { type FormEditorInputCheckAnswersSettings, type FormEditorInputPage, type FormEditorInputPageSettings, type FormEditorInputQuestion } from '../../form/form-editor/types.js';
|
3
3
|
export declare const pageTypeSchema: Joi.StringSchema<string>;
|
4
4
|
export declare const questionTypeSchema: Joi.StringSchema<string>;
|
5
5
|
export declare const questionTypeFullSchema: Joi.StringSchema<string>;
|
@@ -12,6 +12,8 @@ export declare const shortDescriptionSchema: Joi.StringSchema<string>;
|
|
12
12
|
export declare const pageHeadingAndGuidanceSchema: Joi.StringSchema<string>;
|
13
13
|
export declare const pageHeadingSchema: Joi.StringSchema<string>;
|
14
14
|
export declare const guidanceTextSchema: Joi.StringSchema<string>;
|
15
|
+
export declare const needDeclarationSchema: Joi.StringSchema<string>;
|
16
|
+
export declare const declarationTextSchema: Joi.StringSchema<string>;
|
15
17
|
export declare const formEditorInputPageKeys: {
|
16
18
|
pageType: Joi.StringSchema<string>;
|
17
19
|
questionType: Joi.StringSchema<string>;
|
@@ -21,6 +23,14 @@ export declare const formEditorInputPageKeys: {
|
|
21
23
|
* @see {@link FormEditorInputPage}
|
22
24
|
*/
|
23
25
|
export declare const formEditorInputPageSchema: Joi.ObjectSchema<FormEditorInputPage>;
|
26
|
+
export declare const formEditorInputheckAnswersSettingsKeys: {
|
27
|
+
declarationText: Joi.StringSchema<string>;
|
28
|
+
};
|
29
|
+
/**
|
30
|
+
* Joi schema for `FormEditorInputCheckAnswersSettings` interface
|
31
|
+
* @see {@link FormEditorInputCheckAnswersSettings}
|
32
|
+
*/
|
33
|
+
export declare const formEditorInputCheckAnswersSettingSchema: Joi.ObjectSchema<FormEditorInputCheckAnswersSettings>;
|
24
34
|
export declare const formEditorInputQuestionKeys: {
|
25
35
|
question: Joi.StringSchema<string>;
|
26
36
|
shortDescription: Joi.StringSchema<string>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/form-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AAGrB,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC7B,MAAM,iCAAiC,CAAA;AAExC,eAAO,MAAM,cAAc,0BAEK,CAAA;AAChC,eAAO,MAAM,kBAAkB,0BAU5B,CAAA;AAEH,eAAO,MAAM,sBAAsB,0BAahC,CAAA;AAEH,eAAO,MAAM,sBAAsB,0BAMhC,CAAA;AACH,eAAO,MAAM,aAAa,0BAE0C,CAAA;AAEpE,eAAO,MAAM,cAAc,0BAA0B,CAAA;AACrD,eAAO,MAAM,cAAc,0BAAoC,CAAA;AAC/D,eAAO,MAAM,sBAAsB,0BAA4C,CAAA;AAC/E,eAAO,MAAM,sBAAsB,0BAA0B,CAAA;AAC7D,eAAO,MAAM,4BAA4B,0BAA0B,CAAA;AACnE,eAAO,MAAM,iBAAiB,0BAA0B,CAAA;AACxD,eAAO,MAAM,kBAAkB,0BAAoC,CAAA;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/form-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AAGrB,OAAO,EACL,KAAK,mCAAmC,EACxC,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC7B,MAAM,iCAAiC,CAAA;AAExC,eAAO,MAAM,cAAc,0BAEK,CAAA;AAChC,eAAO,MAAM,kBAAkB,0BAU5B,CAAA;AAEH,eAAO,MAAM,sBAAsB,0BAahC,CAAA;AAEH,eAAO,MAAM,sBAAsB,0BAMhC,CAAA;AACH,eAAO,MAAM,aAAa,0BAE0C,CAAA;AAEpE,eAAO,MAAM,cAAc,0BAA0B,CAAA;AACrD,eAAO,MAAM,cAAc,0BAAoC,CAAA;AAC/D,eAAO,MAAM,sBAAsB,0BAA4C,CAAA;AAC/E,eAAO,MAAM,sBAAsB,0BAA0B,CAAA;AAC7D,eAAO,MAAM,4BAA4B,0BAA0B,CAAA;AACnE,eAAO,MAAM,iBAAiB,0BAA0B,CAAA;AACxD,eAAO,MAAM,kBAAkB,0BAAoC,CAAA;AACnE,eAAO,MAAM,qBAAqB,0BAA0B,CAAA;AAC5D,eAAO,MAAM,qBAAqB,0BAA0B,CAAA;AAE5D,eAAO,MAAM,uBAAuB;;;CAGnC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,uCAEzB,CAAA;AAEb,eAAO,MAAM,sCAAsC;;CAElD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,wCAAwC,uDAGtC,CAAA;AAEf,eAAO,MAAM,2BAA2B;;;;;CAKvC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,6BAA6B,2CAG3B,CAAA;AAEf,eAAO,MAAM,+BAA+B;;;;CAI3C,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,+CAG/B,CAAA"}
|
@@ -46,8 +46,17 @@ export interface FormEditor {
|
|
46
46
|
* The page guidance text
|
47
47
|
*/
|
48
48
|
guidanceText: string;
|
49
|
+
/**
|
50
|
+
* The value of radio to reveal declaration text field
|
51
|
+
*/
|
52
|
+
needDeclaration: string;
|
53
|
+
/**
|
54
|
+
* The check answers declaration text
|
55
|
+
*/
|
56
|
+
declarationText: string;
|
49
57
|
}
|
50
58
|
export type FormEditorInputPage = Pick<FormEditor, 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub'>;
|
59
|
+
export type FormEditorInputCheckAnswersSettings = Pick<FormEditor, 'needDeclaration' | 'declarationText'>;
|
51
60
|
export type FormEditorInputQuestion = Pick<FormEditor, 'questionType' | 'question' | 'shortDescription' | 'hintText' | 'questionOptional'>;
|
52
61
|
export type FormEditorInputPageSettings = Pick<FormEditor, 'pageHeadingAndGuidance' | 'pageHeading' | 'guidanceText'>;
|
53
62
|
//# sourceMappingURL=types.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/form-editor/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IAEhC;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAA;IAE9B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/form-editor/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IAEhC;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAA;IAE9B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IAEpB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAA;IAEvB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,UAAU,EACV,UAAU,GAAG,cAAc,GAAG,kBAAkB,GAAG,SAAS,CAC7D,CAAA;AAED,MAAM,MAAM,mCAAmC,GAAG,IAAI,CACpD,UAAU,EACV,iBAAiB,GAAG,iBAAiB,CACtC,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,UAAU,EACR,cAAc,GACd,UAAU,GACV,kBAAkB,GAClB,UAAU,GACV,kBAAkB,CACrB,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC5C,UAAU,EACV,wBAAwB,GAAG,aAAa,GAAG,cAAc,CAC1D,CAAA"}
|
@@ -11,6 +11,12 @@ export declare function getPageDefaults<PageType extends Page>(page?: Pick<PageT
|
|
11
11
|
export declare function hasComponents(page?: Partial<Page>): page is Extract<Page, {
|
12
12
|
components: ComponentDef[];
|
13
13
|
}>;
|
14
|
+
/**
|
15
|
+
* Check if the page has components (the page can be any page type e.g. SummaryPage)
|
16
|
+
*/
|
17
|
+
export declare function hasComponentsEvenIfNoNext(page?: Partial<Page>): page is Extract<Page, {
|
18
|
+
components: ComponentDef[];
|
19
|
+
}>;
|
14
20
|
/**
|
15
21
|
* Check page has form components
|
16
22
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/pages/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EACL,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,UAAU,EAChB,MAAM,qCAAqC,CAAA;AAK5C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAGrD;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,IAAI,EACnD,IAAI,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,GAaC,QAAQ,CAC7C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GACnB,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,YAAY,EAAE,CAAA;CAAE,CAAC,CAEvD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GACnB,IAAI,IAAI,YAAY,GAAG,cAAc,CAGvC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,UAAU,CAEpE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,CAAC,EAAE,cAAc,GAAG,MAAM,GACnC,UAAU,IAAI,cAAc,CAE9B;AAED;;GA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IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,UAAU,CAEpE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,CAAC,EAAE,cAAc,GAAG,MAAM,GACnC,UAAU,IAAI,cAAc,CAE9B;AAED;;GAEG;AACH,wBAAgB,OAAO,CACrB,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GACnB,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,IAAI,EAAE,CAAA;CAAE,CAAC,CAezC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,CAAC,EAAE,cAAc,GAAG,MAAM,8BAO1E"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
export { ControllerNames, ControllerTypes } from '../pages/controller-types.js';
|
2
2
|
export { PageTypes } from '../pages/page-types.js';
|
3
|
-
export { controllerNameFromPath, getPageDefaults, hasComponents, hasFormComponents, hasNext, hasRepeater, isControllerName } from '../pages/helpers.js';
|
3
|
+
export { controllerNameFromPath, getPageDefaults, hasComponents, hasComponentsEvenIfNoNext, hasFormComponents, hasNext, hasRepeater, isControllerName } from '../pages/helpers.js';
|
4
4
|
export { ControllerPath, ControllerType } from '../pages/enums.js';
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,eAAe,EAChB,MAAM,iCAAiC,CAAA;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,gBAAgB,EACjB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,eAAe,EAChB,MAAM,iCAAiC,CAAA;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,aAAa,EACb,yBAAyB,EACzB,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,gBAAgB,EACjB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"page-types.d.ts","sourceRoot":"","sources":["../../../src/pages/page-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,qCAAqC,CAAA;AAG/D;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,IAAI,
|
1
|
+
{"version":3,"file":"page-types.d.ts","sourceRoot":"","sources":["../../../src/pages/page-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,qCAAqC,CAAA;AAG/D;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,IAAI,EA0DnC,CAAA"}
|
package/package.json
CHANGED
package/src/common/types.ts
CHANGED
@@ -127,7 +127,9 @@ export interface CheckboxOrRadioItem {
|
|
127
127
|
/**
|
128
128
|
* Provide additional content to reveal when the checkbox/radio is checked
|
129
129
|
*/
|
130
|
-
conditional?:
|
130
|
+
conditional?: {
|
131
|
+
html?: string
|
132
|
+
}
|
131
133
|
|
132
134
|
/**
|
133
135
|
* The behaviour - if set to "exclusive" implements a 'None of thse' type behaviour via Javascript when checkboxes are clicked
|
@@ -94,6 +94,7 @@ export interface PageSummary extends PageBase {
|
|
94
94
|
path: ControllerPath.Summary | string
|
95
95
|
controller: ControllerType.Summary
|
96
96
|
section?: undefined
|
97
|
+
components?: ComponentDef[]
|
97
98
|
}
|
98
99
|
|
99
100
|
export interface PageStatus extends PageBase {
|
@@ -166,7 +167,7 @@ export interface FormDefinition {
|
|
166
167
|
name?: string
|
167
168
|
feedback?: Feedback
|
168
169
|
phaseBanner?: PhaseBanner
|
169
|
-
declaration?: string
|
170
|
+
declaration?: string // Deprecated in v2
|
170
171
|
skipSummary?: never
|
171
172
|
metadata?: Record<string, unknown>
|
172
173
|
outputEmail?: string
|
@@ -2,6 +2,7 @@ import Joi from 'joi'
|
|
2
2
|
|
3
3
|
import { ComponentType } from '~/src/components/enums.js'
|
4
4
|
import {
|
5
|
+
type FormEditorInputCheckAnswersSettings,
|
5
6
|
type FormEditorInputPage,
|
6
7
|
type FormEditorInputPageSettings,
|
7
8
|
type FormEditorInputQuestion
|
@@ -55,6 +56,8 @@ export const shortDescriptionSchema = Joi.string().required()
|
|
55
56
|
export const pageHeadingAndGuidanceSchema = Joi.string().optional()
|
56
57
|
export const pageHeadingSchema = Joi.string().required()
|
57
58
|
export const guidanceTextSchema = Joi.string().optional().allow('')
|
59
|
+
export const needDeclarationSchema = Joi.string().required()
|
60
|
+
export const declarationTextSchema = Joi.string().required()
|
58
61
|
|
59
62
|
export const formEditorInputPageKeys = {
|
60
63
|
pageType: pageTypeSchema,
|
@@ -69,6 +72,19 @@ export const formEditorInputPageSchema = Joi.object<FormEditorInputPage>()
|
|
69
72
|
.keys(formEditorInputPageKeys)
|
70
73
|
.required()
|
71
74
|
|
75
|
+
export const formEditorInputheckAnswersSettingsKeys = {
|
76
|
+
declarationText: shortDescriptionSchema
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Joi schema for `FormEditorInputCheckAnswersSettings` interface
|
81
|
+
* @see {@link FormEditorInputCheckAnswersSettings}
|
82
|
+
*/
|
83
|
+
export const formEditorInputCheckAnswersSettingSchema =
|
84
|
+
Joi.object<FormEditorInputCheckAnswersSettings>()
|
85
|
+
.keys(formEditorInputheckAnswersSettingsKeys)
|
86
|
+
.required()
|
87
|
+
|
72
88
|
export const formEditorInputQuestionKeys = {
|
73
89
|
question: questionSchema,
|
74
90
|
shortDescription: shortDescriptionSchema,
|
@@ -56,6 +56,16 @@ export interface FormEditor {
|
|
56
56
|
* The page guidance text
|
57
57
|
*/
|
58
58
|
guidanceText: string
|
59
|
+
|
60
|
+
/**
|
61
|
+
* The value of radio to reveal declaration text field
|
62
|
+
*/
|
63
|
+
needDeclaration: string
|
64
|
+
|
65
|
+
/**
|
66
|
+
* The check answers declaration text
|
67
|
+
*/
|
68
|
+
declarationText: string
|
59
69
|
}
|
60
70
|
|
61
71
|
export type FormEditorInputPage = Pick<
|
@@ -63,6 +73,11 @@ export type FormEditorInputPage = Pick<
|
|
63
73
|
'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub'
|
64
74
|
>
|
65
75
|
|
76
|
+
export type FormEditorInputCheckAnswersSettings = Pick<
|
77
|
+
FormEditor,
|
78
|
+
'needDeclaration' | 'declarationText'
|
79
|
+
>
|
80
|
+
|
66
81
|
export type FormEditorInputQuestion = Pick<
|
67
82
|
FormEditor,
|
68
83
|
| 'questionType'
|
package/src/pages/helpers.ts
CHANGED
@@ -42,6 +42,17 @@ export function hasComponents(
|
|
42
42
|
return hasNext(page) && Array.isArray(page.components)
|
43
43
|
}
|
44
44
|
|
45
|
+
/**
|
46
|
+
* Check if the page has components (the page can be any page type e.g. SummaryPage)
|
47
|
+
*/
|
48
|
+
export function hasComponentsEvenIfNoNext(
|
49
|
+
page?: Partial<Page>
|
50
|
+
): page is Extract<Page, { components: ComponentDef[] }> {
|
51
|
+
return (
|
52
|
+
page !== undefined && 'components' in page && Array.isArray(page.components)
|
53
|
+
)
|
54
|
+
}
|
55
|
+
|
45
56
|
/**
|
46
57
|
* Check page has form components
|
47
58
|
*/
|
package/src/pages/index.ts
CHANGED
package/src/pages/page-types.ts
CHANGED