case-editor-tools 1.2.1 → 1.3.0-beta.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/exporter/index.js +1 -4
- package/exporter/index.js.map +1 -1
- package/{item-editor-59f51ecc.js → item-editor-b2c1632b.js} +4 -11
- package/{item-editor-59f51ecc.js.map → item-editor-b2c1632b.js.map} +1 -1
- package/package.json +2 -2
- package/surveys/index.js +1 -1
- package/surveys/survey-editor/item-editor.d.ts +6 -4
- package/surveys/survey-editor/item-editor.js +1 -1
- package/surveys/survey-editor/survey-editor.d.ts +6 -0
- package/surveys/survey-editor/survey-editor.js +15 -15
- package/surveys/survey-items.d.ts +3 -0
- package/surveys/survey-items.js +16 -15
- package/surveys/survey-items.js.map +1 -1
- package/surveys/types/group.js +1 -1
- package/surveys/types/index.js +1 -1
- package/surveys/types/item-properties.d.ts +3 -0
- package/surveys/types/item.js +0 -1
- package/surveys/types/item.js.map +1 -1
- package/surveys/types/survey-definition.js +2 -2
- package/surveys/utils/simple-generators.js +0 -1
- package/surveys/utils/simple-generators.js.map +1 -1
- package/surveys/utils/simple-question-editor.d.ts +3 -1
- package/surveys/utils/simple-question-editor.js +3 -3
package/exporter/index.js
CHANGED
|
@@ -40,10 +40,7 @@ const generateSurveyFiles = (study, outputPath, pretty) => {
|
|
|
40
40
|
}
|
|
41
41
|
study.surveys.forEach(survey => {
|
|
42
42
|
const fileName = `${surveyOutPath}/${survey.key}.json`;
|
|
43
|
-
const outputObject =
|
|
44
|
-
studyKey: study.studyKey,
|
|
45
|
-
survey: survey.getSurvey()
|
|
46
|
-
};
|
|
43
|
+
const outputObject = survey.getSurvey();
|
|
47
44
|
try {
|
|
48
45
|
fs__default["default"].writeFileSync(fileName, JSON.stringify(outputObject, undefined, pretty ? 2 : undefined));
|
|
49
46
|
}
|
package/exporter/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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -86,7 +86,7 @@ const initialRootComp = () => {
|
|
|
86
86
|
};
|
|
87
87
|
class ItemEditor {
|
|
88
88
|
constructor(existingItem, newItem) {
|
|
89
|
-
this.surveyItem = { key: ''
|
|
89
|
+
this.surveyItem = { key: '' };
|
|
90
90
|
if (existingItem) {
|
|
91
91
|
this.surveyItem = Object.assign({}, existingItem);
|
|
92
92
|
// console.log(this.surveyItem);
|
|
@@ -96,7 +96,6 @@ class ItemEditor {
|
|
|
96
96
|
if (newItem === null || newItem === void 0 ? void 0 : newItem.isGroup) {
|
|
97
97
|
const currentItem = {
|
|
98
98
|
key,
|
|
99
|
-
version: 1,
|
|
100
99
|
items: [],
|
|
101
100
|
};
|
|
102
101
|
this.surveyItem = currentItem;
|
|
@@ -104,7 +103,6 @@ class ItemEditor {
|
|
|
104
103
|
else {
|
|
105
104
|
const currentItem = {
|
|
106
105
|
key,
|
|
107
|
-
version: 1,
|
|
108
106
|
};
|
|
109
107
|
if (newItem === null || newItem === void 0 ? void 0 : newItem.type) {
|
|
110
108
|
currentItem.type = newItem.type;
|
|
@@ -163,14 +161,9 @@ class ItemEditor {
|
|
|
163
161
|
this.surveyItem.priority = prio;
|
|
164
162
|
}
|
|
165
163
|
;
|
|
166
|
-
|
|
167
|
-
this.surveyItem.
|
|
164
|
+
setMetadata(data) {
|
|
165
|
+
this.surveyItem.metadata = data;
|
|
168
166
|
}
|
|
169
|
-
;
|
|
170
|
-
setVersionTags(tags) {
|
|
171
|
-
this.surveyItem.versionTags = [...tags];
|
|
172
|
-
}
|
|
173
|
-
;
|
|
174
167
|
// methods for survey group items:
|
|
175
168
|
addSurveyItem(item, atPosition) {
|
|
176
169
|
if (atPosition !== undefined) {
|
|
@@ -539,4 +532,4 @@ class ItemEditor {
|
|
|
539
532
|
|
|
540
533
|
exports.ItemEditor = ItemEditor;
|
|
541
534
|
exports.isSurveyGroupItem = isSurveyGroupItem;
|
|
542
|
-
//# sourceMappingURL=item-editor-
|
|
535
|
+
//# sourceMappingURL=item-editor-b2c1632b.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item-editor-
|
|
1
|
+
{"version":3,"file":"item-editor-b2c1632b.js","sources":["../node_modules/survey-engine/data_types/expression.js","../node_modules/survey-engine/data_types/survey-item.js","../node_modules/survey-engine/data_types/survey-item-component.js","../node_modules/survey-engine/data_types/response.js","../node_modules/survey-engine/data_types/index.js"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nconst isExpression = (value) => {\r\n return typeof (value) === 'object' && value.name !== undefined && value.name.length > 0;\r\n};\r\nconst expressionArgParser = (arg) => {\r\n switch (arg.dtype) {\r\n case 'num':\r\n return arg.num;\r\n case 'str':\r\n return arg.str;\r\n case 'exp':\r\n return arg.exp;\r\n default:\r\n return arg.str;\r\n }\r\n};\n\nexports.expressionArgParser = expressionArgParser;\nexports.isExpression = isExpression;\n//# sourceMappingURL=expression.js.map\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nconst isSurveyGroupItem = (item) => {\r\n const items = item.items;\r\n return items !== undefined && items.length > 0;\r\n};\n\nexports.isSurveyGroupItem = isSurveyGroupItem;\n//# sourceMappingURL=survey-item.js.map\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nconst isItemGroupComponent = (item) => {\r\n const items = item.items;\r\n return items !== undefined && items.length > 0;\r\n};\n\nexports.isItemGroupComponent = isItemGroupComponent;\n//# sourceMappingURL=survey-item-component.js.map\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nconst isSurveyGroupItemResponse = (item) => {\r\n const items = item.items;\r\n return items !== undefined && items.length > 0;\r\n};\n\nexports.isSurveyGroupItemResponse = isSurveyGroupItemResponse;\n//# sourceMappingURL=response.js.map\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar data_types_expression = require('./expression.js');\nvar data_types_surveyItem = require('./survey-item.js');\nvar data_types_surveyItemComponent = require('./survey-item-component.js');\nvar data_types_response = require('./response.js');\n\n\n\nexports.expressionArgParser = data_types_expression.expressionArgParser;\nexports.isExpression = data_types_expression.isExpression;\nexports.isSurveyGroupItem = data_types_surveyItem.isSurveyGroupItem;\nexports.isItemGroupComponent = data_types_surveyItemComponent.isItemGroupComponent;\nexports.isSurveyGroupItemResponse = data_types_response.isSurveyGroupItemResponse;\n//# sourceMappingURL=index.js.map\n"],"names":["isSurveyGroupItem","isItemGroupComponent","require$$0","require$$1","require$$2","require$$3"],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "case-editor-tools",
|
|
3
3
|
"description": "Javascript tools to simplify survey and study coding for CASE.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0-beta.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": "github:case-framework/case-editor-tools",
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"build": "rollup -c"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"survey-engine": "^1.
|
|
23
|
+
"survey-engine": "^1.2.0-beta.0"
|
|
24
24
|
}
|
|
25
25
|
}
|
package/surveys/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var surveys_surveyItems = require('./survey-items.js');
|
|
|
6
6
|
var surveys_utils_optionDefGenerators = require('./utils/optionDefGenerators.js');
|
|
7
7
|
var surveys_surveyEngineExpressions = require('./survey-engine-expressions.js');
|
|
8
8
|
require('./survey-editor/component-editor.js');
|
|
9
|
-
require('../item-editor-
|
|
9
|
+
require('../item-editor-b2c1632b.js');
|
|
10
10
|
require('./utils/randomKeyGenerator.js');
|
|
11
11
|
require('../logger/logger.js');
|
|
12
12
|
require('./utils/componentGenerators.js');
|
|
@@ -9,8 +9,9 @@ interface ItemEditorInt {
|
|
|
9
9
|
clearFollows: () => void;
|
|
10
10
|
setCondition: (exp: Expression | undefined) => void;
|
|
11
11
|
setPriority: (prio: number | undefined) => void;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
setMetadata: (data?: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
}) => void;
|
|
14
15
|
addSurveyItem: (item: SurveyItem, atPosition?: number) => void;
|
|
15
16
|
updateSurveyItem: (item: SurveyItem) => void;
|
|
16
17
|
removeItem: (key: string) => void;
|
|
@@ -42,8 +43,9 @@ export declare class ItemEditor implements ItemEditorInt {
|
|
|
42
43
|
clearFollows(): void;
|
|
43
44
|
setCondition(exp: Expression | undefined): void;
|
|
44
45
|
setPriority(prio: number | undefined): void;
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
setMetadata(data?: {
|
|
47
|
+
[key: string]: string;
|
|
48
|
+
}): void;
|
|
47
49
|
addSurveyItem(item: SurveyItem, atPosition?: number): void;
|
|
48
50
|
updateSurveyItem(item: SurveyItem): void;
|
|
49
51
|
removeItem(key: string): void;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var surveys_surveyEditor_itemEditor = require('../../item-editor-
|
|
5
|
+
var surveys_surveyEditor_itemEditor = require('../../item-editor-b2c1632b.js');
|
|
6
6
|
require('./component-editor.js');
|
|
7
7
|
require('../utils/randomKeyGenerator.js');
|
|
8
8
|
require('../../logger/logger.js');
|
|
@@ -9,6 +9,9 @@ interface SurveyEditorInt {
|
|
|
9
9
|
setPrefillRules: (rules: Expression[]) => void;
|
|
10
10
|
setAvailableFor: (value?: SurveyAvailableFor) => void;
|
|
11
11
|
setRequireLoginBeforeSubmission: (value?: boolean) => void;
|
|
12
|
+
setMetadata: (data?: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
}) => void;
|
|
12
15
|
changeItemKey: (oldKey: string, newKey: string) => void;
|
|
13
16
|
addNewSurveyItem: (itemProps: NewItemProps, parentKey?: string, atPosition?: number) => SurveyItem | undefined;
|
|
14
17
|
updateSurveyItem: (item: SurveyItem) => void;
|
|
@@ -25,6 +28,9 @@ export declare class SurveyEditor implements SurveyEditorInt {
|
|
|
25
28
|
setSurveyName(name: Array<LocalizedString>): void;
|
|
26
29
|
setSurveyDescription(description: Array<LocalizedString>): void;
|
|
27
30
|
setSurveyDuration(duration: Array<LocalizedString>): void;
|
|
31
|
+
setMetadata(data?: {
|
|
32
|
+
[key: string]: string;
|
|
33
|
+
} | undefined): void;
|
|
28
34
|
setMaxItemPerPage(itemLimits: {
|
|
29
35
|
small: number;
|
|
30
36
|
large: number;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var surveys_surveyEditor_itemEditor = require('../../item-editor-
|
|
5
|
+
var surveys_surveyEditor_itemEditor = require('../../item-editor-b2c1632b.js');
|
|
6
6
|
var logger_logger = require('../../logger/logger.js');
|
|
7
7
|
require('./component-editor.js');
|
|
8
8
|
require('../utils/randomKeyGenerator.js');
|
|
@@ -11,19 +11,16 @@ class SurveyEditor {
|
|
|
11
11
|
constructor(survey) {
|
|
12
12
|
if (survey) {
|
|
13
13
|
this.survey = Object.assign({}, survey);
|
|
14
|
-
this.surveyKey = this.survey.
|
|
14
|
+
this.surveyKey = this.survey.surveyDefinition.key;
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
17
|
this.surveyKey = 'survey';
|
|
18
18
|
this.survey = {
|
|
19
19
|
props: {},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
version: 1,
|
|
25
|
-
items: []
|
|
26
|
-
}
|
|
20
|
+
versionId: '',
|
|
21
|
+
surveyDefinition: {
|
|
22
|
+
key: this.surveyKey,
|
|
23
|
+
items: []
|
|
27
24
|
}
|
|
28
25
|
};
|
|
29
26
|
}
|
|
@@ -49,6 +46,9 @@ class SurveyEditor {
|
|
|
49
46
|
this.survey.props.typicalDuration = duration;
|
|
50
47
|
}
|
|
51
48
|
;
|
|
49
|
+
setMetadata(data) {
|
|
50
|
+
this.survey.metadata = data;
|
|
51
|
+
}
|
|
52
52
|
setMaxItemPerPage(itemLimits) {
|
|
53
53
|
this.survey.maxItemsPerPage = itemLimits;
|
|
54
54
|
}
|
|
@@ -69,16 +69,16 @@ class SurveyEditor {
|
|
|
69
69
|
addNewSurveyItem(newItem, parentKey, atPosition) {
|
|
70
70
|
if (!parentKey) {
|
|
71
71
|
newItem.itemKey = this.surveyKey + '.' + newItem.itemKey;
|
|
72
|
-
if (this.survey.
|
|
72
|
+
if (this.survey.surveyDefinition.items.find(it => newItem.itemKey === it.key)) {
|
|
73
73
|
logger_logger.Logger.criticalError('Duplicate key in survey: ' + newItem.itemKey);
|
|
74
74
|
return undefined;
|
|
75
75
|
}
|
|
76
76
|
const item = (new surveys_surveyEditor_itemEditor.ItemEditor(undefined, newItem)).getItem();
|
|
77
77
|
if (atPosition !== undefined) {
|
|
78
|
-
this.survey.
|
|
78
|
+
this.survey.surveyDefinition.items.splice(atPosition, 0, item);
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
|
-
this.survey.
|
|
81
|
+
this.survey.surveyDefinition.items.push(item);
|
|
82
82
|
}
|
|
83
83
|
return item;
|
|
84
84
|
}
|
|
@@ -122,7 +122,7 @@ class SurveyEditor {
|
|
|
122
122
|
changeItemKey(oldKey, newKey, ignoreReferences) {
|
|
123
123
|
if (oldKey === this.surveyKey) {
|
|
124
124
|
this.surveyKey = newKey;
|
|
125
|
-
this.survey.
|
|
125
|
+
this.survey.surveyDefinition = this.changeItemKeyForSubtree(this.survey.surveyDefinition, newKey);
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
let obj = this.findSurveyItem(oldKey);
|
|
@@ -140,7 +140,7 @@ class SurveyEditor {
|
|
|
140
140
|
;
|
|
141
141
|
updateSurveyItem(item) {
|
|
142
142
|
if (item.key === this.surveyKey) {
|
|
143
|
-
this.survey.
|
|
143
|
+
this.survey.surveyDefinition = Object.assign(Object.assign({}, this.survey.surveyDefinition), item);
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
146
|
const ids = item.key.split('.');
|
|
@@ -179,7 +179,7 @@ class SurveyEditor {
|
|
|
179
179
|
let obj = undefined;
|
|
180
180
|
for (const currentKey of paths) {
|
|
181
181
|
if (!obj) {
|
|
182
|
-
obj = this.survey.
|
|
182
|
+
obj = this.survey.surveyDefinition;
|
|
183
183
|
continue;
|
|
184
184
|
}
|
|
185
185
|
if (!surveys_surveyEditor_itemEditor.isSurveyGroupItem(obj)) {
|
package/surveys/survey-items.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var surveys_surveyEditor_componentEditor = require('./survey-editor/component-editor.js');
|
|
6
|
-
var surveys_surveyEditor_itemEditor = require('../item-editor-
|
|
6
|
+
var surveys_surveyEditor_itemEditor = require('../item-editor-b2c1632b.js');
|
|
7
7
|
var surveys_utils_componentGenerators = require('./utils/componentGenerators.js');
|
|
8
8
|
var types_duration = require('../types/duration.js');
|
|
9
9
|
var constants_keyDefinitions = require('../constants/key-definitions.js');
|
|
@@ -18,7 +18,7 @@ require('../logger/logger.js');
|
|
|
18
18
|
require('../expression-utils/expressionGen.js');
|
|
19
19
|
|
|
20
20
|
const commonQuestionGenerator = (props, rg_inner) => {
|
|
21
|
-
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, props.
|
|
21
|
+
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, props.confidentialMode, props.metadata);
|
|
22
22
|
// QUESTION TEXT
|
|
23
23
|
simpleEditor.setTitle(props.questionText, props.questionSubText, props.titleClassName);
|
|
24
24
|
if (props.condition) {
|
|
@@ -149,20 +149,21 @@ const generateResponsiveMatrix = (props) => {
|
|
|
149
149
|
if (!props.customValidations) {
|
|
150
150
|
props.customValidations = [];
|
|
151
151
|
}
|
|
152
|
+
const rowValidations = [];
|
|
153
|
+
props.rows.forEach(row => {
|
|
154
|
+
props.columns.forEach(col => {
|
|
155
|
+
const hasRespExp = surveys_surveyEngineExpressions.SurveyEngine.hasResponse([props.parentKey, props.itemKey].join('.'), [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.responsiveMatrix, `${row.key}-${col.key}`].join('.'));
|
|
156
|
+
if (row.displayCondition === undefined) {
|
|
157
|
+
rowValidations.push(hasRespExp);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
rowValidations.push(surveys_surveyEngineExpressions.SurveyEngine.logic.or(surveys_surveyEngineExpressions.SurveyEngine.logic.not(row.displayCondition), hasRespExp));
|
|
161
|
+
});
|
|
162
|
+
});
|
|
152
163
|
(_a = props.customValidations) === null || _a === void 0 ? void 0 : _a.push({
|
|
153
164
|
key: 'r',
|
|
154
165
|
type: 'hard',
|
|
155
|
-
rule: surveys_utils_simpleGenerators.expWithArgs('and', ...
|
|
156
|
-
return [
|
|
157
|
-
...props.columns.map(col => {
|
|
158
|
-
const hasRespExp = surveys_surveyEngineExpressions.SurveyEngine.hasResponse([props.parentKey, props.itemKey].join('.'), [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.responsiveMatrix, `${row.key}-${col.key}`].join('.'));
|
|
159
|
-
if (row.displayCondition === undefined) {
|
|
160
|
-
return hasRespExp;
|
|
161
|
-
}
|
|
162
|
-
return surveys_surveyEngineExpressions.SurveyEngine.logic.or(surveys_surveyEngineExpressions.SurveyEngine.logic.not(row.displayCondition), hasRespExp);
|
|
163
|
-
})
|
|
164
|
-
];
|
|
165
|
-
}))
|
|
166
|
+
rule: surveys_utils_simpleGenerators.expWithArgs('and', ...rowValidations)
|
|
166
167
|
});
|
|
167
168
|
}
|
|
168
169
|
return commonQuestionGenerator(props, rg_inner);
|
|
@@ -316,7 +317,7 @@ const generateCustomQuestion = (props) => {
|
|
|
316
317
|
const rg_inner = Object.assign(Object.assign({}, item), { role: role });
|
|
317
318
|
items.push(rg_inner);
|
|
318
319
|
});
|
|
319
|
-
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, props.
|
|
320
|
+
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, props.confidentialMode, props.metadata);
|
|
320
321
|
// QUESTION TEXT
|
|
321
322
|
simpleEditor.setTitle(props.questionText, props.questionSubText, props.titleClassName);
|
|
322
323
|
if (props.condition) {
|
|
@@ -348,7 +349,7 @@ const generateCustomQuestion = (props) => {
|
|
|
348
349
|
return simpleEditor.getItem();
|
|
349
350
|
};
|
|
350
351
|
const generateDisplay = (props) => {
|
|
351
|
-
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey,
|
|
352
|
+
const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, undefined, props.metadata);
|
|
352
353
|
props.content.forEach(item => simpleEditor.addDisplayComponent(item));
|
|
353
354
|
if (props.condition) {
|
|
354
355
|
simpleEditor.setCondition(props.condition);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"survey-items.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"survey-items.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/surveys/types/group.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var logger_logger = require('../../logger/logger.js');
|
|
6
|
-
var surveys_surveyEditor_itemEditor = require('../../item-editor-
|
|
6
|
+
var surveys_surveyEditor_itemEditor = require('../../item-editor-b2c1632b.js');
|
|
7
7
|
var surveys_utils_simpleGenerators = require('../utils/simple-generators.js');
|
|
8
8
|
require('../survey-editor/component-editor.js');
|
|
9
9
|
require('../utils/randomKeyGenerator.js');
|
package/surveys/types/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var surveys_types_item = require('./item.js');
|
|
|
7
7
|
var surveys_types_itemProperties = require('./item-properties.js');
|
|
8
8
|
var surveys_types_surveyDefinition = require('./survey-definition.js');
|
|
9
9
|
require('../../logger/logger.js');
|
|
10
|
-
require('../../item-editor-
|
|
10
|
+
require('../../item-editor-b2c1632b.js');
|
|
11
11
|
require('../survey-editor/component-editor.js');
|
|
12
12
|
require('../utils/randomKeyGenerator.js');
|
|
13
13
|
require('../utils/simple-generators.js');
|
package/surveys/types/item.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"item.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var logger_logger = require('../../logger/logger.js');
|
|
6
|
-
var surveys_surveyEditor_itemEditor = require('../../item-editor-
|
|
6
|
+
var surveys_surveyEditor_itemEditor = require('../../item-editor-b2c1632b.js');
|
|
7
7
|
var surveys_surveyEditor_surveyEditor = require('../survey-editor/survey-editor.js');
|
|
8
8
|
var surveys_utils_simpleGenerators = require('../utils/simple-generators.js');
|
|
9
9
|
require('../survey-editor/component-editor.js');
|
|
@@ -48,7 +48,7 @@ class SurveyDefinition {
|
|
|
48
48
|
this.editor.addExistingSurveyItem(item, parentKey);
|
|
49
49
|
}
|
|
50
50
|
checkDuplicateChildKeys() {
|
|
51
|
-
const group = this.editor.getSurvey().
|
|
51
|
+
const group = this.editor.getSurvey().surveyDefinition;
|
|
52
52
|
const keys = group.items.map(item => item.key);
|
|
53
53
|
const hasDuplicates = keys.some((key, index) => {
|
|
54
54
|
const isDuplicateKey = keys.indexOf(key) !== index;
|
|
@@ -117,7 +117,6 @@ const expWithArgs = (name, ...args) => {
|
|
|
117
117
|
const generatePageBreak = (parentKey, key) => {
|
|
118
118
|
return {
|
|
119
119
|
key: parentKey + '.' + (key ? key : "PB_" + surveys_utils_randomKeyGenerator.generateRandomKey(4)),
|
|
120
|
-
version: 0,
|
|
121
120
|
type: 'pageBreak'
|
|
122
121
|
};
|
|
123
122
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-generators.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"simple-generators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -4,7 +4,9 @@ import { DateDisplayComponentProp, StyledTextComponentProp } from "../types/item
|
|
|
4
4
|
export declare class SimpleQuestionEditor {
|
|
5
5
|
editor: ItemEditor;
|
|
6
6
|
key: string;
|
|
7
|
-
constructor(parentKey: string, key: string,
|
|
7
|
+
constructor(parentKey: string, key: string, confidentialMode?: ConfidentialMode, metadata?: {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
});
|
|
8
10
|
getItem(): import("survey-engine/data_types").SurveyItem;
|
|
9
11
|
setTitle(title: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp>, description?: Map<string, string>, className?: string): void;
|
|
10
12
|
setCondition(exp: Expression): void;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var constants_keyDefinitions = require('../../constants/key-definitions.js');
|
|
6
|
-
var surveys_surveyEditor_itemEditor = require('../../item-editor-
|
|
6
|
+
var surveys_surveyEditor_itemEditor = require('../../item-editor-b2c1632b.js');
|
|
7
7
|
var surveys_utils_simpleGenerators = require('./simple-generators.js');
|
|
8
8
|
require('../survey-editor/component-editor.js');
|
|
9
9
|
require('./randomKeyGenerator.js');
|
|
@@ -11,11 +11,11 @@ require('../../logger/logger.js');
|
|
|
11
11
|
require('../types/item-properties.js');
|
|
12
12
|
|
|
13
13
|
class SimpleQuestionEditor {
|
|
14
|
-
constructor(parentKey, key,
|
|
14
|
+
constructor(parentKey, key, confidentialMode, metadata) {
|
|
15
15
|
const itemKey = [parentKey, key].join('.');
|
|
16
16
|
this.key = itemKey;
|
|
17
17
|
this.editor = new surveys_surveyEditor_itemEditor.ItemEditor(undefined, { itemKey: itemKey, isGroup: false });
|
|
18
|
-
this.editor.
|
|
18
|
+
this.editor.setMetadata(metadata);
|
|
19
19
|
this.editor.setConfidentialMode(confidentialMode);
|
|
20
20
|
}
|
|
21
21
|
getItem() {
|