case-editor-tools 1.0.0-beta.37 → 1.0.0-beta.38
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 +1 -0
- package/constants/key-definitions.js +3 -1
- package/constants/key-definitions.js.map +1 -1
- package/expression-utils/studyEngineExpressions.d.ts +3 -0
- package/expression-utils/studyEngineExpressions.js +5 -0
- package/expression-utils/studyEngineExpressions.js.map +1 -1
- package/package.json +1 -1
- package/surveys/survey-engine-expressions.d.ts +3 -0
- package/surveys/survey-engine-expressions.js +5 -0
- package/surveys/survey-engine-expressions.js.map +1 -1
- package/surveys/survey-items.d.ts +2 -1
- package/surveys/survey-items.js +39 -1
- package/surveys/survey-items.js.map +1 -1
- package/surveys/types/item-properties.d.ts +12 -0
|
@@ -16,9 +16,11 @@ const numericInputKey = "num";
|
|
|
16
16
|
const datePickerKey = "date";
|
|
17
17
|
const timeInputKey = "time";
|
|
18
18
|
const matrixKey = "mat";
|
|
19
|
-
const clozeKey = "cloze";
|
|
19
|
+
const clozeKey = "cloze";
|
|
20
|
+
const consentKey = "con";
|
|
20
21
|
|
|
21
22
|
exports.clozeKey = clozeKey;
|
|
23
|
+
exports.consentKey = consentKey;
|
|
22
24
|
exports.datePickerKey = datePickerKey;
|
|
23
25
|
exports.dropDownKey = dropDownKey;
|
|
24
26
|
exports.inputKey = inputKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-definitions.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"key-definitions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -86,6 +86,9 @@ export declare const StudyEngine: {
|
|
|
86
86
|
none: (itemKey: string, ...optionKeys: string[]) => Expression;
|
|
87
87
|
all: (itemKey: string, ...optionKeys: string[]) => Expression;
|
|
88
88
|
};
|
|
89
|
+
consent: {
|
|
90
|
+
accepted: (itemKey: string) => Expression;
|
|
91
|
+
};
|
|
89
92
|
survey: {
|
|
90
93
|
isActive: (surveyKey: string) => Expression;
|
|
91
94
|
validFromOlderThan: (surveyKey: string, delta: Duration, reference?: number | Expression | undefined) => Expression;
|
|
@@ -288,6 +288,9 @@ const multipleChoiceOptionsSelected = (itemKey, ...optionKeys) => expressionUtil
|
|
|
288
288
|
const multipleChoiceAllOfTheseSelected = (itemKey, ...optionKeys) => and(...optionKeys.map(option => expressionUtils_expressionGen.generateExpression('responseHasKeysAny', undefined, itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.multipleChoiceKey].join('.'), option)));
|
|
289
289
|
const multipleChoiceOnlyOtherKeysSelected = (itemKey, ...optionKeys) => expressionUtils_expressionGen.generateExpression('responseHasOnlyKeysOtherThan', undefined, itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.multipleChoiceKey].join('.'), ...optionKeys);
|
|
290
290
|
const singleChoiceOnlyOtherOptionSelected = (itemKey, ...optionKeys) => expressionUtils_expressionGen.generateExpression('responseHasOnlyKeysOtherThan', undefined, itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.singleChoiceKey].join('.'), ...optionKeys);
|
|
291
|
+
const consentAcceptedCondition = (itemKey) => {
|
|
292
|
+
return hasResponseKey(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.consentKey].join('.'));
|
|
293
|
+
};
|
|
291
294
|
const stopParticipation = () => UPDATE_STUDY_STATUS('inactive');
|
|
292
295
|
const finishParticipation = () => UPDATE_STUDY_STATUS('finished');
|
|
293
296
|
/**
|
|
@@ -409,6 +412,8 @@ const StudyEngine = Object.assign(Object.assign(Object.assign({}, NativeStudyEng
|
|
|
409
412
|
any: multipleChoiceOptionsSelected,
|
|
410
413
|
none: multipleChoiceOnlyOtherKeysSelected,
|
|
411
414
|
all: multipleChoiceAllOfTheseSelected,
|
|
415
|
+
}, consent: {
|
|
416
|
+
accepted: consentAcceptedCondition,
|
|
412
417
|
}, survey: {
|
|
413
418
|
isActive: hasSurveyKeyActive,
|
|
414
419
|
validFromOlderThan: hasSurveyKeyValidFromOlderThan,
|
|
@@ -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.38",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": "github:case-framework/case-editor-tools",
|
|
@@ -64,6 +64,9 @@ export declare const SurveyEngine: {
|
|
|
64
64
|
getNumValue: (itemKey: string, optionKey: string) => Expression;
|
|
65
65
|
regexCheck: (itemKey: string, optionKey: string, pattern: string) => Expression;
|
|
66
66
|
};
|
|
67
|
+
consentQuestion: {
|
|
68
|
+
accepted: (itemKey: string) => Expression;
|
|
69
|
+
};
|
|
67
70
|
textInput: {
|
|
68
71
|
regexCheck: (itemKey: string, pattern: string) => Expression;
|
|
69
72
|
};
|
|
@@ -360,6 +360,9 @@ const textInputRegexCheck = (itemKey, pattern) => {
|
|
|
360
360
|
const multilineTextInputRegexCheck = (itemKey, pattern) => {
|
|
361
361
|
return checkResponseValueWithRegex(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.inputKey].join('.'), pattern);
|
|
362
362
|
};
|
|
363
|
+
const consentAcceptedCondition = (itemKey) => {
|
|
364
|
+
return hasResponse(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.consentKey].join('.'));
|
|
365
|
+
};
|
|
363
366
|
const NativeSurveyEngineExpressions = {
|
|
364
367
|
getters: {
|
|
365
368
|
// root data reference:
|
|
@@ -426,6 +429,8 @@ const SurveyEngine = Object.assign(Object.assign({}, NativeSurveyEngineExpressio
|
|
|
426
429
|
getDateValue: multipleChoiceGetNumOptionValue,
|
|
427
430
|
getNumValue: multipleChoiceGetNumOptionValue,
|
|
428
431
|
regexCheck: mulitpleChoiceTextInputRegexCheck,
|
|
432
|
+
}, consentQuestion: {
|
|
433
|
+
accepted: consentAcceptedCondition,
|
|
429
434
|
}, textInput: {
|
|
430
435
|
regexCheck: textInputRegexCheck,
|
|
431
436
|
}, multilineTextInput: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"survey-engine-expressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"survey-engine-expressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ItemGroupComponent, Expression, ItemComponent, SurveyItem, ExpressionArg, ResponseComponent } from "survey-engine/data_types";
|
|
2
|
-
import { ClozeQuestionProps, DateInputQuestionProps, GenericQuestionProps, MultiLineTextInput, NumericInputQuestionProps, OptionDef, ResponsiveBipolarLikertArrayQuestionProps, ResponsiveSingleChoiceArrayQuestionProps, TextInputQuestionProps, TimeInputQuestionProps } from "./types/item-properties";
|
|
2
|
+
import { ClozeQuestionProps, ConsentQuestionProps, DateInputQuestionProps, GenericQuestionProps, MultiLineTextInput, NumericInputQuestionProps, OptionDef, ResponsiveBipolarLikertArrayQuestionProps, ResponsiveSingleChoiceArrayQuestionProps, TextInputQuestionProps, TimeInputQuestionProps } from "./types/item-properties";
|
|
3
3
|
import { LikertGroupRow } from "./responseTypeGenerators/likertGroupComponents";
|
|
4
4
|
interface OptionQuestionProps extends GenericQuestionProps {
|
|
5
5
|
responseOptions: Array<OptionDef>;
|
|
@@ -45,6 +45,7 @@ interface EQ5DHealthSliderProps {
|
|
|
45
45
|
}
|
|
46
46
|
export declare const initEQ5DHealthIndicatorQuestion: (props: EQ5DHealthSliderProps) => ItemGroupComponent;
|
|
47
47
|
export declare const SurveyItems: {
|
|
48
|
+
consent: (props: ConsentQuestionProps) => SurveyItem;
|
|
48
49
|
singleChoice: (props: OptionQuestionProps) => SurveyItem;
|
|
49
50
|
responsiveSingleChoiceArray: (props: ResponsiveSingleChoiceArrayQuestionProps) => SurveyItem;
|
|
50
51
|
responsiveBipolarLikertArray: (props: ResponsiveBipolarLikertArrayQuestionProps) => SurveyItem;
|
package/surveys/survey-items.js
CHANGED
|
@@ -10,11 +10,11 @@ var constants_keyDefinitions = require('../constants/key-definitions.js');
|
|
|
10
10
|
var surveys_utils_simpleGenerators = require('./utils/simple-generators.js');
|
|
11
11
|
var surveys_utils_simpleQuestionEditor = require('./utils/simple-question-editor.js');
|
|
12
12
|
var surveys_surveyEngineExpressions = require('./survey-engine-expressions.js');
|
|
13
|
+
var surveys_types_itemProperties = require('./types/item-properties.js');
|
|
13
14
|
var surveys_responseTypeGenerators_optionGroupComponents = require('./responseTypeGenerators/optionGroupComponents.js');
|
|
14
15
|
var surveys_responseTypeGenerators_likertGroupComponents = require('./responseTypeGenerators/likertGroupComponents.js');
|
|
15
16
|
require('./utils/randomKeyGenerator.js');
|
|
16
17
|
require('../logger/logger.js');
|
|
17
|
-
require('./types/item-properties.js');
|
|
18
18
|
require('../expression-utils/expressionGen.js');
|
|
19
19
|
|
|
20
20
|
const commonQuestionGenerator = (props, rg_inner) => {
|
|
@@ -209,6 +209,43 @@ const generateTextInputQuestion = (props) => {
|
|
|
209
209
|
};
|
|
210
210
|
return commonQuestionGenerator(props, rg_inner);
|
|
211
211
|
};
|
|
212
|
+
const generateConsentQuestion = (props) => {
|
|
213
|
+
const style = props.className ? [{ key: 'className', value: props.className }] : undefined;
|
|
214
|
+
const rg_inner = {
|
|
215
|
+
key: constants_keyDefinitions.consentKey, role: 'consent',
|
|
216
|
+
items: [
|
|
217
|
+
{
|
|
218
|
+
key: 'label', role: 'label',
|
|
219
|
+
content: !Array.isArray(props.checkBoxLabel) ? surveys_utils_simpleGenerators.generateLocStrings(props.checkBoxLabel) : undefined,
|
|
220
|
+
items: Array.isArray(props.checkBoxLabel) ? props.checkBoxLabel.map((item, index) => {
|
|
221
|
+
if (surveys_types_itemProperties.isDateDisplayComponentProp(item)) {
|
|
222
|
+
return surveys_utils_simpleGenerators.generateDateDisplayComp(index.toFixed(), item);
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
key: index.toFixed(),
|
|
226
|
+
role: 'text',
|
|
227
|
+
content: surveys_utils_simpleGenerators.generateLocStrings(item.content),
|
|
228
|
+
style: item.className ? [{ key: 'className', value: item.className }] : undefined
|
|
229
|
+
};
|
|
230
|
+
}) : undefined,
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
key: 'title', role: 'title', content: surveys_utils_simpleGenerators.generateLocStrings(props.dialogTitle)
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
key: 'content', role: 'content', content: surveys_utils_simpleGenerators.generateLocStrings(props.dialogContent)
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
key: 'acceptBtn', role: 'acceptBtn', content: surveys_utils_simpleGenerators.generateLocStrings(props.acceptBtn)
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
key: 'rejectBtn', role: 'rejectBtn', content: surveys_utils_simpleGenerators.generateLocStrings(props.rejectBtn)
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
style: style,
|
|
246
|
+
};
|
|
247
|
+
return commonQuestionGenerator(props, rg_inner);
|
|
248
|
+
};
|
|
212
249
|
const generateMultilineInput = (props) => {
|
|
213
250
|
const rg_inner = {
|
|
214
251
|
key: constants_keyDefinitions.inputKey, role: 'multilineTextInput',
|
|
@@ -308,6 +345,7 @@ const initEQ5DHealthIndicatorQuestion = (props) => {
|
|
|
308
345
|
return groupEdit.getComponent();
|
|
309
346
|
};
|
|
310
347
|
const SurveyItems = {
|
|
348
|
+
consent: generateConsentQuestion,
|
|
311
349
|
singleChoice: generateSingleChoiceQuestion,
|
|
312
350
|
responsiveSingleChoiceArray: generateResponsiveSingleChoiceArrayQuestion,
|
|
313
351
|
responsiveBipolarLikertArray: generateResponsiveBipolarLikertArray,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"survey-items.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"survey-items.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -111,6 +111,18 @@ export interface ClozeProps {
|
|
|
111
111
|
items: Array<OptionDef>;
|
|
112
112
|
}
|
|
113
113
|
export declare type ClozeQuestionProps = ClozeProps & GenericQuestionProps;
|
|
114
|
+
/**
|
|
115
|
+
* Consent Question
|
|
116
|
+
*/
|
|
117
|
+
export interface ConsentProps {
|
|
118
|
+
checkBoxLabel: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp>;
|
|
119
|
+
dialogTitle: Map<string, string>;
|
|
120
|
+
dialogContent: Map<string, string>;
|
|
121
|
+
acceptBtn: Map<string, string>;
|
|
122
|
+
rejectBtn: Map<string, string>;
|
|
123
|
+
className?: string;
|
|
124
|
+
}
|
|
125
|
+
export declare type ConsentQuestionProps = ConsentProps & GenericQuestionProps;
|
|
114
126
|
/**
|
|
115
127
|
* Response Single Choice Likert Array
|
|
116
128
|
*/
|