case-editor-tools 1.0.0-beta.9 → 1.0.2
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/constants/key-definitions.d.ts +3 -0
- package/constants/key-definitions.js +7 -1
- package/constants/key-definitions.js.map +1 -1
- package/exporter/index.d.ts +2 -0
- package/exporter/index.js +128 -0
- package/exporter/index.js.map +1 -0
- package/expression-utils/expressionGen.d.ts +1 -1
- package/expression-utils/studyEngineExpressions.d.ts +94 -13
- package/expression-utils/studyEngineExpressions.js +215 -19
- package/expression-utils/studyEngineExpressions.js.map +1 -1
- package/{item-editor-cb5ebc1a.js → item-editor-59f51ecc.js} +67 -46
- package/item-editor-59f51ecc.js.map +1 -0
- package/logger/index.d.ts +1 -0
- package/logger/index.js +10 -0
- package/logger/index.js.map +1 -0
- package/package.json +5 -5
- package/surveys/index.d.ts +1 -0
- package/surveys/index.js +9 -1
- package/surveys/index.js.map +1 -1
- package/surveys/responseTypeGenerators/likertGroupComponents.d.ts +27 -0
- package/surveys/responseTypeGenerators/likertGroupComponents.js +350 -0
- package/surveys/responseTypeGenerators/likertGroupComponents.js.map +1 -0
- package/surveys/responseTypeGenerators/matrixGroupComponent.d.ts +49 -0
- package/surveys/responseTypeGenerators/matrixGroupComponent.js +100 -0
- package/surveys/responseTypeGenerators/matrixGroupComponent.js.map +1 -0
- package/surveys/responseTypeGenerators/optionGroupComponents.d.ts +7 -0
- package/surveys/responseTypeGenerators/optionGroupComponents.js +129 -0
- package/surveys/responseTypeGenerators/optionGroupComponents.js.map +1 -0
- package/surveys/survey-editor/component-editor.d.ts +1 -1
- package/surveys/survey-editor/data-types.d.ts +1 -1
- package/surveys/survey-editor/item-editor.d.ts +2 -1
- package/surveys/survey-editor/item-editor.js +2 -1
- package/surveys/survey-editor/item-editor.js.map +1 -1
- package/surveys/survey-editor/survey-editor.d.ts +6 -1
- package/surveys/survey-editor/survey-editor.js +13 -6
- package/surveys/survey-editor/survey-editor.js.map +1 -1
- package/surveys/survey-engine-expressions.d.ts +12 -2
- package/surveys/survey-engine-expressions.js +43 -2
- package/surveys/survey-engine-expressions.js.map +1 -1
- package/surveys/survey-items.d.ts +33 -227
- package/surveys/survey-items.js +215 -780
- package/surveys/survey-items.js.map +1 -1
- package/surveys/types/group.d.ts +1 -1
- package/surveys/types/group.js +2 -1
- package/surveys/types/group.js.map +1 -1
- package/surveys/types/index.js +3 -1
- package/surveys/types/index.js.map +1 -1
- package/surveys/types/item-properties.d.ts +206 -2
- package/surveys/types/item-properties.js +7 -0
- package/surveys/types/item-properties.js.map +1 -1
- package/surveys/types/item.d.ts +1 -1
- package/surveys/types/survey-definition.d.ts +7 -3
- package/surveys/types/survey-definition.js +11 -2
- package/surveys/types/survey-definition.js.map +1 -1
- package/surveys/utils/componentGenerators.d.ts +2 -13
- package/surveys/utils/componentGenerators.js +1 -34
- package/surveys/utils/componentGenerators.js.map +1 -1
- package/surveys/utils/optionDefGenerators.d.ts +84 -0
- package/surveys/utils/optionDefGenerators.js +211 -0
- package/surveys/utils/optionDefGenerators.js.map +1 -0
- package/surveys/utils/simple-generators.d.ts +4 -3
- package/surveys/utils/simple-generators.js +29 -0
- package/surveys/utils/simple-generators.js.map +1 -1
- package/surveys/utils/simple-question-editor.d.ts +5 -5
- package/surveys/utils/simple-question-editor.js +5 -2
- package/surveys/utils/simple-question-editor.js.map +1 -1
- package/types/expression.d.ts +1 -1
- package/types/messageConfig.d.ts +49 -0
- package/types/messageConfig.js +23 -0
- package/types/messageConfig.js.map +1 -0
- package/types/study.d.ts +3 -1
- package/types/studyRules.d.ts +3 -2
- package/types/studyRules.js +5 -1
- package/types/studyRules.js.map +1 -1
- package/item-editor-cb5ebc1a.js.map +0 -1
package/surveys/survey-items.js
CHANGED
|
@@ -3,19 +3,22 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var surveys_surveyEditor_componentEditor = require('./survey-editor/component-editor.js');
|
|
6
|
-
var surveys_surveyEditor_itemEditor = require('../item-editor-
|
|
6
|
+
var surveys_surveyEditor_itemEditor = require('../item-editor-59f51ecc.js');
|
|
7
7
|
var surveys_utils_componentGenerators = require('./utils/componentGenerators.js');
|
|
8
8
|
var types_duration = require('../types/duration.js');
|
|
9
9
|
var constants_keyDefinitions = require('../constants/key-definitions.js');
|
|
10
|
-
var surveys_utils_randomKeyGenerator = require('./utils/randomKeyGenerator.js');
|
|
11
10
|
var surveys_utils_simpleGenerators = require('./utils/simple-generators.js');
|
|
12
11
|
var surveys_utils_simpleQuestionEditor = require('./utils/simple-question-editor.js');
|
|
13
12
|
var surveys_surveyEngineExpressions = require('./survey-engine-expressions.js');
|
|
13
|
+
var surveys_types_itemProperties = require('./types/item-properties.js');
|
|
14
|
+
var surveys_responseTypeGenerators_optionGroupComponents = require('./responseTypeGenerators/optionGroupComponents.js');
|
|
15
|
+
var surveys_responseTypeGenerators_likertGroupComponents = require('./responseTypeGenerators/likertGroupComponents.js');
|
|
16
|
+
require('./utils/randomKeyGenerator.js');
|
|
17
|
+
require('../logger/logger.js');
|
|
14
18
|
require('../expression-utils/expressionGen.js');
|
|
15
19
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, props.version ? props.version : 1);
|
|
20
|
+
const commonQuestionGenerator = (props, rg_inner) => {
|
|
21
|
+
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, props.version ? props.version : 1, props.confidentialMode);
|
|
19
22
|
// QUESTION TEXT
|
|
20
23
|
simpleEditor.setTitle(props.questionText, props.questionSubText, props.titleClassName);
|
|
21
24
|
if (props.condition) {
|
|
@@ -27,13 +30,30 @@ const generateNumericInputQuestion = (props) => {
|
|
|
27
30
|
if (props.topDisplayCompoments) {
|
|
28
31
|
props.topDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
29
32
|
}
|
|
33
|
+
simpleEditor.setResponseGroupWithContent(rg_inner);
|
|
34
|
+
if (props.bottomDisplayCompoments) {
|
|
35
|
+
props.bottomDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
36
|
+
}
|
|
37
|
+
if (props.isRequired) {
|
|
38
|
+
simpleEditor.addHasResponseValidation();
|
|
39
|
+
}
|
|
40
|
+
if (props.customValidations) {
|
|
41
|
+
props.customValidations.forEach(v => simpleEditor.editor.addValidation(v));
|
|
42
|
+
}
|
|
43
|
+
if (props.footnoteText) {
|
|
44
|
+
simpleEditor.addDisplayComponent(surveys_utils_componentGenerators.ComponentGenerators.footnote({ content: props.footnoteText }));
|
|
45
|
+
}
|
|
46
|
+
return simpleEditor.getItem();
|
|
47
|
+
};
|
|
48
|
+
const generateNumericInputQuestion = (props) => {
|
|
49
|
+
var _a, _b, _c, _d;
|
|
30
50
|
const style = [];
|
|
31
51
|
if (props.inputMaxWidth) {
|
|
32
52
|
style.push({
|
|
33
53
|
key: 'inputMaxWidth', value: props.inputMaxWidth,
|
|
34
54
|
});
|
|
35
55
|
}
|
|
36
|
-
if (props.
|
|
56
|
+
if (props.labelBehindInput) {
|
|
37
57
|
style.push({ key: 'labelPlacement', value: 'after' });
|
|
38
58
|
}
|
|
39
59
|
const rg_inner = {
|
|
@@ -44,242 +64,84 @@ const generateNumericInputQuestion = (props) => {
|
|
|
44
64
|
max: ((_b = props.componentProperties) === null || _b === void 0 ? void 0 : _b.max) !== undefined ? (typeof ((_c = props.componentProperties) === null || _c === void 0 ? void 0 : _c.max) === 'number' ? { dtype: 'num', num: props.componentProperties.max } : props.componentProperties.max) : undefined,
|
|
45
65
|
stepSize: ((_d = props.componentProperties) === null || _d === void 0 ? void 0 : _d.stepSize) ? (typeof (props.componentProperties.stepSize) === 'number' ? { dtype: 'num', num: props.componentProperties.stepSize } : props.componentProperties.stepSize) : undefined,
|
|
46
66
|
},
|
|
47
|
-
content: surveys_utils_simpleGenerators.generateLocStrings(props.
|
|
67
|
+
content: surveys_utils_simpleGenerators.generateLocStrings(props.inputLabel),
|
|
48
68
|
style: style.length > 0 ? style : undefined,
|
|
49
69
|
};
|
|
50
|
-
|
|
51
|
-
if (props.bottomDisplayCompoments) {
|
|
52
|
-
props.bottomDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
53
|
-
}
|
|
54
|
-
if (props.isRequired) {
|
|
55
|
-
simpleEditor.addHasResponseValidation();
|
|
56
|
-
}
|
|
57
|
-
if (props.customValidations) {
|
|
58
|
-
props.customValidations.forEach(v => simpleEditor.editor.addValidation(v));
|
|
59
|
-
}
|
|
60
|
-
if (props.footnoteText) {
|
|
61
|
-
simpleEditor.addDisplayComponent({
|
|
62
|
-
role: 'footnote', content: surveys_utils_simpleGenerators.generateLocStrings(props.footnoteText), style: [
|
|
63
|
-
{ key: 'className', value: 'fs-small fst-italic text-center' }
|
|
64
|
-
]
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
return simpleEditor.getItem();
|
|
70
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
68
71
|
};
|
|
69
72
|
const generateSingleChoiceQuestion = (props) => {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
simpleEditor.setTitle(props.questionText, props.questionSubText, props.titleClassName);
|
|
73
|
-
if (props.condition) {
|
|
74
|
-
simpleEditor.setCondition(props.condition);
|
|
75
|
-
}
|
|
76
|
-
if (props.helpGroupContent) {
|
|
77
|
-
simpleEditor.editor.setHelpGroupComponent(surveys_utils_simpleGenerators.generateHelpGroupComponent(props.helpGroupContent));
|
|
78
|
-
}
|
|
79
|
-
if (props.topDisplayCompoments) {
|
|
80
|
-
props.topDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
81
|
-
}
|
|
82
|
-
const rg_inner = initSingleChoiceGroup(constants_keyDefinitions.singleChoiceKey, props.responseOptions);
|
|
83
|
-
simpleEditor.setResponseGroupWithContent(rg_inner);
|
|
84
|
-
if (props.bottomDisplayCompoments) {
|
|
85
|
-
props.bottomDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
86
|
-
}
|
|
87
|
-
if (props.isRequired) {
|
|
88
|
-
simpleEditor.addHasResponseValidation();
|
|
89
|
-
}
|
|
90
|
-
if (props.customValidations) {
|
|
91
|
-
props.customValidations.forEach(v => simpleEditor.editor.addValidation(v));
|
|
92
|
-
}
|
|
93
|
-
if (props.footnoteText) {
|
|
94
|
-
simpleEditor.addDisplayComponent({
|
|
95
|
-
role: 'footnote', content: surveys_utils_simpleGenerators.generateLocStrings(props.footnoteText), style: [
|
|
96
|
-
{ key: 'className', value: 'fs-small fst-italic text-center' }
|
|
97
|
-
]
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return simpleEditor.getItem();
|
|
73
|
+
const rg_inner = surveys_responseTypeGenerators_optionGroupComponents.initSingleChoiceGroup(constants_keyDefinitions.singleChoiceKey, props.responseOptions);
|
|
74
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
101
75
|
};
|
|
102
76
|
const generateDropDownQuestion = (props) => {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
simpleEditor.setTitle(props.questionText, props.questionSubText, props.titleClassName);
|
|
106
|
-
if (props.condition) {
|
|
107
|
-
simpleEditor.setCondition(props.condition);
|
|
108
|
-
}
|
|
109
|
-
if (props.helpGroupContent) {
|
|
110
|
-
simpleEditor.editor.setHelpGroupComponent(surveys_utils_simpleGenerators.generateHelpGroupComponent(props.helpGroupContent));
|
|
111
|
-
}
|
|
112
|
-
if (props.topDisplayCompoments) {
|
|
113
|
-
props.topDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
114
|
-
}
|
|
115
|
-
const rg_inner = initDropdownGroup(constants_keyDefinitions.dropDownKey, props.responseOptions);
|
|
116
|
-
simpleEditor.setResponseGroupWithContent(rg_inner);
|
|
117
|
-
if (props.bottomDisplayCompoments) {
|
|
118
|
-
props.bottomDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
119
|
-
}
|
|
120
|
-
if (props.isRequired) {
|
|
121
|
-
simpleEditor.addHasResponseValidation();
|
|
122
|
-
}
|
|
123
|
-
if (props.footnoteText) {
|
|
124
|
-
simpleEditor.addDisplayComponent({
|
|
125
|
-
role: 'footnote', content: surveys_utils_simpleGenerators.generateLocStrings(props.footnoteText), style: [
|
|
126
|
-
{ key: 'className', value: 'fs-small fst-italic text-center' }
|
|
127
|
-
]
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
return simpleEditor.getItem();
|
|
77
|
+
const rg_inner = surveys_responseTypeGenerators_optionGroupComponents.initDropdownGroup(constants_keyDefinitions.dropDownKey, props.responseOptions, undefined, undefined, undefined, props.placeholder);
|
|
78
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
131
79
|
};
|
|
132
80
|
const generateMultipleChoiceQuestion = (props) => {
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
simpleEditor.setTitle(props.questionText, props.questionSubText, props.titleClassName);
|
|
136
|
-
if (props.condition) {
|
|
137
|
-
simpleEditor.setCondition(props.condition);
|
|
138
|
-
}
|
|
139
|
-
if (props.helpGroupContent) {
|
|
140
|
-
simpleEditor.editor.setHelpGroupComponent(surveys_utils_simpleGenerators.generateHelpGroupComponent(props.helpGroupContent));
|
|
141
|
-
}
|
|
142
|
-
if (props.topDisplayCompoments) {
|
|
143
|
-
props.topDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
144
|
-
}
|
|
145
|
-
const rg_inner = initMultipleChoiceGroup(constants_keyDefinitions.multipleChoiceKey, props.responseOptions);
|
|
146
|
-
simpleEditor.setResponseGroupWithContent(rg_inner);
|
|
147
|
-
if (props.bottomDisplayCompoments) {
|
|
148
|
-
props.bottomDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
149
|
-
}
|
|
150
|
-
if (props.isRequired) {
|
|
151
|
-
simpleEditor.addHasResponseValidation();
|
|
152
|
-
}
|
|
153
|
-
if (props.customValidations) {
|
|
154
|
-
props.customValidations.forEach(v => simpleEditor.editor.addValidation(v));
|
|
155
|
-
}
|
|
156
|
-
if (props.footnoteText) {
|
|
157
|
-
simpleEditor.addDisplayComponent({
|
|
158
|
-
role: 'footnote', content: surveys_utils_simpleGenerators.generateLocStrings(props.footnoteText), style: [
|
|
159
|
-
{ key: 'className', value: 'fs-small fst-italic text-center' }
|
|
160
|
-
]
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
return simpleEditor.getItem();
|
|
81
|
+
const rg_inner = surveys_responseTypeGenerators_optionGroupComponents.initMultipleChoiceGroup(constants_keyDefinitions.multipleChoiceKey, props.responseOptions);
|
|
82
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
164
83
|
};
|
|
165
84
|
const generateSimpleLikertGroupQuestion = (props) => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if (props.condition) {
|
|
170
|
-
simpleEditor.setCondition(props.condition);
|
|
171
|
-
}
|
|
172
|
-
if (props.helpGroupContent) {
|
|
173
|
-
simpleEditor.editor.setHelpGroupComponent(surveys_utils_simpleGenerators.generateHelpGroupComponent(props.helpGroupContent));
|
|
174
|
-
}
|
|
175
|
-
if (props.topDisplayCompoments) {
|
|
176
|
-
props.topDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
177
|
-
}
|
|
178
|
-
const rg_inner = initLikertScaleGroup(constants_keyDefinitions.likertScaleGroupKey, props.rows, props.scaleOptions, props.stackOnSmallScreen);
|
|
179
|
-
simpleEditor.setResponseGroupWithContent(rg_inner);
|
|
180
|
-
if (props.bottomDisplayCompoments) {
|
|
181
|
-
props.bottomDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
182
|
-
}
|
|
85
|
+
var _a;
|
|
86
|
+
const rg_inner = surveys_responseTypeGenerators_likertGroupComponents.initLikertScaleGroup(constants_keyDefinitions.likertScaleGroupKey, props.rows, props.scaleOptions, props.stackOnSmallScreen);
|
|
87
|
+
// Add extra validation for likert
|
|
183
88
|
if (props.isRequired) {
|
|
184
|
-
|
|
89
|
+
if (!props.customValidations) {
|
|
90
|
+
props.customValidations = [];
|
|
91
|
+
}
|
|
92
|
+
(_a = props.customValidations) === null || _a === void 0 ? void 0 : _a.push({
|
|
185
93
|
key: 'r',
|
|
186
94
|
type: 'hard',
|
|
187
95
|
rule: surveys_utils_simpleGenerators.expWithArgs('and', ...props.rows.map(r => surveys_utils_simpleGenerators.expWithArgs('responseHasKeysAny', [props.parentKey, props.itemKey].join('.'), [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.likertScaleGroupKey, r.key].join('.'), ...props.scaleOptions.map(o => o.key))))
|
|
188
96
|
});
|
|
189
|
-
simpleEditor.addHasResponseValidation();
|
|
190
97
|
}
|
|
191
|
-
|
|
192
|
-
simpleEditor.addDisplayComponent({
|
|
193
|
-
role: 'footnote', content: surveys_utils_simpleGenerators.generateLocStrings(props.footnoteText), style: [
|
|
194
|
-
{ key: 'className', value: 'fs-small fst-italic text-center' }
|
|
195
|
-
]
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
return simpleEditor.getItem();
|
|
98
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
199
99
|
};
|
|
200
100
|
const generateResponsiveSingleChoiceArrayQuestion = (props) => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (props.condition) {
|
|
205
|
-
simpleEditor.setCondition(props.condition);
|
|
206
|
-
}
|
|
207
|
-
if (props.helpGroupContent) {
|
|
208
|
-
simpleEditor.editor.setHelpGroupComponent(surveys_utils_simpleGenerators.generateHelpGroupComponent(props.helpGroupContent));
|
|
209
|
-
}
|
|
210
|
-
if (props.topDisplayCompoments) {
|
|
211
|
-
props.topDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
212
|
-
}
|
|
213
|
-
const rg_inner = initResponsiveSingleChoiceArray(constants_keyDefinitions.responsiveSingleChoiceArrayKey, Object.assign({}, props));
|
|
214
|
-
simpleEditor.setResponseGroupWithContent(rg_inner);
|
|
215
|
-
if (props.bottomDisplayCompoments) {
|
|
216
|
-
props.bottomDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
217
|
-
}
|
|
101
|
+
var _a;
|
|
102
|
+
const rg_inner = surveys_responseTypeGenerators_likertGroupComponents.initResponsiveSingleChoiceArray(constants_keyDefinitions.responsiveSingleChoiceArrayKey, Object.assign({}, props));
|
|
103
|
+
// Add extra validation
|
|
218
104
|
if (props.isRequired) {
|
|
219
|
-
|
|
105
|
+
if (!props.customValidations) {
|
|
106
|
+
props.customValidations = [];
|
|
107
|
+
}
|
|
108
|
+
(_a = props.customValidations) === null || _a === void 0 ? void 0 : _a.push({
|
|
220
109
|
key: 'r',
|
|
221
110
|
type: 'hard',
|
|
222
|
-
rule: surveys_utils_simpleGenerators.expWithArgs('and', ...props.rows.map(r =>
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
{ key: 'className', value: 'fs-small fst-italic text-center' }
|
|
230
|
-
]
|
|
111
|
+
rule: surveys_utils_simpleGenerators.expWithArgs('and', ...props.rows.map(r => {
|
|
112
|
+
const hasRespExp = surveys_utils_simpleGenerators.expWithArgs('responseHasKeysAny', [props.parentKey, props.itemKey].join('.'), [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.responsiveSingleChoiceArrayKey, r.key].join('.'), ...props.scaleOptions.map(o => o.key));
|
|
113
|
+
if (r.displayCondition === undefined) {
|
|
114
|
+
return hasRespExp;
|
|
115
|
+
}
|
|
116
|
+
return surveys_surveyEngineExpressions.SurveyEngine.logic.or(surveys_surveyEngineExpressions.SurveyEngine.logic.not(r.displayCondition), hasRespExp);
|
|
117
|
+
}))
|
|
231
118
|
});
|
|
232
119
|
}
|
|
233
|
-
return
|
|
120
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
234
121
|
};
|
|
235
122
|
const generateResponsiveBipolarLikertArray = (props) => {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
if (props.condition) {
|
|
240
|
-
simpleEditor.setCondition(props.condition);
|
|
241
|
-
}
|
|
242
|
-
if (props.helpGroupContent) {
|
|
243
|
-
simpleEditor.editor.setHelpGroupComponent(surveys_utils_simpleGenerators.generateHelpGroupComponent(props.helpGroupContent));
|
|
244
|
-
}
|
|
245
|
-
if (props.topDisplayCompoments) {
|
|
246
|
-
props.topDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
247
|
-
}
|
|
248
|
-
const rg_inner = initResponsiveBipolarLikertArray(constants_keyDefinitions.responsiveBipolarLikertArrayKey, Object.assign({}, props));
|
|
249
|
-
simpleEditor.setResponseGroupWithContent(rg_inner);
|
|
250
|
-
if (props.bottomDisplayCompoments) {
|
|
251
|
-
props.bottomDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
252
|
-
}
|
|
123
|
+
var _a;
|
|
124
|
+
const rg_inner = surveys_responseTypeGenerators_likertGroupComponents.initResponsiveBipolarLikertArray(constants_keyDefinitions.responsiveBipolarLikertArrayKey, Object.assign({}, props));
|
|
125
|
+
// Add extra validation
|
|
253
126
|
if (props.isRequired) {
|
|
254
|
-
|
|
127
|
+
if (!props.customValidations) {
|
|
128
|
+
props.customValidations = [];
|
|
129
|
+
}
|
|
130
|
+
(_a = props.customValidations) === null || _a === void 0 ? void 0 : _a.push({
|
|
255
131
|
key: 'r',
|
|
256
132
|
type: 'hard',
|
|
257
|
-
rule: surveys_utils_simpleGenerators.expWithArgs('and', ...props.rows.map(r =>
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
{ key: 'className', value: 'fs-small fst-italic text-center' }
|
|
265
|
-
]
|
|
133
|
+
rule: surveys_utils_simpleGenerators.expWithArgs('and', ...props.rows.map(r => {
|
|
134
|
+
const hasRespExp = surveys_utils_simpleGenerators.expWithArgs('responseHasKeysAny', [props.parentKey, props.itemKey].join('.'), [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.responsiveBipolarLikertArrayKey, r.key].join('.'), ...props.scaleOptions.map(o => o.key));
|
|
135
|
+
if (r.displayCondition === undefined) {
|
|
136
|
+
return hasRespExp;
|
|
137
|
+
}
|
|
138
|
+
return surveys_surveyEngineExpressions.SurveyEngine.logic.or(surveys_surveyEngineExpressions.SurveyEngine.logic.not(r.displayCondition), hasRespExp);
|
|
139
|
+
}))
|
|
266
140
|
});
|
|
267
141
|
}
|
|
268
|
-
return
|
|
142
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
269
143
|
};
|
|
270
144
|
const generateNumericSliderQuestion = (props) => {
|
|
271
|
-
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, props.version ? props.version : 1);
|
|
272
|
-
// QUESTION TEXT
|
|
273
|
-
simpleEditor.setTitle(props.questionText, props.questionSubText, props.titleClassName);
|
|
274
|
-
if (props.condition) {
|
|
275
|
-
simpleEditor.setCondition(props.condition);
|
|
276
|
-
}
|
|
277
|
-
if (props.helpGroupContent) {
|
|
278
|
-
simpleEditor.editor.setHelpGroupComponent(surveys_utils_simpleGenerators.generateHelpGroupComponent(props.helpGroupContent));
|
|
279
|
-
}
|
|
280
|
-
if (props.topDisplayCompoments) {
|
|
281
|
-
props.topDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
282
|
-
}
|
|
283
145
|
const rg_inner = {
|
|
284
146
|
key: 'slider', role: 'sliderNumeric',
|
|
285
147
|
content: surveys_utils_simpleGenerators.generateLocStrings(props.sliderLabel),
|
|
@@ -290,31 +152,9 @@ const generateNumericSliderQuestion = (props) => {
|
|
|
290
152
|
stepSize: props.stepSize ? (typeof (props.stepSize) === 'number' ? { dtype: 'num', num: props.stepSize } : props.stepSize) : undefined,
|
|
291
153
|
}
|
|
292
154
|
};
|
|
293
|
-
|
|
294
|
-
if (props.bottomDisplayCompoments) {
|
|
295
|
-
props.bottomDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
296
|
-
}
|
|
297
|
-
if (props.isRequired) {
|
|
298
|
-
simpleEditor.addHasResponseValidation();
|
|
299
|
-
}
|
|
300
|
-
if (props.footnoteText) {
|
|
301
|
-
simpleEditor.addDisplayComponent(surveys_utils_componentGenerators.ComponentGenerators.footnote({ content: props.footnoteText }));
|
|
302
|
-
}
|
|
303
|
-
return simpleEditor.getItem();
|
|
155
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
304
156
|
};
|
|
305
157
|
const generateDatePickerInput = (props) => {
|
|
306
|
-
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, props.version ? props.version : 1);
|
|
307
|
-
// QUESTION TEXT
|
|
308
|
-
simpleEditor.setTitle(props.questionText, props.questionSubText, props.titleClassName);
|
|
309
|
-
if (props.condition) {
|
|
310
|
-
simpleEditor.setCondition(props.condition);
|
|
311
|
-
}
|
|
312
|
-
if (props.helpGroupContent) {
|
|
313
|
-
simpleEditor.editor.setHelpGroupComponent(surveys_utils_simpleGenerators.generateHelpGroupComponent(props.helpGroupContent));
|
|
314
|
-
}
|
|
315
|
-
if (props.topDisplayCompoments) {
|
|
316
|
-
props.topDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
317
|
-
}
|
|
318
158
|
const rg_inner = {
|
|
319
159
|
key: constants_keyDefinitions.datePickerKey, role: 'dateInput',
|
|
320
160
|
properties: {
|
|
@@ -329,20 +169,125 @@ const generateDatePickerInput = (props) => {
|
|
|
329
169
|
content: props.inputLabelText ? surveys_utils_simpleGenerators.generateLocStrings(props.inputLabelText) : undefined,
|
|
330
170
|
description: props.placeholderText ? surveys_utils_simpleGenerators.generateLocStrings(props.placeholderText) : undefined,
|
|
331
171
|
};
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
172
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
173
|
+
};
|
|
174
|
+
const generateTimeInput = (props) => {
|
|
175
|
+
const style = [];
|
|
176
|
+
if (props.minTime) {
|
|
177
|
+
style.push({
|
|
178
|
+
key: 'minTime', value: props.minTime,
|
|
179
|
+
});
|
|
335
180
|
}
|
|
336
|
-
if (props.
|
|
337
|
-
|
|
181
|
+
if (props.maxTime) {
|
|
182
|
+
style.push({
|
|
183
|
+
key: 'maxTime', value: props.maxTime,
|
|
184
|
+
});
|
|
338
185
|
}
|
|
339
|
-
if (props.
|
|
340
|
-
|
|
186
|
+
if (props.defaultValue) {
|
|
187
|
+
style.push({
|
|
188
|
+
key: 'defaultValue', value: props.defaultValue,
|
|
189
|
+
});
|
|
341
190
|
}
|
|
342
|
-
|
|
191
|
+
if (props.labelBehindInput) {
|
|
192
|
+
style.push({ key: 'labelPlacement', value: 'after' });
|
|
193
|
+
}
|
|
194
|
+
const rg_inner = {
|
|
195
|
+
key: constants_keyDefinitions.timeInputKey, role: 'timeInput',
|
|
196
|
+
properties: {
|
|
197
|
+
stepSize: props.step,
|
|
198
|
+
},
|
|
199
|
+
content: props.inputLabelText ? surveys_utils_simpleGenerators.generateLocStrings(props.inputLabelText) : undefined,
|
|
200
|
+
style: style.length > 0 ? style : undefined,
|
|
201
|
+
};
|
|
202
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
203
|
+
};
|
|
204
|
+
const generateTextInputQuestion = (props) => {
|
|
205
|
+
const style = [];
|
|
206
|
+
if (props.maxLength !== undefined) {
|
|
207
|
+
style.push({ key: 'maxLength', value: props.maxLength.toFixed(0) });
|
|
208
|
+
}
|
|
209
|
+
if (props.className !== undefined) {
|
|
210
|
+
style.push({ key: 'className', value: props.className });
|
|
211
|
+
}
|
|
212
|
+
if (props.inputMaxWidth !== undefined) {
|
|
213
|
+
style.push({ key: 'inputMaxWidth', value: props.inputMaxWidth });
|
|
214
|
+
}
|
|
215
|
+
const rg_inner = {
|
|
216
|
+
key: constants_keyDefinitions.inputKey, role: 'input',
|
|
217
|
+
content: props.inputLabel ? surveys_utils_simpleGenerators.generateLocStrings(props.inputLabel) : undefined,
|
|
218
|
+
description: props.placeholderText ? surveys_utils_simpleGenerators.generateLocStrings(props.placeholderText) : undefined,
|
|
219
|
+
style: style.length > 0 ? [...style] : undefined,
|
|
220
|
+
disabled: props.disabled,
|
|
221
|
+
};
|
|
222
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
223
|
+
};
|
|
224
|
+
const generateConsentQuestion = (props) => {
|
|
225
|
+
const style = props.className ? [{ key: 'className', value: props.className }] : undefined;
|
|
226
|
+
const rg_inner = {
|
|
227
|
+
key: constants_keyDefinitions.consentKey, role: 'consent',
|
|
228
|
+
items: [
|
|
229
|
+
{
|
|
230
|
+
key: 'label', role: 'label',
|
|
231
|
+
content: !Array.isArray(props.checkBoxLabel) ? surveys_utils_simpleGenerators.generateLocStrings(props.checkBoxLabel) : undefined,
|
|
232
|
+
items: Array.isArray(props.checkBoxLabel) ? props.checkBoxLabel.map((item, index) => {
|
|
233
|
+
if (surveys_types_itemProperties.isDateDisplayComponentProp(item)) {
|
|
234
|
+
return surveys_utils_simpleGenerators.generateDateDisplayComp(index.toFixed(), item);
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
key: index.toFixed(),
|
|
238
|
+
role: 'text',
|
|
239
|
+
content: surveys_utils_simpleGenerators.generateLocStrings(item.content),
|
|
240
|
+
style: item.className ? [{ key: 'className', value: item.className }] : undefined
|
|
241
|
+
};
|
|
242
|
+
}) : undefined,
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
key: 'title', role: 'title', content: surveys_utils_simpleGenerators.generateLocStrings(props.dialogTitle)
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
key: 'content', role: 'content', content: surveys_utils_simpleGenerators.generateLocStrings(props.dialogContent)
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
key: 'acceptBtn', role: 'acceptBtn', content: surveys_utils_simpleGenerators.generateLocStrings(props.acceptBtn)
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
key: 'rejectBtn', role: 'rejectBtn', content: surveys_utils_simpleGenerators.generateLocStrings(props.rejectBtn)
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
style: style,
|
|
258
|
+
};
|
|
259
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
343
260
|
};
|
|
344
261
|
const generateMultilineInput = (props) => {
|
|
345
|
-
const
|
|
262
|
+
const rg_inner = {
|
|
263
|
+
key: constants_keyDefinitions.inputKey, role: 'multilineTextInput',
|
|
264
|
+
content: props.inputLabelText ? surveys_utils_simpleGenerators.generateLocStrings(props.inputLabelText) : undefined,
|
|
265
|
+
description: props.placeholderText ? surveys_utils_simpleGenerators.generateLocStrings(props.placeholderText) : undefined,
|
|
266
|
+
style: props.maxLength !== undefined ? [{ key: 'maxLength', value: props.maxLength.toFixed(0) }] : undefined
|
|
267
|
+
};
|
|
268
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
269
|
+
};
|
|
270
|
+
const generateClozeQuestion = (props) => {
|
|
271
|
+
const rg_inner = {
|
|
272
|
+
key: constants_keyDefinitions.clozeKey, role: 'cloze',
|
|
273
|
+
items: props.items.map((item) => {
|
|
274
|
+
const clozeItem = item;
|
|
275
|
+
const comp = surveys_responseTypeGenerators_optionGroupComponents.optionDefToItemComponent(clozeItem);
|
|
276
|
+
return comp;
|
|
277
|
+
})
|
|
278
|
+
};
|
|
279
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
280
|
+
};
|
|
281
|
+
const generateCustomQuestion = (props) => {
|
|
282
|
+
const items = [];
|
|
283
|
+
props.responseItemDefs.forEach(item => {
|
|
284
|
+
const rolePrefix = item.mapToRole !== undefined ? `${item.mapToRole}` : '';
|
|
285
|
+
const role = `${rolePrefix}:${item.role}`;
|
|
286
|
+
delete item['mapToRole'];
|
|
287
|
+
const rg_inner = Object.assign(Object.assign({}, item), { role: role });
|
|
288
|
+
items.push(rg_inner);
|
|
289
|
+
});
|
|
290
|
+
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, props.version ? props.version : 1, props.confidentialMode);
|
|
346
291
|
// QUESTION TEXT
|
|
347
292
|
simpleEditor.setTitle(props.questionText, props.questionSubText, props.titleClassName);
|
|
348
293
|
if (props.condition) {
|
|
@@ -354,18 +299,20 @@ const generateMultilineInput = (props) => {
|
|
|
354
299
|
if (props.topDisplayCompoments) {
|
|
355
300
|
props.topDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
356
301
|
}
|
|
357
|
-
|
|
358
|
-
key: constants_keyDefinitions.
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
};
|
|
362
|
-
simpleEditor.setResponseGroupWithContent(rg_inner);
|
|
302
|
+
simpleEditor.editor.addExistingResponseComponent({
|
|
303
|
+
key: constants_keyDefinitions.responseGroupKey,
|
|
304
|
+
role: 'responseGroup',
|
|
305
|
+
items,
|
|
306
|
+
});
|
|
363
307
|
if (props.bottomDisplayCompoments) {
|
|
364
308
|
props.bottomDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
365
309
|
}
|
|
366
310
|
if (props.isRequired) {
|
|
367
311
|
simpleEditor.addHasResponseValidation();
|
|
368
312
|
}
|
|
313
|
+
if (props.customValidations) {
|
|
314
|
+
props.customValidations.forEach(v => simpleEditor.editor.addValidation(v));
|
|
315
|
+
}
|
|
369
316
|
if (props.footnoteText) {
|
|
370
317
|
simpleEditor.addDisplayComponent(surveys_utils_componentGenerators.ComponentGenerators.footnote({ content: props.footnoteText }));
|
|
371
318
|
}
|
|
@@ -388,198 +335,6 @@ const generateSurveyEnd = (parentKey, content, condition) => {
|
|
|
388
335
|
editor.setCondition(condition);
|
|
389
336
|
return editor.getItem();
|
|
390
337
|
};
|
|
391
|
-
const SurveyItems = {
|
|
392
|
-
singleChoice: generateSingleChoiceQuestion,
|
|
393
|
-
responsiveSingleChoiceArray: generateResponsiveSingleChoiceArrayQuestion,
|
|
394
|
-
responsiveBipolarLikertArray: generateResponsiveBipolarLikertArray,
|
|
395
|
-
multipleChoice: generateMultipleChoiceQuestion,
|
|
396
|
-
simpleLikertGroup: generateSimpleLikertGroupQuestion,
|
|
397
|
-
dateInput: generateDatePickerInput,
|
|
398
|
-
multilineTextInput: generateMultilineInput,
|
|
399
|
-
dropDown: generateDropDownQuestion,
|
|
400
|
-
numericSlider: generateNumericSliderQuestion,
|
|
401
|
-
numericInput: generateNumericInputQuestion,
|
|
402
|
-
display: generateDisplay,
|
|
403
|
-
surveyEnd: generateSurveyEnd,
|
|
404
|
-
};
|
|
405
|
-
const initSingleChoiceGroup = (key, optionItems, order) => {
|
|
406
|
-
// init group
|
|
407
|
-
return initResponseGroup('singleChoiceGroup', key, optionItems, order);
|
|
408
|
-
};
|
|
409
|
-
const initMultipleChoiceGroup = (key, optionItems, order) => {
|
|
410
|
-
// init group
|
|
411
|
-
return initResponseGroup('multipleChoiceGroup', key, optionItems, order);
|
|
412
|
-
};
|
|
413
|
-
const initDropdownGroup = (key, optionItems, order, groupDisabled, groupContent, groupDescription) => {
|
|
414
|
-
// init group
|
|
415
|
-
return initResponseGroup('dropDownGroup', key, optionItems, order, groupDisabled, groupContent ? surveys_utils_simpleGenerators.generateLocStrings(groupContent) : undefined, groupDescription ? surveys_utils_simpleGenerators.generateLocStrings(groupDescription) : undefined);
|
|
416
|
-
};
|
|
417
|
-
const initSliderCategoricalGroup = (key, optionItems, order, groupDisabled) => {
|
|
418
|
-
// init group
|
|
419
|
-
return initResponseGroup('sliderCategorical', key, optionItems, order, groupDisabled);
|
|
420
|
-
};
|
|
421
|
-
const initResponseGroup = (type, key, optionItems, order, groupDisabled, groupContent, groupDescription) => {
|
|
422
|
-
// init group
|
|
423
|
-
const groupEdit = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
424
|
-
key: key,
|
|
425
|
-
isGroup: true,
|
|
426
|
-
role: type,
|
|
427
|
-
});
|
|
428
|
-
groupEdit.setOrder(order ? order : {
|
|
429
|
-
name: 'sequential'
|
|
430
|
-
});
|
|
431
|
-
if (groupDisabled) {
|
|
432
|
-
groupEdit.setDisabled(groupDisabled);
|
|
433
|
-
}
|
|
434
|
-
if (groupContent) {
|
|
435
|
-
groupEdit.setContent(groupContent);
|
|
436
|
-
}
|
|
437
|
-
if (groupDescription) {
|
|
438
|
-
groupEdit.setDescription(groupDescription);
|
|
439
|
-
}
|
|
440
|
-
// add option items
|
|
441
|
-
optionItems.forEach(optionDef => {
|
|
442
|
-
const optEditor = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
443
|
-
key: optionDef.key,
|
|
444
|
-
role: optionDef.role,
|
|
445
|
-
});
|
|
446
|
-
if (optionDef.content) {
|
|
447
|
-
optEditor.setContent(surveys_utils_simpleGenerators.generateLocStrings(optionDef.content));
|
|
448
|
-
}
|
|
449
|
-
if (optionDef.description) {
|
|
450
|
-
optEditor.setDescription(surveys_utils_simpleGenerators.generateLocStrings(optionDef.description));
|
|
451
|
-
}
|
|
452
|
-
if (optionDef.items) {
|
|
453
|
-
optionDef.items.forEach((item, index) => {
|
|
454
|
-
optEditor.addItemComponent({
|
|
455
|
-
key: index.toFixed(),
|
|
456
|
-
role: 'text',
|
|
457
|
-
content: surveys_utils_simpleGenerators.generateLocStrings(item.content),
|
|
458
|
-
style: item.className ? [{ key: 'className', value: item.className }] : undefined
|
|
459
|
-
});
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
switch (optionDef.role) {
|
|
463
|
-
case 'date':
|
|
464
|
-
optEditor.setDType('date');
|
|
465
|
-
break;
|
|
466
|
-
case 'numberInput':
|
|
467
|
-
optEditor.setDType('number');
|
|
468
|
-
break;
|
|
469
|
-
}
|
|
470
|
-
if (optionDef.displayCondition) {
|
|
471
|
-
optEditor.setDisplayCondition(optionDef.displayCondition);
|
|
472
|
-
}
|
|
473
|
-
if (optionDef.disabled) {
|
|
474
|
-
optEditor.setDisabled(optionDef.disabled);
|
|
475
|
-
}
|
|
476
|
-
if (optionDef.style) {
|
|
477
|
-
optEditor.setStyles(optionDef.style);
|
|
478
|
-
}
|
|
479
|
-
if (optionDef.optionProps) {
|
|
480
|
-
if (typeof (optionDef.optionProps.min) === 'number') {
|
|
481
|
-
optionDef.optionProps.min = { dtype: 'num', num: optionDef.optionProps.min };
|
|
482
|
-
}
|
|
483
|
-
if (typeof (optionDef.optionProps.max) === 'number') {
|
|
484
|
-
optionDef.optionProps.max = { dtype: 'num', num: optionDef.optionProps.max };
|
|
485
|
-
}
|
|
486
|
-
if (typeof (optionDef.optionProps.stepSize) === 'number') {
|
|
487
|
-
optionDef.optionProps.stepSize = { dtype: 'num', num: optionDef.optionProps.stepSize };
|
|
488
|
-
}
|
|
489
|
-
optEditor.setProperties(optionDef.optionProps);
|
|
490
|
-
}
|
|
491
|
-
groupEdit.addItemComponent(optEditor.getComponent());
|
|
492
|
-
});
|
|
493
|
-
return groupEdit.getComponent();
|
|
494
|
-
};
|
|
495
|
-
const initMatrixQuestion = (key, rows, order) => {
|
|
496
|
-
// init group
|
|
497
|
-
const groupEdit = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
498
|
-
key: key,
|
|
499
|
-
isGroup: true,
|
|
500
|
-
role: 'matrix',
|
|
501
|
-
});
|
|
502
|
-
groupEdit.setOrder(order ? order : {
|
|
503
|
-
name: 'sequential'
|
|
504
|
-
});
|
|
505
|
-
// init rows
|
|
506
|
-
rows.forEach(rowDef => {
|
|
507
|
-
const rowEditor = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
508
|
-
key: rowDef.key,
|
|
509
|
-
role: rowDef.role,
|
|
510
|
-
});
|
|
511
|
-
if (rowDef.displayCondition) {
|
|
512
|
-
rowEditor.setDisplayCondition(rowDef.displayCondition);
|
|
513
|
-
}
|
|
514
|
-
if (rowDef.disabled) {
|
|
515
|
-
rowEditor.setDisabled(rowDef.disabled);
|
|
516
|
-
}
|
|
517
|
-
switch (rowDef.role) {
|
|
518
|
-
case 'headerRow':
|
|
519
|
-
rowDef.cells.forEach(cell => {
|
|
520
|
-
const cellEditor = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
521
|
-
key: cell.key,
|
|
522
|
-
role: cell.role,
|
|
523
|
-
});
|
|
524
|
-
if (cell.content) {
|
|
525
|
-
cellEditor.setContent(surveys_utils_simpleGenerators.generateLocStrings(cell.content));
|
|
526
|
-
}
|
|
527
|
-
if (cell.description) {
|
|
528
|
-
cellEditor.setDescription(surveys_utils_simpleGenerators.generateLocStrings(cell.description));
|
|
529
|
-
}
|
|
530
|
-
rowEditor.addItemComponent(cellEditor.getComponent());
|
|
531
|
-
});
|
|
532
|
-
break;
|
|
533
|
-
case 'radioRow':
|
|
534
|
-
rowDef.cells.forEach(cell => {
|
|
535
|
-
const cellEditor = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
536
|
-
key: cell.key,
|
|
537
|
-
role: cell.role,
|
|
538
|
-
});
|
|
539
|
-
if (cell.content) {
|
|
540
|
-
cellEditor.setContent(surveys_utils_simpleGenerators.generateLocStrings(cell.content));
|
|
541
|
-
}
|
|
542
|
-
if (cell.description) {
|
|
543
|
-
cellEditor.setDescription(surveys_utils_simpleGenerators.generateLocStrings(cell.description));
|
|
544
|
-
}
|
|
545
|
-
rowEditor.addItemComponent(cellEditor.getComponent());
|
|
546
|
-
});
|
|
547
|
-
break;
|
|
548
|
-
case 'responseRow':
|
|
549
|
-
rowDef.cells.forEach(cell => {
|
|
550
|
-
const cellEditor = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
551
|
-
key: cell.key,
|
|
552
|
-
role: cell.role,
|
|
553
|
-
});
|
|
554
|
-
if (cell.content) {
|
|
555
|
-
cellEditor.setContent(surveys_utils_simpleGenerators.generateLocStrings(cell.content));
|
|
556
|
-
}
|
|
557
|
-
if (cell.description) {
|
|
558
|
-
cellEditor.setDescription(surveys_utils_simpleGenerators.generateLocStrings(cell.description));
|
|
559
|
-
}
|
|
560
|
-
cellEditor.setProperties(cell.properties);
|
|
561
|
-
if (cell.items) {
|
|
562
|
-
cell.items.forEach(opt => {
|
|
563
|
-
const cellOptionEditor = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
564
|
-
key: opt.key,
|
|
565
|
-
role: opt.role,
|
|
566
|
-
});
|
|
567
|
-
if (opt.content) {
|
|
568
|
-
cellOptionEditor.setContent(surveys_utils_simpleGenerators.generateLocStrings(opt.content));
|
|
569
|
-
}
|
|
570
|
-
cellOptionEditor.setDisabled(opt.disabled);
|
|
571
|
-
cellOptionEditor.setDisplayCondition(opt.displayCondition);
|
|
572
|
-
cellEditor.addItemComponent(cellOptionEditor.getComponent());
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
rowEditor.addItemComponent(cellEditor.getComponent());
|
|
576
|
-
});
|
|
577
|
-
break;
|
|
578
|
-
}
|
|
579
|
-
groupEdit.addItemComponent(rowEditor.getComponent());
|
|
580
|
-
});
|
|
581
|
-
return groupEdit.getComponent();
|
|
582
|
-
};
|
|
583
338
|
const initEQ5DHealthIndicatorQuestion = (props) => {
|
|
584
339
|
// init group
|
|
585
340
|
const groupEdit = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
@@ -601,349 +356,29 @@ const initEQ5DHealthIndicatorQuestion = (props) => {
|
|
|
601
356
|
groupEdit.addItemComponent(maxHealthTextEditor.getComponent());
|
|
602
357
|
return groupEdit.getComponent();
|
|
603
358
|
};
|
|
604
|
-
const
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
groupEdit.addItemComponent(desc);
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
|
-
const item = initLikertScaleItem(row.key, scaleOptions.map(option => {
|
|
628
|
-
var _a, _b;
|
|
629
|
-
return {
|
|
630
|
-
key: option.key,
|
|
631
|
-
className: option.className,
|
|
632
|
-
content: row.hideLabels ? undefined : option.content,
|
|
633
|
-
disabled: (_b = (_a = row.optionDisabled) === null || _a === void 0 ? void 0 : _a.find(cond => cond.optionKey === option.key)) === null || _b === void 0 ? void 0 : _b.exp,
|
|
634
|
-
};
|
|
635
|
-
}), stackOnSmallScreen, row.displayCondition);
|
|
636
|
-
groupEdit.addItemComponent(item);
|
|
637
|
-
});
|
|
638
|
-
return groupEdit.getComponent();
|
|
639
|
-
};
|
|
640
|
-
const initResponsiveSingleChoiceArray = (rgKey, props, displayCondition) => {
|
|
641
|
-
var _a, _b;
|
|
642
|
-
const groupEdit = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
643
|
-
key: rgKey,
|
|
644
|
-
isGroup: true,
|
|
645
|
-
role: 'responsiveSingleChoiceArray',
|
|
646
|
-
});
|
|
647
|
-
if (displayCondition) {
|
|
648
|
-
groupEdit.setDisplayCondition(displayCondition);
|
|
649
|
-
}
|
|
650
|
-
const style = [
|
|
651
|
-
{ key: 'defaultMode', value: props.defaultMode },
|
|
652
|
-
];
|
|
653
|
-
if (props.responsiveModes) {
|
|
654
|
-
if (props.responsiveModes.sm) {
|
|
655
|
-
style.push({ key: 'smMode', value: props.responsiveModes.sm });
|
|
656
|
-
}
|
|
657
|
-
if (props.responsiveModes.md) {
|
|
658
|
-
style.push({ key: 'mdMode', value: props.responsiveModes.md });
|
|
659
|
-
}
|
|
660
|
-
if (props.responsiveModes.lg) {
|
|
661
|
-
style.push({ key: 'lgMode', value: props.responsiveModes.lg });
|
|
662
|
-
}
|
|
663
|
-
if (props.responsiveModes.xl) {
|
|
664
|
-
style.push({ key: 'xlMode', value: props.responsiveModes.xl });
|
|
665
|
-
}
|
|
666
|
-
if (props.responsiveModes.xxl) {
|
|
667
|
-
style.push({ key: 'xxlMode', value: props.responsiveModes.xxl });
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
if (props.rgClassName) {
|
|
671
|
-
style.push({ key: 'className', value: props.rgClassName });
|
|
672
|
-
}
|
|
673
|
-
if (props.verticalModeProps) {
|
|
674
|
-
if (props.verticalModeProps.useReverseOptionOrder) {
|
|
675
|
-
style.push({ key: 'verticalModeReverseOrder', value: 'true' });
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
if (props.tableModeProps) {
|
|
679
|
-
style.push({ key: 'tableModeClassName', value: 'table-borderless mb-0 ' + props.tableModeProps.className });
|
|
680
|
-
if (props.tableModeProps.layout) {
|
|
681
|
-
style.push({ key: 'tableModeLayout', value: props.tableModeProps.layout });
|
|
682
|
-
}
|
|
683
|
-
if (props.tableModeProps.firstColWidth) {
|
|
684
|
-
style.push({ key: 'tableModeFirstColWidth', value: props.tableModeProps.firstColWidth });
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
groupEdit.setStyles(style);
|
|
688
|
-
const defaultBorderClass = 'border-bottom border-grey-2';
|
|
689
|
-
let tableModeOptionHeaderClassName = undefined;
|
|
690
|
-
if (!((_a = props.tableModeProps) === null || _a === void 0 ? void 0 : _a.hideRowBorder)) {
|
|
691
|
-
tableModeOptionHeaderClassName = defaultBorderClass;
|
|
692
|
-
}
|
|
693
|
-
if ((_b = props.tableModeProps) === null || _b === void 0 ? void 0 : _b.optionHeaderClassName) {
|
|
694
|
-
tableModeOptionHeaderClassName += ' ' + props.tableModeProps.optionHeaderClassName;
|
|
695
|
-
}
|
|
696
|
-
const optionStyles = [];
|
|
697
|
-
if (tableModeOptionHeaderClassName) {
|
|
698
|
-
optionStyles.push({ key: 'tableModeClassName', value: tableModeOptionHeaderClassName });
|
|
699
|
-
}
|
|
700
|
-
groupEdit.addItemComponent({
|
|
701
|
-
key: 'header',
|
|
702
|
-
role: 'options',
|
|
703
|
-
style: optionStyles.length > 0 ? optionStyles : undefined,
|
|
704
|
-
items: props.scaleOptions.map(option => {
|
|
705
|
-
return {
|
|
706
|
-
key: option.key,
|
|
707
|
-
role: 'option',
|
|
708
|
-
style: option.className ? [{ key: 'className', value: option.className }] : undefined,
|
|
709
|
-
content: !Array.isArray(option.content) ? surveys_utils_simpleGenerators.generateLocStrings(option.content) : undefined,
|
|
710
|
-
items: Array.isArray(option.content) ? option.content.map((cont, index) => {
|
|
711
|
-
return {
|
|
712
|
-
key: index.toFixed(),
|
|
713
|
-
role: 'text',
|
|
714
|
-
content: surveys_utils_simpleGenerators.generateLocStrings(cont.content),
|
|
715
|
-
style: cont.className ? [{ key: 'className', value: cont.className }] : undefined,
|
|
716
|
-
};
|
|
717
|
-
}) : [],
|
|
718
|
-
};
|
|
719
|
-
})
|
|
720
|
-
});
|
|
721
|
-
props.rows.forEach((row, index) => {
|
|
722
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
723
|
-
let tableModeRowClassName = undefined;
|
|
724
|
-
let horizontalModeRowClassName = undefined;
|
|
725
|
-
let verticalModeRowClassName = undefined;
|
|
726
|
-
const isLast = index === props.rows.length - 1;
|
|
727
|
-
if (!((_a = props.tableModeProps) === null || _a === void 0 ? void 0 : _a.hideRowBorder) && !isLast) {
|
|
728
|
-
tableModeRowClassName = defaultBorderClass;
|
|
729
|
-
}
|
|
730
|
-
if ((_b = row.tableModeProps) === null || _b === void 0 ? void 0 : _b.className) {
|
|
731
|
-
tableModeRowClassName += ' ' + ((_c = row.tableModeProps) === null || _c === void 0 ? void 0 : _c.className);
|
|
732
|
-
}
|
|
733
|
-
if (!((_d = props.horizontalModeProps) === null || _d === void 0 ? void 0 : _d.hideRowBorder) && !isLast) {
|
|
734
|
-
horizontalModeRowClassName = defaultBorderClass;
|
|
735
|
-
}
|
|
736
|
-
if ((_e = row.horizontalModeProps) === null || _e === void 0 ? void 0 : _e.className) {
|
|
737
|
-
horizontalModeRowClassName += ' ' + ((_f = row.horizontalModeProps) === null || _f === void 0 ? void 0 : _f.className);
|
|
738
|
-
}
|
|
739
|
-
if (!((_g = props.verticalModeProps) === null || _g === void 0 ? void 0 : _g.hideRowBorder) && !isLast) {
|
|
740
|
-
verticalModeRowClassName = defaultBorderClass;
|
|
741
|
-
}
|
|
742
|
-
if ((_h = row.verticalModeProps) === null || _h === void 0 ? void 0 : _h.className) {
|
|
743
|
-
verticalModeRowClassName += ' ' + ((_j = row.verticalModeProps) === null || _j === void 0 ? void 0 : _j.className);
|
|
744
|
-
}
|
|
745
|
-
const rowStyles = [];
|
|
746
|
-
if (tableModeRowClassName) {
|
|
747
|
-
rowStyles.push({ key: 'tableModeClassName', value: tableModeRowClassName });
|
|
748
|
-
}
|
|
749
|
-
if (horizontalModeRowClassName) {
|
|
750
|
-
rowStyles.push({ key: 'horizontalModeClassName', value: horizontalModeRowClassName });
|
|
751
|
-
}
|
|
752
|
-
if (verticalModeRowClassName) {
|
|
753
|
-
rowStyles.push({ key: 'verticalModeClassName', value: verticalModeRowClassName });
|
|
754
|
-
}
|
|
755
|
-
if ((_k = row.horizontalModeProps) === null || _k === void 0 ? void 0 : _k.labelPlacement) {
|
|
756
|
-
rowStyles.push({ key: 'horizontalModeLabelPlacement', value: row.horizontalModeProps.labelPlacement });
|
|
757
|
-
}
|
|
758
|
-
groupEdit.addItemComponent({
|
|
759
|
-
key: row.key,
|
|
760
|
-
role: 'row',
|
|
761
|
-
style: rowStyles.length > 0 ? rowStyles : undefined,
|
|
762
|
-
content: !Array.isArray(row.content) ? surveys_utils_simpleGenerators.generateLocStrings(row.content) : undefined,
|
|
763
|
-
items: Array.isArray(row.content) ? row.content.map((cont, index) => {
|
|
764
|
-
return {
|
|
765
|
-
key: index.toFixed(),
|
|
766
|
-
role: 'text',
|
|
767
|
-
content: surveys_utils_simpleGenerators.generateLocStrings(cont.content),
|
|
768
|
-
style: cont.className ? [{ key: 'className', value: cont.className }] : undefined,
|
|
769
|
-
};
|
|
770
|
-
}) : [],
|
|
771
|
-
});
|
|
772
|
-
});
|
|
773
|
-
return groupEdit.getComponent();
|
|
774
|
-
};
|
|
775
|
-
const initResponsiveBipolarLikertArray = (rgKey, props, displayCondition) => {
|
|
776
|
-
var _a;
|
|
777
|
-
const groupEdit = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
778
|
-
key: rgKey,
|
|
779
|
-
isGroup: true,
|
|
780
|
-
role: 'responsiveBipolarLikertScaleArray',
|
|
781
|
-
});
|
|
782
|
-
if (displayCondition) {
|
|
783
|
-
groupEdit.setDisplayCondition(displayCondition);
|
|
784
|
-
}
|
|
785
|
-
const style = [
|
|
786
|
-
{ key: 'defaultMode', value: props.defaultMode },
|
|
787
|
-
];
|
|
788
|
-
if (props.responsiveModes) {
|
|
789
|
-
if (props.responsiveModes.sm) {
|
|
790
|
-
style.push({ key: 'smMode', value: props.responsiveModes.sm });
|
|
791
|
-
}
|
|
792
|
-
if (props.responsiveModes.md) {
|
|
793
|
-
style.push({ key: 'mdMode', value: props.responsiveModes.md });
|
|
794
|
-
}
|
|
795
|
-
if (props.responsiveModes.lg) {
|
|
796
|
-
style.push({ key: 'lgMode', value: props.responsiveModes.lg });
|
|
797
|
-
}
|
|
798
|
-
if (props.responsiveModes.xl) {
|
|
799
|
-
style.push({ key: 'xlMode', value: props.responsiveModes.xl });
|
|
800
|
-
}
|
|
801
|
-
if (props.responsiveModes.xxl) {
|
|
802
|
-
style.push({ key: 'xxlMode', value: props.responsiveModes.xxl });
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
if (props.rgClassName) {
|
|
806
|
-
style.push({ key: 'className', value: props.rgClassName });
|
|
807
|
-
}
|
|
808
|
-
if (props.withLabelRowModeProps) {
|
|
809
|
-
if (props.withLabelRowModeProps.maxLabelWidth) {
|
|
810
|
-
style.push({ key: 'labelRowMaxLabelWidth', value: props.withLabelRowModeProps.maxLabelWidth });
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
style.push({ key: 'labelRowPosition', value: ((_a = props.withLabelRowModeProps) === null || _a === void 0 ? void 0 : _a.useBottomLabel) ? 'bottom' : 'top' });
|
|
814
|
-
if (props.tableModeProps) {
|
|
815
|
-
style.push({ key: 'tableModeClassName', value: 'table-borderless mb-0 ' + props.tableModeProps.className });
|
|
816
|
-
if (props.tableModeProps.layout) {
|
|
817
|
-
style.push({ key: 'tableModeLayout', value: props.tableModeProps.layout });
|
|
818
|
-
}
|
|
819
|
-
if (props.tableModeProps.labelColWidth) {
|
|
820
|
-
style.push({ key: 'tableModeLabelColWidth', value: props.tableModeProps.labelColWidth });
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
groupEdit.setStyles(style);
|
|
824
|
-
const defaultBorderClass = 'border-bottom border-grey-2';
|
|
825
|
-
groupEdit.addItemComponent({
|
|
826
|
-
key: 'options',
|
|
827
|
-
role: 'options',
|
|
828
|
-
items: props.scaleOptions.map(option => {
|
|
829
|
-
return {
|
|
830
|
-
key: option.key,
|
|
831
|
-
role: 'option',
|
|
832
|
-
};
|
|
833
|
-
})
|
|
834
|
-
});
|
|
835
|
-
props.rows.forEach((row, index) => {
|
|
836
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
837
|
-
let tableModeRowClassName = undefined;
|
|
838
|
-
let withLabelRowModeClassName = undefined;
|
|
839
|
-
let verticalModeRowClassName = undefined;
|
|
840
|
-
const isLast = index === props.rows.length - 1;
|
|
841
|
-
if (!((_a = props.tableModeProps) === null || _a === void 0 ? void 0 : _a.hideRowBorder) && !isLast) {
|
|
842
|
-
tableModeRowClassName = defaultBorderClass;
|
|
843
|
-
}
|
|
844
|
-
if ((_b = row.tableModeProps) === null || _b === void 0 ? void 0 : _b.className) {
|
|
845
|
-
tableModeRowClassName += ' ' + ((_c = row.tableModeProps) === null || _c === void 0 ? void 0 : _c.className);
|
|
846
|
-
}
|
|
847
|
-
if (!((_d = props.withLabelRowModeProps) === null || _d === void 0 ? void 0 : _d.hideRowBorder) && !isLast) {
|
|
848
|
-
withLabelRowModeClassName = defaultBorderClass;
|
|
849
|
-
}
|
|
850
|
-
if ((_e = row.withLabelRowModeProps) === null || _e === void 0 ? void 0 : _e.className) {
|
|
851
|
-
withLabelRowModeClassName += ' ' + ((_f = row.withLabelRowModeProps) === null || _f === void 0 ? void 0 : _f.className);
|
|
852
|
-
}
|
|
853
|
-
if (!((_g = props.verticalModeProps) === null || _g === void 0 ? void 0 : _g.hideRowBorder) && !isLast) {
|
|
854
|
-
verticalModeRowClassName = defaultBorderClass;
|
|
855
|
-
}
|
|
856
|
-
if ((_h = row.verticalModeProps) === null || _h === void 0 ? void 0 : _h.className) {
|
|
857
|
-
verticalModeRowClassName += ' ' + ((_j = row.verticalModeProps) === null || _j === void 0 ? void 0 : _j.className);
|
|
858
|
-
}
|
|
859
|
-
const rowStyles = [];
|
|
860
|
-
if (tableModeRowClassName) {
|
|
861
|
-
rowStyles.push({ key: 'tableModeClassName', value: tableModeRowClassName });
|
|
862
|
-
}
|
|
863
|
-
if (withLabelRowModeClassName) {
|
|
864
|
-
rowStyles.push({ key: 'withLabelRowModeClassName', value: withLabelRowModeClassName });
|
|
865
|
-
}
|
|
866
|
-
if (verticalModeRowClassName) {
|
|
867
|
-
rowStyles.push({ key: 'verticalModeClassName', value: verticalModeRowClassName });
|
|
868
|
-
}
|
|
869
|
-
const startLabel = {
|
|
870
|
-
key: 'start',
|
|
871
|
-
role: 'start',
|
|
872
|
-
content: !Array.isArray(row.startLabel) ? surveys_utils_simpleGenerators.generateLocStrings(row.startLabel) : undefined,
|
|
873
|
-
items: Array.isArray(row.startLabel) ? row.startLabel.map((cont, index) => {
|
|
874
|
-
return {
|
|
875
|
-
key: index.toFixed(),
|
|
876
|
-
role: 'text',
|
|
877
|
-
content: surveys_utils_simpleGenerators.generateLocStrings(cont.content),
|
|
878
|
-
style: cont.className ? [{ key: 'className', value: cont.className }] : undefined,
|
|
879
|
-
};
|
|
880
|
-
}) : [],
|
|
881
|
-
};
|
|
882
|
-
const endLabel = {
|
|
883
|
-
key: 'end',
|
|
884
|
-
role: 'end',
|
|
885
|
-
content: !Array.isArray(row.endLabel) ? surveys_utils_simpleGenerators.generateLocStrings(row.endLabel) : undefined,
|
|
886
|
-
items: Array.isArray(row.endLabel) ? row.endLabel.map((cont, index) => {
|
|
887
|
-
return {
|
|
888
|
-
key: index.toFixed(),
|
|
889
|
-
role: 'text',
|
|
890
|
-
content: surveys_utils_simpleGenerators.generateLocStrings(cont.content),
|
|
891
|
-
style: cont.className ? [{ key: 'className', value: cont.className }] : undefined,
|
|
892
|
-
};
|
|
893
|
-
}) : [],
|
|
894
|
-
};
|
|
895
|
-
groupEdit.addItemComponent({
|
|
896
|
-
key: row.key,
|
|
897
|
-
role: 'row',
|
|
898
|
-
style: rowStyles.length > 0 ? rowStyles : undefined,
|
|
899
|
-
items: [
|
|
900
|
-
startLabel, endLabel
|
|
901
|
-
],
|
|
902
|
-
});
|
|
903
|
-
});
|
|
904
|
-
return groupEdit.getComponent();
|
|
905
|
-
};
|
|
906
|
-
const initLikertScaleItem = (key, options, stackOnSmallScreen, displayCondition) => {
|
|
907
|
-
// init group
|
|
908
|
-
const groupEdit = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
909
|
-
key: key,
|
|
910
|
-
isGroup: true,
|
|
911
|
-
role: 'likert',
|
|
912
|
-
});
|
|
913
|
-
groupEdit.setDisplayCondition(displayCondition);
|
|
914
|
-
if (stackOnSmallScreen) {
|
|
915
|
-
groupEdit.setStyles([
|
|
916
|
-
{ key: 'responsive', value: 'stackOnSmallScreen' }
|
|
917
|
-
]);
|
|
359
|
+
const SurveyItems = {
|
|
360
|
+
consent: generateConsentQuestion,
|
|
361
|
+
singleChoice: generateSingleChoiceQuestion,
|
|
362
|
+
responsiveSingleChoiceArray: generateResponsiveSingleChoiceArrayQuestion,
|
|
363
|
+
responsiveBipolarLikertArray: generateResponsiveBipolarLikertArray,
|
|
364
|
+
multipleChoice: generateMultipleChoiceQuestion,
|
|
365
|
+
dateInput: generateDatePickerInput,
|
|
366
|
+
timeInput: generateTimeInput,
|
|
367
|
+
textInput: generateTextInputQuestion,
|
|
368
|
+
// eq5dSlider: todo,
|
|
369
|
+
clozeQuestion: generateClozeQuestion,
|
|
370
|
+
numericInput: generateNumericInputQuestion,
|
|
371
|
+
multilineTextInput: generateMultilineInput,
|
|
372
|
+
dropDown: generateDropDownQuestion,
|
|
373
|
+
numericSlider: generateNumericSliderQuestion,
|
|
374
|
+
display: generateDisplay,
|
|
375
|
+
surveyEnd: generateSurveyEnd,
|
|
376
|
+
customQuestion: generateCustomQuestion,
|
|
377
|
+
old: {
|
|
378
|
+
simpleLikertGroup: generateSimpleLikertGroupQuestion,
|
|
918
379
|
}
|
|
919
|
-
options.forEach((option) => {
|
|
920
|
-
const optionComponent = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
921
|
-
key: option.key,
|
|
922
|
-
role: 'option',
|
|
923
|
-
});
|
|
924
|
-
if (option.content) {
|
|
925
|
-
optionComponent.setContent(surveys_utils_simpleGenerators.generateLocStrings(option.content));
|
|
926
|
-
}
|
|
927
|
-
if (option.className) {
|
|
928
|
-
optionComponent.setStyles([{
|
|
929
|
-
key: 'className', value: option.className
|
|
930
|
-
}]);
|
|
931
|
-
}
|
|
932
|
-
optionComponent.setDisabled(option.disabled);
|
|
933
|
-
groupEdit.addItemComponent(optionComponent.getComponent());
|
|
934
|
-
});
|
|
935
|
-
return groupEdit.getComponent();
|
|
936
380
|
};
|
|
937
381
|
|
|
938
382
|
exports.SurveyItems = SurveyItems;
|
|
939
|
-
exports.initDropdownGroup = initDropdownGroup;
|
|
940
383
|
exports.initEQ5DHealthIndicatorQuestion = initEQ5DHealthIndicatorQuestion;
|
|
941
|
-
exports.initLikertScaleGroup = initLikertScaleGroup;
|
|
942
|
-
exports.initLikertScaleItem = initLikertScaleItem;
|
|
943
|
-
exports.initMatrixQuestion = initMatrixQuestion;
|
|
944
|
-
exports.initMultipleChoiceGroup = initMultipleChoiceGroup;
|
|
945
|
-
exports.initResponsiveBipolarLikertArray = initResponsiveBipolarLikertArray;
|
|
946
|
-
exports.initResponsiveSingleChoiceArray = initResponsiveSingleChoiceArray;
|
|
947
|
-
exports.initSingleChoiceGroup = initSingleChoiceGroup;
|
|
948
|
-
exports.initSliderCategoricalGroup = initSliderCategoricalGroup;
|
|
949
384
|
//# sourceMappingURL=survey-items.js.map
|