@defra/forms-model 3.0.421 → 3.0.423
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/form/form-editor/index.js +21 -13
- package/dist/module/form/form-editor/index.js.map +1 -1
- package/dist/module/form/form-editor/types.js.map +1 -1
- package/dist/types/form/form-editor/index.d.ts +8 -0
- package/dist/types/form/form-editor/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/types.d.ts +35 -9
- package/dist/types/form/form-editor/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/form/form-editor/index.ts +24 -13
- package/src/form/form-editor/types.ts +54 -9
@@ -5,20 +5,28 @@ export const questionTypeSchema = Joi.string().required().valid('written-answer-
|
|
5
5
|
export const questionTypeFullSchema = Joi.string().required().valid(ComponentType.TextField, ComponentType.MultilineTextField, ComponentType.NumberField, ComponentType.DatePartsField, ComponentType.MonthYearField, ComponentType.UkAddressField, ComponentType.TelephoneNumberField, ComponentType.FileUploadField, ComponentType.EmailAddressField, ComponentType.SelectField);
|
6
6
|
export const writtenAnswerSubSchema = Joi.string().required().valid(ComponentType.TextField, ComponentType.MultilineTextField, ComponentType.NumberField);
|
7
7
|
export const dateSubSchema = Joi.string().required().valid(ComponentType.DatePartsField, ComponentType.MonthYearField);
|
8
|
-
export const nameSchema = Joi.string().required();
|
9
|
-
export const questionSchema = Joi.string().required();
|
10
|
-
export const hintTextSchema = Joi.string().optional().allow('');
|
11
|
-
export const questionOptionalSchema = Joi.string().optional().valid('', 'true');
|
12
|
-
export const shortDescriptionSchema = Joi.string().required();
|
13
|
-
export const pageHeadingAndGuidanceSchema = Joi.string().optional();
|
14
|
-
export const pageHeadingSchema = Joi.string().required();
|
15
|
-
export const guidanceTextSchema = Joi.string().
|
16
|
-
export const needDeclarationSchema = Joi.string().required();
|
17
|
-
export const declarationTextSchema = Joi.string().required();
|
18
|
-
export const
|
19
|
-
export const
|
8
|
+
export const nameSchema = Joi.string().trim().required();
|
9
|
+
export const questionSchema = Joi.string().trim().required();
|
10
|
+
export const hintTextSchema = Joi.string().trim().optional().allow('');
|
11
|
+
export const questionOptionalSchema = Joi.string().trim().optional().valid('', 'true');
|
12
|
+
export const shortDescriptionSchema = Joi.string().trim().required();
|
13
|
+
export const pageHeadingAndGuidanceSchema = Joi.string().trim().optional();
|
14
|
+
export const pageHeadingSchema = Joi.string().trim().required();
|
15
|
+
export const guidanceTextSchema = Joi.string().trim();
|
16
|
+
export const needDeclarationSchema = Joi.string().trim().required();
|
17
|
+
export const declarationTextSchema = Joi.string().trim().required();
|
18
|
+
export const minSchema = Joi.number().empty('').integer();
|
19
|
+
export const maxSchema = Joi.number().empty('').integer().min(1);
|
20
|
+
export const minLengthSchema = Joi.number().empty('').integer().min(1);
|
21
|
+
export const maxLengthSchema = Joi.number().empty('').integer().min(1);
|
22
|
+
export const maxFutureSchema = Joi.number().empty('').integer().min(1);
|
23
|
+
export const maxPastSchema = Joi.number().empty('').integer().min(1);
|
24
|
+
export const precisionSchema = Joi.number().empty('').integer().min(1);
|
25
|
+
export const prefixSchema = Joi.string().trim().optional().allow('');
|
20
26
|
export const regexSchema = Joi.string().optional().allow('');
|
21
|
-
export const
|
27
|
+
export const rowsSchema = Joi.number().empty('').integer().min(1);
|
28
|
+
export const suffixSchema = Joi.string().trim().optional().allow('');
|
29
|
+
export const classesSchema = Joi.string().trim().optional().allow('');
|
22
30
|
export const formEditorInputPageKeys = {
|
23
31
|
pageType: pageTypeSchema,
|
24
32
|
questionType: questionTypeSchema
|
@@ -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","nameSchema","questionSchema","hintTextSchema","optional","allow","questionOptionalSchema","shortDescriptionSchema","pageHeadingAndGuidanceSchema","pageHeadingSchema","guidanceTextSchema","needDeclarationSchema","declarationTextSchema","minLengthSchema","number","empty","min","maxLengthSchema","regexSchema","classesSchema","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 nameSchema = Joi.string().required()\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()\nexport const minLengthSchema = Joi.number().empty('').min(1)\nexport const maxLengthSchema = Joi.number().empty('').min(1)\nexport const regexSchema = Joi.string().optional().allow('')\nexport const classesSchema = 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 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":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,GAAG,CAAC2C,MAAM,CAA8B,CAAC,CACtCC,IAAI,CAACU,+BAA+B,CAAC,CACrClD,QAAQ,CAAC,CAAC","ignoreList":[]}
|
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","nameSchema","trim","questionSchema","hintTextSchema","optional","allow","questionOptionalSchema","shortDescriptionSchema","pageHeadingAndGuidanceSchema","pageHeadingSchema","guidanceTextSchema","needDeclarationSchema","declarationTextSchema","minSchema","number","empty","integer","maxSchema","min","minLengthSchema","maxLengthSchema","maxFutureSchema","maxPastSchema","precisionSchema","prefixSchema","regexSchema","rowsSchema","suffixSchema","classesSchema","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 nameSchema = Joi.string().trim().required()\nexport const questionSchema = Joi.string().trim().required()\nexport const hintTextSchema = Joi.string().trim().optional().allow('')\nexport const questionOptionalSchema = Joi.string()\n .trim()\n .optional()\n .valid('', 'true')\nexport const shortDescriptionSchema = Joi.string().trim().required()\nexport const pageHeadingAndGuidanceSchema = Joi.string().trim().optional()\nexport const pageHeadingSchema = Joi.string().trim().required()\nexport const guidanceTextSchema = Joi.string().trim()\nexport const needDeclarationSchema = Joi.string().trim().required()\nexport const declarationTextSchema = Joi.string().trim().required()\nexport const minSchema = Joi.number().empty('').integer()\nexport const maxSchema = Joi.number().empty('').integer().min(1)\nexport const minLengthSchema = Joi.number().empty('').integer().min(1)\nexport const maxLengthSchema = Joi.number().empty('').integer().min(1)\nexport const maxFutureSchema = Joi.number().empty('').integer().min(1)\nexport const maxPastSchema = Joi.number().empty('').integer().min(1)\nexport const precisionSchema = Joi.number().empty('').integer().min(1)\nexport const prefixSchema = Joi.string().trim().optional().allow('')\nexport const regexSchema = Joi.string().optional().allow('')\nexport const rowsSchema = Joi.number().empty('').integer().min(1)\nexport const suffixSchema = Joi.string().trim().optional().allow('')\nexport const classesSchema = Joi.string().trim().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 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,CAAC,CACvCC,QAAQ,CAAC,CAAC,CACVC,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC;AAChC,OAAO,MAAMC,kBAAkB,GAAGN,GAAG,CAACG,MAAM,CAAC,CAAC,CAC3CC,QAAQ,CAAC,CAAC,CACVC,KAAK,CACJ,sBAAsB,EACtB,YAAY,EACZJ,aAAa,CAACM,cAAc,EAC5BN,aAAa,CAACO,oBAAoB,EAClCP,aAAa,CAACQ,eAAe,EAC7BR,aAAa,CAACS,iBAAiB,EAC/BT,aAAa,CAACU,WAChB,CAAC;AAEH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MwB,uBAAuB,GAAG;EACrCC,QAAQ,EAAEhD,cAAc;EACxBiD,YAAY,EAAE7C;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAM8C,yBAAyB,GAAGpD,GAAG,CAACqD,MAAM,CAAsB,CAAC,CACvEC,IAAI,CAACL,uBAAuB,CAAC,CAC7B7C,QAAQ,CAAC,CAAC;AAEb,OAAO,MAAMmD,sCAAsC,GAAG;EACpDC,eAAe,EAAE7B;AACnB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAM8B,wCAAwC,GACnDzD,GAAG,CAACqD,MAAM,CAAsC,CAAC,CAC9CC,IAAI,CAACC,sCAAsC,CAAC,CAC5CnD,QAAQ,CAAC,CAAC;AAEf,OAAO,MAAMsD,2BAA2B,GAAG;EACzCC,QAAQ,EAAErC,cAAc;EACxBsC,gBAAgB,EAAEjC,sBAAsB;EACxCkC,QAAQ,EAAEtC,cAAc;EACxBuC,gBAAgB,EAAEpC;AACpB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMqC,6BAA6B,GACxC/D,GAAG,CAACqD,MAAM,CAA0B,CAAC,CAClCC,IAAI,CAACI,2BAA2B,CAAC,CACjCtD,QAAQ,CAAC,CAAC;AAEf,OAAO,MAAM4D,+BAA+B,GAAG;EAC7CC,sBAAsB,EAAErC,4BAA4B;EACpDsC,WAAW,EAAErC,iBAAiB;EAC9BsC,YAAY,EAAErC;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMsC,iCAAiC,GAC5CpE,GAAG,CAACqD,MAAM,CAA8B,CAAC,CACtCC,IAAI,CAACU,+BAA+B,CAAC,CACrC5D,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 name of the question (unique id)\n */\n name: 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 /**\n * The min length a field can have\n */\n minLength: string\n\n /**\n * The max length a field can have\n */\n maxLength: string\n\n /**\n * The regex value of a field\n */\n regex: string\n\n /**\n * The classes to be applied to a field\n */\n classes: 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 | 'name'\n | 'question'\n | 'shortDescription'\n | 'hintText'\n | 'questionOptional'\n | 'minLength'\n | 'maxLength'\n | 'regex'\n | 'classes'\n>\n\nexport type FormEditorInputPageSettings = Pick<\n FormEditor,\n 'pageHeadingAndGuidance' | 'pageHeading' | 'guidanceText'\n>\n\nexport interface GovukField {\n id?: string\n name?: string\n idPrefix?: string\n value?: string | boolean | number\n classes?: string\n label?: { text?: string; html?: string; classes?: string }\n hint?: { text?: string; html?: string; classes?: string }\n items?: { text?: string; value?: string }\n rows?: number\n}\n\nexport interface FormEditorGovukField {\n question?: GovukField\n hintText?: GovukField\n questionOptional?: GovukField\n shortDescription?: GovukField\n
|
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 name of the question (unique id)\n */\n name: 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 /**\n * The min length a field can have\n */\n minLength: string\n\n /**\n * The max length a field can have\n */\n maxLength: string\n\n /**\n * The regex value of a field\n */\n regex: string\n\n /**\n * The number of rows of a textarea\n */\n rows: string\n\n /**\n * The classes to be applied to a field\n */\n classes: string\n\n /**\n * The prefix to be applied to a field\n */\n prefix: string\n\n /**\n * The suffix to be applied to a field\n */\n suffix: string\n\n /**\n * The decimal precision of a number field\n */\n precision: string\n\n /**\n * The lowest number allowed in a field\n */\n min: string\n\n /**\n * The highest number allowed in a field\n */\n max: string\n\n /**\n * The maximum days in the future to allow for a date\n */\n maxFuture: string\n\n /**\n * The maximum days in the past to allow for a date\n */\n maxPast: 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 | 'name'\n | 'question'\n | 'shortDescription'\n | 'hintText'\n | 'questionOptional'\n | 'minLength'\n | 'maxLength'\n | 'regex'\n | 'rows'\n | 'classes'\n | 'prefix'\n | 'suffix'\n | 'precision'\n | 'min'\n | 'max'\n | 'maxFuture'\n | 'maxPast'\n>\n\nexport type FormEditorInputPageSettings = Pick<\n FormEditor,\n 'pageHeadingAndGuidance' | 'pageHeading' | 'guidanceText'\n>\n\nexport type FormEditorInputGuidancePage = Pick<\n FormEditor,\n 'pageHeading' | 'guidanceText'\n>\n\nexport interface GovukField {\n id?: string\n name?: string\n idPrefix?: string\n value?: string | boolean | number\n classes?: string\n label?: { text?: string; html?: string; classes?: string }\n hint?: { text?: string; html?: string; classes?: string }\n items?: { text?: string; value?: string }\n rows?: number\n type?: string\n}\n\nexport interface FormEditorGovukField {\n question?: GovukField\n hintText?: GovukField\n questionOptional?: GovukField\n shortDescription?: GovukField\n errorMessage?: { text: string }\n}\n"],"mappings":"","ignoreList":[]}
|
@@ -15,9 +15,17 @@ export declare const pageHeadingSchema: Joi.StringSchema<string>;
|
|
15
15
|
export declare const guidanceTextSchema: Joi.StringSchema<string>;
|
16
16
|
export declare const needDeclarationSchema: Joi.StringSchema<string>;
|
17
17
|
export declare const declarationTextSchema: Joi.StringSchema<string>;
|
18
|
+
export declare const minSchema: Joi.NumberSchema<number>;
|
19
|
+
export declare const maxSchema: Joi.NumberSchema<number>;
|
18
20
|
export declare const minLengthSchema: Joi.NumberSchema<number>;
|
19
21
|
export declare const maxLengthSchema: Joi.NumberSchema<number>;
|
22
|
+
export declare const maxFutureSchema: Joi.NumberSchema<number>;
|
23
|
+
export declare const maxPastSchema: Joi.NumberSchema<number>;
|
24
|
+
export declare const precisionSchema: Joi.NumberSchema<number>;
|
25
|
+
export declare const prefixSchema: Joi.StringSchema<string>;
|
20
26
|
export declare const regexSchema: Joi.StringSchema<string>;
|
27
|
+
export declare const rowsSchema: Joi.NumberSchema<number>;
|
28
|
+
export declare const suffixSchema: Joi.StringSchema<string>;
|
21
29
|
export declare const classesSchema: Joi.StringSchema<string>;
|
22
30
|
export declare const formEditorInputPageKeys: {
|
23
31
|
pageType: 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,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,UAAU,
|
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,UAAU,0BAAiC,CAAA;AACxD,eAAO,MAAM,cAAc,0BAAiC,CAAA;AAC5D,eAAO,MAAM,cAAc,0BAA2C,CAAA;AACtE,eAAO,MAAM,sBAAsB,0BAGf,CAAA;AACpB,eAAO,MAAM,sBAAsB,0BAAiC,CAAA;AACpE,eAAO,MAAM,4BAA4B,0BAAiC,CAAA;AAC1E,eAAO,MAAM,iBAAiB,0BAAiC,CAAA;AAC/D,eAAO,MAAM,kBAAkB,0BAAsB,CAAA;AACrD,eAAO,MAAM,qBAAqB,0BAAiC,CAAA;AACnE,eAAO,MAAM,qBAAqB,0BAAiC,CAAA;AACnE,eAAO,MAAM,SAAS,0BAAmC,CAAA;AACzD,eAAO,MAAM,SAAS,0BAA0C,CAAA;AAChE,eAAO,MAAM,eAAe,0BAA0C,CAAA;AACtE,eAAO,MAAM,eAAe,0BAA0C,CAAA;AACtE,eAAO,MAAM,eAAe,0BAA0C,CAAA;AACtE,eAAO,MAAM,aAAa,0BAA0C,CAAA;AACpE,eAAO,MAAM,eAAe,0BAA0C,CAAA;AACtE,eAAO,MAAM,YAAY,0BAA2C,CAAA;AACpE,eAAO,MAAM,WAAW,0BAAoC,CAAA;AAC5D,eAAO,MAAM,UAAU,0BAA0C,CAAA;AACjE,eAAO,MAAM,YAAY,0BAA2C,CAAA;AACpE,eAAO,MAAM,aAAa,0BAA2C,CAAA;AAErE,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"}
|
@@ -70,15 +70,48 @@ export interface FormEditor {
|
|
70
70
|
* The regex value of a field
|
71
71
|
*/
|
72
72
|
regex: string;
|
73
|
+
/**
|
74
|
+
* The number of rows of a textarea
|
75
|
+
*/
|
76
|
+
rows: string;
|
73
77
|
/**
|
74
78
|
* The classes to be applied to a field
|
75
79
|
*/
|
76
80
|
classes: string;
|
81
|
+
/**
|
82
|
+
* The prefix to be applied to a field
|
83
|
+
*/
|
84
|
+
prefix: string;
|
85
|
+
/**
|
86
|
+
* The suffix to be applied to a field
|
87
|
+
*/
|
88
|
+
suffix: string;
|
89
|
+
/**
|
90
|
+
* The decimal precision of a number field
|
91
|
+
*/
|
92
|
+
precision: string;
|
93
|
+
/**
|
94
|
+
* The lowest number allowed in a field
|
95
|
+
*/
|
96
|
+
min: string;
|
97
|
+
/**
|
98
|
+
* The highest number allowed in a field
|
99
|
+
*/
|
100
|
+
max: string;
|
101
|
+
/**
|
102
|
+
* The maximum days in the future to allow for a date
|
103
|
+
*/
|
104
|
+
maxFuture: string;
|
105
|
+
/**
|
106
|
+
* The maximum days in the past to allow for a date
|
107
|
+
*/
|
108
|
+
maxPast: string;
|
77
109
|
}
|
78
110
|
export type FormEditorInputPage = Pick<FormEditor, 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub'>;
|
79
111
|
export type FormEditorInputCheckAnswersSettings = Pick<FormEditor, 'needDeclaration' | 'declarationText'>;
|
80
|
-
export type FormEditorInputQuestion = Pick<FormEditor, 'questionType' | 'name' | 'question' | 'shortDescription' | 'hintText' | 'questionOptional' | 'minLength' | 'maxLength' | 'regex' | 'classes'>;
|
112
|
+
export type FormEditorInputQuestion = Pick<FormEditor, 'questionType' | 'name' | 'question' | 'shortDescription' | 'hintText' | 'questionOptional' | 'minLength' | 'maxLength' | 'regex' | 'rows' | 'classes' | 'prefix' | 'suffix' | 'precision' | 'min' | 'max' | 'maxFuture' | 'maxPast'>;
|
81
113
|
export type FormEditorInputPageSettings = Pick<FormEditor, 'pageHeadingAndGuidance' | 'pageHeading' | 'guidanceText'>;
|
114
|
+
export type FormEditorInputGuidancePage = Pick<FormEditor, 'pageHeading' | 'guidanceText'>;
|
82
115
|
export interface GovukField {
|
83
116
|
id?: string;
|
84
117
|
name?: string;
|
@@ -100,22 +133,15 @@ export interface GovukField {
|
|
100
133
|
value?: string;
|
101
134
|
};
|
102
135
|
rows?: number;
|
136
|
+
type?: string;
|
103
137
|
}
|
104
138
|
export interface FormEditorGovukField {
|
105
139
|
question?: GovukField;
|
106
140
|
hintText?: GovukField;
|
107
141
|
questionOptional?: GovukField;
|
108
142
|
shortDescription?: GovukField;
|
109
|
-
minLength?: GovukField;
|
110
|
-
maxLength?: GovukField;
|
111
|
-
regex?: GovukField;
|
112
|
-
classes?: GovukField;
|
113
143
|
errorMessage?: {
|
114
144
|
text: string;
|
115
145
|
};
|
116
146
|
}
|
117
|
-
export interface FormEditorGovukFieldList {
|
118
|
-
fields: FormEditorGovukField;
|
119
|
-
optionalFieldsPartial?: string;
|
120
|
-
}
|
121
147
|
//# 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,IAAI,EAAE,MAAM,CAAA;IAEZ;;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;IAEvB;;OAEG;I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QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1D,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACzD,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACzC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,gBAAgB,CAAC,EAAE,UAAU,CAAA;IAC7B,gBAAgB,CAAC,EAAE,UAAU,CAAA;IAC7B,YAAY,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAChC"}
|
package/package.json
CHANGED
@@ -49,20 +49,31 @@ export const dateSubSchema = Joi.string()
|
|
49
49
|
.required()
|
50
50
|
.valid(ComponentType.DatePartsField, ComponentType.MonthYearField)
|
51
51
|
|
52
|
-
export const nameSchema = Joi.string().required()
|
53
|
-
export const questionSchema = Joi.string().required()
|
54
|
-
export const hintTextSchema = Joi.string().optional().allow('')
|
55
|
-
export const questionOptionalSchema = Joi.string()
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
export const
|
60
|
-
export const
|
61
|
-
export const
|
62
|
-
export const
|
63
|
-
export const
|
52
|
+
export const nameSchema = Joi.string().trim().required()
|
53
|
+
export const questionSchema = Joi.string().trim().required()
|
54
|
+
export const hintTextSchema = Joi.string().trim().optional().allow('')
|
55
|
+
export const questionOptionalSchema = Joi.string()
|
56
|
+
.trim()
|
57
|
+
.optional()
|
58
|
+
.valid('', 'true')
|
59
|
+
export const shortDescriptionSchema = Joi.string().trim().required()
|
60
|
+
export const pageHeadingAndGuidanceSchema = Joi.string().trim().optional()
|
61
|
+
export const pageHeadingSchema = Joi.string().trim().required()
|
62
|
+
export const guidanceTextSchema = Joi.string().trim()
|
63
|
+
export const needDeclarationSchema = Joi.string().trim().required()
|
64
|
+
export const declarationTextSchema = Joi.string().trim().required()
|
65
|
+
export const minSchema = Joi.number().empty('').integer()
|
66
|
+
export const maxSchema = Joi.number().empty('').integer().min(1)
|
67
|
+
export const minLengthSchema = Joi.number().empty('').integer().min(1)
|
68
|
+
export const maxLengthSchema = Joi.number().empty('').integer().min(1)
|
69
|
+
export const maxFutureSchema = Joi.number().empty('').integer().min(1)
|
70
|
+
export const maxPastSchema = Joi.number().empty('').integer().min(1)
|
71
|
+
export const precisionSchema = Joi.number().empty('').integer().min(1)
|
72
|
+
export const prefixSchema = Joi.string().trim().optional().allow('')
|
64
73
|
export const regexSchema = Joi.string().optional().allow('')
|
65
|
-
export const
|
74
|
+
export const rowsSchema = Joi.number().empty('').integer().min(1)
|
75
|
+
export const suffixSchema = Joi.string().trim().optional().allow('')
|
76
|
+
export const classesSchema = Joi.string().trim().optional().allow('')
|
66
77
|
|
67
78
|
export const formEditorInputPageKeys = {
|
68
79
|
pageType: pageTypeSchema,
|
@@ -87,10 +87,50 @@ export interface FormEditor {
|
|
87
87
|
*/
|
88
88
|
regex: string
|
89
89
|
|
90
|
+
/**
|
91
|
+
* The number of rows of a textarea
|
92
|
+
*/
|
93
|
+
rows: string
|
94
|
+
|
90
95
|
/**
|
91
96
|
* The classes to be applied to a field
|
92
97
|
*/
|
93
98
|
classes: string
|
99
|
+
|
100
|
+
/**
|
101
|
+
* The prefix to be applied to a field
|
102
|
+
*/
|
103
|
+
prefix: string
|
104
|
+
|
105
|
+
/**
|
106
|
+
* The suffix to be applied to a field
|
107
|
+
*/
|
108
|
+
suffix: string
|
109
|
+
|
110
|
+
/**
|
111
|
+
* The decimal precision of a number field
|
112
|
+
*/
|
113
|
+
precision: string
|
114
|
+
|
115
|
+
/**
|
116
|
+
* The lowest number allowed in a field
|
117
|
+
*/
|
118
|
+
min: string
|
119
|
+
|
120
|
+
/**
|
121
|
+
* The highest number allowed in a field
|
122
|
+
*/
|
123
|
+
max: string
|
124
|
+
|
125
|
+
/**
|
126
|
+
* The maximum days in the future to allow for a date
|
127
|
+
*/
|
128
|
+
maxFuture: string
|
129
|
+
|
130
|
+
/**
|
131
|
+
* The maximum days in the past to allow for a date
|
132
|
+
*/
|
133
|
+
maxPast: string
|
94
134
|
}
|
95
135
|
|
96
136
|
export type FormEditorInputPage = Pick<
|
@@ -114,7 +154,15 @@ export type FormEditorInputQuestion = Pick<
|
|
114
154
|
| 'minLength'
|
115
155
|
| 'maxLength'
|
116
156
|
| 'regex'
|
157
|
+
| 'rows'
|
117
158
|
| 'classes'
|
159
|
+
| 'prefix'
|
160
|
+
| 'suffix'
|
161
|
+
| 'precision'
|
162
|
+
| 'min'
|
163
|
+
| 'max'
|
164
|
+
| 'maxFuture'
|
165
|
+
| 'maxPast'
|
118
166
|
>
|
119
167
|
|
120
168
|
export type FormEditorInputPageSettings = Pick<
|
@@ -122,6 +170,11 @@ export type FormEditorInputPageSettings = Pick<
|
|
122
170
|
'pageHeadingAndGuidance' | 'pageHeading' | 'guidanceText'
|
123
171
|
>
|
124
172
|
|
173
|
+
export type FormEditorInputGuidancePage = Pick<
|
174
|
+
FormEditor,
|
175
|
+
'pageHeading' | 'guidanceText'
|
176
|
+
>
|
177
|
+
|
125
178
|
export interface GovukField {
|
126
179
|
id?: string
|
127
180
|
name?: string
|
@@ -132,6 +185,7 @@ export interface GovukField {
|
|
132
185
|
hint?: { text?: string; html?: string; classes?: string }
|
133
186
|
items?: { text?: string; value?: string }
|
134
187
|
rows?: number
|
188
|
+
type?: string
|
135
189
|
}
|
136
190
|
|
137
191
|
export interface FormEditorGovukField {
|
@@ -139,14 +193,5 @@ export interface FormEditorGovukField {
|
|
139
193
|
hintText?: GovukField
|
140
194
|
questionOptional?: GovukField
|
141
195
|
shortDescription?: GovukField
|
142
|
-
minLength?: GovukField
|
143
|
-
maxLength?: GovukField
|
144
|
-
regex?: GovukField
|
145
|
-
classes?: GovukField
|
146
196
|
errorMessage?: { text: string }
|
147
197
|
}
|
148
|
-
|
149
|
-
export interface FormEditorGovukFieldList {
|
150
|
-
fields: FormEditorGovukField
|
151
|
-
optionalFieldsPartial?: string
|
152
|
-
}
|