case-editor-tools 1.0.0-beta.7 → 1.0.0
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 +16 -0
- package/constants/key-definitions.js +38 -0
- package/constants/key-definitions.js.map +1 -0
- 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 +2 -0
- package/expression-utils/expressionGen.js +31 -0
- package/expression-utils/expressionGen.js.map +1 -0
- package/expression-utils/studyEngineExpressions.d.ts +195 -0
- package/expression-utils/studyEngineExpressions.js +479 -0
- package/expression-utils/studyEngineExpressions.js.map +1 -0
- package/index.d.ts +0 -0
- package/index.js +3 -0
- package/index.js.map +1 -0
- package/item-editor-59f51ecc.js +542 -0
- 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/logger/logger.d.ts +9 -0
- package/logger/logger.js +31 -0
- package/logger/logger.js.map +1 -0
- package/package.json +5 -5
- package/surveys/index.d.ts +3 -0
- package/surveys/index.js +29 -0
- package/surveys/index.js.map +1 -0
- 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 +84 -0
- package/surveys/survey-editor/component-editor.js +112 -0
- package/surveys/survey-editor/component-editor.js.map +1 -0
- package/surveys/survey-editor/data-types.d.ts +13 -0
- package/surveys/survey-editor/data-types.js +3 -0
- package/surveys/survey-editor/data-types.js.map +1 -0
- package/surveys/survey-editor/item-editor.d.ts +66 -0
- package/surveys/survey-editor/item-editor.js +13 -0
- package/surveys/survey-editor/item-editor.js.map +1 -0
- package/surveys/survey-editor/survey-editor.d.ts +48 -0
- package/surveys/survey-editor/survey-editor.js +237 -0
- package/surveys/survey-editor/survey-editor.js.map +1 -0
- package/surveys/survey-engine-expressions.d.ts +130 -0
- package/surveys/survey-engine-expressions.js +448 -0
- package/surveys/survey-engine-expressions.js.map +1 -0
- package/surveys/survey-items.d.ts +72 -0
- package/surveys/survey-items.js +384 -0
- package/surveys/survey-items.js.map +1 -0
- package/surveys/types/group.d.ts +23 -0
- package/surveys/types/group.js +72 -0
- package/surveys/types/group.js.map +1 -0
- package/surveys/types/index.d.ts +4 -0
- package/surveys/types/index.js +22 -0
- package/surveys/types/index.js.map +1 -0
- package/surveys/types/item-properties.d.ts +223 -0
- package/surveys/types/item-properties.js +10 -0
- package/surveys/types/item-properties.js.map +1 -0
- package/surveys/types/item.d.ts +22 -0
- package/surveys/types/item.js +34 -0
- package/surveys/types/item.js.map +1 -0
- package/surveys/types/survey-definition.d.ts +23 -0
- package/surveys/types/survey-definition.js +69 -0
- package/surveys/types/survey-definition.js.map +1 -0
- package/surveys/utils/componentGenerators.d.ts +24 -0
- package/surveys/utils/componentGenerators.js +59 -0
- package/surveys/utils/componentGenerators.js.map +1 -0
- 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/randomKeyGenerator.d.ts +1 -0
- package/surveys/utils/randomKeyGenerator.js +16 -0
- package/surveys/utils/randomKeyGenerator.js.map +1 -0
- package/surveys/utils/simple-generators.d.ts +14 -0
- package/surveys/utils/simple-generators.js +131 -0
- package/surveys/utils/simple-generators.js.map +1 -0
- package/surveys/utils/simple-question-editor.d.ts +14 -0
- package/surveys/utils/simple-question-editor.js +47 -0
- package/surveys/utils/simple-question-editor.js.map +1 -0
- package/types/duration.d.ts +9 -0
- package/types/duration.js +29 -0
- package/types/duration.js.map +1 -0
- package/types/expression.d.ts +4 -0
- package/types/expression.js +23 -0
- package/types/expression.js.map +1 -0
- 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 +15 -0
- package/types/study.js +3 -0
- package/types/study.js.map +1 -0
- package/types/studyRules.d.ts +9 -0
- package/types/studyRules.js +36 -0
- package/types/studyRules.js.map +1 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { Expression } from "survey-engine/data_types";
|
|
2
|
+
import { Duration } from "../types/duration";
|
|
3
|
+
export declare const NativeSurveyEngineExpressions: {
|
|
4
|
+
getters: {
|
|
5
|
+
getContext: () => Expression;
|
|
6
|
+
getResponses: () => Expression;
|
|
7
|
+
getRenderedItems: () => Expression;
|
|
8
|
+
getAttribute: (objectRef: Expression, attributeName: string) => Expression;
|
|
9
|
+
getArrayItemAtIndex: (arrayRef: Expression, index: number) => Expression;
|
|
10
|
+
getArrayItemByKey: (arrayRef: Expression, itemKey: string) => Expression;
|
|
11
|
+
getObjByHierarchicalKey: (objectRef: Expression, itemKey: string) => Expression;
|
|
12
|
+
getNestedObjectByKey: (objectRef: Expression, itemKey: string) => Expression;
|
|
13
|
+
};
|
|
14
|
+
previousResponses: {
|
|
15
|
+
getItemsByKey: (itemKey: string) => Expression;
|
|
16
|
+
getLastItemByKey: (itemKey: string) => Expression;
|
|
17
|
+
getAllResponsesForSurveyKey: (surveyKey: string) => Expression;
|
|
18
|
+
filterResponsesByIncludesKeys: (responsesRef: Expression, itemKey: string, searchKeys: string) => Expression;
|
|
19
|
+
filterResponsesByValue: (responsesRef: Expression, itemKey: string, expectedValue: string) => Expression;
|
|
20
|
+
getLastFromSurveyItemResponses: (responsesRef: Expression) => Expression;
|
|
21
|
+
};
|
|
22
|
+
isDefined: (arg: Expression) => Expression;
|
|
23
|
+
hasResponse: (itemKey: string, responseKey: string) => Expression;
|
|
24
|
+
getResponseItem: (itemKey: string, responseKey: string) => Expression;
|
|
25
|
+
parseValueAsNum: (valueRef: Expression) => Expression;
|
|
26
|
+
getResponseValueAsNum: (itemKey: string, responseKey: string) => Expression;
|
|
27
|
+
getResponseValueAsStr: (itemKey: string, responseKey: string) => Expression;
|
|
28
|
+
checkResponseValueWithRegex: (itemKey: string, responseKey: string, regexPattern: string) => Expression;
|
|
29
|
+
responseHasKeysAny: (itemKey: string, responseKey: string, ...optionKeys: string[]) => Expression;
|
|
30
|
+
responseHasKeysAll: (itemKey: string, responseKey: string, ...optionKeys: string[]) => Expression;
|
|
31
|
+
responseHasOnlyKeysOtherThan: (itemKey: string, responseKey: string, ...optionKeys: string[]) => Expression;
|
|
32
|
+
getSurveyItemValidation: (itemKey: string, validationKey: string) => Expression;
|
|
33
|
+
dateResponseDiffFromNow: (itemKey: string, responseKey: string, unit: 'years' | 'months' | 'days' | 'hours' | 'minutes' | 'seconds', ignoreSign?: boolean | undefined) => Expression;
|
|
34
|
+
countResponseItems: (itemKey: string, responseKey: string) => Expression;
|
|
35
|
+
compare: {
|
|
36
|
+
eq: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
|
|
37
|
+
lt: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
|
|
38
|
+
lte: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
|
|
39
|
+
gt: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
|
|
40
|
+
gte: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
|
|
41
|
+
};
|
|
42
|
+
logic: {
|
|
43
|
+
or: (...args: Expression[]) => Expression;
|
|
44
|
+
and: (...args: Expression[]) => Expression;
|
|
45
|
+
not: (arg: Expression) => Expression;
|
|
46
|
+
};
|
|
47
|
+
getSecondsSince: (referenceTime: Expression) => Expression;
|
|
48
|
+
timestampWithOffset: (delta: Duration, reference?: number | Expression | undefined) => Expression;
|
|
49
|
+
};
|
|
50
|
+
export declare const SurveyEngine: {
|
|
51
|
+
singleChoice: {
|
|
52
|
+
any: (itemKey: string, ...optionKeys: string[]) => Expression;
|
|
53
|
+
none: (itemKey: string, ...optionKeys: string[]) => Expression;
|
|
54
|
+
getDateValue: (itemKey: string, optionKey: string) => Expression;
|
|
55
|
+
getNumValue: (itemKey: string, optionKey: string) => Expression;
|
|
56
|
+
regexCheck: (itemKey: string, optionKey: string, pattern: string) => Expression;
|
|
57
|
+
};
|
|
58
|
+
multipleChoice: {
|
|
59
|
+
any: (itemKey: string, ...optionKeys: string[]) => Expression;
|
|
60
|
+
none: (itemKey: string, ...optionKeys: string[]) => Expression;
|
|
61
|
+
all: (itemKey: string, ...optionKeys: string[]) => Expression;
|
|
62
|
+
selectionCount: (itemKey: string) => Expression;
|
|
63
|
+
getDateValue: (itemKey: string, optionKey: string) => Expression;
|
|
64
|
+
getNumValue: (itemKey: string, optionKey: string) => Expression;
|
|
65
|
+
regexCheck: (itemKey: string, optionKey: string, pattern: string) => Expression;
|
|
66
|
+
};
|
|
67
|
+
consentQuestion: {
|
|
68
|
+
accepted: (itemKey: string) => Expression;
|
|
69
|
+
};
|
|
70
|
+
textInput: {
|
|
71
|
+
regexCheck: (itemKey: string, pattern: string) => Expression;
|
|
72
|
+
};
|
|
73
|
+
multilineTextInput: {
|
|
74
|
+
regexCheck: (itemKey: string, pattern: string) => Expression;
|
|
75
|
+
};
|
|
76
|
+
datePicker: {
|
|
77
|
+
get: (itemKey: string) => Expression;
|
|
78
|
+
};
|
|
79
|
+
participantFlags: {
|
|
80
|
+
hasKey: (key: string) => Expression;
|
|
81
|
+
hasKeyAndValue: (key: string, value: string) => Expression;
|
|
82
|
+
getAsNum: (key: string) => Expression;
|
|
83
|
+
};
|
|
84
|
+
isLoggedIn: () => Expression;
|
|
85
|
+
getters: {
|
|
86
|
+
getContext: () => Expression;
|
|
87
|
+
getResponses: () => Expression;
|
|
88
|
+
getRenderedItems: () => Expression;
|
|
89
|
+
getAttribute: (objectRef: Expression, attributeName: string) => Expression;
|
|
90
|
+
getArrayItemAtIndex: (arrayRef: Expression, index: number) => Expression;
|
|
91
|
+
getArrayItemByKey: (arrayRef: Expression, itemKey: string) => Expression;
|
|
92
|
+
getObjByHierarchicalKey: (objectRef: Expression, itemKey: string) => Expression;
|
|
93
|
+
getNestedObjectByKey: (objectRef: Expression, itemKey: string) => Expression;
|
|
94
|
+
};
|
|
95
|
+
previousResponses: {
|
|
96
|
+
getItemsByKey: (itemKey: string) => Expression;
|
|
97
|
+
getLastItemByKey: (itemKey: string) => Expression;
|
|
98
|
+
getAllResponsesForSurveyKey: (surveyKey: string) => Expression;
|
|
99
|
+
filterResponsesByIncludesKeys: (responsesRef: Expression, itemKey: string, searchKeys: string) => Expression;
|
|
100
|
+
filterResponsesByValue: (responsesRef: Expression, itemKey: string, expectedValue: string) => Expression;
|
|
101
|
+
getLastFromSurveyItemResponses: (responsesRef: Expression) => Expression;
|
|
102
|
+
};
|
|
103
|
+
isDefined: (arg: Expression) => Expression;
|
|
104
|
+
hasResponse: (itemKey: string, responseKey: string) => Expression;
|
|
105
|
+
getResponseItem: (itemKey: string, responseKey: string) => Expression;
|
|
106
|
+
parseValueAsNum: (valueRef: Expression) => Expression;
|
|
107
|
+
getResponseValueAsNum: (itemKey: string, responseKey: string) => Expression;
|
|
108
|
+
getResponseValueAsStr: (itemKey: string, responseKey: string) => Expression;
|
|
109
|
+
checkResponseValueWithRegex: (itemKey: string, responseKey: string, regexPattern: string) => Expression;
|
|
110
|
+
responseHasKeysAny: (itemKey: string, responseKey: string, ...optionKeys: string[]) => Expression;
|
|
111
|
+
responseHasKeysAll: (itemKey: string, responseKey: string, ...optionKeys: string[]) => Expression;
|
|
112
|
+
responseHasOnlyKeysOtherThan: (itemKey: string, responseKey: string, ...optionKeys: string[]) => Expression;
|
|
113
|
+
getSurveyItemValidation: (itemKey: string, validationKey: string) => Expression;
|
|
114
|
+
dateResponseDiffFromNow: (itemKey: string, responseKey: string, unit: 'years' | 'months' | 'days' | 'hours' | 'minutes' | 'seconds', ignoreSign?: boolean | undefined) => Expression;
|
|
115
|
+
countResponseItems: (itemKey: string, responseKey: string) => Expression;
|
|
116
|
+
compare: {
|
|
117
|
+
eq: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
|
|
118
|
+
lt: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
|
|
119
|
+
lte: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
|
|
120
|
+
gt: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
|
|
121
|
+
gte: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
|
|
122
|
+
};
|
|
123
|
+
logic: {
|
|
124
|
+
or: (...args: Expression[]) => Expression;
|
|
125
|
+
and: (...args: Expression[]) => Expression;
|
|
126
|
+
not: (arg: Expression) => Expression;
|
|
127
|
+
};
|
|
128
|
+
getSecondsSince: (referenceTime: Expression) => Expression;
|
|
129
|
+
timestampWithOffset: (delta: Duration, reference?: number | Expression | undefined) => Expression;
|
|
130
|
+
};
|
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var constants_keyDefinitions = require('../constants/key-definitions.js');
|
|
6
|
+
var types_duration = require('../types/duration.js');
|
|
7
|
+
var expressionUtils_expressionGen = require('../expression-utils/expressionGen.js');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Logical OR expression
|
|
11
|
+
* @returns expression that return true if any of the arguments evaluates to true
|
|
12
|
+
*/
|
|
13
|
+
const or = (...args) => expressionUtils_expressionGen.generateExpression('or', undefined, ...args);
|
|
14
|
+
/**
|
|
15
|
+
* Logical AND expression
|
|
16
|
+
* @returns expression that return true if all of the arguments evaluates to true
|
|
17
|
+
*/
|
|
18
|
+
const and = (...args) => expressionUtils_expressionGen.generateExpression('and', undefined, ...args);
|
|
19
|
+
/**
|
|
20
|
+
* Logical NOT expression
|
|
21
|
+
* @returns expression that negates the argument - true if arg is false, false if arg is true
|
|
22
|
+
*/
|
|
23
|
+
const not = (arg) => expressionUtils_expressionGen.generateExpression('not', undefined, arg);
|
|
24
|
+
/**
|
|
25
|
+
* [===] Equality check
|
|
26
|
+
* @returns expression that return true of both arguments are equal
|
|
27
|
+
*/
|
|
28
|
+
const eq = (val1, val2) => expressionUtils_expressionGen.generateExpression('eq', undefined, val1, val2);
|
|
29
|
+
/**
|
|
30
|
+
* [<] val1 is less than val2?
|
|
31
|
+
* @param val1
|
|
32
|
+
* @param val2
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
const lt = (val1, val2) => expressionUtils_expressionGen.generateExpression('lt', undefined, val1, val2);
|
|
36
|
+
/**
|
|
37
|
+
* [<=] val1 is less than or equal to val2?
|
|
38
|
+
* @param val1
|
|
39
|
+
* @param val2
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
const lte = (val1, val2) => expressionUtils_expressionGen.generateExpression('lte', undefined, val1, val2);
|
|
43
|
+
/**
|
|
44
|
+
* [>] val1 is greater than val2?
|
|
45
|
+
* @param val1
|
|
46
|
+
* @param val2
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
const gt = (val1, val2) => expressionUtils_expressionGen.generateExpression('gt', undefined, val1, val2);
|
|
50
|
+
/**
|
|
51
|
+
* [>=] val1 is greater than or equal to val2?
|
|
52
|
+
* @param val1
|
|
53
|
+
* @param val2
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
const gte = (val1, val2) => expressionUtils_expressionGen.generateExpression('gte', undefined, val1, val2);
|
|
57
|
+
/**
|
|
58
|
+
* Generate a timestamp value (POSIX timestamp). T = T_ref + delta. If 'reference' is not defined, the current time will be used as a reference.
|
|
59
|
+
* @param delta offset for the timestamp generation
|
|
60
|
+
* @param reference optional - a hard coded number, or an expression that should retrieve a timestamp (e.g., surveys assigned from, or response to a date question)
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
const timestampWithOffset = (delta, reference) => expressionUtils_expressionGen.generateExpression('timestampWithOffset', undefined, types_duration.durationObjectToSeconds(delta), reference ? reference : undefined);
|
|
64
|
+
/**
|
|
65
|
+
* Parse the result of an expression as a number
|
|
66
|
+
* @param valueRef expression that returns a string with the value that should be parsed
|
|
67
|
+
* @returns expression that returns the value or undefined
|
|
68
|
+
*/
|
|
69
|
+
const parseValueAsNum = (valueRef) => {
|
|
70
|
+
return expressionUtils_expressionGen.generateExpression('parseValueAsNum', 'float', valueRef);
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Extract value from a response if exits parsed as a number
|
|
74
|
+
* @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
|
|
75
|
+
* @param responseKey full key of the response slot inside the item (e.g. rg.num)
|
|
76
|
+
* @returns expression that returns the value or undefined
|
|
77
|
+
*/
|
|
78
|
+
const getResponseValueAsNum = (itemKey, responseKey) => {
|
|
79
|
+
return expressionUtils_expressionGen.generateExpression('getResponseValueAsNum', 'float', itemKey, responseKey);
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Extract value from a response if exits as string
|
|
83
|
+
* @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
|
|
84
|
+
* @param responseKey full key of the response slot inside the item (e.g. rg.input)
|
|
85
|
+
* @returns expression that returns the value or undefined
|
|
86
|
+
*/
|
|
87
|
+
const getResponseValueAsStr = (itemKey, responseKey) => {
|
|
88
|
+
return expressionUtils_expressionGen.generateExpression('getResponseValueAsStr', 'string', itemKey, responseKey);
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Count the number of existing response items inside the slot
|
|
92
|
+
* @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
|
|
93
|
+
* @param responseKey full key of the response slot inside the item (e.g. rg.mcg)
|
|
94
|
+
* @returns expression that returns the number of items of the response slot
|
|
95
|
+
*/
|
|
96
|
+
const countResponseItems = (itemKey, responseKey) => {
|
|
97
|
+
return expressionUtils_expressionGen.generateExpression('countResponseItems', undefined, itemKey, responseKey);
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Evaluates an expression and checks if the return value is defined
|
|
101
|
+
* @param arg Expression with a potentially undefined return value
|
|
102
|
+
* @returns
|
|
103
|
+
*/
|
|
104
|
+
const isDefined = (arg) => {
|
|
105
|
+
return expressionUtils_expressionGen.generateExpression('isDefined', undefined, arg);
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Reference to the context variable storing e.g. participant infos
|
|
109
|
+
* @returns
|
|
110
|
+
*/
|
|
111
|
+
const getContext = () => {
|
|
112
|
+
return expressionUtils_expressionGen.generateExpression('getContext', undefined);
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Reference to the current response array
|
|
116
|
+
* @returns
|
|
117
|
+
*/
|
|
118
|
+
const getResponses = () => {
|
|
119
|
+
return expressionUtils_expressionGen.generateExpression('getResponses', undefined);
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Reference to the list of currently active survey questions
|
|
123
|
+
* @returns
|
|
124
|
+
*/
|
|
125
|
+
const getRenderedItems = () => {
|
|
126
|
+
return expressionUtils_expressionGen.generateExpression('getRenderedItems', undefined);
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Extract value of an attribute of the referenced object
|
|
130
|
+
* @param objectRef expression that references an object
|
|
131
|
+
* @param attributeName name of the attribute to be extracted
|
|
132
|
+
* @returns
|
|
133
|
+
*/
|
|
134
|
+
const getAttribute = (objectRef, attributeName) => {
|
|
135
|
+
return expressionUtils_expressionGen.generateExpression('getAttribute', undefined, objectRef, attributeName);
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Extract value at index
|
|
139
|
+
* @param arrayRef expression that references an array
|
|
140
|
+
* @param index position in the array
|
|
141
|
+
* @returns
|
|
142
|
+
*/
|
|
143
|
+
const getArrayItemAtIndex = (arrayRef, index) => {
|
|
144
|
+
return expressionUtils_expressionGen.generateExpression('getArrayItemAtIndex', undefined, arrayRef, index);
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Extract value with a specific key
|
|
148
|
+
* @param arrayRef expression that references an array
|
|
149
|
+
* @param itemKey key of the target item
|
|
150
|
+
* @returns
|
|
151
|
+
*/
|
|
152
|
+
const getArrayItemByKey = (arrayRef, itemKey) => {
|
|
153
|
+
return expressionUtils_expressionGen.generateExpression('getArrayItemByKey', undefined, arrayRef, itemKey);
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Extract value with a specific key from the hierarchical tree
|
|
157
|
+
* @param objectRef expression that references the root object
|
|
158
|
+
* @param itemKey key of the target item
|
|
159
|
+
* @returns
|
|
160
|
+
*/
|
|
161
|
+
const getObjByHierarchicalKey = (objectRef, itemKey) => {
|
|
162
|
+
return expressionUtils_expressionGen.generateExpression('getObjByHierarchicalKey', undefined, objectRef, itemKey);
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Extract value with a specific key from the tree
|
|
166
|
+
* @param objectRef expression that references the root object
|
|
167
|
+
* @param itemKey key of the target item
|
|
168
|
+
* @returns
|
|
169
|
+
*/
|
|
170
|
+
const getNestedObjectByKey = (objectRef, itemKey) => {
|
|
171
|
+
return expressionUtils_expressionGen.generateExpression('getNestedObjectByKey', undefined, objectRef, itemKey);
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Retrieve items by the same key from the previous responses arrays
|
|
175
|
+
* @param itemKey key of the target item
|
|
176
|
+
* @returns
|
|
177
|
+
*/
|
|
178
|
+
const findPreviousSurveyResponsesByKey = (itemKey) => {
|
|
179
|
+
return expressionUtils_expressionGen.generateExpression('findPreviousSurveyResponsesByKey', undefined, itemKey);
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Retrieve all previous responses for a specific survey key
|
|
183
|
+
* @param surveyKey key of the target survey
|
|
184
|
+
* @returns
|
|
185
|
+
*/
|
|
186
|
+
const getPreviousResponses = (surveyKey) => {
|
|
187
|
+
return expressionUtils_expressionGen.generateExpression('getPreviousResponses', undefined, surveyKey);
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Retrieve last item for a specific key from the previous responses arrays
|
|
191
|
+
* @param itemKey key of the target item
|
|
192
|
+
* @returns
|
|
193
|
+
*/
|
|
194
|
+
const getLastFromSurveyResponses = (itemKey) => {
|
|
195
|
+
return expressionUtils_expressionGen.generateExpression('getLastFromSurveyResponses', undefined, itemKey);
|
|
196
|
+
};
|
|
197
|
+
const filterResponsesByIncludesKeys = (responsesRef, itemKey, searchKeys) => {
|
|
198
|
+
return expressionUtils_expressionGen.generateExpression('filterResponsesByIncludesKeys', undefined, responsesRef, itemKey, ...searchKeys);
|
|
199
|
+
};
|
|
200
|
+
const filterResponsesByValue = (responsesRef, itemKey, expectedValue) => {
|
|
201
|
+
return expressionUtils_expressionGen.generateExpression('filterResponsesByValue', undefined, responsesRef, itemKey, expectedValue);
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Given a list of previous responses (list of single responses), retrieve the latest one.
|
|
205
|
+
* @param responsesRef expression that references a list of response items
|
|
206
|
+
* @returns
|
|
207
|
+
*/
|
|
208
|
+
const getLastFromSurveyItemResponses = (responsesRef) => {
|
|
209
|
+
return expressionUtils_expressionGen.generateExpression('getLastFromSurveyItemResponses', undefined, responsesRef);
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Calculate time difference between "now" and the reference time in seconds
|
|
213
|
+
* @param referenceTime expression that should return a time (in POSIX timestamp form)
|
|
214
|
+
* @returns expression returns undefined if rerefence time is evaluated to undefined
|
|
215
|
+
*/
|
|
216
|
+
const getSecondsSince = (referenceTime) => {
|
|
217
|
+
return expressionUtils_expressionGen.generateExpression('getSecondsSince', undefined, referenceTime);
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Get response object for a specific item and slot
|
|
221
|
+
* @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
|
|
222
|
+
* @param responseKey full key of the response slot inside the item (e.g. rg.num)
|
|
223
|
+
* @returns
|
|
224
|
+
*/
|
|
225
|
+
const getResponseItem = (itemKey, responseKey) => {
|
|
226
|
+
return expressionUtils_expressionGen.generateExpression('getResponseItem', undefined, itemKey, responseKey);
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Check if an item has a specific response object (by key)
|
|
230
|
+
* @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
|
|
231
|
+
* @param responseKey full key of the response slot inside the item (e.g. rg.num)
|
|
232
|
+
* @returns
|
|
233
|
+
*/
|
|
234
|
+
const hasResponse = (itemKey, responseKey) => {
|
|
235
|
+
return expressionUtils_expressionGen.generateExpression('hasResponse', undefined, itemKey, responseKey);
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Evaluate if regex expression is fulfilled on the responses value attribute
|
|
239
|
+
* @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
|
|
240
|
+
* @param responseKey full key of the response slot inside the item (e.g. rg.input)
|
|
241
|
+
* @param regexPattern regex pattern to check value against
|
|
242
|
+
* @returns
|
|
243
|
+
*/
|
|
244
|
+
const checkResponseValueWithRegex = (itemKey, responseKey, regexPattern) => {
|
|
245
|
+
return expressionUtils_expressionGen.generateExpression('checkResponseValueWithRegex', undefined, itemKey, responseKey, regexPattern);
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Check if any of the following options is selected
|
|
249
|
+
* @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
|
|
250
|
+
* @param responseKey full key of the response slot inside the item (e.g. rg.scg)
|
|
251
|
+
* @param optionKeys keys of the option that should be selected
|
|
252
|
+
* @returns
|
|
253
|
+
*/
|
|
254
|
+
const responseHasKeysAny = (itemKey, responseKey, ...optionKeys) => {
|
|
255
|
+
return expressionUtils_expressionGen.generateExpression('responseHasKeysAny', undefined, itemKey, responseKey, ...optionKeys);
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Check if all of the following options are selected
|
|
259
|
+
* @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
|
|
260
|
+
* @param responseKey full key of the response slot inside the item (e.g. rg.scg)
|
|
261
|
+
* @param optionKeys keys of the option that should be selected
|
|
262
|
+
* @returns
|
|
263
|
+
*/
|
|
264
|
+
const responseHasKeysAll = (itemKey, responseKey, ...optionKeys) => {
|
|
265
|
+
return expressionUtils_expressionGen.generateExpression('responseHasKeysAll', undefined, itemKey, responseKey, ...optionKeys);
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Check if only other options were selected
|
|
269
|
+
* @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
|
|
270
|
+
* @param responseKey full key of the response slot inside the item (e.g. rg.scg)
|
|
271
|
+
* @param optionKeys keys of the option that shouldn't be selected
|
|
272
|
+
* @returns
|
|
273
|
+
*/
|
|
274
|
+
const responseHasOnlyKeysOtherThan = (itemKey, responseKey, ...optionKeys) => {
|
|
275
|
+
return expressionUtils_expressionGen.generateExpression('responseHasOnlyKeysOtherThan', undefined, itemKey, responseKey, ...optionKeys);
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* To use evaluated validations rules, we can reference them with this method.
|
|
279
|
+
* @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
|
|
280
|
+
* @param validationKey key of the validation rule
|
|
281
|
+
* @returns
|
|
282
|
+
*/
|
|
283
|
+
const getSurveyItemValidation = (itemKey, validationKey) => {
|
|
284
|
+
return expressionUtils_expressionGen.generateExpression('getSurveyItemValidation', undefined, itemKey, validationKey);
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Calculate difference of a selected date input and current timestamp with selected unit
|
|
288
|
+
* @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
|
|
289
|
+
* @param responseKey full key of the response slot inside the item (e.g. rg.input)
|
|
290
|
+
* @param unit in which unit should the difference be returned
|
|
291
|
+
* @param ignoreSign if set to true, sign (+/-) is ignored and the absolute value of the difference is returned
|
|
292
|
+
* @returns
|
|
293
|
+
*/
|
|
294
|
+
const dateResponseDiffFromNow = (itemKey, responseKey, unit, ignoreSign) => {
|
|
295
|
+
return expressionUtils_expressionGen.generateExpression('dateResponseDiffFromNow', undefined, itemKey, responseKey, unit, ignoreSign ? 1 : undefined);
|
|
296
|
+
};
|
|
297
|
+
/**
|
|
298
|
+
* Check participant flags object if contains the specified key value pair
|
|
299
|
+
* @param key retrieve participant flag's value for this key
|
|
300
|
+
* @returns
|
|
301
|
+
*/
|
|
302
|
+
const parseParticipantFlagAsNum = (key) => {
|
|
303
|
+
return parseValueAsNum(getAttribute(getAttribute(getContext(), 'participantFlags'), key));
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* Check participant flags object if contains the specified key value pair
|
|
307
|
+
* @param key retrieve participant flag's value for this key
|
|
308
|
+
* @returns
|
|
309
|
+
*/
|
|
310
|
+
const hasParticipantFlagKey = (key) => {
|
|
311
|
+
return isDefined(getAttribute(getAttribute(getContext(), 'participantFlags'), key));
|
|
312
|
+
};
|
|
313
|
+
/**
|
|
314
|
+
* Check participant flags object if contains the specified key value pair
|
|
315
|
+
* @param key retrieve participant flag's value for this key
|
|
316
|
+
* @param value string value to be checked for a match
|
|
317
|
+
* @returns
|
|
318
|
+
*/
|
|
319
|
+
const hasParticipantFlagKeyAndValue = (key, value) => {
|
|
320
|
+
return eq(getAttribute(getAttribute(getContext(), 'participantFlags'), key), value);
|
|
321
|
+
};
|
|
322
|
+
/**
|
|
323
|
+
* Check if the participant is logged in currently.
|
|
324
|
+
* @returns true if context variable isLoggedIn is set and true
|
|
325
|
+
*/
|
|
326
|
+
const isLoggedIn = () => {
|
|
327
|
+
return and(isDefined(getAttribute(getContext(), 'isLoggedIn')), getAttribute(getContext(), 'isLoggedIn'));
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* Counts the number of selected options in a multiple choice question
|
|
331
|
+
* @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
|
|
332
|
+
* @returns
|
|
333
|
+
*/
|
|
334
|
+
const multipleChoiceSelectionCount = (itemKey) => {
|
|
335
|
+
return countResponseItems(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.multipleChoiceKey].join('.'));
|
|
336
|
+
};
|
|
337
|
+
const getDatePickerResponseValue = (itemKey) => {
|
|
338
|
+
return getResponseValueAsNum(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.datePickerKey].join('.'));
|
|
339
|
+
};
|
|
340
|
+
const singleChoiceOptionsSelected = (itemKey, ...optionKeys) => responseHasKeysAll(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.singleChoiceKey].join('.'), ...optionKeys);
|
|
341
|
+
const multipleChoiceOptionsSelected = (itemKey, ...optionKeys) => responseHasKeysAny(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.multipleChoiceKey].join('.'), ...optionKeys);
|
|
342
|
+
const multipleChoiceAllOfTheseSelected = (itemKey, ...optionKeys) => responseHasKeysAll(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.multipleChoiceKey].join('.'), ...optionKeys);
|
|
343
|
+
const multipleChoiceOnlyOtherKeysSelected = (itemKey, ...optionKeys) => responseHasOnlyKeysOtherThan(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.multipleChoiceKey].join('.'), ...optionKeys);
|
|
344
|
+
const singleChoiceOnlyOtherOptionSelected = (itemKey, ...optionKeys) => responseHasOnlyKeysOtherThan(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.singleChoiceKey].join('.'), ...optionKeys);
|
|
345
|
+
const singleChoiceGetNumOptionValue = (itemKey, optionKey) => {
|
|
346
|
+
return getResponseValueAsNum(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.singleChoiceKey, optionKey].join('.'));
|
|
347
|
+
};
|
|
348
|
+
const multipleChoiceGetNumOptionValue = (itemKey, optionKey) => {
|
|
349
|
+
return getResponseValueAsNum(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.multipleChoiceKey, optionKey].join('.'));
|
|
350
|
+
};
|
|
351
|
+
const singleChoiceTextInputRegexCheck = (itemKey, optionKey, pattern) => {
|
|
352
|
+
return checkResponseValueWithRegex(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.singleChoiceKey, optionKey].join('.'), pattern);
|
|
353
|
+
};
|
|
354
|
+
const mulitpleChoiceTextInputRegexCheck = (itemKey, optionKey, pattern) => {
|
|
355
|
+
return checkResponseValueWithRegex(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.multipleChoiceKey, optionKey].join('.'), pattern);
|
|
356
|
+
};
|
|
357
|
+
const textInputRegexCheck = (itemKey, pattern) => {
|
|
358
|
+
return checkResponseValueWithRegex(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.inputKey].join('.'), pattern);
|
|
359
|
+
};
|
|
360
|
+
const multilineTextInputRegexCheck = (itemKey, pattern) => {
|
|
361
|
+
return checkResponseValueWithRegex(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.inputKey].join('.'), pattern);
|
|
362
|
+
};
|
|
363
|
+
const consentAcceptedCondition = (itemKey) => {
|
|
364
|
+
return hasResponse(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.consentKey].join('.'));
|
|
365
|
+
};
|
|
366
|
+
const NativeSurveyEngineExpressions = {
|
|
367
|
+
getters: {
|
|
368
|
+
// root data reference:
|
|
369
|
+
getContext,
|
|
370
|
+
getResponses,
|
|
371
|
+
getRenderedItems,
|
|
372
|
+
// object access:
|
|
373
|
+
getAttribute,
|
|
374
|
+
getArrayItemAtIndex,
|
|
375
|
+
getArrayItemByKey,
|
|
376
|
+
getObjByHierarchicalKey,
|
|
377
|
+
getNestedObjectByKey,
|
|
378
|
+
},
|
|
379
|
+
// query methods for previous names:
|
|
380
|
+
previousResponses: {
|
|
381
|
+
getItemsByKey: findPreviousSurveyResponsesByKey,
|
|
382
|
+
getLastItemByKey: getLastFromSurveyResponses,
|
|
383
|
+
getAllResponsesForSurveyKey: getPreviousResponses,
|
|
384
|
+
filterResponsesByIncludesKeys,
|
|
385
|
+
filterResponsesByValue,
|
|
386
|
+
getLastFromSurveyItemResponses,
|
|
387
|
+
},
|
|
388
|
+
// client side shortcut methods:
|
|
389
|
+
isDefined,
|
|
390
|
+
hasResponse,
|
|
391
|
+
getResponseItem,
|
|
392
|
+
parseValueAsNum,
|
|
393
|
+
getResponseValueAsNum,
|
|
394
|
+
getResponseValueAsStr,
|
|
395
|
+
checkResponseValueWithRegex,
|
|
396
|
+
responseHasKeysAny,
|
|
397
|
+
responseHasKeysAll,
|
|
398
|
+
responseHasOnlyKeysOtherThan,
|
|
399
|
+
getSurveyItemValidation,
|
|
400
|
+
dateResponseDiffFromNow,
|
|
401
|
+
countResponseItems,
|
|
402
|
+
compare: {
|
|
403
|
+
eq,
|
|
404
|
+
lt,
|
|
405
|
+
lte,
|
|
406
|
+
gt,
|
|
407
|
+
gte,
|
|
408
|
+
},
|
|
409
|
+
logic: {
|
|
410
|
+
or,
|
|
411
|
+
and,
|
|
412
|
+
not,
|
|
413
|
+
},
|
|
414
|
+
// Other
|
|
415
|
+
getSecondsSince,
|
|
416
|
+
timestampWithOffset,
|
|
417
|
+
};
|
|
418
|
+
const SurveyEngine = Object.assign(Object.assign({}, NativeSurveyEngineExpressions), { singleChoice: {
|
|
419
|
+
any: singleChoiceOptionsSelected,
|
|
420
|
+
none: singleChoiceOnlyOtherOptionSelected,
|
|
421
|
+
getDateValue: singleChoiceGetNumOptionValue,
|
|
422
|
+
getNumValue: singleChoiceGetNumOptionValue,
|
|
423
|
+
regexCheck: singleChoiceTextInputRegexCheck,
|
|
424
|
+
}, multipleChoice: {
|
|
425
|
+
any: multipleChoiceOptionsSelected,
|
|
426
|
+
none: multipleChoiceOnlyOtherKeysSelected,
|
|
427
|
+
all: multipleChoiceAllOfTheseSelected,
|
|
428
|
+
selectionCount: multipleChoiceSelectionCount,
|
|
429
|
+
getDateValue: multipleChoiceGetNumOptionValue,
|
|
430
|
+
getNumValue: multipleChoiceGetNumOptionValue,
|
|
431
|
+
regexCheck: mulitpleChoiceTextInputRegexCheck,
|
|
432
|
+
}, consentQuestion: {
|
|
433
|
+
accepted: consentAcceptedCondition,
|
|
434
|
+
}, textInput: {
|
|
435
|
+
regexCheck: textInputRegexCheck,
|
|
436
|
+
}, multilineTextInput: {
|
|
437
|
+
regexCheck: multilineTextInputRegexCheck,
|
|
438
|
+
}, datePicker: {
|
|
439
|
+
get: getDatePickerResponseValue,
|
|
440
|
+
}, participantFlags: {
|
|
441
|
+
hasKey: hasParticipantFlagKey,
|
|
442
|
+
hasKeyAndValue: hasParticipantFlagKeyAndValue,
|
|
443
|
+
getAsNum: parseParticipantFlagAsNum,
|
|
444
|
+
}, isLoggedIn });
|
|
445
|
+
|
|
446
|
+
exports.NativeSurveyEngineExpressions = NativeSurveyEngineExpressions;
|
|
447
|
+
exports.SurveyEngine = SurveyEngine;
|
|
448
|
+
//# sourceMappingURL=survey-engine-expressions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-engine-expressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ItemGroupComponent, Expression, ItemComponent, SurveyItem, ExpressionArg, ResponseComponent } from "survey-engine/data_types";
|
|
2
|
+
import { ClozeQuestionProps, ConsentQuestionProps, DateInputQuestionProps, GenericQuestionProps, MultiLineTextInput, NumericInputQuestionProps, OptionDef, ResponsiveBipolarLikertArrayQuestionProps, ResponsiveSingleChoiceArrayQuestionProps, TextInputQuestionProps, TimeInputQuestionProps } from "./types/item-properties";
|
|
3
|
+
import { LikertGroupRow } from "./responseTypeGenerators/likertGroupComponents";
|
|
4
|
+
interface OptionQuestionProps extends GenericQuestionProps {
|
|
5
|
+
responseOptions: Array<OptionDef>;
|
|
6
|
+
}
|
|
7
|
+
interface DropDownQuestionProps extends GenericQuestionProps {
|
|
8
|
+
responseOptions: Array<OptionDef>;
|
|
9
|
+
placeholder?: Map<string, string>;
|
|
10
|
+
}
|
|
11
|
+
interface LikertGroupQuestionProps extends GenericQuestionProps {
|
|
12
|
+
rows: Array<LikertGroupRow>;
|
|
13
|
+
scaleOptions: Array<{
|
|
14
|
+
key: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
content: Map<string, string>;
|
|
17
|
+
}>;
|
|
18
|
+
stackOnSmallScreen?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface NumericSliderProps extends GenericQuestionProps {
|
|
21
|
+
sliderLabel: Map<string, string>;
|
|
22
|
+
noResponseLabel: Map<string, string>;
|
|
23
|
+
min?: number | ExpressionArg;
|
|
24
|
+
max?: number | ExpressionArg;
|
|
25
|
+
stepSize?: number | ExpressionArg;
|
|
26
|
+
}
|
|
27
|
+
interface CustomResponseItem extends ResponseComponent {
|
|
28
|
+
mapToRole?: 'singleChoiceGroup' | 'multipleChoiceGroup' | 'input';
|
|
29
|
+
items?: ItemComponent[];
|
|
30
|
+
}
|
|
31
|
+
interface CustomQuestionProps extends GenericQuestionProps {
|
|
32
|
+
responseItemDefs: CustomResponseItem[];
|
|
33
|
+
}
|
|
34
|
+
interface DisplayProps {
|
|
35
|
+
parentKey: string;
|
|
36
|
+
itemKey: string;
|
|
37
|
+
content: Array<ItemComponent>;
|
|
38
|
+
condition?: Expression;
|
|
39
|
+
}
|
|
40
|
+
interface EQ5DHealthSliderProps {
|
|
41
|
+
role: 'eq5d-health-indicator';
|
|
42
|
+
key: string;
|
|
43
|
+
displayCondition?: Expression;
|
|
44
|
+
disabled?: Expression;
|
|
45
|
+
instructionText: Map<string, string>;
|
|
46
|
+
valueBoxText: Map<string, string>;
|
|
47
|
+
maxHealthText: Map<string, string>;
|
|
48
|
+
minHealthText: Map<string, string>;
|
|
49
|
+
}
|
|
50
|
+
export declare const initEQ5DHealthIndicatorQuestion: (props: EQ5DHealthSliderProps) => ItemGroupComponent;
|
|
51
|
+
export declare const SurveyItems: {
|
|
52
|
+
consent: (props: ConsentQuestionProps) => SurveyItem;
|
|
53
|
+
singleChoice: (props: OptionQuestionProps) => SurveyItem;
|
|
54
|
+
responsiveSingleChoiceArray: (props: ResponsiveSingleChoiceArrayQuestionProps) => SurveyItem;
|
|
55
|
+
responsiveBipolarLikertArray: (props: ResponsiveBipolarLikertArrayQuestionProps) => SurveyItem;
|
|
56
|
+
multipleChoice: (props: OptionQuestionProps) => SurveyItem;
|
|
57
|
+
dateInput: (props: DateInputQuestionProps) => SurveyItem;
|
|
58
|
+
timeInput: (props: TimeInputQuestionProps) => SurveyItem;
|
|
59
|
+
textInput: (props: TextInputQuestionProps) => SurveyItem;
|
|
60
|
+
clozeQuestion: (props: ClozeQuestionProps) => SurveyItem;
|
|
61
|
+
numericInput: (props: NumericInputQuestionProps) => SurveyItem;
|
|
62
|
+
multilineTextInput: (props: MultiLineTextInput) => SurveyItem;
|
|
63
|
+
dropDown: (props: DropDownQuestionProps) => SurveyItem;
|
|
64
|
+
numericSlider: (props: NumericSliderProps) => SurveyItem;
|
|
65
|
+
display: (props: DisplayProps) => SurveyItem;
|
|
66
|
+
surveyEnd: (parentKey: string, content: Map<string, string>, condition?: Expression | undefined) => SurveyItem;
|
|
67
|
+
customQuestion: (props: CustomQuestionProps) => SurveyItem;
|
|
68
|
+
old: {
|
|
69
|
+
simpleLikertGroup: (props: LikertGroupQuestionProps) => SurveyItem;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
export {};
|