@planning-inspectorate/dynamic-forms 3.15.6 → 3.16.0
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/.gitattributes +3 -0
- package/.prettierrc +1 -0
- package/README.md +11 -3
- package/package.json +6 -4
- package/{types/src → src}/components/address/question.d.ts +14 -2
- package/src/components/address/question.d.ts.map +1 -0
- package/src/components/address/question.js +1 -2
- package/{types/src → src}/components/boolean/question.d.ts +2 -2
- package/src/components/boolean/question.d.ts.map +1 -0
- package/src/components/boolean/question.js +1 -1
- package/src/components/checkbox/question.d.ts +29 -0
- package/src/components/checkbox/question.d.ts.map +1 -0
- package/src/components/checkbox/question.js +1 -5
- package/{types/src → src}/components/date/question.d.ts +10 -2
- package/src/components/date/question.d.ts.map +1 -0
- package/src/components/date/question.js +1 -2
- package/{types/src → src}/components/date-period/question.d.ts +16 -4
- package/src/components/date-period/question.d.ts.map +1 -0
- package/src/components/date-period/question.js +1 -2
- package/{types/src → src}/components/date-time/question.d.ts +10 -2
- package/src/components/date-time/question.d.ts.map +1 -0
- package/src/components/date-time/question.js +1 -2
- package/src/components/email/question.d.ts +23 -0
- package/src/components/email/question.d.ts.map +1 -0
- package/src/components/email/question.js +1 -9
- package/src/components/manage-list/manage-list-actions.d.ts.map +1 -0
- package/src/components/manage-list/manage-list-section.d.ts.map +1 -0
- package/{types/src → src}/components/manage-list/question.d.ts +10 -3
- package/src/components/manage-list/question.d.ts.map +1 -0
- package/src/components/manage-list/question.js +4 -1
- package/{types/src → src}/components/manage-list/utils.d.ts +3 -3
- package/src/components/manage-list/utils.d.ts.map +1 -0
- package/src/components/manage-list/utils.js +2 -2
- package/src/components/multi-field-input/question.d.ts +52 -0
- package/src/components/multi-field-input/question.d.ts.map +1 -0
- package/src/components/multi-field-input/question.js +5 -13
- package/{types/src → src}/components/number-entry/question.d.ts +7 -3
- package/src/components/number-entry/question.d.ts.map +1 -0
- package/src/components/number-entry/question.js +2 -2
- package/src/components/radio/question.d.ts +19 -0
- package/src/components/radio/question.d.ts.map +1 -0
- package/src/components/radio/question.js +1 -5
- package/{types/src → src}/components/select/question.d.ts +7 -3
- package/src/components/select/question.d.ts.map +1 -0
- package/src/components/select/question.js +2 -2
- package/src/components/single-line-input/question.d.ts +20 -0
- package/src/components/single-line-input/question.d.ts.map +1 -0
- package/src/components/single-line-input/question.js +1 -1
- package/{types/src → src}/components/text-entry/question.d.ts +7 -3
- package/src/components/text-entry/question.d.ts.map +1 -0
- package/src/components/text-entry/question.js +1 -1
- package/{types/src → src}/components/text-entry-redact/question.d.ts +12 -9
- package/src/components/text-entry-redact/question.d.ts.map +1 -0
- package/src/components/text-entry-redact/question.js +4 -1
- package/{types/src → src}/components/unit-option-entry/question.d.ts +12 -8
- package/src/components/unit-option-entry/question.d.ts.map +1 -0
- package/src/components/unit-option-entry/question.js +5 -6
- package/src/components/utils/component-types.d.ts.map +1 -0
- package/src/components/utils/persisted-number-answer.d.ts.map +1 -0
- package/src/components/utils/question-has-answer.d.ts.map +1 -0
- package/src/components/utils/question-utils.d.ts.map +1 -0
- package/{types/src → src}/controller.d.ts +2 -7
- package/src/controller.d.ts.map +1 -0
- package/src/controller.js +3 -10
- package/{types/src → src}/index.d.ts +4 -3
- package/src/index.d.ts.map +1 -0
- package/src/index.js +6 -4
- package/src/journey/journey-response.d.ts +28 -0
- package/src/journey/journey-response.d.ts.map +1 -0
- package/src/journey/journey-response.js +4 -8
- package/{types/src → src}/journey/journey.d.ts +8 -8
- package/src/journey/journey.d.ts.map +1 -0
- package/src/journey/journey.js +6 -6
- package/src/lib/address-utils.d.ts.map +1 -0
- package/src/lib/address.d.ts.map +1 -0
- package/src/lib/date-utils.d.ts.map +1 -0
- package/src/lib/session-answer-store.d.ts.map +1 -0
- package/src/lib/utils.d.ts.map +1 -0
- package/src/lib/uuid.d.ts.map +1 -0
- package/src/middleware/build-get-journey.d.ts.map +1 -0
- package/src/middleware/redirect-to-unanswered-question.d.ts +12 -0
- package/src/middleware/redirect-to-unanswered-question.d.ts.map +1 -0
- package/src/middleware/redirect-to-unanswered-question.js +1 -1
- package/src/questions/create-questions.d.ts +18 -0
- package/src/questions/create-questions.d.ts.map +1 -0
- package/src/questions/create-questions.js +3 -3
- package/{types/src → src}/questions/options-question.d.ts +7 -7
- package/src/questions/options-question.d.ts.map +1 -0
- package/src/questions/options-question.js +4 -4
- package/{types/src → src}/questions/question.d.ts +33 -79
- package/src/questions/question.d.ts.map +1 -0
- package/src/questions/question.js +19 -51
- package/src/questions/questions.d.ts +3 -0
- package/src/questions/questions.d.ts.map +1 -0
- package/src/questions/questions.js +1 -1
- package/{types/src → src}/section.d.ts +16 -15
- package/src/section.d.ts.map +1 -0
- package/src/section.js +12 -14
- package/src/validator/address-validator.d.ts.map +1 -0
- package/src/validator/base-validator.d.ts.map +1 -0
- package/src/validator/conditional-required-validator.d.ts.map +1 -0
- package/src/validator/confirmation-checkbox-validator.d.ts.map +1 -0
- package/src/validator/coordinates-validator.d.ts.map +1 -0
- package/src/validator/cross-question-validator.d.ts.map +1 -0
- package/src/validator/date-period-validator.d.ts.map +1 -0
- package/src/validator/date-time-validator.d.ts.map +1 -0
- package/src/validator/date-validator.d.ts.map +1 -0
- package/src/validator/document-upload-validator.d.ts.map +1 -0
- package/src/validator/email-validator.d.ts.map +1 -0
- package/{types/src → src}/validator/multi-field-input-validator.d.ts +3 -3
- package/src/validator/multi-field-input-validator.d.ts.map +1 -0
- package/src/validator/multi-field-input-validator.js +3 -3
- package/{types/src → src}/validator/numeric-validator.d.ts +2 -2
- package/src/validator/numeric-validator.d.ts.map +1 -0
- package/src/validator/numeric-validator.js +2 -2
- package/src/validator/required-validator.d.ts.map +1 -0
- package/src/validator/same-answer-validator.d.ts.map +1 -0
- package/{types/src → src}/validator/string-validator.d.ts +3 -3
- package/src/validator/string-validator.d.ts.map +1 -0
- package/src/validator/string-validator.js +3 -3
- package/src/validator/unit-option-entry-validator.d.ts.map +1 -0
- package/src/validator/valid-option-validator.d.ts.map +1 -0
- package/src/validator/validation-error-handler.d.ts.map +1 -0
- package/src/validator/validator.d.ts.map +1 -0
- package/test/questions.js +1 -1
- package/test/secondary-actions.test.js +1 -1
- package/tsconfig.json +11 -4
- package/{types/src/questions → typedefs}/question-props.d.ts +28 -26
- package/{src/questions → typedefs}/question-types.d.ts +44 -16
- package/{src → typedefs}/section-types.d.ts +1 -1
- package/typedefs/section-types.js +1 -0
- package/move-types.js +0 -12
- package/src/questions/question-props.d.ts +0 -295
- package/types/commitlint.config.d.ts +0 -7
- package/types/commitlint.config.d.ts.map +0 -1
- package/types/eslint.config.d.ts +0 -97
- package/types/eslint.config.d.ts.map +0 -1
- package/types/move-types.d.ts +0 -2
- package/types/move-types.d.ts.map +0 -1
- package/types/src/components/address/question.d.ts.map +0 -1
- package/types/src/components/boolean/question.d.ts.map +0 -1
- package/types/src/components/checkbox/question.d.ts +0 -33
- package/types/src/components/checkbox/question.d.ts.map +0 -1
- package/types/src/components/date/question.d.ts.map +0 -1
- package/types/src/components/date-period/question.d.ts.map +0 -1
- package/types/src/components/date-time/question.d.ts.map +0 -1
- package/types/src/components/email/question.d.ts +0 -35
- package/types/src/components/email/question.d.ts.map +0 -1
- package/types/src/components/manage-list/manage-list-actions.d.ts.map +0 -1
- package/types/src/components/manage-list/manage-list-section.d.ts.map +0 -1
- package/types/src/components/manage-list/question.d.ts.map +0 -1
- package/types/src/components/manage-list/utils.d.ts.map +0 -1
- package/types/src/components/multi-field-input/question.d.ts +0 -64
- package/types/src/components/multi-field-input/question.d.ts.map +0 -1
- package/types/src/components/number-entry/question.d.ts.map +0 -1
- package/types/src/components/radio/question.d.ts +0 -23
- package/types/src/components/radio/question.d.ts.map +0 -1
- package/types/src/components/select/question.d.ts.map +0 -1
- package/types/src/components/single-line-input/question.d.ts +0 -16
- package/types/src/components/single-line-input/question.d.ts.map +0 -1
- package/types/src/components/text-entry/question.d.ts.map +0 -1
- package/types/src/components/text-entry-redact/question.d.ts.map +0 -1
- package/types/src/components/unit-option-entry/question.d.ts.map +0 -1
- package/types/src/components/utils/component-types.d.ts.map +0 -1
- package/types/src/components/utils/persisted-number-answer.d.ts.map +0 -1
- package/types/src/components/utils/question-has-answer.d.ts.map +0 -1
- package/types/src/components/utils/question-utils.d.ts.map +0 -1
- package/types/src/controller.d.ts.map +0 -1
- package/types/src/index.d.ts.map +0 -1
- package/types/src/journey/journey-response.d.ts +0 -32
- package/types/src/journey/journey-response.d.ts.map +0 -1
- package/types/src/journey/journey-types.d.ts +0 -28
- package/types/src/journey/journey-types.d.ts.map +0 -1
- package/types/src/journey/journey.d.ts.map +0 -1
- package/types/src/lib/address-utils.d.ts.map +0 -1
- package/types/src/lib/address.d.ts.map +0 -1
- package/types/src/lib/date-utils.d.ts.map +0 -1
- package/types/src/lib/session-answer-store.d.ts.map +0 -1
- package/types/src/lib/utils.d.ts.map +0 -1
- package/types/src/lib/uuid.d.ts.map +0 -1
- package/types/src/middleware/build-get-journey.d.ts.map +0 -1
- package/types/src/middleware/redirect-to-unanswered-question.d.ts +0 -12
- package/types/src/middleware/redirect-to-unanswered-question.d.ts.map +0 -1
- package/types/src/questions/create-questions.d.ts +0 -18
- package/types/src/questions/create-questions.d.ts.map +0 -1
- package/types/src/questions/options-question.d.ts.map +0 -1
- package/types/src/questions/question-props.d.ts.map +0 -1
- package/types/src/questions/question-types.d.ts +0 -86
- package/types/src/questions/question-types.d.ts.map +0 -1
- package/types/src/questions/question.d.ts.map +0 -1
- package/types/src/questions/questions.d.ts +0 -3
- package/types/src/questions/questions.d.ts.map +0 -1
- package/types/src/section.d.ts.map +0 -1
- package/types/src/validator/address-validator.d.ts.map +0 -1
- package/types/src/validator/base-validator.d.ts.map +0 -1
- package/types/src/validator/conditional-required-validator.d.ts.map +0 -1
- package/types/src/validator/confirmation-checkbox-validator.d.ts.map +0 -1
- package/types/src/validator/coordinates-validator.d.ts.map +0 -1
- package/types/src/validator/cross-question-validator.d.ts.map +0 -1
- package/types/src/validator/date-period-validator.d.ts.map +0 -1
- package/types/src/validator/date-time-validator.d.ts.map +0 -1
- package/types/src/validator/date-validator.d.ts.map +0 -1
- package/types/src/validator/document-upload-validator.d.ts.map +0 -1
- package/types/src/validator/email-validator.d.ts.map +0 -1
- package/types/src/validator/multi-field-input-validator.d.ts.map +0 -1
- package/types/src/validator/numeric-validator.d.ts.map +0 -1
- package/types/src/validator/required-validator.d.ts.map +0 -1
- package/types/src/validator/same-answer-validator.d.ts.map +0 -1
- package/types/src/validator/string-validator.d.ts.map +0 -1
- package/types/src/validator/unit-option-entry-validator.d.ts.map +0 -1
- package/types/src/validator/valid-option-validator.d.ts.map +0 -1
- package/types/src/validator/validation-error-handler.d.ts.map +0 -1
- package/types/src/validator/validator.d.ts.map +0 -1
- /package/{types/src → src}/components/manage-list/manage-list-actions.d.ts +0 -0
- /package/{types/src → src}/components/manage-list/manage-list-section.d.ts +0 -0
- /package/{types/src → src}/components/utils/component-types.d.ts +0 -0
- /package/{types/src → src}/components/utils/persisted-number-answer.d.ts +0 -0
- /package/{types/src → src}/components/utils/question-has-answer.d.ts +0 -0
- /package/{types/src → src}/components/utils/question-utils.d.ts +0 -0
- /package/{types/src → src}/lib/address-utils.d.ts +0 -0
- /package/{types/src → src}/lib/address.d.ts +0 -0
- /package/{types/src → src}/lib/date-utils.d.ts +0 -0
- /package/{types/src → src}/lib/session-answer-store.d.ts +0 -0
- /package/{types/src → src}/lib/utils.d.ts +0 -0
- /package/{types/src → src}/lib/uuid.d.ts +0 -0
- /package/{types/src → src}/middleware/build-get-journey.d.ts +0 -0
- /package/{types/src → src}/validator/address-validator.d.ts +0 -0
- /package/{types/src → src}/validator/base-validator.d.ts +0 -0
- /package/{types/src → src}/validator/conditional-required-validator.d.ts +0 -0
- /package/{types/src → src}/validator/confirmation-checkbox-validator.d.ts +0 -0
- /package/{types/src → src}/validator/coordinates-validator.d.ts +0 -0
- /package/{types/src → src}/validator/cross-question-validator.d.ts +0 -0
- /package/{types/src → src}/validator/date-period-validator.d.ts +0 -0
- /package/{types/src → src}/validator/date-time-validator.d.ts +0 -0
- /package/{types/src → src}/validator/date-validator.d.ts +0 -0
- /package/{types/src → src}/validator/document-upload-validator.d.ts +0 -0
- /package/{types/src → src}/validator/email-validator.d.ts +0 -0
- /package/{types/src → src}/validator/required-validator.d.ts +0 -0
- /package/{types/src → src}/validator/same-answer-validator.d.ts +0 -0
- /package/{types/src → src}/validator/unit-option-entry-validator.d.ts +0 -0
- /package/{types/src → src}/validator/valid-option-validator.d.ts +0 -0
- /package/{types/src → src}/validator/validation-error-handler.d.ts +0 -0
- /package/{types/src → src}/validator/validator.d.ts +0 -0
- /package/{src/journey → typedefs}/journey-types.d.ts +0 -0
- /package/{src/journey → typedefs}/journey-types.js +0 -0
- /package/{src/questions → typedefs}/question-props.js +0 -0
- /package/{src/questions → typedefs}/question-types.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["questions.js"],"names":[],"mappings":"AAsBA,+DAA+D;AAC/D,8BADW,MAAM,CAAC,MAAM,EAAE,OAAO,eAAe,EAAE,QAAQ,CAAC,CAkBxD"}
|
|
@@ -20,7 +20,7 @@ import ManageListQuestion from '../components/manage-list/question.js';
|
|
|
20
20
|
// This looks a bit grim because so few of our
|
|
21
21
|
// Questions overlap with Question correctly.
|
|
22
22
|
// Maybe something to fix at some point
|
|
23
|
-
/** @type {Record<string, import('./question').Question>} */
|
|
23
|
+
/** @type {Record<string, import('./question.js').Question>} */
|
|
24
24
|
export const questionClasses = Object.freeze({
|
|
25
25
|
[COMPONENT_TYPES.ADDRESS]: AddressQuestion,
|
|
26
26
|
[COMPONENT_TYPES.CHECKBOX]: CheckboxQuestion,
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {((response: import('#journey-response').JourneyResponse) => boolean)} QuestionCondition
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* A value indicating the final question of a section has been reached
|
|
3
6
|
*
|
|
@@ -12,10 +15,10 @@ export class Section {
|
|
|
12
15
|
/**
|
|
13
16
|
* Implementation of getNextQuestion given a list of questions
|
|
14
17
|
*
|
|
15
|
-
* @param {import('
|
|
16
|
-
* @returns {Question|Symbol|null}
|
|
18
|
+
* @param {import('#typedefs/section-types.d.ts').StaticGetNextQuestionParams} params
|
|
19
|
+
* @returns {import('./questions/question.js').Question|Symbol|null}
|
|
17
20
|
*/
|
|
18
|
-
static getNextQuestion({ questions, questionFieldName, response, takeNextQuestion, reverse }: import("
|
|
21
|
+
static getNextQuestion({ questions, questionFieldName, response, takeNextQuestion, reverse }: import("#typedefs/section-types.d.ts").StaticGetNextQuestionParams): import("./questions/question.js").Question | Symbol | null;
|
|
19
22
|
/**
|
|
20
23
|
* creates an instance of a section
|
|
21
24
|
* @param {string} name
|
|
@@ -31,9 +34,9 @@ export class Section {
|
|
|
31
34
|
*/
|
|
32
35
|
segment: string;
|
|
33
36
|
/**
|
|
34
|
-
* @type {Array<Question>} - questions within the section
|
|
37
|
+
* @type {Array<import('./questions/question.js').Question>} - questions within the section
|
|
35
38
|
*/
|
|
36
|
-
questions: Array<Question>;
|
|
39
|
+
questions: Array<import("./questions/question.js").Question>;
|
|
37
40
|
/**
|
|
38
41
|
* Add a condition to all questions in this section
|
|
39
42
|
*
|
|
@@ -70,22 +73,22 @@ export class Section {
|
|
|
70
73
|
endMultiQuestionCondition(conditionName: string): this;
|
|
71
74
|
/**
|
|
72
75
|
* Get the next question in this section given a questionParam (question fieldName)
|
|
73
|
-
* @param {import('
|
|
74
|
-
* @returns {Question|Symbol|null}
|
|
76
|
+
* @param {import('#typedefs/section-types.d.ts').GetNextQuestionParams} params
|
|
77
|
+
* @returns {import('./questions/question.js').Question|Symbol|null}
|
|
75
78
|
*/
|
|
76
|
-
getNextQuestion(params: import("
|
|
79
|
+
getNextQuestion(params: import("#typedefs/section-types.d.ts").GetNextQuestionParams): import("./questions/question.js").Question | Symbol | null;
|
|
77
80
|
/**
|
|
78
81
|
* checks answers on response to ensure that a answer is provided for each required question in the section
|
|
79
|
-
* @param {JourneyResponse} journeyResponse
|
|
82
|
+
* @param {import('#journey-response').JourneyResponse} journeyResponse
|
|
80
83
|
* @returns {SectionStatus}
|
|
81
84
|
*/
|
|
82
|
-
getStatus(journeyResponse: JourneyResponse): SectionStatus;
|
|
85
|
+
getStatus(journeyResponse: import("#journey-response").JourneyResponse): SectionStatus;
|
|
83
86
|
/**
|
|
84
87
|
* checks answers on response and return true if the status of the section is complete
|
|
85
|
-
* @param {JourneyResponse} journeyResponse
|
|
88
|
+
* @param {import('#journey-response').JourneyResponse} journeyResponse
|
|
86
89
|
* @returns {boolean}
|
|
87
90
|
*/
|
|
88
|
-
isComplete(journeyResponse: JourneyResponse): boolean;
|
|
91
|
+
isComplete(journeyResponse: import("#journey-response").JourneyResponse): boolean;
|
|
89
92
|
#private;
|
|
90
93
|
}
|
|
91
94
|
export type SECTION_STATUS = SectionStatus;
|
|
@@ -100,8 +103,6 @@ export const SECTION_STATUS: Readonly<{
|
|
|
100
103
|
IN_PROGRESS: "In progress";
|
|
101
104
|
COMPLETE: "Completed";
|
|
102
105
|
}>;
|
|
103
|
-
export type
|
|
104
|
-
export type JourneyResponse = any;
|
|
105
|
-
export type QuestionCondition = ((response: JourneyResponse) => boolean);
|
|
106
|
+
export type QuestionCondition = ((response: import("#journey-response").JourneyResponse) => boolean);
|
|
106
107
|
export type SectionStatus = string;
|
|
107
108
|
//# sourceMappingURL=section.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section.d.ts","sourceRoot":"","sources":["section.js"],"names":[],"mappings":"AAGA;;GAEG;AAEH;;;;GAIG;AACH,6BAFU,MAAM,CAEuC;AAEvD;;;GAGG;AACH;IAgNC;;;;;OAKG;IACH,8FAHW,OAAO,8BAA8B,EAAE,2BAA2B,GAChE,OAAO,yBAAyB,EAAE,QAAQ,GAAC,MAAM,GAAC,IAAI,CAoBlE;IAvMD;;;;OAIG;IACH,kBAHW,MAAM,WACN,MAAM,EAKhB;IAxCD;;OAEG;IACH,MAFU,MAAM,CAEX;IAEL;;OAEG;IACH,SAFU,MAAM,CAER;IAER;;OAEG;IACH,WAFU,KAAK,CAAC,OAAO,yBAAyB,EAAE,QAAQ,CAAC,CAE5C;IA6Bf;;;;;OAKG;IACH,2CAHW,iBAAiB,GACf,IAAI,CAchB;IAED;;;;;OAKG;IACH,sBAJW,OAAO,yBAAyB,EAAE,QAAQ,sBAC1C,OAAO,iDAAiD,EAAE,iBAAiB,GACzE,IAAI,CAgBhB;IA8BD;;;;OAIG;IACH,qCAHW,iBAAiB,GACf,IAAI,CAahB;IAED,kFAoBC;IAED;;;;;OAKG;IACH,2CAJW,MAAM,yBACN,iBAAiB,GACf,IAAI,CAQhB;IAED;;;;OAIG;IACH,yCAHW,MAAM,GACJ,IAAI,CAQhB;IAED;;;;OAIG;IACH,wBAHW,OAAO,8BAA8B,EAAE,qBAAqB,GAC1D,OAAO,yBAAyB,EAAE,QAAQ,GAAC,MAAM,GAAC,IAAI,CAuBlE;IA4BD;;;;OAIG;IACH,2BAHW,OAAO,mBAAmB,EAAE,eAAe,GACzC,aAAa,CAoDzB;IAED;;;;OAIG;IACH,4BAHW,OAAO,mBAAmB,EAAE,eAAe,GACzC,OAAO,CAInB;;CAKD;6BAOS,aAAa;AALvB;;GAEG;AAEH;;GAEG;AACH;;;;GAIG;gCA1UU,CAAC,CAAC,QAAQ,EAAE,OAAO,mBAAmB,EAAE,eAAe,KAAK,OAAO,CAAC;4BAgUpE,MAAM"}
|
package/src/section.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {import('./questions/question').Question} Question
|
|
3
|
-
* @typedef {import('./journey/journey-response').JourneyResponse} JourneyResponse
|
|
4
|
-
* @typedef {((response: JourneyResponse) => boolean)} QuestionCondition
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
import RequiredValidator from './validator/required-validator.js';
|
|
8
2
|
import { answerObjectForManageList } from '#src/components/manage-list/utils.js';
|
|
9
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {((response: import('#journey-response').JourneyResponse) => boolean)} QuestionCondition
|
|
6
|
+
*/
|
|
7
|
+
|
|
10
8
|
/**
|
|
11
9
|
* A value indicating the final question of a section has been reached
|
|
12
10
|
*
|
|
@@ -30,7 +28,7 @@ export class Section {
|
|
|
30
28
|
segment;
|
|
31
29
|
|
|
32
30
|
/**
|
|
33
|
-
* @type {Array<Question>} - questions within the section
|
|
31
|
+
* @type {Array<import('./questions/question.js').Question>} - questions within the section
|
|
34
32
|
*/
|
|
35
33
|
questions = [];
|
|
36
34
|
|
|
@@ -105,7 +103,7 @@ export class Section {
|
|
|
105
103
|
|
|
106
104
|
/**
|
|
107
105
|
* Apply conditions to the given question
|
|
108
|
-
* @param {
|
|
106
|
+
* @param {import('./questions/question.js').Question} question
|
|
109
107
|
* @param [condition] - specific condition for this question
|
|
110
108
|
*/
|
|
111
109
|
#applyConditions(question, condition) {
|
|
@@ -200,8 +198,8 @@ export class Section {
|
|
|
200
198
|
|
|
201
199
|
/**
|
|
202
200
|
* Get the next question in this section given a questionParam (question fieldName)
|
|
203
|
-
* @param {import('
|
|
204
|
-
* @returns {Question|Symbol|null}
|
|
201
|
+
* @param {import('#typedefs/section-types.d.ts').GetNextQuestionParams} params
|
|
202
|
+
* @returns {import('./questions/question.js').Question|Symbol|null}
|
|
205
203
|
*/
|
|
206
204
|
getNextQuestion(params) {
|
|
207
205
|
const { response, manageListQuestion, routeParams } = params;
|
|
@@ -229,8 +227,8 @@ export class Section {
|
|
|
229
227
|
/**
|
|
230
228
|
* Implementation of getNextQuestion given a list of questions
|
|
231
229
|
*
|
|
232
|
-
* @param {import('
|
|
233
|
-
* @returns {Question|Symbol|null}
|
|
230
|
+
* @param {import('#typedefs/section-types.d.ts').StaticGetNextQuestionParams} params
|
|
231
|
+
* @returns {import('./questions/question.js').Question|Symbol|null}
|
|
234
232
|
*/
|
|
235
233
|
static getNextQuestion({ questions, questionFieldName, response, takeNextQuestion = false, reverse = false }) {
|
|
236
234
|
const numberOfQuestions = questions.length;
|
|
@@ -254,7 +252,7 @@ export class Section {
|
|
|
254
252
|
|
|
255
253
|
/**
|
|
256
254
|
* checks answers on response to ensure that a answer is provided for each required question in the section
|
|
257
|
-
* @param {JourneyResponse} journeyResponse
|
|
255
|
+
* @param {import('#journey-response').JourneyResponse} journeyResponse
|
|
258
256
|
* @returns {SectionStatus}
|
|
259
257
|
*/
|
|
260
258
|
getStatus(journeyResponse) {
|
|
@@ -311,7 +309,7 @@ export class Section {
|
|
|
311
309
|
|
|
312
310
|
/**
|
|
313
311
|
* checks answers on response and return true if the status of the section is complete
|
|
314
|
-
* @param {JourneyResponse} journeyResponse
|
|
312
|
+
* @param {import('#journey-response').JourneyResponse} journeyResponse
|
|
315
313
|
* @returns {boolean}
|
|
316
314
|
*/
|
|
317
315
|
isComplete(journeyResponse) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-validator.d.ts","sourceRoot":"","sources":["address-validator.js"],"names":[],"mappings":"AAIO,4EAQN;AAGD,oCAAqC,GAAG,CAAC;AACzC,oCAAqC,CAAC,CAAC;AACvC,oCAAqC,GAAG,CAAC;AACzC,oCAAqC,CAAC,CAAC;AACvC,gCAAiC,GAAG,CAAC;AACrC,gCAAiC,CAAC,CAAC;AACnC,8BAA+B,GAAG,CAAC;AACnC,8BAA+B,CAAC,CAAC;AACjC,gCAAiC,CAAC,CAAC;AACnC,gCAAiC,CAAC,CAAC;AAEnC;;;GAGG;AACH;IACC;;;;OAIG;IACH,mBAFG;QAAqH,cAAc;0BAA5G,OAAO;0BAAgB,OAAO;sBAAY,OAAO;oBAAU,OAAO;sBAAY,OAAO;;KAAwB,EAKtI;IADA;sBAJyB,OAAO;sBAAgB,OAAO;kBAAY,OAAO;gBAAU,OAAO;kBAAY,OAAO;kBAIpE;IAG3C;;;OAGG;IACH,sBAFW,OAAO,0BAA0B,EAAE,QAAQ,iDAYrD;;CAqGD;;0BA1JyB,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-validator.d.ts","sourceRoot":"","sources":["base-validator.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;IACC;;OAEG;IACH,cAFU,MAAM,CAEH;IAQb;;;;;;;OAOG;IAEH,sBALW;QAAC,SAAS,EAAE,MAAM,CAAA;KAAC,oBACnB,OAAO,gCAAgC,EAAE,eAAe,GACtD,OAAO,mBAAmB,EAAE,eAAe,GAAG,OAAO,mBAAmB,EAAE,eAAe,EAAE,CAKvG;IAED;;;;;OAKG;IACH,sBAEC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional-required-validator.d.ts","sourceRoot":"","sources":["conditional-required-validator.js"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;;GAGG;AACH;IAMC;;;OAGG;IACH,2BAFW,MAAM,EAQhB;IAED;;;OAGG;IACH,sBAFW,OAAO,kCAAkC,EAAE,eAAe,WAcpE;IAED,+DAEC;IAED,2FAKC;CACD;;;0BAzDyB,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation-checkbox-validator.d.ts","sourceRoot":"","sources":["confirmation-checkbox-validator.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;GAGG;AACH;IAMC;;;;;OAKG;IACH,4CAHG;QAAuB,YAAY,EAA3B,MAAM;QACS,YAAY,EAA3B,MAAM;KAChB,EAMA;IAFA,qBAAgC;IAIjC;;OAEG;IACH,wDAEC;CACD;;;0BAnCyB,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinates-validator.d.ts","sourceRoot":"","sources":["coordinates-validator.js"],"names":[],"mappings":"AAGA,uCAAwC,CAAC,CAAC;AAE1C;;;;GAIG;AACH;IACC;;;OAGG;IACH,sBAHW,eAAe,WACf,eAAe,EAMzB;IAFA,0BAAwB;IACxB,yBAAsB;IAGvB,0DAkCC;CACD;;;WAjDa,MAAM;eACN,MAAM;;0BARM,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cross-question-validator.d.ts","sourceRoot":"","sources":["cross-question-validator.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IAUC;;;;;;;;OAQG;IACH,kGAPG;QAAuB,mBAAmB,EAAlC,MAAM;QACyE,kBAAkB,EAAjG,CAAC,CAAC,aAAa,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,KAAK,OAAO,CAAC,GAAE,IAAI;QACrD,aAAa;QACb,uBAAuB;KAChD,EAsBF;IArCD,qBAAqB;IACrB,qBADW,MAAM,CACG;IACpB,+EAA+E;IAC/E,oBADW,CAAC,CAAC,aAAa,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,KAAK,OAAO,CAAC,CACxD;IACnB,sBAAsB;IACtB,eADW,OAAO,CACJ;IACd,sBAAsB;IACtB,yBADW,OAAO,CACM;IA8CxB;;;;;;;OAOG;IACH,sBAJW,OAAO,0BAA0B,EAAE,QAAQ,oBAC3C,OAAO,gCAAgC,EAAE,eAAe,GACtD,OAAO,mBAAmB,EAAE,eAAe,EAAE,CAuCzD;;CACD;;0BA1GyB,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-period-validator.d.ts","sourceRoot":"","sources":["date-period-validator.js"],"names":[],"mappings":"AAQA;;;;GAIG;AAEH;;;GAGG;AACH;IAIC;;;;;OAKG;IACH,wBAJW,MAAM,2BACN,sBAAsB,kBACtB,MAAM,EAgChB;IAvCD,qCAAqC;IACrC,wBADW,sBAAsB,CACV;IAoBtB,uBAAmG;IACnG,uBAAmG;IACnG,yBAAyG;IACzG,wBAAsG;IACtG,4BAAkH;IAClH,2BAA+G;IAC/G,6BACuF;IACvF,6BACuF;IACvF,8BACyF;IACzF,6BACuF;IACvF,4BAAkH;IAClH,0BAA4G;IAK7G;;;OAGG;IACH,sBAFW,OAAO,gCAAgC,EAAE,YAAY,iDAsB/D;IAED;;;;sDAuCC;IAED;;;;sDAwBC;IAED;;;;sDAuBC;;CA6BD;;;;;;0BAxMyB,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-time-validator.d.ts","sourceRoot":"","sources":["date-time-validator.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH;IACC;;;;;;OAMG;IACH,4BALW,MAAM,mBACN,MAAM,2BACN,sBAAsB,sBACtB,MAAM,EAahB;IADA,uBAAoC;IAGrC;;;OAGG;IACH,sBAFW,OAAO,qCAAqC,EAAE,gBAAgB,iDAsCxE;CACD;;0BApEyB,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-validator.d.ts","sourceRoot":"","sources":["date-validator.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AAEH;;;GAGG;AACH;IAIC;;;;;OAKG;IACH,wBAJW,MAAM,2BACN,sBAAsB,kBACtB,MAAM,EAiChB;IAxCD,qCAAqC;IACrC,wBADW,sBAAsB,CACV;IAqBtB,uBAAmG;IACnG,uBAAmG;IACnG,yBAAyG;IACzG,wBAAsG;IACtG,4BAAkH;IAClH,2BAA+G;IAC/G,6BACuF;IACvF,6BACuF;IACvF,8BACyF;IACzF,6BACuF;IACvF,4BAAkH;IAClH,0BAA4G;IAS7G;;;OAGG;IACH,sBAFW,OAAO,gCAAgC,EAAE,YAAY,iDA0H/D;;CA6BD;;;;;;;0BAtNyB,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-upload-validator.d.ts","sourceRoot":"","sources":["document-upload-validator.js"],"names":[],"mappings":"AAGA;IACC;;;OAGG;IACH,uBAHW,MAAM,iBACN,MAAM,EAMhB;IAFA,kBAA0B;IAI3B,0DAYC;CACD;;0BA3ByB,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-validator.d.ts","sourceRoot":"","sources":["email-validator.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH;IACC;;;;;OAKG;IACH,mDAJG;QAAwC,OAAO;QACvB,YAAY;QACZ,SAAS;KACnC,EAcA;IAVA;;;;;;;;;;;;;;;;;;;;;;;;;MAMC;IAGD,8BAA0B;IAG3B,wEAIC;CACD;;;;;;;;;;;;;;;;;;;;;;;;0BAtCyB,qBAAqB"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {Object} Regex
|
|
3
3
|
* @property {String | RegExp} regex
|
|
4
|
-
* @property {
|
|
4
|
+
* @property {string} regexMessage
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {Object} MinLength
|
|
8
8
|
* @property {Number} minLength
|
|
9
|
-
* @property {
|
|
9
|
+
* @property {string} minLengthMessage
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
12
|
* @typedef {Object} MaxLength
|
|
13
13
|
* @property {Number} maxLength
|
|
14
|
-
* @property {
|
|
14
|
+
* @property {string} maxLengthMessage
|
|
15
15
|
*/
|
|
16
16
|
/**
|
|
17
17
|
* @typedef {Object} FieldBase
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-field-input-validator.d.ts","sourceRoot":"","sources":["multi-field-input-validator.js"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;GAEG;AAEH;IACC;;;;OAIG;IACH,0CAHG;QAAyB,MAAM;QACP,eAAe;KAAC,EAQ1C;IAFA,gBAAoB;IACpB,wBAAwE;IAGzE;;OAEG;IAEH,0DA8BC;IAKD;;;;OAIG;IACH,gCAHW,MAAM,GACJ,OAAO,CAQnB;CACD;;;WA3Ga,SAAS,MAAM;kBACf,MAAM;;;;sBAMN,MAAM;;;;sBAMN,MAAM;;;eAKN,MAAM;;;;;4BAOP,SAAS,GAAG;IACpB,QAAQ,EAAE,IAAI,CAAC;IACf,YAAY,EAAE,MAAM,CAAA;CACrB;4BAIS,SAAS,GAAG;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;oBAIS,aAAa,GAAG,aAAa;0BA1ChB,qBAAqB"}
|
|
@@ -4,19 +4,19 @@ import BaseValidator from './base-validator.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* @typedef {Object} Regex
|
|
6
6
|
* @property {String | RegExp} regex
|
|
7
|
-
* @property {
|
|
7
|
+
* @property {string} regexMessage
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @typedef {Object} MinLength
|
|
12
12
|
* @property {Number} minLength
|
|
13
|
-
* @property {
|
|
13
|
+
* @property {string} minLengthMessage
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @typedef {Object} MaxLength
|
|
18
18
|
* @property {Number} maxLength
|
|
19
|
-
* @property {
|
|
19
|
+
* @property {string} maxLengthMessage
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {Object} MinValue
|
|
3
3
|
* @property {Number} min
|
|
4
|
-
* @property {
|
|
4
|
+
* @property {string} minMessage
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {Object} MaxValue
|
|
8
8
|
* @property {Number} max
|
|
9
|
-
* @property {
|
|
9
|
+
* @property {string} maxMessage
|
|
10
10
|
*/
|
|
11
11
|
export class NumericValidator extends BaseValidator {
|
|
12
12
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numeric-validator.d.ts","sourceRoot":"","sources":["numeric-validator.js"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH;;;;GAIG;AAEH;IACC;;;;;;;;;OASG;IACH,mFARG;QAAwB,GAAG;QACH,UAAU;QACV,GAAG;QACH,UAAU;QACV,KAAK;QACL,YAAY;QACZ,SAAS;KAAC,EAWpC;IAPA,wBAAc;IACd,mBAAmE;IACnE,wBAAc;IACd,mBAAkE;IAClE,0BAAkB;IAClB,qBAA0D;IAC1D,8BAA0B;IAG3B,wEAgBC;CACD;;;;gBAhDa,MAAM;;;;gBAMN,MAAM;;0BAXM,qBAAqB"}
|
|
@@ -5,13 +5,13 @@ import BaseValidator from './base-validator.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {Object} MinValue
|
|
7
7
|
* @property {Number} min
|
|
8
|
-
* @property {
|
|
8
|
+
* @property {string} minMessage
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @typedef {Object} MaxValue
|
|
13
13
|
* @property {Number} max
|
|
14
|
-
* @property {
|
|
14
|
+
* @property {string} maxMessage
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
export class NumericValidator extends BaseValidator {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"required-validator.d.ts","sourceRoot":"","sources":["required-validator.js"],"names":[],"mappings":"AAIA;;;GAGG;AACH;IAMC;;;OAGG;IACH,2BAFW,MAAM,EAQhB;IAED;;;OAGG;IACH,sBAFW,OAAO,0BAA0B,EAAE,QAAQ,+CAIrD;CAKD;;0BAnCyB,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"same-answer-validator.d.ts","sourceRoot":"","sources":["same-answer-validator.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IACC;;;OAGG;IAEH,iCAJW,MAAM,EAAE,iBACR,MAAM,EAOhB;IAFA,8BAAoD;IAIrD;;;OAGG;IACH,wEAQC;CACD;;0BA9ByB,qBAAqB"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {Object} MinLength
|
|
3
3
|
* @property {Number} minLength
|
|
4
|
-
* @property {
|
|
4
|
+
* @property {string} [minLengthMessage]
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {Object} MaxLength
|
|
8
8
|
* @property {Number} maxLength
|
|
9
|
-
* @property {
|
|
9
|
+
* @property {string} [maxLengthMessage]
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
12
|
* @typedef {Object} Regex
|
|
13
13
|
* @property {String | RegExp} regex
|
|
14
|
-
* @property {
|
|
14
|
+
* @property {string} [regexMessage]
|
|
15
15
|
*/
|
|
16
16
|
export class StringValidator extends BaseValidator {
|
|
17
17
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-validator.d.ts","sourceRoot":"","sources":["string-validator.js"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;IAcC;;;;;;OAMG;IACH,yDALG;QAA2B,SAAS;QACT,SAAS;QACb,KAAK;QACJ,SAAS;KAAC,EAmBpC;IArCD;;;MAGE;IACF;;;MAGE;IACF;;;MAGE;IAyBD,8BAA0B;IAG3B,wEAkBC;CACD;;;;;;;;;;;WA/Da,SAAS,MAAM;;;0BAfH,qBAAqB"}
|
|
@@ -4,19 +4,19 @@ import BaseValidator from './base-validator.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* @typedef {Object} MinLength
|
|
6
6
|
* @property {Number} minLength
|
|
7
|
-
* @property {
|
|
7
|
+
* @property {string} [minLengthMessage]
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @typedef {Object} MaxLength
|
|
12
12
|
* @property {Number} maxLength
|
|
13
|
-
* @property {
|
|
13
|
+
* @property {string} [maxLengthMessage]
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @typedef {Object} Regex
|
|
18
18
|
* @property {String | RegExp} regex
|
|
19
|
-
* @property {
|
|
19
|
+
* @property {string} [regexMessage]
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
export class StringValidator extends BaseValidator {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit-option-entry-validator.d.ts","sourceRoot":"","sources":["unit-option-entry-validator.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH;IACC;;;;;;;;OAQG;IAEH,oEARG;QAAwB,YAAY;QACZ,IAAI;QACJ,GAAG;QACH,GAAG;QACJ,KAAK;QACJ,YAAY;KAAC,EAWvC;IALA,aAA2B;IAC3B,wBAAc;IACd,wBAAc;IACd,WAAkB;IAClB,qBAA0D;IAG3D;;;OAGG;IACH,sBAFW,OAAO,6CAA6C,EAAE,uBAAuB,WA4CvF;IAED,2FAKC;CACD;;0BAlFyB,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valid-option-validator.d.ts","sourceRoot":"","sources":["valid-option-validator.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH;IACC;;;OAGG;IACH,2BAFW,MAAM,EAUhB;IAED;;;OAGG;IACH,sBAFW,OAAO,kCAAkC,EAAE,OAAO,+CAU5D;CACD;;0BAnCyB,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-error-handler.d.ts","sourceRoot":"","sources":["validation-error-handler.js"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH;;GAEG;AACH,sDAFU,cAAc,CAkBtB;AAQK,uDAJI,OAAO,mBAAmB,EAAE,aAAa,CAAC,OAAO,mBAAmB,EAAE,eAAe,CAAC,mBACtF,cAAc,GACZ,OAAO,SAAS,EAAE,OAAO,CA2BrC;AAED,+DAAoE;6BA3DvD;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,EAAE;;;;6BAE9B,CAAC,MAAM,EAAE,uBAAuB,KAAK,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["validator.js"],"names":[],"mappings":"AA4BA,oDACe,QAAG,EAAE,QAAG,EAAE,SAAI,kBAM5B;;AAjCD,wCAAwC;AACxC,wBADW,OAAO,SAAS,EAAE,OAAO,CAsBlC"}
|
package/test/questions.js
CHANGED
|
@@ -4,7 +4,7 @@ import { questionClasses } from '../src/questions/questions.js';
|
|
|
4
4
|
import EmailValidator from '../src/validator/email-validator.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @typedef {import('
|
|
7
|
+
* @typedef {import('#typedefs/question-props.d.ts').QuestionProps} Props
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/** @type {Record<string, Props>} */
|
|
@@ -10,7 +10,7 @@ import { mockRandomUUID } from '#test/mock/uuid.js';
|
|
|
10
10
|
import { createJourney as createTestJourney, JOURNEY_ID } from '#test/journey.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* @type {import('
|
|
13
|
+
* @type {import('#typedefs/question-types.d.ts').SecondaryAction[]}
|
|
14
14
|
*/
|
|
15
15
|
const testSecondaryActions = [
|
|
16
16
|
{
|
package/tsconfig.json
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"include": ["**/*.ts", "**/*.js"],
|
|
3
|
-
"exclude": [
|
|
3
|
+
"exclude": [
|
|
4
|
+
"node_modules",
|
|
5
|
+
"packages/database/src/client/**",
|
|
6
|
+
"**/*.test.ts",
|
|
7
|
+
"**/*.test.js",
|
|
8
|
+
"test/**",
|
|
9
|
+
"*.config.js",
|
|
10
|
+
"typedefs/**"
|
|
11
|
+
],
|
|
4
12
|
"compilerOptions": {
|
|
5
13
|
"allowImportingTsExtensions": true,
|
|
6
14
|
"allowJs": true,
|
|
@@ -14,13 +22,12 @@
|
|
|
14
22
|
"esModuleInterop": true,
|
|
15
23
|
"module": "NodeNext",
|
|
16
24
|
"moduleResolution": "nodenext",
|
|
17
|
-
"outDir": "types",
|
|
18
|
-
"rootDir": ".",
|
|
19
25
|
"strict": true,
|
|
20
26
|
"target": "esnext",
|
|
21
27
|
"skipLibCheck": true,
|
|
22
28
|
"paths": {
|
|
23
|
-
"#question-types": ["./
|
|
29
|
+
"#question-types": ["./typedefs/question-types.d.ts"],
|
|
30
|
+
"#typedefs/*": ["./typedefs/*"],
|
|
24
31
|
"#src/*": ["./src/*"],
|
|
25
32
|
"#test/*": ["./test/*"],
|
|
26
33
|
"#question": ["./src/questions/question.js"],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { QuestionParameters } from '
|
|
1
|
+
import type { QuestionParameters } from './question-types.d.ts';
|
|
2
2
|
|
|
3
|
-
type QuestionTypes =
|
|
3
|
+
export type QuestionTypes =
|
|
4
4
|
| 'boolean'
|
|
5
5
|
| 'checkbox'
|
|
6
6
|
| 'date'
|
|
@@ -26,7 +26,7 @@ export type CommonQuestionParams = Omit<QuestionParameters, 'viewFolder'>;
|
|
|
26
26
|
/**
|
|
27
27
|
* Full props including type for routing/factory layer
|
|
28
28
|
*/
|
|
29
|
-
type CommonQuestionProps = CommonQuestionParams & {
|
|
29
|
+
export type CommonQuestionProps = CommonQuestionParams & {
|
|
30
30
|
type: QuestionTypes;
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -37,29 +37,31 @@ export type BaseQuestionProps = CommonQuestionParams & {
|
|
|
37
37
|
type: string;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
type
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
40
|
+
export type SelectableOption = {
|
|
41
|
+
text: string;
|
|
42
|
+
value: string;
|
|
43
|
+
hint?: object;
|
|
44
|
+
checked?: boolean | undefined;
|
|
45
|
+
attributes?: Record<string, string>;
|
|
46
|
+
behaviour?: 'exclusive';
|
|
47
|
+
conditional?: {
|
|
48
|
+
question: string;
|
|
49
|
+
type: string;
|
|
50
|
+
fieldName: string;
|
|
51
|
+
inputClasses?: string;
|
|
52
|
+
html?: string;
|
|
53
|
+
value?: unknown;
|
|
54
|
+
label?: string;
|
|
55
|
+
hint?: string;
|
|
56
|
+
};
|
|
57
|
+
conditionalText?: {
|
|
58
|
+
html: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type DividerOption = { divider?: string };
|
|
63
|
+
|
|
64
|
+
export type Option = SelectableOption | DividerOption;
|
|
63
65
|
|
|
64
66
|
type Affix = {
|
|
65
67
|
text: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { RouteParams } from '
|
|
1
|
+
import type { RouteParams } from './journey-types.d.ts';
|
|
2
2
|
import type ManageListQuestion from '#src/components/manage-list/question.js';
|
|
3
|
-
import type BaseValidator from '
|
|
4
|
-
import type { JourneyResponse } from '
|
|
3
|
+
import type BaseValidator from '#src/validator/base-validator.js';
|
|
4
|
+
import type { JourneyResponse } from '#src/journey/journey-response.js';
|
|
5
5
|
|
|
6
6
|
export interface QuestionParameters {
|
|
7
7
|
title: string;
|
|
@@ -55,23 +55,33 @@ export interface SecondaryActionLink {
|
|
|
55
55
|
classes?: string;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
interface BaseQuestionViewData {
|
|
59
|
+
value: unknown;
|
|
60
|
+
question: string;
|
|
61
|
+
fieldName: string;
|
|
62
|
+
pageTitle: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
html?: string;
|
|
65
|
+
hint?: string;
|
|
66
|
+
interfaceType?: string;
|
|
67
|
+
autocomplete?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface QuestionViewModel<TQuestionViewData extends BaseQuestionViewData = BaseQuestionViewData> {
|
|
71
|
+
question: TQuestionViewData;
|
|
72
|
+
answer: unknown;
|
|
67
73
|
layoutTemplate: string;
|
|
68
|
-
pageCaption
|
|
74
|
+
pageCaption?: string;
|
|
69
75
|
continueButtonText: string;
|
|
70
|
-
backLink
|
|
71
|
-
showBackToListLink:
|
|
76
|
+
backLink?: string;
|
|
77
|
+
showBackToListLink: boolean;
|
|
72
78
|
listLink: string;
|
|
73
79
|
journeyTitle: string;
|
|
74
|
-
|
|
80
|
+
payload?: unknown;
|
|
81
|
+
util: {
|
|
82
|
+
trimTrailingSlash: (str: string) => string;
|
|
83
|
+
};
|
|
84
|
+
[key: string]: unknown;
|
|
75
85
|
}
|
|
76
86
|
|
|
77
87
|
export interface PrepQuestionForRenderingOptions {
|
|
@@ -84,3 +94,21 @@ export interface PrepQuestionForRenderingOptions {
|
|
|
84
94
|
* Question class and still pass them to the createQuestions function.
|
|
85
95
|
*/
|
|
86
96
|
export type QuestionClass<TQuestion extends Question = Question> = new (...args: never[]) => TQuestion;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Action link displayed in summary lists
|
|
100
|
+
*/
|
|
101
|
+
export interface ActionView {
|
|
102
|
+
href: string;
|
|
103
|
+
text: string;
|
|
104
|
+
visuallyHiddenText?: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* A row in a summary list, returned by formatAnswerForSummary
|
|
109
|
+
*/
|
|
110
|
+
export interface SummaryRow {
|
|
111
|
+
key: string;
|
|
112
|
+
value: string;
|
|
113
|
+
action?: ActionView | ActionView[];
|
|
114
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JourneyResponse } from '#src/journey/journey-response.js';
|
|
2
2
|
import ManageListQuestion from '#src/components/manage-list/question.js';
|
|
3
3
|
import { Question } from '#src/questions/question.js';
|
|
4
|
-
import { RouteParams } from '
|
|
4
|
+
import { RouteParams } from './journey-types.d.ts';
|
|
5
5
|
|
|
6
6
|
export interface GetNextQuestionParams {
|
|
7
7
|
questionFieldName: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// empty source file to go with .d.ts file
|
package/move-types.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { copyFile } from 'node:fs/promises';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
const filesToCopy = ['questions/question-props.d.ts', 'questions/question-types.d.ts', 'journey/journey-types.d.ts'];
|
|
5
|
-
|
|
6
|
-
// copy some of the type definition files to the types output that are not automatically included
|
|
7
|
-
for (const file of filesToCopy) {
|
|
8
|
-
const src = path.join(import.meta.dirname, 'src', file);
|
|
9
|
-
const dest = path.join(import.meta.dirname, 'types', 'src', file);
|
|
10
|
-
await copyFile(src, dest);
|
|
11
|
-
console.log(`Copied ${src} to ${dest}`);
|
|
12
|
-
}
|