case-editor-tools 1.0.0-beta.3 → 1.0.0-beta.30
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/{build/constants → constants}/key-definitions.d.ts +1 -0
- package/{build/constants → constants}/key-definitions.js +3 -1
- package/{build/constants → constants}/key-definitions.js.map +1 -1
- package/exporter/index.d.ts +2 -0
- package/exporter/index.js +99 -0
- package/exporter/index.js.map +1 -0
- package/{build/expression-utils → expression-utils}/expressionGen.d.ts +1 -1
- package/{build/expression-utils → expression-utils}/expressionGen.js +0 -0
- package/{build/expression-utils → expression-utils}/expressionGen.js.map +0 -0
- package/{build/expression-utils → expression-utils}/studyEngineExpressions.d.ts +37 -7
- package/{build/expression-utils → expression-utils}/studyEngineExpressions.js +93 -4
- package/{build/expression-utils → expression-utils}/studyEngineExpressions.js.map +1 -1
- package/{build/index.d.ts → index.d.ts} +0 -0
- package/{build/index.js → index.js} +0 -0
- package/{build/index.js.map → index.js.map} +0 -0
- package/{build/item-editor-8fd24b61.js → item-editor-c6933791.js} +69 -51
- package/item-editor-c6933791.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/{build/logger → logger}/logger.d.ts +0 -0
- package/{build/logger → logger}/logger.js +0 -0
- package/{build/logger → logger}/logger.js.map +0 -0
- package/package.json +7 -8
- package/surveys/index.d.ts +3 -0
- package/surveys/index.js +28 -0
- package/surveys/index.js.map +1 -0
- package/surveys/responseTypeGenerators/likertGroupComponents.d.ts +27 -0
- package/surveys/responseTypeGenerators/likertGroupComponents.js +347 -0
- package/surveys/responseTypeGenerators/likertGroupComponents.js.map +1 -0
- package/surveys/responseTypeGenerators/matrixGroupComponent.d.ts +49 -0
- package/surveys/responseTypeGenerators/matrixGroupComponent.js +99 -0
- package/surveys/responseTypeGenerators/matrixGroupComponent.js.map +1 -0
- package/surveys/responseTypeGenerators/optionGroupComponents.d.ts +7 -0
- package/surveys/responseTypeGenerators/optionGroupComponents.js +125 -0
- package/surveys/responseTypeGenerators/optionGroupComponents.js.map +1 -0
- package/{build → surveys}/survey-editor/component-editor.d.ts +1 -1
- package/{build → surveys}/survey-editor/component-editor.js +0 -0
- package/{build → surveys}/survey-editor/component-editor.js.map +0 -0
- package/{build → surveys}/survey-editor/data-types.d.ts +1 -1
- package/{build → surveys}/survey-editor/data-types.js +0 -0
- package/{build → surveys}/survey-editor/data-types.js.map +0 -0
- package/{build → surveys}/survey-editor/item-editor.d.ts +1 -1
- package/{build → surveys}/survey-editor/item-editor.js +3 -2
- package/{build → surveys}/survey-editor/item-editor.js.map +1 -1
- package/{build → surveys}/survey-editor/survey-editor.d.ts +6 -1
- package/{build → surveys}/survey-editor/survey-editor.js +15 -8
- package/{build → surveys}/survey-editor/survey-editor.js.map +1 -1
- package/{build/expression-utils/surveyEngineExpressions.d.ts → surveys/survey-engine-expressions.d.ts} +9 -2
- package/{build/expression-utils/surveyEngineExpressions.js → surveys/survey-engine-expressions.js} +36 -4
- package/{build/expression-utils/surveyEngineExpressions.js.map → surveys/survey-engine-expressions.js.map} +1 -1
- package/surveys/survey-items.d.ts +66 -0
- package/surveys/survey-items.js +302 -0
- package/surveys/survey-items.js.map +1 -0
- package/{build → surveys}/types/group.d.ts +1 -1
- package/{build → surveys}/types/group.js +5 -5
- package/{build → surveys}/types/group.js.map +0 -0
- package/surveys/types/index.d.ts +4 -0
- package/surveys/types/index.js +20 -0
- package/surveys/types/index.js.map +1 -0
- package/surveys/types/item-properties.d.ts +189 -0
- package/surveys/types/item-properties.js +3 -0
- package/surveys/types/item-properties.js.map +1 -0
- package/{build → surveys}/types/item.d.ts +1 -1
- package/{build → surveys}/types/item.js +0 -0
- package/{build → surveys}/types/item.js.map +0 -0
- package/{build/types/surveyDefinition.d.ts → surveys/types/survey-definition.d.ts} +7 -3
- package/{build/types/surveyDefinition.js → surveys/types/survey-definition.js} +19 -11
- package/surveys/types/survey-definition.js.map +1 -0
- package/{build → surveys}/utils/componentGenerators.d.ts +2 -13
- package/surveys/utils/componentGenerators.js +58 -0
- package/{build → surveys}/utils/componentGenerators.js.map +1 -1
- package/surveys/utils/optionDefGenerators.d.ts +69 -0
- package/surveys/utils/optionDefGenerators.js +169 -0
- package/surveys/utils/optionDefGenerators.js.map +1 -0
- package/{build → surveys}/utils/randomKeyGenerator.d.ts +0 -0
- package/{build → surveys}/utils/randomKeyGenerator.js +0 -0
- package/{build → surveys}/utils/randomKeyGenerator.js.map +0 -0
- package/{build → surveys}/utils/simple-generators.d.ts +2 -2
- package/{build → surveys}/utils/simple-generators.js +5 -5
- package/{build → surveys}/utils/simple-generators.js.map +0 -0
- package/{build → surveys}/utils/simple-question-editor.d.ts +3 -3
- package/{build → surveys}/utils/simple-question-editor.js +7 -6
- package/{build → surveys}/utils/simple-question-editor.js.map +1 -1
- package/{build/types → types}/duration.d.ts +0 -0
- package/{build/types → types}/duration.js +0 -0
- package/{build/types → types}/duration.js.map +0 -0
- package/{build/types → types}/expression.d.ts +1 -1
- package/{build/types → types}/expression.js +0 -0
- package/{build/types → types}/expression.js.map +0 -0
- package/{build/types → types}/study.d.ts +2 -2
- package/{build/types → types}/study.js +0 -0
- package/{build/types → types}/study.js.map +0 -0
- package/{build/types → types}/studyRules.d.ts +1 -1
- package/{build/types → types}/studyRules.js +0 -0
- package/{build/types → types}/studyRules.js.map +0 -0
- package/.babelrc.js +0 -7
- package/.editorconfig +0 -13
- package/LICENSE +0 -202
- package/build/item-editor-8fd24b61.js.map +0 -1
- package/build/package.json +0 -26
- package/build/types/surveyDefinition.js.map +0 -1
- package/build/utils/componentGenerators.js +0 -92
- package/build/utils/question-type-generator.d.ts +0 -283
- package/build/utils/question-type-generator.js +0 -949
- package/build/utils/question-type-generator.js.map +0 -1
- package/rollup.config.js +0 -53
- package/src/constants/key-definitions.ts +0 -13
- package/src/expression-utils/expressionGen.ts +0 -28
- package/src/expression-utils/studyEngineExpressions.ts +0 -359
- package/src/expression-utils/surveyEngineExpressions.ts +0 -483
- package/src/index.ts +0 -1
- package/src/logger/logger.ts +0 -31
- package/src/survey-editor/component-editor.ts +0 -133
- package/src/survey-editor/data-types.ts +0 -18
- package/src/survey-editor/item-editor.ts +0 -528
- package/src/survey-editor/survey-editor.ts +0 -260
- package/src/types/duration.ts +0 -32
- package/src/types/expression.ts +0 -22
- package/src/types/group.ts +0 -73
- package/src/types/item.ts +0 -42
- package/src/types/study.ts +0 -17
- package/src/types/studyRules.ts +0 -39
- package/src/types/surveyDefinition.ts +0 -83
- package/src/utils/componentGenerators.ts +0 -122
- package/src/utils/question-type-generator.ts +0 -1516
- package/src/utils/randomKeyGenerator.ts +0 -11
- package/src/utils/simple-generators.ts +0 -106
- package/src/utils/simple-question-editor.ts +0 -52
- package/tsconfig.json +0 -100
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-definition.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import { Expression, ItemComponent } from "survey-engine/
|
|
2
|
-
import {
|
|
1
|
+
import { Expression, ItemComponent } from "survey-engine/data_types";
|
|
2
|
+
import { StyledTextComponentProp } 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 extends CommonProps {
|
|
9
|
-
key: string;
|
|
10
|
-
disabled?: Expression;
|
|
11
|
-
className?: string;
|
|
12
|
-
}
|
|
13
|
-
interface OptionTextProps extends CommonProps {
|
|
14
|
-
key: string;
|
|
15
|
-
className?: string;
|
|
16
|
-
}
|
|
17
8
|
interface TextProps extends CommonProps {
|
|
18
9
|
content: Map<string, string>;
|
|
19
10
|
variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'li';
|
|
@@ -24,8 +15,6 @@ interface MarkdownProps extends CommonProps {
|
|
|
24
15
|
className?: string;
|
|
25
16
|
}
|
|
26
17
|
export declare const ComponentGenerators: {
|
|
27
|
-
option: (props: OptionProps) => OptionDef;
|
|
28
|
-
multipleChoiceOptionSubtitle: (props: OptionTextProps) => OptionDef;
|
|
29
18
|
footnote: (props: {
|
|
30
19
|
content: Map<string, string>;
|
|
31
20
|
}) => ItemComponent;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var surveys_utils_randomKeyGenerator = require('./randomKeyGenerator.js');
|
|
6
|
+
var surveys_utils_simpleGenerators = require('./simple-generators.js');
|
|
7
|
+
require('../survey-editor/component-editor.js');
|
|
8
|
+
|
|
9
|
+
const text = (props) => {
|
|
10
|
+
const styles = [];
|
|
11
|
+
if (props.className !== undefined) {
|
|
12
|
+
styles.push({
|
|
13
|
+
key: 'className', value: props.className
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (props.variant !== undefined) {
|
|
17
|
+
styles.push({
|
|
18
|
+
key: 'variant', value: props.variant
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
key: surveys_utils_randomKeyGenerator.generateRandomKey(3),
|
|
23
|
+
role: 'text',
|
|
24
|
+
style: styles.length > 0 ? styles : undefined,
|
|
25
|
+
content: surveys_utils_simpleGenerators.generateLocStrings(props.content),
|
|
26
|
+
displayCondition: props.displayCondition,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
const markdown = (props) => {
|
|
30
|
+
const styles = [];
|
|
31
|
+
if (props.className !== undefined) {
|
|
32
|
+
styles.push({
|
|
33
|
+
key: 'className', value: props.className
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
key: surveys_utils_randomKeyGenerator.generateRandomKey(3),
|
|
38
|
+
role: 'markdown',
|
|
39
|
+
style: styles.length > 0 ? styles : undefined,
|
|
40
|
+
content: surveys_utils_simpleGenerators.generateLocStrings(props.content),
|
|
41
|
+
displayCondition: props.displayCondition,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const footnote = (props) => {
|
|
45
|
+
return {
|
|
46
|
+
role: 'footnote', content: surveys_utils_simpleGenerators.generateLocStrings(props.content), style: [
|
|
47
|
+
{ key: 'className', value: 'fs-small fst-italic text-center' }
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const ComponentGenerators = {
|
|
52
|
+
footnote,
|
|
53
|
+
text,
|
|
54
|
+
markdown,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
exports.ComponentGenerators = ComponentGenerators;
|
|
58
|
+
//# sourceMappingURL=componentGenerators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"componentGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Expression } from "survey-engine/data_types";
|
|
2
|
+
import { ClozeProps, DateInputProps, NumericInputProps, OptionDef, StyledTextComponentProp, TextInputProps } from "../types/item-properties";
|
|
3
|
+
interface CommonProps {
|
|
4
|
+
key?: string;
|
|
5
|
+
content?: Map<string, string> | StyledTextComponentProp[];
|
|
6
|
+
displayCondition?: Expression;
|
|
7
|
+
}
|
|
8
|
+
interface OptionProps {
|
|
9
|
+
disabled?: Expression;
|
|
10
|
+
className?: string;
|
|
11
|
+
displayCondition?: Expression;
|
|
12
|
+
}
|
|
13
|
+
interface OptionTextProps extends CommonProps {
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
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;
|
|
68
|
+
};
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
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) => {
|
|
29
|
+
const styles = [];
|
|
30
|
+
if (props.className !== undefined) {
|
|
31
|
+
styles.push({
|
|
32
|
+
key: 'className', value: props.className
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
key: props.key ? props.key : surveys_utils_randomKeyGenerator.generateRandomKey(6),
|
|
37
|
+
role: 'text',
|
|
38
|
+
content: !Array.isArray(props.content) ? props.content : undefined,
|
|
39
|
+
displayCondition: props.displayCondition,
|
|
40
|
+
style: styles,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const markdown = (props) => {
|
|
44
|
+
const styles = [];
|
|
45
|
+
if (props.className !== undefined) {
|
|
46
|
+
styles.push({
|
|
47
|
+
key: 'className', value: props.className
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
key: props.key ? props.key : surveys_utils_randomKeyGenerator.generateRandomKey(6),
|
|
52
|
+
role: 'markdown',
|
|
53
|
+
content: !Array.isArray(props.content) ? props.content : undefined,
|
|
54
|
+
displayCondition: props.displayCondition,
|
|
55
|
+
style: styles,
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
const textInput = (props) => {
|
|
59
|
+
const style = [];
|
|
60
|
+
if (props.maxLength !== undefined) {
|
|
61
|
+
style.push({ key: 'maxLength', value: props.maxLength.toFixed(0) });
|
|
62
|
+
}
|
|
63
|
+
if (props.className !== undefined) {
|
|
64
|
+
style.push({ key: 'className', value: props.className });
|
|
65
|
+
}
|
|
66
|
+
if (props.inputMaxWidth !== undefined) {
|
|
67
|
+
style.push({ key: 'inputMaxWidth', value: props.inputMaxWidth });
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
key: props.key,
|
|
71
|
+
role: 'input',
|
|
72
|
+
content: props.inputLabel,
|
|
73
|
+
description: props.placeholderText,
|
|
74
|
+
displayCondition: props.displayCondition,
|
|
75
|
+
disabled: props.disabled,
|
|
76
|
+
style: style.length > 0 ? style : undefined,
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
const numberInput = (props) => {
|
|
80
|
+
var _a, _b, _c, _d;
|
|
81
|
+
const style = [];
|
|
82
|
+
if (props.inputMaxWidth !== undefined) {
|
|
83
|
+
style.push({ key: 'inputMaxWidth', value: props.inputMaxWidth });
|
|
84
|
+
}
|
|
85
|
+
if (props.labelBehindInput) {
|
|
86
|
+
style.push({ key: 'labelPlacement', value: 'after' });
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
key: props.key,
|
|
90
|
+
role: 'numberInput',
|
|
91
|
+
content: props.inputLabel,
|
|
92
|
+
displayCondition: props.displayCondition,
|
|
93
|
+
disabled: props.disabled,
|
|
94
|
+
optionProps: {
|
|
95
|
+
min: ((_a = props.componentProperties) === null || _a === void 0 ? void 0 : _a.min) !== undefined ? (typeof (props.componentProperties.min) === 'number' ? { dtype: 'num', num: props.componentProperties.min } : props.componentProperties.min) : undefined,
|
|
96
|
+
max: ((_b = props.componentProperties) === null || _b === void 0 ? void 0 : _b.max) !== undefined ? (typeof ((_c = props.componentProperties) === null || _c === void 0 ? void 0 : _c.max) === 'number' ? { dtype: 'num', num: props.componentProperties.max } : props.componentProperties.max) : undefined,
|
|
97
|
+
stepSize: ((_d = props.componentProperties) === null || _d === void 0 ? void 0 : _d.stepSize) ? (typeof (props.componentProperties.stepSize) === 'number' ? { dtype: 'num', num: props.componentProperties.stepSize } : props.componentProperties.stepSize) : undefined,
|
|
98
|
+
},
|
|
99
|
+
style: style.length > 0 ? style : undefined,
|
|
100
|
+
};
|
|
101
|
+
};
|
|
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,
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
exports.ClozeItemTypes = ClozeItemTypes;
|
|
167
|
+
exports.MultipleChoiceOptionTypes = MultipleChoiceOptionTypes;
|
|
168
|
+
exports.SingleChoiceOptionTypes = SingleChoiceOptionTypes;
|
|
169
|
+
//# sourceMappingURL=optionDefGenerators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionDefGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LocalizedString, ItemComponent, ExpressionName, Expression, ItemGroupComponent, SurveySingleItem } from "survey-engine/
|
|
2
|
-
import { StyledTextComponentProp } from "
|
|
1
|
+
import { LocalizedString, ItemComponent, ExpressionName, Expression, ItemGroupComponent, SurveySingleItem } from "survey-engine/data_types";
|
|
2
|
+
import { StyledTextComponentProp } from "../types/item-properties";
|
|
3
3
|
export declare const generateLocStrings: (translations: Map<string, string>) => LocalizedString[];
|
|
4
4
|
export declare const generateTitleComponent: (content: Map<string, string> | Array<StyledTextComponentProp>, description?: Map<string, string> | undefined, className?: string | undefined) => ItemComponent;
|
|
5
5
|
export declare const generateHelpGroupComponent: (items: Array<{
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var surveys_surveyEditor_componentEditor = require('../survey-editor/component-editor.js');
|
|
6
|
+
var surveys_utils_randomKeyGenerator = require('./randomKeyGenerator.js');
|
|
7
7
|
|
|
8
8
|
const generateLocStrings = (translations) => {
|
|
9
9
|
// console.log(translations);
|
|
@@ -44,7 +44,7 @@ const generateTitleComponent = (content, description, className) => {
|
|
|
44
44
|
};
|
|
45
45
|
const generateHelpGroupComponent = (items) => {
|
|
46
46
|
// init group
|
|
47
|
-
const groupEdit = new
|
|
47
|
+
const groupEdit = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
48
48
|
isGroup: true,
|
|
49
49
|
role: 'helpGroup',
|
|
50
50
|
});
|
|
@@ -52,7 +52,7 @@ const generateHelpGroupComponent = (items) => {
|
|
|
52
52
|
name: 'sequential'
|
|
53
53
|
});
|
|
54
54
|
items.forEach(item => {
|
|
55
|
-
const itemEditor = new
|
|
55
|
+
const itemEditor = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
56
56
|
role: 'text',
|
|
57
57
|
});
|
|
58
58
|
itemEditor.setContent(generateLocStrings(item.content));
|
|
@@ -88,7 +88,7 @@ const expWithArgs = (name, ...args) => {
|
|
|
88
88
|
};
|
|
89
89
|
const generatePageBreak = (parentKey, key) => {
|
|
90
90
|
return {
|
|
91
|
-
key: parentKey + '.' + (key ? key : "PB_" +
|
|
91
|
+
key: parentKey + '.' + (key ? key : "PB_" + surveys_utils_randomKeyGenerator.generateRandomKey(4)),
|
|
92
92
|
version: 0,
|
|
93
93
|
type: 'pageBreak'
|
|
94
94
|
};
|
|
File without changes
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Expression, ItemComponent } from "survey-engine/
|
|
1
|
+
import { Expression, ItemComponent } from "survey-engine/data_types";
|
|
2
2
|
import { ItemEditor } from "../survey-editor/item-editor";
|
|
3
|
-
import { StyledTextComponentProp } from "
|
|
3
|
+
import { StyledTextComponentProp } from "../types/item-properties";
|
|
4
4
|
export declare class SimpleQuestionEditor {
|
|
5
5
|
editor: ItemEditor;
|
|
6
6
|
key: string;
|
|
7
7
|
constructor(parentKey: string, key: string, version: number);
|
|
8
|
-
getItem(): import("survey-engine/
|
|
8
|
+
getItem(): import("survey-engine/data_types").SurveyItem;
|
|
9
9
|
setTitle(title: Map<string, string> | Array<StyledTextComponentProp>, description?: Map<string, string>, className?: string): void;
|
|
10
10
|
setCondition(exp: Expression): void;
|
|
11
11
|
addDisplayComponent(comp: ItemComponent, atPosition?: number): void;
|
|
@@ -2,24 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var constants_keyDefinitions = require('
|
|
6
|
-
var
|
|
7
|
-
var
|
|
5
|
+
var constants_keyDefinitions = require('../../constants/key-definitions.js');
|
|
6
|
+
var surveys_surveyEditor_itemEditor = require('../../item-editor-c6933791.js');
|
|
7
|
+
var surveys_utils_simpleGenerators = require('./simple-generators.js');
|
|
8
8
|
require('../survey-editor/component-editor.js');
|
|
9
9
|
require('./randomKeyGenerator.js');
|
|
10
|
+
require('../../logger/logger.js');
|
|
10
11
|
|
|
11
12
|
class SimpleQuestionEditor {
|
|
12
13
|
constructor(parentKey, key, version) {
|
|
13
14
|
const itemKey = [parentKey, key].join('.');
|
|
14
15
|
this.key = itemKey;
|
|
15
|
-
this.editor = new
|
|
16
|
+
this.editor = new surveys_surveyEditor_itemEditor.ItemEditor(undefined, { itemKey: itemKey, isGroup: false });
|
|
16
17
|
this.editor.setVersion(version);
|
|
17
18
|
}
|
|
18
19
|
getItem() {
|
|
19
20
|
return this.editor.getItem();
|
|
20
21
|
}
|
|
21
22
|
setTitle(title, description, className) {
|
|
22
|
-
this.editor.setTitleComponent(
|
|
23
|
+
this.editor.setTitleComponent(surveys_utils_simpleGenerators.generateTitleComponent(title, description, className));
|
|
23
24
|
}
|
|
24
25
|
setCondition(exp) {
|
|
25
26
|
this.editor.setCondition(exp);
|
|
@@ -31,7 +32,7 @@ class SimpleQuestionEditor {
|
|
|
31
32
|
this.editor.addValidation({
|
|
32
33
|
key: 'r1',
|
|
33
34
|
type: 'hard',
|
|
34
|
-
rule:
|
|
35
|
+
rule: surveys_utils_simpleGenerators.expWithArgs('hasResponse', this.key, constants_keyDefinitions.responseGroupKey)
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
38
|
setResponseGroupWithContent(content) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-question-editor.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"simple-question-editor.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Expression, ExpressionArg } from "survey-engine/
|
|
1
|
+
import { Expression, ExpressionArg } from "survey-engine/data_types";
|
|
2
2
|
export declare const isExpression: (value: Expression | any) => value is Expression;
|
|
3
3
|
export declare type ExpressionArgDType = 'exp' | 'num' | 'str';
|
|
4
4
|
export declare const expressionArgParser: (arg: ExpressionArg) => any;
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Expression } from "survey-engine/
|
|
1
|
+
import { Expression } from "survey-engine/data_types";
|
|
2
2
|
import { StudyRules } from "./studyRules";
|
|
3
|
-
import { SurveyDefinition } from "
|
|
3
|
+
import { SurveyDefinition } from "../surveys/types/survey-definition";
|
|
4
4
|
export interface Study {
|
|
5
5
|
studyKey: string;
|
|
6
6
|
outputFolderName?: string;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/.babelrc.js
DELETED
package/.editorconfig
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Editor configuration, see https://editorconfig.org
|
|
2
|
-
root = true
|
|
3
|
-
|
|
4
|
-
[*]
|
|
5
|
-
charset = utf-8
|
|
6
|
-
indent_style = space
|
|
7
|
-
indent_size = 2
|
|
8
|
-
insert_final_newline = true
|
|
9
|
-
trim_trailing_whitespace = true
|
|
10
|
-
|
|
11
|
-
[*.md]
|
|
12
|
-
max_line_length = off
|
|
13
|
-
trim_trailing_whitespace = false
|