@defra/forms-model 3.0.415 → 3.0.417
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/common/enums.js +6 -0
- package/dist/module/common/enums.js.map +1 -0
- package/dist/module/common/types.js.map +1 -1
- package/dist/module/form/form-editor/index.js +4 -0
- package/dist/module/form/form-editor/index.js.map +1 -1
- package/dist/module/form/form-editor/types.js.map +1 -1
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/types/common/enums.d.ts +5 -0
- package/dist/types/common/enums.d.ts.map +1 -0
- package/dist/types/common/types.d.ts +1 -4
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/form/form-editor/index.d.ts +4 -0
- package/dist/types/form/form-editor/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/types.d.ts +56 -1
- package/dist/types/form/form-editor/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/enums.ts +4 -0
- package/src/common/types.ts +1 -5
- package/src/form/form-editor/index.ts +4 -0
- package/src/form/form-editor/types.ts +53 -0
- package/src/index.ts +1 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"enums.js","names":["FormStatus"],"sources":["../../../src/common/enums.ts"],"sourcesContent":["export enum FormStatus {\n Draft = 'draft',\n Live = 'live'\n}\n"],"mappings":"AAAA,WAAYA,UAAU,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/common/types.ts"],"sourcesContent":["import {\n type PaginationOptions,\n type PaginationResult\n} from '~/src/common/pagination/types.js'\nimport { type SearchOptions } from '~/src/common/search/types.js'\nimport { type SortingOptions } from '~/src/common/sorting/types.js'\n\n/**\n * Options for querying results, including pagination, sorting, and searching\n */\nexport type QueryOptions = PaginationOptions & SortingOptions & SearchOptions\n\n/**\n * Available
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/common/types.ts"],"sourcesContent":["import {\n type PaginationOptions,\n type PaginationResult\n} from '~/src/common/pagination/types.js'\nimport { type SearchOptions } from '~/src/common/search/types.js'\nimport { type SortingOptions } from '~/src/common/sorting/types.js'\nimport { type FormStatus } from '~/src/index.js'\n\n/**\n * Options for querying results, including pagination, sorting, and searching\n */\nexport type QueryOptions = PaginationOptions & SortingOptions & SearchOptions\n\n/**\n * Available filter options for the current result set\n */\nexport interface FilterOptions {\n /**\n * List of unique authors in the response\n */\n authors: string[]\n\n /**\n * List of organizations that have forms\n */\n organisations: string[]\n\n /**\n * Status values present in the results\n */\n status?: FormStatus[]\n}\n\n/**\n * Metadata containing the optional pagination, sorting, and searching information\n */\nexport interface Meta {\n /**\n * The pagination details\n */\n pagination?: PaginationResult\n\n /**\n * The sorting details\n */\n sorting?: SortingOptions\n\n /**\n * The search details\n */\n search?: SearchOptions\n\n /**\n * Available filter options\n */\n filters?: FilterOptions\n}\n\n/**\n * Standard response wrapper for query results with metadata\n */\nexport interface QueryResult<Model> {\n /**\n * The array of data items\n */\n data: Model[]\n\n /**\n * The metadata about the result\n */\n meta: Meta\n}\n\n/**\n * Type for the list items within a Radio or Checkbox nunjucks definition\n */\nexport interface CheckboxOrRadioItem {\n /**\n * The text to be displayed\n */\n text?: string\n\n /**\n * If text is set, this is not required. HTML to use within each radio item label\n */\n html?: string\n\n /**\n * Specific ID attribute for the checkbox/radio item\n */\n id?: string\n\n /**\n * Name for the checkbox/radio item\n */\n name?: string\n\n /**\n * Required. Value for the radio input\n */\n value: string\n\n /**\n * Subset of options for the label\n */\n label?: string\n\n /**\n * Can be used to add a hint to each item\n */\n hint?: string\n\n /**\n * Divider text to separate checkbox/radio items, for example the text \"or\"\n */\n divider?: string\n\n /**\n * Whether the checkbox/radio should be checked when the page loads\n */\n checked?: boolean\n\n /**\n * Provide additional content to reveal when the checkbox/radio is checked\n */\n conditional?: {\n html?: string\n }\n\n /**\n * The behaviour - if set to \"exclusive\" implements a 'None of thse' type behaviour via Javascript when checkboxes are clicked\n */\n behaviour?: string\n\n /**\n * If true, checkbox/radio option will be disabled\n */\n disabled?: boolean\n\n /**\n * HTML attributes (for example data attributes) to add to the checkbox input tag\n */\n attributes?: object\n}\n"],"mappings":"","ignoreList":[]}
|
@@ -14,6 +14,10 @@ export const pageHeadingSchema = Joi.string().required();
|
|
14
14
|
export const guidanceTextSchema = Joi.string().optional().allow('');
|
15
15
|
export const needDeclarationSchema = Joi.string().required();
|
16
16
|
export const declarationTextSchema = Joi.string().required();
|
17
|
+
export const minLengthSchema = Joi.number().empty('').min(1);
|
18
|
+
export const maxLengthSchema = Joi.number().empty('').min(1);
|
19
|
+
export const regexSchema = Joi.string().optional().allow('');
|
20
|
+
export const classesSchema = Joi.string().optional().allow('');
|
17
21
|
export const formEditorInputPageKeys = {
|
18
22
|
pageType: pageTypeSchema,
|
19
23
|
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,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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ACnE,OAAO,MAAMK,iBAAiB,GAAG3B,GAAG,CAACG,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;AACxD,OAAO,MAAMwB,kBAAkB,GAAG5B,GAAG,CAACG,MAAM,CAAC,CAAC,CAACmB,QAAQ,CAAC,CAAC,CAACC,KAAK,CAAC,EAAE,CAAC;AACnE,OAAO,MAAMM,qBAAqB,GAAG7B,GAAG,CAACG,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;AAC5D,OAAO,MAAM0B,qBAAqB,GAAG9B,GAAG,CAACG,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;
|
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,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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sC,CAAC,CAC5CxC,QAAQ,CAAC,CAAC;AAEf,OAAO,MAAM2C,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,GACxCpD,GAAG,CAAC0C,MAAM,CAA0B,CAAC,CAClCC,IAAI,CAACI,2BAA2B,CAAC,CACjC3C,QAAQ,CAAC,CAAC;AAEf,OAAO,MAAMiD,+BAA+B,GAAG;EAC7CC,sBAAsB,EAAE5B,4BAA4B;EACpD6B,WAAW,EAAE5B,iBAAiB;EAC9B6B,YAAY,EAAE5B;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAM6B,iCAAiC,GAC5CzD,GAAG,CAAC0C,MAAM,CAA8B,CAAC,CACtCC,IAAI,CAACU,+BAA+B,CAAC,CACrCjD,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 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":[]}
|
package/dist/module/index.js
CHANGED
package/dist/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from '~/src/common/schema.js'\nexport * from '~/src/common/pagination/index.js'\nexport * from '~/src/common/search/index.js'\nexport * from '~/src/common/sorting/index.js'\nexport * from '~/src/components/index.js'\nexport * from '~/src/conditions/index.js'\nexport * from '~/src/form/form-definition/index.js'\nexport * from '~/src/form/form-definition/types.js'\nexport * from '~/src/form/form-metadata/index.js'\nexport * from '~/src/form/form-submission/index.js'\nexport * from '~/src/form/utils/index.js'\nexport * from '~/src/form/form-editor/index.js'\nexport * from '~/src/form/form-manager/index.js'\nexport * from '~/src/form/form-manager/types.js'\nexport * from '~/src/pages/index.js'\nexport * from '~/src/utils/helpers.js'\nexport * from '~/src/utils/markdown.js'\n\nexport type * from '~/src/common/types.js'\nexport type * from '~/src/common/pagination/types.js'\nexport type * from '~/src/common/search/types.js'\nexport type * from '~/src/common/sorting/types.js'\nexport type * from '~/src/components/types.js'\nexport type * from '~/src/conditions/types.js'\nexport type * from '~/src/form/form-definition/types.js'\nexport type * from '~/src/form/form-metadata/types.js'\nexport type * from '~/src/form/form-submission/types.js'\nexport type * from '~/src/form/form-editor/types.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from '~/src/common/enums.js'\nexport * from '~/src/common/schema.js'\nexport * from '~/src/common/pagination/index.js'\nexport * from '~/src/common/search/index.js'\nexport * from '~/src/common/sorting/index.js'\nexport * from '~/src/components/index.js'\nexport * from '~/src/conditions/index.js'\nexport * from '~/src/form/form-definition/index.js'\nexport * from '~/src/form/form-definition/types.js'\nexport * from '~/src/form/form-metadata/index.js'\nexport * from '~/src/form/form-submission/index.js'\nexport * from '~/src/form/utils/index.js'\nexport * from '~/src/form/form-editor/index.js'\nexport * from '~/src/form/form-manager/index.js'\nexport * from '~/src/form/form-manager/types.js'\nexport * from '~/src/pages/index.js'\nexport * from '~/src/utils/helpers.js'\nexport * from '~/src/utils/markdown.js'\n\nexport type * from '~/src/common/types.js'\nexport type * from '~/src/common/pagination/types.js'\nexport type * from '~/src/common/search/types.js'\nexport type * from '~/src/common/sorting/types.js'\nexport type * from '~/src/components/types.js'\nexport type * from '~/src/conditions/types.js'\nexport type * from '~/src/form/form-definition/types.js'\nexport type * from '~/src/form/form-metadata/types.js'\nexport type * from '~/src/form/form-submission/types.js'\nexport type * from '~/src/form/form-editor/types.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/common/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,KAAK,UAAU;IACf,IAAI,SAAS;CACd"}
|
@@ -1,14 +1,11 @@
|
|
1
1
|
import { type PaginationOptions, type PaginationResult } from '../common/pagination/types.js';
|
2
2
|
import { type SearchOptions } from '../common/search/types.js';
|
3
3
|
import { type SortingOptions } from '../common/sorting/types.js';
|
4
|
+
import { type FormStatus } from '../index.js';
|
4
5
|
/**
|
5
6
|
* Options for querying results, including pagination, sorting, and searching
|
6
7
|
*/
|
7
8
|
export type QueryOptions = PaginationOptions & SortingOptions & SearchOptions;
|
8
|
-
/**
|
9
|
-
* Available form status values
|
10
|
-
*/
|
11
|
-
export type FormStatus = 'draft' | 'live';
|
12
9
|
/**
|
13
10
|
* Available filter options for the current result set
|
14
11
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAA;
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,cAAc,GAAG,aAAa,CAAA;AAE7E;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAE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
@@ -14,6 +14,10 @@ export declare const pageHeadingSchema: Joi.StringSchema<string>;
|
|
14
14
|
export declare const guidanceTextSchema: Joi.StringSchema<string>;
|
15
15
|
export declare const needDeclarationSchema: Joi.StringSchema<string>;
|
16
16
|
export declare const declarationTextSchema: Joi.StringSchema<string>;
|
17
|
+
export declare const minLengthSchema: Joi.NumberSchema<number>;
|
18
|
+
export declare const maxLengthSchema: Joi.NumberSchema<number>;
|
19
|
+
export declare const regexSchema: Joi.StringSchema<string>;
|
20
|
+
export declare const classesSchema: Joi.StringSchema<string>;
|
17
21
|
export declare const formEditorInputPageKeys: {
|
18
22
|
pageType: Joi.StringSchema<string>;
|
19
23
|
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,e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AAED;;;GAGG;AACH,eAAO,MAAM,6BAA6B,2CAG3B,CAAA;AAEf,eAAO,MAAM,+BAA+B;;;;CAI3C,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,+CAG/B,CAAA"}
|
@@ -54,9 +54,64 @@ export interface FormEditor {
|
|
54
54
|
* The check answers declaration text
|
55
55
|
*/
|
56
56
|
declarationText: string;
|
57
|
+
/**
|
58
|
+
* The min length a field can have
|
59
|
+
*/
|
60
|
+
minLength: string;
|
61
|
+
/**
|
62
|
+
* The max length a field can have
|
63
|
+
*/
|
64
|
+
maxLength: string;
|
65
|
+
/**
|
66
|
+
* The regex value of a field
|
67
|
+
*/
|
68
|
+
regex: string;
|
69
|
+
/**
|
70
|
+
* The classes to be applied to a field
|
71
|
+
*/
|
72
|
+
classes: string;
|
57
73
|
}
|
58
74
|
export type FormEditorInputPage = Pick<FormEditor, 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub'>;
|
59
75
|
export type FormEditorInputCheckAnswersSettings = Pick<FormEditor, 'needDeclaration' | 'declarationText'>;
|
60
|
-
export type FormEditorInputQuestion = Pick<FormEditor, 'questionType' | 'question' | 'shortDescription' | 'hintText' | 'questionOptional'>;
|
76
|
+
export type FormEditorInputQuestion = Pick<FormEditor, 'questionType' | 'question' | 'shortDescription' | 'hintText' | 'questionOptional' | 'minLength' | 'maxLength' | 'regex' | 'classes'>;
|
61
77
|
export type FormEditorInputPageSettings = Pick<FormEditor, 'pageHeadingAndGuidance' | 'pageHeading' | 'guidanceText'>;
|
78
|
+
export interface GovukField {
|
79
|
+
id?: string;
|
80
|
+
name?: string;
|
81
|
+
idPrefix?: string;
|
82
|
+
value?: string | boolean | number;
|
83
|
+
classes?: string;
|
84
|
+
label?: {
|
85
|
+
text?: string;
|
86
|
+
html?: string;
|
87
|
+
classes?: string;
|
88
|
+
};
|
89
|
+
hint?: {
|
90
|
+
text?: string;
|
91
|
+
html?: string;
|
92
|
+
classes?: string;
|
93
|
+
};
|
94
|
+
items?: {
|
95
|
+
text?: string;
|
96
|
+
value?: string;
|
97
|
+
};
|
98
|
+
rows?: number;
|
99
|
+
}
|
100
|
+
export interface FormEditorGovukField {
|
101
|
+
question?: GovukField;
|
102
|
+
hintText?: GovukField;
|
103
|
+
questionOptional?: GovukField;
|
104
|
+
shortDescription?: GovukField;
|
105
|
+
minLength?: GovukField;
|
106
|
+
maxLength?: GovukField;
|
107
|
+
regex?: GovukField;
|
108
|
+
classes?: GovukField;
|
109
|
+
errorMessage?: {
|
110
|
+
text: string;
|
111
|
+
};
|
112
|
+
}
|
113
|
+
export interface FormEditorGovukFieldList {
|
114
|
+
fields: FormEditorGovukField;
|
115
|
+
optionalFieldsPartial?: string;
|
116
|
+
}
|
62
117
|
//# 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;
|
1
|
+
{"version":3,"file":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C,EAAE,MAAM,CAAA;CAC/B"}
|
package/dist/types/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qCAAqC,CAAA;AACnD,cAAc,qCAAqC,CAAA;AACnD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qCAAqC,CAAA;AACnD,cAAc,2BAA2B,CAAA;AACzC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AAEvC,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,8BAA8B,CAAA;AACjD,mBAAmB,+BAA+B,CAAA;AAClD,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,qCAAqC,CAAA;AACxD,mBAAmB,mCAAmC,CAAA;AACtD,mBAAmB,qCAAqC,CAAA;AACxD,mBAAmB,iCAAiC,CAAA"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qCAAqC,CAAA;AACnD,cAAc,qCAAqC,CAAA;AACnD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qCAAqC,CAAA;AACnD,cAAc,2BAA2B,CAAA;AACzC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AAEvC,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,8BAA8B,CAAA;AACjD,mBAAmB,+BAA+B,CAAA;AAClD,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,qCAAqC,CAAA;AACxD,mBAAmB,mCAAmC,CAAA;AACtD,mBAAmB,qCAAqC,CAAA;AACxD,mBAAmB,iCAAiC,CAAA"}
|
package/package.json
CHANGED
package/src/common/types.ts
CHANGED
@@ -4,17 +4,13 @@ import {
|
|
4
4
|
} from '~/src/common/pagination/types.js'
|
5
5
|
import { type SearchOptions } from '~/src/common/search/types.js'
|
6
6
|
import { type SortingOptions } from '~/src/common/sorting/types.js'
|
7
|
+
import { type FormStatus } from '~/src/index.js'
|
7
8
|
|
8
9
|
/**
|
9
10
|
* Options for querying results, including pagination, sorting, and searching
|
10
11
|
*/
|
11
12
|
export type QueryOptions = PaginationOptions & SortingOptions & SearchOptions
|
12
13
|
|
13
|
-
/**
|
14
|
-
* Available form status values
|
15
|
-
*/
|
16
|
-
export type FormStatus = 'draft' | 'live'
|
17
|
-
|
18
14
|
/**
|
19
15
|
* Available filter options for the current result set
|
20
16
|
*/
|
@@ -58,6 +58,10 @@ export const pageHeadingSchema = Joi.string().required()
|
|
58
58
|
export const guidanceTextSchema = Joi.string().optional().allow('')
|
59
59
|
export const needDeclarationSchema = Joi.string().required()
|
60
60
|
export const declarationTextSchema = Joi.string().required()
|
61
|
+
export const minLengthSchema = Joi.number().empty('').min(1)
|
62
|
+
export const maxLengthSchema = Joi.number().empty('').min(1)
|
63
|
+
export const regexSchema = Joi.string().optional().allow('')
|
64
|
+
export const classesSchema = Joi.string().optional().allow('')
|
61
65
|
|
62
66
|
export const formEditorInputPageKeys = {
|
63
67
|
pageType: pageTypeSchema,
|
@@ -66,6 +66,26 @@ export interface FormEditor {
|
|
66
66
|
* The check answers declaration text
|
67
67
|
*/
|
68
68
|
declarationText: string
|
69
|
+
|
70
|
+
/**
|
71
|
+
* The min length a field can have
|
72
|
+
*/
|
73
|
+
minLength: string
|
74
|
+
|
75
|
+
/**
|
76
|
+
* The max length a field can have
|
77
|
+
*/
|
78
|
+
maxLength: string
|
79
|
+
|
80
|
+
/**
|
81
|
+
* The regex value of a field
|
82
|
+
*/
|
83
|
+
regex: string
|
84
|
+
|
85
|
+
/**
|
86
|
+
* The classes to be applied to a field
|
87
|
+
*/
|
88
|
+
classes: string
|
69
89
|
}
|
70
90
|
|
71
91
|
export type FormEditorInputPage = Pick<
|
@@ -85,9 +105,42 @@ export type FormEditorInputQuestion = Pick<
|
|
85
105
|
| 'shortDescription'
|
86
106
|
| 'hintText'
|
87
107
|
| 'questionOptional'
|
108
|
+
| 'minLength'
|
109
|
+
| 'maxLength'
|
110
|
+
| 'regex'
|
111
|
+
| 'classes'
|
88
112
|
>
|
89
113
|
|
90
114
|
export type FormEditorInputPageSettings = Pick<
|
91
115
|
FormEditor,
|
92
116
|
'pageHeadingAndGuidance' | 'pageHeading' | 'guidanceText'
|
93
117
|
>
|
118
|
+
|
119
|
+
export interface GovukField {
|
120
|
+
id?: string
|
121
|
+
name?: string
|
122
|
+
idPrefix?: string
|
123
|
+
value?: string | boolean | number
|
124
|
+
classes?: string
|
125
|
+
label?: { text?: string; html?: string; classes?: string }
|
126
|
+
hint?: { text?: string; html?: string; classes?: string }
|
127
|
+
items?: { text?: string; value?: string }
|
128
|
+
rows?: number
|
129
|
+
}
|
130
|
+
|
131
|
+
export interface FormEditorGovukField {
|
132
|
+
question?: GovukField
|
133
|
+
hintText?: GovukField
|
134
|
+
questionOptional?: GovukField
|
135
|
+
shortDescription?: GovukField
|
136
|
+
minLength?: GovukField
|
137
|
+
maxLength?: GovukField
|
138
|
+
regex?: GovukField
|
139
|
+
classes?: GovukField
|
140
|
+
errorMessage?: { text: string }
|
141
|
+
}
|
142
|
+
|
143
|
+
export interface FormEditorGovukFieldList {
|
144
|
+
fields: FormEditorGovukField
|
145
|
+
optionalFieldsPartial?: string
|
146
|
+
}
|
package/src/index.ts
CHANGED