case-editor-tools 1.0.0-beta.39 → 1.0.0-beta.42
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 +4 -0
- package/expression-utils/studyEngineExpressions.js +9 -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 +1 -0
- package/surveys/utils/optionDefGenerators.js +1 -0
- package/surveys/utils/optionDefGenerators.js.map +1 -1
|
@@ -19,6 +19,7 @@ export declare const NativeStudyEngineExpressions: {
|
|
|
19
19
|
hasStudyStatus: (status: string) => Expression;
|
|
20
20
|
hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
|
|
21
21
|
hasParticipantFlagKey: (key: string) => Expression;
|
|
22
|
+
getParticipantFlagValue: (key: string) => Expression;
|
|
22
23
|
lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string | undefined) => Expression;
|
|
23
24
|
hasMessageTypeAssigned: (messageType: string) => Expression;
|
|
24
25
|
getMessageNextTime: (messageType: string) => Expression;
|
|
@@ -30,6 +31,7 @@ export declare const NativeStudyEngineExpressions: {
|
|
|
30
31
|
hasStudyStatus: (status: string) => Expression;
|
|
31
32
|
hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
|
|
32
33
|
hasParticipantFlagKey: (key: string) => Expression;
|
|
34
|
+
getParticipantFlagValue: (key: string) => Expression;
|
|
33
35
|
lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string | undefined) => Expression;
|
|
34
36
|
hasMessageTypeAssigned: (messageType: string) => Expression;
|
|
35
37
|
getMessageNextTime: (messageType: string) => Expression;
|
|
@@ -159,6 +161,7 @@ export declare const StudyEngine: {
|
|
|
159
161
|
hasStudyStatus: (status: string) => Expression;
|
|
160
162
|
hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
|
|
161
163
|
hasParticipantFlagKey: (key: string) => Expression;
|
|
164
|
+
getParticipantFlagValue: (key: string) => Expression;
|
|
162
165
|
lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string | undefined) => Expression;
|
|
163
166
|
hasMessageTypeAssigned: (messageType: string) => Expression;
|
|
164
167
|
getMessageNextTime: (messageType: string) => Expression;
|
|
@@ -170,6 +173,7 @@ export declare const StudyEngine: {
|
|
|
170
173
|
hasStudyStatus: (status: string) => Expression;
|
|
171
174
|
hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
|
|
172
175
|
hasParticipantFlagKey: (key: string) => Expression;
|
|
176
|
+
getParticipantFlagValue: (key: string) => Expression;
|
|
173
177
|
lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string | undefined) => Expression;
|
|
174
178
|
hasMessageTypeAssigned: (messageType: string) => Expression;
|
|
175
179
|
getMessageNextTime: (messageType: string) => Expression;
|
|
@@ -124,6 +124,13 @@ const hasParticipantFlagKeyAndValueForIncoming = (key, value) => expressionUtils
|
|
|
124
124
|
*/
|
|
125
125
|
const hasParticipantFlagKey = (key) => expressionUtils_expressionGen.generateExpression('hasParticipantFlagKey', undefined, key);
|
|
126
126
|
const hasParticipantFlagKeyForIncoming = (key) => expressionUtils_expressionGen.generateExpression('incomingState:hasParticipantFlagKey', undefined, key);
|
|
127
|
+
/**
|
|
128
|
+
* Retrieve the value of a participant flag
|
|
129
|
+
* @param key look up this flag
|
|
130
|
+
* @returns return the value or an empty string if not present
|
|
131
|
+
*/
|
|
132
|
+
const getParticipantFlagValue = (key) => expressionUtils_expressionGen.generateExpression('getParticipantFlagValue', undefined, key);
|
|
133
|
+
const getParticipantFlagValueForIncoming = (key) => expressionUtils_expressionGen.generateExpression('incomingState:getParticipantFlagValue', undefined, key);
|
|
127
134
|
/**
|
|
128
135
|
* Checks if the participant has a message type assigned (at least one)
|
|
129
136
|
* @param messageType
|
|
@@ -358,6 +365,7 @@ const NativeStudyEngineExpressions = {
|
|
|
358
365
|
hasStudyStatus,
|
|
359
366
|
hasParticipantFlagKeyAndValue,
|
|
360
367
|
hasParticipantFlagKey,
|
|
368
|
+
getParticipantFlagValue,
|
|
361
369
|
lastSubmissionDateOlderThan,
|
|
362
370
|
hasMessageTypeAssigned,
|
|
363
371
|
getMessageNextTime,
|
|
@@ -370,6 +378,7 @@ const NativeStudyEngineExpressions = {
|
|
|
370
378
|
hasStudyStatus: hasStudyStatusForIncoming,
|
|
371
379
|
hasParticipantFlagKeyAndValue: hasParticipantFlagKeyAndValueForIncoming,
|
|
372
380
|
hasParticipantFlagKey: hasParticipantFlagKeyForIncoming,
|
|
381
|
+
getParticipantFlagValue: getParticipantFlagValueForIncoming,
|
|
373
382
|
lastSubmissionDateOlderThan: lastSubmissionDateOlderThanForIncoming,
|
|
374
383
|
hasMessageTypeAssigned: hasMessageTypeAssignedForIncoming,
|
|
375
384
|
getMessageNextTime: getMessageNextTimeForIncoming,
|
|
@@ -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.42",
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optionDefGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"optionDefGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|