@planning-inspectorate/dynamic-forms 3.3.4 → 3.4.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/.azure/pipelines/azure-pipelines-pr.yml +4 -0
- package/.azure/pipelines/release.yml +4 -0
- package/README.md +20 -9
- package/package.json +9 -3
- package/src/components/address/question.js +1 -10
- package/src/components/boolean/question.js +1 -1
- package/src/components/checkbox/question.js +2 -6
- package/src/components/date/question.js +1 -8
- package/src/components/date-period/question.js +1 -8
- package/src/components/email/question.js +4 -4
- package/src/components/multi-field-input/question.js +3 -3
- package/src/components/multi-field-input/question.test.js +1 -1
- package/src/components/number-entry/question.js +1 -5
- package/src/components/radio/question.js +1 -1
- package/src/components/select/question.js +1 -1
- package/src/components/single-line-input/question.js +0 -8
- package/src/components/text-entry/question.js +4 -4
- package/src/components/text-entry-redact/question.js +6 -16
- package/src/components/unit-option-entry/question.js +4 -11
- package/src/components/utils/component-types.js +18 -0
- package/src/index.js +72 -25
- package/src/middleware/redirect-to-unanswered-question.test.js +1 -1
- package/src/questions/options-question.js +5 -12
- package/src/questions/question-types.d.ts +3 -3
- package/src/questions/question.js +6 -6
- package/src/questions/questions.js +1 -1
- package/tsconfig.json +9 -1
- package/types/commitlint.config.d.ts +7 -0
- package/types/commitlint.config.d.ts.map +1 -0
- package/types/eslint.config.d.ts +95 -0
- package/types/eslint.config.d.ts.map +1 -0
- package/types/src/components/address/question.d.ts +31 -0
- package/types/src/components/address/question.d.ts.map +1 -0
- package/types/src/components/address/question.test.d.ts +2 -0
- package/types/src/components/address/question.test.d.ts.map +1 -0
- package/types/src/components/boolean/question.d.ts +47 -0
- package/types/src/components/boolean/question.d.ts.map +1 -0
- package/types/src/components/boolean/question.test.d.ts +2 -0
- package/types/src/components/boolean/question.test.d.ts.map +1 -0
- package/types/src/components/checkbox/question.d.ts +49 -0
- package/types/src/components/checkbox/question.d.ts.map +1 -0
- package/types/src/components/checkbox/question.test.d.ts +2 -0
- package/types/src/components/checkbox/question.test.d.ts.map +1 -0
- package/types/src/components/date/question.d.ts +22 -0
- package/types/src/components/date/question.d.ts.map +1 -0
- package/types/src/components/date/question.test.d.ts +2 -0
- package/types/src/components/date/question.test.d.ts.map +1 -0
- package/types/src/components/date-period/question.d.ts +29 -0
- package/types/src/components/date-period/question.d.ts.map +1 -0
- package/types/src/components/date-period/question.test.d.ts +2 -0
- package/types/src/components/date-period/question.test.d.ts.map +1 -0
- package/types/src/components/date-time/question.d.ts +24 -0
- package/types/src/components/date-time/question.d.ts.map +1 -0
- package/types/src/components/date-time/question.test.d.ts +2 -0
- package/types/src/components/date-time/question.test.d.ts.map +1 -0
- package/types/src/components/email/question.d.ts +30 -0
- package/types/src/components/email/question.d.ts.map +1 -0
- package/types/src/components/email/question.test.d.ts +2 -0
- package/types/src/components/email/question.test.d.ts.map +1 -0
- package/types/src/components/identifier/question.d.ts +15 -0
- package/types/src/components/identifier/question.d.ts.map +1 -0
- package/types/src/components/identifier/question.test.d.ts +2 -0
- package/types/src/components/identifier/question.test.d.ts.map +1 -0
- package/types/src/components/manage-list/manage-list-section.d.ts +16 -0
- package/types/src/components/manage-list/manage-list-section.d.ts.map +1 -0
- package/types/src/components/manage-list/manage-list-section.test.d.ts +2 -0
- package/types/src/components/manage-list/manage-list-section.test.d.ts.map +1 -0
- package/types/src/components/manage-list/question.d.ts +41 -0
- package/types/src/components/manage-list/question.d.ts.map +1 -0
- package/types/src/components/manage-list/question.test.d.ts +2 -0
- package/types/src/components/manage-list/question.test.d.ts.map +1 -0
- package/types/src/components/manage-list/utils.d.ts +18 -0
- package/types/src/components/manage-list/utils.d.ts.map +1 -0
- package/types/src/components/manage-list/utils.test.d.ts +2 -0
- package/types/src/components/manage-list/utils.test.d.ts.map +1 -0
- package/types/src/components/multi-field-input/question.d.ts +106 -0
- package/types/src/components/multi-field-input/question.d.ts.map +1 -0
- package/types/src/components/multi-field-input/question.test.d.ts +2 -0
- package/types/src/components/multi-field-input/question.test.d.ts.map +1 -0
- package/types/src/components/number-entry/question.d.ts +37 -0
- package/types/src/components/number-entry/question.d.ts.map +1 -0
- package/types/src/components/radio/question.d.ts +53 -0
- package/types/src/components/radio/question.d.ts.map +1 -0
- package/types/src/components/radio/question.test.d.ts +2 -0
- package/types/src/components/radio/question.test.d.ts.map +1 -0
- package/types/src/components/select/question.d.ts +51 -0
- package/types/src/components/select/question.d.ts.map +1 -0
- package/types/src/components/select/question.test.d.ts +2 -0
- package/types/src/components/select/question.test.d.ts.map +1 -0
- package/types/src/components/single-line-input/question.d.ts +18 -0
- package/types/src/components/single-line-input/question.d.ts.map +1 -0
- package/types/src/components/single-line-input/question.test.d.ts +2 -0
- package/types/src/components/single-line-input/question.test.d.ts.map +1 -0
- package/types/src/components/text-entry/question.d.ts +34 -0
- package/types/src/components/text-entry/question.d.ts.map +1 -0
- package/types/src/components/text-entry/question.test.d.ts +2 -0
- package/types/src/components/text-entry/question.test.d.ts.map +1 -0
- package/types/src/components/text-entry-redact/question.d.ts +42 -0
- package/types/src/components/text-entry-redact/question.d.ts.map +1 -0
- package/types/src/components/text-entry-redact/question.test.d.ts +2 -0
- package/types/src/components/text-entry-redact/question.test.d.ts.map +1 -0
- package/types/src/components/unit-option-entry/question.d.ts +83 -0
- package/types/src/components/unit-option-entry/question.d.ts.map +1 -0
- package/types/src/components/unit-option-entry/question.test.d.ts +2 -0
- package/types/src/components/unit-option-entry/question.test.d.ts.map +1 -0
- package/types/src/components/utils/component-types.d.ts +19 -0
- package/types/src/components/utils/component-types.d.ts.map +1 -0
- package/types/src/components/utils/persisted-number-answer.d.ts +2 -0
- package/types/src/components/utils/persisted-number-answer.d.ts.map +1 -0
- package/types/src/components/utils/question-has-answer.d.ts +17 -0
- package/types/src/components/utils/question-has-answer.d.ts.map +1 -0
- package/types/src/components/utils/question-has-answer.test.d.ts +2 -0
- package/types/src/components/utils/question-has-answer.test.d.ts.map +1 -0
- package/types/src/components/utils/question-utils.d.ts +15 -0
- package/types/src/components/utils/question-utils.d.ts.map +1 -0
- package/types/src/components/utils/question-utils.test.d.ts +2 -0
- package/types/src/components/utils/question-utils.test.d.ts.map +1 -0
- package/types/src/controller.d.ts +78 -0
- package/types/src/controller.d.ts.map +1 -0
- package/types/src/controller.test.d.ts +2 -0
- package/types/src/controller.test.d.ts.map +1 -0
- package/types/src/index.d.ts +54 -0
- package/types/src/index.d.ts.map +1 -0
- package/types/src/journey/journey-response.d.ts +32 -0
- package/types/src/journey/journey-response.d.ts.map +1 -0
- package/types/src/journey/journey-response.test.d.ts +2 -0
- package/types/src/journey/journey-response.test.d.ts.map +1 -0
- package/types/src/journey/journey.d.ts +144 -0
- package/types/src/journey/journey.d.ts.map +1 -0
- package/types/src/journey/journey.test.d.ts +2 -0
- package/types/src/journey/journey.test.d.ts.map +1 -0
- package/types/src/lib/address-utils.d.ts +6 -0
- package/types/src/lib/address-utils.d.ts.map +1 -0
- package/types/src/lib/address-utils.test.d.ts +2 -0
- package/types/src/lib/address-utils.test.d.ts.map +1 -0
- package/types/src/lib/address.d.ts +43 -0
- package/types/src/lib/address.d.ts.map +1 -0
- package/types/src/lib/address.test.d.ts +2 -0
- package/types/src/lib/address.test.d.ts.map +1 -0
- package/types/src/lib/date-utils.d.ts +60 -0
- package/types/src/lib/date-utils.d.ts.map +1 -0
- package/types/src/lib/date-utils.test.d.ts +2 -0
- package/types/src/lib/date-utils.test.d.ts.map +1 -0
- package/types/src/lib/session-answer-store.d.ts +84 -0
- package/types/src/lib/session-answer-store.d.ts.map +1 -0
- package/types/src/lib/session-answer-store.test.d.ts +2 -0
- package/types/src/lib/session-answer-store.test.d.ts.map +1 -0
- package/types/src/lib/utils.d.ts +19 -0
- package/types/src/lib/utils.d.ts.map +1 -0
- package/types/src/lib/utils.test.d.ts +2 -0
- package/types/src/lib/utils.test.d.ts.map +1 -0
- package/types/src/lib/uuid.d.ts +7 -0
- package/types/src/lib/uuid.d.ts.map +1 -0
- package/types/src/lib/uuid.test.d.ts +2 -0
- package/types/src/lib/uuid.test.d.ts.map +1 -0
- package/types/src/middleware/build-get-journey.d.ts +6 -0
- package/types/src/middleware/build-get-journey.d.ts.map +1 -0
- package/types/src/middleware/redirect-to-unanswered-question.d.ts +12 -0
- package/types/src/middleware/redirect-to-unanswered-question.d.ts.map +1 -0
- package/types/src/middleware/redirect-to-unanswered-question.test.d.ts +2 -0
- package/types/src/middleware/redirect-to-unanswered-question.test.d.ts.map +1 -0
- package/types/src/questions/create-questions.d.ts +21 -0
- package/types/src/questions/create-questions.d.ts.map +1 -0
- package/types/src/questions/options-question.d.ts +74 -0
- package/types/src/questions/options-question.d.ts.map +1 -0
- package/types/src/questions/options-question.test.d.ts +2 -0
- package/types/src/questions/options-question.test.d.ts.map +1 -0
- package/types/src/questions/question.d.ts +274 -0
- package/types/src/questions/question.d.ts.map +1 -0
- package/types/src/questions/question.test.d.ts +2 -0
- package/types/src/questions/question.test.d.ts.map +1 -0
- package/types/src/questions/questions.d.ts +3 -0
- package/types/src/questions/questions.d.ts.map +1 -0
- package/types/src/section.d.ts +107 -0
- package/types/src/section.d.ts.map +1 -0
- package/types/src/section.test.d.ts +2 -0
- package/types/src/section.test.d.ts.map +1 -0
- package/types/src/validator/address-validator.d.ts +41 -0
- package/types/src/validator/address-validator.d.ts.map +1 -0
- package/types/src/validator/address-validator.test.d.ts +2 -0
- package/types/src/validator/address-validator.test.d.ts.map +1 -0
- package/types/src/validator/base-validator.d.ts +11 -0
- package/types/src/validator/base-validator.d.ts.map +1 -0
- package/types/src/validator/base-validator.test.d.ts +2 -0
- package/types/src/validator/base-validator.test.d.ts.map +1 -0
- package/types/src/validator/conditional-required-validator.d.ts +24 -0
- package/types/src/validator/conditional-required-validator.d.ts.map +1 -0
- package/types/src/validator/conditional-required-validator.test.d.ts +2 -0
- package/types/src/validator/conditional-required-validator.test.d.ts.map +1 -0
- package/types/src/validator/confirmation-checkbox-validator.d.ts +27 -0
- package/types/src/validator/confirmation-checkbox-validator.d.ts.map +1 -0
- package/types/src/validator/confirmation-checkbox-validator.test.d.ts +2 -0
- package/types/src/validator/confirmation-checkbox-validator.test.d.ts.map +1 -0
- package/types/src/validator/coordinates-validator.d.ts +22 -0
- package/types/src/validator/coordinates-validator.d.ts.map +1 -0
- package/types/src/validator/coordinates-validator.test.d.ts +2 -0
- package/types/src/validator/coordinates-validator.test.d.ts.map +1 -0
- package/types/src/validator/date-period-validator.d.ts +63 -0
- package/types/src/validator/date-period-validator.d.ts.map +1 -0
- package/types/src/validator/date-period-validator.test.d.ts +2 -0
- package/types/src/validator/date-period-validator.test.d.ts.map +1 -0
- package/types/src/validator/date-time-validator.d.ts +26 -0
- package/types/src/validator/date-time-validator.d.ts.map +1 -0
- package/types/src/validator/date-time-validator.test.d.ts +2 -0
- package/types/src/validator/date-time-validator.test.d.ts.map +1 -0
- package/types/src/validator/date-validator.d.ts +48 -0
- package/types/src/validator/date-validator.d.ts.map +1 -0
- package/types/src/validator/date-validator.test.d.ts +2 -0
- package/types/src/validator/date-validator.test.d.ts.map +1 -0
- package/types/src/validator/document-upload-validator.d.ts +10 -0
- package/types/src/validator/document-upload-validator.d.ts.map +1 -0
- package/types/src/validator/document-upload-validator.test.d.ts +2 -0
- package/types/src/validator/document-upload-validator.test.d.ts.map +1 -0
- package/types/src/validator/email-validator.d.ts +73 -0
- package/types/src/validator/email-validator.d.ts.map +1 -0
- package/types/src/validator/email-validator.test.d.ts +2 -0
- package/types/src/validator/email-validator.test.d.ts.map +1 -0
- package/types/src/validator/multi-field-input-validator.d.ts +70 -0
- package/types/src/validator/multi-field-input-validator.d.ts.map +1 -0
- package/types/src/validator/multi-field-input-validator.test.d.ts +2 -0
- package/types/src/validator/multi-field-input-validator.test.d.ts.map +1 -0
- package/types/src/validator/numeric-validator.d.ts +49 -0
- package/types/src/validator/numeric-validator.d.ts.map +1 -0
- package/types/src/validator/numeric-validator.test.d.ts +2 -0
- package/types/src/validator/numeric-validator.test.d.ts.map +1 -0
- package/types/src/validator/required-validator.d.ts +22 -0
- package/types/src/validator/required-validator.d.ts.map +1 -0
- package/types/src/validator/required-validator.test.d.ts +2 -0
- package/types/src/validator/required-validator.test.d.ts.map +1 -0
- package/types/src/validator/same-answer-validator.d.ts +18 -0
- package/types/src/validator/same-answer-validator.d.ts.map +1 -0
- package/types/src/validator/same-answer-validator.test.d.ts +2 -0
- package/types/src/validator/same-answer-validator.test.d.ts.map +1 -0
- package/types/src/validator/string-validator.d.ts +58 -0
- package/types/src/validator/string-validator.d.ts.map +1 -0
- package/types/src/validator/string-validator.test.d.ts +2 -0
- package/types/src/validator/string-validator.test.d.ts.map +1 -0
- package/types/src/validator/unit-option-entry-validator.d.ts +40 -0
- package/types/src/validator/unit-option-entry-validator.d.ts.map +1 -0
- package/types/src/validator/unit-option-entry-validator.test.d.ts +2 -0
- package/types/src/validator/unit-option-entry-validator.test.d.ts.map +1 -0
- package/types/src/validator/valid-option-validator.d.ts +22 -0
- package/types/src/validator/valid-option-validator.d.ts.map +1 -0
- package/types/src/validator/valid-option-validator.test.d.ts +2 -0
- package/types/src/validator/valid-option-validator.test.d.ts.map +1 -0
- package/types/src/validator/validation-error-handler.d.ts +20 -0
- package/types/src/validator/validation-error-handler.d.ts.map +1 -0
- package/types/src/validator/validation-error-handler.test.d.ts +2 -0
- package/types/src/validator/validation-error-handler.test.d.ts.map +1 -0
- package/types/src/validator/validator.d.ts +5 -0
- package/types/src/validator/validator.d.ts.map +1 -0
- package/types/src/validator/validator.test.d.ts +2 -0
- package/types/src/validator/validator.test.d.ts.map +1 -0
- package/types/test/mock/journey.d.ts +3 -0
- package/types/test/mock/journey.d.ts.map +1 -0
- package/types/test/mock/uuid.d.ts +7 -0
- package/types/test/mock/uuid.d.ts.map +1 -0
- package/types/test/utils/nunjucks.d.ts +2 -0
- package/types/test/utils/nunjucks.d.ts.map +1 -0
- package/types/test/utils/utils.d.ts +32 -0
- package/types/test/utils/utils.d.ts.map +1 -0
- package/src/lib/address.d.ts +0 -7
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('#question').QuestionViewModel} QuestionViewModel
|
|
3
|
+
* @typedef {import('#journey').Journey} Journey
|
|
4
|
+
* @typedef {import('#journey-response').JourneyResponse} JourneyResponse
|
|
5
|
+
* @typedef {import('../../section').Section} Section
|
|
6
|
+
* @typedef {import('../../validator/base-validator')} BaseValidator
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {Object} Suffix
|
|
10
|
+
* @property {string} text
|
|
11
|
+
* @property {string} [classes] optional property, used to add classes to the suffix/prefix
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Object} InputField
|
|
15
|
+
* @property {string} fieldName
|
|
16
|
+
* @property {string} label
|
|
17
|
+
* @property {string} [formatJoinString] optional property, used by formatAnswerForSummary (eg task list display), effective default to line break
|
|
18
|
+
* @property {string} [formatPrefix] optional property, used by formatAnswerForSummary (eg task list display), to prefix answer
|
|
19
|
+
* @property {function} [formatTextFunction] optional property, used to format the answer for display and value in question
|
|
20
|
+
* @property {Record<string, string>} [attributes] optional property, used to add html attributes to the field
|
|
21
|
+
* @property {Suffix} [suffix] optional property, used to add a suffix to the field
|
|
22
|
+
* @property {Suffix} [prefix] optional property, used to add a prefix to the field
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* @class
|
|
26
|
+
*/
|
|
27
|
+
export default class MultiFieldInputQuestion extends Question {
|
|
28
|
+
/**
|
|
29
|
+
* @param {import('#question-types').QuestionParameters} params
|
|
30
|
+
* @param {string|undefined} [params.label] if defined this show as a label for the input and the question will just be a standard h1
|
|
31
|
+
* @param {Record<string, string>} [params.inputAttributes] html attributes to add to the input
|
|
32
|
+
* @param {InputField[]} params.inputFields input fields
|
|
33
|
+
*/
|
|
34
|
+
constructor({ label, inputAttributes, inputFields, ...params }: import("#question-types").QuestionParameters);
|
|
35
|
+
/** @type {Record<string, string>} */
|
|
36
|
+
inputAttributes: Record<string, string>;
|
|
37
|
+
label: any;
|
|
38
|
+
inputFields: any;
|
|
39
|
+
answerForViewModel(answers: any): any;
|
|
40
|
+
/**
|
|
41
|
+
* returns the formatted answers values to be used to build task list elements
|
|
42
|
+
* @param {Journey} journey
|
|
43
|
+
* @param {String} sectionSegment
|
|
44
|
+
* @returns {Array<{
|
|
45
|
+
* key: string;
|
|
46
|
+
* value: string | Object;
|
|
47
|
+
* action: {
|
|
48
|
+
* href: string;
|
|
49
|
+
* text: string;
|
|
50
|
+
* visuallyHiddenText: string;
|
|
51
|
+
* };
|
|
52
|
+
* }>}
|
|
53
|
+
*/
|
|
54
|
+
formatAnswerForSummary(sectionSegment: string, journey: Journey): Array<{
|
|
55
|
+
key: string;
|
|
56
|
+
value: string | Object;
|
|
57
|
+
action: {
|
|
58
|
+
href: string;
|
|
59
|
+
text: string;
|
|
60
|
+
visuallyHiddenText: string;
|
|
61
|
+
};
|
|
62
|
+
}>;
|
|
63
|
+
#private;
|
|
64
|
+
}
|
|
65
|
+
export type QuestionViewModel = import("#question").QuestionViewModel;
|
|
66
|
+
export type Journey = import("#journey").Journey;
|
|
67
|
+
export type JourneyResponse = import("#journey-response").JourneyResponse;
|
|
68
|
+
export type Section = any;
|
|
69
|
+
export type BaseValidator = any;
|
|
70
|
+
export type Suffix = {
|
|
71
|
+
text: string;
|
|
72
|
+
/**
|
|
73
|
+
* optional property, used to add classes to the suffix/prefix
|
|
74
|
+
*/
|
|
75
|
+
classes?: string | undefined;
|
|
76
|
+
};
|
|
77
|
+
export type InputField = {
|
|
78
|
+
fieldName: string;
|
|
79
|
+
label: string;
|
|
80
|
+
/**
|
|
81
|
+
* optional property, used by formatAnswerForSummary (eg task list display), effective default to line break
|
|
82
|
+
*/
|
|
83
|
+
formatJoinString?: string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* optional property, used by formatAnswerForSummary (eg task list display), to prefix answer
|
|
86
|
+
*/
|
|
87
|
+
formatPrefix?: string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* optional property, used to format the answer for display and value in question
|
|
90
|
+
*/
|
|
91
|
+
formatTextFunction?: Function | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* optional property, used to add html attributes to the field
|
|
94
|
+
*/
|
|
95
|
+
attributes?: Record<string, string> | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* optional property, used to add a suffix to the field
|
|
98
|
+
*/
|
|
99
|
+
suffix?: Suffix | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* optional property, used to add a prefix to the field
|
|
102
|
+
*/
|
|
103
|
+
prefix?: Suffix | undefined;
|
|
104
|
+
};
|
|
105
|
+
import { Question } from '#question';
|
|
106
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/multi-field-input/question.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH;;;;GAIG;AAEH;;;;;;;;;;GAUG;AAEH;;GAEG;AACH;IAIC;;;;;OAKG;IACH,gEALW,OAAO,iBAAiB,EAAE,kBAAkB,EAkBtD;IAtBD,qCAAqC;IACrC,iBADW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CACjB;IAaf,WAAkB;IAIjB,iBAA8B;IAMhC,sCAOC;IA8BD;;;;;;;;;;;;;OAaG;IACH,wDAZW,OAAO,GAEL,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;gCAjJY,OAAO,WAAW,EAAE,iBAAiB;sBACrC,OAAO,UAAU,EAAE,OAAO;8BAC1B,OAAO,mBAAmB,EAAE,eAAe;;;;UAO1C,MAAM;;;;;;;eAMN,MAAM;WACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;yBArBK,WAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.test.d.ts","sourceRoot":"","sources":["../../../../src/components/multi-field-input/question.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export default class NumberEntryQuestion extends Question {
|
|
2
|
+
/**
|
|
3
|
+
* @param {import('#question-types').QuestionParameters} params
|
|
4
|
+
* @param {string} [params.suffix]
|
|
5
|
+
* @param {string|undefined} [params.label] if defined this show as a label for the input and the question will just be a standard h1
|
|
6
|
+
*/
|
|
7
|
+
constructor({ label, suffix, ...params }: import("#question-types").QuestionParameters);
|
|
8
|
+
suffix: any;
|
|
9
|
+
label: any;
|
|
10
|
+
answerForViewModel(answers: any): string | number;
|
|
11
|
+
/**
|
|
12
|
+
* returns the formatted answers values to be used to build task list elements
|
|
13
|
+
* @param {Object} answer
|
|
14
|
+
* @param {import('#journey').Journey} journey
|
|
15
|
+
* @param {String} sectionSegment
|
|
16
|
+
* @returns {Array<{
|
|
17
|
+
* key: string;
|
|
18
|
+
* value: string | Object;
|
|
19
|
+
* action: {
|
|
20
|
+
* href: string;
|
|
21
|
+
* text: string;
|
|
22
|
+
* visuallyHiddenText: string;
|
|
23
|
+
* };
|
|
24
|
+
* }>}
|
|
25
|
+
*/
|
|
26
|
+
formatAnswerForSummary(sectionSegment: string, journey: import("#journey").Journey, answer: Object): Array<{
|
|
27
|
+
key: string;
|
|
28
|
+
value: string | Object;
|
|
29
|
+
action: {
|
|
30
|
+
href: string;
|
|
31
|
+
text: string;
|
|
32
|
+
visuallyHiddenText: string;
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
import { Question } from '#question';
|
|
37
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/number-entry/question.js"],"names":[],"mappings":"AAGA;IACC;;;;OAIG;IACH,0CAJW,OAAO,iBAAiB,EAAE,kBAAkB,EAYtD;IAFA,YAAoB;IACpB,WAAkB;IAGnB,kDAEC;IAUD;;;;;;;;;;;;;;OAcG;IACH,wDAZW,OAAO,UAAU,EAAE,OAAO,UAD1B,MAAM,GAGJ,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,CAIJ;CACD;yBAjDwB,WAAW"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export default class RadioQuestion extends OptionsQuestion {
|
|
2
|
+
/**
|
|
3
|
+
* @param {Object} params
|
|
4
|
+
* @param {string} params.title
|
|
5
|
+
* @param {string} params.question
|
|
6
|
+
* @param {string} params.fieldName
|
|
7
|
+
* @param {string} [params.viewFolder]
|
|
8
|
+
* @param {string} [params.url]
|
|
9
|
+
* @param {string} [params.hint]
|
|
10
|
+
* @param {string} [params.pageTitle]
|
|
11
|
+
* @param {string} [params.description]
|
|
12
|
+
* @param {string} [params.label]
|
|
13
|
+
* @param {string} [params.html]
|
|
14
|
+
* @param {string} [params.legend] - optional legend, used instead of h1
|
|
15
|
+
* @param {Array.<import('../../questions/options-question.js').Option>} params.options
|
|
16
|
+
* @param {Array.<import('#base-validator').BaseValidator>} [params.validators]
|
|
17
|
+
* @param {boolean} [params.editable]
|
|
18
|
+
* @param {Object<string, any>} [params.viewData]
|
|
19
|
+
* @param {import('../../questions/question-types.js').ActionLink} [params.actionLink]
|
|
20
|
+
*/
|
|
21
|
+
constructor({ title, question, fieldName, viewFolder, url, hint, pageTitle, description, label, html, legend, options, validators, actionLink, editable, viewData }: {
|
|
22
|
+
title: string;
|
|
23
|
+
question: string;
|
|
24
|
+
fieldName: string;
|
|
25
|
+
viewFolder?: string | undefined;
|
|
26
|
+
url?: string | undefined;
|
|
27
|
+
hint?: string | undefined;
|
|
28
|
+
pageTitle?: string | undefined;
|
|
29
|
+
description?: string | undefined;
|
|
30
|
+
label?: string | undefined;
|
|
31
|
+
html?: string | undefined;
|
|
32
|
+
legend?: string | undefined;
|
|
33
|
+
options: Array<import("../../questions/options-question.js").Option>;
|
|
34
|
+
validators?: any[] | undefined;
|
|
35
|
+
editable?: boolean | undefined;
|
|
36
|
+
viewData?: {
|
|
37
|
+
[x: string]: any;
|
|
38
|
+
} | undefined;
|
|
39
|
+
actionLink?: import("../../questions/question-types.js").ActionLink | undefined;
|
|
40
|
+
});
|
|
41
|
+
label: string | undefined;
|
|
42
|
+
legend: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* returns the formatted answers values to be used to build task list elements
|
|
45
|
+
* @param {Object} answer
|
|
46
|
+
* @param {Journey} journey
|
|
47
|
+
* @param {String} sectionSegment
|
|
48
|
+
* @returns {Array.<Object>}
|
|
49
|
+
*/
|
|
50
|
+
formatAnswerForSummary(sectionSegment: string, journey: Journey, answer: Object): Array<Object>;
|
|
51
|
+
}
|
|
52
|
+
import OptionsQuestion from '../../questions/options-question.js';
|
|
53
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/radio/question.js"],"names":[],"mappings":"AAEA;IACC;;;;;;;;;;;;;;;;;;OAkBG;IACH,qKAjBG;QAAuB,KAAK,EAApB,MAAM;QACS,QAAQ,EAAvB,MAAM;QACS,SAAS,EAAxB,MAAM;QACU,UAAU;QACV,GAAG;QACH,IAAI;QACJ,SAAS;QACT,WAAW;QACX,KAAK;QACL,IAAI;QACJ,MAAM;QAC+C,OAAO,EAA5E,KAAK,CAAE,OAAO,qCAAqC,EAAE,MAAM,CAAC;QACH,UAAU;QAClD,QAAQ;QACI,QAAQ;;;QAC2B,UAAU;KAAC,EAuCrF;IAFA,0BAAkB;IAClB,2BAAoB;IAWrB;;;;;;OAMG;IACH,wDAJW,OAAO,UADP,MAAM,GAGJ,KAAK,CAAE,MAAM,CAAC,CAgB1B;CACD;4BA3F2B,qCAAqC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.test.d.ts","sourceRoot":"","sources":["../../../../src/components/radio/question.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export default class SelectQuestion extends OptionsQuestion {
|
|
2
|
+
/**
|
|
3
|
+
* @param {Object} params
|
|
4
|
+
* @param {string} params.title
|
|
5
|
+
* @param {string} params.question
|
|
6
|
+
* @param {string} params.fieldName
|
|
7
|
+
* @param {string} [params.viewFolder]
|
|
8
|
+
* @param {string} [params.url]
|
|
9
|
+
* @param {string} [params.hint]
|
|
10
|
+
* @param {string} [params.pageTitle]
|
|
11
|
+
* @param {string} [params.description]
|
|
12
|
+
* @param {string} [params.label]
|
|
13
|
+
* @param {string} [params.html]
|
|
14
|
+
* @param {string} [params.legend] - optional legend, used instead of h1
|
|
15
|
+
* @param {Array.<import('../../questions/options-question.js').Option>} params.options
|
|
16
|
+
* @param {Object<string, any>} [params.viewData]
|
|
17
|
+
* @param {Array.<import('#base-validator').BaseValidator>} [params.validators]
|
|
18
|
+
*/
|
|
19
|
+
constructor({ title, question, fieldName, viewFolder, url, hint, pageTitle, description, label, html, legend, options, validators, viewData }: {
|
|
20
|
+
title: string;
|
|
21
|
+
question: string;
|
|
22
|
+
fieldName: string;
|
|
23
|
+
viewFolder?: string | undefined;
|
|
24
|
+
url?: string | undefined;
|
|
25
|
+
hint?: string | undefined;
|
|
26
|
+
pageTitle?: string | undefined;
|
|
27
|
+
description?: string | undefined;
|
|
28
|
+
label?: string | undefined;
|
|
29
|
+
html?: string | undefined;
|
|
30
|
+
legend?: string | undefined;
|
|
31
|
+
options: Array<import("../../questions/options-question.js").Option>;
|
|
32
|
+
viewData?: {
|
|
33
|
+
[x: string]: any;
|
|
34
|
+
} | undefined;
|
|
35
|
+
validators?: any[] | undefined;
|
|
36
|
+
});
|
|
37
|
+
label: string | undefined;
|
|
38
|
+
legend: string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* returns the formatted answers values to be used to build task list elements
|
|
41
|
+
* note: only supports a single answer
|
|
42
|
+
*
|
|
43
|
+
* @param {Object} answer
|
|
44
|
+
* @param {Journey} journey
|
|
45
|
+
* @param {String} sectionSegment
|
|
46
|
+
* @returns {Array.<Object>}
|
|
47
|
+
*/
|
|
48
|
+
formatAnswerForSummary(sectionSegment: string, journey: Journey, answer: Object): Array<Object>;
|
|
49
|
+
}
|
|
50
|
+
import OptionsQuestion from '../../questions/options-question.js';
|
|
51
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/select/question.js"],"names":[],"mappings":"AAEA;IACC;;;;;;;;;;;;;;;;OAgBG;IACH,+IAfG;QAAuB,KAAK,EAApB,MAAM;QACS,QAAQ,EAAvB,MAAM;QACS,SAAS,EAAxB,MAAM;QACU,UAAU;QACV,GAAG;QACH,IAAI;QACJ,SAAS;QACT,WAAW;QACX,KAAK;QACL,IAAI;QACJ,MAAM;QAC+C,OAAO,EAA5E,KAAK,CAAE,OAAO,qCAAqC,EAAE,MAAM,CAAC;QAC/B,QAAQ;;;QACoB,UAAU;KAAC,EAmC9E;IAFA,0BAAkB;IAClB,2BAAoB;IAWrB;;;;;;;;OAQG;IACH,wDAJW,OAAO,UADP,MAAM,GAGJ,KAAK,CAAE,MAAM,CAAC,CAS1B;CACD;4BAhF2B,qCAAqC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.test.d.ts","sourceRoot":"","sources":["../../../../src/components/select/question.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @class
|
|
3
|
+
*/
|
|
4
|
+
export default class SingleLineInputQuestion extends Question {
|
|
5
|
+
/**
|
|
6
|
+
* @param {import('#question-types').QuestionParameters} params
|
|
7
|
+
* @param {string|undefined} [params.label] if defined this show as a label for the input and the question will just be a standard h1
|
|
8
|
+
* @param {Record<string, string>} [params.inputAttributes] html attributes to add to the input
|
|
9
|
+
* @param {string} [params.classes] html classes to add to the input
|
|
10
|
+
*/
|
|
11
|
+
constructor(params: import("#question-types").QuestionParameters);
|
|
12
|
+
/** @type {Record<string, string>} */
|
|
13
|
+
inputAttributes: Record<string, string>;
|
|
14
|
+
label: any;
|
|
15
|
+
classes: any;
|
|
16
|
+
}
|
|
17
|
+
import { Question } from '#question';
|
|
18
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/single-line-input/question.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IAIC;;;;;OAKG;IACH,oBALW,OAAO,iBAAiB,EAAE,kBAAkB,EActD;IAlBD,qCAAqC;IACrC,iBADW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CACjB;IAcf,WAAyB;IAEzB,aAAmC;CAepC;yBAtCwB,WAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.test.d.ts","sourceRoot":"","sources":["../../../../src/components/single-line-input/question.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {QuestionViewModel} from '#question'
|
|
3
|
+
* @import {Journey} from '#journey'
|
|
4
|
+
* @import {JourneyResponse} from '#journey-response'
|
|
5
|
+
* @import {Section} from '#section'
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} TextEntryCheckbox
|
|
9
|
+
* @property {string} header
|
|
10
|
+
* @property {string} text
|
|
11
|
+
* @property {string} name
|
|
12
|
+
* @property {string} [errorMessage]
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* @class
|
|
16
|
+
*/
|
|
17
|
+
export default class TextEntryQuestion extends Question {
|
|
18
|
+
/**
|
|
19
|
+
* @param {import('#question-types').QuestionParameters} params
|
|
20
|
+
* @param {TextEntryCheckbox} [params.textEntryCheckbox]
|
|
21
|
+
* @param {string|undefined} [params.label] if defined this show as a label for the input and the question will just be a standard h1
|
|
22
|
+
*/
|
|
23
|
+
constructor({ textEntryCheckbox, label, ...params }: import("#question-types").QuestionParameters);
|
|
24
|
+
textEntryCheckbox: any;
|
|
25
|
+
label: any;
|
|
26
|
+
}
|
|
27
|
+
export type TextEntryCheckbox = {
|
|
28
|
+
header: string;
|
|
29
|
+
text: string;
|
|
30
|
+
name: string;
|
|
31
|
+
errorMessage?: string | undefined;
|
|
32
|
+
};
|
|
33
|
+
import { Question } from '#question';
|
|
34
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/text-entry/question.js"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH;;;;;;GAMG;AAEH;;GAEG;AACH;IACC;;;;OAIG;IACH,qDAJW,OAAO,iBAAiB,EAAE,kBAAkB,EAYtD;IAFA,uBAA0C;IAC1C,WAAkB;CAUnB;;YAhCa,MAAM;UACN,MAAM;UACN,MAAM;;;yBAZK,WAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.test.d.ts","sourceRoot":"","sources":["../../../../src/components/text-entry/question.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const REDACT_CHARACTER: "\u2588";
|
|
2
|
+
export const TRUNCATED_MAX_LENGTH: 500;
|
|
3
|
+
/**
|
|
4
|
+
* @class
|
|
5
|
+
*/
|
|
6
|
+
export default class TextEntryRedactQuestion extends Question {
|
|
7
|
+
/**
|
|
8
|
+
* @param {import('#question-types').QuestionParameters} params
|
|
9
|
+
* @param {import('../text-entry/question.js').TextEntryCheckbox} [params.textEntryCheckbox]
|
|
10
|
+
* @param {string|undefined} [params.label] if defined this show as a label for the input and the question will just be a standard h1
|
|
11
|
+
* @param {boolean} [params.onlyShowRedactedValueForSummary] whether to only show redacted value for summary
|
|
12
|
+
* @param {boolean} [params.useRedactedFieldNameForSave] whether to use the redacted field name when saving answers
|
|
13
|
+
* @param {boolean} [params.showSuggestionsUi] use the suggestions UI for this question
|
|
14
|
+
* @param {string} [params.summaryText] summaryText to use with the details component
|
|
15
|
+
* @param {boolean} [params.shouldTruncateSummary] determines whether redacted comment is truncated in summary view
|
|
16
|
+
*/
|
|
17
|
+
constructor({ textEntryCheckbox, label, onlyShowRedactedValueForSummary, useRedactedFieldNameForSave, showSuggestionsUi, summaryText, shouldTruncateSummary, ...params }: import("#question-types").QuestionParameters);
|
|
18
|
+
textEntryCheckbox: any;
|
|
19
|
+
label: any;
|
|
20
|
+
onlyShowRedactedValueForSummary: any;
|
|
21
|
+
useRedactedFieldNameForSave: any;
|
|
22
|
+
showSuggestionsUi: any;
|
|
23
|
+
summaryText: any;
|
|
24
|
+
shouldTruncateSummary: any;
|
|
25
|
+
prepQuestionForRendering(section: any, journey: any, customViewData: any, payload: any, options: any): import("#question").QuestionViewModel;
|
|
26
|
+
answerForViewModel(answers: any): string;
|
|
27
|
+
formatAnswerForSummary(sectionSegment: any, journey: any, answer: any, capitals?: boolean): {
|
|
28
|
+
key: string;
|
|
29
|
+
value: string | Object;
|
|
30
|
+
action: {
|
|
31
|
+
href: string;
|
|
32
|
+
text: string;
|
|
33
|
+
visuallyHiddenText: string;
|
|
34
|
+
};
|
|
35
|
+
}[] | {
|
|
36
|
+
key: string;
|
|
37
|
+
value: string;
|
|
38
|
+
action: import("../../controller.js").ActionView | import("../../controller.js").ActionView[] | undefined;
|
|
39
|
+
}[];
|
|
40
|
+
}
|
|
41
|
+
import { Question } from '#question';
|
|
42
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/text-entry-redact/question.js"],"names":[],"mappings":"AAGA,+BAAgC,QAAG,CAAC;AACpC,mCAAoC,GAAG,CAAC;AAExC;;GAEG;AACH;IACC;;;;;;;;;OASG;IACH,0KATW,OAAO,iBAAiB,EAAE,kBAAkB,EA+BtD;IAPA,uBAA0C;IAC1C,WAAkB;IAClB,qCAAsE;IACtE,iCAA8D;IAC9D,uBAA0C;IAC1C,iBAA8B;IAC9B,2BAAkD;IAkBnD,6IAOC;IAED,yCAEC;IAYD;;;;;;;;;;;;QAuBC;CACD;yBA1GwB,WAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.test.d.ts","sourceRoot":"","sources":["../../../../src/components/text-entry-redact/question.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UnitOptions are the options displayed in the radio format - in this case the value
|
|
3
|
+
* represents the unit.
|
|
4
|
+
* Conditionals must be used to capture the relevant quantity.
|
|
5
|
+
* Each conditional must have a fieldName which uses the conditionalFieldName from the
|
|
6
|
+
* UnitOptionEntryQuestion object as a base, followed by an underscore and unit reference
|
|
7
|
+
* eg 'siteAreaSquareMetres_hectares' - this is required for validation and saving to the DB
|
|
8
|
+
* @typedef {{
|
|
9
|
+
* text: string;
|
|
10
|
+
* value: string;
|
|
11
|
+
* hint?: object;
|
|
12
|
+
* checked?: boolean | undefined;
|
|
13
|
+
* attributes?: Record<string, string>;
|
|
14
|
+
* behaviour?: 'exclusive';
|
|
15
|
+
* conditional: {
|
|
16
|
+
* fieldName: string;
|
|
17
|
+
* suffix: string;
|
|
18
|
+
* value?: unknown;
|
|
19
|
+
* label?: string;
|
|
20
|
+
* hint?: string;
|
|
21
|
+
* conversionFactor?: number;
|
|
22
|
+
* }
|
|
23
|
+
*}} UnitOption
|
|
24
|
+
*/
|
|
25
|
+
export default class UnitOptionEntryQuestion extends Question {
|
|
26
|
+
/** @type {Array<UnitOption>} */
|
|
27
|
+
options: Array<UnitOption>;
|
|
28
|
+
conditionalFieldName: any;
|
|
29
|
+
label: any;
|
|
30
|
+
optionJoinString: string;
|
|
31
|
+
/**
|
|
32
|
+
* gets the view model for this question
|
|
33
|
+
* @param {import('../../section').Section} section - the current section
|
|
34
|
+
* @param {import('#journey').Journey} journey - the journey we are in
|
|
35
|
+
* @param {Record<string, unknown>} [customViewData] additional data to send to view
|
|
36
|
+
* @param {Record<string, unknown>} [payload]
|
|
37
|
+
* @param {import('#src/questions/question-types.d.ts').PrepQuestionForRenderingOptions} options
|
|
38
|
+
* @returns {import('#question').QuestionViewModel & {
|
|
39
|
+
* question: import('#question').QuestionViewModel['question'] & {
|
|
40
|
+
* options:UnitOption[]
|
|
41
|
+
* }
|
|
42
|
+
* }}
|
|
43
|
+
*/
|
|
44
|
+
prepQuestionForRendering(section: any, journey: import("#journey").Journey, customViewData?: Record<string, unknown>, payload?: Record<string, unknown>, options: import("#src/questions/question-types.d.ts").PrepQuestionForRenderingOptions): import("#question").QuestionViewModel & {
|
|
45
|
+
question: import("#question").QuestionViewModel["question"] & {
|
|
46
|
+
options: UnitOption[];
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Get the data to save from the request, returns an object of answers
|
|
51
|
+
* @param {import('express').Request} req
|
|
52
|
+
* @param {JourneyResponse} journeyResponse - current journey response, modified with the new answers
|
|
53
|
+
* @returns {Promise<{ answers: Record<string, unknown> }>}
|
|
54
|
+
*/ getDataToSave(req: any, journeyResponse: JourneyResponse): Promise<{
|
|
55
|
+
answers: Record<string, unknown>;
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* UnitOptions are the options displayed in the radio format - in this case the value
|
|
60
|
+
* represents the unit.
|
|
61
|
+
* Conditionals must be used to capture the relevant quantity.
|
|
62
|
+
* Each conditional must have a fieldName which uses the conditionalFieldName from the
|
|
63
|
+
* UnitOptionEntryQuestion object as a base, followed by an underscore and unit reference
|
|
64
|
+
* eg 'siteAreaSquareMetres_hectares' - this is required for validation and saving to the DB
|
|
65
|
+
*/
|
|
66
|
+
export type UnitOption = {
|
|
67
|
+
text: string;
|
|
68
|
+
value: string;
|
|
69
|
+
hint?: object;
|
|
70
|
+
checked?: boolean | undefined;
|
|
71
|
+
attributes?: Record<string, string>;
|
|
72
|
+
behaviour?: "exclusive";
|
|
73
|
+
conditional: {
|
|
74
|
+
fieldName: string;
|
|
75
|
+
suffix: string;
|
|
76
|
+
value?: unknown;
|
|
77
|
+
label?: string;
|
|
78
|
+
hint?: string;
|
|
79
|
+
conversionFactor?: number;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
import { Question } from '../../questions/question.js';
|
|
83
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/unit-option-entry/question.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;IACC,gCAAgC;IAChC,SADW,KAAK,CAAC,UAAU,CAAC,CACpB;IAqBP,0BAAgD;IAEhD,WAAkB;IAClB,yBAA+C;IAGhD;;;;;;;;;;;;OAYG;IACH,gDAVW,OAAO,UAAU,EAAE,OAAO,mBAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YACvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WACvB,OAAO,oCAAoC,EAAE,+BAA+B,GAC1E,OAAO,WAAW,EAAE,iBAAiB,GAAG;QAChD,QAAQ,EAAE,OAAO,WAAW,EAAE,iBAAiB,CAAC,UAAU,CAAC,GAAG;YAC5D,OAAO,EAAC,UAAU,EAAE,CAAA;SACrB,CAAA;KACF,CAmDH;IAED;;;;;OAKG,CACH,yCAHW,eAAe,GACb,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAgCzD;CAoBD;;;;;;;;;yBAvKY;IACR,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,WAAW,EAAE;QACX,SAAS,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,OAAO,CAAC;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAA;CACH;yBA3BsB,6BAA6B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.test.d.ts","sourceRoot":"","sources":["../../../../src/components/unit-option-entry/question.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const COMPONENT_TYPES: Readonly<{
|
|
2
|
+
CHECKBOX: "checkbox";
|
|
3
|
+
BOOLEAN: "boolean";
|
|
4
|
+
RADIO: "radio";
|
|
5
|
+
DATE: "date";
|
|
6
|
+
DATE_PERIOD: "date-period";
|
|
7
|
+
DATE_TIME: "date-time";
|
|
8
|
+
TEXT_ENTRY: "text-entry";
|
|
9
|
+
TEXT_ENTRY_REDACT: "text-entry-redact";
|
|
10
|
+
SELECT: "select";
|
|
11
|
+
SINGLE_LINE_INPUT: "single-line-input";
|
|
12
|
+
MULTI_FIELD_INPUT: "multi-field-input";
|
|
13
|
+
NUMBER: "number";
|
|
14
|
+
ADDRESS: "site-address";
|
|
15
|
+
UNIT_OPTION: "unit-option";
|
|
16
|
+
EMAIL: "email";
|
|
17
|
+
MANAGE_LIST: "manage-list";
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=component-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-types.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/component-types.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persisted-number-answer.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/persisted-number-answer.js"],"names":[],"mappings":"AAGO,iDAFI,MAAM,mBAYhB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function logicalCombinations(response: import("#src/journey/journey-response.js").JourneyResponse): {
|
|
2
|
+
and: CombinationFunc;
|
|
3
|
+
or: CombinationFunc;
|
|
4
|
+
};
|
|
5
|
+
export function whenQuestionHasAnswer(question: import("#question").Question, expectedValue: unknown): import("#src/section.js").QuestionCondition;
|
|
6
|
+
export function questionHasAnswer(response: import("#src/journey/journey-response.js").JourneyResponse, question: import("#question").Question | {
|
|
7
|
+
optionJoinString: string;
|
|
8
|
+
}, expectedValue: unknown): boolean;
|
|
9
|
+
export function questionArrayMeetsCondition(response: JourneyResponse, question: any, conditionFn?: (item: any) => boolean): boolean;
|
|
10
|
+
export function questionsHaveAnswers(response: import("#src/journey/journey-response.js").JourneyResponse, questionKeyTuples: QuestionKeyTuples, { logicalCombinator }?: {
|
|
11
|
+
logicalCombinator: "and" | "or";
|
|
12
|
+
}): boolean;
|
|
13
|
+
export function questionHasNonEmptyStringAnswer(response: import("#src/journey/journey-response.js").JourneyResponse, question: import("#question").Question): boolean;
|
|
14
|
+
export function questionHasNonEmptyNumberAnswer(response: import("#src/journey/journey-response.js").JourneyResponse, question: import("#question").Question): boolean;
|
|
15
|
+
export type QuestionKeyTuples = [any, unknown][];
|
|
16
|
+
export type CombinationFunc = (questionKeyTuples: QuestionKeyTuples) => boolean;
|
|
17
|
+
//# sourceMappingURL=question-has-answer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question-has-answer.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/question-has-answer.js"],"names":[],"mappings":"AAOO,8CAHI,OAAO,kCAAkC,EAAE,eAAe,GACxD;IAAC,GAAG,EAAE,eAAe,CAAC;IAAC,EAAE,EAAE,eAAe,CAAA;CAAC,CAOtD;AAYK,gDAJI,OAAO,WAAW,EAAE,QAAQ,iBAC5B,OAAO,GACL,OAAO,iBAAiB,EAAE,iBAAiB,CAIvD;AAUM,4CALI,OAAO,kCAAkC,EAAE,eAAe,YAC1D,OAAO,WAAW,EAAE,QAAQ,GAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAC,iBACvD,OAAO,GACL,OAAO,CAgBnB;AAUM,sDALI,eAAe,YACf,GAAG,gBACH,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,GACpB,OAAO,CAWnB;AASM,+CANI,OAAO,kCAAkC,EAAE,eAAe,qBAC1D,iBAAiB,0BAEzB;IAA8B,iBAAiB,EAAvC,KAAK,GAAG,IAAI;CACpB,GAAU,OAAO,CAUnB;AAOM,0DAJI,OAAO,kCAAkC,EAAE,eAAe,YAC1D,OAAO,WAAW,EAAE,QAAQ,GAC1B,OAAO,CAMnB;AAOM,0DAJI,OAAO,kCAAkC,EAAE,eAAe,YAC1D,OAAO,WAAW,EAAE,QAAQ,GAC1B,OAAO,CAMnB;gCA5Ga,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE;8BAChB,CAAC,iBAAiB,EAAE,iBAAiB,KAAK,OAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question-has-answer.test.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/question-has-answer.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function getConditionalFieldName(parentField: any, conditionalField: any): string;
|
|
2
|
+
export function getConditionalAnswer(answers: any, question: any, answer: any): any;
|
|
3
|
+
/**
|
|
4
|
+
* @param {unknown} conditional
|
|
5
|
+
* @returns {conditional is {html: string}}
|
|
6
|
+
*/
|
|
7
|
+
export function conditionalIsJustHTML(conditional: unknown): conditional is {
|
|
8
|
+
html: string;
|
|
9
|
+
};
|
|
10
|
+
declare namespace _default {
|
|
11
|
+
export { getConditionalAnswer };
|
|
12
|
+
export { getConditionalFieldName };
|
|
13
|
+
}
|
|
14
|
+
export default _default;
|
|
15
|
+
//# sourceMappingURL=question-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question-utils.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/question-utils.js"],"names":[],"mappings":"AAAA,yFAEC;AAED,oFAGC;AAED;;;GAGG;AACH,mDAHW,OAAO,GACL,WAAW,IAAI;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAIzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question-utils.test.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/question-utils.test.js"],"names":[],"mappings":""}
|