@defra/forms-model 3.0.679 → 3.0.681
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-audit/enums.js +2 -0
- package/dist/module/form/form-audit/enums.js.map +1 -1
- package/dist/module/form/form-audit/types.js.map +1 -1
- package/dist/module/form/form-editor/__stubs__/preview.js +14 -0
- package/dist/module/form/form-editor/__stubs__/preview.js.map +1 -1
- package/dist/module/form/form-editor/enums.js +7 -0
- package/dist/module/form/form-editor/enums.js.map +1 -0
- package/dist/module/form/form-editor/index.js +6 -3
- package/dist/module/form/form-editor/index.js.map +1 -1
- package/dist/module/form/form-editor/preview/component-elements.js +1 -0
- package/dist/module/form/form-editor/preview/component-elements.js.map +1 -1
- package/dist/module/form/form-editor/preview/types.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/form/form-audit/enums.d.ts +2 -0
- package/dist/types/form/form-audit/enums.d.ts.map +1 -1
- package/dist/types/form/form-audit/types.d.ts +9 -1
- package/dist/types/form/form-audit/types.d.ts.map +1 -1
- package/dist/types/form/form-editor/__stubs__/preview.d.ts +10 -0
- package/dist/types/form/form-editor/__stubs__/preview.d.ts.map +1 -1
- package/dist/types/form/form-editor/enums.d.ts +6 -0
- package/dist/types/form/form-editor/enums.d.ts.map +1 -0
- package/dist/types/form/form-editor/index.d.ts +4 -1
- package/dist/types/form/form-editor/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/component-elements.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/types.d.ts +1 -0
- package/dist/types/form/form-editor/preview/types.d.ts.map +1 -1
- package/dist/types/form/form-editor/types.d.ts +7 -2
- 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/schemas/form-editor-input-question-schema.json +5 -0
- package/src/form/form-audit/enums.ts +2 -0
- package/src/form/form-audit/types.ts +12 -0
- package/src/form/form-editor/__stubs__/preview.js +14 -0
- package/src/form/form-editor/enums.ts +5 -0
- package/src/form/form-editor/index.ts +11 -2
- package/src/form/form-editor/preview/component-elements.js +1 -0
- package/src/form/form-editor/preview/types.ts +1 -0
- package/src/form/form-editor/types.ts +8 -0
- package/src/index.ts +1 -0
|
@@ -85,6 +85,11 @@ export class QuestionPreviewElements {
|
|
|
85
85
|
* @protected
|
|
86
86
|
*/
|
|
87
87
|
_shortDesc = ''
|
|
88
|
+
/**
|
|
89
|
+
* @type {string}
|
|
90
|
+
* @protected
|
|
91
|
+
*/
|
|
92
|
+
_errorDesc = ''
|
|
88
93
|
/**
|
|
89
94
|
* @type {string}
|
|
90
95
|
* @protected
|
|
@@ -133,6 +138,7 @@ export class QuestionPreviewElements {
|
|
|
133
138
|
hintText: this._hintText,
|
|
134
139
|
optional: this._optional,
|
|
135
140
|
shortDesc: this._shortDesc,
|
|
141
|
+
errorDesc: this._errorDesc,
|
|
136
142
|
userClasses: this._userClasses,
|
|
137
143
|
items: this._items,
|
|
138
144
|
content: this._content
|
|
@@ -307,6 +313,7 @@ export const baseElements = /** @type {BaseSettings} */ ({
|
|
|
307
313
|
hintText: 'Choose one adventure that best suits you.',
|
|
308
314
|
userClasses: '',
|
|
309
315
|
shortDesc: '',
|
|
316
|
+
errorDesc: '',
|
|
310
317
|
content: '',
|
|
311
318
|
largeTitle: true
|
|
312
319
|
})
|
|
@@ -318,6 +325,7 @@ export const numberElements = /** @type {NumberSettings} */ ({
|
|
|
318
325
|
hintText: 'Choose one adventure that best suits you.',
|
|
319
326
|
userClasses: '',
|
|
320
327
|
shortDesc: '',
|
|
328
|
+
errorDesc: '',
|
|
321
329
|
content: '',
|
|
322
330
|
largeTitle: true,
|
|
323
331
|
prefix: '',
|
|
@@ -396,6 +404,11 @@ export class NumberPreviewElements {
|
|
|
396
404
|
* @protected
|
|
397
405
|
*/
|
|
398
406
|
_shortDesc = ''
|
|
407
|
+
/**
|
|
408
|
+
* @type {string}
|
|
409
|
+
* @protected
|
|
410
|
+
*/
|
|
411
|
+
_errorDesc = ''
|
|
399
412
|
/**
|
|
400
413
|
* @type {string}
|
|
401
414
|
* @protected
|
|
@@ -458,6 +471,7 @@ export class NumberPreviewElements {
|
|
|
458
471
|
hintText: this._hintText,
|
|
459
472
|
optional: this._optional,
|
|
460
473
|
shortDesc: this._shortDesc,
|
|
474
|
+
errorDesc: this._errorDesc,
|
|
461
475
|
userClasses: this._userClasses,
|
|
462
476
|
prefix: this._prefix,
|
|
463
477
|
suffix: this._suffix,
|
|
@@ -276,6 +276,12 @@ export const shortDescriptionSchema = Joi.string()
|
|
|
276
276
|
.required()
|
|
277
277
|
.description('Brief description of the question for internal use')
|
|
278
278
|
|
|
279
|
+
export const errorDescriptionSchema = Joi.string()
|
|
280
|
+
.custom(rtrimOnly)
|
|
281
|
+
.allow('')
|
|
282
|
+
.optional()
|
|
283
|
+
.description('Description that will be displayed in error messages')
|
|
284
|
+
|
|
279
285
|
export const pageHeadingAndGuidanceSchema = Joi.string()
|
|
280
286
|
.trim()
|
|
281
287
|
.optional()
|
|
@@ -679,6 +685,7 @@ export const questionDetailsFullSchema = {
|
|
|
679
685
|
regexSchema,
|
|
680
686
|
rowsSchema,
|
|
681
687
|
shortDescriptionSchema,
|
|
688
|
+
errorDescriptionSchema,
|
|
682
689
|
suffixSchema,
|
|
683
690
|
tabularDataTypesSchema,
|
|
684
691
|
usePostcodeLookupSchema,
|
|
@@ -707,7 +714,7 @@ export const formEditorInputPageSchema = Joi.object<FormEditorInputPage>()
|
|
|
707
714
|
.required()
|
|
708
715
|
.description('Input schema for creating a new page in the form editor')
|
|
709
716
|
|
|
710
|
-
export const
|
|
717
|
+
export const formEditorInputCheckAnswersSettingsKeys = {
|
|
711
718
|
declarationText: shortDescriptionSchema
|
|
712
719
|
}
|
|
713
720
|
|
|
@@ -717,13 +724,14 @@ export const formEditorInputheckAnswersSettingsKeys = {
|
|
|
717
724
|
*/
|
|
718
725
|
export const formEditorInputCheckAnswersSettingSchema =
|
|
719
726
|
Joi.object<FormEditorInputCheckAnswersSettings>()
|
|
720
|
-
.keys(
|
|
727
|
+
.keys(formEditorInputCheckAnswersSettingsKeys)
|
|
721
728
|
.required()
|
|
722
729
|
.description('Configuration for the check-answers page')
|
|
723
730
|
|
|
724
731
|
export const formEditorInputQuestionKeys = {
|
|
725
732
|
question: questionSchema,
|
|
726
733
|
shortDescription: shortDescriptionSchema,
|
|
734
|
+
errorDescription: errorDescriptionSchema,
|
|
727
735
|
hintText: hintTextSchema,
|
|
728
736
|
questionOptional: questionOptionalSchema
|
|
729
737
|
}
|
|
@@ -763,6 +771,7 @@ export function govukFieldValueIsString(
|
|
|
763
771
|
'question',
|
|
764
772
|
'hintText',
|
|
765
773
|
'shortDescription',
|
|
774
|
+
'errorDescription',
|
|
766
775
|
'autoCompleteOptions',
|
|
767
776
|
'classes',
|
|
768
777
|
'prefix',
|
|
@@ -72,6 +72,11 @@ export interface FormEditor {
|
|
|
72
72
|
*/
|
|
73
73
|
shortDescription: string
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* The error description of the question
|
|
77
|
+
*/
|
|
78
|
+
errorDescription: string
|
|
79
|
+
|
|
75
80
|
/**
|
|
76
81
|
* The value of checkbox to reveal instruction text field
|
|
77
82
|
*/
|
|
@@ -460,6 +465,7 @@ export type FormEditorInputQuestion = Pick<
|
|
|
460
465
|
| 'name'
|
|
461
466
|
| 'question'
|
|
462
467
|
| 'shortDescription'
|
|
468
|
+
| 'errorDescription'
|
|
463
469
|
| 'hintText'
|
|
464
470
|
| 'declarationText'
|
|
465
471
|
| 'questionOptional'
|
|
@@ -537,6 +543,7 @@ export type FormEditorInputQuestionDetails = Pick<
|
|
|
537
543
|
| 'question'
|
|
538
544
|
| 'hintText'
|
|
539
545
|
| 'shortDescription'
|
|
546
|
+
| 'errorDescription'
|
|
540
547
|
| 'questionOptional'
|
|
541
548
|
| 'questionType'
|
|
542
549
|
| 'fileTypes'
|
|
@@ -745,6 +752,7 @@ export interface FormEditorGovukField {
|
|
|
745
752
|
instructionText?: GovukField
|
|
746
753
|
questionOptional?: GovukField
|
|
747
754
|
shortDescription?: GovukField
|
|
755
|
+
errorDescription?: GovukField
|
|
748
756
|
fileTypes?: GovukField
|
|
749
757
|
documentTypes?: GovukField
|
|
750
758
|
imageTypes?: GovukField
|
package/src/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ export * from '~/src/form/form-metrics/index.js'
|
|
|
16
16
|
export * from '~/src/form/form-submission/index.js'
|
|
17
17
|
export * from '~/src/form/form-submission/enums.js'
|
|
18
18
|
export * from '~/src/form/utils/index.js'
|
|
19
|
+
export * from '~/src/form/form-editor/enums.js'
|
|
19
20
|
export * from '~/src/form/form-editor/index.js'
|
|
20
21
|
export * from '~/src/form/form-editor/preview/index.js'
|
|
21
22
|
export * from '~/src/form/form-manager/types.js'
|