case-editor-tools 1.0.0-beta.23 → 1.0.0-beta.27

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.
@@ -15,8 +15,11 @@ export declare const NativeStudyEngineExpressions: {
15
15
  getSurveyKeyAssignedFrom: (surveyKey: string) => Expression;
16
16
  getSurveyKeyAssignedUntil: (surveyKey: string) => Expression;
17
17
  hasStudyStatus: (status: string) => Expression;
18
- hasParticipantFlag: (key: string, value: string) => Expression;
18
+ hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
19
+ hasParticipantFlagKey: (key: string) => Expression;
19
20
  lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string | undefined) => Expression;
21
+ hasMessageTypeAssigned: (messageType: string) => Expression;
22
+ getMessageNextTime: (messageType: string) => Expression;
20
23
  };
21
24
  eq: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
22
25
  lt: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
@@ -34,7 +37,7 @@ export declare const StudyEngineActions: {
34
37
  ifThen: (condition: Expression, ...args: Expression[]) => Expression;
35
38
  participantActions: {
36
39
  updateStudyStatus: (status: string) => Expression;
37
- updateFlag: (key: string, newValue: string) => Expression;
40
+ updateFlag: (key: string, newValue: string | number | Expression) => Expression;
38
41
  removeFlag: (key: string) => Expression;
39
42
  assignedSurveys: {
40
43
  add: (surveyKey: string, category: 'immediate' | 'prio' | 'normal' | 'optional', activeFrom?: number | Expression | undefined, activeUntil?: number | Expression | undefined) => Expression;
@@ -46,6 +49,11 @@ export declare const StudyEngineActions: {
46
49
  removeAll: () => Expression;
47
50
  remove: (surveyKey: string, selector: 'first' | 'last' | 'all') => Expression;
48
51
  };
52
+ messages: {
53
+ add: (messageType: string, scheduledFor: number | Expression) => Expression;
54
+ removeAll: () => Expression;
55
+ remove: (messageType: string) => Expression;
56
+ };
49
57
  stopParticipation: () => Expression;
50
58
  finishParticipation: () => Expression;
51
59
  };
@@ -65,12 +73,22 @@ export declare const StudyEngine: {
65
73
  validFromOlderThan: (surveyKey: string, delta: Duration, reference?: number | Expression | undefined) => Expression;
66
74
  validUntilSoonerThan: (surveyKey: string, delta: Duration, reference?: number | Expression | undefined) => Expression;
67
75
  };
76
+ prefillRules: {
77
+ GET_LAST_SURVEY_ITEM: (surveyKey: string, itemKey: string, submittedLaterThan?: Duration | undefined) => Expression;
78
+ };
79
+ contextRules: {
80
+ previousResponses: {
81
+ LAST_RESPONSES_BY_KEY: (surveyKey: string, limit: number) => Expression;
82
+ ALL_RESPONSES_SINCE: (sinceTimestamp: number) => Expression;
83
+ RESPONSES_SINCE_BY_KEY: (sinceTimestamp: number, surveyKey: string) => Expression;
84
+ };
85
+ };
68
86
  if: (condition: Expression, actionIfTrue: Expression, actionIfFalse?: Expression | undefined) => Expression;
69
87
  do: (...args: Expression[]) => Expression;
70
88
  ifThen: (condition: Expression, ...args: Expression[]) => Expression;
71
89
  participantActions: {
72
90
  updateStudyStatus: (status: string) => Expression;
73
- updateFlag: (key: string, newValue: string) => Expression;
91
+ updateFlag: (key: string, newValue: string | number | Expression) => Expression;
74
92
  removeFlag: (key: string) => Expression;
75
93
  assignedSurveys: {
76
94
  add: (surveyKey: string, category: 'immediate' | 'prio' | 'normal' | 'optional', activeFrom?: number | Expression | undefined, activeUntil?: number | Expression | undefined) => Expression;
@@ -82,6 +100,11 @@ export declare const StudyEngine: {
82
100
  removeAll: () => Expression;
83
101
  remove: (surveyKey: string, selector: 'first' | 'last' | 'all') => Expression;
84
102
  };
103
+ messages: {
104
+ add: (messageType: string, scheduledFor: number | Expression) => Expression;
105
+ removeAll: () => Expression;
106
+ remove: (messageType: string) => Expression;
107
+ };
85
108
  stopParticipation: () => Expression;
86
109
  finishParticipation: () => Expression;
87
110
  };
@@ -99,8 +122,11 @@ export declare const StudyEngine: {
99
122
  getSurveyKeyAssignedFrom: (surveyKey: string) => Expression;
100
123
  getSurveyKeyAssignedUntil: (surveyKey: string) => Expression;
101
124
  hasStudyStatus: (status: string) => Expression;
102
- hasParticipantFlag: (key: string, value: string) => Expression;
125
+ hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
126
+ hasParticipantFlagKey: (key: string) => Expression;
103
127
  lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string | undefined) => Expression;
128
+ hasMessageTypeAssigned: (messageType: string) => Expression;
129
+ getMessageNextTime: (messageType: string) => Expression;
104
130
  };
105
131
  eq: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
106
132
  lt: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
@@ -86,12 +86,30 @@ const getSurveyKeyAssignedUntil = (surveyKey) => expressionUtils_expressionGen.g
86
86
  */
87
87
  const hasStudyStatus = (status) => expressionUtils_expressionGen.generateExpression('getSurveyKeyAssignedUntil', undefined, status);
88
88
  /**
89
- * Check if a participant flag is present
89
+ * Check if a participant flag with specific value is present
90
90
  * @param key look up this flag
91
91
  * @param value and for this value
92
92
  * @returns return true if key - value pair (with case sensitive matching for both key and value) is present. If any of the two is different, or participant flags is empty, it returns false.
93
93
  */
94
- const hasParticipantFlag = (key, value) => expressionUtils_expressionGen.generateExpression('hasParticipantFlag', undefined, key, value);
94
+ const hasParticipantFlagKeyAndValue = (key, value) => expressionUtils_expressionGen.generateExpression('hasParticipantFlag', undefined, key, value);
95
+ /**
96
+ * Check if a participant flag is present
97
+ * @param key look up this flag
98
+ * @returns return true if key is present. If any of the two is different, or participant flags is empty, it returns false.
99
+ */
100
+ const hasParticipantFlagKey = (key) => expressionUtils_expressionGen.generateExpression('hasParticipantFlagKey', undefined, key);
101
+ /**
102
+ * Checks if the participant has a message type assigned (at least one)
103
+ * @param messageType
104
+ * @returns return true if a message with the given message type is assigned
105
+ */
106
+ const hasMessageTypeAssigned = (messageType) => expressionUtils_expressionGen.generateExpression('hasMessageTypeAssigned', undefined, messageType);
107
+ /**
108
+ * Retrieve the timestamp (scheduledFor) for a particular message type. Return 0 if not assigned.
109
+ * @param messageType
110
+ * @returns timestamp value or zero
111
+ */
112
+ const getMessageNextTime = (messageType) => expressionUtils_expressionGen.generateExpression('getMessageNextTime', undefined, messageType);
95
113
  /**
96
114
  * Check if the last submission is older than the reference timestamp
97
115
  * @param reference look up this flag
@@ -141,13 +159,31 @@ const UPDATE_STUDY_STATUS = (status) => expressionUtils_expressionGen.generateEx
141
159
  /**
142
160
  * Add or update a participant flag
143
161
  * @param key
144
- * @param newValue
162
+ * @param newValue: string, number or expression where result should be written in the flag's value
145
163
  * @returns
146
164
  */
147
165
  const UPDATE_FLAG = (key, newValue) => expressionUtils_expressionGen.generateExpression('UPDATE_FLAG', undefined, key, newValue);
148
166
  const REMOVE_FLAG = (key) => expressionUtils_expressionGen.generateExpression('REMOVE_FLAG', undefined, key);
149
167
  const ADD_NEW_SURVEY = (surveyKey, category, activeFrom, activeUntil) => expressionUtils_expressionGen.generateExpression('ADD_NEW_SURVEY', undefined, surveyKey, activeFrom !== undefined ? activeFrom : 0, activeUntil !== undefined ? activeUntil : 0, category);
150
168
  const REMOVE_ALL_SURVEYS = () => expressionUtils_expressionGen.generateExpression('REMOVE_ALL_SURVEYS');
169
+ /**
170
+ * Add participant message
171
+ * @param messageType message type
172
+ * @param scheduledFor timestamp or expression returning a timestamp
173
+ * @returns
174
+ */
175
+ const ADD_MESSAGE = (messageType, scheduledFor) => expressionUtils_expressionGen.generateExpression('ADD_MESSAGE', undefined, messageType, scheduledFor);
176
+ /**
177
+ * Remove all messages scheduled for the participant
178
+ * @returns
179
+ */
180
+ const REMOVE_ALL_MESSAGES = () => expressionUtils_expressionGen.generateExpression('REMOVE_ALL_MESSAGES', undefined);
181
+ /**
182
+ * Remove all messages with this message type
183
+ * @param messageType message type
184
+ * @returns
185
+ */
186
+ const REMOVE_MESSAGES_BY_TYPE = (messageType) => expressionUtils_expressionGen.generateExpression('REMOVE_MESSAGES_BY_TYPE', undefined, messageType);
151
187
  /**
152
188
  * When submitting the response, item response with the given key would be added to the report array
153
189
  * @param itemKey find and add this item to the report array
@@ -172,6 +208,22 @@ const REMOVE_REPORT_BY_KEY = (surveyKey, selector) => {
172
208
  }
173
209
  };
174
210
  // ##################
211
+ // Prefill rule methods:
212
+ const GET_LAST_SURVEY_ITEM = (surveyKey, itemKey, submittedLaterThan) => {
213
+ return expressionUtils_expressionGen.generateExpression('GET_LAST_SURVEY_ITEM', undefined, surveyKey, itemKey, submittedLaterThan ? types_duration.durationObjectToSeconds(submittedLaterThan) : undefined);
214
+ };
215
+ // ##################
216
+ // Context previous responses methods:
217
+ const LAST_RESPONSES_BY_KEY = (surveyKey, limit) => {
218
+ return expressionUtils_expressionGen.generateExpression('LAST_RESPONSES_BY_KEY', undefined, surveyKey, limit);
219
+ };
220
+ const ALL_RESPONSES_SINCE = (sinceTimestamp) => {
221
+ return expressionUtils_expressionGen.generateExpression('ALL_RESPONSES_SINCE', undefined, sinceTimestamp);
222
+ };
223
+ const RESPONSES_SINCE_BY_KEY = (sinceTimestamp, surveyKey) => {
224
+ return expressionUtils_expressionGen.generateExpression('RESPONSES_SINCE_BY_KEY', undefined, sinceTimestamp, surveyKey);
225
+ };
226
+ // ##################
175
227
  // Extra methods:
176
228
  const singleChoiceOptionsSelected = (itemKey, ...optionKeys) => expressionUtils_expressionGen.generateExpression('responseHasKeysAny', undefined, itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.singleChoiceKey].join('.'), ...optionKeys);
177
229
  const multipleChoiceOptionsSelected = (itemKey, ...optionKeys) => expressionUtils_expressionGen.generateExpression('responseHasKeysAny', undefined, itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.multipleChoiceKey].join('.'), ...optionKeys);
@@ -226,8 +278,11 @@ const NativeStudyEngineExpressions = {
226
278
  getSurveyKeyAssignedFrom,
227
279
  getSurveyKeyAssignedUntil,
228
280
  hasStudyStatus,
229
- hasParticipantFlag,
281
+ hasParticipantFlagKeyAndValue,
282
+ hasParticipantFlagKey,
230
283
  lastSubmissionDateOlderThan,
284
+ hasMessageTypeAssigned,
285
+ getMessageNextTime,
231
286
  },
232
287
  // logical and comparision
233
288
  eq,
@@ -259,6 +314,11 @@ const StudyEngineActions = {
259
314
  removeAll: REMOVE_ALL_REPORTS,
260
315
  remove: REMOVE_REPORT_BY_KEY,
261
316
  },
317
+ messages: {
318
+ add: ADD_MESSAGE,
319
+ removeAll: REMOVE_ALL_MESSAGES,
320
+ remove: REMOVE_MESSAGES_BY_TYPE,
321
+ },
262
322
  // Extra methods:
263
323
  stopParticipation,
264
324
  finishParticipation,
@@ -275,6 +335,14 @@ const StudyEngine = Object.assign(Object.assign(Object.assign({}, NativeStudyEng
275
335
  isActive: hasSurveyKeyActive,
276
336
  validFromOlderThan: hasSurveyKeyValidFromOlderThan,
277
337
  validUntilSoonerThan: hasSurveyKeyValidUntilSoonerThan,
338
+ }, prefillRules: {
339
+ GET_LAST_SURVEY_ITEM,
340
+ }, contextRules: {
341
+ previousResponses: {
342
+ LAST_RESPONSES_BY_KEY,
343
+ ALL_RESPONSES_SINCE,
344
+ RESPONSES_SINCE_BY_KEY,
345
+ }
278
346
  } });
279
347
 
280
348
  exports.NativeStudyEngineExpressions = NativeStudyEngineExpressions;
@@ -1 +1 @@
1
- {"version":3,"file":"studyEngineExpressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"studyEngineExpressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "case-editor-tools",
3
3
  "description": "Javascript tools to simplify survey and study coding for CASE.",
4
- "version": "1.0.0-beta.23",
4
+ "version": "1.0.0-beta.27",
5
5
  "main": "index.js",
6
6
  "license": "Apache-2.0",
7
7
  "repository": "github:case-framework/case-editor-tools",
8
8
  "devDependencies": {
9
9
  "@rollup/plugin-commonjs": "^21.0.1",
10
- "@rollup/plugin-node-resolve": "^13.1.1",
10
+ "@rollup/plugin-node-resolve": "^13.1.3",
11
11
  "rollup": "^2.61.1",
12
12
  "rollup-plugin-copy": "^3.4.0",
13
13
  "rollup-plugin-delete": "^2.0.0",
@@ -20,6 +20,6 @@
20
20
  "build": "rollup -c"
21
21
  },
22
22
  "dependencies": {
23
- "survey-engine": "^1.0.2"
23
+ "survey-engine": "^1.0.3"
24
24
  }
25
25
  }
@@ -22,6 +22,7 @@ export declare const NativeSurveyEngineExpressions: {
22
22
  isDefined: (arg: Expression) => Expression;
23
23
  hasResponse: (itemKey: string, responseKey: string) => Expression;
24
24
  getResponseItem: (itemKey: string, responseKey: string) => Expression;
25
+ parseValueAsNum: (valueRef: Expression) => Expression;
25
26
  getResponseValueAsNum: (itemKey: string, responseKey: string) => Expression;
26
27
  getResponseValueAsStr: (itemKey: string, responseKey: string) => Expression;
27
28
  checkResponseValueWithRegex: (itemKey: string, responseKey: string, regexPattern: string) => Expression;
@@ -72,7 +73,11 @@ export declare const SurveyEngine: {
72
73
  datePicker: {
73
74
  get: (itemKey: string) => Expression;
74
75
  };
75
- hasParticipantFlag: (key: string, value: string) => Expression;
76
+ participantFlags: {
77
+ hasKey: (key: string, value: string) => Expression;
78
+ hasKeyAndValue: (key: string, value: string) => Expression;
79
+ getAsNum: (key: string) => Expression;
80
+ };
76
81
  getters: {
77
82
  getContext: () => Expression;
78
83
  getResponses: () => Expression;
@@ -94,6 +99,7 @@ export declare const SurveyEngine: {
94
99
  isDefined: (arg: Expression) => Expression;
95
100
  hasResponse: (itemKey: string, responseKey: string) => Expression;
96
101
  getResponseItem: (itemKey: string, responseKey: string) => Expression;
102
+ parseValueAsNum: (valueRef: Expression) => Expression;
97
103
  getResponseValueAsNum: (itemKey: string, responseKey: string) => Expression;
98
104
  getResponseValueAsStr: (itemKey: string, responseKey: string) => Expression;
99
105
  checkResponseValueWithRegex: (itemKey: string, responseKey: string, regexPattern: string) => Expression;
@@ -61,6 +61,14 @@ const gte = (val1, val2) => expressionUtils_expressionGen.generateExpression('gt
61
61
  * @returns
62
62
  */
63
63
  const timestampWithOffset = (delta, reference) => expressionUtils_expressionGen.generateExpression('timestampWithOffset', undefined, types_duration.durationObjectToSeconds(delta), reference ? reference : undefined);
64
+ /**
65
+ * Parse the result of an expression as a number
66
+ * @param valueRef expression that returns a string with the value that should be parsed
67
+ * @returns expression that returns the value or undefined
68
+ */
69
+ const parseValueAsNum = (valueRef) => {
70
+ return expressionUtils_expressionGen.generateExpression('parseValueAsNum', 'float', valueRef);
71
+ };
64
72
  /**
65
73
  * Extract value from a response if exits parsed as a number
66
74
  * @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
@@ -286,13 +294,29 @@ const getSurveyItemValidation = (itemKey, validationKey) => {
286
294
  const dateResponseDiffFromNow = (itemKey, responseKey, unit, ignoreSign) => {
287
295
  return expressionUtils_expressionGen.generateExpression('dateResponseDiffFromNow', undefined, itemKey, responseKey, unit, ignoreSign ? 1 : undefined);
288
296
  };
297
+ /**
298
+ * Check participant flags object if contains the specified key value pair
299
+ * @param key retrieve participant flag's value for this key
300
+ * @returns
301
+ */
302
+ const parseParticipantFlagAsNum = (key) => {
303
+ return parseValueAsNum(getAttribute(getAttribute(getContext(), 'participantFlags'), key));
304
+ };
305
+ /**
306
+ * Check participant flags object if contains the specified key value pair
307
+ * @param key retrieve participant flag's value for this key
308
+ * @returns
309
+ */
310
+ const hasParticipantFlagKey = (key, value) => {
311
+ return isDefined(getAttribute(getAttribute(getContext(), 'participantFlags'), key));
312
+ };
289
313
  /**
290
314
  * Check participant flags object if contains the specified key value pair
291
315
  * @param key retrieve participant flag's value for this key
292
316
  * @param value string value to be checked for a match
293
317
  * @returns
294
318
  */
295
- const hasParticipantFlag = (key, value) => {
319
+ const hasParticipantFlagKeyAndValue = (key, value) => {
296
320
  return eq(getAttribute(getAttribute(getContext(), 'participantFlags'), key), value);
297
321
  };
298
322
  /**
@@ -355,6 +379,7 @@ const NativeSurveyEngineExpressions = {
355
379
  isDefined,
356
380
  hasResponse,
357
381
  getResponseItem,
382
+ parseValueAsNum,
358
383
  getResponseValueAsNum,
359
384
  getResponseValueAsStr,
360
385
  checkResponseValueWithRegex,
@@ -400,7 +425,11 @@ const SurveyEngine = Object.assign(Object.assign({}, NativeSurveyEngineExpressio
400
425
  regexCheck: multilineTextInputRegexCheck,
401
426
  }, datePicker: {
402
427
  get: getDatePickerResponseValue,
403
- }, hasParticipantFlag });
428
+ }, participantFlags: {
429
+ hasKey: hasParticipantFlagKey,
430
+ hasKeyAndValue: hasParticipantFlagKeyAndValue,
431
+ getAsNum: parseParticipantFlagAsNum,
432
+ } });
404
433
 
405
434
  exports.NativeSurveyEngineExpressions = NativeSurveyEngineExpressions;
406
435
  exports.SurveyEngine = SurveyEngine;
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -16,7 +16,8 @@ export declare abstract class SurveyDefinition {
16
16
  abstract buildSurvey(): void;
17
17
  getSurvey(): import("survey-engine/data_types").Survey;
18
18
  getSurveyJSON(pretty?: boolean): string;
19
- addItem(item: SurveyItem): void;
19
+ addItem(item: SurveyItem, pageBreakAfter?: boolean): void;
20
+ addPageBreak(): void;
20
21
  addSurveyItemToPath(item: SurveyItem, parentKey: string): void;
21
22
  private checkDuplicateChildKeys;
22
23
  }
@@ -34,8 +34,14 @@ class SurveyDefinition {
34
34
  this.checkDuplicateChildKeys();
35
35
  return this.editor.getSurveyJSON(pretty);
36
36
  }
37
- addItem(item) {
37
+ addItem(item, pageBreakAfter) {
38
38
  this.editor.addExistingSurveyItem(item, this.key);
39
+ if (pageBreakAfter) {
40
+ this.addPageBreak();
41
+ }
42
+ }
43
+ addPageBreak() {
44
+ this.editor.addExistingSurveyItem(surveys_utils_simpleGenerators.generatePageBreak(this.key), this.key);
39
45
  }
40
46
  addSurveyItemToPath(item, parentKey) {
41
47
  this.editor.addExistingSurveyItem(item, parentKey);
@@ -1 +1 @@
1
- {"version":3,"file":"survey-definition.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"survey-definition.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}