case-editor-tools 1.0.0-beta.38 → 1.0.0-beta.41
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/expression-utils/studyEngineExpressions.d.ts +8 -0
- package/expression-utils/studyEngineExpressions.js +19 -0
- package/expression-utils/studyEngineExpressions.js.map +1 -1
- package/package.json +1 -1
- package/surveys/survey-items.d.ts +5 -1
- package/surveys/survey-items.js +15 -3
- package/surveys/survey-items.js.map +1 -1
- package/surveys/utils/optionDefGenerators.d.ts +3 -0
- package/surveys/utils/optionDefGenerators.js +8 -0
- package/surveys/utils/optionDefGenerators.js.map +1 -1
|
@@ -72,6 +72,10 @@ export declare const StudyEngineActions: {
|
|
|
72
72
|
removeAll: () => Expression;
|
|
73
73
|
remove: (messageType: string) => Expression;
|
|
74
74
|
};
|
|
75
|
+
confidentialResponses: {
|
|
76
|
+
removeByKey: (key: string) => Expression;
|
|
77
|
+
removeAll: () => Expression;
|
|
78
|
+
};
|
|
75
79
|
stopParticipation: () => Expression;
|
|
76
80
|
finishParticipation: () => Expression;
|
|
77
81
|
};
|
|
@@ -130,6 +134,10 @@ export declare const StudyEngine: {
|
|
|
130
134
|
removeAll: () => Expression;
|
|
131
135
|
remove: (messageType: string) => Expression;
|
|
132
136
|
};
|
|
137
|
+
confidentialResponses: {
|
|
138
|
+
removeByKey: (key: string) => Expression;
|
|
139
|
+
removeAll: () => Expression;
|
|
140
|
+
};
|
|
133
141
|
stopParticipation: () => Expression;
|
|
134
142
|
finishParticipation: () => Expression;
|
|
135
143
|
};
|
|
@@ -236,6 +236,21 @@ const INIT_REPORT = (reportKey) => {
|
|
|
236
236
|
const CANCEL_REPORT = (reportKey) => {
|
|
237
237
|
return expressionUtils_expressionGen.generateExpression('CANCEL_REPORT', undefined, reportKey);
|
|
238
238
|
};
|
|
239
|
+
/**
|
|
240
|
+
* Remove the confidential responses with this key for the participant
|
|
241
|
+
* @param key key of the confidential responses that should be removed
|
|
242
|
+
* @returns
|
|
243
|
+
*/
|
|
244
|
+
const REMOVE_CONFIDENTIAL_RESPONSE_BY_KEY = (key) => {
|
|
245
|
+
return expressionUtils_expressionGen.generateExpression('REMOVE_CONFIDENTIAL_RESPONSE_BY_KEY', undefined, key);
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Remove all confidential responses for the participant
|
|
249
|
+
* @returns
|
|
250
|
+
*/
|
|
251
|
+
const REMOVE_ALL_CONFIDENTIAL_RESPONSES = () => {
|
|
252
|
+
return expressionUtils_expressionGen.generateExpression('REMOVE_ALL_CONFIDENTIAL_RESPONSES', undefined);
|
|
253
|
+
};
|
|
239
254
|
/**
|
|
240
255
|
* Update one value attribute in a report. If report was not initialized, one will be added to the list.
|
|
241
256
|
* @param reportKey
|
|
@@ -400,6 +415,10 @@ const StudyEngineActions = {
|
|
|
400
415
|
removeAll: REMOVE_ALL_MESSAGES,
|
|
401
416
|
remove: REMOVE_MESSAGES_BY_TYPE,
|
|
402
417
|
},
|
|
418
|
+
confidentialResponses: {
|
|
419
|
+
removeByKey: REMOVE_CONFIDENTIAL_RESPONSE_BY_KEY,
|
|
420
|
+
removeAll: REMOVE_ALL_CONFIDENTIAL_RESPONSES,
|
|
421
|
+
},
|
|
403
422
|
// Extra methods:
|
|
404
423
|
stopParticipation,
|
|
405
424
|
finishParticipation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"studyEngineExpressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"studyEngineExpressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
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.41",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": "github:case-framework/case-editor-tools",
|
|
@@ -4,6 +4,10 @@ import { LikertGroupRow } from "./responseTypeGenerators/likertGroupComponents";
|
|
|
4
4
|
interface OptionQuestionProps extends GenericQuestionProps {
|
|
5
5
|
responseOptions: Array<OptionDef>;
|
|
6
6
|
}
|
|
7
|
+
interface DropDownQuestionProps extends GenericQuestionProps {
|
|
8
|
+
responseOptions: Array<OptionDef>;
|
|
9
|
+
placeholder?: Map<string, string>;
|
|
10
|
+
}
|
|
7
11
|
interface LikertGroupQuestionProps extends GenericQuestionProps {
|
|
8
12
|
rows: Array<LikertGroupRow>;
|
|
9
13
|
scaleOptions: Array<{
|
|
@@ -56,7 +60,7 @@ export declare const SurveyItems: {
|
|
|
56
60
|
clozeQuestion: (props: ClozeQuestionProps) => SurveyItem;
|
|
57
61
|
numericInput: (props: NumericInputQuestionProps) => SurveyItem;
|
|
58
62
|
multilineTextInput: (props: MultiLineTextInput) => SurveyItem;
|
|
59
|
-
dropDown: (props:
|
|
63
|
+
dropDown: (props: DropDownQuestionProps) => SurveyItem;
|
|
60
64
|
numericSlider: (props: NumericSliderProps) => SurveyItem;
|
|
61
65
|
display: (props: DisplayProps) => SurveyItem;
|
|
62
66
|
surveyEnd: (parentKey: string, content: Map<string, string>, condition?: Expression | undefined) => SurveyItem;
|
package/surveys/survey-items.js
CHANGED
|
@@ -74,7 +74,7 @@ const generateSingleChoiceQuestion = (props) => {
|
|
|
74
74
|
return commonQuestionGenerator(props, rg_inner);
|
|
75
75
|
};
|
|
76
76
|
const generateDropDownQuestion = (props) => {
|
|
77
|
-
const rg_inner = surveys_responseTypeGenerators_optionGroupComponents.initDropdownGroup(constants_keyDefinitions.dropDownKey, props.responseOptions);
|
|
77
|
+
const rg_inner = surveys_responseTypeGenerators_optionGroupComponents.initDropdownGroup(constants_keyDefinitions.dropDownKey, props.responseOptions, undefined, undefined, undefined, props.placeholder);
|
|
78
78
|
return commonQuestionGenerator(props, rg_inner);
|
|
79
79
|
};
|
|
80
80
|
const generateMultipleChoiceQuestion = (props) => {
|
|
@@ -108,7 +108,13 @@ const generateResponsiveSingleChoiceArrayQuestion = (props) => {
|
|
|
108
108
|
(_a = props.customValidations) === null || _a === void 0 ? void 0 : _a.push({
|
|
109
109
|
key: 'r',
|
|
110
110
|
type: 'hard',
|
|
111
|
-
rule: surveys_utils_simpleGenerators.expWithArgs('and', ...props.rows.map(r =>
|
|
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
|
+
}))
|
|
112
118
|
});
|
|
113
119
|
}
|
|
114
120
|
return commonQuestionGenerator(props, rg_inner);
|
|
@@ -124,7 +130,13 @@ const generateResponsiveBipolarLikertArray = (props) => {
|
|
|
124
130
|
(_a = props.customValidations) === null || _a === void 0 ? void 0 : _a.push({
|
|
125
131
|
key: 'r',
|
|
126
132
|
type: 'hard',
|
|
127
|
-
rule: surveys_utils_simpleGenerators.expWithArgs('and', ...props.rows.map(r =>
|
|
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
|
+
}))
|
|
128
140
|
});
|
|
129
141
|
}
|
|
130
142
|
return commonQuestionGenerator(props, rg_inner);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"survey-items.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"survey-items.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -30,6 +30,7 @@ export declare const SingleChoiceOptionTypes: {
|
|
|
30
30
|
cloze: (props: ClozeProps & {
|
|
31
31
|
key: string;
|
|
32
32
|
displayCondition?: Expression;
|
|
33
|
+
className?: string;
|
|
33
34
|
}) => OptionDef;
|
|
34
35
|
};
|
|
35
36
|
export declare const MultipleChoiceOptionTypes: {
|
|
@@ -50,6 +51,7 @@ export declare const MultipleChoiceOptionTypes: {
|
|
|
50
51
|
cloze: (props: ClozeProps & {
|
|
51
52
|
key: string;
|
|
52
53
|
displayCondition?: Expression;
|
|
54
|
+
className?: string;
|
|
53
55
|
}) => OptionDef;
|
|
54
56
|
};
|
|
55
57
|
export declare const ClozeItemTypes: {
|
|
@@ -74,6 +76,7 @@ export declare const ClozeItemTypes: {
|
|
|
74
76
|
}) => OptionDef;
|
|
75
77
|
dropDown: (props: {
|
|
76
78
|
key: string;
|
|
79
|
+
placeholder?: Map<string, string>;
|
|
77
80
|
displayCondition?: Expression;
|
|
78
81
|
options: Array<OptionDef>;
|
|
79
82
|
}) => OptionDef;
|
|
@@ -152,15 +152,23 @@ const dropDown = (props) => {
|
|
|
152
152
|
key: props.key,
|
|
153
153
|
role: 'dropDownGroup',
|
|
154
154
|
displayCondition: props.displayCondition,
|
|
155
|
+
description: props.placeholder,
|
|
155
156
|
items: props.options,
|
|
156
157
|
};
|
|
157
158
|
};
|
|
158
159
|
const cloze = (props) => {
|
|
160
|
+
const styles = [];
|
|
161
|
+
if (props.className !== undefined) {
|
|
162
|
+
styles.push({
|
|
163
|
+
key: 'className', value: props.className
|
|
164
|
+
});
|
|
165
|
+
}
|
|
159
166
|
return {
|
|
160
167
|
key: props.key,
|
|
161
168
|
role: 'cloze',
|
|
162
169
|
items: props.items,
|
|
163
170
|
displayCondition: props.displayCondition,
|
|
171
|
+
style: styles.length > 0 ? styles : undefined,
|
|
164
172
|
};
|
|
165
173
|
};
|
|
166
174
|
const clozeLineBreak = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optionDefGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"optionDefGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|