case-editor-tools 1.0.0-beta.13 → 1.0.0-beta.17
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/package.json +3 -3
- package/surveys/index.d.ts +1 -1
- package/surveys/index.js +3 -1
- package/surveys/index.js.map +1 -1
- package/surveys/survey-items.d.ts +3 -21
- package/surveys/survey-items.js +34 -1
- package/surveys/survey-items.js.map +1 -1
- package/surveys/types/item-properties.d.ts +23 -0
- package/surveys/utils/optionDefGenerators.d.ts +55 -38
- package/surveys/utils/optionDefGenerators.js +94 -33
- package/surveys/utils/optionDefGenerators.js.map +1 -1
|
@@ -14,8 +14,10 @@ const sliderCategoricalKey = "scc";
|
|
|
14
14
|
const inputKey = "ic";
|
|
15
15
|
const numericInputKey = "num";
|
|
16
16
|
const datePickerKey = "date";
|
|
17
|
-
const matrixKey = "mat";
|
|
17
|
+
const matrixKey = "mat";
|
|
18
|
+
const clozeKey = "cloze";
|
|
18
19
|
|
|
20
|
+
exports.clozeKey = clozeKey;
|
|
19
21
|
exports.datePickerKey = datePickerKey;
|
|
20
22
|
exports.dropDownKey = dropDownKey;
|
|
21
23
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
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.17",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": "github:case-framework/case-editor-tools",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
10
10
|
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
11
|
-
"rollup": "^2.
|
|
11
|
+
"rollup": "^2.60.2",
|
|
12
12
|
"rollup-plugin-copy": "^3.4.0",
|
|
13
13
|
"rollup-plugin-delete": "^2.0.0",
|
|
14
14
|
"rollup-plugin-multi-input": "^1.3.1",
|
|
15
15
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
16
|
-
"rollup-plugin-typescript2": "^0.
|
|
16
|
+
"rollup-plugin-typescript2": "^0.31.1",
|
|
17
17
|
"typescript": "^4.4.4"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
package/surveys/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { SurveyItems } from './survey-items';
|
|
2
|
-
export {
|
|
2
|
+
export { SingleChoiceOptionTypes, MultipleChoiceOptionTypes, ClozeItemTypes } from './utils/optionDefGenerators';
|
|
3
3
|
export { SurveyEngine } from './survey-engine-expressions';
|
package/surveys/index.js
CHANGED
|
@@ -19,6 +19,8 @@ require('../expression-utils/expressionGen.js');
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
exports.SurveyItems = surveys_surveyItems.SurveyItems;
|
|
22
|
-
exports.
|
|
22
|
+
exports.ClozeItemTypes = surveys_utils_optionDefGenerators.ClozeItemTypes;
|
|
23
|
+
exports.MultipleChoiceOptionTypes = surveys_utils_optionDefGenerators.MultipleChoiceOptionTypes;
|
|
24
|
+
exports.SingleChoiceOptionTypes = surveys_utils_optionDefGenerators.SingleChoiceOptionTypes;
|
|
23
25
|
exports.SurveyEngine = surveys_surveyEngineExpressions.SurveyEngine;
|
|
24
26
|
//# sourceMappingURL=index.js.map
|
package/surveys/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ItemGroupComponent, Expression, ComponentProperties, ItemComponent, SurveyItem, ExpressionArg } from "survey-engine/lib/data_types";
|
|
2
|
-
import {
|
|
3
|
-
import { GenericQuestionProps, NumericInputQuestionProps, OptionDef, ResponsiveBipolarLikertArrayProps, ResponsiveBipolarLikertArrayQuestionProps, ResponsiveSingleChoiceArrayProps, ResponsiveSingleChoiceArrayQuestionProps, TextInputQuestionProps } from "./types/item-properties";
|
|
2
|
+
import { ClozeQuestionProps, DateInputQuestionProps, GenericQuestionProps, MultiLineTextInput, NumericInputQuestionProps, OptionDef, ResponsiveBipolarLikertArrayProps, ResponsiveBipolarLikertArrayQuestionProps, ResponsiveSingleChoiceArrayProps, ResponsiveSingleChoiceArrayQuestionProps, TextInputQuestionProps } from "./types/item-properties";
|
|
4
3
|
interface OptionQuestionProps extends GenericQuestionProps {
|
|
5
4
|
responseOptions: Array<OptionDef>;
|
|
6
5
|
}
|
|
@@ -20,24 +19,6 @@ interface NumericSliderProps extends GenericQuestionProps {
|
|
|
20
19
|
max?: number | ExpressionArg;
|
|
21
20
|
stepSize?: number | ExpressionArg;
|
|
22
21
|
}
|
|
23
|
-
interface DatePickerInput extends GenericQuestionProps {
|
|
24
|
-
dateInputMode: 'YMD' | 'YM' | 'Y';
|
|
25
|
-
inputLabelText?: Map<string, string>;
|
|
26
|
-
placeholderText?: Map<string, string>;
|
|
27
|
-
minRelativeDate?: {
|
|
28
|
-
reference?: number | Expression;
|
|
29
|
-
delta: Duration;
|
|
30
|
-
};
|
|
31
|
-
maxRelativeDate?: {
|
|
32
|
-
reference?: number | Expression;
|
|
33
|
-
delta: Duration;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
interface MultiLineTextInput extends GenericQuestionProps {
|
|
37
|
-
inputLabelText?: Map<string, string>;
|
|
38
|
-
placeholderText?: Map<string, string>;
|
|
39
|
-
maxLength?: number;
|
|
40
|
-
}
|
|
41
22
|
interface DisplayProps {
|
|
42
23
|
parentKey: string;
|
|
43
24
|
itemKey: string;
|
|
@@ -136,8 +117,9 @@ export declare const SurveyItems: {
|
|
|
136
117
|
responsiveSingleChoiceArray: (props: ResponsiveSingleChoiceArrayQuestionProps) => SurveyItem;
|
|
137
118
|
responsiveBipolarLikertArray: (props: ResponsiveBipolarLikertArrayQuestionProps) => SurveyItem;
|
|
138
119
|
multipleChoice: (props: OptionQuestionProps) => SurveyItem;
|
|
139
|
-
dateInput: (props:
|
|
120
|
+
dateInput: (props: DateInputQuestionProps) => SurveyItem;
|
|
140
121
|
textInput: (props: TextInputQuestionProps) => SurveyItem;
|
|
122
|
+
clozeQuestion: (props: ClozeQuestionProps) => SurveyItem;
|
|
141
123
|
numericInput: (props: NumericInputQuestionProps) => SurveyItem;
|
|
142
124
|
multilineTextInput: (props: MultiLineTextInput) => SurveyItem;
|
|
143
125
|
dropDown: (props: OptionQuestionProps) => SurveyItem;
|
package/surveys/survey-items.js
CHANGED
|
@@ -415,6 +415,39 @@ const generateMultilineInput = (props) => {
|
|
|
415
415
|
}
|
|
416
416
|
return simpleEditor.getItem();
|
|
417
417
|
};
|
|
418
|
+
const generateClozeQuestion = (props) => {
|
|
419
|
+
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, props.version ? props.version : 1);
|
|
420
|
+
// QUESTION TEXT
|
|
421
|
+
simpleEditor.setTitle(props.questionText, props.questionSubText, props.titleClassName);
|
|
422
|
+
if (props.condition) {
|
|
423
|
+
simpleEditor.setCondition(props.condition);
|
|
424
|
+
}
|
|
425
|
+
if (props.helpGroupContent) {
|
|
426
|
+
simpleEditor.editor.setHelpGroupComponent(surveys_utils_simpleGenerators.generateHelpGroupComponent(props.helpGroupContent));
|
|
427
|
+
}
|
|
428
|
+
if (props.topDisplayCompoments) {
|
|
429
|
+
props.topDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
430
|
+
}
|
|
431
|
+
const rg_inner = {
|
|
432
|
+
key: constants_keyDefinitions.clozeKey, role: 'cloze',
|
|
433
|
+
items: props.items.map((item) => {
|
|
434
|
+
const clozeItem = item;
|
|
435
|
+
const comp = optionDefToItemComponent(clozeItem);
|
|
436
|
+
return comp;
|
|
437
|
+
})
|
|
438
|
+
};
|
|
439
|
+
simpleEditor.setResponseGroupWithContent(rg_inner);
|
|
440
|
+
if (props.bottomDisplayCompoments) {
|
|
441
|
+
props.bottomDisplayCompoments.forEach(comp => simpleEditor.addDisplayComponent(comp));
|
|
442
|
+
}
|
|
443
|
+
if (props.isRequired) {
|
|
444
|
+
simpleEditor.addHasResponseValidation();
|
|
445
|
+
}
|
|
446
|
+
if (props.footnoteText) {
|
|
447
|
+
simpleEditor.addDisplayComponent(surveys_utils_componentGenerators.ComponentGenerators.footnote({ content: props.footnoteText }));
|
|
448
|
+
}
|
|
449
|
+
return simpleEditor.getItem();
|
|
450
|
+
};
|
|
418
451
|
const generateDisplay = (props) => {
|
|
419
452
|
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, 1);
|
|
420
453
|
props.content.forEach(item => simpleEditor.addDisplayComponent(item));
|
|
@@ -992,7 +1025,7 @@ const SurveyItems = {
|
|
|
992
1025
|
dateInput: generateDatePickerInput,
|
|
993
1026
|
textInput: generateTextInputQuestion,
|
|
994
1027
|
// eq5dSlider: todo,
|
|
995
|
-
|
|
1028
|
+
clozeQuestion: generateClozeQuestion,
|
|
996
1029
|
numericInput: generateNumericInputQuestion,
|
|
997
1030
|
multilineTextInput: generateMultilineInput,
|
|
998
1031
|
dropDown: generateDropDownQuestion,
|
|
@@ -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,4 +1,5 @@
|
|
|
1
1
|
import { ComponentProperties, Expression, ItemComponent, Validation } from "survey-engine/lib/data_types";
|
|
2
|
+
import { Duration } from "../../types/duration";
|
|
2
3
|
export interface StyledTextComponentProp {
|
|
3
4
|
content: Map<string, string>;
|
|
4
5
|
className?: string;
|
|
@@ -49,6 +50,23 @@ export interface NumericInputProps {
|
|
|
49
50
|
disabled?: Expression;
|
|
50
51
|
}
|
|
51
52
|
export declare type NumericInputQuestionProps = GenericQuestionProps & NumericInputProps;
|
|
53
|
+
/**
|
|
54
|
+
* Date Input
|
|
55
|
+
*/
|
|
56
|
+
export interface DateInputProps {
|
|
57
|
+
dateInputMode: 'YMD' | 'YM' | 'Y';
|
|
58
|
+
inputLabelText?: Map<string, string>;
|
|
59
|
+
placeholderText?: Map<string, string>;
|
|
60
|
+
minRelativeDate?: {
|
|
61
|
+
reference?: number | Expression;
|
|
62
|
+
delta: Duration;
|
|
63
|
+
};
|
|
64
|
+
maxRelativeDate?: {
|
|
65
|
+
reference?: number | Expression;
|
|
66
|
+
delta: Duration;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export declare type DateInputQuestionProps = DateInputProps & GenericQuestionProps;
|
|
52
70
|
/**
|
|
53
71
|
* Text Input
|
|
54
72
|
*/
|
|
@@ -61,6 +79,11 @@ export interface TextInputProps {
|
|
|
61
79
|
disabled?: Expression;
|
|
62
80
|
}
|
|
63
81
|
export declare type TextInputQuestionProps = TextInputProps & GenericQuestionProps;
|
|
82
|
+
export interface MultiLineTextInput extends GenericQuestionProps {
|
|
83
|
+
inputLabelText?: Map<string, string>;
|
|
84
|
+
placeholderText?: Map<string, string>;
|
|
85
|
+
maxLength?: number;
|
|
86
|
+
}
|
|
64
87
|
/**
|
|
65
88
|
* Cloze Question
|
|
66
89
|
*/
|
|
@@ -1,52 +1,69 @@
|
|
|
1
1
|
import { Expression } from "survey-engine/lib/data_types";
|
|
2
|
-
import { NumericInputProps, OptionDef, StyledTextComponentProp, TextInputProps } from "../types/item-properties";
|
|
2
|
+
import { ClozeProps, DateInputProps, NumericInputProps, OptionDef, StyledTextComponentProp, TextInputProps } from "../types/item-properties";
|
|
3
3
|
interface CommonProps {
|
|
4
4
|
key?: string;
|
|
5
5
|
content?: Map<string, string> | StyledTextComponentProp[];
|
|
6
6
|
displayCondition?: Expression;
|
|
7
7
|
}
|
|
8
|
-
interface OptionProps
|
|
9
|
-
key: string;
|
|
8
|
+
interface OptionProps {
|
|
10
9
|
disabled?: Expression;
|
|
11
10
|
className?: string;
|
|
11
|
+
displayCondition?: Expression;
|
|
12
12
|
}
|
|
13
13
|
interface OptionTextProps extends CommonProps {
|
|
14
|
-
key: string;
|
|
15
14
|
className?: string;
|
|
16
15
|
}
|
|
17
|
-
export declare const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
16
|
+
export declare const SingleChoiceOptionTypes: {
|
|
17
|
+
option: (key: string, content: Map<string, string> | StyledTextComponentProp[], extraProps?: OptionProps | undefined) => OptionDef;
|
|
18
|
+
textInput: (props: TextInputProps & {
|
|
19
|
+
key: string;
|
|
20
|
+
displayCondition?: Expression;
|
|
21
|
+
}) => OptionDef;
|
|
22
|
+
numberInput: (props: NumericInputProps & {
|
|
23
|
+
key: string;
|
|
24
|
+
displayCondition?: Expression;
|
|
25
|
+
}) => OptionDef;
|
|
26
|
+
cloze: (props: ClozeProps & {
|
|
27
|
+
key: string;
|
|
28
|
+
displayCondition?: Expression;
|
|
29
|
+
}) => OptionDef;
|
|
30
|
+
};
|
|
31
|
+
export declare const MultipleChoiceOptionTypes: {
|
|
32
|
+
option: (key: string, content: Map<string, string> | StyledTextComponentProp[], extraProps?: OptionProps | undefined) => OptionDef;
|
|
33
|
+
subtitle: (props: OptionTextProps) => OptionDef;
|
|
34
|
+
textInput: (props: TextInputProps & {
|
|
35
|
+
key: string;
|
|
36
|
+
displayCondition?: Expression;
|
|
37
|
+
}) => OptionDef;
|
|
38
|
+
numberInput: (props: NumericInputProps & {
|
|
39
|
+
key: string;
|
|
40
|
+
displayCondition?: Expression;
|
|
41
|
+
}) => OptionDef;
|
|
42
|
+
cloze: (props: ClozeProps & {
|
|
43
|
+
key: string;
|
|
44
|
+
displayCondition?: Expression;
|
|
45
|
+
}) => OptionDef;
|
|
46
|
+
};
|
|
47
|
+
export declare const ClozeItemTypes: {
|
|
48
|
+
text: (props: OptionTextProps) => OptionDef;
|
|
49
|
+
markdown: (props: OptionTextProps) => OptionDef;
|
|
50
|
+
textInput: (props: TextInputProps & {
|
|
51
|
+
key: string;
|
|
52
|
+
displayCondition?: Expression;
|
|
53
|
+
}) => OptionDef;
|
|
54
|
+
dateInput: (props: DateInputProps & {
|
|
55
|
+
key: string;
|
|
56
|
+
displayCondition?: Expression;
|
|
57
|
+
}) => OptionDef;
|
|
58
|
+
clozeLineBreak: () => OptionDef;
|
|
59
|
+
numberInput: (props: NumericInputProps & {
|
|
60
|
+
key: string;
|
|
61
|
+
displayCondition?: Expression;
|
|
62
|
+
}) => OptionDef;
|
|
63
|
+
dropDown: (props: {
|
|
64
|
+
key: string;
|
|
65
|
+
displayCondition?: Expression;
|
|
66
|
+
options: Array<OptionDef>;
|
|
67
|
+
}) => OptionDef;
|
|
51
68
|
};
|
|
52
69
|
export {};
|
|
@@ -2,7 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
var surveys_surveyEngineExpressions = require('../survey-engine-expressions.js');
|
|
6
|
+
var surveys_utils_randomKeyGenerator = require('./randomKeyGenerator.js');
|
|
7
|
+
require('../../constants/key-definitions.js');
|
|
8
|
+
require('../../types/duration.js');
|
|
9
|
+
require('../../expression-utils/expressionGen.js');
|
|
10
|
+
|
|
11
|
+
const option = (key, content, extraProps) => {
|
|
12
|
+
const styles = [];
|
|
13
|
+
if ((extraProps === null || extraProps === void 0 ? void 0 : extraProps.className) !== undefined) {
|
|
14
|
+
styles.push({
|
|
15
|
+
key: 'className', value: extraProps.className
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
key: key,
|
|
20
|
+
role: 'option',
|
|
21
|
+
content: !Array.isArray(content) ? content : undefined,
|
|
22
|
+
items: Array.isArray(content) ? content : undefined,
|
|
23
|
+
displayCondition: extraProps === null || extraProps === void 0 ? void 0 : extraProps.displayCondition,
|
|
24
|
+
disabled: extraProps === null || extraProps === void 0 ? void 0 : extraProps.disabled,
|
|
25
|
+
style: styles,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const multipleChoiceOptionSubtitle = (props) => {
|
|
6
29
|
const styles = [];
|
|
7
30
|
if (props.className !== undefined) {
|
|
8
31
|
styles.push({
|
|
@@ -10,16 +33,14 @@ const option = (props) => {
|
|
|
10
33
|
});
|
|
11
34
|
}
|
|
12
35
|
return {
|
|
13
|
-
key: props.key,
|
|
14
|
-
role: '
|
|
36
|
+
key: props.key ? props.key : surveys_utils_randomKeyGenerator.generateRandomKey(6),
|
|
37
|
+
role: 'text',
|
|
15
38
|
content: !Array.isArray(props.content) ? props.content : undefined,
|
|
16
|
-
items: Array.isArray(props.content) ? props.content : undefined,
|
|
17
39
|
displayCondition: props.displayCondition,
|
|
18
|
-
disabled: props.disabled,
|
|
19
40
|
style: styles,
|
|
20
41
|
};
|
|
21
42
|
};
|
|
22
|
-
const
|
|
43
|
+
const markdown = (props) => {
|
|
23
44
|
const styles = [];
|
|
24
45
|
if (props.className !== undefined) {
|
|
25
46
|
styles.push({
|
|
@@ -27,8 +48,8 @@ const multipleChoiceOptionSubtitle = (props) => {
|
|
|
27
48
|
});
|
|
28
49
|
}
|
|
29
50
|
return {
|
|
30
|
-
key: props.key,
|
|
31
|
-
role: '
|
|
51
|
+
key: props.key ? props.key : surveys_utils_randomKeyGenerator.generateRandomKey(6),
|
|
52
|
+
role: 'markdown',
|
|
32
53
|
content: !Array.isArray(props.content) ? props.content : undefined,
|
|
33
54
|
displayCondition: props.displayCondition,
|
|
34
55
|
style: styles,
|
|
@@ -78,31 +99,71 @@ const numberInput = (props) => {
|
|
|
78
99
|
style: style.length > 0 ? style : undefined,
|
|
79
100
|
};
|
|
80
101
|
};
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
102
|
+
const dateInput = (props) => {
|
|
103
|
+
return {
|
|
104
|
+
key: props.key,
|
|
105
|
+
role: 'dateInput',
|
|
106
|
+
optionProps: {
|
|
107
|
+
dateInputMode: { str: props.dateInputMode },
|
|
108
|
+
min: props.minRelativeDate ? {
|
|
109
|
+
dtype: 'exp', exp: surveys_surveyEngineExpressions.SurveyEngine.timestampWithOffset(props.minRelativeDate.delta, props.minRelativeDate.reference)
|
|
110
|
+
} : undefined,
|
|
111
|
+
max: props.maxRelativeDate ? {
|
|
112
|
+
dtype: 'exp', exp: surveys_surveyEngineExpressions.SurveyEngine.timestampWithOffset(props.maxRelativeDate.delta, props.maxRelativeDate.reference ? props.maxRelativeDate.reference : undefined)
|
|
113
|
+
} : undefined,
|
|
114
|
+
},
|
|
115
|
+
content: props.inputLabelText,
|
|
116
|
+
displayCondition: props.displayCondition,
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
const dropDown = (props) => {
|
|
120
|
+
return {
|
|
121
|
+
key: props.key,
|
|
122
|
+
role: 'dropDownGroup',
|
|
123
|
+
displayCondition: props.displayCondition,
|
|
124
|
+
items: props.options,
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
const cloze = (props) => {
|
|
128
|
+
return {
|
|
129
|
+
key: props.key,
|
|
130
|
+
role: 'cloze',
|
|
131
|
+
items: props.items,
|
|
132
|
+
displayCondition: props.displayCondition,
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
const clozeLineBreak = () => {
|
|
136
|
+
return {
|
|
137
|
+
key: surveys_utils_randomKeyGenerator.generateRandomKey(5),
|
|
138
|
+
role: 'lineBreak',
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
const SingleChoiceOptionTypes = {
|
|
142
|
+
option,
|
|
143
|
+
textInput,
|
|
144
|
+
//dateInput,
|
|
145
|
+
numberInput,
|
|
146
|
+
cloze,
|
|
147
|
+
};
|
|
148
|
+
const MultipleChoiceOptionTypes = {
|
|
149
|
+
option,
|
|
150
|
+
subtitle: multipleChoiceOptionSubtitle,
|
|
151
|
+
textInput,
|
|
152
|
+
// dateInput,
|
|
153
|
+
numberInput,
|
|
154
|
+
cloze,
|
|
155
|
+
};
|
|
156
|
+
const ClozeItemTypes = {
|
|
157
|
+
text: multipleChoiceOptionSubtitle,
|
|
158
|
+
markdown,
|
|
159
|
+
textInput,
|
|
160
|
+
dateInput,
|
|
161
|
+
clozeLineBreak,
|
|
162
|
+
numberInput,
|
|
163
|
+
dropDown,
|
|
105
164
|
};
|
|
106
165
|
|
|
107
|
-
exports.
|
|
166
|
+
exports.ClozeItemTypes = ClozeItemTypes;
|
|
167
|
+
exports.MultipleChoiceOptionTypes = MultipleChoiceOptionTypes;
|
|
168
|
+
exports.SingleChoiceOptionTypes = SingleChoiceOptionTypes;
|
|
108
169
|
//# sourceMappingURL=optionDefGenerators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optionDefGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"optionDefGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|