@defra/forms-model 3.0.417 → 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.
- package/dist/module/form/form-editor/index.js +1 -0
- package/dist/module/form/form-editor/index.js.map +1 -1
- package/dist/module/form/form-editor/types.js.map +1 -1
- package/dist/types/form/form-editor/index.d.ts +1 -0
- package/dist/types/form/form-editor/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/types.d.ts +5 -1
- package/dist/types/form/form-editor/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/form/form-editor/index.ts +1 -0
- package/src/form/form-editor/types.ts +6 -0
@@ -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');
|
@@ -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","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 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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ypeSchema","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,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,EACvBZ,aAAa,CAACa,kBAAkB,EAChCb,aA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C,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 /**\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 | '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":[]}
|
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>;
|
@@ -1 +1 @@
|
|
1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AAsC;;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
|
*/
|
@@ -73,7 +77,7 @@ export interface FormEditor {
|
|
73
77
|
}
|
74
78
|
export type FormEditorInputPage = Pick<FormEditor, 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub'>;
|
75
79
|
export type FormEditorInputCheckAnswersSettings = Pick<FormEditor, 'needDeclaration' | 'declarationText'>;
|
76
|
-
export type FormEditorInputQuestion = Pick<FormEditor, 'questionType' | 'question' | 'shortDescription' | 'hintText' | 'questionOptional' | 'minLength' | 'maxLength' | 'regex' | 'classes'>;
|
80
|
+
export type FormEditorInputQuestion = Pick<FormEditor, 'questionType' | 'name' | 'question' | 'shortDescription' | 'hintText' | 'questionOptional' | 'minLength' | 'maxLength' | 'regex' | 'classes'>;
|
77
81
|
export type FormEditorInputPageSettings = Pick<FormEditor, 'pageHeadingAndGuidance' | 'pageHeading' | 'guidanceText'>;
|
78
82
|
export interface GovukField {
|
79
83
|
id?: string;
|
@@ -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,YAA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,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')
|
@@ -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
|
*/
|
@@ -101,6 +106,7 @@ export type FormEditorInputCheckAnswersSettings = Pick<
|
|
101
106
|
export type FormEditorInputQuestion = Pick<
|
102
107
|
FormEditor,
|
103
108
|
| 'questionType'
|
109
|
+
| 'name'
|
104
110
|
| 'question'
|
105
111
|
| 'shortDescription'
|
106
112
|
| 'hintText'
|