case-editor-tools 1.4.0 → 1.5.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/expression-utils/expressionGen.js +8 -1
- package/expression-utils/expressionGen.js.map +1 -1
- package/expression-utils/studyEngineExpressions.d.ts +4 -0
- package/expression-utils/studyEngineExpressions.js +14 -0
- package/expression-utils/studyEngineExpressions.js.map +1 -1
- package/index-8e5154bb.js +79 -0
- package/index-8e5154bb.js.map +1 -0
- package/package.json +1 -1
- package/surveys/index.js +2 -1
- package/surveys/index.js.map +1 -1
- package/surveys/survey-editor/item-editor.js +457 -6
- package/surveys/survey-editor/item-editor.js.map +1 -1
- package/surveys/survey-editor/survey-editor.js +7 -6
- package/surveys/survey-editor/survey-editor.js.map +1 -1
- package/surveys/survey-engine-expressions.js +2 -0
- package/surveys/survey-engine-expressions.js.map +1 -1
- package/surveys/survey-items.js +2 -1
- package/surveys/survey-items.js.map +1 -1
- package/surveys/types/group.js +2 -1
- package/surveys/types/group.js.map +1 -1
- package/surveys/types/index.js +2 -1
- package/surveys/types/index.js.map +1 -1
- package/surveys/types/survey-definition.js +2 -1
- package/surveys/types/survey-definition.js.map +1 -1
- package/surveys/utils/optionDefGenerators.js +2 -0
- package/surveys/utils/optionDefGenerators.js.map +1 -1
- package/surveys/utils/simple-question-editor.js +2 -1
- package/surveys/utils/simple-question-editor.js.map +1 -1
- package/types/studyRules.js +2 -0
- package/types/studyRules.js.map +1 -1
- package/item-editor-b2c1632b.js +0 -535
- package/item-editor-b2c1632b.js.map +0 -1
|
@@ -2,12 +2,463 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./component-editor.js');
|
|
7
|
-
require('../utils/randomKeyGenerator.js');
|
|
8
|
-
require('../../logger/logger.js');
|
|
5
|
+
var index = require('../../index-8e5154bb.js');
|
|
6
|
+
var surveys_surveyEditor_componentEditor = require('./component-editor.js');
|
|
7
|
+
var surveys_utils_randomKeyGenerator = require('../utils/randomKeyGenerator.js');
|
|
8
|
+
var logger_logger = require('../../logger/logger.js');
|
|
9
9
|
|
|
10
|
+
const initialRootComp = () => {
|
|
11
|
+
return {
|
|
12
|
+
role: 'root',
|
|
13
|
+
order: { name: 'sequential' },
|
|
14
|
+
items: []
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
class ItemEditor {
|
|
18
|
+
constructor(existingItem, newItem) {
|
|
19
|
+
this.surveyItem = { key: '' };
|
|
20
|
+
if (existingItem) {
|
|
21
|
+
this.surveyItem = Object.assign({}, existingItem);
|
|
22
|
+
// console.log(this.surveyItem);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const key = (newItem === null || newItem === void 0 ? void 0 : newItem.itemKey) ? newItem.itemKey : 'no key';
|
|
26
|
+
if (newItem === null || newItem === void 0 ? void 0 : newItem.isGroup) {
|
|
27
|
+
const currentItem = {
|
|
28
|
+
key,
|
|
29
|
+
items: [],
|
|
30
|
+
};
|
|
31
|
+
this.surveyItem = currentItem;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
const currentItem = {
|
|
35
|
+
key,
|
|
36
|
+
};
|
|
37
|
+
if (newItem === null || newItem === void 0 ? void 0 : newItem.type) {
|
|
38
|
+
currentItem.type = newItem.type;
|
|
39
|
+
}
|
|
40
|
+
this.surveyItem = currentItem;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
getItem() {
|
|
45
|
+
return Object.assign({}, this.surveyItem);
|
|
46
|
+
}
|
|
47
|
+
getItemJSON(pretty) {
|
|
48
|
+
return JSON.stringify(this.surveyItem, undefined, pretty ? ' ' : undefined);
|
|
49
|
+
}
|
|
50
|
+
setKey(newKey) {
|
|
51
|
+
this.surveyItem.key = newKey;
|
|
52
|
+
}
|
|
53
|
+
setConfidentialMode(confidentialMode) {
|
|
54
|
+
this.surveyItem.confidentialMode = confidentialMode;
|
|
55
|
+
}
|
|
56
|
+
addToFollows(key) {
|
|
57
|
+
if (!this.surveyItem.follows) {
|
|
58
|
+
this.surveyItem.follows = [];
|
|
59
|
+
}
|
|
60
|
+
if (this.surveyItem.follows.includes(key)) {
|
|
61
|
+
console.warn('follows array already includes key: ', key);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this.surveyItem.follows.push(key);
|
|
65
|
+
}
|
|
66
|
+
removeFromFollows(key) {
|
|
67
|
+
if (!this.surveyItem.follows) {
|
|
68
|
+
console.warn('follows array already empty');
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (!this.surveyItem.follows.includes(key)) {
|
|
72
|
+
console.warn('follows array does not include key: ', key);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.surveyItem.follows = this.surveyItem.follows.filter(k => k !== key);
|
|
76
|
+
}
|
|
77
|
+
;
|
|
78
|
+
clearFollows() {
|
|
79
|
+
if (!this.surveyItem.follows) {
|
|
80
|
+
console.warn('follows array already empty');
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
this.surveyItem.follows = undefined;
|
|
84
|
+
}
|
|
85
|
+
;
|
|
86
|
+
setCondition(exp) {
|
|
87
|
+
this.surveyItem.condition = exp;
|
|
88
|
+
}
|
|
89
|
+
;
|
|
90
|
+
setPriority(prio) {
|
|
91
|
+
this.surveyItem.priority = prio;
|
|
92
|
+
}
|
|
93
|
+
;
|
|
94
|
+
setMetadata(data) {
|
|
95
|
+
this.surveyItem.metadata = data;
|
|
96
|
+
}
|
|
97
|
+
// methods for survey group items:
|
|
98
|
+
addSurveyItem(item, atPosition) {
|
|
99
|
+
if (atPosition !== undefined) {
|
|
100
|
+
this.surveyItem.items.splice(atPosition, 0, Object.assign({}, item));
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
this.surveyItem.items.push(Object.assign({}, item));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
;
|
|
107
|
+
updateSurveyItem(item) {
|
|
108
|
+
const ind = this.surveyItem.items.findIndex(it => item.key === it.key);
|
|
109
|
+
if (ind < 0) {
|
|
110
|
+
console.warn('item not found in the items array');
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.surveyItem.items[ind] = Object.assign({}, item);
|
|
114
|
+
}
|
|
115
|
+
;
|
|
116
|
+
removeItem(key) {
|
|
117
|
+
if (!this.surveyItem.items.find(it => it.key === key)) {
|
|
118
|
+
console.warn('group items does not contain item with key: ', key);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
this.surveyItem.items = this.surveyItem.items.filter(it => it.key !== key);
|
|
122
|
+
}
|
|
123
|
+
;
|
|
124
|
+
changeItemPosition(key, newPosition) {
|
|
125
|
+
console.warn('unimplemented');
|
|
126
|
+
}
|
|
127
|
+
;
|
|
128
|
+
setSelectionMethod(exp) {
|
|
129
|
+
this.surveyItem.selectionMethod = exp;
|
|
130
|
+
}
|
|
131
|
+
;
|
|
132
|
+
// methods for survey single items:
|
|
133
|
+
setItemType(type) {
|
|
134
|
+
this.surveyItem.type = type;
|
|
135
|
+
}
|
|
136
|
+
;
|
|
137
|
+
setTitleComponent(title) {
|
|
138
|
+
const currentItem = this.surveyItem;
|
|
139
|
+
if (!currentItem.components) {
|
|
140
|
+
currentItem.components = Object.assign({}, initialRootComp());
|
|
141
|
+
}
|
|
142
|
+
title.role = 'title';
|
|
143
|
+
const ind = currentItem.components.items.findIndex(comp => comp.role === 'title');
|
|
144
|
+
if (ind < 0) {
|
|
145
|
+
currentItem.components.items.push(Object.assign({}, title));
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
currentItem.components.items[ind] = Object.assign({}, title);
|
|
149
|
+
}
|
|
150
|
+
setHelpGroupComponent(helpGroup) {
|
|
151
|
+
const currentItem = this.surveyItem;
|
|
152
|
+
if (!currentItem.components) {
|
|
153
|
+
currentItem.components = Object.assign({}, initialRootComp());
|
|
154
|
+
}
|
|
155
|
+
helpGroup.role = 'helpGroup';
|
|
156
|
+
const ind = currentItem.components.items.findIndex(comp => comp.role === 'helpGroup');
|
|
157
|
+
if (ind < 0) {
|
|
158
|
+
currentItem.components.items.push(Object.assign({}, helpGroup));
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
currentItem.components.items[ind] = Object.assign({}, helpGroup);
|
|
162
|
+
}
|
|
163
|
+
;
|
|
164
|
+
// for warning, error, texts:
|
|
165
|
+
addDisplayComponent(comp, atPosition) {
|
|
166
|
+
const currentItem = this.surveyItem;
|
|
167
|
+
if (!currentItem.components) {
|
|
168
|
+
currentItem.components = Object.assign({}, initialRootComp());
|
|
169
|
+
}
|
|
170
|
+
if (atPosition !== undefined) {
|
|
171
|
+
currentItem.components.items.splice(atPosition, 0, Object.assign({}, comp));
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
currentItem.components.items.push(Object.assign({}, comp));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
;
|
|
178
|
+
updateDisplayComponent(at, comp) {
|
|
179
|
+
const currentItem = this.surveyItem;
|
|
180
|
+
if (!currentItem.components || !currentItem.components.items || currentItem.components.items.length <= at + 1 || at < 0) {
|
|
181
|
+
console.warn('component not found at ', at);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
currentItem.components.items[at] = Object.assign({}, comp);
|
|
185
|
+
}
|
|
186
|
+
;
|
|
187
|
+
removeDisplayComponent(at) {
|
|
188
|
+
const currentItem = this.surveyItem;
|
|
189
|
+
if (!currentItem.components || !currentItem.components.items || currentItem.components.items.length <= at + 1 || at < 0) {
|
|
190
|
+
console.warn('component not found at ', at);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
currentItem.components.items.splice(at, 1);
|
|
194
|
+
}
|
|
195
|
+
;
|
|
196
|
+
addNewResponseComponent(props, parentKey, atPosition) {
|
|
197
|
+
const currentItem = this.surveyItem;
|
|
198
|
+
if (!currentItem.components) {
|
|
199
|
+
currentItem.components = Object.assign({}, initialRootComp());
|
|
200
|
+
}
|
|
201
|
+
if (!parentKey) {
|
|
202
|
+
props.role = 'responseGroup';
|
|
203
|
+
if (!props.key) {
|
|
204
|
+
props.key = 'rg';
|
|
205
|
+
}
|
|
206
|
+
props.isGroup = true;
|
|
207
|
+
const newComponent = (new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, props)).getComponent();
|
|
208
|
+
const ind = currentItem.components.items.findIndex(comp => comp.role === 'responseGroup');
|
|
209
|
+
if (ind < 0) {
|
|
210
|
+
currentItem.components.items.push(newComponent);
|
|
211
|
+
return Object.assign({}, newComponent);
|
|
212
|
+
}
|
|
213
|
+
currentItem.components.items[ind] = newComponent;
|
|
214
|
+
return Object.assign({}, newComponent);
|
|
215
|
+
}
|
|
216
|
+
const ids = parentKey.split('.');
|
|
217
|
+
let obj = undefined;
|
|
218
|
+
for (const currentKey of ids) {
|
|
219
|
+
if (!obj) {
|
|
220
|
+
const ind = currentItem.components.items.findIndex(c => c.key === currentKey);
|
|
221
|
+
if (ind < 0) {
|
|
222
|
+
console.warn('response component not found: ', currentKey);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
obj = currentItem.components.items[ind];
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
if (!index.isItemGroupComponent(obj)) {
|
|
229
|
+
obj.items = [];
|
|
230
|
+
// leaf found
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
const index$1 = obj.items.findIndex(it => it.key === currentKey);
|
|
234
|
+
if (index$1 < 0) {
|
|
235
|
+
console.warn('item component cannot be found: ', currentKey);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
obj = obj.items[index$1];
|
|
239
|
+
}
|
|
240
|
+
if (!obj) {
|
|
241
|
+
console.warn('survey item cannot be found: ', parentKey);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (obj.items.find(it => props.key === it.key)) {
|
|
245
|
+
logger_logger.Logger.criticalError('Duplicate key: ' + props.key);
|
|
246
|
+
return undefined;
|
|
247
|
+
}
|
|
248
|
+
const newComponent = (new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, props)).getComponent();
|
|
249
|
+
if (atPosition !== undefined) {
|
|
250
|
+
obj.items.splice(atPosition, 0, newComponent);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
obj.items.push(newComponent);
|
|
254
|
+
}
|
|
255
|
+
return newComponent;
|
|
256
|
+
}
|
|
257
|
+
;
|
|
258
|
+
addExistingResponseComponent(newComp, parentKey, atPosition) {
|
|
259
|
+
const currentItem = this.surveyItem;
|
|
260
|
+
if (!currentItem.components) {
|
|
261
|
+
currentItem.components = Object.assign({}, initialRootComp());
|
|
262
|
+
}
|
|
263
|
+
if (newComp.key === undefined) {
|
|
264
|
+
newComp.key = surveys_utils_randomKeyGenerator.generateRandomKey(4);
|
|
265
|
+
}
|
|
266
|
+
if (!parentKey) {
|
|
267
|
+
const ind = currentItem.components.items.findIndex(comp => comp.role === 'responseGroup');
|
|
268
|
+
if (ind < 0) {
|
|
269
|
+
currentItem.components.items.push(newComp);
|
|
270
|
+
return Object.assign({}, newComp);
|
|
271
|
+
}
|
|
272
|
+
currentItem.components.items[ind] = newComp;
|
|
273
|
+
return Object.assign({}, newComp);
|
|
274
|
+
}
|
|
275
|
+
const ids = parentKey.split('.');
|
|
276
|
+
let obj = undefined;
|
|
277
|
+
for (const currentKey of ids) {
|
|
278
|
+
if (!obj) {
|
|
279
|
+
const ind = currentItem.components.items.findIndex(c => c.key === currentKey);
|
|
280
|
+
if (ind < 0) {
|
|
281
|
+
console.warn('response component not found: ', currentKey);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
obj = currentItem.components.items[ind];
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
if (!index.isItemGroupComponent(obj)) {
|
|
288
|
+
obj.items = [];
|
|
289
|
+
// leaf found
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
const index$1 = obj.items.findIndex(it => it.key === currentKey);
|
|
293
|
+
if (index$1 < 0) {
|
|
294
|
+
console.warn('item component cannot be found: ', currentKey);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
obj = obj.items[index$1];
|
|
298
|
+
}
|
|
299
|
+
if (!obj) {
|
|
300
|
+
console.warn('item component cannot be found: ', parentKey);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
if (obj.items.find(it => newComp.key === it.key)) {
|
|
304
|
+
logger_logger.Logger.criticalError('Duplicate key: ' + newComp.key);
|
|
305
|
+
return undefined;
|
|
306
|
+
}
|
|
307
|
+
if (atPosition !== undefined) {
|
|
308
|
+
obj.items.splice(atPosition, 0, newComp);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
obj.items.push(newComp);
|
|
312
|
+
}
|
|
313
|
+
return newComp;
|
|
314
|
+
}
|
|
315
|
+
;
|
|
316
|
+
updateResponseComponent(path, item) {
|
|
317
|
+
const currentItem = this.surveyItem;
|
|
318
|
+
if (!currentItem.components) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const responseGroup = currentItem.components.items.find(comp => comp.role === 'responseGroup');
|
|
322
|
+
if (!responseGroup) {
|
|
323
|
+
console.warn('no responseGroup found');
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (responseGroup.key === path) {
|
|
327
|
+
const ind = currentItem.components.items.findIndex(it => it.key === path);
|
|
328
|
+
if (ind < 0) {
|
|
329
|
+
console.warn('item component cannot be found: ', path);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
currentItem.components.items[ind] = Object.assign({}, item);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
const ids = path.split('.');
|
|
336
|
+
const parentIds = ids.slice(1, ids.length - 1);
|
|
337
|
+
let obj = responseGroup;
|
|
338
|
+
for (const currentKey of parentIds) {
|
|
339
|
+
if (!index.isItemGroupComponent(obj)) {
|
|
340
|
+
// leaf found
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
const index$1 = obj.items.findIndex(it => it.key === currentKey);
|
|
344
|
+
if (index$1 < 0) {
|
|
345
|
+
console.warn('item component cannot be found: ', currentKey);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
obj = obj.items[index$1];
|
|
349
|
+
}
|
|
350
|
+
if (!obj) {
|
|
351
|
+
console.warn('survey item cannot be found: ', path);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const ind = obj.items.findIndex(it => it.key === ids[ids.length - 1]);
|
|
355
|
+
if (ind < 0) {
|
|
356
|
+
console.warn('item component cannot be found: ', path);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
obj.items[ind] = Object.assign({}, item);
|
|
360
|
+
}
|
|
361
|
+
;
|
|
362
|
+
removeResponseComponent(keyPath) {
|
|
363
|
+
const currentItem = this.surveyItem;
|
|
364
|
+
if (!currentItem.components) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
const responseGroup = currentItem.components.items.find(comp => comp.role === 'responseGroup');
|
|
368
|
+
if (!responseGroup) {
|
|
369
|
+
console.warn('no responseGroup found');
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
if (responseGroup.key === keyPath) {
|
|
373
|
+
currentItem.components.items = currentItem.components.items.filter(it => it.role !== 'responseGroup');
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
const ids = keyPath.split('.');
|
|
377
|
+
const parentIds = ids.slice(1, ids.length - 1);
|
|
378
|
+
let obj = responseGroup;
|
|
379
|
+
for (const currentKey of parentIds) {
|
|
380
|
+
if (!index.isItemGroupComponent(obj)) {
|
|
381
|
+
// leaf found
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
const index$1 = obj.items.findIndex(it => it.key === currentKey);
|
|
385
|
+
if (index$1 < 0) {
|
|
386
|
+
console.warn('item component cannot be found: ', currentKey);
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
obj = obj.items[index$1];
|
|
390
|
+
}
|
|
391
|
+
if (!obj) {
|
|
392
|
+
console.warn('survey item cannot be found: ', keyPath);
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
obj.items = obj.items.filter(comp => comp.key !== ids[ids.length - 1]);
|
|
396
|
+
}
|
|
397
|
+
;
|
|
398
|
+
findResponseComponent(key) {
|
|
399
|
+
const currentItem = this.surveyItem;
|
|
400
|
+
if (!currentItem.components) {
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
const ids = key.split('.');
|
|
404
|
+
let obj = undefined;
|
|
405
|
+
for (const currentKey of ids) {
|
|
406
|
+
if (!obj) {
|
|
407
|
+
const ind = currentItem.components.items.findIndex(c => c.key === currentKey);
|
|
408
|
+
if (ind < 0) {
|
|
409
|
+
console.warn('item component not found: ', currentKey);
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
obj = currentItem.components.items[ind];
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
if (!index.isItemGroupComponent(obj)) {
|
|
416
|
+
obj.items = [];
|
|
417
|
+
// leaf found
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
const index$1 = obj.items.findIndex(it => it.key === currentKey);
|
|
421
|
+
if (index$1 < 0) {
|
|
422
|
+
console.warn('item component cannot be found: ', currentKey);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
obj = obj.items[index$1];
|
|
426
|
+
}
|
|
427
|
+
if (!obj) {
|
|
428
|
+
console.warn('item component cannot be found: ', key);
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
return obj;
|
|
432
|
+
}
|
|
433
|
+
;
|
|
434
|
+
addValidation(v) {
|
|
435
|
+
const currentItem = this.surveyItem;
|
|
436
|
+
if (!currentItem.validations) {
|
|
437
|
+
currentItem.validations = [];
|
|
438
|
+
}
|
|
439
|
+
if (currentItem.validations.find(valid => v.key === valid.key)) {
|
|
440
|
+
console.warn('validation key already used: ', v.key);
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
currentItem.validations.push(Object.assign({}, v));
|
|
444
|
+
this.surveyItem = Object.assign({}, currentItem);
|
|
445
|
+
}
|
|
446
|
+
;
|
|
447
|
+
removeValidation(vKey) {
|
|
448
|
+
const currentItem = this.surveyItem;
|
|
449
|
+
if (!currentItem.validations) {
|
|
450
|
+
console.warn('validation key not found used: ', vKey);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
if (currentItem.validations.find(valid => vKey === valid.key)) {
|
|
454
|
+
console.warn('validation key not found used: ', vKey);
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
currentItem.validations = currentItem.validations.filter(v => v.key !== vKey);
|
|
458
|
+
this.surveyItem = Object.assign({}, currentItem);
|
|
459
|
+
}
|
|
460
|
+
;
|
|
461
|
+
}
|
|
10
462
|
|
|
11
|
-
|
|
12
|
-
exports.ItemEditor = surveys_surveyEditor_itemEditor.ItemEditor;
|
|
463
|
+
exports.ItemEditor = ItemEditor;
|
|
13
464
|
//# sourceMappingURL=item-editor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item-editor.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"item-editor.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var index = require('../../index-8e5154bb.js');
|
|
6
6
|
var logger_logger = require('../../logger/logger.js');
|
|
7
|
+
var surveys_surveyEditor_itemEditor = require('./item-editor.js');
|
|
7
8
|
require('./component-editor.js');
|
|
8
9
|
require('../utils/randomKeyGenerator.js');
|
|
9
10
|
|
|
@@ -182,16 +183,16 @@ class SurveyEditor {
|
|
|
182
183
|
obj = this.survey.surveyDefinition;
|
|
183
184
|
continue;
|
|
184
185
|
}
|
|
185
|
-
if (!
|
|
186
|
+
if (!index.isSurveyGroupItem(obj)) {
|
|
186
187
|
console.warn('survey item is not a group: ', obj.key);
|
|
187
188
|
return;
|
|
188
189
|
}
|
|
189
|
-
const index = obj.items.findIndex(it => it.key === currentKey);
|
|
190
|
-
if (index < 0) {
|
|
190
|
+
const index$1 = obj.items.findIndex(it => it.key === currentKey);
|
|
191
|
+
if (index$1 < 0) {
|
|
191
192
|
console.warn('survey item cannot be found: ', currentKey);
|
|
192
193
|
return;
|
|
193
194
|
}
|
|
194
|
-
obj = obj.items[index];
|
|
195
|
+
obj = obj.items[index$1];
|
|
195
196
|
}
|
|
196
197
|
return obj;
|
|
197
198
|
}
|
|
@@ -222,7 +223,7 @@ class SurveyEditor {
|
|
|
222
223
|
}
|
|
223
224
|
changeItemKeyForSubtree(currentItem, newKey) {
|
|
224
225
|
currentItem = Object.assign({}, currentItem);
|
|
225
|
-
if (
|
|
226
|
+
if (index.isSurveyGroupItem(currentItem)) {
|
|
226
227
|
currentItem.items = currentItem.items.map(item => {
|
|
227
228
|
const newSubkey = newKey + '.' + item.key.slice(item.key.lastIndexOf('.') + 1);
|
|
228
229
|
return this.changeItemKeyForSubtree(item, newSubkey);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"survey-editor.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"survey-editor.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var constants_keyDefinitions = require('../constants/key-definitions.js');
|
|
6
6
|
var types_duration = require('../types/duration.js');
|
|
7
7
|
var expressionUtils_expressionGen = require('../expression-utils/expressionGen.js');
|
|
8
|
+
require('../index-8e5154bb.js');
|
|
9
|
+
require('../logger/logger.js');
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Logical OR expression
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"survey-engine-expressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"survey-engine-expressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
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('
|
|
6
|
+
var surveys_surveyEditor_itemEditor = require('./survey-editor/item-editor.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');
|
|
@@ -13,6 +13,7 @@ var surveys_surveyEngineExpressions = require('./survey-engine-expressions.js');
|
|
|
13
13
|
var surveys_types_itemProperties = require('./types/item-properties.js');
|
|
14
14
|
var surveys_responseTypeGenerators_optionGroupComponents = require('./responseTypeGenerators/optionGroupComponents.js');
|
|
15
15
|
var surveys_responseTypeGenerators_likertGroupComponents = require('./responseTypeGenerators/likertGroupComponents.js');
|
|
16
|
+
require('../index-8e5154bb.js');
|
|
16
17
|
require('./utils/randomKeyGenerator.js');
|
|
17
18
|
require('../logger/logger.js');
|
|
18
19
|
require('../expression-utils/expressionGen.js');
|
|
@@ -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,8 +3,9 @@
|
|
|
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('
|
|
6
|
+
var surveys_surveyEditor_itemEditor = require('../survey-editor/item-editor.js');
|
|
7
7
|
var surveys_utils_simpleGenerators = require('../utils/simple-generators.js');
|
|
8
|
+
require('../../index-8e5154bb.js');
|
|
8
9
|
require('../survey-editor/component-editor.js');
|
|
9
10
|
require('../utils/randomKeyGenerator.js');
|
|
10
11
|
require('./item-properties.js');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"group.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/surveys/types/index.js
CHANGED
|
@@ -7,7 +7,8 @@ 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('
|
|
10
|
+
require('../survey-editor/item-editor.js');
|
|
11
|
+
require('../../index-8e5154bb.js');
|
|
11
12
|
require('../survey-editor/component-editor.js');
|
|
12
13
|
require('../utils/randomKeyGenerator.js');
|
|
13
14
|
require('../utils/simple-generators.js');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,9 +3,10 @@
|
|
|
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('
|
|
6
|
+
var surveys_surveyEditor_itemEditor = require('../survey-editor/item-editor.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
|
+
require('../../index-8e5154bb.js');
|
|
9
10
|
require('../survey-editor/component-editor.js');
|
|
10
11
|
require('../utils/randomKeyGenerator.js');
|
|
11
12
|
require('./item-properties.js');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"survey-definition.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"survey-definition.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -7,6 +7,8 @@ var surveys_utils_randomKeyGenerator = require('./randomKeyGenerator.js');
|
|
|
7
7
|
require('../../constants/key-definitions.js');
|
|
8
8
|
require('../../types/duration.js');
|
|
9
9
|
require('../../expression-utils/expressionGen.js');
|
|
10
|
+
require('../../index-8e5154bb.js');
|
|
11
|
+
require('../../logger/logger.js');
|
|
10
12
|
|
|
11
13
|
const option = (key, content, extraProps) => {
|
|
12
14
|
const styles = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optionDefGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"optionDefGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,8 +3,9 @@
|
|
|
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('
|
|
6
|
+
var surveys_surveyEditor_itemEditor = require('../survey-editor/item-editor.js');
|
|
7
7
|
var surveys_utils_simpleGenerators = require('./simple-generators.js');
|
|
8
|
+
require('../../index-8e5154bb.js');
|
|
8
9
|
require('../survey-editor/component-editor.js');
|
|
9
10
|
require('./randomKeyGenerator.js');
|
|
10
11
|
require('../../logger/logger.js');
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/types/studyRules.js
CHANGED
|
@@ -6,6 +6,8 @@ var expressionUtils_studyEngineExpressions = require('../expression-utils/studyE
|
|
|
6
6
|
require('../constants/key-definitions.js');
|
|
7
7
|
require('./duration.js');
|
|
8
8
|
require('../expression-utils/expressionGen.js');
|
|
9
|
+
require('../index-8e5154bb.js');
|
|
10
|
+
require('../logger/logger.js');
|
|
9
11
|
|
|
10
12
|
class StudyRules {
|
|
11
13
|
constructor(enterRules, submitRules, timerRules, mergeRules) {
|
package/types/studyRules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"studyRules.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"studyRules.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|