@planning-inspectorate/dynamic-forms 3.10.4 → 3.10.6
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/package.json +1 -1
- package/src/components/address/question.js +3 -1
- package/src/components/boolean/question.js +3 -1
- package/src/components/checkbox/question.js +3 -1
- package/src/components/date/question.js +3 -1
- package/src/components/date-period/question.js +3 -1
- package/src/components/date-time/question.js +3 -1
- package/src/components/email/question.js +3 -1
- package/src/components/identifier/question.js +3 -1
- package/src/components/manage-list/question.js +3 -1
- package/src/components/multi-field-input/question.js +5 -37
- package/src/components/multi-field-input/question.test.js +2 -6
- package/src/components/number-entry/question.js +3 -1
- package/src/components/radio/question.js +3 -1
- package/src/components/select/question.js +3 -1
- package/src/components/single-line-input/question.js +3 -1
- package/src/components/text-entry/question.js +3 -1
- package/src/components/text-entry-redact/question.js +3 -1
- package/src/components/unit-option-entry/question.js +3 -1
- package/src/index.js +6 -3
- package/src/index.test.js +26 -1
- package/src/questions/question-props.d.ts +12 -4
- package/src/questions/question.js +2 -6
- package/types/src/components/address/question.d.ts +2 -1
- package/types/src/components/address/question.d.ts.map +1 -1
- package/types/src/components/boolean/question.d.ts +2 -1
- package/types/src/components/boolean/question.d.ts.map +1 -1
- package/types/src/components/checkbox/question.d.ts +2 -1
- package/types/src/components/checkbox/question.d.ts.map +1 -1
- package/types/src/components/date/question.d.ts +2 -1
- package/types/src/components/date/question.d.ts.map +1 -1
- package/types/src/components/date-period/question.d.ts +2 -1
- package/types/src/components/date-period/question.d.ts.map +1 -1
- package/types/src/components/date-time/question.d.ts +2 -1
- package/types/src/components/date-time/question.d.ts.map +1 -1
- package/types/src/components/email/question.d.ts +2 -1
- package/types/src/components/email/question.d.ts.map +1 -1
- package/types/src/components/identifier/question.d.ts +2 -1
- package/types/src/components/identifier/question.d.ts.map +1 -1
- package/types/src/components/manage-list/question.d.ts +2 -1
- package/types/src/components/manage-list/question.d.ts.map +1 -1
- package/types/src/components/multi-field-input/question.d.ts +19 -64
- package/types/src/components/multi-field-input/question.d.ts.map +1 -1
- package/types/src/components/number-entry/question.d.ts +2 -1
- package/types/src/components/number-entry/question.d.ts.map +1 -1
- package/types/src/components/radio/question.d.ts +2 -1
- package/types/src/components/radio/question.d.ts.map +1 -1
- package/types/src/components/select/question.d.ts +2 -1
- package/types/src/components/select/question.d.ts.map +1 -1
- package/types/src/components/single-line-input/question.d.ts +2 -1
- package/types/src/components/single-line-input/question.d.ts.map +1 -1
- package/types/src/components/text-entry/question.d.ts +2 -1
- package/types/src/components/text-entry/question.d.ts.map +1 -1
- package/types/src/components/text-entry-redact/question.d.ts +3 -10
- package/types/src/components/text-entry-redact/question.d.ts.map +1 -1
- package/types/src/components/unit-option-entry/question.d.ts +2 -1
- package/types/src/components/unit-option-entry/question.d.ts.map +1 -1
- package/types/src/index.d.ts +4 -2
- package/types/src/index.d.ts.map +1 -1
- package/types/src/questions/question-props.d.ts +12 -4
- package/types/src/questions/question.d.ts +4 -12
- package/types/src/questions/question.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { Address } from '../../lib/address.js';
|
|
|
5
5
|
import { nl2br } from '../../lib/utils.js';
|
|
6
6
|
import AddressValidator from '../../validator/address-validator.js';
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export class AddressQuestion extends Question {
|
|
9
9
|
/**
|
|
10
10
|
* @param {import('#question-types').QuestionParameters} params
|
|
11
11
|
*/
|
|
@@ -135,3 +135,5 @@ export default class AddressQuestion extends Question {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
+
|
|
139
|
+
export default AddressQuestion;
|
|
@@ -31,7 +31,7 @@ export const booleanToYesNoOrNull = (value) => {
|
|
|
31
31
|
return null;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
export
|
|
34
|
+
export class BooleanQuestion extends RadioQuestion {
|
|
35
35
|
/**
|
|
36
36
|
* @param {Object} params
|
|
37
37
|
* @param {string} params.title
|
|
@@ -120,3 +120,5 @@ export default class BooleanQuestion extends RadioQuestion {
|
|
|
120
120
|
return { answers };
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
+
|
|
124
|
+
export default BooleanQuestion;
|
|
@@ -10,7 +10,7 @@ const defaultOptionJoinString = ',';
|
|
|
10
10
|
* @property {string} conditional the conditional text input
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export class CheckboxQuestion extends OptionsQuestion {
|
|
14
14
|
/**
|
|
15
15
|
* @param {Object} params
|
|
16
16
|
* @param {string} params.title
|
|
@@ -86,3 +86,5 @@ export default class CheckboxQuestion extends OptionsQuestion {
|
|
|
86
86
|
return super.formatAnswerForSummary(sectionSegment, journey, formattedAnswer, false);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
|
|
90
|
+
export default CheckboxQuestion;
|
|
@@ -6,7 +6,7 @@ const DEFAULT_DATE_FORMAT = 'd MMMM yyyy';
|
|
|
6
6
|
/**
|
|
7
7
|
* @class
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export class DateQuestion extends Question {
|
|
10
10
|
/**
|
|
11
11
|
* @param {import('#question-types').QuestionParameters} params
|
|
12
12
|
* @param {string} [params.dateFormat]
|
|
@@ -82,3 +82,5 @@ export default class DateQuestion extends Question {
|
|
|
82
82
|
return [{ key: key, value: formattedAnswer, action: action }];
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
+
|
|
86
|
+
export default DateQuestion;
|
|
@@ -9,7 +9,7 @@ const DEFAULT_DATE_FORMAT = 'HH:mm d MMMM yyyy';
|
|
|
9
9
|
* Represents a date period, two dates which make up a period or range
|
|
10
10
|
* @class
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export class DatePeriodQuestion extends Question {
|
|
13
13
|
/**
|
|
14
14
|
* @param {import('#question-types').QuestionParameters} params
|
|
15
15
|
* @param {string} [params.dateFormat]
|
|
@@ -153,3 +153,5 @@ export default class DatePeriodQuestion extends Question {
|
|
|
153
153
|
return [{ key: key, value: formattedAnswer, action: action }];
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
+
|
|
157
|
+
export default DatePeriodQuestion;
|
|
@@ -4,7 +4,7 @@ import { formatDateForDisplay, parseDateInput } from '../../lib/date-utils.js';
|
|
|
4
4
|
const DEFAULT_DATE_FORMAT = 'd MMMM yyyy';
|
|
5
5
|
const DEFAULT_TIME_FORMAT = 'HH:mma';
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export class DateTimeQuestion extends Question {
|
|
8
8
|
static AM = 'am';
|
|
9
9
|
static PM = 'pm';
|
|
10
10
|
|
|
@@ -123,3 +123,5 @@ export default class DateTimeQuestion extends Question {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
+
|
|
127
|
+
export default DateTimeQuestion;
|
|
@@ -13,7 +13,7 @@ import SingleLineInputQuestion from '../single-line-input/question.js';
|
|
|
13
13
|
* Automatically sets the input type to "email" and adds appropriate attributes
|
|
14
14
|
* @class
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export class EmailQuestion extends SingleLineInputQuestion {
|
|
17
17
|
/**
|
|
18
18
|
* @param {import('#question-types').QuestionParameters} params
|
|
19
19
|
* @param {string|undefined} [params.label] if defined this show as a label for the input and the question will just be a standard h1
|
|
@@ -53,3 +53,5 @@ export default class EmailQuestion extends SingleLineInputQuestion {
|
|
|
53
53
|
return super.formatAnswerForSummary(sectionSegment, journey, answer, false);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
+
|
|
57
|
+
export default EmailQuestion;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Question } from '#question';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export class IdentifierQuestion extends Question {
|
|
4
4
|
/** @type {string|undefined} page h1, optional, will default to use question's label */
|
|
5
5
|
pageHeading;
|
|
6
6
|
/** @type {string} css classes to apply to input element */
|
|
@@ -29,3 +29,5 @@ export default class IdentifierQuestion extends Question {
|
|
|
29
29
|
viewModel.question.label = this.label;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
export default IdentifierQuestion;
|
|
@@ -11,7 +11,7 @@ import { MANAGE_LIST_ACTIONS } from './manage-list-actions.js';
|
|
|
11
11
|
* @property {string} [confirmationQuestion] - the name of the confirmation question to use when removing an item, default 'confirm'
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export class ManageListQuestion extends Question {
|
|
15
15
|
/** @type {import('../../section.js').Section} */
|
|
16
16
|
#section;
|
|
17
17
|
/** @type {boolean} */
|
|
@@ -187,3 +187,5 @@ export default class ManageListQuestion extends Question {
|
|
|
187
187
|
this.#section = section;
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
+
|
|
191
|
+
export default ManageListQuestion;
|
|
@@ -10,44 +10,18 @@ import { nl2br } from '../../lib/utils.js';
|
|
|
10
10
|
* @typedef {import('../../validator/base-validator')} BaseValidator
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* @typedef {Object} Suffix
|
|
15
|
-
* @property {string} text
|
|
16
|
-
* @property {string} [classes] optional property, used to add classes to the suffix/prefix
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @typedef {Object} InputField
|
|
21
|
-
* @property {string} fieldName
|
|
22
|
-
* @property {string} label
|
|
23
|
-
* @property {string} [formatJoinString] optional property, used by formatAnswerForSummary (eg task list display), effective default to line break
|
|
24
|
-
* @property {string} [formatPrefix] optional property, used by formatAnswerForSummary (eg task list display), to prefix answer
|
|
25
|
-
* @property {function} [formatTextFunction] optional property, used to format the answer for display and value in question
|
|
26
|
-
* @property {Record<string, string>} [attributes] optional property, used to add html attributes to the field
|
|
27
|
-
* @property {Suffix} [suffix] optional property, used to add a suffix to the field
|
|
28
|
-
* @property {Suffix} [prefix] optional property, used to add a prefix to the field
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
13
|
/**
|
|
32
14
|
* @class
|
|
33
15
|
*/
|
|
34
|
-
export
|
|
35
|
-
/** @type {Record<string, string>} */
|
|
36
|
-
inputAttributes;
|
|
37
|
-
|
|
16
|
+
export class MultiFieldInputQuestion extends Question {
|
|
38
17
|
/**
|
|
39
|
-
* @param {import('#question-
|
|
40
|
-
* @param {string|undefined} [params.label] if defined this show as a label for the input and the question will just be a standard h1
|
|
41
|
-
* @param {Record<string, string>} [params.inputAttributes] html attributes to add to the input
|
|
42
|
-
* @param {InputField[]} params.inputFields input fields
|
|
18
|
+
* @param {import('#src/questions/question-props.d.ts').MultiFieldInputQuestionProps} params
|
|
43
19
|
*/
|
|
44
|
-
constructor({
|
|
20
|
+
constructor({ inputFields, ...params }) {
|
|
45
21
|
super({
|
|
46
22
|
...params,
|
|
47
23
|
viewFolder: 'multi-field-input'
|
|
48
24
|
});
|
|
49
|
-
this.label = label;
|
|
50
|
-
this.inputAttributes = inputAttributes;
|
|
51
25
|
|
|
52
26
|
if (inputFields) {
|
|
53
27
|
this.inputFields = inputFields;
|
|
@@ -65,14 +39,6 @@ export default class MultiFieldInputQuestion extends Question {
|
|
|
65
39
|
});
|
|
66
40
|
}
|
|
67
41
|
|
|
68
|
-
/**
|
|
69
|
-
* @param {import('#question').QuestionViewModel} viewModel
|
|
70
|
-
*/
|
|
71
|
-
addCustomDataToViewModel(viewModel) {
|
|
72
|
-
viewModel.question.label = this.label;
|
|
73
|
-
viewModel.question.attributes = this.inputAttributes;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
42
|
/**
|
|
77
43
|
* Get the data to save from the request, returns an object of answers
|
|
78
44
|
* @param {import('express').Request} req
|
|
@@ -149,3 +115,5 @@ export default class MultiFieldInputQuestion extends Question {
|
|
|
149
115
|
return valueToFormat;
|
|
150
116
|
}
|
|
151
117
|
}
|
|
118
|
+
|
|
119
|
+
export default MultiFieldInputQuestion;
|
|
@@ -9,7 +9,6 @@ const FIELDNAME = 'field-name';
|
|
|
9
9
|
const VALIDATORS = [1, 2];
|
|
10
10
|
const HTML = '/path/to/html.njk';
|
|
11
11
|
const HINT = 'hint';
|
|
12
|
-
const LABEL = 'A label';
|
|
13
12
|
const INPUTFIELDS = [{ fieldName: 'testField1' }, { fieldName: 'testField2' }];
|
|
14
13
|
|
|
15
14
|
function createMultiFieldInputQuestion(
|
|
@@ -19,7 +18,6 @@ function createMultiFieldInputQuestion(
|
|
|
19
18
|
validators = VALIDATORS,
|
|
20
19
|
html = HTML,
|
|
21
20
|
hint = HINT,
|
|
22
|
-
label = LABEL,
|
|
23
21
|
inputFields = INPUTFIELDS
|
|
24
22
|
) {
|
|
25
23
|
return new MultiFieldInputQuestion({
|
|
@@ -29,7 +27,6 @@ function createMultiFieldInputQuestion(
|
|
|
29
27
|
validators: validators,
|
|
30
28
|
html: html,
|
|
31
29
|
hint: hint,
|
|
32
|
-
label: label,
|
|
33
30
|
inputFields: inputFields
|
|
34
31
|
});
|
|
35
32
|
}
|
|
@@ -45,13 +42,12 @@ describe('./src/dynamic-forms/components/multi-field-input/question.js', () => {
|
|
|
45
42
|
assert.strictEqual(testQuestion.validators, VALIDATORS);
|
|
46
43
|
assert.strictEqual(testQuestion.html, HTML);
|
|
47
44
|
assert.strictEqual(testQuestion.hint, HINT);
|
|
48
|
-
assert.strictEqual(testQuestion.label, LABEL);
|
|
49
45
|
assert.strictEqual(testQuestion.inputFields, INPUTFIELDS);
|
|
50
46
|
});
|
|
51
47
|
|
|
52
48
|
it('should throw error if no inputFields parameter is passed to the constructor', () => {
|
|
53
49
|
assert.throws(() => {
|
|
54
|
-
createMultiFieldInputQuestion(TITLE, QUESTION, FIELDNAME, VALIDATORS, HTML, HINT,
|
|
50
|
+
createMultiFieldInputQuestion(TITLE, QUESTION, FIELDNAME, VALIDATORS, HTML, HINT, null);
|
|
55
51
|
}, new Error('inputFields are mandatory'));
|
|
56
52
|
});
|
|
57
53
|
|
|
@@ -118,7 +114,7 @@ describe('./src/dynamic-forms/components/multi-field-input/question.js', () => {
|
|
|
118
114
|
});
|
|
119
115
|
it('should set inputFields with formatted values from journey response if formatTextFunction is provided', () => {
|
|
120
116
|
const formatTextFunction = (value) => `Formatted: ${value}`;
|
|
121
|
-
const question = createMultiFieldInputQuestion(TITLE, QUESTION, FIELDNAME, VALIDATORS, HTML, HINT,
|
|
117
|
+
const question = createMultiFieldInputQuestion(TITLE, QUESTION, FIELDNAME, VALIDATORS, HTML, HINT, [
|
|
122
118
|
{ fieldName: 'testField1', formatTextFunction },
|
|
123
119
|
{ fieldName: 'testField2', formatTextFunction }
|
|
124
120
|
]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Question } from '#question';
|
|
2
2
|
import { getPersistedNumberAnswer } from '../utils/persisted-number-answer.js';
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export class NumberEntryQuestion extends Question {
|
|
5
5
|
/**
|
|
6
6
|
* @param {import('#question-types').QuestionParameters} params
|
|
7
7
|
* @param {string} [params.suffix]
|
|
@@ -48,3 +48,5 @@ export default class NumberEntryQuestion extends Question {
|
|
|
48
48
|
return super.formatAnswerForSummary(sectionSegment, journey, answer, false);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
export default NumberEntryQuestion;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import OptionsQuestion from '../../questions/options-question.js';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export class RadioQuestion extends OptionsQuestion {
|
|
4
4
|
/**
|
|
5
5
|
* @param {Object} params
|
|
6
6
|
* @param {string} params.title
|
|
@@ -90,3 +90,5 @@ export default class RadioQuestion extends OptionsQuestion {
|
|
|
90
90
|
return super.formatAnswerForSummary(sectionSegment, journey, answer);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
+
|
|
94
|
+
export default RadioQuestion;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import OptionsQuestion from '../../questions/options-question.js';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export class SelectQuestion extends OptionsQuestion {
|
|
4
4
|
#disableAccessibleAutocomplete;
|
|
5
5
|
/**
|
|
6
6
|
* @param {Object} params
|
|
@@ -84,3 +84,5 @@ export default class SelectQuestion extends OptionsQuestion {
|
|
|
84
84
|
return super.formatAnswerForSummary(sectionSegment, journey, answer);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
|
|
88
|
+
export default SelectQuestion;
|
|
@@ -3,7 +3,7 @@ import { Question } from '#question';
|
|
|
3
3
|
/**
|
|
4
4
|
* @class
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export class SingleLineInputQuestion extends Question {
|
|
7
7
|
/** @type {Record<string, string>} */
|
|
8
8
|
inputAttributes;
|
|
9
9
|
|
|
@@ -37,3 +37,5 @@ export default class SingleLineInputQuestion extends Question {
|
|
|
37
37
|
viewModel.question.classes = this.classes;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
export default SingleLineInputQuestion;
|
|
@@ -17,7 +17,7 @@ import { Question } from '#question';
|
|
|
17
17
|
/**
|
|
18
18
|
* @class
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export class TextEntryQuestion extends Question {
|
|
21
21
|
/**
|
|
22
22
|
* @param {import('#question-types').QuestionParameters} params
|
|
23
23
|
* @param {TextEntryCheckbox} [params.textEntryCheckbox]
|
|
@@ -41,3 +41,5 @@ export default class TextEntryQuestion extends Question {
|
|
|
41
41
|
viewModel.question.textEntryCheckbox = this.textEntryCheckbox;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
export default TextEntryQuestion;
|
|
@@ -7,7 +7,7 @@ export const TRUNCATED_MAX_LENGTH = 500;
|
|
|
7
7
|
/**
|
|
8
8
|
* @class
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export class TextEntryRedactQuestion extends Question {
|
|
11
11
|
/**
|
|
12
12
|
* @param {import('#question-types').QuestionParameters} params
|
|
13
13
|
* @param {import('../text-entry/question.js').TextEntryCheckbox} [params.textEntryCheckbox]
|
|
@@ -105,3 +105,5 @@ export default class TextEntryRedactQuestion extends Question {
|
|
|
105
105
|
return super.formatAnswerForSummary(sectionSegment, journey, toShow, capitals);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
+
|
|
109
|
+
export default TextEntryRedactQuestion;
|
|
@@ -30,7 +30,7 @@ const defaultOptionJoinString = ',';
|
|
|
30
30
|
*}} UnitOption
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
export
|
|
33
|
+
export class UnitOptionEntryQuestion extends Question {
|
|
34
34
|
/** @type {Array<UnitOption>} */
|
|
35
35
|
options;
|
|
36
36
|
|
|
@@ -180,3 +180,5 @@ export default class UnitOptionEntryQuestion extends Question {
|
|
|
180
180
|
return super.formatAnswerForSummary(sectionSegment, journey, formattedAnswer, false);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
+
|
|
184
|
+
export default UnitOptionEntryQuestion;
|
package/src/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// Components
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { AddressQuestion };
|
|
2
|
+
export * from './components/address/question.js';
|
|
5
3
|
export * from './components/boolean/question.js';
|
|
6
4
|
export * from './components/checkbox/question.js';
|
|
7
5
|
export * from './components/date/question.js';
|
|
8
6
|
export * from './components/date-period/question.js';
|
|
7
|
+
export * from './components/date-time/question.js';
|
|
8
|
+
export * from './components/email/question.js';
|
|
9
|
+
export * from './components/manage-list/question.js';
|
|
9
10
|
export * from './components/multi-field-input/question.js';
|
|
10
11
|
export * from './components/number-entry/question.js';
|
|
11
12
|
export * from './components/radio/question.js';
|
|
@@ -14,6 +15,8 @@ export * from './components/single-line-input/question.js';
|
|
|
14
15
|
export * from './components/text-entry/question.js';
|
|
15
16
|
export * from './components/text-entry-redact/question.js';
|
|
16
17
|
export * from './components/unit-option-entry/question.js';
|
|
18
|
+
|
|
19
|
+
// Utils
|
|
17
20
|
export * from './components/utils/persisted-number-answer.js';
|
|
18
21
|
export * from './components/utils/question-has-answer.js';
|
|
19
22
|
export * from './components/utils/question-utils.js';
|
package/src/index.test.js
CHANGED
|
@@ -49,7 +49,6 @@ describe('public API', () => {
|
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
it('should re-export key top-level classes and factories', () => {
|
|
52
|
-
assert.equal(typeof api.AddressQuestion, 'function');
|
|
53
52
|
assert.equal(typeof api.Question, 'function');
|
|
54
53
|
assert.equal(typeof api.createQuestions, 'function');
|
|
55
54
|
assert.equal(typeof api.questionClasses, 'object');
|
|
@@ -57,4 +56,30 @@ describe('public API', () => {
|
|
|
57
56
|
assert.equal(typeof api.Journey, 'function');
|
|
58
57
|
assert.equal(typeof api.JourneyResponse, 'function');
|
|
59
58
|
});
|
|
59
|
+
|
|
60
|
+
it('should re-export component questions and helpers', () => {
|
|
61
|
+
assert.equal(typeof api.AddressQuestion, 'function');
|
|
62
|
+
assert.equal(typeof api.BooleanQuestion, 'function');
|
|
63
|
+
assert.equal(typeof api.CheckboxQuestion, 'function');
|
|
64
|
+
assert.equal(typeof api.DateQuestion, 'function');
|
|
65
|
+
assert.equal(typeof api.DatePeriodQuestion, 'function');
|
|
66
|
+
assert.equal(typeof api.DateTimeQuestion, 'function');
|
|
67
|
+
assert.equal(typeof api.EmailQuestion, 'function');
|
|
68
|
+
assert.equal(typeof api.ManageListQuestion, 'function');
|
|
69
|
+
assert.equal(typeof api.MultiFieldInputQuestion, 'function');
|
|
70
|
+
assert.equal(typeof api.NumberEntryQuestion, 'function');
|
|
71
|
+
assert.equal(typeof api.RadioQuestion, 'function');
|
|
72
|
+
assert.equal(typeof api.SelectQuestion, 'function');
|
|
73
|
+
assert.equal(typeof api.SingleLineInputQuestion, 'function');
|
|
74
|
+
assert.equal(typeof api.TextEntryQuestion, 'function');
|
|
75
|
+
assert.equal(typeof api.TextEntryRedactQuestion, 'function');
|
|
76
|
+
assert.equal(typeof api.UnitOptionEntryQuestion, 'function');
|
|
77
|
+
|
|
78
|
+
assert.equal(typeof api.BOOLEAN_OPTIONS, 'object');
|
|
79
|
+
assert.equal(typeof api.yesNoToBoolean, 'function');
|
|
80
|
+
assert.equal(typeof api.booleanToYesNoValue, 'function');
|
|
81
|
+
assert.equal(typeof api.booleanToYesNoOrNull, 'function');
|
|
82
|
+
assert.equal(typeof api.REDACT_CHARACTER, 'string');
|
|
83
|
+
assert.equal(typeof api.TRUNCATED_MAX_LENGTH, 'number');
|
|
84
|
+
});
|
|
60
85
|
});
|
|
@@ -46,10 +46,20 @@ type Option =
|
|
|
46
46
|
}
|
|
47
47
|
| { divider?: string };
|
|
48
48
|
|
|
49
|
+
type Affix = {
|
|
50
|
+
text: string;
|
|
51
|
+
classes?: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
49
54
|
interface InputField {
|
|
50
55
|
fieldName: string;
|
|
51
56
|
label: string;
|
|
52
|
-
formatJoinString?: string; //
|
|
57
|
+
formatJoinString?: string; // used by formatAnswerForSummary (e.g. task list display), effective default to line break
|
|
58
|
+
formatPrefix?: string; // used by formatAnswerForSummary (e.g. task list display), to prefix answer
|
|
59
|
+
formatTextFunction?: (text: string) => string; // used to format the answer for display and value in question
|
|
60
|
+
attributes?: Record<string, string>; // used to add HTML attributes to the field
|
|
61
|
+
suffix?: Affix; // used to add a suffix to the field
|
|
62
|
+
prefix?: Affix; // used to add a prefix to the field
|
|
53
63
|
hint?: string;
|
|
54
64
|
}
|
|
55
65
|
|
|
@@ -109,11 +119,9 @@ type EmailQuestionProps = CommonQuestionProps & {
|
|
|
109
119
|
type: 'email';
|
|
110
120
|
};
|
|
111
121
|
|
|
112
|
-
type MultiFieldInputQuestionProps = CommonQuestionProps & {
|
|
122
|
+
export type MultiFieldInputQuestionProps = CommonQuestionProps & {
|
|
113
123
|
type: 'multi-field-input';
|
|
114
|
-
inputAttributes?: Record<string, string>;
|
|
115
124
|
inputFields: InputField[];
|
|
116
|
-
formatType?: 'contactDetails' | 'standard';
|
|
117
125
|
};
|
|
118
126
|
|
|
119
127
|
type NumberEntryQuestionProps = CommonQuestionProps & {
|
|
@@ -95,7 +95,7 @@ export class Question {
|
|
|
95
95
|
/**
|
|
96
96
|
* Private, but not marked as such because it breaks types, either using #variable:
|
|
97
97
|
* - Property '#isInManageListSection' is missing in type
|
|
98
|
-
* or with @private
|
|
98
|
+
* or with the @ private tag
|
|
99
99
|
* - Types have separate declarations of a private property '_isInManageListSection'.
|
|
100
100
|
* @type {boolean}
|
|
101
101
|
*/
|
|
@@ -401,11 +401,7 @@ export class Question {
|
|
|
401
401
|
* @returns {Array<{
|
|
402
402
|
* key: string;
|
|
403
403
|
* value: string | Object;
|
|
404
|
-
* action
|
|
405
|
-
* href: string;
|
|
406
|
-
* text: string;
|
|
407
|
-
* visuallyHiddenText: string;
|
|
408
|
-
* };
|
|
404
|
+
* action?: ActionView | ActionView[];
|
|
409
405
|
* }>}
|
|
410
406
|
*/
|
|
411
407
|
formatAnswerForSummary(sectionSegment, journey, answer, capitals = true) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export class AddressQuestion extends Question {
|
|
2
2
|
/**
|
|
3
3
|
* @param {import('#question-types').QuestionParameters} params
|
|
4
4
|
*/
|
|
@@ -31,5 +31,6 @@ export default class AddressQuestion extends Question {
|
|
|
31
31
|
}): string;
|
|
32
32
|
formatLabelFromRequiredFields(fieldName: any): "" | " (optional)";
|
|
33
33
|
}
|
|
34
|
+
export default AddressQuestion;
|
|
34
35
|
import { Question } from '#question';
|
|
35
36
|
//# sourceMappingURL=question.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/address/question.js"],"names":[],"mappings":"AAOA;IACC;;OAEG;IACH,oBAFW,OAAO,iBAAiB,EAAE,kBAAkB,EAqBtD;IAXE;;;;;;kBAA8C;IAIhD;;;;;;MAMC;IAGF;;;OAGG;IACH,4BAHW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjB,GAAC,GAAC,MAAM,CAqBpB;IAqCD;;;OAGG;IACH;;eAUC;IAuBD,kEAMC;CACD
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/address/question.js"],"names":[],"mappings":"AAOA;IACC;;OAEG;IACH,oBAFW,OAAO,iBAAiB,EAAE,kBAAkB,EAqBtD;IAXE;;;;;;kBAA8C;IAIhD;;;;;;MAMC;IAGF;;;OAGG;IACH,4BAHW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjB,GAAC,GAAC,MAAM,CAqBpB;IAqCD;;;OAGG;IACH;;eAUC;IAuBD,kEAMC;CACD;;yBAxIwB,WAAW"}
|
|
@@ -5,7 +5,7 @@ export const BOOLEAN_OPTIONS: Readonly<{
|
|
|
5
5
|
export function yesNoToBoolean(value: string | any): boolean;
|
|
6
6
|
export function booleanToYesNoValue(value: any): "yes" | "no";
|
|
7
7
|
export function booleanToYesNoOrNull(value: boolean | null): string | null;
|
|
8
|
-
export
|
|
8
|
+
export class BooleanQuestion extends RadioQuestion {
|
|
9
9
|
/**
|
|
10
10
|
* @param {Object} params
|
|
11
11
|
* @param {string} params.title
|
|
@@ -45,5 +45,6 @@ export default class BooleanQuestion extends RadioQuestion {
|
|
|
45
45
|
* @returns {Promise.<Object>}
|
|
46
46
|
*/ getDataToSave(req: any, journeyResponse: JourneyResponse): Promise<Object>;
|
|
47
47
|
}
|
|
48
|
+
export default BooleanQuestion;
|
|
48
49
|
import RadioQuestion from '../radio/question.js';
|
|
49
50
|
//# sourceMappingURL=question.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/boolean/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,6IAdG;QAAuB,KAAK,EAApB,MAAM;QACS,QAAQ,EAAvB,MAAM;QACS,SAAS,EAAxB,MAAM;QACU,GAAG;QACH,IAAI;QACJ,SAAS;QACT,WAAW;QACX,IAAI;QACJ,aAAa;QACyC,OAAO;QACpB,UAAU;QAClD,QAAQ;QACyC,QAAQ,GAA1E,OAAO,iBAAiB,EAAE,kBAAkB,CAAC,UAAU,CAAC;KAAmB,EAmDrF;IADA,sBAAkC;IAGnC;;;;;OAKG,CACH,yCAHW,eAAe,GACb,OAAO,CAAE,MAAM,CAAC,CAe5B;CACD
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/boolean/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,6IAdG;QAAuB,KAAK,EAApB,MAAM;QACS,QAAQ,EAAvB,MAAM;QACS,SAAS,EAAxB,MAAM;QACU,GAAG;QACH,IAAI;QACJ,SAAS;QACT,WAAW;QACX,IAAI;QACJ,aAAa;QACyC,OAAO;QACpB,UAAU;QAClD,QAAQ;QACyC,QAAQ,GAA1E,OAAO,iBAAiB,EAAE,kBAAkB,CAAC,UAAU,CAAC;KAAmB,EAmDrF;IADA,sBAAkC;IAGnC;;;;;OAKG,CACH,yCAHW,eAAe,GACb,OAAO,CAAE,MAAM,CAAC,CAe5B;CACD;;0BAzHyB,sBAAsB"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @property {string} value the checkbox answer
|
|
5
5
|
* @property {string} conditional the conditional text input
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export class CheckboxQuestion extends OptionsQuestion {
|
|
8
8
|
/**
|
|
9
9
|
* @param {Object} params
|
|
10
10
|
* @param {string} params.title
|
|
@@ -37,6 +37,7 @@ export default class CheckboxQuestion extends OptionsQuestion {
|
|
|
37
37
|
*/
|
|
38
38
|
formatAnswerForSummary(sectionSegment: string, journey: import("#journey").Journey, answer: string | ConditionalAnswerObject): Array<Object>;
|
|
39
39
|
}
|
|
40
|
+
export default CheckboxQuestion;
|
|
40
41
|
export type ConditionalAnswerObject = {
|
|
41
42
|
/**
|
|
42
43
|
* the checkbox answer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/checkbox/question.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AAEH;IACC;;;;;;;;;;;OAWG;IACH,wGAVG;QAAuB,KAAK,EAApB,MAAM;QACS,QAAQ,EAAvB,MAAM;QACS,SAAS,EAAxB,MAAM;QACU,GAAG;QACH,SAAS;QACT,WAAW;QAC0C,OAAO,EAA5E,KAAK,CAAE,OAAO,qCAAqC,EAAE,MAAM,CAAC;QACH,UAAU;QACD,QAAQ,GAA1E,OAAO,iBAAiB,EAAE,kBAAkB,CAAC,UAAU,CAAC;KAAmB,EAiBrF;IAED;;;;;;OAMG;IACH,wDAJW,OAAO,UAAU,EAAE,OAAO,UAD1B,MAAM,GAAG,uBAAuB,GAG9B,KAAK,CAAE,MAAM,CAAC,CAuC1B;CACD
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/checkbox/question.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AAEH;IACC;;;;;;;;;;;OAWG;IACH,wGAVG;QAAuB,KAAK,EAApB,MAAM;QACS,QAAQ,EAAvB,MAAM;QACS,SAAS,EAAxB,MAAM;QACU,GAAG;QACH,SAAS;QACT,WAAW;QAC0C,OAAO,EAA5E,KAAK,CAAE,OAAO,qCAAqC,EAAE,MAAM,CAAC;QACH,UAAU;QACD,QAAQ,GAA1E,OAAO,iBAAiB,EAAE,kBAAkB,CAAC,UAAU,CAAC;KAAmB,EAiBrF;IAED;;;;;;OAMG;IACH,wDAJW,OAAO,UAAU,EAAE,OAAO,UAD1B,MAAM,GAAG,uBAAuB,GAG9B,KAAK,CAAE,MAAM,CAAC,CAuC1B;CACD;;;;;;WA/Ea,MAAM;;;;iBACN,MAAM;;4BATQ,qCAAqC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @class
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export class DateQuestion extends Question {
|
|
5
5
|
/**
|
|
6
6
|
* @param {import('#question-types').QuestionParameters} params
|
|
7
7
|
* @param {string} [params.dateFormat]
|
|
@@ -18,5 +18,6 @@ export default class DateQuestion extends Question {
|
|
|
18
18
|
[x: string]: any;
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
+
export default DateQuestion;
|
|
21
22
|
import { Question } from '../../questions/question.js';
|
|
22
23
|
//# sourceMappingURL=question.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/date/question.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;IACC;;;OAGG;IACH,uCAHW,OAAO,iBAAiB,EAAE,kBAAkB,EAStD;IADA,gBAA4B;IAG7B;;;;;OAKG,CACH,yCAHW,OAAO,mBAAmB,EAAE,eAAe,GACzC,OAAO,CAAE,MAAM,CAAC,CAY5B;IAED;;MAwBC;CAoBD
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/date/question.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;IACC;;;OAGG;IACH,uCAHW,OAAO,iBAAiB,EAAE,kBAAkB,EAStD;IADA,gBAA4B;IAG7B;;;;;OAKG,CACH,yCAHW,OAAO,mBAAmB,EAAE,eAAe,GACzC,OAAO,CAAE,MAAM,CAAC,CAY5B;IAED;;MAwBC;CAoBD;;yBAlFwB,6BAA6B"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Represents a date period, two dates which make up a period or range
|
|
3
3
|
* @class
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export class DatePeriodQuestion extends Question {
|
|
6
6
|
/**
|
|
7
7
|
* @param {import('#question-types').QuestionParameters} params
|
|
8
8
|
* @param {string} [params.dateFormat]
|
|
@@ -30,5 +30,6 @@ export default class DatePeriodQuestion extends Question {
|
|
|
30
30
|
[x: string]: any;
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
+
export default DatePeriodQuestion;
|
|
33
34
|
import { Question } from '#question';
|
|
34
35
|
//# sourceMappingURL=question.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/date-period/question.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH;IACC;;;;;;;;;OASG;IACH,6FATW,OAAO,iBAAiB,EAAE,kBAAkB,EAqBtD;IAPA,gBAA4B;IAC5B,YAAsD;IAEtD,eAA0B;IAC1B,aAAsB;IACtB,eAA+D;IAC/D,aAA2D;IAG5D;;;;;OAKG,CACH,yCAHW,OAAO,mBAAmB,EAAE,eAAe,GACzC,OAAO,CAAE,MAAM,CAAC,CAgC5B;IAED;;MAuCC;CAyCD
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/date-period/question.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH;IACC;;;;;;;;;OASG;IACH,6FATW,OAAO,iBAAiB,EAAE,kBAAkB,EAqBtD;IAPA,gBAA4B;IAC5B,YAAsD;IAEtD,eAA0B;IAC1B,aAAsB;IACtB,eAA+D;IAC/D,aAA2D;IAG5D;;;;;OAKG,CACH,yCAHW,OAAO,mBAAmB,EAAE,eAAe,GACzC,OAAO,CAAE,MAAM,CAAC,CAgC5B;IAED;;MAuCC;CAyCD;;yBAzJwB,WAAW"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export class DateTimeQuestion extends Question {
|
|
2
2
|
static AM: string;
|
|
3
3
|
static PM: string;
|
|
4
4
|
/**
|
|
@@ -20,5 +20,6 @@ export default class DateTimeQuestion extends Question {
|
|
|
20
20
|
};
|
|
21
21
|
#private;
|
|
22
22
|
}
|
|
23
|
+
export default DateTimeQuestion;
|
|
23
24
|
import { Question } from '../../questions/question.js';
|
|
24
25
|
//# sourceMappingURL=question.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/date-time/question.js"],"names":[],"mappings":"AAMA;IACC,kBAAiB;IACjB,kBAAiB;IAEjB;;;;OAIG;IACH,mDAJW,OAAO,iBAAiB,EAAE,kBAAkB,EAWtD;IAFA,gBAA4B;IAC5B,gBAA4B;IAG7B;;;;;OAKG,CACH,yCAHW,eAAe,GACb,OAAO,CAAE,MAAM,CAAC,CAqB5B;IAED;;MAqCC;;CAoCD
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/date-time/question.js"],"names":[],"mappings":"AAMA;IACC,kBAAiB;IACjB,kBAAiB;IAEjB;;;;OAIG;IACH,mDAJW,OAAO,iBAAiB,EAAE,kBAAkB,EAWtD;IAFA,gBAA4B;IAC5B,gBAA4B;IAG7B;;;;;OAKG,CACH,yCAHW,eAAe,GACb,OAAO,CAAE,MAAM,CAAC,CAqB5B;IAED;;MAqCC;;CAoCD;;yBA5HwB,6BAA6B"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Automatically sets the input type to "email" and adds appropriate attributes
|
|
11
11
|
* @class
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export class EmailQuestion extends SingleLineInputQuestion {
|
|
14
14
|
/**
|
|
15
15
|
* Override formatAnswerForSummary to prevent capitalization of email addresses
|
|
16
16
|
* Email addresses should remain in their original case (typically lowercase)
|
|
@@ -21,6 +21,7 @@ export default class EmailQuestion extends SingleLineInputQuestion {
|
|
|
21
21
|
*/
|
|
22
22
|
formatAnswerForSummary(sectionSegment: string, journey: import("#journey").Journey, answer: string): any[];
|
|
23
23
|
}
|
|
24
|
+
export default EmailQuestion;
|
|
24
25
|
export type QuestionViewModel = import("#question").QuestionViewModel;
|
|
25
26
|
export type Journey = import("#journey").Journey;
|
|
26
27
|
export type JourneyResponse = import("#journey-response").JourneyResponse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/email/question.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH;;;;GAIG;AACH;IA2BC;;;;;;;OAOG;IACH,uCALW,MAAM,WACN,OAAO,UAAU,EAAE,OAAO,UAC1B,MAAM,SAMhB;CACD
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/email/question.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH;;;;GAIG;AACH;IA2BC;;;;;;;OAOG;IACH,uCALW,MAAM,WACN,OAAO,UAAU,EAAE,OAAO,UAC1B,MAAM,SAMhB;CACD;;gCAnDY,OAAO,WAAW,EAAE,iBAAiB;sBACrC,OAAO,UAAU,EAAE,OAAO;8BAC1B,OAAO,mBAAmB,EAAE,eAAe;;;oCALpB,kCAAkC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export class IdentifierQuestion extends Question {
|
|
2
2
|
/**
|
|
3
3
|
* @param {import('#question-types').QuestionParameters} params
|
|
4
4
|
* @param {string} [params.inputClasses] css class string to be added to the input
|
|
@@ -11,5 +11,6 @@ export default class IdentifierQuestion extends Question {
|
|
|
11
11
|
inputClasses: string;
|
|
12
12
|
label: any;
|
|
13
13
|
}
|
|
14
|
+
export default IdentifierQuestion;
|
|
14
15
|
import { Question } from '#question';
|
|
15
16
|
//# sourceMappingURL=question.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/identifier/question.js"],"names":[],"mappings":"AAEA;IAMC;;;;OAIG;IACH,gDAJW,OAAO,iBAAiB,EAAE,kBAAkB,EAYtD;IAlBD,uFAAuF;IACvF,aADW,MAAM,GAAC,SAAS,CACf;IACZ,2DAA2D;IAC3D,cADW,MAAM,CACJ;IAcZ,WAAkB;CAUnB
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/identifier/question.js"],"names":[],"mappings":"AAEA;IAMC;;;;OAIG;IACH,gDAJW,OAAO,iBAAiB,EAAE,kBAAkB,EAYtD;IAlBD,uFAAuF;IACvF,aADW,MAAM,GAAC,SAAS,CACf;IACZ,2DAA2D;IAC3D,cADW,MAAM,CACJ;IAcZ,WAAkB;CAUnB;;yBA9BwB,WAAW"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @property {boolean} [showAnswersInSummary] - whether to show the answers on the main check-your-answers page (or just a count)
|
|
6
6
|
* @property {string} [confirmationQuestion] - the name of the confirmation question to use when removing an item, default 'confirm'
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export class ManageListQuestion extends Question {
|
|
9
9
|
/**
|
|
10
10
|
* @param {import('#question-types').QuestionParameters & ManageListQuestionParameters} params
|
|
11
11
|
*/
|
|
@@ -26,6 +26,7 @@ export default class ManageListQuestion extends Question {
|
|
|
26
26
|
get section(): import("../../section.js").Section;
|
|
27
27
|
#private;
|
|
28
28
|
}
|
|
29
|
+
export default ManageListQuestion;
|
|
29
30
|
export type ManageListQuestionParameters = {
|
|
30
31
|
/**
|
|
31
32
|
* - the single name of the list item, e.g. "Holiday activity"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/manage-list/question.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AAEH;IAOC;;OAEG;IACH,oBAFW,OAAO,iBAAiB,EAAE,kBAAkB,GAAG,4BAA4B,EAerF;IAcD,wCAEC;IAyDD;;;;OAMC;IAED;;;;QAsBC;IAED,4EAQC;IAoCD,yDAEC;IATD,kDAKC;;CAKD
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/manage-list/question.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AAEH;IAOC;;OAEG;IACH,oBAFW,OAAO,iBAAiB,EAAE,kBAAkB,GAAG,4BAA4B,EAerF;IAcD,wCAEC;IAyDD;;;;OAMC;IAED;;;;QAsBC;IAED,4EAQC;IAoCD,yDAEC;IATD,kDAKC;;CAKD;;;;;;mBArLa,MAAM;;;;;;;;;;;;;;yBAPK,WAAW"}
|
|
@@ -5,38 +5,27 @@
|
|
|
5
5
|
* @typedef {import('../../section').Section} Section
|
|
6
6
|
* @typedef {import('../../validator/base-validator')} BaseValidator
|
|
7
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
8
|
/**
|
|
25
9
|
* @class
|
|
26
10
|
*/
|
|
27
|
-
export
|
|
28
|
-
/**
|
|
29
|
-
* @param {import('#question-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
11
|
+
export class MultiFieldInputQuestion extends Question {
|
|
12
|
+
/**
|
|
13
|
+
* @param {import('#src/questions/question-props.d.ts').MultiFieldInputQuestionProps} params
|
|
14
|
+
*/
|
|
15
|
+
constructor({ inputFields, ...params }: import("#src/questions/question-props.d.ts").MultiFieldInputQuestionProps);
|
|
16
|
+
inputFields: import("#src/questions/question-props.d.ts").InputField[];
|
|
17
|
+
answerForViewModel(answers: any): {
|
|
18
|
+
value: string;
|
|
19
|
+
fieldName: string;
|
|
20
|
+
label: string;
|
|
21
|
+
formatJoinString?: string;
|
|
22
|
+
formatPrefix?: string;
|
|
23
|
+
formatTextFunction?: (text: string) => string;
|
|
24
|
+
attributes?: Record<string, string>;
|
|
25
|
+
suffix?: import("#src/questions/question-props.d.ts").Affix;
|
|
26
|
+
prefix?: import("#src/questions/question-props.d.ts").Affix;
|
|
27
|
+
hint?: string;
|
|
28
|
+
}[];
|
|
40
29
|
/**
|
|
41
30
|
* returns the formatted answers values to be used to build task list elements
|
|
42
31
|
* @param {Journey} journey
|
|
@@ -62,45 +51,11 @@ export default class MultiFieldInputQuestion extends Question {
|
|
|
62
51
|
}>;
|
|
63
52
|
#private;
|
|
64
53
|
}
|
|
54
|
+
export default MultiFieldInputQuestion;
|
|
65
55
|
export type QuestionViewModel = import("#question").QuestionViewModel;
|
|
66
56
|
export type Journey = import("#journey").Journey;
|
|
67
57
|
export type JourneyResponse = import("#journey-response").JourneyResponse;
|
|
68
58
|
export type Section = any;
|
|
69
59
|
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
60
|
import { Question } from '#question';
|
|
106
61
|
//# sourceMappingURL=question.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/multi-field-input/question.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/multi-field-input/question.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH;;GAEG;AACH;IACC;;OAEG;IACH,wCAFW,OAAO,oCAAoC,EAAE,4BAA4B,EAanF;IAJC,uEAA8B;IAMhC;;;;;;;;;;;QAOC;IAsBD;;;;;;;;;;;;;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;;gCA/GY,OAAO,WAAW,EAAE,iBAAiB;sBACrC,OAAO,UAAU,EAAE,OAAO;8BAC1B,OAAO,mBAAmB,EAAE,eAAe;;;yBAP/B,WAAW"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export class NumberEntryQuestion extends Question {
|
|
2
2
|
/**
|
|
3
3
|
* @param {import('#question-types').QuestionParameters} params
|
|
4
4
|
* @param {string} [params.suffix]
|
|
@@ -33,5 +33,6 @@ export default class NumberEntryQuestion extends Question {
|
|
|
33
33
|
};
|
|
34
34
|
}>;
|
|
35
35
|
}
|
|
36
|
+
export default NumberEntryQuestion;
|
|
36
37
|
import { Question } from '#question';
|
|
37
38
|
//# sourceMappingURL=question.d.ts.map
|
|
@@ -1 +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
|
|
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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export class RadioQuestion extends OptionsQuestion {
|
|
2
2
|
/**
|
|
3
3
|
* @param {Object} params
|
|
4
4
|
* @param {string} params.title
|
|
@@ -49,5 +49,6 @@ export default class RadioQuestion extends OptionsQuestion {
|
|
|
49
49
|
*/
|
|
50
50
|
formatAnswerForSummary(sectionSegment: string, journey: Journey, answer: Object): Array<Object>;
|
|
51
51
|
}
|
|
52
|
+
export default RadioQuestion;
|
|
52
53
|
import OptionsQuestion from '../../questions/options-question.js';
|
|
53
54
|
//# sourceMappingURL=question.d.ts.map
|
|
@@ -1 +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;;;QACS,UAAU;KAAC,EAuCnE;IAFA,0BAAkB;IAClB,2BAAoB;IAWrB;;;;;;OAMG;IACH,wDAJW,OAAO,UADP,MAAM,GAGJ,KAAK,CAAE,MAAM,CAAC,CAgB1B;CACD
|
|
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;;;QACS,UAAU;KAAC,EAuCnE;IAFA,0BAAkB;IAClB,2BAAoB;IAWrB;;;;;;OAMG;IACH,wDAJW,OAAO,UADP,MAAM,GAGJ,KAAK,CAAE,MAAM,CAAC,CAgB1B;CACD;;4BA3F2B,qCAAqC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export class SelectQuestion extends OptionsQuestion {
|
|
2
2
|
/**
|
|
3
3
|
* @param {Object} params
|
|
4
4
|
* @param {string} params.title
|
|
@@ -50,5 +50,6 @@ export default class SelectQuestion extends OptionsQuestion {
|
|
|
50
50
|
formatAnswerForSummary(sectionSegment: string, journey: Journey, answer: Object): Array<Object>;
|
|
51
51
|
#private;
|
|
52
52
|
}
|
|
53
|
+
export default SelectQuestion;
|
|
53
54
|
import OptionsQuestion from '../../questions/options-question.js';
|
|
54
55
|
//# sourceMappingURL=question.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/select/question.js"],"names":[],"mappings":"AAEA;IAEC;;;;;;;;;;;;;;;;;OAiBG;IACH,8KAhBG;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;QACN,6BAA6B;QACwB,OAAO,EAA5E,KAAK,CAAE,OAAO,qCAAqC,EAAE,MAAM,CAAC;QAC/B,QAAQ;;;QACoB,UAAU;KAAC,EAqC9E;IAHA,0BAAkB;IAClB,2BAAoB;IAarB;;;;;;;;OAQG;IACH,wDAJW,OAAO,UADP,MAAM,GAGJ,KAAK,CAAE,MAAM,CAAC,CAS1B;;CACD
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/select/question.js"],"names":[],"mappings":"AAEA;IAEC;;;;;;;;;;;;;;;;;OAiBG;IACH,8KAhBG;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;QACN,6BAA6B;QACwB,OAAO,EAA5E,KAAK,CAAE,OAAO,qCAAqC,EAAE,MAAM,CAAC;QAC/B,QAAQ;;;QACoB,UAAU;KAAC,EAqC9E;IAHA,0BAAkB;IAClB,2BAAoB;IAarB;;;;;;;;OAQG;IACH,wDAJW,OAAO,UADP,MAAM,GAGJ,KAAK,CAAE,MAAM,CAAC,CAS1B;;CACD;;4BArF2B,qCAAqC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @class
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export class SingleLineInputQuestion extends Question {
|
|
5
5
|
/**
|
|
6
6
|
* @param {import('#question-types').QuestionParameters} params
|
|
7
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
|
|
@@ -14,5 +14,6 @@ export default class SingleLineInputQuestion extends Question {
|
|
|
14
14
|
label: any;
|
|
15
15
|
classes: any;
|
|
16
16
|
}
|
|
17
|
+
export default SingleLineInputQuestion;
|
|
17
18
|
import { Question } from '#question';
|
|
18
19
|
//# sourceMappingURL=question.d.ts.map
|
|
@@ -1 +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
|
|
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"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
/**
|
|
15
15
|
* @class
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export class TextEntryQuestion extends Question {
|
|
18
18
|
/**
|
|
19
19
|
* @param {import('#question-types').QuestionParameters} params
|
|
20
20
|
* @param {TextEntryCheckbox} [params.textEntryCheckbox]
|
|
@@ -24,6 +24,7 @@ export default class TextEntryQuestion extends Question {
|
|
|
24
24
|
textEntryCheckbox: any;
|
|
25
25
|
label: any;
|
|
26
26
|
}
|
|
27
|
+
export default TextEntryQuestion;
|
|
27
28
|
export type TextEntryCheckbox = {
|
|
28
29
|
header: string;
|
|
29
30
|
text: string;
|
|
@@ -1 +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
|
|
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"}
|
|
@@ -3,7 +3,7 @@ export const TRUNCATED_MAX_LENGTH: 500;
|
|
|
3
3
|
/**
|
|
4
4
|
* @class
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export class TextEntryRedactQuestion extends Question {
|
|
7
7
|
/**
|
|
8
8
|
* @param {import('#question-types').QuestionParameters} params
|
|
9
9
|
* @param {import('../text-entry/question.js').TextEntryCheckbox} [params.textEntryCheckbox]
|
|
@@ -27,16 +27,9 @@ export default class TextEntryRedactQuestion extends Question {
|
|
|
27
27
|
formatAnswerForSummary(sectionSegment: any, journey: any, answer: any, capitals?: boolean): {
|
|
28
28
|
key: string;
|
|
29
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;
|
|
30
|
+
action?: import("../../controller.js").ActionView | import("../../controller.js").ActionView[];
|
|
39
31
|
}[];
|
|
40
32
|
}
|
|
33
|
+
export default TextEntryRedactQuestion;
|
|
41
34
|
import { Question } from '#question';
|
|
42
35
|
//# sourceMappingURL=question.d.ts.map
|
|
@@ -1 +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
|
|
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"}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* }
|
|
23
23
|
*}} UnitOption
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
25
|
+
export class UnitOptionEntryQuestion extends Question {
|
|
26
26
|
/** @type {Array<UnitOption>} */
|
|
27
27
|
options: Array<UnitOption>;
|
|
28
28
|
conditionalFieldName: any;
|
|
@@ -55,6 +55,7 @@ export default class UnitOptionEntryQuestion extends Question {
|
|
|
55
55
|
answers: Record<string, unknown>;
|
|
56
56
|
}>;
|
|
57
57
|
}
|
|
58
|
+
export default UnitOptionEntryQuestion;
|
|
58
59
|
/**
|
|
59
60
|
* UnitOptions are the options displayed in the radio format - in this case the value
|
|
60
61
|
* represents the unit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/unit-option-entry/question.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;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,iBAAiB,EAAE,+BAA+B,GACvD,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
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/unit-option-entry/question.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;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,iBAAiB,EAAE,+BAA+B,GACvD,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;yBA5BsB,6BAA6B"}
|
package/types/src/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./components/address/question.js";
|
|
2
2
|
export * from "./components/boolean/question.js";
|
|
3
3
|
export * from "./components/checkbox/question.js";
|
|
4
4
|
export * from "./components/date/question.js";
|
|
5
5
|
export * from "./components/date-period/question.js";
|
|
6
|
+
export * from "./components/date-time/question.js";
|
|
7
|
+
export * from "./components/email/question.js";
|
|
8
|
+
export * from "./components/manage-list/question.js";
|
|
6
9
|
export * from "./components/multi-field-input/question.js";
|
|
7
10
|
export * from "./components/number-entry/question.js";
|
|
8
11
|
export * from "./components/radio/question.js";
|
|
@@ -52,5 +55,4 @@ export { createQuestions } from "./questions/create-questions.js";
|
|
|
52
55
|
export { questionClasses } from "./questions/questions.js";
|
|
53
56
|
export { Section } from "./section.js";
|
|
54
57
|
export { default as validate } from "./validator/validator.js";
|
|
55
|
-
import AddressQuestion from './components/address/question.js';
|
|
56
58
|
//# sourceMappingURL=index.d.ts.map
|
package/types/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":""}
|
|
@@ -46,10 +46,20 @@ type Option =
|
|
|
46
46
|
}
|
|
47
47
|
| { divider?: string };
|
|
48
48
|
|
|
49
|
+
type Affix = {
|
|
50
|
+
text: string;
|
|
51
|
+
classes?: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
49
54
|
interface InputField {
|
|
50
55
|
fieldName: string;
|
|
51
56
|
label: string;
|
|
52
|
-
formatJoinString?: string; //
|
|
57
|
+
formatJoinString?: string; // used by formatAnswerForSummary (e.g. task list display), effective default to line break
|
|
58
|
+
formatPrefix?: string; // used by formatAnswerForSummary (e.g. task list display), to prefix answer
|
|
59
|
+
formatTextFunction?: (text: string) => string; // used to format the answer for display and value in question
|
|
60
|
+
attributes?: Record<string, string>; // used to add HTML attributes to the field
|
|
61
|
+
suffix?: Affix; // used to add a suffix to the field
|
|
62
|
+
prefix?: Affix; // used to add a prefix to the field
|
|
53
63
|
hint?: string;
|
|
54
64
|
}
|
|
55
65
|
|
|
@@ -109,11 +119,9 @@ type EmailQuestionProps = CommonQuestionProps & {
|
|
|
109
119
|
type: 'email';
|
|
110
120
|
};
|
|
111
121
|
|
|
112
|
-
type MultiFieldInputQuestionProps = CommonQuestionProps & {
|
|
122
|
+
export type MultiFieldInputQuestionProps = CommonQuestionProps & {
|
|
113
123
|
type: 'multi-field-input';
|
|
114
|
-
inputAttributes?: Record<string, string>;
|
|
115
124
|
inputFields: InputField[];
|
|
116
|
-
formatType?: 'contactDetails' | 'standard';
|
|
117
125
|
};
|
|
118
126
|
|
|
119
127
|
type NumberEntryQuestionProps = CommonQuestionProps & {
|
|
@@ -87,11 +87,11 @@ export class Question {
|
|
|
87
87
|
/**
|
|
88
88
|
* Private, but not marked as such because it breaks types, either using #variable:
|
|
89
89
|
* - Property '#isInManageListSection' is missing in type
|
|
90
|
-
* or with @private
|
|
90
|
+
* or with the @ private tag
|
|
91
91
|
* - Types have separate declarations of a private property '_isInManageListSection'.
|
|
92
92
|
* @type {boolean}
|
|
93
93
|
*/
|
|
94
|
-
|
|
94
|
+
_isInManageListSection: boolean;
|
|
95
95
|
autocomplete: string | undefined;
|
|
96
96
|
editable: boolean;
|
|
97
97
|
viewData: {
|
|
@@ -223,21 +223,13 @@ export class Question {
|
|
|
223
223
|
* @returns {Array<{
|
|
224
224
|
* key: string;
|
|
225
225
|
* value: string | Object;
|
|
226
|
-
* action
|
|
227
|
-
* href: string;
|
|
228
|
-
* text: string;
|
|
229
|
-
* visuallyHiddenText: string;
|
|
230
|
-
* };
|
|
226
|
+
* action?: ActionView | ActionView[];
|
|
231
227
|
* }>}
|
|
232
228
|
*/
|
|
233
229
|
formatAnswerForSummary(sectionSegment: string, journey: Journey, answer: Object, capitals?: boolean): Array<{
|
|
234
230
|
key: string;
|
|
235
231
|
value: string | Object;
|
|
236
|
-
action
|
|
237
|
-
href: string;
|
|
238
|
-
text: string;
|
|
239
|
-
visuallyHiddenText: string;
|
|
240
|
-
};
|
|
232
|
+
action?: ActionView | ActionView[];
|
|
241
233
|
}>;
|
|
242
234
|
/**
|
|
243
235
|
* Returns the action link for the question
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../src/questions/question.js"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;GAWG;AAEH;;;GAGG;AACH;IA4DC;;;OAGG;IACH,yLAHW,OAAO,iBAAiB,EAAE,kBAAkB,oBAC5C,MAAM,CAAC,MAAM,WAAW,EAsDlC;IAnHD,6EAA6E;IAC7E,WADW,MAAM,CACP;IACV,sDAAsD;IACtD,OADW,MAAM,CACX;IACN,+DAA+D;IAC/D,UADW,MAAM,CACR;IACT,mFAAmF;IACnF,aADW,MAAM,GAAC,SAAS,CACf;IACZ,iDAAiD;IACjD,YADW,MAAM,CACN;IACX,qHAAqH;IACrH,WADW,MAAM,CACP;IACV,6FAA6F;IAC7F,UADW,OAAO,CACF;IAChB,iGAAiG;IACjG,YADW,KAAK,CAAE,aAAa,CAAC,CAChB;IAChB,2DAA2D;IAC3D,MADW,MAAM,GAAC,SAAS,CACtB;IACL,sEAAsE;IACtE,oBADW,OAAO,CACQ;IAC1B,oDAAoD;IACpD,KADW,MAAM,GAAC,SAAS,CACvB;IACJ,qDAAqD;IACrD,MADW,MAAM,GAAC,SAAS,CACtB;IACL,sDAAsD;IACtD,eADW,MAAM,GAAC,SAAS,CACb;IACd,wDAAwD;IACxD,YADW,UAAU,GAAC,SAAS,CACpB;IAEX,iFAAiF;IACjF,gBADW,MAAM,CACc;IAC/B,4CAA4C;IAC5C,oBADW,MAAM,CACe;IAChC,uDAAuD;IACvD,kBADW,MAAM,CACW;IAC5B,uDAAuD;IACvD,kBADW,MAAM,CACW;IAC5B,oDAAoD;IACpD,eADW,MAAM,CACK;IAEtB;;;OAGG;IACH,qBAFa,OAAO,CAEO;IAE3B;;;MAGE;IACF;;;;;;OAMG;IACH
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../src/questions/question.js"],"names":[],"mappings":"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"}
|