@defra/forms-model 3.0.416 → 3.0.418

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.
@@ -5,6 +5,7 @@ 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();
8
9
  export const questionSchema = Joi.string().required();
9
10
  export const hintTextSchema = Joi.string().optional().allow('');
10
11
  export const questionOptionalSchema = Joi.string().optional().valid('', 'true');
@@ -14,6 +15,10 @@ export const pageHeadingSchema = Joi.string().required();
14
15
  export const guidanceTextSchema = Joi.string().optional().allow('');
15
16
  export const needDeclarationSchema = Joi.string().required();
16
17
  export const declarationTextSchema = Joi.string().required();
18
+ export const minLengthSchema = Joi.number().empty('').min(1);
19
+ export const maxLengthSchema = Joi.number().empty('').min(1);
20
+ export const regexSchema = Joi.string().optional().allow('');
21
+ export const classesSchema = Joi.string().optional().allow('');
17
22
  export const formEditorInputPageKeys = {
18
23
  pageType: pageTypeSchema,
19
24
  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","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,CAAC,CACvCC,QAAQ,CAAC,CAAC,CACVC,KAAK,CAAC,UAAU,EAAE,UAAU,CA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AQ,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
+ {"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":"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,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C,GAAG,CAAC2C,MAAM,CAAsB,CAAC,CACvEC,IAAI,CAACL,uBAAuB,CAAC,CAC7BnC,QAAQ,CAAC,CAAC;AAEb,OAAO,MAAMyC,sCAAsC,GAAG;EACpDC,eAAe,EAAEpB;AACnB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMqB,wCAAwC,GACnD/C,GAAG,CAAC2C,MAAM,CAAsC,CAAC,CAC9CC,IAAI,CAACC,sCAAsC,CAAC,CAC5CzC,QAAQ,CAAC,CAAC;AAEf,OAAO,MAAM4C,2BAA2B,GAAG;EACzCC,QAAQ,EAAE5B,cAAc;EACxB6B,gBAAgB,EAAExB,sBAAsB;EACxCyB,QAAQ,EAAE7B,cAAc;EACxB8B,gBAAgB,EAAE3B;AACpB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAM4B,6BAA6B,GACxCrD,GAAG,CAAC2C,MAAM,CAA0B,CAAC,CAClCC,IAAI,CAACI,2BAA2B,CAAC,CACjC5C,QAAQ,CAAC,CAAC;AAEf,OAAO,MAAMkD,+BAA+B,GAAG;EAC7CC,sBAAsB,EAAE5B,4BAA4B;EACpD6B,WAAW,EAAE5B,iBAAiB;EAC9B6B,YAAY,EAAE5B;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAM6B,iCAAiC,GAC5C1D,GAAG,CAAC2C,MAAM,CAA8B,CAAC,CACtCC,IAAI,CAACU,+BAA+B,CAAC,CACrClD,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 /**\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":[]}
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 minLength?: GovukField\n maxLength?: GovukField\n regex?: GovukField\n classes?: GovukField\n errorMessage?: { text: string }\n}\n\nexport interface FormEditorGovukFieldList {\n fields: FormEditorGovukField\n optionalFieldsPartial?: string\n}\n"],"mappings":"","ignoreList":[]}
@@ -5,6 +5,7 @@ export declare const questionTypeSchema: Joi.StringSchema<string>;
5
5
  export declare const questionTypeFullSchema: Joi.StringSchema<string>;
6
6
  export declare const writtenAnswerSubSchema: Joi.StringSchema<string>;
7
7
  export declare const dateSubSchema: Joi.StringSchema<string>;
8
+ export declare const nameSchema: Joi.StringSchema<string>;
8
9
  export declare const questionSchema: Joi.StringSchema<string>;
9
10
  export declare const hintTextSchema: Joi.StringSchema<string>;
10
11
  export declare const questionOptionalSchema: Joi.StringSchema<string>;
@@ -14,6 +15,10 @@ export declare const pageHeadingSchema: Joi.StringSchema<string>;
14
15
  export declare const guidanceTextSchema: Joi.StringSchema<string>;
15
16
  export declare const needDeclarationSchema: Joi.StringSchema<string>;
16
17
  export declare const declarationTextSchema: Joi.StringSchema<string>;
18
+ export declare const minLengthSchema: Joi.NumberSchema<number>;
19
+ export declare const maxLengthSchema: Joi.NumberSchema<number>;
20
+ export declare const regexSchema: Joi.StringSchema<string>;
21
+ export declare const classesSchema: Joi.StringSchema<string>;
17
22
  export declare const formEditorInputPageKeys: {
18
23
  pageType: Joi.StringSchema<string>;
19
24
  questionType: 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,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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BAAgC,CAAA;AAC5D,eAAO,MAAM,eAAe,0BAAgC,CAAA;AAC5D,eAAO,MAAM,WAAW,0BAAoC,CAAA;AAC5D,eAAO,MAAM,aAAa,0BAAoC,CAAA;AAE9D,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"}
@@ -18,6 +18,10 @@ export interface FormEditor {
18
18
  * The sub-type of date
19
19
  */
20
20
  dateSub: string;
21
+ /**
22
+ * The name of the question (unique id)
23
+ */
24
+ name: string;
21
25
  /**
22
26
  * The text of the question
23
27
  */
@@ -54,9 +58,64 @@ export interface FormEditor {
54
58
  * The check answers declaration text
55
59
  */
56
60
  declarationText: string;
61
+ /**
62
+ * The min length a field can have
63
+ */
64
+ minLength: string;
65
+ /**
66
+ * The max length a field can have
67
+ */
68
+ maxLength: string;
69
+ /**
70
+ * The regex value of a field
71
+ */
72
+ regex: string;
73
+ /**
74
+ * The classes to be applied to a field
75
+ */
76
+ classes: string;
57
77
  }
58
78
  export type FormEditorInputPage = Pick<FormEditor, 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub'>;
59
79
  export type FormEditorInputCheckAnswersSettings = Pick<FormEditor, 'needDeclaration' | 'declarationText'>;
60
- export type FormEditorInputQuestion = Pick<FormEditor, 'questionType' | 'question' | 'shortDescription' | 'hintText' | 'questionOptional'>;
80
+ export type FormEditorInputQuestion = Pick<FormEditor, 'questionType' | 'name' | 'question' | 'shortDescription' | 'hintText' | 'questionOptional' | 'minLength' | 'maxLength' | 'regex' | 'classes'>;
61
81
  export type FormEditorInputPageSettings = Pick<FormEditor, 'pageHeadingAndGuidance' | 'pageHeading' | 'guidanceText'>;
82
+ export interface GovukField {
83
+ id?: string;
84
+ name?: string;
85
+ idPrefix?: string;
86
+ value?: string | boolean | number;
87
+ classes?: string;
88
+ label?: {
89
+ text?: string;
90
+ html?: string;
91
+ classes?: string;
92
+ };
93
+ hint?: {
94
+ text?: string;
95
+ html?: string;
96
+ classes?: string;
97
+ };
98
+ items?: {
99
+ text?: string;
100
+ value?: string;
101
+ };
102
+ rows?: number;
103
+ }
104
+ export interface FormEditorGovukField {
105
+ question?: GovukField;
106
+ hintText?: GovukField;
107
+ questionOptional?: GovukField;
108
+ shortDescription?: GovukField;
109
+ minLength?: GovukField;
110
+ maxLength?: GovukField;
111
+ regex?: GovukField;
112
+ classes?: GovukField;
113
+ errorMessage?: {
114
+ text: string;
115
+ };
116
+ }
117
+ export interface FormEditorGovukFieldList {
118
+ fields: FormEditorGovukField;
119
+ optionalFieldsPartial?: string;
120
+ }
62
121
  //# 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;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"}
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;IAC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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;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,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,YAAY,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAChC;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,oBAAoB,CAAA;IAC5B,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAC/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-model",
3
- "version": "3.0.416",
3
+ "version": "3.0.418",
4
4
  "description": "A hapi plugin providing the model for Defra forms",
5
5
  "homepage": "https://github.com/DEFRA/forms-designer/tree/main/model#readme",
6
6
  "repository": {
@@ -49,6 +49,7 @@ export const dateSubSchema = Joi.string()
49
49
  .required()
50
50
  .valid(ComponentType.DatePartsField, ComponentType.MonthYearField)
51
51
 
52
+ export const nameSchema = Joi.string().required()
52
53
  export const questionSchema = Joi.string().required()
53
54
  export const hintTextSchema = Joi.string().optional().allow('')
54
55
  export const questionOptionalSchema = Joi.string().optional().valid('', 'true')
@@ -58,6 +59,10 @@ export const pageHeadingSchema = Joi.string().required()
58
59
  export const guidanceTextSchema = Joi.string().optional().allow('')
59
60
  export const needDeclarationSchema = Joi.string().required()
60
61
  export const declarationTextSchema = Joi.string().required()
62
+ export const minLengthSchema = Joi.number().empty('').min(1)
63
+ export const maxLengthSchema = Joi.number().empty('').min(1)
64
+ export const regexSchema = Joi.string().optional().allow('')
65
+ export const classesSchema = Joi.string().optional().allow('')
61
66
 
62
67
  export const formEditorInputPageKeys = {
63
68
  pageType: pageTypeSchema,
@@ -22,6 +22,11 @@ export interface FormEditor {
22
22
  */
23
23
  dateSub: string
24
24
 
25
+ /**
26
+ * The name of the question (unique id)
27
+ */
28
+ name: string
29
+
25
30
  /**
26
31
  * The text of the question
27
32
  */
@@ -66,6 +71,26 @@ export interface FormEditor {
66
71
  * The check answers declaration text
67
72
  */
68
73
  declarationText: string
74
+
75
+ /**
76
+ * The min length a field can have
77
+ */
78
+ minLength: string
79
+
80
+ /**
81
+ * The max length a field can have
82
+ */
83
+ maxLength: string
84
+
85
+ /**
86
+ * The regex value of a field
87
+ */
88
+ regex: string
89
+
90
+ /**
91
+ * The classes to be applied to a field
92
+ */
93
+ classes: string
69
94
  }
70
95
 
71
96
  export type FormEditorInputPage = Pick<
@@ -81,13 +106,47 @@ export type FormEditorInputCheckAnswersSettings = Pick<
81
106
  export type FormEditorInputQuestion = Pick<
82
107
  FormEditor,
83
108
  | 'questionType'
109
+ | 'name'
84
110
  | 'question'
85
111
  | 'shortDescription'
86
112
  | 'hintText'
87
113
  | 'questionOptional'
114
+ | 'minLength'
115
+ | 'maxLength'
116
+ | 'regex'
117
+ | 'classes'
88
118
  >
89
119
 
90
120
  export type FormEditorInputPageSettings = Pick<
91
121
  FormEditor,
92
122
  'pageHeadingAndGuidance' | 'pageHeading' | 'guidanceText'
93
123
  >
124
+
125
+ export interface GovukField {
126
+ id?: string
127
+ name?: string
128
+ idPrefix?: string
129
+ value?: string | boolean | number
130
+ classes?: string
131
+ label?: { text?: string; html?: string; classes?: string }
132
+ hint?: { text?: string; html?: string; classes?: string }
133
+ items?: { text?: string; value?: string }
134
+ rows?: number
135
+ }
136
+
137
+ export interface FormEditorGovukField {
138
+ question?: GovukField
139
+ hintText?: GovukField
140
+ questionOptional?: GovukField
141
+ shortDescription?: GovukField
142
+ minLength?: GovukField
143
+ maxLength?: GovukField
144
+ regex?: GovukField
145
+ classes?: GovukField
146
+ errorMessage?: { text: string }
147
+ }
148
+
149
+ export interface FormEditorGovukFieldList {
150
+ fields: FormEditorGovukField
151
+ optionalFieldsPartial?: string
152
+ }