case-editor-tools 1.0.0-beta.21 → 1.0.0-beta.22
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "case-editor-tools",
|
|
3
3
|
"description": "Javascript tools to simplify survey and study coding for CASE.",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.22",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": "github:case-framework/case-editor-tools",
|
|
@@ -24,7 +24,7 @@ interface CustomResponseItem extends ResponseComponent {
|
|
|
24
24
|
mapToRole?: 'singleChoiceGroup' | 'multipleChoiceGroup' | 'input';
|
|
25
25
|
}
|
|
26
26
|
interface CustomQuestionProps extends GenericQuestionProps {
|
|
27
|
-
|
|
27
|
+
responseItemDefs: CustomResponseItem[];
|
|
28
28
|
}
|
|
29
29
|
interface DisplayProps {
|
|
30
30
|
parentKey: string;
|
package/surveys/survey-items.js
CHANGED
|
@@ -199,10 +199,43 @@ const generateClozeQuestion = (props) => {
|
|
|
199
199
|
return commonQuestionGenerator(props, rg_inner);
|
|
200
200
|
};
|
|
201
201
|
const generateCustomQuestion = (props) => {
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
const items = [];
|
|
203
|
+
props.responseItemDefs.forEach(item => {
|
|
204
|
+
const rolePrefix = item.mapToRole !== undefined ? `${item.mapToRole}` : '';
|
|
205
|
+
const role = `${rolePrefix}:${item.role}`;
|
|
206
|
+
const rg_inner = Object.assign(Object.assign({}, item), { role: role });
|
|
207
|
+
items.push(rg_inner);
|
|
208
|
+
});
|
|
209
|
+
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, props.version ? props.version : 1);
|
|
210
|
+
// QUESTION TEXT
|
|
211
|
+
simpleEditor.setTitle(props.questionText, props.questionSubText, props.titleClassName);
|
|
212
|
+
if (props.condition) {
|
|
213
|
+
simpleEditor.setCondition(props.condition);
|
|
214
|
+
}
|
|
215
|
+
if (props.helpGroupContent) {
|
|
216
|
+
simpleEditor.editor.setHelpGroupComponent(surveys_utils_simpleGenerators.generateHelpGroupComponent(props.helpGroupContent));
|
|
217
|
+
}
|
|
218
|
+
if (props.topDisplayCompoments) {
|
|
219
|
+
props.topDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
220
|
+
}
|
|
221
|
+
simpleEditor.editor.addExistingResponseComponent({
|
|
222
|
+
key: constants_keyDefinitions.responseGroupKey,
|
|
223
|
+
role: 'responseGroup',
|
|
224
|
+
items,
|
|
225
|
+
});
|
|
226
|
+
if (props.bottomDisplayCompoments) {
|
|
227
|
+
props.bottomDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
228
|
+
}
|
|
229
|
+
if (props.isRequired) {
|
|
230
|
+
simpleEditor.addHasResponseValidation();
|
|
231
|
+
}
|
|
232
|
+
if (props.customValidations) {
|
|
233
|
+
props.customValidations.forEach(v => simpleEditor.editor.addValidation(v));
|
|
234
|
+
}
|
|
235
|
+
if (props.footnoteText) {
|
|
236
|
+
simpleEditor.addDisplayComponent(surveys_utils_componentGenerators.ComponentGenerators.footnote({ content: props.footnoteText }));
|
|
237
|
+
}
|
|
238
|
+
return simpleEditor.getItem();
|
|
206
239
|
};
|
|
207
240
|
const generateDisplay = (props) => {
|
|
208
241
|
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"survey-items.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"survey-items.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|