@defra/forms-model 3.0.678 → 3.0.680
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 +4 -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-definition/helpers.js +1 -1
- package/dist/module/form/form-definition/helpers.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/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/form/form-manager/types.js +4 -1
- package/dist/module/form/form-manager/types.js.map +1 -1
- package/dist/types/form/form-audit/types.d.ts.map +1 -1
- package/dist/types/form/form-definition/helpers.d.ts +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/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/package.json +1 -1
- package/schemas/form-editor-input-question-schema.json +5 -0
- package/src/form/form-audit/types.ts +17 -34
- package/src/form/form-definition/helpers.ts +1 -1
- package/src/form/form-editor/__stubs__/preview.js +14 -0
- package/src/form/form-editor/index.ts +14 -4
- 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
|
@@ -85,8 +85,7 @@ export interface FormTitleUpdatedMessageData extends FormMessageDataBase {
|
|
|
85
85
|
changes: ChangesMessageData<FormTitleChanges>
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
export interface FormOrganisationUpdatedMessageData
|
|
89
|
-
extends FormMessageDataBase {
|
|
88
|
+
export interface FormOrganisationUpdatedMessageData extends FormMessageDataBase {
|
|
90
89
|
changes: ChangesMessageData<FormOrganisationChanges>
|
|
91
90
|
}
|
|
92
91
|
|
|
@@ -98,43 +97,35 @@ export interface FormTeamEmailUpdatedMessageData extends FormMessageDataBase {
|
|
|
98
97
|
changes: ChangesMessageData<FormTeamEmailChanges>
|
|
99
98
|
}
|
|
100
99
|
|
|
101
|
-
export interface FormSupportContactUpdatedMessageData
|
|
102
|
-
extends FormMessageDataBase {
|
|
100
|
+
export interface FormSupportContactUpdatedMessageData extends FormMessageDataBase {
|
|
103
101
|
changes: ChangesMessageData<FormSupportContactChanges>
|
|
104
102
|
}
|
|
105
103
|
|
|
106
|
-
export interface FormSupportPhoneUpdatedMessageData
|
|
107
|
-
extends FormMessageDataBase {
|
|
104
|
+
export interface FormSupportPhoneUpdatedMessageData extends FormMessageDataBase {
|
|
108
105
|
changes: ChangesMessageData<FormSupportPhoneChanges>
|
|
109
106
|
}
|
|
110
107
|
|
|
111
|
-
export interface FormSupportEmailUpdatedMessageData
|
|
112
|
-
extends FormMessageDataBase {
|
|
108
|
+
export interface FormSupportEmailUpdatedMessageData extends FormMessageDataBase {
|
|
113
109
|
changes: ChangesMessageData<FormSupportEmailChanges>
|
|
114
110
|
}
|
|
115
111
|
|
|
116
|
-
export interface FormSupportOnlineUpdatedMessageData
|
|
117
|
-
extends FormMessageDataBase {
|
|
112
|
+
export interface FormSupportOnlineUpdatedMessageData extends FormMessageDataBase {
|
|
118
113
|
changes: ChangesMessageData<FormSupportOnlineChanges>
|
|
119
114
|
}
|
|
120
115
|
|
|
121
|
-
export interface FormPrivacyNoticeUpdatedMessageData
|
|
122
|
-
extends FormMessageDataBase {
|
|
116
|
+
export interface FormPrivacyNoticeUpdatedMessageData extends FormMessageDataBase {
|
|
123
117
|
changes: ChangesMessageData<FormPrivacyNoticeChanges>
|
|
124
118
|
}
|
|
125
119
|
|
|
126
|
-
export interface FormTermsAndConditionsAgreedMessageData
|
|
127
|
-
extends FormMessageDataBase {
|
|
120
|
+
export interface FormTermsAndConditionsAgreedMessageData extends FormMessageDataBase {
|
|
128
121
|
changes: ChangesMessageData<FormTermsAndConditionsChanges>
|
|
129
122
|
}
|
|
130
123
|
|
|
131
|
-
export interface FormNotificationEmailUpdatedMessageData
|
|
132
|
-
extends FormMessageDataBase {
|
|
124
|
+
export interface FormNotificationEmailUpdatedMessageData extends FormMessageDataBase {
|
|
133
125
|
changes: ChangesMessageData<FormNotificationEmailChanges>
|
|
134
126
|
}
|
|
135
127
|
|
|
136
|
-
export interface FormSubmissionGuidanceUpdatedMessageData
|
|
137
|
-
extends FormMessageDataBase {
|
|
128
|
+
export interface FormSubmissionGuidanceUpdatedMessageData extends FormMessageDataBase {
|
|
138
129
|
changes: ChangesMessageData<FormSubmissionGuidanceChanges>
|
|
139
130
|
}
|
|
140
131
|
|
|
@@ -321,24 +312,21 @@ export interface FormPrivacyNoticeUpdatedMessage extends ManagerMessageBase {
|
|
|
321
312
|
data: FormPrivacyNoticeUpdatedMessageData
|
|
322
313
|
}
|
|
323
314
|
|
|
324
|
-
export interface FormTermsAndConditionsAgreedMessage
|
|
325
|
-
extends ManagerMessageBase {
|
|
315
|
+
export interface FormTermsAndConditionsAgreedMessage extends ManagerMessageBase {
|
|
326
316
|
category: AuditEventMessageCategory.FORM
|
|
327
317
|
type: AuditEventMessageType.FORM_TERMS_AND_CONDITIONS_AGREED
|
|
328
318
|
source: AuditEventMessageSource.FORMS_MANAGER
|
|
329
319
|
data: FormTermsAndConditionsAgreedMessageData
|
|
330
320
|
}
|
|
331
321
|
|
|
332
|
-
export interface FormNotificationEmailUpdatedMessage
|
|
333
|
-
extends ManagerMessageBase {
|
|
322
|
+
export interface FormNotificationEmailUpdatedMessage extends ManagerMessageBase {
|
|
334
323
|
category: AuditEventMessageCategory.FORM
|
|
335
324
|
type: AuditEventMessageType.FORM_NOTIFICATION_EMAIL_UPDATED
|
|
336
325
|
source: AuditEventMessageSource.FORMS_MANAGER
|
|
337
326
|
data: FormNotificationEmailUpdatedMessageData
|
|
338
327
|
}
|
|
339
328
|
|
|
340
|
-
export interface FormSubmissionGuidanceUpdatedMessage
|
|
341
|
-
extends ManagerMessageBase {
|
|
329
|
+
export interface FormSubmissionGuidanceUpdatedMessage extends ManagerMessageBase {
|
|
342
330
|
category: AuditEventMessageCategory.FORM
|
|
343
331
|
type: AuditEventMessageType.FORM_SUBMISSION_GUIDANCE_UPDATED
|
|
344
332
|
source: AuditEventMessageSource.FORMS_MANAGER
|
|
@@ -419,29 +407,25 @@ export interface AuthenticationLoginMessage extends AuthenticationMessageBase {
|
|
|
419
407
|
data: AuthenticationMessageData
|
|
420
408
|
}
|
|
421
409
|
|
|
422
|
-
export interface AuthenticationLogoutManualMessage
|
|
423
|
-
extends AuthenticationMessageBase {
|
|
410
|
+
export interface AuthenticationLogoutManualMessage extends AuthenticationMessageBase {
|
|
424
411
|
category: AuditEventMessageCategory.AUTHENTICATION
|
|
425
412
|
type: AuditEventMessageType.AUTHENTICATION_LOGOUT_MANUAL
|
|
426
413
|
data: AuthenticationMessageData
|
|
427
414
|
}
|
|
428
415
|
|
|
429
|
-
export interface AuthenticationLogoutAutoMessage
|
|
430
|
-
extends AuthenticationMessageBase {
|
|
416
|
+
export interface AuthenticationLogoutAutoMessage extends AuthenticationMessageBase {
|
|
431
417
|
category: AuditEventMessageCategory.AUTHENTICATION
|
|
432
418
|
type: AuditEventMessageType.AUTHENTICATION_LOGOUT_AUTO
|
|
433
419
|
data: AuthenticationMessageData
|
|
434
420
|
}
|
|
435
421
|
|
|
436
|
-
export interface AuthenticationLogoutDifferentDeviceMessage
|
|
437
|
-
extends AuthenticationMessageBase {
|
|
422
|
+
export interface AuthenticationLogoutDifferentDeviceMessage extends AuthenticationMessageBase {
|
|
438
423
|
category: AuditEventMessageCategory.AUTHENTICATION
|
|
439
424
|
type: AuditEventMessageType.AUTHENTICATION_LOGOUT_DIFFERENT_DEVICE
|
|
440
425
|
data: AuthenticationMessageData
|
|
441
426
|
}
|
|
442
427
|
|
|
443
|
-
export interface FormSubmissionExcelRequestedMessage
|
|
444
|
-
extends DesignerMessageBase {
|
|
428
|
+
export interface FormSubmissionExcelRequestedMessage extends DesignerMessageBase {
|
|
445
429
|
category: AuditEventMessageCategory.FORM
|
|
446
430
|
type: AuditEventMessageType.FORM_SUBMISSION_EXCEL_REQUESTED
|
|
447
431
|
data: ExcelGenerationMessageData
|
|
@@ -459,8 +443,7 @@ export interface PlatformCsatExcelRequestedMessage extends DesignerMessageBase {
|
|
|
459
443
|
data: ExcelGenerationMessageData
|
|
460
444
|
}
|
|
461
445
|
|
|
462
|
-
export interface PlatformMetricsDownloadRequestedMessage
|
|
463
|
-
extends DesignerMessageBase {
|
|
446
|
+
export interface PlatformMetricsDownloadRequestedMessage extends DesignerMessageBase {
|
|
464
447
|
category: AuditEventMessageCategory.FORM
|
|
465
448
|
type: AuditEventMessageType.PLATFORM_METRICS_DOWNLOAD_REQUESTED
|
|
466
449
|
}
|
|
@@ -28,7 +28,7 @@ export function isFormDefinition(
|
|
|
28
28
|
/**
|
|
29
29
|
* TypeGuard to check if something is a ConditionListItemRefValueDataV2
|
|
30
30
|
* @param { unknown } conditionValueData
|
|
31
|
-
* @returns {
|
|
31
|
+
* @returns { conditionValueData is ConditionListItemRefValueDataV2 }
|
|
32
32
|
*/
|
|
33
33
|
export function isConditionListItemRefValueData(
|
|
34
34
|
conditionValueData: unknown
|
|
@@ -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()
|
|
@@ -496,8 +502,9 @@ type GenericRuleOptions<K extends string, T> = Omit<GetRuleOptions, 'args'> & {
|
|
|
496
502
|
args: Record<K, T>
|
|
497
503
|
}
|
|
498
504
|
|
|
499
|
-
interface DSLSchema<
|
|
500
|
-
|
|
505
|
+
interface DSLSchema<
|
|
506
|
+
TSchema = Record<string, unknown>[]
|
|
507
|
+
> extends ArraySchema<TSchema> {
|
|
501
508
|
rowSeparator: (rowSep: string | RegExp) => DSLSchema<TSchema>
|
|
502
509
|
row: (rowSep: string | RegExp) => DSLSchema<TSchema>
|
|
503
510
|
colSeparator: (colSep: string | RegExp) => DSLSchema<TSchema>
|
|
@@ -678,6 +685,7 @@ export const questionDetailsFullSchema = {
|
|
|
678
685
|
regexSchema,
|
|
679
686
|
rowsSchema,
|
|
680
687
|
shortDescriptionSchema,
|
|
688
|
+
errorDescriptionSchema,
|
|
681
689
|
suffixSchema,
|
|
682
690
|
tabularDataTypesSchema,
|
|
683
691
|
usePostcodeLookupSchema,
|
|
@@ -706,7 +714,7 @@ export const formEditorInputPageSchema = Joi.object<FormEditorInputPage>()
|
|
|
706
714
|
.required()
|
|
707
715
|
.description('Input schema for creating a new page in the form editor')
|
|
708
716
|
|
|
709
|
-
export const
|
|
717
|
+
export const formEditorInputCheckAnswersSettingsKeys = {
|
|
710
718
|
declarationText: shortDescriptionSchema
|
|
711
719
|
}
|
|
712
720
|
|
|
@@ -716,13 +724,14 @@ export const formEditorInputheckAnswersSettingsKeys = {
|
|
|
716
724
|
*/
|
|
717
725
|
export const formEditorInputCheckAnswersSettingSchema =
|
|
718
726
|
Joi.object<FormEditorInputCheckAnswersSettings>()
|
|
719
|
-
.keys(
|
|
727
|
+
.keys(formEditorInputCheckAnswersSettingsKeys)
|
|
720
728
|
.required()
|
|
721
729
|
.description('Configuration for the check-answers page')
|
|
722
730
|
|
|
723
731
|
export const formEditorInputQuestionKeys = {
|
|
724
732
|
question: questionSchema,
|
|
725
733
|
shortDescription: shortDescriptionSchema,
|
|
734
|
+
errorDescription: errorDescriptionSchema,
|
|
726
735
|
hintText: hintTextSchema,
|
|
727
736
|
questionOptional: questionOptionalSchema
|
|
728
737
|
}
|
|
@@ -762,6 +771,7 @@ export function govukFieldValueIsString(
|
|
|
762
771
|
'question',
|
|
763
772
|
'hintText',
|
|
764
773
|
'shortDescription',
|
|
774
|
+
'errorDescription',
|
|
765
775
|
'autoCompleteOptions',
|
|
766
776
|
'classes',
|
|
767
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
|