case-editor-tools 1.0.0-beta.4 → 1.0.0-beta.43
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 +3 -0
- package/{build/constants → constants}/key-definitions.js +7 -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/expression-utils/studyEngineExpressions.d.ts +193 -0
- package/{build/expression-utils → expression-utils}/studyEngineExpressions.js +205 -19
- 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-59f51ecc.js} +72 -51
- 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/{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 +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/{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 +2 -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} +12 -2
- package/{build/expression-utils/surveyEngineExpressions.js → surveys/survey-engine-expressions.js} +45 -4
- package/{build/expression-utils/surveyEngineExpressions.js.map → surveys/survey-engine-expressions.js.map} +1 -1
- package/surveys/survey-items.d.ts +72 -0
- package/surveys/survey-items.js +384 -0
- package/surveys/survey-items.js.map +1 -0
- package/{build → surveys}/types/group.d.ts +1 -1
- package/{build → surveys}/types/group.js +6 -5
- package/{build → surveys}/types/group.js.map +1 -1
- 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/{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} +20 -11
- package/surveys/types/survey-definition.js.map +1 -0
- package/{build → surveys}/utils/componentGenerators.d.ts +2 -13
- package/surveys/utils/componentGenerators.js +59 -0
- package/{build → surveys}/utils/componentGenerators.js.map +1 -1
- package/surveys/utils/optionDefGenerators.d.ts +84 -0
- package/surveys/utils/optionDefGenerators.js +211 -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 +4 -3
- package/{build → surveys}/utils/simple-generators.js +34 -5
- package/{build → surveys}/utils/simple-generators.js.map +1 -1
- package/surveys/utils/simple-question-editor.d.ts +14 -0
- package/{build → surveys}/utils/simple-question-editor.js +10 -7
- 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 +3 -2
- package/{build/types → types}/studyRules.js +5 -1
- package/types/studyRules.js.map +1 -0
- package/.babelrc.js +0 -7
- package/.editorconfig +0 -13
- package/LICENSE +0 -202
- package/build/expression-utils/studyEngineExpressions.d.ts +0 -114
- package/build/item-editor-8fd24b61.js.map +0 -1
- package/build/package.json +0 -26
- package/build/types/studyRules.js.map +0 -1
- 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/build/utils/simple-question-editor.d.ts +0 -14
- 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,211 @@
|
|
|
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 timeInput = (props) => {
|
|
120
|
+
const style = [];
|
|
121
|
+
if (props.minTime) {
|
|
122
|
+
style.push({
|
|
123
|
+
key: 'minTime', value: props.minTime,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
if (props.maxTime) {
|
|
127
|
+
style.push({
|
|
128
|
+
key: 'maxTime', value: props.maxTime,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
if (props.defaultValue) {
|
|
132
|
+
style.push({
|
|
133
|
+
key: 'defaultValue', value: props.defaultValue,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
if (props.labelBehindInput) {
|
|
137
|
+
style.push({ key: 'labelPlacement', value: 'after' });
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
key: props.key,
|
|
141
|
+
role: 'timeInput',
|
|
142
|
+
optionProps: {
|
|
143
|
+
stepSize: props.step,
|
|
144
|
+
},
|
|
145
|
+
content: props.inputLabelText,
|
|
146
|
+
displayCondition: props.displayCondition,
|
|
147
|
+
style: style.length > 0 ? style : undefined,
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
const dropDown = (props) => {
|
|
151
|
+
return {
|
|
152
|
+
key: props.key,
|
|
153
|
+
role: 'dropDownGroup',
|
|
154
|
+
displayCondition: props.displayCondition,
|
|
155
|
+
description: props.placeholder,
|
|
156
|
+
items: props.options,
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
const cloze = (props) => {
|
|
160
|
+
const styles = [];
|
|
161
|
+
if (props.className !== undefined) {
|
|
162
|
+
styles.push({
|
|
163
|
+
key: 'className', value: props.className
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
key: props.key,
|
|
168
|
+
role: 'cloze',
|
|
169
|
+
items: props.items,
|
|
170
|
+
displayCondition: props.displayCondition,
|
|
171
|
+
style: styles.length > 0 ? styles : undefined,
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
const clozeLineBreak = () => {
|
|
175
|
+
return {
|
|
176
|
+
key: surveys_utils_randomKeyGenerator.generateRandomKey(5),
|
|
177
|
+
role: 'lineBreak',
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
const SingleChoiceOptionTypes = {
|
|
181
|
+
option,
|
|
182
|
+
textInput,
|
|
183
|
+
//dateInput,
|
|
184
|
+
timeInput,
|
|
185
|
+
numberInput,
|
|
186
|
+
cloze,
|
|
187
|
+
};
|
|
188
|
+
const MultipleChoiceOptionTypes = {
|
|
189
|
+
option,
|
|
190
|
+
subtitle: multipleChoiceOptionSubtitle,
|
|
191
|
+
textInput,
|
|
192
|
+
// dateInput
|
|
193
|
+
timeInput,
|
|
194
|
+
numberInput,
|
|
195
|
+
cloze,
|
|
196
|
+
};
|
|
197
|
+
const ClozeItemTypes = {
|
|
198
|
+
text: multipleChoiceOptionSubtitle,
|
|
199
|
+
markdown,
|
|
200
|
+
textInput,
|
|
201
|
+
dateInput,
|
|
202
|
+
timeInput,
|
|
203
|
+
clozeLineBreak,
|
|
204
|
+
numberInput,
|
|
205
|
+
dropDown,
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
exports.ClozeItemTypes = ClozeItemTypes;
|
|
209
|
+
exports.MultipleChoiceOptionTypes = MultipleChoiceOptionTypes;
|
|
210
|
+
exports.SingleChoiceOptionTypes = SingleChoiceOptionTypes;
|
|
211
|
+
//# 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,7 +1,8 @@
|
|
|
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 { DateDisplayComponentProp, StyledTextComponentProp } from "../types/item-properties";
|
|
3
3
|
export declare const generateLocStrings: (translations: Map<string, string>) => LocalizedString[];
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const generateDateDisplayComp: (key: string, item: DateDisplayComponentProp) => ItemComponent;
|
|
5
|
+
export declare const generateTitleComponent: (content: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp>, description?: Map<string, string> | undefined, className?: string | undefined) => ItemComponent;
|
|
5
6
|
export declare const generateHelpGroupComponent: (items: Array<{
|
|
6
7
|
content: Map<string, string>;
|
|
7
8
|
style?: Array<{
|
|
@@ -2,8 +2,9 @@
|
|
|
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_types_itemProperties = require('../types/item-properties.js');
|
|
7
|
+
var surveys_utils_randomKeyGenerator = require('./randomKeyGenerator.js');
|
|
7
8
|
|
|
8
9
|
const generateLocStrings = (translations) => {
|
|
9
10
|
// console.log(translations);
|
|
@@ -17,11 +18,38 @@ const generateLocStrings = (translations) => {
|
|
|
17
18
|
});
|
|
18
19
|
return locString;
|
|
19
20
|
};
|
|
21
|
+
const generateDateDisplayComp = (key, item) => {
|
|
22
|
+
// console.log(translations);
|
|
23
|
+
const styleArray = [
|
|
24
|
+
{ key: 'dateFormat', value: item.dateFormat }
|
|
25
|
+
];
|
|
26
|
+
if (item.className) {
|
|
27
|
+
styleArray.push({ key: 'className', value: item.className });
|
|
28
|
+
}
|
|
29
|
+
const locString = new Array();
|
|
30
|
+
const dateExp = item.date;
|
|
31
|
+
item.languageCodes.forEach((code) => {
|
|
32
|
+
const translatedItem = {
|
|
33
|
+
code: code,
|
|
34
|
+
parts: [{ dtype: 'exp', exp: dateExp }]
|
|
35
|
+
};
|
|
36
|
+
locString.push(translatedItem);
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
key: key,
|
|
40
|
+
role: 'dateDisplay',
|
|
41
|
+
content: locString,
|
|
42
|
+
style: styleArray,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
20
45
|
const generateTitleComponent = (content, description, className) => {
|
|
21
46
|
let items = undefined;
|
|
22
47
|
let currentContent = undefined;
|
|
23
48
|
if (Array.isArray(content)) {
|
|
24
49
|
items = content.map((item, index) => {
|
|
50
|
+
if (surveys_types_itemProperties.isDateDisplayComponentProp(item)) {
|
|
51
|
+
return generateDateDisplayComp(index.toFixed(), item);
|
|
52
|
+
}
|
|
25
53
|
return {
|
|
26
54
|
key: index.toFixed(),
|
|
27
55
|
role: 'text',
|
|
@@ -44,7 +72,7 @@ const generateTitleComponent = (content, description, className) => {
|
|
|
44
72
|
};
|
|
45
73
|
const generateHelpGroupComponent = (items) => {
|
|
46
74
|
// init group
|
|
47
|
-
const groupEdit = new
|
|
75
|
+
const groupEdit = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
48
76
|
isGroup: true,
|
|
49
77
|
role: 'helpGroup',
|
|
50
78
|
});
|
|
@@ -52,7 +80,7 @@ const generateHelpGroupComponent = (items) => {
|
|
|
52
80
|
name: 'sequential'
|
|
53
81
|
});
|
|
54
82
|
items.forEach(item => {
|
|
55
|
-
const itemEditor = new
|
|
83
|
+
const itemEditor = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
56
84
|
role: 'text',
|
|
57
85
|
});
|
|
58
86
|
itemEditor.setContent(generateLocStrings(item.content));
|
|
@@ -88,13 +116,14 @@ const expWithArgs = (name, ...args) => {
|
|
|
88
116
|
};
|
|
89
117
|
const generatePageBreak = (parentKey, key) => {
|
|
90
118
|
return {
|
|
91
|
-
key: parentKey + '.' + (key ? key : "PB_" +
|
|
119
|
+
key: parentKey + '.' + (key ? key : "PB_" + surveys_utils_randomKeyGenerator.generateRandomKey(4)),
|
|
92
120
|
version: 0,
|
|
93
121
|
type: 'pageBreak'
|
|
94
122
|
};
|
|
95
123
|
};
|
|
96
124
|
|
|
97
125
|
exports.expWithArgs = expWithArgs;
|
|
126
|
+
exports.generateDateDisplayComp = generateDateDisplayComp;
|
|
98
127
|
exports.generateHelpGroupComponent = generateHelpGroupComponent;
|
|
99
128
|
exports.generateLocStrings = generateLocStrings;
|
|
100
129
|
exports.generatePageBreak = generatePageBreak;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-generators.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"simple-generators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ConfidentialMode, Expression, ItemComponent } from "survey-engine/data_types";
|
|
2
|
+
import { ItemEditor } from "../survey-editor/item-editor";
|
|
3
|
+
import { DateDisplayComponentProp, StyledTextComponentProp } from "../types/item-properties";
|
|
4
|
+
export declare class SimpleQuestionEditor {
|
|
5
|
+
editor: ItemEditor;
|
|
6
|
+
key: string;
|
|
7
|
+
constructor(parentKey: string, key: string, version: number, confidentialMode?: ConfidentialMode);
|
|
8
|
+
getItem(): import("survey-engine/data_types").SurveyItem;
|
|
9
|
+
setTitle(title: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp>, description?: Map<string, string>, className?: string): void;
|
|
10
|
+
setCondition(exp: Expression): void;
|
|
11
|
+
addDisplayComponent(comp: ItemComponent, atPosition?: number): void;
|
|
12
|
+
addHasResponseValidation(): void;
|
|
13
|
+
setResponseGroupWithContent(content: ItemComponent): void;
|
|
14
|
+
}
|
|
@@ -2,24 +2,27 @@
|
|
|
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-59f51ecc.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');
|
|
11
|
+
require('../types/item-properties.js');
|
|
10
12
|
|
|
11
13
|
class SimpleQuestionEditor {
|
|
12
|
-
constructor(parentKey, key, version) {
|
|
14
|
+
constructor(parentKey, key, version, confidentialMode) {
|
|
13
15
|
const itemKey = [parentKey, key].join('.');
|
|
14
16
|
this.key = itemKey;
|
|
15
|
-
this.editor = new
|
|
17
|
+
this.editor = new surveys_surveyEditor_itemEditor.ItemEditor(undefined, { itemKey: itemKey, isGroup: false });
|
|
16
18
|
this.editor.setVersion(version);
|
|
19
|
+
this.editor.setConfidentialMode(confidentialMode);
|
|
17
20
|
}
|
|
18
21
|
getItem() {
|
|
19
22
|
return this.editor.getItem();
|
|
20
23
|
}
|
|
21
24
|
setTitle(title, description, className) {
|
|
22
|
-
this.editor.setTitleComponent(
|
|
25
|
+
this.editor.setTitleComponent(surveys_utils_simpleGenerators.generateTitleComponent(title, description, className));
|
|
23
26
|
}
|
|
24
27
|
setCondition(exp) {
|
|
25
28
|
this.editor.setCondition(exp);
|
|
@@ -31,7 +34,7 @@ class SimpleQuestionEditor {
|
|
|
31
34
|
this.editor.addValidation({
|
|
32
35
|
key: 'r1',
|
|
33
36
|
type: 'hard',
|
|
34
|
-
rule:
|
|
37
|
+
rule: surveys_utils_simpleGenerators.expWithArgs('hasResponse', this.key, constants_keyDefinitions.responseGroupKey)
|
|
35
38
|
});
|
|
36
39
|
}
|
|
37
40
|
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
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Expression } from 'survey-engine/
|
|
1
|
+
import { Expression } from 'survey-engine/data_types';
|
|
2
2
|
export declare class StudyRules {
|
|
3
3
|
private enterRules?;
|
|
4
4
|
private submitRules?;
|
|
5
5
|
private timerRules?;
|
|
6
|
-
|
|
6
|
+
private mergeRules?;
|
|
7
|
+
constructor(enterRules?: Expression[], submitRules?: Expression[], timerRules?: Expression[], mergeRules?: Expression[]);
|
|
7
8
|
get(): Expression[];
|
|
8
9
|
}
|
|
@@ -8,10 +8,11 @@ require('./duration.js');
|
|
|
8
8
|
require('../expression-utils/expressionGen.js');
|
|
9
9
|
|
|
10
10
|
class StudyRules {
|
|
11
|
-
constructor(enterRules, submitRules, timerRules) {
|
|
11
|
+
constructor(enterRules, submitRules, timerRules, mergeRules) {
|
|
12
12
|
this.enterRules = enterRules;
|
|
13
13
|
this.submitRules = submitRules;
|
|
14
14
|
this.timerRules = timerRules;
|
|
15
|
+
this.mergeRules = mergeRules;
|
|
15
16
|
}
|
|
16
17
|
get() {
|
|
17
18
|
const rules = [];
|
|
@@ -24,6 +25,9 @@ class StudyRules {
|
|
|
24
25
|
if (this.timerRules) {
|
|
25
26
|
rules.push(expressionUtils_studyEngineExpressions.StudyEngine.ifThen(expressionUtils_studyEngineExpressions.StudyEngine.checkEventType('TIMER'), ...this.timerRules));
|
|
26
27
|
}
|
|
28
|
+
if (this.mergeRules) {
|
|
29
|
+
rules.push(expressionUtils_studyEngineExpressions.StudyEngine.ifThen(expressionUtils_studyEngineExpressions.StudyEngine.checkEventType('MERGE'), ...this.mergeRules));
|
|
30
|
+
}
|
|
27
31
|
return rules;
|
|
28
32
|
}
|
|
29
33
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"studyRules.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
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
|