@planning-inspectorate/dynamic-forms 3.15.5 → 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 +5 -4
- 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/{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/components/identifier/index.njk +0 -62
- package/src/components/identifier/question.js +0 -33
- package/src/components/identifier/question.test.js +0 -46
- 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/identifier/question.d.ts +0 -16
- package/types/src/components/identifier/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 -19
- 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 +0 -295
- 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
package/.gitattributes
CHANGED
package/.prettierrc
CHANGED
package/README.md
CHANGED
|
@@ -295,9 +295,17 @@ Commits must follow conventional commits, and the commit types will be used by s
|
|
|
295
295
|
The package will be released automatically using semantic-release, on merge to main. This will include a git tag for the release, and publishing to NPM.
|
|
296
296
|
|
|
297
297
|
### Type safety
|
|
298
|
-
We use JSDocs to describe the types used. This is helpful for the JavaScript developers, and *crucial* for this project being compatible with TypeScript. Type declarations for TypeScript users are auto-generated by `tsc`
|
|
299
|
-
|
|
300
|
-
|
|
298
|
+
We use JSDocs to describe the types used. This is helpful for the JavaScript developers, and *crucial* for this project being compatible with TypeScript. Type declarations for TypeScript users are auto-generated by `tsc` inline alongside the source files.
|
|
299
|
+
|
|
300
|
+
**Type definitions:**
|
|
301
|
+
- Shared type definitions should be placed in the `typedefs/` folder (e.g. `typedefs/question-types.d.ts`)
|
|
302
|
+
- New type definition files need a corresponding empty `.js` file, which needs to be exported from `index.js`, in order to be importable from the package root.
|
|
303
|
+
- Types can be imported using path aliases, e.g. `@param {import('#typedefs/question-types.d.ts').SummaryRow[]} rows`
|
|
304
|
+
|
|
305
|
+
**Best practices:**
|
|
306
|
+
1. Always use inline imports for JSDoc types, e.g. `@param {import('#section').Section} section`
|
|
307
|
+
2. Avoid top-level `@typedef` imports like `@typedef {import('../validator/base-validator.js')} BaseValidator` - these can create confusion when the compiler auto-generates declarations
|
|
308
|
+
3. Maintain `index.js` - if you're adding code that users of this module will import, ensure it is exported in `index.js`
|
|
301
309
|
|
|
302
310
|
Thank you for your co-operation and contributions!
|
|
303
311
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planning-inspectorate/dynamic-forms",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0",
|
|
4
4
|
"description": "This package is for building GDS forms using a configuration-based approach.",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"types": "./
|
|
7
|
+
"types": "./src/index.d.ts",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/Planning-Inspectorate/dynamic-forms.git"
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"lint": "npx eslint .",
|
|
18
18
|
"format": "prettier --write .",
|
|
19
19
|
"format-check": "prettier --check .",
|
|
20
|
-
"generate-types": "npx tsc --project tsconfig.json
|
|
20
|
+
"generate-types": "npx tsc --project tsconfig.json",
|
|
21
|
+
"reset-generated-types": "find . -name \"*.d.ts\" -not -path \"./typedefs/*\" -not -path \"./node_modules/*\" -delete && find . -name \"*.d.ts.map\" -not -path \"./node_modules/*\" -delete",
|
|
21
22
|
"prepare": "node .husky/install.mjs",
|
|
22
23
|
"test": "node --test",
|
|
23
24
|
"test-coverage": "node --test --experimental-test-coverage"
|
|
@@ -30,7 +31,8 @@
|
|
|
30
31
|
"nunjucks": "^3.2.4"
|
|
31
32
|
},
|
|
32
33
|
"imports": {
|
|
33
|
-
"#question-types": "./
|
|
34
|
+
"#question-types": "./typedefs/question-types.d.ts",
|
|
35
|
+
"#typedefs/*": "./typedefs/*",
|
|
34
36
|
"#test/*": "./test/*",
|
|
35
37
|
"#base-validator": "./src/validator/base-validator.js",
|
|
36
38
|
"#journey": "./src/journey/journey.js",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export class AddressQuestion extends Question {
|
|
2
2
|
/**
|
|
3
|
-
* @param {import('
|
|
3
|
+
* @param {import('#typedefs/question-props.d.ts').SiteAddressQuestionParams} params
|
|
4
4
|
*/
|
|
5
|
-
constructor(params: import("
|
|
5
|
+
constructor(params: import("#typedefs/question-props.d.ts").SiteAddressQuestionParams);
|
|
6
6
|
requiredFields: {
|
|
7
7
|
addressLine1: boolean;
|
|
8
8
|
addressLine2: boolean;
|
|
@@ -22,6 +22,10 @@ export class AddressQuestion extends Question {
|
|
|
22
22
|
* @returns {*|string}
|
|
23
23
|
*/
|
|
24
24
|
answerForViewModel(answers: Record<string, any>): any | string;
|
|
25
|
+
/**
|
|
26
|
+
* @param {import('#question').QuestionViewModel} viewModel
|
|
27
|
+
*/
|
|
28
|
+
addCustomDataToViewModel(viewModel: import("#question").QuestionViewModel): void;
|
|
25
29
|
/**
|
|
26
30
|
* @param {Object<string, any>} answer
|
|
27
31
|
* @returns The formatted address to be presented in the UI
|
|
@@ -29,6 +33,14 @@ export class AddressQuestion extends Question {
|
|
|
29
33
|
format(answer: {
|
|
30
34
|
[x: string]: any;
|
|
31
35
|
}): string;
|
|
36
|
+
/**
|
|
37
|
+
* returns the formatted answers values to be used to build task list elements
|
|
38
|
+
*/
|
|
39
|
+
formatAnswerForSummary(sectionSegment: any, journey: any, answer: any): {
|
|
40
|
+
key: string;
|
|
41
|
+
value: string;
|
|
42
|
+
action: import("../../index.js").ActionView | import("../../index.js").ActionView[] | undefined;
|
|
43
|
+
}[];
|
|
32
44
|
formatLabelFromRequiredFields(fieldName: any): "" | " (optional)";
|
|
33
45
|
}
|
|
34
46
|
export default AddressQuestion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["question.js"],"names":[],"mappings":"AAOA;IACC;;OAEG;IACH,oBAFW,OAAO,+BAA+B,EAAE,yBAAyB,EAqB3E;IAXE;;;;;;kBAA8C;IAIhD;;;;;;MAMC;IAiBF;;;OAGG;IACH,4BAHW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjB,GAAC,GAAC,MAAM,CAqBpB;IAED;;OAEG;IACH,oCAFW,OAAO,WAAW,EAAE,iBAAiB,QAI/C;IA8BD;;;OAGG;IACH;;eAUC;IAED;;OAEG;IACH;;;;QAgBC;IACD,kEAMC;CACD;;yBArJwB,WAAW"}
|
|
@@ -7,7 +7,7 @@ import AddressValidator from '../../validator/address-validator.js';
|
|
|
7
7
|
|
|
8
8
|
export class AddressQuestion extends Question {
|
|
9
9
|
/**
|
|
10
|
-
* @param {import('
|
|
10
|
+
* @param {import('#typedefs/question-props.d.ts').SiteAddressQuestionParams} params
|
|
11
11
|
*/
|
|
12
12
|
constructor(params) {
|
|
13
13
|
super({
|
|
@@ -122,7 +122,6 @@ export class AddressQuestion extends Question {
|
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* returns the formatted answers values to be used to build task list elements
|
|
125
|
-
* @type {Question['formatAnswerForSummary']}
|
|
126
125
|
*/
|
|
127
126
|
formatAnswerForSummary(sectionSegment, journey, answer) {
|
|
128
127
|
let formattedAnswer = this.notStartedText;
|
|
@@ -7,9 +7,9 @@ export function booleanToYesNoValue(value: any): "yes" | "no";
|
|
|
7
7
|
export function booleanToYesNoOrNull(value: boolean | null): string | null;
|
|
8
8
|
export class BooleanQuestion extends RadioQuestion {
|
|
9
9
|
/**
|
|
10
|
-
* @param {import('
|
|
10
|
+
* @param {import('#typedefs/question-props.d.ts').BooleanQuestionParams} params
|
|
11
11
|
*/
|
|
12
|
-
constructor({ title, question, fieldName, url, hint, pageTitle, description, html, validators, interfaceType, options, editable, viewData }: import("
|
|
12
|
+
constructor({ title, question, fieldName, url, hint, pageTitle, description, html, validators, interfaceType, options, editable, viewData }: import("#typedefs/question-props.d.ts").BooleanQuestionParams);
|
|
13
13
|
interfaceType: "checkbox" | "radio";
|
|
14
14
|
/**
|
|
15
15
|
* Get the data to save from the request, returns an object of answers
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["question.js"],"names":[],"mappings":"AAEA;;;GAGG;AAMI,sCAHI,MAAM,GAAC,GAAC,GACN,OAAO,CAOnB;AAEM,8DAEN;AAMM,4CAHI,OAAO,GAAC,IAAI,GACV,MAAM,GAAC,IAAI,CAOvB;AAED;IACC;;OAEG;IACH,6IAFW,OAAO,+BAA+B,EAAE,qBAAqB,EAmDvE;IADA,oCAAkC;IAGnC;;;;;OAKG,CACH,mBAJW,OAAO,SAAS,EAAE,OAAO,mBACzB,eAAe,GACb,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAezD;CACD;;0BA5GyB,sBAAsB"}
|
|
@@ -33,7 +33,7 @@ export const booleanToYesNoOrNull = (value) => {
|
|
|
33
33
|
|
|
34
34
|
export class BooleanQuestion extends RadioQuestion {
|
|
35
35
|
/**
|
|
36
|
-
* @param {import('
|
|
36
|
+
* @param {import('#typedefs/question-props.d.ts').BooleanQuestionParams} params
|
|
37
37
|
*/
|
|
38
38
|
constructor({
|
|
39
39
|
title,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef ConditionalAnswerObject
|
|
3
|
+
* @type {object}
|
|
4
|
+
* @property {string} value the checkbox answer
|
|
5
|
+
* @property {string} conditional the conditional text input
|
|
6
|
+
*/
|
|
7
|
+
export class CheckboxQuestion extends OptionsQuestion {
|
|
8
|
+
/**
|
|
9
|
+
* @param {import('#typedefs/question-props.d.ts').CheckboxQuestionParams} params
|
|
10
|
+
*/
|
|
11
|
+
constructor({ title, question, fieldName, url, pageTitle, description, options, validators, viewData }: import("#typedefs/question-props.d.ts").CheckboxQuestionParams);
|
|
12
|
+
/**
|
|
13
|
+
* returns the formatted answers values to be used to build task list elements
|
|
14
|
+
*/
|
|
15
|
+
formatAnswerForSummary(sectionSegment: any, journey: any, answer: any): import("../../index.js").SummaryRow[];
|
|
16
|
+
}
|
|
17
|
+
export default CheckboxQuestion;
|
|
18
|
+
export type ConditionalAnswerObject = {
|
|
19
|
+
/**
|
|
20
|
+
* the checkbox answer
|
|
21
|
+
*/
|
|
22
|
+
value: string;
|
|
23
|
+
/**
|
|
24
|
+
* the conditional text input
|
|
25
|
+
*/
|
|
26
|
+
conditional: string;
|
|
27
|
+
};
|
|
28
|
+
import OptionsQuestion from '../../questions/options-question.js';
|
|
29
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["question.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AAEH;IACC;;OAEG;IACH,wGAFW,OAAO,+BAA+B,EAAE,sBAAsB,EAiBxE;IAED;;OAEG;IACH,8GAqCC;CACD;;;;;;WAlEa,MAAM;;;;iBACN,MAAM;;4BATQ,qCAAqC"}
|
|
@@ -12,7 +12,7 @@ const defaultOptionJoinString = ',';
|
|
|
12
12
|
|
|
13
13
|
export class CheckboxQuestion extends OptionsQuestion {
|
|
14
14
|
/**
|
|
15
|
-
* @param {import('
|
|
15
|
+
* @param {import('#typedefs/question-props.d.ts').CheckboxQuestionParams} params
|
|
16
16
|
*/
|
|
17
17
|
constructor({ title, question, fieldName, url, pageTitle, description, options, validators, viewData }) {
|
|
18
18
|
super({
|
|
@@ -33,10 +33,6 @@ export class CheckboxQuestion extends OptionsQuestion {
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* returns the formatted answers values to be used to build task list elements
|
|
36
|
-
* @param {string | ConditionalAnswerObject } answer will be a single value string, a comma-separated string representing multiple values (one of which may be a conditional) or a single ConditionalAnswerObject
|
|
37
|
-
* @param {import('#journey').Journey} journey
|
|
38
|
-
* @param {String} sectionSegment
|
|
39
|
-
* @returns {Array.<Object>}
|
|
40
36
|
*/
|
|
41
37
|
formatAnswerForSummary(sectionSegment, journey, answer) {
|
|
42
38
|
if (!answer) {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export class DateQuestion extends Question {
|
|
5
5
|
/**
|
|
6
|
-
* @param {import('
|
|
6
|
+
* @param {import('#typedefs/question-props.d.ts').DateQuestionParams} params
|
|
7
7
|
*/
|
|
8
|
-
constructor({ dateFormat, ...parentParams }: import("
|
|
8
|
+
constructor({ dateFormat, ...parentParams }: import("#typedefs/question-props.d.ts").DateQuestionParams);
|
|
9
9
|
dateFormat: string;
|
|
10
10
|
/**
|
|
11
11
|
* Get the data to save from the request, returns an object of answers
|
|
@@ -16,6 +16,14 @@ export class DateQuestion extends Question {
|
|
|
16
16
|
answerForViewModel(answers: any, isPayload: any): {
|
|
17
17
|
[x: string]: any;
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* returns the formatted answers values to be used to build task list elements
|
|
21
|
+
*/
|
|
22
|
+
formatAnswerForSummary(sectionSegment: any, journey: any, answer: any): {
|
|
23
|
+
key: string;
|
|
24
|
+
value: string;
|
|
25
|
+
action: import("../../index.js").ActionView | import("../../index.js").ActionView[] | undefined;
|
|
26
|
+
}[];
|
|
19
27
|
}
|
|
20
28
|
export default DateQuestion;
|
|
21
29
|
import { Question } from '../../questions/question.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["question.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;IACC;;OAEG;IACH,6CAFW,OAAO,+BAA+B,EAAE,kBAAkB,EAQpE;IADA,mBAA4B;IAW7B;;;;;OAKG,CACH,mBAJW,OAAO,SAAS,EAAE,OAAO,mBACzB,OAAO,mBAAmB,EAAE,eAAe,GACzC,OAAO,CAAE,MAAM,CAAC,CAY5B;IAED;;MAwBC;IAED;;OAEG;IACH;;;;QAaC;CACD;;yBAxFwB,6BAA6B"}
|
|
@@ -8,7 +8,7 @@ const DEFAULT_DATE_FORMAT = 'd MMMM yyyy';
|
|
|
8
8
|
*/
|
|
9
9
|
export class DateQuestion extends Question {
|
|
10
10
|
/**
|
|
11
|
-
* @param {import('
|
|
11
|
+
* @param {import('#typedefs/question-props.d.ts').DateQuestionParams} params
|
|
12
12
|
*/
|
|
13
13
|
constructor({ dateFormat = DEFAULT_DATE_FORMAT, ...parentParams }) {
|
|
14
14
|
super({
|
|
@@ -72,7 +72,6 @@ export class DateQuestion extends Question {
|
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* returns the formatted answers values to be used to build task list elements
|
|
75
|
-
* @type {Question['formatAnswerForSummary']}
|
|
76
75
|
*/
|
|
77
76
|
formatAnswerForSummary(sectionSegment, journey, answer) {
|
|
78
77
|
let formattedAnswer;
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export class DatePeriodQuestion extends Question {
|
|
6
6
|
/**
|
|
7
|
-
* @param {import('
|
|
7
|
+
* @param {import('#typedefs/question-props.d.ts').DatePeriodQuestionParams} params
|
|
8
8
|
*/
|
|
9
|
-
constructor({ dateFormat, hint, labels, hintStart, startTime, hintEnd, endTime, ...parentParams }: import("
|
|
9
|
+
constructor({ dateFormat, hint, labels, hintStart, startTime, hintEnd, endTime, ...parentParams }: import("#typedefs/question-props.d.ts").DatePeriodQuestionParams);
|
|
10
10
|
dateFormat: string;
|
|
11
11
|
labels: {
|
|
12
12
|
start: string;
|
|
@@ -14,8 +14,8 @@ export class DatePeriodQuestion extends Question {
|
|
|
14
14
|
};
|
|
15
15
|
hintStart: string | undefined;
|
|
16
16
|
hintEnd: string | undefined;
|
|
17
|
-
startTime: import("
|
|
18
|
-
endTime: import("
|
|
17
|
+
startTime: import("#typedefs/question-props.d.ts").TimeComponents;
|
|
18
|
+
endTime: import("#typedefs/question-props.d.ts").TimeComponents;
|
|
19
19
|
/**
|
|
20
20
|
* Get the data to save from the request, returns an object of answers
|
|
21
21
|
* @param {import('express').Request} req
|
|
@@ -25,6 +25,18 @@ export class DatePeriodQuestion extends Question {
|
|
|
25
25
|
answerForViewModel(answers: any, isPayload: any): {
|
|
26
26
|
[x: string]: any;
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* @param {import('#question').QuestionViewModel} viewModel
|
|
30
|
+
*/
|
|
31
|
+
addCustomDataToViewModel(viewModel: import("#question").QuestionViewModel): void;
|
|
32
|
+
/**
|
|
33
|
+
* returns the formatted answers values to be used to build task list elements
|
|
34
|
+
*/
|
|
35
|
+
formatAnswerForSummary(sectionSegment: any, journey: any, answer: any): {
|
|
36
|
+
key: string;
|
|
37
|
+
value: string;
|
|
38
|
+
action: import("../../index.js").ActionView | import("../../index.js").ActionView[] | undefined;
|
|
39
|
+
}[];
|
|
28
40
|
}
|
|
29
41
|
export default DatePeriodQuestion;
|
|
30
42
|
import { Question } from '#question';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["question.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH;IACC;;OAEG;IACH,mGAFW,OAAO,+BAA+B,EAAE,wBAAwB,EAuB1E;IAPA,mBAA4B;IAC5B;;;MAAsD;IAEtD,8BAA0B;IAC1B,4BAAsB;IACtB,kEAA+D;IAC/D,gEAA2D;IAkB5D;;;;;OAKG,CACH,mBAJW,OAAO,SAAS,EAAE,OAAO,mBACzB,OAAO,mBAAmB,EAAE,eAAe,GACzC,OAAO,CAAE,MAAM,CAAC,CAgC5B;IAED;;MAuCC;IAED;;OAEG;IACH,oCAFW,OAAO,WAAW,EAAE,iBAAiB,QAM/C;IAED;;OAEG;IACH;;;;QAyBC;CACD;;yBAzKwB,WAAW"}
|
|
@@ -11,7 +11,7 @@ const DEFAULT_DATE_FORMAT = 'HH:mm d MMMM yyyy';
|
|
|
11
11
|
*/
|
|
12
12
|
export class DatePeriodQuestion extends Question {
|
|
13
13
|
/**
|
|
14
|
-
* @param {import('
|
|
14
|
+
* @param {import('#typedefs/question-props.d.ts').DatePeriodQuestionParams} params
|
|
15
15
|
*/
|
|
16
16
|
constructor({
|
|
17
17
|
dateFormat = DEFAULT_DATE_FORMAT,
|
|
@@ -141,7 +141,6 @@ export class DatePeriodQuestion extends Question {
|
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
* returns the formatted answers values to be used to build task list elements
|
|
144
|
-
* @type {Question['formatAnswerForSummary']}
|
|
145
144
|
*/
|
|
146
145
|
formatAnswerForSummary(sectionSegment, journey, answer) {
|
|
147
146
|
let formattedAnswer;
|
|
@@ -2,9 +2,9 @@ export class DateTimeQuestion extends Question {
|
|
|
2
2
|
static AM: string;
|
|
3
3
|
static PM: string;
|
|
4
4
|
/**
|
|
5
|
-
* @param {import('
|
|
5
|
+
* @param {import('#typedefs/question-props.d.ts').DateTimeQuestionParams} params
|
|
6
6
|
*/
|
|
7
|
-
constructor({ dateFormat, timeFormat, ...parentParams }: import("
|
|
7
|
+
constructor({ dateFormat, timeFormat, ...parentParams }: import("#typedefs/question-props.d.ts").DateTimeQuestionParams);
|
|
8
8
|
dateFormat: string;
|
|
9
9
|
timeFormat: string;
|
|
10
10
|
/**
|
|
@@ -16,6 +16,14 @@ export class DateTimeQuestion extends Question {
|
|
|
16
16
|
answerForViewModel(answers: any, isPayload: any): {
|
|
17
17
|
[x: string]: any;
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* returns the formatted answers values to be used to build task list elements
|
|
21
|
+
*/
|
|
22
|
+
formatAnswerForSummary(sectionSegment: any, journey: any, answer: any): {
|
|
23
|
+
key: string;
|
|
24
|
+
value: string;
|
|
25
|
+
action: import("../../index.js").ActionView | import("../../index.js").ActionView[] | undefined;
|
|
26
|
+
}[];
|
|
19
27
|
#private;
|
|
20
28
|
}
|
|
21
29
|
export default DateTimeQuestion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["question.js"],"names":[],"mappings":"AAMA;IACC,kBAAiB;IACjB,kBAAiB;IAEjB;;OAEG;IACH,yDAFW,OAAO,+BAA+B,EAAE,sBAAsB,EASxE;IAFA,mBAA4B;IAC5B,mBAA4B;IAkB7B;;;;;OAKG,CACH,mBAJW,OAAO,SAAS,EAAE,OAAO,mBACzB,eAAe,GACb,OAAO,CAAE,MAAM,CAAC,CAqB5B;IAED;;MAqCC;IAED;;OAEG;IACH;;;;QAQC;;CAsBD;;yBAxIwB,6BAA6B"}
|
|
@@ -9,7 +9,7 @@ export class DateTimeQuestion extends Question {
|
|
|
9
9
|
static PM = 'pm';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* @param {import('
|
|
12
|
+
* @param {import('#typedefs/question-props.d.ts').DateTimeQuestionParams} params
|
|
13
13
|
*/
|
|
14
14
|
constructor({ dateFormat = DEFAULT_DATE_FORMAT, timeFormat = DEFAULT_TIME_FORMAT, ...parentParams }) {
|
|
15
15
|
super({
|
|
@@ -103,7 +103,6 @@ export class DateTimeQuestion extends Question {
|
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
105
|
* returns the formatted answers values to be used to build task list elements
|
|
106
|
-
* @type {Question['formatAnswerForSummary']}
|
|
107
106
|
*/
|
|
108
107
|
formatAnswerForSummary(sectionSegment, journey, answer) {
|
|
109
108
|
return [
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email input question that extends SingleLineInputQuestion
|
|
3
|
+
* Automatically sets the input type to "email" and adds appropriate attributes
|
|
4
|
+
* @class
|
|
5
|
+
*/
|
|
6
|
+
export class EmailQuestion extends SingleLineInputQuestion {
|
|
7
|
+
/**
|
|
8
|
+
* @param {import('#typedefs/question-props.d.ts').EmailQuestionParams} params
|
|
9
|
+
*/
|
|
10
|
+
constructor(params: import("#typedefs/question-props.d.ts").EmailQuestionParams);
|
|
11
|
+
/**
|
|
12
|
+
* Override formatAnswerForSummary to prevent capitalization of email addresses
|
|
13
|
+
* Email addresses should remain in their original case (typically lowercase)
|
|
14
|
+
* @param {string} sectionSegment
|
|
15
|
+
* @param {import('#journey').Journey} journey
|
|
16
|
+
* @param {string} answer
|
|
17
|
+
* @returns {Array}
|
|
18
|
+
*/
|
|
19
|
+
formatAnswerForSummary(sectionSegment: string, journey: import("#journey").Journey, answer: string): any[];
|
|
20
|
+
}
|
|
21
|
+
export default EmailQuestion;
|
|
22
|
+
import SingleLineInputQuestion from '../single-line-input/question.js';
|
|
23
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["question.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH;IACC;;OAEG;IACH,oBAFW,OAAO,+BAA+B,EAAE,mBAAmB,EAmBrE;IAED;;;;;;;OAOG;IACH,uCALW,MAAM,WACN,OAAO,UAAU,EAAE,OAAO,UAC1B,MAAM,SAMhB;CACD;;oCA1CmC,kCAAkC"}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import SingleLineInputQuestion from '../single-line-input/question.js';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @typedef {import('#question').QuestionViewModel} QuestionViewModel
|
|
5
|
-
* @typedef {import('#journey').Journey} Journey
|
|
6
|
-
* @typedef {import('#journey-response').JourneyResponse} JourneyResponse
|
|
7
|
-
* @typedef {import('../../section').Section} Section
|
|
8
|
-
* @typedef {import('../../validator/base-validator')} BaseValidator
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
3
|
/**
|
|
12
4
|
* Email input question that extends SingleLineInputQuestion
|
|
13
5
|
* Automatically sets the input type to "email" and adds appropriate attributes
|
|
@@ -15,7 +7,7 @@ import SingleLineInputQuestion from '../single-line-input/question.js';
|
|
|
15
7
|
*/
|
|
16
8
|
export class EmailQuestion extends SingleLineInputQuestion {
|
|
17
9
|
/**
|
|
18
|
-
* @param {import('
|
|
10
|
+
* @param {import('#typedefs/question-props.d.ts').EmailQuestionParams} params
|
|
19
11
|
*/
|
|
20
12
|
constructor(params) {
|
|
21
13
|
// Set default input attributes for email
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manage-list-actions.d.ts","sourceRoot":"","sources":["manage-list-actions.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,kCAFU,QAAQ,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,CAAC,CAM5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manage-list-section.d.ts","sourceRoot":"","sources":["manage-list-section.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IACC,cAEC;IAED;;;;;;OAMG;IACH,2BAFa,OAAO,CAInB;IAED;;;;;OAKG;IACH,sBAJW,OAAO,6BAA6B,EAAE,QAAQ,sBAC9C,OAAO,0BAA0B,EAAE,iBAAiB,GAClD,IAAI,CAYhB;CACD;wBAtCuB,kBAAkB"}
|
|
@@ -7,19 +7,26 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export class ManageListQuestion extends Question {
|
|
9
9
|
/**
|
|
10
|
-
* @param {import('
|
|
10
|
+
* @param {import('#typedefs/question-props.d.ts').ManageListQuestionParams} params
|
|
11
11
|
*/
|
|
12
|
-
constructor(params: import("
|
|
12
|
+
constructor(params: import("#typedefs/question-props.d.ts").ManageListQuestionParams);
|
|
13
13
|
get confirmationQuestionParam(): string;
|
|
14
|
+
/**
|
|
15
|
+
* @param {import('#question').QuestionViewModel} viewModel
|
|
16
|
+
*/
|
|
17
|
+
addCustomDataToViewModel(viewModel: import("#question").QuestionViewModel): void;
|
|
14
18
|
getDataToSave(req: any, journeyResponse: any): Promise<{
|
|
15
19
|
answers: {
|
|
16
20
|
[x: string]: any;
|
|
17
21
|
};
|
|
18
22
|
}>;
|
|
23
|
+
/**
|
|
24
|
+
* returns the formatted answers values to be used to build task list elements
|
|
25
|
+
*/
|
|
19
26
|
formatAnswerForSummary(sectionSegment: any, journey: any, answer: any): {
|
|
20
27
|
key: string;
|
|
21
28
|
value: string;
|
|
22
|
-
action: import("../../
|
|
29
|
+
action: import("../../index.js").ActionView | import("../../index.js").ActionView[] | undefined;
|
|
23
30
|
}[];
|
|
24
31
|
renderConfirmationAction(res: any, itemToRemove: any, viewModel: any): void;
|
|
25
32
|
set section(section: import("../../section.js").Section);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["question.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AAEH;IAOC;;OAEG;IACH,oBAFW,OAAO,+BAA+B,EAAE,wBAAwB,EAe1E;IAcD,wCAEC;IAED;;OAEG;IACH,oCAFW,OAAO,WAAW,EAAE,iBAAiB,QAmB/C;IAmCD;;;;OAMC;IAED;;OAEG;IACH;;;;QAsBC;IAED,4EAQC;IAoCD,yDAEC;IATD,kDAKC;;CAKD;;;;;;mBAxLa,MAAM;;;;;;;;;;;;;;yBAPK,WAAW"}
|
|
@@ -19,7 +19,7 @@ export class ManageListQuestion extends Question {
|
|
|
19
19
|
#confirmationQuestionParam;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* @param {import('
|
|
22
|
+
* @param {import('#typedefs/question-props.d.ts').ManageListQuestionParams} params
|
|
23
23
|
*/
|
|
24
24
|
constructor(params) {
|
|
25
25
|
super({
|
|
@@ -115,6 +115,9 @@ export class ManageListQuestion extends Question {
|
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
/**
|
|
119
|
+
* returns the formatted answers values to be used to build task list elements
|
|
120
|
+
*/
|
|
118
121
|
formatAnswerForSummary(sectionSegment, journey, answer) {
|
|
119
122
|
let formattedAnswer = this.notStartedText;
|
|
120
123
|
if (answer && Array.isArray(answer)) {
|
|
@@ -11,8 +11,8 @@ export function answerObjectForManageList(response: import("../../journey/journe
|
|
|
11
11
|
*
|
|
12
12
|
* @param {import('../../journey/journey-response.js').JourneyResponse} response
|
|
13
13
|
* @param {import('./question.js')} manageListQuestion
|
|
14
|
-
* @param {import('
|
|
15
|
-
* @returns {import('
|
|
14
|
+
* @param {import('#typedefs/journey-types.d.ts').RouteParams} params
|
|
15
|
+
* @returns {import('#typedefs/journey-types.d.ts').ManageListAnswers}
|
|
16
16
|
*/
|
|
17
|
-
export function answerObjectForManageListSaving(response: import("../../journey/journey-response.js").JourneyResponse, manageListQuestion: typeof import("./question.js"), params: import("
|
|
17
|
+
export function answerObjectForManageListSaving(response: import("../../journey/journey-response.js").JourneyResponse, manageListQuestion: typeof import("./question.js"), params: import("#typedefs/journey-types.d.ts").RouteParams): import("#typedefs/journey-types.d.ts").ManageListAnswers;
|
|
18
18
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oDALW,OAAO,mCAAmC,EAAE,eAAe,wEAE3D,MAAM,GACJ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQnC;AAED;;;;;;;GAOG;AACH,0DALW,OAAO,mCAAmC,EAAE,eAAe,8DAE3D,OAAO,8BAA8B,EAAE,WAAW,GAChD,OAAO,8BAA8B,EAAE,iBAAiB,CAapE"}
|
|
@@ -18,8 +18,8 @@ export function answerObjectForManageList(response, manageListQuestion, manageLi
|
|
|
18
18
|
*
|
|
19
19
|
* @param {import('../../journey/journey-response.js').JourneyResponse} response
|
|
20
20
|
* @param {import('./question.js')} manageListQuestion
|
|
21
|
-
* @param {import('
|
|
22
|
-
* @returns {import('
|
|
21
|
+
* @param {import('#typedefs/journey-types.d.ts').RouteParams} params
|
|
22
|
+
* @returns {import('#typedefs/journey-types.d.ts').ManageListAnswers}
|
|
23
23
|
*/
|
|
24
24
|
export function answerObjectForManageListSaving(response, manageListQuestion, params) {
|
|
25
25
|
const answersList =
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @class
|
|
3
|
+
*/
|
|
4
|
+
export class MultiFieldInputQuestion extends Question {
|
|
5
|
+
/**
|
|
6
|
+
* @param {import('#typedefs/question-props.d.ts').MultiFieldInputQuestionParams} params
|
|
7
|
+
*/
|
|
8
|
+
constructor({ inputFields, ...parentParams }: import("#typedefs/question-props.d.ts").MultiFieldInputQuestionParams);
|
|
9
|
+
inputFields: import("#typedefs/question-props.d.ts").InputField[];
|
|
10
|
+
answerForViewModel(answers: any): {
|
|
11
|
+
value: string;
|
|
12
|
+
fieldName: string;
|
|
13
|
+
label: string;
|
|
14
|
+
formatJoinString?: string;
|
|
15
|
+
formatPrefix?: string;
|
|
16
|
+
formatTextFunction?: (text: string) => string;
|
|
17
|
+
attributes?: Record<string, string>;
|
|
18
|
+
suffix?: import("#typedefs/question-props.d.ts").Affix;
|
|
19
|
+
prefix?: import("#typedefs/question-props.d.ts").Affix;
|
|
20
|
+
hint?: string;
|
|
21
|
+
classes?: string;
|
|
22
|
+
inputmode?: "decimal" | "numeric";
|
|
23
|
+
pattern?: string;
|
|
24
|
+
}[];
|
|
25
|
+
/**
|
|
26
|
+
* returns the formatted answers values to be used to build task list elements
|
|
27
|
+
* @param {import('#journey').Journey} journey
|
|
28
|
+
* @param {string} sectionSegment
|
|
29
|
+
* @returns {Array<{
|
|
30
|
+
* key: string;
|
|
31
|
+
* value: string | Object;
|
|
32
|
+
* action: {
|
|
33
|
+
* href: string;
|
|
34
|
+
* text: string;
|
|
35
|
+
* visuallyHiddenText: string;
|
|
36
|
+
* };
|
|
37
|
+
* }>}
|
|
38
|
+
*/
|
|
39
|
+
formatAnswerForSummary(sectionSegment: string, journey: import("#journey").Journey): Array<{
|
|
40
|
+
key: string;
|
|
41
|
+
value: string | Object;
|
|
42
|
+
action: {
|
|
43
|
+
href: string;
|
|
44
|
+
text: string;
|
|
45
|
+
visuallyHiddenText: string;
|
|
46
|
+
};
|
|
47
|
+
}>;
|
|
48
|
+
#private;
|
|
49
|
+
}
|
|
50
|
+
export default MultiFieldInputQuestion;
|
|
51
|
+
import { Question } from '#question';
|
|
52
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["question.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IACC;;OAEG;IACH,8CAFW,OAAO,+BAA+B,EAAE,6BAA6B,EAa/E;IAJC,kEAA8B;IAchC;;;;;;;;;;;;;;QAOC;IAsBD;;;;;;;;;;;;;OAaG;IACH,uCAXW,MAAM,WADN,OAAO,UAAU,EAAE,OAAO,GAExB,KAAK,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QACvB,MAAM,EAAE;YACN,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,kBAAkB,EAAE,MAAM,CAAC;SAC5B,CAAC;KACH,CAAC,CAkBJ;;CAyBD;;yBApHwB,WAAW"}
|
|
@@ -2,20 +2,12 @@ import { Question } from '#question';
|
|
|
2
2
|
import escape from 'escape-html';
|
|
3
3
|
import { nl2br } from '../../lib/utils.js';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {import('#question').QuestionViewModel} QuestionViewModel
|
|
7
|
-
* @typedef {import('#journey').Journey} Journey
|
|
8
|
-
* @typedef {import('#journey-response').JourneyResponse} JourneyResponse
|
|
9
|
-
* @typedef {import('../../section').Section} Section
|
|
10
|
-
* @typedef {import('../../validator/base-validator')} BaseValidator
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
5
|
/**
|
|
14
6
|
* @class
|
|
15
7
|
*/
|
|
16
8
|
export class MultiFieldInputQuestion extends Question {
|
|
17
9
|
/**
|
|
18
|
-
* @param {import('
|
|
10
|
+
* @param {import('#typedefs/question-props.d.ts').MultiFieldInputQuestionParams} params
|
|
19
11
|
*/
|
|
20
12
|
constructor({ inputFields, ...parentParams }) {
|
|
21
13
|
super({
|
|
@@ -50,7 +42,7 @@ export class MultiFieldInputQuestion extends Question {
|
|
|
50
42
|
/**
|
|
51
43
|
* Get the data to save from the request, returns an object of answers
|
|
52
44
|
* @param {import('express').Request} req
|
|
53
|
-
* @param {JourneyResponse} journeyResponse - current journey response, modified with the new answers
|
|
45
|
+
* @param {import('#journey-response').JourneyResponse} journeyResponse - current journey response, modified with the new answers
|
|
54
46
|
* @returns {Promise<{ answers: Record<string, unknown> }>}
|
|
55
47
|
*/ //eslint-disable-next-line no-unused-vars -- journeyResponse kept for other questions to use
|
|
56
48
|
async getDataToSave(req, journeyResponse) {
|
|
@@ -69,8 +61,8 @@ export class MultiFieldInputQuestion extends Question {
|
|
|
69
61
|
|
|
70
62
|
/**
|
|
71
63
|
* returns the formatted answers values to be used to build task list elements
|
|
72
|
-
* @param {Journey} journey
|
|
73
|
-
* @param {
|
|
64
|
+
* @param {import('#journey').Journey} journey
|
|
65
|
+
* @param {string} sectionSegment
|
|
74
66
|
* @returns {Array<{
|
|
75
67
|
* key: string;
|
|
76
68
|
* value: string | Object;
|
|
@@ -101,7 +93,7 @@ export class MultiFieldInputQuestion extends Question {
|
|
|
101
93
|
|
|
102
94
|
/**
|
|
103
95
|
* checks whether any answers have been provided for input field questions
|
|
104
|
-
* @param {Journey} journey
|
|
96
|
+
* @param {import('#journey').Journey} journey
|
|
105
97
|
* @returns {boolean}
|
|
106
98
|
*/
|
|
107
99
|
#allQuestionsUnanswered(journey) {
|