@defra/forms-model 3.0.425 → 3.0.427
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 +38 -3
- 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 +34 -0
- package/dist/types/form/form-editor/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/types.d.ts +10 -2
- package/dist/types/form/form-editor/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/form/form-editor/index.ts +48 -5
- package/src/form/form-editor/types.ts +12 -1
@@ -1,10 +1,17 @@
|
|
1
1
|
import Joi from 'joi';
|
2
2
|
import { ComponentType } from "../../components/enums.js";
|
3
|
+
export let QuestionTypeSubGroup = /*#__PURE__*/function (QuestionTypeSubGroup) {
|
4
|
+
QuestionTypeSubGroup["WrittenAnswerSubGroup"] = "writtenAnswerSub";
|
5
|
+
QuestionTypeSubGroup["DateSubGroup"] = "dateSub";
|
6
|
+
QuestionTypeSubGroup["ListSubGroup"] = "listSub";
|
7
|
+
return QuestionTypeSubGroup;
|
8
|
+
}({});
|
3
9
|
export const pageTypeSchema = Joi.string().required().valid('question', 'guidance');
|
4
|
-
export const questionTypeSchema = Joi.string().required().valid(
|
10
|
+
export const questionTypeSchema = Joi.string().required().valid(QuestionTypeSubGroup.WrittenAnswerSubGroup, QuestionTypeSubGroup.DateSubGroup, ComponentType.UkAddressField, ComponentType.TelephoneNumberField, ComponentType.FileUploadField, ComponentType.EmailAddressField, QuestionTypeSubGroup.ListSubGroup);
|
5
11
|
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
12
|
export const writtenAnswerSubSchema = Joi.string().required().valid(ComponentType.TextField, ComponentType.MultilineTextField, ComponentType.NumberField);
|
7
13
|
export const dateSubSchema = Joi.string().required().valid(ComponentType.DatePartsField, ComponentType.MonthYearField);
|
14
|
+
export const listSubSchema = Joi.string().required().valid(ComponentType.YesNoField, ComponentType.CheckboxesField, ComponentType.RadiosField, ComponentType.AutocompleteField);
|
8
15
|
export const nameSchema = Joi.string().trim().required();
|
9
16
|
export const questionSchema = Joi.string().trim().required();
|
10
17
|
export const hintTextSchema = Joi.string().trim().optional().allow('');
|
@@ -15,8 +22,9 @@ export const pageHeadingSchema = Joi.string().trim().required();
|
|
15
22
|
export const guidanceTextSchema = Joi.string().trim();
|
16
23
|
export const needDeclarationSchema = Joi.string().trim().required();
|
17
24
|
export const declarationTextSchema = Joi.string().trim().required();
|
18
|
-
export const
|
19
|
-
export const
|
25
|
+
export const exactFilesSchema = Joi.number().empty('').integer().min(1).max(25);
|
26
|
+
export const minFilesSchema = Joi.number().empty('').integer().min(0).max(25);
|
27
|
+
export const maxFilesSchema = Joi.number().empty('').integer().min(1).max(25);
|
20
28
|
export const minSchema = Joi.number().empty('').integer();
|
21
29
|
export const maxSchema = Joi.number().empty('').integer();
|
22
30
|
export const minLengthSchema = Joi.number().empty('').integer().min(1);
|
@@ -33,6 +41,33 @@ export const fileTypesSchema = Joi.array().items(Joi.string()).single().empty(nu
|
|
33
41
|
export const documentTypesSchema = Joi.array().items(Joi.string()).single().empty(null).default([]);
|
34
42
|
export const imageTypesSchema = Joi.array().items(Joi.string()).single().empty(null).default([]);
|
35
43
|
export const tabularDataTypesSchema = Joi.array().items(Joi.string()).single().empty(null).default([]);
|
44
|
+
export const questionDetailsFullSchema = {
|
45
|
+
classesSchema,
|
46
|
+
documentTypesSchema,
|
47
|
+
exactFilesSchema,
|
48
|
+
fileTypesSchema,
|
49
|
+
hintTextSchema,
|
50
|
+
imageTypesSchema,
|
51
|
+
maxFilesSchema,
|
52
|
+
maxFutureSchema,
|
53
|
+
maxLengthSchema,
|
54
|
+
maxPastSchema,
|
55
|
+
maxSchema,
|
56
|
+
minFilesSchema,
|
57
|
+
minLengthSchema,
|
58
|
+
minSchema,
|
59
|
+
nameSchema,
|
60
|
+
precisionSchema,
|
61
|
+
prefixSchema,
|
62
|
+
questionOptionalSchema,
|
63
|
+
questionSchema,
|
64
|
+
questionTypeFullSchema,
|
65
|
+
regexSchema,
|
66
|
+
rowsSchema,
|
67
|
+
shortDescriptionSchema,
|
68
|
+
suffixSchema,
|
69
|
+
tabularDataTypesSchema
|
70
|
+
};
|
36
71
|
export const formEditorInputPageKeys = {
|
37
72
|
pageType: pageTypeSchema,
|
38
73
|
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","trim","questionSchema","hintTextSchema","optional","allow","questionOptionalSchema","shortDescriptionSchema","pageHeadingAndGuidanceSchema","pageHeadingSchema","guidanceTextSchema","needDeclarationSchema","declarationTextSchema","minFilesSchema","number","empty","integer","min","maxFilesSchema","minSchema","maxSchema","minLengthSchema","maxLengthSchema","maxFutureSchema","maxPastSchema","precisionSchema","prefixSchema","regexSchema","rowsSchema","suffixSchema","classesSchema","fileTypesSchema","array","items","single","default","documentTypesSchema","imageTypesSchema","tabularDataTypesSchema","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 minFilesSchema = Joi.number().empty('').integer().min(0)\nexport const maxFilesSchema = Joi.number().empty('').integer().min(1)\nexport const minSchema = Joi.number().empty('').integer()\nexport const maxSchema = Joi.number().empty('').integer()\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('')\nexport const fileTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\nexport const documentTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\nexport const imageTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\nexport const tabularDataTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\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,OAAO,MAAMC,sBAAsB,GAAGZ,GAAG,CAACG,MAAM,CAAC,CAAC,CAC/CC,QAAQ,CAAC,CAAC,CACVC,KAAK,CACJJ,aAAa,CAACY,SAAS,EACvBZ,aAAa,CAACa,kBAAkB,EAChCb,aAAa,CAACc,WAAW,EACzBd,aAAa,CAACe,cAAc,EAC5Bf,aAAa,CAACgB,cAAc,EAC5BhB,aAAa,CAACM,cAAc,EAC5BN,aAAa,CAACO,oBAAoB,EAClCP,aAAa,CAACQ,eAAe,EAC7BR,aAAa,CAACS,iBAAiB,EAC/BT,aAAa,CAACU,WAChB,CAAC;AAEH,OAAO,MAAMO,sBAAsB,GAAGlB,GAAG,CAACG,MAAM,CAAC,CAAC,CAC/CC,QAAQ,CAAC,CAAC,CACVC,KAAK,CACJJ,aAAa,CAACY,SAAS,EACvB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ACA;AACA;AACA;AACA,OAAO,MAAM+C,6BAA6B,GACxCzE,GAAG,CAAC+D,MAAM,CAA0B,CAAC,CAClCC,IAAI,CAACI,2BAA2B,CAAC,CACjChE,QAAQ,CAAC,CAAC;AAEf,OAAO,MAAMsE,+BAA+B,GAAG;EAC7CC,sBAAsB,EAAE/C,4BAA4B;EACpDgD,WAAW,EAAE/C,iBAAiB;EAC9BgD,YAAY,EAAE/C;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMgD,iCAAiC,GAC5C9E,GAAG,CAAC+D,MAAM,CAA8B,CAAC,CACtCC,IAAI,CAACU,+BAA+B,CAAC,CACrCtE,QAAQ,CAAC,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"file":"index.js","names":["Joi","ComponentType","QuestionTypeSubGroup","pageTypeSchema","string","required","valid","questionTypeSchema","WrittenAnswerSubGroup","DateSubGroup","UkAddressField","TelephoneNumberField","FileUploadField","EmailAddressField","ListSubGroup","questionTypeFullSchema","TextField","MultilineTextField","NumberField","DatePartsField","MonthYearField","SelectField","writtenAnswerSubSchema","dateSubSchema","listSubSchema","YesNoField","CheckboxesField","RadiosField","AutocompleteField","nameSchema","trim","questionSchema","hintTextSchema","optional","allow","questionOptionalSchema","shortDescriptionSchema","pageHeadingAndGuidanceSchema","pageHeadingSchema","guidanceTextSchema","needDeclarationSchema","declarationTextSchema","exactFilesSchema","number","empty","integer","min","max","minFilesSchema","maxFilesSchema","minSchema","maxSchema","minLengthSchema","maxLengthSchema","maxFutureSchema","maxPastSchema","precisionSchema","prefixSchema","regexSchema","rowsSchema","suffixSchema","classesSchema","fileTypesSchema","array","items","single","default","documentTypesSchema","imageTypesSchema","tabularDataTypesSchema","questionDetailsFullSchema","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 enum QuestionTypeSubGroup {\n WrittenAnswerSubGroup = 'writtenAnswerSub',\n DateSubGroup = 'dateSub',\n ListSubGroup = 'listSub'\n}\n\nexport const pageTypeSchema = Joi.string()\n .required()\n .valid('question', 'guidance')\nexport const questionTypeSchema = Joi.string()\n .required()\n .valid(\n QuestionTypeSubGroup.WrittenAnswerSubGroup,\n QuestionTypeSubGroup.DateSubGroup,\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n QuestionTypeSubGroup.ListSubGroup\n )\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)\nexport const listSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField\n )\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 exactFilesSchema = Joi.number().empty('').integer().min(1).max(25)\nexport const minFilesSchema = Joi.number().empty('').integer().min(0).max(25)\nexport const maxFilesSchema = Joi.number().empty('').integer().min(1).max(25)\nexport const minSchema = Joi.number().empty('').integer()\nexport const maxSchema = Joi.number().empty('').integer()\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('')\nexport const fileTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\nexport const documentTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\nexport const imageTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\nexport const tabularDataTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n\nexport const questionDetailsFullSchema = {\n classesSchema,\n documentTypesSchema,\n exactFilesSchema,\n fileTypesSchema,\n hintTextSchema,\n imageTypesSchema,\n maxFilesSchema,\n maxFutureSchema,\n maxLengthSchema,\n maxPastSchema,\n maxSchema,\n minFilesSchema,\n minLengthSchema,\n minSchema,\n nameSchema,\n precisionSchema,\n prefixSchema,\n questionOptionalSchema,\n questionSchema,\n questionTypeFullSchema,\n regexSchema,\n rowsSchema,\n shortDescriptionSchema,\n suffixSchema,\n tabularDataTypesSchema\n}\n\nexport const formEditorInputPageKeys = {\n pageType: pageTypeSchema,\n questionType: questionTypeSchema\n}\n\n/**\n * Joi schema for `FormEditorInputPage` interface\n * @see {@link FormEditorInputPage}\n */\nexport const formEditorInputPageSchema = Joi.object<FormEditorInputPage>()\n .keys(formEditorInputPageKeys)\n .required()\n\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,WAAYC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAMhC,OAAO,MAAMC,cAAc,GAAGH,G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,EAAElE;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMmE,yBAAyB,GAAG1E,GAAG,CAAC2E,MAAM,CAAsB,CAAC,CACvEC,IAAI,CAACL,uBAAuB,CAAC,CAC7BlE,QAAQ,CAAC,CAAC;AAEb,OAAO,MAAMwE,sCAAsC,GAAG;EACpDC,eAAe,EAAE1C;AACnB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAM2C,wCAAwC,GACnD/E,GAAG,CAAC2E,MAAM,CAAsC,CAAC,CAC9CC,IAAI,CAACC,sCAAsC,CAAC,CAC5CxE,QAAQ,CAAC,CAAC;AAEf,OAAO,MAAM2E,2BAA2B,GAAG;EACzCC,QAAQ,EAAElD,cAAc;EACxBmD,gBAAgB,EAAE9C,sBAAsB;EACxC+C,QAAQ,EAAEnD,cAAc;EACxBoD,gBAAgB,EAAEjD;AACpB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMkD,6BAA6B,GACxCrF,GAAG,CAAC2E,MAAM,CAA0B,CAAC,CAClCC,IAAI,CAACI,2BAA2B,CAAC,CACjC3E,QAAQ,CAAC,CAAC;AAEf,OAAO,MAAMiF,+BAA+B,GAAG;EAC7CC,sBAAsB,EAAElD,4BAA4B;EACpDmD,WAAW,EAAElD,iBAAiB;EAC9BmD,YAAY,EAAElD;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMmD,iCAAiC,GAC5C1F,GAAG,CAAC2E,MAAM,CAA8B,CAAC,CACtCC,IAAI,CAACU,+BAA+B,CAAC,CACrCjF,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 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 /**\n * The minimum number of files to upload\n */\n minFiles: string\n\n /**\n * The maximum number of files to upload\n */\n maxFiles: string\n\n /**\n * The type of files for upload\n */\n fileTypes: string[]\n\n /**\n * The types of document files for upload\n */\n documentTypes: string[]\n\n /**\n * The types of image files for upload\n */\n imageTypes: string[]\n\n /**\n * The types of tabular data files for upload\n */\n tabularDataTypes: 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 | 'minFiles'\n | 'maxFiles'\n | 'fileTypes'\n | 'documentTypes'\n | 'imageTypes'\n | 'tabularDataTypes'\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 fieldset?: {\n legend?: { text?: string; isPageHeading?: boolean; classes?: string }\n }\n value?: string | boolean | number | string[]\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; checked?: boolean }[]\n rows?: number\n type?: string\n}\n\nexport interface FormEditorGovukField {\n question?: GovukField\n hintText?: GovukField\n questionOptional?: GovukField\n shortDescription?: GovukField\n fileTypes?: GovukField\n documentTypes?: GovukField\n imageTypes?: GovukField\n tabularDataTypes?: GovukField\n errorMessage?: { text: string }\n}\n\nexport interface FormEditorCheckbox {\n text?: string\n hint?: {\n text?: string\n }\n value?: string\n divider?: {\n text?: string\n hint?: string\n value?: string\n }\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 sub-type of lists\n */\n listSub: 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 /**\n * The exact number of files to upload\n */\n exactFiles: string\n\n /**\n * The minimum number of files to upload\n */\n minFiles: string\n\n /**\n * The maximum number of files to upload\n */\n maxFiles: string\n\n /**\n * The type of files for upload\n */\n fileTypes: string[]\n\n /**\n * The types of document files for upload\n */\n documentTypes: string[]\n\n /**\n * The types of image files for upload\n */\n imageTypes: string[]\n\n /**\n * The types of tabular data files for upload\n */\n tabularDataTypes: string[]\n}\n\nexport type FormEditorInputPage = Pick<\n FormEditor,\n 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub' | 'listSub'\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 | 'exactFiles'\n | 'minFiles'\n | 'maxFiles'\n | 'fileTypes'\n | 'documentTypes'\n | 'imageTypes'\n | 'tabularDataTypes'\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 fieldset?: {\n legend?: { text?: string; isPageHeading?: boolean; classes?: string }\n }\n value?: string | boolean | number | string[]\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; checked?: boolean }[]\n rows?: number\n type?: string\n}\n\nexport interface FormEditorGovukField {\n question?: GovukField\n hintText?: GovukField\n questionOptional?: GovukField\n shortDescription?: GovukField\n fileTypes?: GovukField\n documentTypes?: GovukField\n imageTypes?: GovukField\n tabularDataTypes?: GovukField\n errorMessage?: { text: string }\n}\n\nexport interface FormEditorCheckbox {\n text?: string\n hint?: {\n text?: string\n }\n value?: string\n divider?: {\n text?: string\n hint?: string\n value?: string\n }\n}\n"],"mappings":"","ignoreList":[]}
|
@@ -1,10 +1,16 @@
|
|
1
1
|
import Joi from 'joi';
|
2
2
|
import { type FormEditorInputCheckAnswersSettings, type FormEditorInputPage, type FormEditorInputPageSettings, type FormEditorInputQuestion } from '../../form/form-editor/types.js';
|
3
|
+
export declare enum QuestionTypeSubGroup {
|
4
|
+
WrittenAnswerSubGroup = "writtenAnswerSub",
|
5
|
+
DateSubGroup = "dateSub",
|
6
|
+
ListSubGroup = "listSub"
|
7
|
+
}
|
3
8
|
export declare const pageTypeSchema: Joi.StringSchema<string>;
|
4
9
|
export declare const questionTypeSchema: Joi.StringSchema<string>;
|
5
10
|
export declare const questionTypeFullSchema: Joi.StringSchema<string>;
|
6
11
|
export declare const writtenAnswerSubSchema: Joi.StringSchema<string>;
|
7
12
|
export declare const dateSubSchema: Joi.StringSchema<string>;
|
13
|
+
export declare const listSubSchema: Joi.StringSchema<string>;
|
8
14
|
export declare const nameSchema: Joi.StringSchema<string>;
|
9
15
|
export declare const questionSchema: Joi.StringSchema<string>;
|
10
16
|
export declare const hintTextSchema: Joi.StringSchema<string>;
|
@@ -15,6 +21,7 @@ export declare const pageHeadingSchema: Joi.StringSchema<string>;
|
|
15
21
|
export declare const guidanceTextSchema: Joi.StringSchema<string>;
|
16
22
|
export declare const needDeclarationSchema: Joi.StringSchema<string>;
|
17
23
|
export declare const declarationTextSchema: Joi.StringSchema<string>;
|
24
|
+
export declare const exactFilesSchema: Joi.NumberSchema<number>;
|
18
25
|
export declare const minFilesSchema: Joi.NumberSchema<number>;
|
19
26
|
export declare const maxFilesSchema: Joi.NumberSchema<number>;
|
20
27
|
export declare const minSchema: Joi.NumberSchema<number>;
|
@@ -33,6 +40,33 @@ export declare const fileTypesSchema: Joi.ArraySchema<any[]>;
|
|
33
40
|
export declare const documentTypesSchema: Joi.ArraySchema<any[]>;
|
34
41
|
export declare const imageTypesSchema: Joi.ArraySchema<any[]>;
|
35
42
|
export declare const tabularDataTypesSchema: Joi.ArraySchema<any[]>;
|
43
|
+
export declare const questionDetailsFullSchema: {
|
44
|
+
classesSchema: Joi.StringSchema<string>;
|
45
|
+
documentTypesSchema: Joi.ArraySchema<any[]>;
|
46
|
+
exactFilesSchema: Joi.NumberSchema<number>;
|
47
|
+
fileTypesSchema: Joi.ArraySchema<any[]>;
|
48
|
+
hintTextSchema: Joi.StringSchema<string>;
|
49
|
+
imageTypesSchema: Joi.ArraySchema<any[]>;
|
50
|
+
maxFilesSchema: Joi.NumberSchema<number>;
|
51
|
+
maxFutureSchema: Joi.NumberSchema<number>;
|
52
|
+
maxLengthSchema: Joi.NumberSchema<number>;
|
53
|
+
maxPastSchema: Joi.NumberSchema<number>;
|
54
|
+
maxSchema: Joi.NumberSchema<number>;
|
55
|
+
minFilesSchema: Joi.NumberSchema<number>;
|
56
|
+
minLengthSchema: Joi.NumberSchema<number>;
|
57
|
+
minSchema: Joi.NumberSchema<number>;
|
58
|
+
nameSchema: Joi.StringSchema<string>;
|
59
|
+
precisionSchema: Joi.NumberSchema<number>;
|
60
|
+
prefixSchema: Joi.StringSchema<string>;
|
61
|
+
questionOptionalSchema: Joi.StringSchema<string>;
|
62
|
+
questionSchema: Joi.StringSchema<string>;
|
63
|
+
questionTypeFullSchema: Joi.StringSchema<string>;
|
64
|
+
regexSchema: Joi.StringSchema<string>;
|
65
|
+
rowsSchema: Joi.NumberSchema<number>;
|
66
|
+
shortDescriptionSchema: Joi.StringSchema<string>;
|
67
|
+
suffixSchema: Joi.StringSchema<string>;
|
68
|
+
tabularDataTypesSchema: Joi.ArraySchema<any[]>;
|
69
|
+
};
|
36
70
|
export declare const formEditorInputPageKeys: {
|
37
71
|
pageType: Joi.StringSchema<string>;
|
38
72
|
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;
|
1
|
+
{"version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E,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;AACrE,eAAO,MAAM,eAAe,wBAId,CAAA;AACd,eAAO,MAAM,mBAAmB,wBAIlB,CAAA;AACd,eAAO,MAAM,gBAAgB,wBAIf,CAAA;AACd,eAAO,MAAM,sBAAsB,wBAIrB,CAAA;AAEd,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BrC,CAAA;AAED,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 sub-type of lists
|
23
|
+
*/
|
24
|
+
listSub: string;
|
21
25
|
/**
|
22
26
|
* The name of the question (unique id)
|
23
27
|
*/
|
@@ -106,6 +110,10 @@ export interface FormEditor {
|
|
106
110
|
* The maximum days in the past to allow for a date
|
107
111
|
*/
|
108
112
|
maxPast: string;
|
113
|
+
/**
|
114
|
+
* The exact number of files to upload
|
115
|
+
*/
|
116
|
+
exactFiles: string;
|
109
117
|
/**
|
110
118
|
* The minimum number of files to upload
|
111
119
|
*/
|
@@ -131,9 +139,9 @@ export interface FormEditor {
|
|
131
139
|
*/
|
132
140
|
tabularDataTypes: string[];
|
133
141
|
}
|
134
|
-
export type FormEditorInputPage = Pick<FormEditor, 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub'>;
|
142
|
+
export type FormEditorInputPage = Pick<FormEditor, 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub' | 'listSub'>;
|
135
143
|
export type FormEditorInputCheckAnswersSettings = Pick<FormEditor, 'needDeclaration' | 'declarationText'>;
|
136
|
-
export type FormEditorInputQuestion = Pick<FormEditor, 'questionType' | 'name' | 'question' | 'shortDescription' | 'hintText' | 'questionOptional' | 'minLength' | 'maxLength' | 'regex' | 'rows' | 'classes' | 'prefix' | 'suffix' | 'precision' | 'min' | 'max' | 'maxFuture' | 'maxPast' | 'minFiles' | 'maxFiles' | 'fileTypes' | 'documentTypes' | 'imageTypes' | 'tabularDataTypes'>;
|
144
|
+
export type FormEditorInputQuestion = Pick<FormEditor, 'questionType' | 'name' | 'question' | 'shortDescription' | 'hintText' | 'questionOptional' | 'minLength' | 'maxLength' | 'regex' | 'rows' | 'classes' | 'prefix' | 'suffix' | 'precision' | 'min' | 'max' | 'maxFuture' | 'maxPast' | 'exactFiles' | 'minFiles' | 'maxFiles' | 'fileTypes' | 'documentTypes' | 'imageTypes' | 'tabularDataTypes'>;
|
137
145
|
export type FormEditorInputPageSettings = Pick<FormEditor, 'pageHeadingAndGuidance' | 'pageHeading' | 'guidanceText'>;
|
138
146
|
export type FormEditorInputGuidancePage = Pick<FormEditor, 'pageHeading' | 'guidanceText'>;
|
139
147
|
export interface GovukField {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/form-editor/types.ts"],"names":[],"mappings":"AAAA;;GAE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AE,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,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,gBAAgB,CAAC,EAAE,UAAU,CAAA;IAC7B,YAAY,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAChC;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE;QACL,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;IACD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACF"}
|
package/package.json
CHANGED
@@ -8,19 +8,25 @@ import {
|
|
8
8
|
type FormEditorInputQuestion
|
9
9
|
} from '~/src/form/form-editor/types.js'
|
10
10
|
|
11
|
+
export enum QuestionTypeSubGroup {
|
12
|
+
WrittenAnswerSubGroup = 'writtenAnswerSub',
|
13
|
+
DateSubGroup = 'dateSub',
|
14
|
+
ListSubGroup = 'listSub'
|
15
|
+
}
|
16
|
+
|
11
17
|
export const pageTypeSchema = Joi.string()
|
12
18
|
.required()
|
13
19
|
.valid('question', 'guidance')
|
14
20
|
export const questionTypeSchema = Joi.string()
|
15
21
|
.required()
|
16
22
|
.valid(
|
17
|
-
|
18
|
-
|
23
|
+
QuestionTypeSubGroup.WrittenAnswerSubGroup,
|
24
|
+
QuestionTypeSubGroup.DateSubGroup,
|
19
25
|
ComponentType.UkAddressField,
|
20
26
|
ComponentType.TelephoneNumberField,
|
21
27
|
ComponentType.FileUploadField,
|
22
28
|
ComponentType.EmailAddressField,
|
23
|
-
|
29
|
+
QuestionTypeSubGroup.ListSubGroup
|
24
30
|
)
|
25
31
|
|
26
32
|
export const questionTypeFullSchema = Joi.string()
|
@@ -48,6 +54,14 @@ export const writtenAnswerSubSchema = Joi.string()
|
|
48
54
|
export const dateSubSchema = Joi.string()
|
49
55
|
.required()
|
50
56
|
.valid(ComponentType.DatePartsField, ComponentType.MonthYearField)
|
57
|
+
export const listSubSchema = Joi.string()
|
58
|
+
.required()
|
59
|
+
.valid(
|
60
|
+
ComponentType.YesNoField,
|
61
|
+
ComponentType.CheckboxesField,
|
62
|
+
ComponentType.RadiosField,
|
63
|
+
ComponentType.AutocompleteField
|
64
|
+
)
|
51
65
|
|
52
66
|
export const nameSchema = Joi.string().trim().required()
|
53
67
|
export const questionSchema = Joi.string().trim().required()
|
@@ -62,8 +76,9 @@ export const pageHeadingSchema = Joi.string().trim().required()
|
|
62
76
|
export const guidanceTextSchema = Joi.string().trim()
|
63
77
|
export const needDeclarationSchema = Joi.string().trim().required()
|
64
78
|
export const declarationTextSchema = Joi.string().trim().required()
|
65
|
-
export const
|
66
|
-
export const
|
79
|
+
export const exactFilesSchema = Joi.number().empty('').integer().min(1).max(25)
|
80
|
+
export const minFilesSchema = Joi.number().empty('').integer().min(0).max(25)
|
81
|
+
export const maxFilesSchema = Joi.number().empty('').integer().min(1).max(25)
|
67
82
|
export const minSchema = Joi.number().empty('').integer()
|
68
83
|
export const maxSchema = Joi.number().empty('').integer()
|
69
84
|
export const minLengthSchema = Joi.number().empty('').integer().min(1)
|
@@ -97,6 +112,34 @@ export const tabularDataTypesSchema = Joi.array()
|
|
97
112
|
.empty(null)
|
98
113
|
.default([])
|
99
114
|
|
115
|
+
export const questionDetailsFullSchema = {
|
116
|
+
classesSchema,
|
117
|
+
documentTypesSchema,
|
118
|
+
exactFilesSchema,
|
119
|
+
fileTypesSchema,
|
120
|
+
hintTextSchema,
|
121
|
+
imageTypesSchema,
|
122
|
+
maxFilesSchema,
|
123
|
+
maxFutureSchema,
|
124
|
+
maxLengthSchema,
|
125
|
+
maxPastSchema,
|
126
|
+
maxSchema,
|
127
|
+
minFilesSchema,
|
128
|
+
minLengthSchema,
|
129
|
+
minSchema,
|
130
|
+
nameSchema,
|
131
|
+
precisionSchema,
|
132
|
+
prefixSchema,
|
133
|
+
questionOptionalSchema,
|
134
|
+
questionSchema,
|
135
|
+
questionTypeFullSchema,
|
136
|
+
regexSchema,
|
137
|
+
rowsSchema,
|
138
|
+
shortDescriptionSchema,
|
139
|
+
suffixSchema,
|
140
|
+
tabularDataTypesSchema
|
141
|
+
}
|
142
|
+
|
100
143
|
export const formEditorInputPageKeys = {
|
101
144
|
pageType: pageTypeSchema,
|
102
145
|
questionType: questionTypeSchema
|
@@ -22,6 +22,11 @@ export interface FormEditor {
|
|
22
22
|
*/
|
23
23
|
dateSub: string
|
24
24
|
|
25
|
+
/**
|
26
|
+
* The sub-type of lists
|
27
|
+
*/
|
28
|
+
listSub: string
|
29
|
+
|
25
30
|
/**
|
26
31
|
* The name of the question (unique id)
|
27
32
|
*/
|
@@ -132,6 +137,11 @@ export interface FormEditor {
|
|
132
137
|
*/
|
133
138
|
maxPast: string
|
134
139
|
|
140
|
+
/**
|
141
|
+
* The exact number of files to upload
|
142
|
+
*/
|
143
|
+
exactFiles: string
|
144
|
+
|
135
145
|
/**
|
136
146
|
* The minimum number of files to upload
|
137
147
|
*/
|
@@ -165,7 +175,7 @@ export interface FormEditor {
|
|
165
175
|
|
166
176
|
export type FormEditorInputPage = Pick<
|
167
177
|
FormEditor,
|
168
|
-
'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub'
|
178
|
+
'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub' | 'listSub'
|
169
179
|
>
|
170
180
|
|
171
181
|
export type FormEditorInputCheckAnswersSettings = Pick<
|
@@ -193,6 +203,7 @@ export type FormEditorInputQuestion = Pick<
|
|
193
203
|
| 'max'
|
194
204
|
| 'maxFuture'
|
195
205
|
| 'maxPast'
|
206
|
+
| 'exactFiles'
|
196
207
|
| 'minFiles'
|
197
208
|
| 'maxFiles'
|
198
209
|
| 'fileTypes'
|